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(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(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(struct device_node *device,
351 int *lenp);
352 extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
355 int index);
358 for (pp = dn->properties; pp != NULL; pp = pp->next)
360 extern int of_n_addr_cells(struct device_node *np);
361 extern int of_n_size_cells(struct device_node *np);
364 extern int of_modalias_node(struct device_node *node, char *modalias, int len);
368 int index);
369 extern int of_parse_phandle_with_args(const struct device_node *np,
370 const char *list_name, const char *cells_name, int index,
372 extern int of_parse_phandle_with_args_map(const struct device_node *np,
373 const char *list_name, const char *stem_name, int index,
375 extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
376 const char *list_name, int cells_count, int index,
378 extern int of_count_phandle_with_args(const struct device_node *np,
382 extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
386 int cell_count);
388 extern int of_phandle_iterator_next(struct of_phandle_iterator *it);
389 extern int of_phandle_iterator_args(struct of_phandle_iterator *it,
391 int size);
394 extern int of_alias_get_id(struct device_node *np, const char *stem);
395 extern int of_alias_get_highest_id(const char *stem);
396 extern int of_alias_get_alias_list(const struct of_device_id *matches,
398 unsigned int nbits);
400 extern int of_machine_is_compatible(const char *compat);
402 extern int of_add_property(struct device_node *np, struct property *prop);
403 extern int of_remove_property(struct device_node *np, struct property *prop);
404 extern int of_update_property(struct device_node *np, struct property *newprop);
413 extern int of_attach_node(struct device_node *);
414 extern int of_detach_node(struct device_node *);
419 * of_property_read_u8_array - Find and read an array of u8 from a property.
421 * @np: device node from which the property value is to be read.
422 * @propname: name of the property to be searched.
426 * Search for a property in a device node and read 8-bit value(s) from
430 * ``property = /bits/ 8 <0x50 0x60 0x70>;``
432 * Return: 0 on success, -EINVAL if the property does not exist,
433 * -ENODATA if property does not have a value, and -EOVERFLOW if the
434 * property data isn't large enough.
438 static inline int of_property_read_u8_array(const struct device_node *np, in of_property_read_u8_array()
442 int ret = of_property_read_variable_u8_array(np, propname, out_values, in of_property_read_u8_array()
451 * of_property_read_u16_array - Find and read an array of u16 from a property.
453 * @np: device node from which the property value is to be read.
454 * @propname: name of the property to be searched.
458 * Search for a property in a device node and read 16-bit value(s) from
462 * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
464 * Return: 0 on success, -EINVAL if the property does not exist,
465 * -ENODATA if property does not have a value, and -EOVERFLOW if the
466 * property data isn't large enough.
470 static inline int of_property_read_u16_array(const struct device_node *np, in of_property_read_u16_array()
474 int ret = of_property_read_variable_u16_array(np, propname, out_values, in of_property_read_u16_array()
483 * of_property_read_u32_array - Find and read an array of 32 bit integers
484 * from a property.
486 * @np: device node from which the property value is to be read.
487 * @propname: name of the property to be searched.
491 * Search for a property in a device node and read 32-bit value(s) from
494 * Return: 0 on success, -EINVAL if the property does not exist,
495 * -ENODATA if property does not have a value, and -EOVERFLOW if the
496 * property data isn't large enough.
500 static inline int of_property_read_u32_array(const struct device_node *np, in of_property_read_u32_array()
504 int ret = of_property_read_variable_u32_array(np, propname, out_values, in of_property_read_u32_array()
513 * of_property_read_u64_array - Find and read an array of 64 bit integers
514 * from a property.
516 * @np: device node from which the property value is to be read.
517 * @propname: name of the property to be searched.
521 * Search for a property in a device node and read 64-bit value(s) from
524 * Return: 0 on success, -EINVAL if the property does not exist,
525 * -ENODATA if property does not have a value, and -EOVERFLOW if the
526 * property data isn't large enough.
530 static inline int of_property_read_u64_array(const struct device_node *np, in of_property_read_u64_array()
534 int ret = of_property_read_variable_u64_array(np, propname, out_values, in of_property_read_u64_array()
543 * struct property *prop;
550 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
553 * struct property *prop;
559 const char *of_prop_next_string(struct property *prop, const char *cur);
561 bool of_console_check(struct device_node *dn, char *name, int index);
563 extern int of_cpu_node_to_id(struct device_node *np);
565 int of_map_id(struct device_node *np, u32 id,
576 int ima_get_kexec_buffer(void **addr, size_t *size);
577 int ima_free_kexec_buffer(void);
606 return "<no-node>"; in of_node_full_name()
693 static inline int of_device_is_compatible(const struct device_node *device, in of_device_is_compatible()
699 static inline int of_device_compatible_match(struct device_node *device, in of_device_compatible_match()
715 static inline struct property *of_find_property(const struct device_node *np, in of_find_property()
717 int *lenp) in of_find_property()
730 static inline int of_property_count_elems_of_size(const struct device_node *np, in of_property_count_elems_of_size()
731 const char *propname, int elem_size) in of_property_count_elems_of_size()
733 return -ENOSYS; in of_property_count_elems_of_size()
736 static inline int of_property_read_u8_array(const struct device_node *np, in of_property_read_u8_array()
739 return -ENOSYS; in of_property_read_u8_array()
742 static inline int of_property_read_u16_array(const struct device_node *np, in of_property_read_u16_array()
745 return -ENOSYS; in of_property_read_u16_array()
748 static inline int of_property_read_u32_array(const struct device_node *np, in of_property_read_u32_array()
752 return -ENOSYS; in of_property_read_u32_array()
755 static inline int of_property_read_u64_array(const struct device_node *np, in of_property_read_u64_array()
759 return -ENOSYS; in of_property_read_u64_array()
762 static inline int of_property_read_u32_index(const struct device_node *np, in of_property_read_u32_index()
765 return -ENOSYS; in of_property_read_u32_index()
768 static inline int of_property_read_u64_index(const struct device_node *np, in of_property_read_u64_index()
771 return -ENOSYS; in of_property_read_u64_index()
776 int *lenp) in of_get_property()
781 static inline struct device_node *of_get_cpu_node(int cpu, in of_get_cpu_node()
782 unsigned int *thread) in of_get_cpu_node()
793 int index) in of_get_cpu_state_node()
798 static inline int of_n_addr_cells(struct device_node *np) in of_n_addr_cells()
803 static inline int of_n_size_cells(struct device_node *np) in of_n_size_cells()
808 static inline int of_property_read_variable_u8_array(const struct device_node *np, in of_property_read_variable_u8_array()
812 return -ENOSYS; in of_property_read_variable_u8_array()
815 static inline int of_property_read_variable_u16_array(const struct device_node *np, in of_property_read_variable_u16_array()
819 return -ENOSYS; in of_property_read_variable_u16_array()
822 static inline int of_property_read_variable_u32_array(const struct device_node *np, in of_property_read_variable_u32_array()
828 return -ENOSYS; in of_property_read_variable_u32_array()
831 static inline int of_property_read_u64(const struct device_node *np, in of_property_read_u64()
834 return -ENOSYS; in of_property_read_u64()
837 static inline int of_property_read_variable_u64_array(const struct device_node *np, in of_property_read_variable_u64_array()
843 return -ENOSYS; in of_property_read_variable_u64_array()
846 static inline int of_property_read_string(const struct device_node *np, in of_property_read_string()
850 return -ENOSYS; in of_property_read_string()
853 static inline int of_property_match_string(const struct device_node *np, in of_property_match_string()
857 return -ENOSYS; in of_property_match_string()
860 static inline int of_property_read_string_helper(const struct device_node *np, in of_property_read_string_helper()
862 const char **out_strs, size_t sz, int index) in of_property_read_string_helper()
864 return -ENOSYS; in of_property_read_string_helper()
869 int index) in of_parse_phandle()
874 static inline int of_parse_phandle_with_args(const struct device_node *np, in of_parse_phandle_with_args()
877 int index, in of_parse_phandle_with_args()
880 return -ENOSYS; in of_parse_phandle_with_args()
883 static inline int of_parse_phandle_with_args_map(const struct device_node *np, in of_parse_phandle_with_args_map()
886 int index, in of_parse_phandle_with_args_map()
889 return -ENOSYS; in of_parse_phandle_with_args_map()
892 static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, in of_parse_phandle_with_fixed_args()
893 const char *list_name, int cells_count, int index, in of_parse_phandle_with_fixed_args()
896 return -ENOSYS; in of_parse_phandle_with_fixed_args()
899 static inline int of_count_phandle_with_args(const struct device_node *np, in of_count_phandle_with_args()
903 return -ENOSYS; in of_count_phandle_with_args()
906 static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, in of_phandle_iterator_init()
910 int cell_count) in of_phandle_iterator_init()
912 return -ENOSYS; in of_phandle_iterator_init()
915 static inline int of_phandle_iterator_next(struct of_phandle_iterator *it) in of_phandle_iterator_next()
917 return -ENOSYS; in of_phandle_iterator_next()
920 static inline int of_phandle_iterator_args(struct of_phandle_iterator *it, in of_phandle_iterator_args()
922 int size) in of_phandle_iterator_args()
927 static inline int of_alias_get_id(struct device_node *np, const char *stem) in of_alias_get_id()
929 return -ENOSYS; in of_alias_get_id()
932 static inline int of_alias_get_highest_id(const char *stem) in of_alias_get_highest_id()
934 return -ENOSYS; in of_alias_get_highest_id()
937 static inline int of_alias_get_alias_list(const struct of_device_id *matches, in of_alias_get_alias_list()
939 unsigned int nbits) in of_alias_get_alias_list()
941 return -ENOSYS; in of_alias_get_alias_list()
944 static inline int of_machine_is_compatible(const char *compat) in of_machine_is_compatible()
949 static inline int of_add_property(struct device_node *np, struct property *prop) in of_add_property()
954 static inline int of_remove_property(struct device_node *np, struct property *prop) in of_remove_property()
959 static inline bool of_console_check(const struct device_node *dn, const char *name, int index) in of_console_check()
964 static inline const __be32 *of_prop_next_u32(struct property *prop, in of_prop_next_u32()
970 static inline const char *of_prop_next_string(struct property *prop, in of_prop_next_string()
976 static inline int of_node_check_flag(struct device_node *n, unsigned long flag) in of_node_check_flag()
981 static inline int of_node_test_and_set_flag(struct device_node *n, in of_node_test_and_set_flag()
995 static inline int of_property_check_flag(struct property *p, unsigned long flag) in of_property_check_flag()
1000 static inline void of_property_set_flag(struct property *p, unsigned long flag) in of_property_set_flag()
1004 static inline void of_property_clear_flag(struct property *p, unsigned long flag) in of_property_clear_flag()
1008 static inline int of_cpu_node_to_id(struct device_node *np) in of_cpu_node_to_id()
1010 return -ENODEV; in of_cpu_node_to_id()
1013 static inline int of_map_id(struct device_node *np, u32 id, in of_map_id()
1017 return -EINVAL; in of_map_id()
1036 static inline int of_prop_val_eq(struct property *p1, struct property *p2) in of_prop_val_eq()
1038 return p1->length == p2->length && in of_prop_val_eq()
1039 !memcmp(p1->value, p2->value, (size_t)p1->length); in of_prop_val_eq()
1043 extern int of_node_to_nid(struct device_node *np);
1045 static inline int of_node_to_nid(struct device_node *device) in of_node_to_nid()
1052 extern int of_numa_init(void);
1054 static inline int of_numa_init(void) in of_numa_init()
1056 return -ENOSYS; in of_numa_init()
1080 * of_property_count_u8_elems - Count the number of u8 elements in a property
1082 * @np: device node from which the property value is to be read.
1083 * @propname: name of the property to be searched.
1085 * Search for a property in a device node and count the number of u8 elements
1088 * Return: The number of elements on sucess, -EINVAL if the property does
1089 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1090 * property does not have a value.
1092 static inline int of_property_count_u8_elems(const struct device_node *np, in of_property_count_u8_elems()
1099 * of_property_count_u16_elems - Count the number of u16 elements in a property
1101 * @np: device node from which the property value is to be read.
1102 * @propname: name of the property to be searched.
1104 * Search for a property in a device node and count the number of u16 elements
1107 * Return: The number of elements on sucess, -EINVAL if the property does
1108 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1109 * property does not have a value.
1111 static inline int of_property_count_u16_elems(const struct device_node *np, in of_property_count_u16_elems()
1118 * of_property_count_u32_elems - Count the number of u32 elements in a property
1120 * @np: device node from which the property value is to be read.
1121 * @propname: name of the property to be searched.
1123 * Search for a property in a device node and count the number of u32 elements
1126 * Return: The number of elements on sucess, -EINVAL if the property does
1127 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1128 * property does not have a value.
1130 static inline int of_property_count_u32_elems(const struct device_node *np, in of_property_count_u32_elems()
1137 * of_property_count_u64_elems - Count the number of u64 elements in a property
1139 * @np: device node from which the property value is to be read.
1140 * @propname: name of the property to be searched.
1142 * Search for a property in a device node and count the number of u64 elements
1145 * Return: The number of elements on sucess, -EINVAL if the property does
1146 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1147 * property does not have a value.
1149 static inline int of_property_count_u64_elems(const struct device_node *np, in of_property_count_u64_elems()
1156 * of_property_read_string_array() - Read an array of strings from a multiple
1157 * strings property.
1158 * @np: device node from which the property value is to be read.
1159 * @propname: name of the property to be searched.
1163 * Search for a property in a device tree node and retrieve a list of
1164 * terminated string values (pointer to data, not a copy) in that property.
1166 * Return: If @out_strs is NULL, the number of strings in the property is returned.
1168 static inline int of_property_read_string_array(const struct device_node *np, in of_property_read_string_array()
1176 * of_property_count_strings() - Find and return the number of strings from a
1177 * multiple strings property.
1178 * @np: device node from which the property value is to be read.
1179 * @propname: name of the property to be searched.
1181 * Search for a property in a device tree node and retrieve the number of null
1184 * Return: The number of strings on success, -EINVAL if the property does not
1185 * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1186 * is not null-terminated within the length of the property data.
1188 static inline int of_property_count_strings(const struct device_node *np, in of_property_count_strings()
1195 * of_property_read_string_index() - Find and read a string from a multiple
1196 * strings property.
1197 * @np: device node from which the property value is to be read.
1198 * @propname: name of the property to be searched.
1203 * Search for a property in a device tree node and retrieve a null
1205 * contained in that property.
1207 * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
1208 * property does not have a value, and -EILSEQ if the string is not
1209 * null-terminated within the length of the property data.
1213 static inline int of_property_read_string_index(const struct device_node *np, in of_property_read_string_index()
1215 int index, const char **output) in of_property_read_string_index()
1217 int rc = of_property_read_string_helper(np, propname, output, 1, index); in of_property_read_string_index()
1222 * of_property_read_bool - Find a property
1223 * @np: device node from which the property value is to be read.
1224 * @propname: name of the property to be searched.
1226 * Search for a property in a device node.
1228 * Return: true if the property exists false otherwise.
1233 struct property *prop = of_find_property(np, propname, NULL); in of_property_read_bool()
1238 static inline int of_property_read_u8(const struct device_node *np, in of_property_read_u8()
1245 static inline int of_property_read_u16(const struct device_node *np, in of_property_read_u16()
1252 static inline int of_property_read_u32(const struct device_node *np, in of_property_read_u32()
1259 static inline int of_property_read_s32(const struct device_node *np, in of_property_read_s32()
1315 static inline int of_get_child_count(const struct device_node *np) in of_get_child_count()
1318 int num = 0; in of_get_child_count()
1326 static inline int of_get_available_child_count(const struct device_node *np) in of_get_available_child_count()
1329 int num = 0; in of_get_available_child_count()
1355 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
1356 typedef int (*of_init_fn_1_ret)(struct device_node *);
1367 * struct of_changeset_entry - Holds a changeset entry
1372 * @prop: pointer to the property affected
1373 * @old_prop: hold a pointer to the original property
1384 struct property *prop;
1385 struct property *old_prop;
1389 * struct of_changeset - changeset tracker structure
1394 * live tree. In case of an error, changes are rolled-back.
1409 extern int of_reconfig_notifier_register(struct notifier_block *);
1410 extern int of_reconfig_notifier_unregister(struct notifier_block *);
1411 extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd);
1412 extern int of_reconfig_get_state_change(unsigned long action,
1417 extern int of_changeset_apply(struct of_changeset *ocs);
1418 extern int of_changeset_revert(struct of_changeset *ocs);
1419 extern int of_changeset_action(struct of_changeset *ocs,
1421 struct property *prop);
1423 static inline int of_changeset_attach_node(struct of_changeset *ocs, in of_changeset_attach_node()
1429 static inline int of_changeset_detach_node(struct of_changeset *ocs, in of_changeset_detach_node()
1435 static inline int of_changeset_add_property(struct of_changeset *ocs, in of_changeset_add_property()
1436 struct device_node *np, struct property *prop) in of_changeset_add_property()
1441 static inline int of_changeset_remove_property(struct of_changeset *ocs, in of_changeset_remove_property()
1442 struct device_node *np, struct property *prop) in of_changeset_remove_property()
1447 static inline int of_changeset_update_property(struct of_changeset *ocs, in of_changeset_update_property()
1448 struct device_node *np, struct property *prop) in of_changeset_update_property()
1453 static inline int of_reconfig_notifier_register(struct notifier_block *nb) in of_reconfig_notifier_register()
1455 return -EINVAL; in of_reconfig_notifier_register()
1457 static inline int of_reconfig_notifier_unregister(struct notifier_block *nb) in of_reconfig_notifier_unregister()
1459 return -EINVAL; in of_reconfig_notifier_unregister()
1461 static inline int of_reconfig_notify(unsigned long action, in of_reconfig_notify()
1464 return -EINVAL; in of_reconfig_notify()
1466 static inline int of_reconfig_get_state_change(unsigned long action, in of_reconfig_get_state_change()
1469 return -EINVAL; in of_reconfig_get_state_change()
1474 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1481 return of_property_read_bool(np, "system-power-controller"); in of_device_is_system_power_controller()
1502 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
1503 int *ovcs_id);
1504 int of_overlay_remove(int *ovcs_id);
1505 int of_overlay_remove_all(void);
1507 int of_overlay_notifier_register(struct notifier_block *nb);
1508 int of_overlay_notifier_unregister(struct notifier_block *nb);
1512 static inline int of_overlay_fdt_apply(void *overlay_fdt, u32 overlay_fdt_size, in of_overlay_fdt_apply()
1513 int *ovcs_id) in of_overlay_fdt_apply()
1515 return -ENOTSUPP; in of_overlay_fdt_apply()
1518 static inline int of_overlay_remove(int *ovcs_id) in of_overlay_remove()
1520 return -ENOTSUPP; in of_overlay_remove()
1523 static inline int of_overlay_remove_all(void) in of_overlay_remove_all()
1525 return -ENOTSUPP; in of_overlay_remove_all()
1528 static inline int of_overlay_notifier_register(struct notifier_block *nb) in of_overlay_notifier_register()
1533 static inline int of_overlay_notifier_unregister(struct notifier_block *nb) in of_overlay_notifier_unregister()