1 /* This file is part of the program psim.
3 Copyright (C) 1994-1998, 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.
26 #include "sim-assert.h"
42 /* manipulate/lookup device names */
44 typedef struct _name_specifier
{
46 /* components in the full length name */
70 /* Given a device specifier, break it up into its main components:
71 path (and if present) property name and property value. */
74 split_device_specifier (struct hw
*current
,
75 const char *device_specifier
,
80 /* expand any leading alias if present */
82 && *device_specifier
!= '\0'
83 && *device_specifier
!= '.'
84 && *device_specifier
!= '/')
86 struct hw
*aliases
= hw_tree_find_device (current
, "/aliases");
89 while (device_specifier
[len
] != '\0'
90 && device_specifier
[len
] != '/'
91 && device_specifier
[len
] != ':'
92 && !isspace (device_specifier
[len
]))
94 alias
[len
] = device_specifier
[len
];
96 if (len
>= sizeof(alias
))
97 hw_abort (NULL
, "split_device_specifier: buffer overflow");
101 && hw_find_property (aliases
, alias
))
103 strcpy (spec
->buf
, hw_find_string_property(aliases
, alias
));
104 strcat (spec
->buf
, device_specifier
+ len
);
108 strcpy (spec
->buf
, device_specifier
);
113 strcpy(spec
->buf
, device_specifier
);
116 /* check no overflow */
117 if (strlen(spec
->buf
) >= sizeof(spec
->buf
))
118 hw_abort (NULL
, "split_device_specifier: buffer overflow\n");
120 /* strip leading spaces */
122 while (*chp
!= '\0' && isspace(*chp
))
127 /* find the path and terminate it with null */
129 while (*chp
!= '\0' && !isspace(*chp
))
138 while (*chp
!= '\0' && isspace(*chp
))
142 /* now go back and chop the property off of the path */
143 if (spec
->value
[0] == '\0')
145 spec
->property
= NULL
; /*not a property*/
148 else if (spec
->value
[0] == '>'
149 || spec
->value
[0] == '<')
151 /* an interrupt spec */
152 spec
->property
= NULL
;
155 chp
= strrchr(spec
->path
, '/');
158 spec
->property
= spec
->path
;
159 spec
->path
= strchr(spec
->property
, '\0');
163 spec
->property
= chp
+1;
167 /* and mark the rest as invalid */
172 spec
->last_name
= NULL
;
173 spec
->last_family
= NULL
;
174 spec
->last_unit
= NULL
;
175 spec
->last_args
= NULL
;
181 /* given a device specifier break it up into its main components -
182 path and property name - assuming that the last `device' is a
186 split_property_specifier (struct hw
*current
,
187 const char *property_specifier
,
188 name_specifier
*spec
)
190 if (split_device_specifier (current
, property_specifier
, spec
))
192 if (spec
->property
== NULL
)
194 /* force the last name to be a property name */
195 char *chp
= strrchr (spec
->path
, '/');
198 spec
->property
= spec
->path
;
199 spec
->path
= strrchr (spec
->property
, '\0');;
204 spec
->property
= chp
+ 1;
214 /* device the next device name and split it up, return 0 when no more
215 names to struct hw */
218 split_device_name (name_specifier
*spec
)
221 /* remember what came before */
222 spec
->last_name
= spec
->name
;
223 spec
->last_family
= spec
->family
;
224 spec
->last_unit
= spec
->unit
;
225 spec
->last_args
= spec
->args
;
227 if (spec
->path
[0] == '\0')
235 /* break the current device spec from the path */
236 spec
->name
= spec
->path
;
237 chp
= strchr (spec
->name
, '/');
239 spec
->path
= strchr (spec
->name
, '\0');
245 /* break out the base */
246 if (spec
->name
[0] == '(')
248 chp
= strchr(spec
->name
, ')');
251 spec
->family
= spec
->name
;
256 spec
->family
= spec
->name
+ 1;
257 spec
->name
= chp
+ 1;
262 spec
->family
= spec
->name
;
264 /* now break out the unit */
265 chp
= strchr(spec
->name
, '@');
277 /* finally any args */
278 chp
= strchr(chp
, ':');
290 /* device the value, returning the next non-space token */
293 split_value (name_specifier
*spec
)
296 if (spec
->value
== NULL
)
298 /* skip leading white space */
299 while (isspace (spec
->value
[0]))
301 if (spec
->value
[0] == '\0')
307 /* find trailing space */
308 while (spec
->value
[0] != '\0' && !isspace (spec
->value
[0]))
310 /* chop this value out */
311 if (spec
->value
[0] != '\0')
313 spec
->value
[0] = '\0';
321 /* traverse the path specified by spec starting at current */
324 split_find_device (struct hw
*current
,
325 name_specifier
*spec
)
327 /* strip off (and process) any leading ., .., ./ and / */
330 if (strncmp (spec
->path
, "/", strlen ("/")) == 0)
333 while (current
!= NULL
&& hw_parent (current
) != NULL
)
334 current
= hw_parent (current
);
335 spec
->path
+= strlen ("/");
337 else if (strncmp (spec
->path
, "./", strlen ("./")) == 0)
341 spec
->path
+= strlen ("./");
343 else if (strncmp (spec
->path
, "../", strlen ("../")) == 0)
346 if (current
!= NULL
&& hw_parent (current
) != NULL
)
347 current
= hw_parent (current
);
348 spec
->path
+= strlen ("../");
350 else if (strcmp (spec
->path
, ".") == 0)
354 spec
->path
+= strlen (".");
356 else if (strcmp (spec
->path
, "..") == 0)
359 if (current
!= NULL
&& hw_parent (current
) != NULL
)
360 current
= hw_parent (current
);
361 spec
->path
+= strlen ("..");
367 /* now go through the path proper */
371 split_device_name (spec
);
375 while (split_device_name (spec
))
378 for (child
= hw_child (current
);
379 child
!= NULL
; child
= hw_sibling (child
))
381 if (strcmp (spec
->name
, hw_name (child
)) == 0)
383 if (spec
->unit
== NULL
)
388 hw_unit_decode (current
, spec
->unit
, &phys
);
389 if (memcmp (&phys
, hw_unit_address (child
),
390 sizeof (hw_unit
)) == 0)
396 return current
; /* search failed */
405 split_fill_path (struct hw
*current
,
406 const char *device_specifier
,
407 name_specifier
*spec
)
410 if (!split_device_specifier (current
, device_specifier
, spec
))
411 hw_abort (current
, "error parsing %s\n", device_specifier
);
413 /* fill our tree with its contents */
414 current
= split_find_device (current
, spec
);
416 /* add any additional devices as needed */
417 if (spec
->name
!= NULL
)
421 if (current
!= NULL
&& !hw_finished_p (current
))
423 current
= hw_create (NULL
,
430 while (split_device_name (spec
));
437 /* <non-white-space> */
440 skip_token(const char *chp
)
442 while (!isspace(*chp
) && *chp
!= '\0')
444 while (isspace(*chp
) && *chp
!= '\0')
450 /* count the number of entries */
453 count_entries (struct hw
*current
,
454 const char *property_name
,
455 const char *property_value
,
458 const char *chp
= property_value
;
463 chp
= skip_token (chp
);
465 if ((nr_entries
% modulo
) != 0)
467 hw_abort (current
, "incorrect number of entries for %s property %s, should be multiple of %d",
468 property_name
, property_value
, modulo
);
470 return nr_entries
/ modulo
;
475 /* parse: <address> ::= <token> ; device dependant */
478 parse_address (struct hw
*current
,
483 if (hw_unit_decode (bus
, chp
, address
) < 0)
484 hw_abort (current
, "invalid unit address in %s", chp
);
485 return skip_token (chp
);
489 /* parse: <size> ::= <number> { "," <number> } ; */
492 parse_size (struct hw
*current
,
499 const char *curr
= chp
;
500 memset(size
, 0, sizeof(*size
));
501 /* parse the numeric list */
502 size
->nr_cells
= hw_unit_nr_size_cells (bus
);
507 size
->cells
[nr
] = strtoul (curr
, &next
, 0);
509 hw_abort (current
, "Problem parsing <size> %s", chp
);
513 if (nr
== size
->nr_cells
)
514 hw_abort (current
, "Too many values in <size> %s", chp
);
517 ASSERT (nr
> 0 && nr
<= size
->nr_cells
);
518 /* right align the numbers */
519 for (i
= 1; i
<= size
->nr_cells
; i
++)
522 size
->cells
[size
->nr_cells
- i
] = size
->cells
[nr
- i
];
524 size
->cells
[size
->nr_cells
- i
] = 0;
526 return skip_token (chp
);
530 /* parse: <reg> ::= { <address> <size> } ; */
533 parse_reg_property (struct hw
*current
,
534 const char *property_name
,
535 const char *property_value
)
539 reg_property_spec
*regs
;
542 /* determine the number of reg entries by counting tokens */
543 nr_regs
= count_entries (current
, property_name
, property_value
, 2);
545 /* create working space */
546 regs
= zalloc (nr_regs
* sizeof (*regs
));
549 chp
= property_value
;
550 for (reg_nr
= 0; reg_nr
< nr_regs
; reg_nr
++)
552 chp
= parse_address (current
, hw_parent(current
),
553 chp
, ®s
[reg_nr
].address
);
554 chp
= parse_size (current
, hw_parent(current
),
555 chp
, ®s
[reg_nr
].size
);
559 hw_add_reg_array_property (current
, property_name
,
566 /* { <child-address> <parent-address> <child-size> }* */
569 parse_ranges_property (struct hw
*current
,
570 const char *property_name
,
571 const char *property_value
)
575 range_property_spec
*ranges
;
578 /* determine the number of ranges specified */
579 nr_ranges
= count_entries (current
, property_name
, property_value
, 3);
581 /* create a property of that size */
582 ranges
= zalloc (nr_ranges
* sizeof(*ranges
));
585 chp
= property_value
;
586 for (range_nr
= 0; range_nr
< nr_ranges
; range_nr
++)
588 chp
= parse_address (current
, current
,
589 chp
, &ranges
[range_nr
].child_address
);
590 chp
= parse_address (current
, hw_parent(current
),
591 chp
, &ranges
[range_nr
].parent_address
);
592 chp
= parse_size (current
, current
,
593 chp
, &ranges
[range_nr
].size
);
597 hw_add_range_array_property (current
, property_name
, ranges
, nr_ranges
);
606 parse_integer_property (struct hw
*current
,
607 const char *property_name
,
608 const char *property_value
)
611 unsigned_cell words
[1024];
612 /* integer or integer array? */
617 words
[nr_entries
] = strtoul (property_value
, &end
, 0);
618 if (property_value
== end
)
621 if (nr_entries
* sizeof (words
[0]) >= sizeof (words
))
622 hw_abort (current
, "buffer overflow");
623 property_value
= end
;
626 hw_abort (current
, "error parsing integer property %s (%s)",
627 property_name
, property_value
);
628 else if (nr_entries
== 1)
629 hw_add_integer_property (current
, property_name
, words
[0]);
633 for (i
= 0; i
< nr_entries
; i
++)
637 /* perhaphs integer array property is better */
638 hw_add_array_property (current
, property_name
, words
,
639 sizeof(words
[0]) * nr_entries
);
647 parse_string_property (struct hw
*current
,
648 const char *property_name
,
649 const char *property_value
)
654 int approx_nr_strings
;
656 /* get an estimate as to the number of strings by counting double
658 approx_nr_strings
= 2;
659 for (chp
= property_value
; *chp
; chp
++)
664 approx_nr_strings
= (approx_nr_strings
) / 2;
666 /* create a string buffer for that many (plus a null) */
667 strings
= (char**) zalloc ((approx_nr_strings
+ 1) * sizeof(char*));
669 /* now find all the strings */
670 chp
= property_value
;
675 /* skip leading space */
676 while (*chp
!= '\0' && isspace (*chp
))
684 /* a quoted string - watch for '\' et.al. */
685 /* estimate the size and allocate space for it */
689 while (chp
[pos
] != '\0' && chp
[pos
] != '"')
691 if (chp
[pos
] == '\\' && chp
[pos
+1] != '\0')
696 strings
[nr_strings
] = zalloc (pos
+ 1);
697 /* copy the string over */
699 while (*chp
!= '\0' && *chp
!= '"')
701 if (*chp
== '\\' && *(chp
+1) != '\0') {
702 strings
[nr_strings
][pos
] = *(chp
+1);
708 strings
[nr_strings
][pos
] = *chp
;
715 strings
[nr_strings
][pos
] = '\0';
719 /* copy over a single unquoted token */
721 while (chp
[len
] != '\0' && !isspace(chp
[len
]))
723 strings
[nr_strings
] = zalloc(len
+ 1);
724 strncpy(strings
[nr_strings
], chp
, len
);
725 strings
[nr_strings
][len
] = '\0';
729 if (nr_strings
> approx_nr_strings
)
730 hw_abort (current
, "String property %s badly formatted",
733 ASSERT (strings
[nr_strings
] == NULL
); /* from zalloc */
737 hw_add_string_property (current
, property_name
, "");
738 else if (nr_strings
== 1)
739 hw_add_string_property (current
, property_name
, strings
[0]);
742 const char **specs
= (const char**) strings
; /* stop a bogus error */
743 hw_add_string_array_property (current
, property_name
,
747 /* flush the created string */
748 while (nr_strings
> 0)
751 zfree (strings
[nr_strings
]);
757 /* <path-to-ihandle-device> */
761 parse_ihandle_property (struct hw
*current
,
762 const char *property
,
765 ihandle_runtime_property_spec ihandle
;
767 /* pass the full path */
768 ihandle
.full_path
= value
;
770 /* save this ready for the ihandle create */
771 hw_add_ihandle_runtime_property (current
, property
,
778 hw_tree_create (SIM_DESC sd
,
781 return hw_create (sd
, NULL
, family
, family
, NULL
, NULL
);
785 hw_tree_delete (struct hw
*me
)
787 /* Need to allow devices to disapear under our feet */
788 while (hw_child (me
) != NULL
)
790 hw_tree_delete (hw_child (me
));
797 hw_tree_parse (struct hw
*current
,
801 char device_specifier
[1024];
804 /* format the path */
808 vsprintf (device_specifier
, fmt
, ap
);
810 if (strlen (device_specifier
) >= sizeof (device_specifier
))
811 hw_abort (NULL
, "device_tree_add_deviced: buffer overflow\n");
814 /* construct the tree down to the final struct hw */
815 current
= split_fill_path (current
, device_specifier
, &spec
);
817 /* is there an interrupt spec */
818 if (spec
.property
== NULL
819 && spec
.value
!= NULL
)
821 char *op
= split_value (&spec
);
826 char *my_port_name
= split_value (&spec
);
828 char *dest_port_name
= split_value (&spec
);
830 name_specifier dest_spec
;
831 char *dest_hw_name
= split_value (&spec
);
834 my_port
= hw_port_decode (current
, my_port_name
,
836 /* find the dest device and port */
837 dest
= split_fill_path(current
, dest_hw_name
, &dest_spec
);
838 dest_port
= hw_port_decode (dest
, dest_port_name
,
840 /* connect the two */
841 hw_port_attach (current
,
849 hw_abort (current
, "unreconised interrupt spec %s\n", spec
.value
);
854 /* is there a property */
855 if (spec
.property
!= NULL
)
857 if (strcmp (spec
.value
, "true") == 0)
858 hw_add_boolean_property (current
, spec
.property
, 1);
859 else if (strcmp (spec
.value
, "false") == 0)
860 hw_add_boolean_property (current
, spec
.property
, 0);
863 const struct hw_property
*property
;
864 switch (spec
.value
[0])
869 parse_ihandle_property (current
, spec
.property
, spec
.value
+ 1);
875 unsigned8 words
[1024];
876 char *curr
= spec
.value
+ 1;
881 words
[nr_words
] = H2BE_1 (strtoul (curr
, &next
, 0));
887 hw_add_array_property (current
, spec
.property
,
888 words
, sizeof(words
[0]) * nr_words
);
893 parse_string_property (current
, spec
.property
, spec
.value
);
899 property
= hw_tree_find_property (current
, spec
.value
);
900 if (property
== NULL
)
901 hw_abort (current
, "property %s not found\n", spec
.value
);
902 hw_add_duplicate_property (current
,
909 if (strcmp (spec
.property
, "reg") == 0
910 || strcmp (spec
.property
, "assigned-addresses") == 0
911 || strcmp (spec
.property
, "alternate-reg") == 0)
913 parse_reg_property (current
, spec
.property
, spec
.value
);
915 else if (strcmp (spec
.property
, "ranges") == 0)
917 parse_ranges_property (current
, spec
.property
, spec
.value
);
919 else if (isdigit(spec
.value
[0])
920 || (spec
.value
[0] == '-' && isdigit(spec
.value
[1]))
921 || (spec
.value
[0] == '+' && isdigit(spec
.value
[1])))
923 parse_integer_property(current
, spec
.property
, spec
.value
);
926 parse_string_property(current
, spec
.property
, spec
.value
);
937 finish_hw_tree (struct hw
*me
,
940 if (!hw_finished_p (me
))
945 hw_tree_finish (struct hw
*root
)
947 hw_tree_traverse (root
, finish_hw_tree
, NULL
, NULL
);
953 hw_tree_traverse (struct hw
*root
,
954 hw_tree_traverse_function
*prefix
,
955 hw_tree_traverse_function
*postfix
,
961 for (child
= hw_child (root
);
963 child
= hw_sibling (child
))
965 hw_tree_traverse (child
, prefix
, postfix
, data
);
968 postfix (root
, data
);
972 static void hw_printf
975 ...) __attribute__ ((format (printf
, 2, 3)));
978 hw_printf (struct hw
*me
,
984 sim_io_vprintf (hw_system (me
), fmt
, ap
);
990 print_address (struct hw
*bus
,
994 hw_unit_encode (bus
, phys
, unit
, sizeof(unit
));
995 hw_printf (bus
, " %s", unit
);
999 print_size (struct hw
*bus
,
1000 const hw_unit
*size
)
1003 for (i
= 0; i
< size
->nr_cells
; i
++)
1004 if (size
->cells
[i
] != 0)
1006 if (i
< size
->nr_cells
) {
1007 hw_printf (bus
, " 0x%lx", (unsigned long) size
->cells
[i
]);
1009 for (; i
< size
->nr_cells
; i
++)
1010 hw_printf (bus
, ",0x%lx", (unsigned long) size
->cells
[i
]);
1013 hw_printf (bus
, " 0");
1017 print_reg_property(struct hw
*me
,
1018 const struct hw_property
*property
)
1021 reg_property_spec reg
;
1023 hw_find_reg_array_property (me
, property
->name
, reg_nr
, ®
);
1025 print_address (hw_parent (me
), ®
.address
);
1026 print_size (me
, ®
.size
);
1031 print_ranges_property(struct hw
*me
,
1032 const struct hw_property
*property
)
1035 range_property_spec range
;
1037 hw_find_range_array_property (me
, property
->name
, range_nr
, &range
);
1040 print_address (me
, &range
.child_address
);
1041 print_address (hw_parent (me
), &range
.parent_address
);
1042 print_size (me
, &range
.size
);
1047 print_string (struct hw
*me
,
1050 hw_printf (me
, " \"");
1051 while (*string
!= '\0') {
1054 hw_printf (me
, "\\\"");
1057 hw_printf (me
, "\\\\");
1060 hw_printf (me
, "%c", *string
);
1065 hw_printf (me
, "\"");
1069 print_string_array_property (struct hw
*me
,
1070 const struct hw_property
*property
)
1073 string_property_spec string
;
1075 hw_find_string_array_property (me
, property
->name
, nr
, &string
);
1078 print_string (me
, string
);
1083 print_properties (struct hw
*me
)
1085 const struct hw_property
*property
;
1086 for (property
= hw_find_property (me
, NULL
);
1088 property
= hw_next_property (property
))
1090 if (hw_parent (me
) == NULL
)
1091 hw_printf (me
, "/%s", property
->name
);
1093 hw_printf (me
, "%s/%s", hw_path (me
), property
->name
);
1094 if (property
->original
!= NULL
)
1096 hw_printf (me
, " !");
1097 hw_printf (me
, "%s/%s",
1098 hw_path (property
->original
->owner
),
1099 property
->original
->name
);
1103 switch (property
->type
)
1105 case array_property
:
1107 if ((property
->sizeof_array
% sizeof (signed_cell
)) == 0)
1109 unsigned_cell
*w
= (unsigned_cell
*) property
->array
;
1112 cell_nr
< (property
->sizeof_array
/ sizeof (unsigned_cell
));
1115 hw_printf (me
, " 0x%lx", (unsigned long) BE2H_cell (w
[cell_nr
]));
1120 unsigned8
*w
= (unsigned8
*)property
->array
;
1121 hw_printf (me
, " [");
1122 while ((char*)w
- (char*)property
->array
< property
->sizeof_array
) {
1123 hw_printf (me
, " 0x%2x", BE2H_1 (*w
));
1129 case boolean_property
:
1131 int b
= hw_find_boolean_property(me
, property
->name
);
1132 hw_printf (me
, " %s", b
? "true" : "false");
1136 case ihandle_property
:
1138 if (property
->array
!= NULL
)
1140 device_instance
*instance
= hw_find_ihandle_property (me
, property
->name
);
1141 hw_printf (me
, " *%s", device_instance_path(instance
));
1145 /* not yet initialized, ask the device for the path */
1146 ihandle_runtime_property_spec spec
;
1147 hw_find_ihandle_runtime_property (me
, property
->name
, &spec
);
1148 hw_printf (me
, " *%s", spec
.full_path
);
1153 case integer_property
:
1155 unsigned_word w
= hw_find_integer_property (me
, property
->name
);
1156 hw_printf (me
, " 0x%lx", (unsigned long)w
);
1159 case range_array_property
:
1161 print_ranges_property (me
, property
);
1164 case reg_array_property
:
1166 print_reg_property (me
, property
);
1169 case string_property
:
1171 const char *s
= hw_find_string_property (me
, property
->name
);
1172 print_string (me
, s
);
1175 case string_array_property
:
1177 print_string_array_property (me
, property
);
1182 hw_printf (me
, "\n");
1187 print_interrupts (struct hw
*me
,
1191 void *ignore_or_null
)
1195 hw_port_encode (me
, my_port
, src
, sizeof(src
), output_port
);
1196 hw_port_encode (dest
, dest_port
, dst
, sizeof(dst
), input_port
);
1197 hw_printf (me
, "%s > %s %s %s\n",
1204 print_device (struct hw
*me
,
1205 void *ignore_or_null
)
1207 hw_printf (me
, "%s\n", hw_path (me
));
1208 print_properties (me
);
1209 hw_port_traverse (me
, print_interrupts
, NULL
);
1213 hw_tree_print (struct hw
*root
)
1215 hw_tree_traverse (root
,
1224 tree_instance(struct hw
*root
,
1225 const char *device_specifier
)
1227 /* find the device node */
1229 name_specifier spec
;
1230 if (!split_device_specifier(root
, device_specifier
, &spec
))
1232 me
= split_find_device(root
, &spec
);
1233 if (spec
.name
!= NULL
)
1235 /* create the instance */
1236 return device_create_instance(me
, device_specifier
, spec
.last_args
);
1241 hw_tree_find_device (struct hw
*root
,
1242 const char *path_to_device
)
1245 name_specifier spec
;
1247 /* parse the path */
1248 split_device_specifier (root
, path_to_device
, &spec
);
1249 if (spec
.value
!= NULL
)
1250 return NULL
; /* something wierd */
1253 node
= split_find_device (root
, &spec
);
1254 if (spec
.name
!= NULL
)
1255 return NULL
; /* not a leaf */
1261 const struct hw_property
*
1262 hw_tree_find_property (struct hw
*root
,
1263 const char *path_to_property
)
1265 name_specifier spec
;
1266 if (!split_property_specifier (root
, path_to_property
, &spec
))
1267 hw_abort (root
, "Invalid property path %s", path_to_property
);
1268 root
= split_find_device (root
, &spec
);
1269 return hw_find_property (root
, spec
.property
);
1273 hw_tree_find_boolean_property (struct hw
*root
,
1274 const char *path_to_property
)
1276 name_specifier spec
;
1277 if (!split_property_specifier (root
, path_to_property
, &spec
))
1278 hw_abort (root
, "Invalid property path %s", path_to_property
);
1279 root
= split_find_device (root
, &spec
);
1280 return hw_find_boolean_property (root
, spec
.property
);
1284 hw_tree_find_integer_property (struct hw
*root
,
1285 const char *path_to_property
)
1287 name_specifier spec
;
1288 if (!split_property_specifier (root
, path_to_property
, &spec
))
1289 hw_abort (root
, "Invalid property path %s", path_to_property
);
1290 root
= split_find_device (root
, &spec
);
1291 return hw_find_integer_property (root
, spec
.property
);
1296 hw_tree_find_ihandle_property (struct hw
*root
,
1297 const char *path_to_property
)
1299 name_specifier spec
;
1300 if (!split_property_specifier (root
, path_to_property
, &spec
))
1301 hw_abort (root
, "Invalid property path %s", path_to_property
);
1302 root
= split_find_device (root
, &spec
);
1303 return hw_find_ihandle_property (root
, spec
.property
);
1308 hw_tree_find_string_property (struct hw
*root
,
1309 const char *path_to_property
)
1311 name_specifier spec
;
1312 if (!split_property_specifier (root
, path_to_property
, &spec
))
1313 hw_abort (root
, "Invalid property path %s", path_to_property
);
1314 root
= split_find_device (root
, &spec
);
1315 return hw_find_string_property (root
, spec
.property
);