1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 #include "libiberty.h"
50 /* manipulate/lookup device names */
52 typedef struct _name_specifier {
53 /* components in the full length name */
73 /* Given a device specifier, break it up into its main components:
74 path (and if present) property name and property value. */
78 split_device_specifier(device *current,
79 const char *device_specifier,
84 /* expand any leading alias if present */
86 && *device_specifier != '\0'
87 && *device_specifier != '.'
88 && *device_specifier != '/') {
89 device *aliases = tree_find_device(current, "/aliases");
92 while (device_specifier[len] != '\0'
93 && device_specifier[len] != '/'
94 && device_specifier[len] != ':'
95 && !isspace(device_specifier[len])) {
96 alias[len] = device_specifier[len];
98 if (len >= sizeof(alias))
99 error("split_device_specifier: buffer overflow");
103 && device_find_property(aliases, alias)) {
104 strcpy(spec->buf, device_find_string_property(aliases, alias));
105 strcat(spec->buf, device_specifier + len);
108 strcpy(spec->buf, device_specifier);
112 strcpy(spec->buf, device_specifier);
115 /* check no overflow */
116 if (strlen(spec->buf) >= sizeof(spec->buf))
117 error("split_device_specifier: buffer overflow\n");
119 /* strip leading spaces */
121 while (*chp != '\0' && isspace(*chp))
126 /* find the path and terminate it with null */
128 while (*chp != '\0' && !isspace(*chp))
136 while (*chp != '\0' && isspace(*chp))
140 /* now go back and chop the property off of the path */
141 if (spec->value[0] == '\0') {
142 spec->property = NULL; /*not a property*/
145 else if (spec->value[0] == '>'
146 || spec->value[0] == '<') {
147 /* an interrupt spec */
148 spec->property = NULL;
151 chp = strrchr(spec->path, '/');
153 spec->property = spec->path;
154 spec->path = strchr(spec->property, '\0');
158 spec->property = chp+1;
162 /* and mark the rest as invalid */
167 spec->last_name = NULL;
168 spec->last_base = NULL;
169 spec->last_unit = NULL;
170 spec->last_args = NULL;
176 /* given a device specifier break it up into its main components -
177 path and property name - assuming that the last `device' is a
180 STATIC_INLINE_DEVICE\
182 split_property_specifier(device *current,
183 const char *property_specifier,
184 name_specifier *spec)
186 if (split_device_specifier(current, property_specifier, spec)) {
187 if (spec->property == NULL) {
188 /* force the last name to be a property name */
189 char *chp = strrchr(spec->path, '/');
191 spec->property = spec->path;
192 spec->path = strrchr(spec->property, '\0');;
196 spec->property = chp+1;
206 /* device the next device name and split it up, return 0 when no more
211 split_device_name(name_specifier *spec)
214 /* remember what came before */
215 spec->last_name = spec->name;
216 spec->last_base = spec->base;
217 spec->last_unit = spec->unit;
218 spec->last_args = spec->args;
220 if (spec->path[0] == '\0') {
227 /* break the current device spec from the path */
228 spec->name = spec->path;
229 chp = strchr(spec->name, '/');
231 spec->path = strchr(spec->name, '\0');
236 /* break out the base */
237 if (spec->name[0] == '(') {
238 chp = strchr(spec->name, ')');
240 spec->base = spec->name;
244 spec->base = spec->name + 1;
245 spec->name = chp + 1;
249 spec->base = spec->name;
251 /* now break out the unit */
252 chp = strchr(spec->name, '@');
262 /* finally any args */
263 chp = strchr(chp, ':');
274 /* device the value, returning the next non-space token */
278 split_value(name_specifier *spec)
281 if (spec->value == NULL)
283 /* skip leading white space */
284 while (isspace(spec->value[0]))
286 if (spec->value[0] == '\0') {
291 /* find trailing space */
292 while (spec->value[0] != '\0' && !isspace(spec->value[0]))
294 /* chop this value out */
295 if (spec->value[0] != '\0') {
296 spec->value[0] = '\0';
304 /* traverse the path specified by spec starting at current */
308 split_find_device(device *current,
309 name_specifier *spec)
311 /* strip off (and process) any leading ., .., ./ and / */
313 if (strncmp(spec->path, "/", strlen("/")) == 0) {
315 while (current != NULL && device_parent(current) != NULL)
316 current = device_parent(current);
317 spec->path += strlen("/");
319 else if (strncmp(spec->path, "./", strlen("./")) == 0) {
322 spec->path += strlen("./");
324 else if (strncmp(spec->path, "../", strlen("../")) == 0) {
326 if (current != NULL && device_parent(current) != NULL)
327 current = device_parent(current);
328 spec->path += strlen("../");
330 else if (strcmp(spec->path, ".") == 0) {
333 spec->path += strlen(".");
335 else if (strcmp(spec->path, "..") == 0) {
337 if (current != NULL && device_parent(current) != NULL)
338 current = device_parent(current);
339 spec->path += strlen("..");
345 /* now go through the path proper */
347 if (current == NULL) {
348 split_device_name(spec);
352 while (split_device_name(spec)) {
354 for (child = device_child(current);
355 child != NULL; child = device_sibling(child)) {
356 if (strcmp(spec->name, device_name(child)) == 0) {
357 if (spec->unit == NULL)
361 device_decode_unit(current, spec->unit, &phys);
362 if (memcmp(&phys, device_unit_address(child),
363 sizeof(device_unit)) == 0)
369 return current; /* search failed */
379 split_fill_path(device *current,
380 const char *device_specifier,
381 name_specifier *spec)
384 if (!split_device_specifier(current, device_specifier, spec))
385 device_error(current, "error parsing %s\n", device_specifier);
387 /* fill our tree with its contents */
388 current = split_find_device(current, spec);
390 /* add any additional devices as needed */
391 if (spec->name != NULL) {
393 current = device_create(current, spec->base, spec->name,
394 spec->unit, spec->args);
395 } while (split_device_name(spec));
404 tree_init(device *root,
407 TRACE(trace_device_tree, ("tree_init(root=0x%lx, system=0x%lx)\n",
410 /* remove the old, rebuild the new */
411 tree_traverse(root, device_clean, NULL, system);
412 tree_traverse(root, device_init_static_properties, NULL, system);
413 tree_traverse(root, device_init_address, NULL, system);
414 tree_traverse(root, device_init_runtime_properties, NULL, system);
415 tree_traverse(root, device_init_data, NULL, system);
420 /* <non-white-space> */
424 skip_token(const char *chp)
426 while (!isspace(*chp) && *chp != '\0')
428 while (isspace(*chp) && *chp != '\0')
434 /* count the number of entries */
438 count_entries(device *current,
439 const char *property_name,
440 const char *property_value,
443 const char *chp = property_value;
445 while (*chp != '\0') {
447 chp = skip_token(chp);
449 if ((nr_entries % modulo) != 0) {
450 device_error(current, "incorrect number of entries for %s property %s, should be multiple of %d",
451 property_name, property_value, modulo);
453 return nr_entries / modulo;
458 /* parse: <address> ::= <token> ; device dependant */
462 parse_address(device *current,
465 device_unit *address)
467 ASSERT(device_nr_address_cells(bus) > 0);
468 if (device_decode_unit(bus, chp, address) < 0)
469 device_error(current, "invalid unit address in %s", chp);
470 return skip_token(chp);
474 /* parse: <size> ::= <number> { "," <number> } ; */
478 parse_size(device *current,
485 const char *curr = chp;
486 memset(size, 0, sizeof(*size));
487 /* parse the numeric list */
488 size->nr_cells = device_nr_size_cells(bus);
490 ASSERT(size->nr_cells > 0);
493 size->cells[nr] = strtoul(curr, &next, 0);
495 device_error(current, "Problem parsing <size> %s", chp);
499 if (nr == size->nr_cells)
500 device_error(current, "Too many values in <size> %s", chp);
503 ASSERT(nr > 0 && nr <= size->nr_cells);
504 /* right align the numbers */
505 for (i = 1; i <= size->nr_cells; i++) {
507 size->cells[size->nr_cells - i] = size->cells[nr - i];
509 size->cells[size->nr_cells - i] = 0;
511 return skip_token(chp);
515 /* parse: <reg> ::= { <address> <size> } ; */
519 parse_reg_property(device *current,
520 const char *property_name,
521 const char *property_value)
525 reg_property_spec *regs;
527 device *bus = device_parent(current);
529 /* determine the number of reg entries by counting tokens */
530 nr_regs = count_entries(current, property_name, property_value,
531 1 + (device_nr_size_cells(bus) > 0));
533 /* create working space */
534 regs = zalloc(nr_regs * sizeof(*regs));
537 chp = property_value;
538 for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) {
539 chp = parse_address(current, bus, chp, ®s[reg_nr].address);
540 if (device_nr_size_cells(bus) > 0)
541 chp = parse_size(current, bus, chp, ®s[reg_nr].size);
543 memset(®s[reg_nr].size, 0, sizeof (®s[reg_nr].size));
547 device_add_reg_array_property(current, property_name,
554 /* { <child-address> <parent-address> <child-size> }* */
558 parse_ranges_property(device *current,
559 const char *property_name,
560 const char *property_value)
564 range_property_spec *ranges;
567 /* determine the number of ranges specified */
568 nr_ranges = count_entries(current, property_name, property_value, 3);
570 /* create a property of that size */
571 ranges = zalloc(nr_ranges * sizeof(*ranges));
574 chp = property_value;
575 for (range_nr = 0; range_nr < nr_ranges; range_nr++) {
576 chp = parse_address(current, current,
577 chp, &ranges[range_nr].child_address);
578 chp = parse_address(current, device_parent(current),
579 chp, &ranges[range_nr].parent_address);
580 chp = parse_size(current, current,
581 chp, &ranges[range_nr].size);
585 device_add_range_array_property(current, property_name, ranges, nr_ranges);
595 parse_integer_property(device *current,
596 const char *property_name,
597 const char *property_value)
600 unsigned_cell words[1024];
601 /* integer or integer array? */
605 words[nr_entries] = strtoul(property_value, &end, 0);
606 if (property_value == end)
609 if (nr_entries * sizeof(words[0]) >= sizeof(words))
610 device_error(current, "buffer overflow");
611 property_value = end;
614 device_error(current, "error parsing integer property %s (%s)",
615 property_name, property_value);
616 else if (nr_entries == 1)
617 device_add_integer_property(current, property_name, words[0]);
620 for (i = 0; i < nr_entries; i++) {
623 /* perhaps integer array property is better */
624 device_add_array_property(current, property_name, words,
625 sizeof(words[0]) * nr_entries);
629 /* PROPERTY_VALUE is a raw property value. Quote it as required by
630 parse_string_property. It is the caller's responsibility to free
631 the memory returned. */
635 tree_quote_property(const char *property_value)
642 /* Count characters needing quotes in PROPERTY_VALUE. */
644 for (chp = property_value; *chp; ++chp)
645 if (*chp == '\\' || *chp == '"')
648 ret = (char *) xmalloc (strlen (property_value)
651 + 1 /* terminator */);
654 /* Add the opening quote. */
656 /* Copy the value. */
657 for (chp = property_value; *chp; ++chp)
658 if (*chp == '\\' || *chp == '"')
660 /* Quote this character. */
666 /* Add the closing quote. */
668 /* Terminate the string. */
678 parse_string_property(device *current,
679 const char *property_name,
680 const char *property_value)
685 int approx_nr_strings;
687 /* get an estimate as to the number of strings by counting double
689 approx_nr_strings = 2;
690 for (chp = property_value; *chp; chp++) {
694 approx_nr_strings = (approx_nr_strings) / 2;
696 /* create a string buffer for that many (plus a null) */
697 strings = (char**)zalloc((approx_nr_strings + 1) * sizeof(char*));
699 /* now find all the strings */
700 chp = property_value;
704 /* skip leading space */
705 while (*chp != '\0' && isspace(*chp))
712 /* a quoted string - watch for '\' et.al. */
713 /* estimate the size and allocate space for it */
717 while (chp[pos] != '\0' && chp[pos] != '"') {
718 if (chp[pos] == '\\' && chp[pos+1] != '\0')
723 strings[nr_strings] = zalloc(pos + 1);
724 /* copy the string over */
726 while (*chp != '\0' && *chp != '"') {
727 if (*chp == '\\' && *(chp+1) != '\0') {
728 strings[nr_strings][pos] = *(chp+1);
733 strings[nr_strings][pos] = *chp;
740 strings[nr_strings][pos] = '\0';
743 /* copy over a single unquoted token */
745 while (chp[len] != '\0' && !isspace(chp[len]))
747 strings[nr_strings] = zalloc(len + 1);
748 strncpy(strings[nr_strings], chp, len);
749 strings[nr_strings][len] = '\0';
753 if (nr_strings > approx_nr_strings)
754 device_error(current, "String property %s badly formatted",
757 ASSERT(strings[nr_strings] == NULL); /* from zalloc */
761 device_add_string_property(current, property_name, "");
762 else if (nr_strings == 1)
763 device_add_string_property(current, property_name, strings[0]);
765 const char **specs = (const char**)strings; /* stop a bogus error */
766 device_add_string_array_property(current, property_name,
770 /* flush the created string */
771 while (nr_strings > 0) {
773 free(strings[nr_strings]);
779 /* <path-to-ihandle-device> */
783 parse_ihandle_property(device *current,
784 const char *property,
787 ihandle_runtime_property_spec ihandle;
789 /* pass the full path */
790 ihandle.full_path = value;
792 /* save this ready for the ihandle create */
793 device_add_ihandle_runtime_property(current, property,
801 tree_parse(device *current,
805 char device_specifier[1024];
808 /* format the path */
812 vsprintf(device_specifier, fmt, ap);
814 if (strlen(device_specifier) >= sizeof(device_specifier))
815 error("device_tree_add_deviced: buffer overflow\n");
818 /* construct the tree down to the final device */
819 current = split_fill_path(current, device_specifier, &spec);
821 /* is there an interrupt spec */
822 if (spec.property == NULL
823 && spec.value != NULL) {
824 char *op = split_value(&spec);
828 char *my_port_name = split_value(&spec);
830 char *dest_port_name = split_value(&spec);
832 name_specifier dest_spec;
833 char *dest_device_name = split_value(&spec);
836 my_port = device_interrupt_decode(current, my_port_name,
838 /* find the dest device and port */
839 dest = split_fill_path(current, dest_device_name, &dest_spec);
840 dest_port = device_interrupt_decode(dest, dest_port_name,
842 /* connect the two */
843 device_interrupt_attach(current,
851 device_error(current, "unreconised interrupt spec %s\n", spec.value);
856 /* is there a property */
857 if (spec.property != NULL) {
858 if (strcmp(spec.value, "true") == 0)
859 device_add_boolean_property(current, spec.property, 1);
860 else if (strcmp(spec.value, "false") == 0)
861 device_add_boolean_property(current, spec.property, 0);
863 const device_property *property;
864 switch (spec.value[0]) {
866 parse_ihandle_property(current, spec.property, spec.value + 1);
870 unsigned8 words[1024];
871 char *curr = spec.value + 1;
875 words[nr_words] = H2BE_1(strtoul(curr, &next, 0));
881 device_add_array_property(current, spec.property,
882 words, sizeof(words[0]) * nr_words);
886 parse_string_property(current, spec.property, spec.value);
890 property = tree_find_property(current, spec.value);
891 if (property == NULL)
892 device_error(current, "property %s not found\n", spec.value);
893 device_add_duplicate_property(current,
898 if (strcmp(spec.property, "reg") == 0
899 || strcmp(spec.property, "assigned-addresses") == 0
900 || strcmp(spec.property, "alternate-reg") == 0){
901 parse_reg_property(current, spec.property, spec.value);
903 else if (strcmp(spec.property, "ranges") == 0) {
904 parse_ranges_property(current, spec.property, spec.value);
906 else if (isdigit(spec.value[0])
907 || (spec.value[0] == '-' && isdigit(spec.value[1]))
908 || (spec.value[0] == '+' && isdigit(spec.value[1]))) {
909 parse_integer_property(current, spec.property, spec.value);
912 parse_string_property(current, spec.property, spec.value);
923 tree_traverse(device *root,
924 tree_traverse_function *prefix,
925 tree_traverse_function *postfix,
931 for (child = device_child(root);
933 child = device_sibling(child)) {
934 tree_traverse(child, prefix, postfix, data);
943 print_address(device *bus,
944 const device_unit *phys)
947 device_encode_unit(bus, phys, unit, sizeof(unit));
948 printf_filtered(" %s", unit);
953 print_size(device *bus,
954 const device_unit *size)
957 for (i = 0; i < size->nr_cells; i++)
958 if (size->cells[i] != 0)
960 if (i < size->nr_cells) {
961 printf_filtered(" 0x%lx", (unsigned long)size->cells[i]);
963 for (; i < size->nr_cells; i++)
964 printf_filtered(",0x%lx", (unsigned long)size->cells[i]);
967 printf_filtered(" 0");
972 print_reg_property(device *me,
973 const device_property *property)
976 reg_property_spec reg;
978 device_find_reg_array_property(me, property->name, reg_nr, ®);
980 print_address(device_parent(me), ®.address);
981 print_size(me, ®.size);
987 print_ranges_property(device *me,
988 const device_property *property)
991 range_property_spec range;
993 device_find_range_array_property(me, property->name, range_nr, &range);
995 print_address(me, &range.child_address);
996 print_address(device_parent(me), &range.parent_address);
997 print_size(me, &range.size);
1003 print_string(const char *string)
1005 printf_filtered(" \"");
1006 while (*string != '\0') {
1009 printf_filtered("\\\"");
1012 printf_filtered("\\\\");
1015 printf_filtered("%c", *string);
1020 printf_filtered("\"");
1025 print_string_array_property(device *me,
1026 const device_property *property)
1029 string_property_spec string;
1031 device_find_string_array_property(me, property->name, nr, &string);
1033 print_string(string);
1039 print_properties(device *me)
1041 const device_property *property;
1042 for (property = device_find_property(me, NULL);
1044 property = device_next_property(property)) {
1045 printf_filtered("%s/%s", device_path(me), property->name);
1046 if (property->original != NULL) {
1047 printf_filtered(" !");
1048 printf_filtered("%s/%s",
1049 device_path(property->original->owner),
1050 property->original->name);
1053 switch (property->type) {
1054 case array_property:
1055 if ((property->sizeof_array % sizeof(signed_cell)) == 0) {
1056 unsigned_cell *w = (unsigned_cell*)property->array;
1059 cell_nr < (property->sizeof_array / sizeof(unsigned_cell));
1061 printf_filtered(" 0x%lx", (unsigned long)BE2H_cell(w[cell_nr]));
1065 unsigned8 *w = (unsigned8*)property->array;
1066 printf_filtered(" [");
1067 while ((char*)w - (char*)property->array < property->sizeof_array) {
1068 printf_filtered(" 0x%2x", BE2H_1(*w));
1073 case boolean_property:
1075 int b = device_find_boolean_property(me, property->name);
1076 printf_filtered(" %s", b ? "true" : "false");
1079 case ihandle_property:
1081 if (property->array != NULL) {
1082 device_instance *instance = device_find_ihandle_property(me, property->name);
1083 printf_filtered(" *%s", device_instance_path(instance));
1086 /* not yet initialized, ask the device for the path */
1087 ihandle_runtime_property_spec spec;
1088 device_find_ihandle_runtime_property(me, property->name, &spec);
1089 printf_filtered(" *%s", spec.full_path);
1093 case integer_property:
1095 unsigned_word w = device_find_integer_property(me, property->name);
1096 printf_filtered(" 0x%lx", (unsigned long)w);
1099 case range_array_property:
1100 print_ranges_property(me, property);
1102 case reg_array_property:
1103 print_reg_property(me, property);
1105 case string_property:
1107 const char *s = device_find_string_property(me, property->name);
1111 case string_array_property:
1112 print_string_array_property(me, property);
1116 printf_filtered("\n");
1122 print_interrupts(device *me,
1126 void *ignore_or_null)
1130 device_interrupt_encode(me, my_port, src, sizeof(src), output_port);
1131 device_interrupt_encode(dest, dest_port, dst, sizeof(dst), input_port);
1132 printf_filtered("%s > %s %s %s\n",
1140 print_device(device *me,
1141 void *ignore_or_null)
1143 printf_filtered("%s\n", device_path(me));
1144 print_properties(me);
1145 device_interrupt_traverse(me, print_interrupts, NULL);
1150 tree_print(device *root)
1160 tree_usage(int verbose)
1163 printf_filtered("\n");
1164 printf_filtered("A device/property specifier has the form:\n");
1165 printf_filtered("\n");
1166 printf_filtered(" /path/to/a/device [ property-value ]\n");
1167 printf_filtered("\n");
1168 printf_filtered("and a possible device is\n");
1169 printf_filtered("\n");
1172 printf_filtered("\n");
1173 printf_filtered("A device/property specifier (<spec>) has the format:\n");
1174 printf_filtered("\n");
1175 printf_filtered(" <spec> ::= <path> [ <value> ] ;\n");
1176 printf_filtered(" <path> ::= { <prefix> } { <node> \"/\" } <node> ;\n");
1177 printf_filtered(" <prefix> ::= ( | \"/\" | \"../\" | \"./\" ) ;\n");
1178 printf_filtered(" <node> ::= <name> [ \"@\" <unit> ] [ \":\" <args> ] ;\n");
1179 printf_filtered(" <unit> ::= <number> { \",\" <number> } ;\n");
1180 printf_filtered("\n");
1181 printf_filtered("Where:\n");
1182 printf_filtered("\n");
1183 printf_filtered(" <name> is the name of a device (list below)\n");
1184 printf_filtered(" <unit> is the unit-address relative to the parent bus\n");
1185 printf_filtered(" <args> additional arguments used when creating the device\n");
1186 printf_filtered(" <value> ::= ( <number> # integer property\n");
1187 printf_filtered(" | \"[\" { <number> } # array property (byte)\n");
1188 printf_filtered(" | \"{\" { <number> } # array property (cell)\n");
1189 printf_filtered(" | [ \"true\" | \"false\" ] # boolean property\n");
1190 printf_filtered(" | \"*\" <path> # ihandle property\n");
1191 printf_filtered(" | \"!\" <path> # copy property\n");
1192 printf_filtered(" | \">\" [ <number> ] <path> # attach interrupt\n");
1193 printf_filtered(" | \"<\" <path> # attach child interrupt\n");
1194 printf_filtered(" | \"\\\"\" <text> # string property\n");
1195 printf_filtered(" | <text> # string property\n");
1196 printf_filtered(" ) ;\n");
1197 printf_filtered("\n");
1198 printf_filtered("And the following are valid device names:\n");
1199 printf_filtered("\n");
1207 tree_instance(device *root,
1208 const char *device_specifier)
1210 /* find the device node */
1212 name_specifier spec;
1213 if (!split_device_specifier(root, device_specifier, &spec))
1215 me = split_find_device(root, &spec);
1216 if (spec.name != NULL)
1218 /* create the instance */
1219 return device_create_instance(me, device_specifier, spec.last_args);
1225 tree_find_device(device *root,
1226 const char *path_to_device)
1229 name_specifier spec;
1231 /* parse the path */
1232 split_device_specifier(root, path_to_device, &spec);
1233 if (spec.value != NULL)
1234 return NULL; /* something wierd */
1237 node = split_find_device(root, &spec);
1238 if (spec.name != NULL)
1239 return NULL; /* not a leaf */
1246 (const device_property *)
1247 tree_find_property(device *root,
1248 const char *path_to_property)
1250 name_specifier spec;
1251 if (!split_property_specifier(root, path_to_property, &spec))
1252 device_error(root, "Invalid property path %s", path_to_property);
1253 root = split_find_device(root, &spec);
1254 return device_find_property(root, spec.property);
1259 tree_find_boolean_property(device *root,
1260 const char *path_to_property)
1262 name_specifier spec;
1263 if (!split_property_specifier(root, path_to_property, &spec))
1264 device_error(root, "Invalid property path %s", path_to_property);
1265 root = split_find_device(root, &spec);
1266 return device_find_boolean_property(root, spec.property);
1271 tree_find_integer_property(device *root,
1272 const char *path_to_property)
1274 name_specifier spec;
1275 if (!split_property_specifier(root, path_to_property, &spec))
1276 device_error(root, "Invalid property path %s", path_to_property);
1277 root = split_find_device(root, &spec);
1278 return device_find_integer_property(root, spec.property);
1283 tree_find_ihandle_property(device *root,
1284 const char *path_to_property)
1286 name_specifier spec;
1287 if (!split_property_specifier(root, path_to_property, &spec))
1288 device_error(root, "Invalid property path %s", path_to_property);
1289 root = split_find_device(root, &spec);
1290 return device_find_ihandle_property(root, spec.property);
1295 tree_find_string_property(device *root,
1296 const char *path_to_property)
1298 name_specifier spec;
1299 if (!split_property_specifier(root, path_to_property, &spec))
1300 device_error(root, "Invalid property path %s", path_to_property);
1301 root = split_find_device(root, &spec);
1302 return device_find_string_property(root, spec.property);
1306 #endif /* _PARSE_C_ */