Changeset 28ecadb in mainline for boot/genarch/ofw_tree.c


Ignore:
Timestamp:
2006-09-22T21:44:54Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d684e4
Parents:
16529d5
Message:

Convert sparc64 to detect keyboard and determine
its physical address by walking the memory representation
of the OpenFirmware device tree.

Add bus-specific functions that know how to apply the
"ranges" property to one component of the "reg" property.
Buses supported so far include FHC, EBUS and PCI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/ofw_tree.c

    r16529d5 r28ecadb  
    4848static void * ofw_tree_space_alloc(size_t size)
    4949{
    50         return balloc(size, size);
     50        char *addr;
     51
     52        /*
     53         * What we do here is a nasty hack :-)
     54         * Problem: string property values that are allocated via this
     55         * function typically do not contain the trailing '\0'. This
     56         * is very uncomfortable for kernel, which is supposed to deal
     57         * with the properties.
     58         * Solution: when allocating space via this function, we always
     59         * allocate space for the extra '\0' character that we store
     60         * behind the requested memory.
     61         */
     62        addr = balloc(size + 1, size);
     63        if (addr)
     64                addr[size] = '\0';
     65        return addr;
    5166}
    5267
     
    154169                        break;
    155170               
    156                 strncpy(current_node->property[i].name, name, sizeof(name));
     171                memcpy(current_node->property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN);
     172                current_node->property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN] = '\0';
    157173
    158174                size = ofw_get_proplen(current, name);
Note: See TracChangeset for help on using the changeset viewer.