Lines Matching +full:int +full:- +full:property

1 /* SPDX-License-Identifier: GPL-2.0+ */
8 * Copyright (C) 1996-2005 Paul Mackerras.
22 #include <linux/property.h>
31 struct property { struct
33 int length;
35 struct property *next; argument
40 unsigned int unique_id;
57 struct property *properties; argument
58 struct property *deadprops; /* removed properties */
68 unsigned int unique_id;
76 int args_count;
83 int cell_count;
99 struct property *prop;
100 struct property *old_prop;
109 kobject_init(&node->kobj, &of_node_ktype); in of_node_init()
111 fwnode_init(&node->fwnode, &of_fwnode_ops); in of_node_init()
115 #define of_node_kobj(n) (&(n)->kobj)
124 /* Dummy ref counting routines - to be implemented later */
150 #define OF_BAD_ADDR ((u64)-1)
157 return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &of_fwnode_ops; in is_of_node()
175 &__of_fwnode_handle_node->fwnode : NULL; \
185 return node && (node->parent == NULL); in of_node_is_root()
188 static inline int of_node_check_flag(const struct device_node *n, unsigned long flag) in of_node_check_flag()
190 return test_bit(flag, &n->_flags); in of_node_check_flag()
193 static inline int of_node_test_and_set_flag(struct device_node *n, in of_node_test_and_set_flag()
196 return test_and_set_bit(flag, &n->_flags); in of_node_test_and_set_flag()
201 set_bit(flag, &n->_flags); in of_node_set_flag()
206 clear_bit(flag, &n->_flags); in of_node_clear_flag()
210 static inline int of_property_check_flag(const struct property *p, unsigned long flag) in of_property_check_flag()
212 return test_bit(flag, &p->_flags); in of_property_check_flag()
215 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
217 set_bit(flag, &p->_flags); in of_property_set_flag()
220 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
222 clear_bit(flag, &p->_flags); in of_property_clear_flag()
234 static inline u64 of_read_number(const __be32 *cell, int size) in of_read_number()
237 for (; size--; cell++) in of_read_number()
243 static inline unsigned long of_read_ulong(const __be32 *cell, int size) in of_read_ulong()
253 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
254 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
261 return np ? np->full_name : "<no-node>"; in of_node_full_name()
300 extern int of_find_last_cache_level(unsigned int cpu);
304 extern struct property *of_find_property(const struct device_node *np,
306 int *lenp);
307 extern int of_property_count_elems_of_size(const struct device_node *np,
308 const char *propname, int elem_size);
309 extern int of_property_read_u32_index(const struct device_node *np,
312 extern int of_property_read_u64_index(const struct device_node *np,
315 extern int of_property_read_variable_u8_array(const struct device_node *np,
318 extern int of_property_read_variable_u16_array(const struct device_node *np,
321 extern int of_property_read_variable_u32_array(const struct device_node *np,
326 extern int of_property_read_u64(const struct device_node *np,
328 extern int of_property_read_variable_u64_array(const struct device_node *np,
334 extern int of_property_read_string(const struct device_node *np,
337 extern int of_property_match_string(const struct device_node *np,
340 extern int of_property_read_string_helper(const struct device_node *np,
342 const char **out_strs, size_t sz, int index);
343 extern int of_device_is_compatible(const struct device_node *device,
345 extern int of_device_compatible_match(const struct device_node *device,
351 int *lenp);
352 extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
355 int index);
356 extern u64 of_get_cpu_hwid(struct device_node *cpun, unsigned int thread);
359 for (pp = dn->properties; pp != NULL; pp = pp->next)
361 extern int of_n_addr_cells(struct device_node *np);
362 extern int of_n_size_cells(struct device_node *np);
365 extern int of_modalias_node(struct device_node *node, char *modalias, int len);
367 extern int __of_parse_phandle_with_args(const struct device_node *np,
368 const char *list_name, const char *cells_name, int cell_count,
369 int index, struct of_phandle_args *out_args);
370 extern int of_parse_phandle_with_args_map(const struct device_node *np,
371 const char *list_name, const char *stem_name, int index,
373 extern int of_count_phandle_with_args(const struct device_node *np,
377 extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
381 int cell_count);
383 extern int of_phandle_iterator_next(struct of_phandle_iterator *it);
384 extern int of_phandle_iterator_args(struct of_phandle_iterator *it,
386 int size);
389 extern int of_alias_get_id(struct device_node *np, const char *stem);
390 extern int of_alias_get_highest_id(const char *stem);
392 extern int of_machine_is_compatible(const char *compat);
394 extern int of_add_property(struct device_node *np, struct property *prop);
395 extern int of_remove_property(struct device_node *np, struct property *prop);
396 extern int of_update_property(struct device_node *np, struct property *newprop);
405 extern int of_attach_node(struct device_node *);
406 extern int of_detach_node(struct device_node *);
411 * struct property *prop;
418 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
421 * struct property *prop;
427 const char *of_prop_next_string(struct property *prop, const char *cur);
429 bool of_console_check(struct device_node *dn, char *name, int index);
431 extern int of_cpu_node_to_id(struct device_node *np);
433 int of_map_id(struct device_node *np, u32 id,
472 return "<no-node>"; in of_node_full_name()
559 static inline int of_device_is_compatible(const struct device_node *device, in of_device_is_compatible()
565 static inline int of_device_compatible_match(const struct device_node *device, in of_device_compatible_match()
581 static inline struct property *of_find_property(const struct device_node *np, in of_find_property()
583 int *lenp) in of_find_property()
596 static inline int of_property_count_elems_of_size(const struct device_node *np, in of_property_count_elems_of_size()
597 const char *propname, int elem_size) in of_property_count_elems_of_size()
599 return -ENOSYS; in of_property_count_elems_of_size()
602 static inline int of_property_read_u32_index(const struct device_node *np, in of_property_read_u32_index()
605 return -ENOSYS; in of_property_read_u32_index()
608 static inline int of_property_read_u64_index(const struct device_node *np, in of_property_read_u64_index()
611 return -ENOSYS; in of_property_read_u64_index()
616 int *lenp) in of_get_property()
621 static inline struct device_node *of_get_cpu_node(int cpu, in of_get_cpu_node()
622 unsigned int *thread) in of_get_cpu_node()
633 int index) in of_get_cpu_state_node()
638 static inline int of_n_addr_cells(struct device_node *np) in of_n_addr_cells()
643 static inline int of_n_size_cells(struct device_node *np) in of_n_size_cells()
648 static inline int of_property_read_variable_u8_array(const struct device_node *np, in of_property_read_variable_u8_array()
652 return -ENOSYS; in of_property_read_variable_u8_array()
655 static inline int of_property_read_variable_u16_array(const struct device_node *np, in of_property_read_variable_u16_array()
659 return -ENOSYS; in of_property_read_variable_u16_array()
662 static inline int of_property_read_variable_u32_array(const struct device_node *np, in of_property_read_variable_u32_array()
668 return -ENOSYS; in of_property_read_variable_u32_array()
671 static inline int of_property_read_u64(const struct device_node *np, in of_property_read_u64()
674 return -ENOSYS; in of_property_read_u64()
677 static inline int of_property_read_variable_u64_array(const struct device_node *np, in of_property_read_variable_u64_array()
683 return -ENOSYS; in of_property_read_variable_u64_array()
686 static inline int of_property_read_string(const struct device_node *np, in of_property_read_string()
690 return -ENOSYS; in of_property_read_string()
693 static inline int of_property_match_string(const struct device_node *np, in of_property_match_string()
697 return -ENOSYS; in of_property_match_string()
700 static inline int of_property_read_string_helper(const struct device_node *np, in of_property_read_string_helper()
702 const char **out_strs, size_t sz, int index) in of_property_read_string_helper()
704 return -ENOSYS; in of_property_read_string_helper()
707 static inline int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args()
710 int cell_count, in __of_parse_phandle_with_args()
711 int index, in __of_parse_phandle_with_args()
714 return -ENOSYS; in __of_parse_phandle_with_args()
717 static inline int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map()
720 int index, in of_parse_phandle_with_args_map()
723 return -ENOSYS; in of_parse_phandle_with_args_map()
726 static inline int of_count_phandle_with_args(const struct device_node *np, in of_count_phandle_with_args()
730 return -ENOSYS; in of_count_phandle_with_args()
733 static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, in of_phandle_iterator_init()
737 int cell_count) in of_phandle_iterator_init()
739 return -ENOSYS; in of_phandle_iterator_init()
742 static inline int of_phandle_iterator_next(struct of_phandle_iterator *it) in of_phandle_iterator_next()
744 return -ENOSYS; in of_phandle_iterator_next()
747 static inline int of_phandle_iterator_args(struct of_phandle_iterator *it, in of_phandle_iterator_args()
749 int size) in of_phandle_iterator_args()
754 static inline int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id()
756 return -ENOSYS; in of_alias_get_id()
759 static inline int of_alias_get_highest_id(const char *stem) in of_alias_get_highest_id()
761 return -ENOSYS; in of_alias_get_highest_id()
764 static inline int of_machine_is_compatible(const char *compat) in of_machine_is_compatible()
769 static inline int of_add_property(struct device_node *np, struct property *prop) in of_add_property()
774 static inline int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property()
779 static inline bool of_console_check(const struct device_node *dn, const char *name, int index) in of_console_check()
784 static inline const __be32 *of_prop_next_u32(struct property *prop, in of_prop_next_u32()
790 static inline const char *of_prop_next_string(struct property *prop, in of_prop_next_string()
796 static inline int of_node_check_flag(struct device_node *n, unsigned long flag) in of_node_check_flag()
801 static inline int of_node_test_and_set_flag(struct device_node *n, in of_node_test_and_set_flag()
815 static inline int of_property_check_flag(const struct property *p, in of_property_check_flag()
821 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
825 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
829 static inline int of_cpu_node_to_id(struct device_node *np) in of_cpu_node_to_id()
831 return -ENODEV; in of_cpu_node_to_id()
834 static inline int of_map_id(struct device_node *np, u32 id, in of_map_id()
838 return -EINVAL; in of_map_id()
857 static inline int of_prop_val_eq(struct property *p1, struct property *p2) in of_prop_val_eq()
859 return p1->length == p2->length && in of_prop_val_eq()
860 !memcmp(p1->value, p2->value, (size_t)p1->length); in of_prop_val_eq()
864 extern int of_node_to_nid(struct device_node *np);
866 static inline int of_node_to_nid(struct device_node *device) in of_node_to_nid()
873 extern int of_numa_init(void);
875 static inline int of_numa_init(void) in of_numa_init()
877 return -ENOSYS; in of_numa_init()
901 * of_parse_phandle - Resolve a phandle property to a device_node pointer
902 * @np: Pointer to device node holding phandle property
903 * @phandle_name: Name of property holding a phandle value
912 int index) in of_parse_phandle()
924 * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
926 * @list_name: property name that contains a list
927 * @cells_name: property name that specifies phandles' arguments count
935 * Caller is responsible to call of_node_put() on the returned out_args->np
941 * #list-cells = <2>;
945 * #list-cells = <1>;
953 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
955 static inline int of_parse_phandle_with_args(const struct device_node *np, in of_parse_phandle_with_args()
958 int index, in of_parse_phandle_with_args()
961 int cell_count = -1; in of_parse_phandle_with_args()
972 * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
974 * @list_name: property name that contains a list
983 * Caller is responsible to call of_node_put() on the returned out_args->np
1001 static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args()
1003 int cell_count, in of_parse_phandle_with_fixed_args()
1004 int index, in of_parse_phandle_with_fixed_args()
1012 * of_property_count_u8_elems - Count the number of u8 elements in a property
1014 * @np: device node from which the property value is to be read.
1015 * @propname: name of the property to be searched.
1017 * Search for a property in a device node and count the number of u8 elements
1020 * Return: The number of elements on sucess, -EINVAL if the property does
1021 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1022 * property does not have a value.
1024 static inline int of_property_count_u8_elems(const struct device_node *np, in of_property_count_u8_elems()
1031 * of_property_count_u16_elems - Count the number of u16 elements in a property
1033 * @np: device node from which the property value is to be read.
1034 * @propname: name of the property to be searched.
1036 * Search for a property in a device node and count the number of u16 elements
1039 * Return: The number of elements on sucess, -EINVAL if the property does
1040 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1041 * property does not have a value.
1043 static inline int of_property_count_u16_elems(const struct device_node *np, in of_property_count_u16_elems()
1050 * of_property_count_u32_elems - Count the number of u32 elements in a property
1052 * @np: device node from which the property value is to be read.
1053 * @propname: name of the property to be searched.
1055 * Search for a property in a device node and count the number of u32 elements
1058 * Return: The number of elements on sucess, -EINVAL if the property does
1059 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1060 * property does not have a value.
1062 static inline int of_property_count_u32_elems(const struct device_node *np, in of_property_count_u32_elems()
1069 * of_property_count_u64_elems - Count the number of u64 elements in a property
1071 * @np: device node from which the property value is to be read.
1072 * @propname: name of the property to be searched.
1074 * Search for a property in a device node and count the number of u64 elements
1077 * Return: The number of elements on sucess, -EINVAL if the property does
1078 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1079 * property does not have a value.
1081 static inline int of_property_count_u64_elems(const struct device_node *np, in of_property_count_u64_elems()
1088 * of_property_read_string_array() - Read an array of strings from a multiple
1089 * strings property.
1090 * @np: device node from which the property value is to be read.
1091 * @propname: name of the property to be searched.
1095 * Search for a property in a device tree node and retrieve a list of
1096 * terminated string values (pointer to data, not a copy) in that property.
1098 * Return: If @out_strs is NULL, the number of strings in the property is returned.
1100 static inline int of_property_read_string_array(const struct device_node *np, in of_property_read_string_array()
1108 * of_property_count_strings() - Find and return the number of strings from a
1109 * multiple strings property.
1110 * @np: device node from which the property value is to be read.
1111 * @propname: name of the property to be searched.
1113 * Search for a property in a device tree node and retrieve the number of null
1116 * Return: The number of strings on success, -EINVAL if the property does not
1117 * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1118 * is not null-terminated within the length of the property data.
1120 static inline int of_property_count_strings(const struct device_node *np, in of_property_count_strings()
1127 * of_property_read_string_index() - Find and read a string from a multiple
1128 * strings property.
1129 * @np: device node from which the property value is to be read.
1130 * @propname: name of the property to be searched.
1135 * Search for a property in a device tree node and retrieve a null
1137 * contained in that property.
1139 * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
1140 * property does not have a value, and -EILSEQ if the string is not
1141 * null-terminated within the length of the property data.
1145 static inline int of_property_read_string_index(const struct device_node *np, in of_property_read_string_index()
1147 int index, const char **output) in of_property_read_string_index()
1149 int rc = of_property_read_string_helper(np, propname, output, 1, index); in of_property_read_string_index()
1154 * of_property_read_bool - Find a property
1155 * @np: device node from which the property value is to be read.
1156 * @propname: name of the property to be searched.
1158 * Search for a property in a device node.
1160 * Return: true if the property exists false otherwise.
1165 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_bool()
1171 * of_property_read_u8_array - Find and read an array of u8 from a property.
1173 * @np: device node from which the property value is to be read.
1174 * @propname: name of the property to be searched.
1178 * Search for a property in a device node and read 8-bit value(s) from
1182 * ``property = /bits/ 8 <0x50 0x60 0x70>;``
1184 * Return: 0 on success, -EINVAL if the property does not exist,
1185 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1186 * property data isn't large enough.
1190 static inline int of_property_read_u8_array(const struct device_node *np, in of_property_read_u8_array()
1194 int ret = of_property_read_variable_u8_array(np, propname, out_values, in of_property_read_u8_array()
1203 * of_property_read_u16_array - Find and read an array of u16 from a property.
1205 * @np: device node from which the property value is to be read.
1206 * @propname: name of the property to be searched.
1210 * Search for a property in a device node and read 16-bit value(s) from
1214 * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
1216 * Return: 0 on success, -EINVAL if the property does not exist,
1217 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1218 * property data isn't large enough.
1222 static inline int of_property_read_u16_array(const struct device_node *np, in of_property_read_u16_array()
1226 int ret = of_property_read_variable_u16_array(np, propname, out_values, in of_property_read_u16_array()
1235 * of_property_read_u32_array - Find and read an array of 32 bit integers
1236 * from a property.
1238 * @np: device node from which the property value is to be read.
1239 * @propname: name of the property to be searched.
1243 * Search for a property in a device node and read 32-bit value(s) from
1246 * Return: 0 on success, -EINVAL if the property does not exist,
1247 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1248 * property data isn't large enough.
1252 static inline int of_property_read_u32_array(const struct device_node *np, in of_property_read_u32_array()
1256 int ret = of_property_read_variable_u32_array(np, propname, out_values, in of_property_read_u32_array()
1265 * of_property_read_u64_array - Find and read an array of 64 bit integers
1266 * from a property.
1268 * @np: device node from which the property value is to be read.
1269 * @propname: name of the property to be searched.
1273 * Search for a property in a device node and read 64-bit value(s) from
1276 * Return: 0 on success, -EINVAL if the property does not exist,
1277 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1278 * property data isn't large enough.
1282 static inline int of_property_read_u64_array(const struct device_node *np, in of_property_read_u64_array()
1286 int ret = of_property_read_variable_u64_array(np, propname, out_values, in of_property_read_u64_array()
1294 static inline int of_property_read_u8(const struct device_node *np, in of_property_read_u8()
1301 static inline int of_property_read_u16(const struct device_node *np, in of_property_read_u16()
1308 static inline int of_property_read_u32(const struct device_node *np, in of_property_read_u32()
1315 static inline int of_property_read_s32(const struct device_node *np, in of_property_read_s32()
1371 static inline int of_get_child_count(const struct device_node *np) in of_get_child_count()
1374 int num = 0; in of_get_child_count()
1382 static inline int of_get_available_child_count(const struct device_node *np) in of_get_available_child_count()
1385 int num = 0; in of_get_available_child_count()
1411 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
1412 typedef int (*of_init_fn_1_ret)(struct device_node *);
1423 * struct of_changeset_entry - Holds a changeset entry
1428 * @prop: pointer to the property affected
1429 * @old_prop: hold a pointer to the original property
1440 struct property *prop;
1441 struct property *old_prop;
1445 * struct of_changeset - changeset tracker structure
1450 * live tree. In case of an error, changes are rolled-back.
1465 extern int of_reconfig_notifier_register(struct notifier_block *);
1466 extern int of_reconfig_notifier_unregister(struct notifier_block *);
1467 extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd);
1468 extern int of_reconfig_get_state_change(unsigned long action,
1473 extern int of_changeset_apply(struct of_changeset *ocs);
1474 extern int of_changeset_revert(struct of_changeset *ocs);
1475 extern int of_changeset_action(struct of_changeset *ocs,
1477 struct property *prop);
1479 static inline int of_changeset_attach_node(struct of_changeset *ocs, in of_changeset_attach_node()
1485 static inline int of_changeset_detach_node(struct of_changeset *ocs, in of_changeset_detach_node()
1491 static inline int of_changeset_add_property(struct of_changeset *ocs, in of_changeset_add_property()
1492 struct device_node *np, struct property *prop) in of_changeset_add_property()
1497 static inline int of_changeset_remove_property(struct of_changeset *ocs, in of_changeset_remove_property()
1498 struct device_node *np, struct property *prop) in of_changeset_remove_property()
1503 static inline int of_changeset_update_property(struct of_changeset *ocs, in of_changeset_update_property()
1504 struct device_node *np, struct property *prop) in of_changeset_update_property()
1509 static inline int of_reconfig_notifier_register(struct notifier_block *nb) in of_reconfig_notifier_register()
1511 return -EINVAL; in of_reconfig_notifier_register()
1513 static inline int of_reconfig_notifier_unregister(struct notifier_block *nb) in of_reconfig_notifier_unregister()
1515 return -EINVAL; in of_reconfig_notifier_unregister()
1517 static inline int of_reconfig_notify(unsigned long action, in of_reconfig_notify()
1520 return -EINVAL; in of_reconfig_notify()
1522 static inline int of_reconfig_get_state_change(unsigned long action, in of_reconfig_get_state_change()
1525 return -EINVAL; in of_reconfig_get_state_change()
1530 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1537 return of_property_read_bool(np, "system-power-controller"); in of_device_is_system_power_controller()
1556 "pre-apply", in of_overlay_action_name()
1557 "post-apply", in of_overlay_action_name()
1558 "pre-remove", in of_overlay_action_name()
1559 "post-remove", in of_overlay_action_name()
1572 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
1573 int *ovcs_id);
1574 int of_overlay_remove(int *ovcs_id);
1575 int of_overlay_remove_all(void);
1577 int of_overlay_notifier_register(struct notifier_block *nb);
1578 int of_overlay_notifier_unregister(struct notifier_block *nb);
1582 static inline int of_overlay_fdt_apply(void *overlay_fdt, u32 overlay_fdt_size, in of_overlay_fdt_apply()
1583 int *ovcs_id) in of_overlay_fdt_apply()
1585 return -ENOTSUPP; in of_overlay_fdt_apply()
1588 static inline int of_overlay_remove(int *ovcs_id) in of_overlay_remove()
1590 return -ENOTSUPP; in of_overlay_remove()
1593 static inline int of_overlay_remove_all(void) in of_overlay_remove_all()
1595 return -ENOTSUPP; in of_overlay_remove_all()
1598 static inline int of_overlay_notifier_register(struct notifier_block *nb) in of_overlay_notifier_register()
1603 static inline int of_overlay_notifier_unregister(struct notifier_block *nb) in of_overlay_notifier_unregister()