Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 25a76ab8 in mainline for boot/genarch/src/ofw_tree.c


Ignore:
Timestamp:
2010-05-08T07:53:23Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
051bc69a
Parents:
6c39a907 (diff), 1317380 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • boot/genarch/src/ofw_tree.c

    r6c39a907 r25a76ab8  
    2727 */
    2828
    29 #include <ofw_tree.h>
    30 #include <ofw.h>
    31 #include <ofwarch.h>
    32 #include <types.h>
    33 #include <string.h>
     29#include <genarch/ofw_tree.h>
     30#include <genarch/ofw.h>
     31#include <arch/ofw.h>
     32#include <typedefs.h>
     33#include <str.h>
    3434#include <balloc.h>
    35 #include <asm.h>
    3635#include <memstr.h>
    3736
     37static char path[OFW_TREE_PATH_MAX_LEN + 1];
     38static char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
     39static char name2[OFW_TREE_PROPERTY_MAX_NAMELEN];
     40
    3841static ofw_tree_node_t *ofw_tree_node_alloc(void)
    3942{
     
    4144}
    4245
    43 static ofw_tree_property_t *ofw_tree_properties_alloc(unsigned count)
     46static ofw_tree_property_t *ofw_tree_properties_alloc(size_t count)
    4447{
    4548        return balloc(count * sizeof(ofw_tree_property_t),
     
    5962         * behind the requested memory.
    6063         */
    61         char *addr = balloc(size + 1, size);
     64        char *addr = balloc(size + 1, 4);
    6265        if (addr)
    6366                addr[size] = '\0';
     
    99102                 * Get the disambigued name.
    100103                 */
    101                 static char path[OFW_TREE_PATH_MAX_LEN + 1];
    102104                size_t len = ofw_package_to_path(current, path, OFW_TREE_PATH_MAX_LEN);
    103                 if (len == -1)
     105                if (len == (size_t) -1)
    104106                        return;
    105107               
     
    107109               
    108110                /* Find last slash */
    109                 int i;
    110                 for (i = len - 1; (i >= 0) && (path[i] != '/'); i--);
     111                size_t i;
     112                for (i = len; (i > 0) && (path[i - 1] != '/'); i--);
    111113               
    112114                /* Do not include the slash */
    113                 i++;
    114115                len -= i;
    115116               
     
    127128                 */
    128129                phandle child = ofw_get_child_node(current);
    129                 if ((child != 0) && (child != -1)) {
     130                if ((child != 0) && (child != (phandle) -1)) {
    130131                        ofw_tree_node_t *child_node = ofw_tree_node_alloc();
    131132                        if (child_node) {
     
    140141                 * Count properties.
    141142                 */
    142                 static char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
    143                 static char name2[OFW_TREE_PROPERTY_MAX_NAMELEN];
    144143                name[0] = '\0';
    145144                while (ofw_next_property(current, name, name2) == 1) {
     
    188187                current_node->property = (ofw_tree_property_t *) balloc_rebase(property);
    189188               
    190                
    191189                /*
    192190                 * Iteratively process the next peer node.
     
    197195                 */
    198196                phandle peer = ofw_get_peer_node(current);
    199                 if ((peer != 0) && (peer != -1)) {
     197                if ((peer != 0) && (peer != (phandle) -1)) {
    200198                        ofw_tree_node_t *peer_node = ofw_tree_node_alloc();
    201199                        if (peer_node) {
     
    234232         */
    235233        phandle ssm_node = ofw_find_device("/ssm@0,0");
    236         if (ssm_node != -1) {
     234        if (ssm_node != (phandle) -1) {
    237235                ofw_tree_node_t *ssm = ofw_tree_node_alloc();
    238236                if (ssm) {
Note: See TracChangeset for help on using the changeset viewer.