- Timestamp:
- 2006-09-20T20:31:44Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 28ecadb
- Parents:
- 61e90dd
- Location:
- boot/genarch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/genarch/ofw.c
r61e90dd r16529d5 115 115 } 116 116 117 int ofw_get_property(const phandle device, const char *name, constvoid *buf, const int buflen)117 int ofw_get_property(const phandle device, const char *name, void *buf, const int buflen) 118 118 { 119 119 return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen); … … 128 128 { 129 129 return ofw_call("nextprop", 3, 1, NULL, device, previous, buf); 130 } 131 132 int ofw_package_to_path(const phandle device, char *buf, const int buflen) 133 { 134 return ofw_call("package-to-path", 3, 1, NULL, device, buf, buflen); 130 135 } 131 136 -
boot/genarch/ofw.h
r61e90dd r16529d5 103 103 extern void ofw_write(const char *str, const int len); 104 104 105 extern int ofw_get_property(const phandle device, const char *name, constvoid *buf, const int buflen);105 extern int ofw_get_property(const phandle device, const char *name, void *buf, const int buflen); 106 106 extern int ofw_get_proplen(const phandle device, const char *name); 107 107 extern int ofw_next_property(const phandle device, char *previous, char *buf); … … 110 110 extern phandle ofw_get_peer_node(const phandle node); 111 111 extern phandle ofw_find_device(const char *name); 112 113 extern int ofw_package_to_path(const phandle device, char *buf, const int buflen); 112 114 113 115 extern int ofw(ofw_args_t *arg); -
boot/genarch/ofw_tree.c
r61e90dd r16529d5 32 32 #include <string.h> 33 33 #include <balloc.h> 34 #include <asm.h> 35 36 #define MAX_PATH_LEN 256 34 37 35 38 static ofw_tree_node_t *ofw_tree_node_alloc(void) … … 62 65 ofw_tree_node_t *parent_node, phandle current) 63 66 { 67 static char path[MAX_PATH_LEN+1]; 68 static char name[OFW_TREE_PROPERTY_MAX_NAMELEN]; 64 69 phandle peer; 65 70 phandle child; 66 71 unsigned properties = 0; 67 char name[OFW_TREE_PROPERTY_MAX_NAMELEN]; 72 size_t len; 73 int i; 68 74 69 75 /* … … 77 83 78 84 /* 85 * Get the disambigued name. 86 */ 87 len = ofw_package_to_path(current, path, MAX_PATH_LEN); 88 if (len == -1) 89 return; 90 91 path[len] = '\0'; 92 for (i = len - 1; i >= 0 && path[i] != '/'; i--) 93 ; 94 i++; /* do not include '/' */ 95 96 len -= i; 97 current_node->da_name = ofw_tree_space_alloc(len + 1); /* add space for trailing '\0' */ 98 if (!current_node->da_name) 99 return; 100 101 memcpy(current_node->da_name, &path[i], len); 102 current_node->da_name[len] = '\0'; 103 104 /* 79 105 * Recursively process the potential peer node. 80 106 */ … … 85 111 peer_node = ofw_tree_node_alloc(); 86 112 if (peer_node) { 87 ofw_tree_node_process(peer_node, current_node, peer);113 ofw_tree_node_process(peer_node, parent_node, peer); 88 114 current_node->peer = peer_node; 89 115 } … … 121 147 return; 122 148 123 int i = 0;124 125 149 name[0] = '\0'; 126 150 for (i = 0; ofw_next_property(current, name, name) == 1; i++) { -
boot/genarch/ofw_tree.h
r61e90dd r16529d5 44 44 ofw_tree_node_t *child; 45 45 46 char *da_name; /**< Disambigued name. */ 47 46 48 unsigned properties; /**< Number of properties. */ 47 49 ofw_tree_property_t *property;
Note:
See TracChangeset
for help on using the changeset viewer.