hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/of.h
....@@ -50,7 +50,6 @@
5050
5151 struct device_node {
5252 const char *name;
53
- const char *type;
5453 phandle phandle;
5554 const char *full_name;
5655 struct fwnode_handle fwnode;
....@@ -66,7 +65,6 @@
6665 unsigned long _flags;
6766 void *data;
6867 #if defined(CONFIG_SPARC)
69
- const char *path_component_name;
7068 unsigned int unique_id;
7169 struct of_irq_controller *irq_trans;
7270 #endif
....@@ -110,7 +108,7 @@
110108 #if defined(CONFIG_OF_KOBJ)
111109 kobject_init(&node->kobj, &of_node_ktype);
112110 #endif
113
- node->fwnode.ops = &of_fwnode_ops;
111
+ fwnode_init(&node->fwnode, &of_fwnode_ops);
114112 }
115113
116114 #if defined(CONFIG_OF_KOBJ)
....@@ -252,12 +250,6 @@
252250 #include <asm/prom.h>
253251 #endif
254252
255
-/* Default #address and #size cells. Allow arch asm/prom.h to override */
256
-#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
257
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
258
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
259
-#endif
260
-
261253 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
262254 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
263255
....@@ -358,6 +350,10 @@
358350 const char *name,
359351 int *lenp);
360352 extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
353
+extern struct device_node *of_get_next_cpu_node(struct device_node *prev);
354
+extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
355
+ int index);
356
+
361357 #define for_each_property_of_node(dn, pp) \
362358 for (pp = dn->properties; pp != NULL; pp = pp->next)
363359
....@@ -397,6 +393,9 @@
397393 extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
398394 extern int of_alias_get_id(struct device_node *np, const char *stem);
399395 extern int of_alias_get_highest_id(const char *stem);
396
+extern int of_alias_get_alias_list(const struct of_device_id *matches,
397
+ const char *stem, unsigned long *bitmap,
398
+ unsigned int nbits);
400399
401400 extern int of_machine_is_compatible(const char *compat);
402401
....@@ -555,6 +554,12 @@
555554
556555 extern int of_cpu_node_to_id(struct device_node *np);
557556
557
+int of_map_id(struct device_node *np, u32 id,
558
+ const char *map_name, const char *map_mask_name,
559
+ struct device_node **target, u32 *id_out);
560
+
561
+phys_addr_t of_dma_get_max_cpu_address(struct device_node *np);
562
+
558563 #else /* CONFIG_OF */
559564
560565 static inline void of_core_init(void)
....@@ -623,6 +628,11 @@
623628 }
624629
625630 static inline struct device_node *of_get_parent(const struct device_node *node)
631
+{
632
+ return NULL;
633
+}
634
+
635
+static inline struct device_node *of_get_next_parent(struct device_node *node)
626636 {
627637 return NULL;
628638 }
....@@ -755,6 +765,17 @@
755765
756766 static inline struct device_node *of_get_cpu_node(int cpu,
757767 unsigned int *thread)
768
+{
769
+ return NULL;
770
+}
771
+
772
+static inline struct device_node *of_get_next_cpu_node(struct device_node *prev)
773
+{
774
+ return NULL;
775
+}
776
+
777
+static inline struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
778
+ int index)
758779 {
759780 return NULL;
760781 }
....@@ -898,7 +919,24 @@
898919 return -ENOSYS;
899920 }
900921
922
+static inline int of_alias_get_alias_list(const struct of_device_id *matches,
923
+ const char *stem, unsigned long *bitmap,
924
+ unsigned int nbits)
925
+{
926
+ return -ENOSYS;
927
+}
928
+
901929 static inline int of_machine_is_compatible(const char *compat)
930
+{
931
+ return 0;
932
+}
933
+
934
+static inline int of_add_property(struct device_node *np, struct property *prop)
935
+{
936
+ return 0;
937
+}
938
+
939
+static inline int of_remove_property(struct device_node *np, struct property *prop)
902940 {
903941 return 0;
904942 }
....@@ -955,6 +993,18 @@
955993 static inline int of_cpu_node_to_id(struct device_node *np)
956994 {
957995 return -ENODEV;
996
+}
997
+
998
+static inline int of_map_id(struct device_node *np, u32 id,
999
+ const char *map_name, const char *map_mask_name,
1000
+ struct device_node **target, u32 *id_out)
1001
+{
1002
+ return -EINVAL;
1003
+}
1004
+
1005
+static inline phys_addr_t of_dma_get_max_cpu_address(struct device_node *np)
1006
+{
1007
+ return PHYS_ADDR_MAX;
9581008 }
9591009
9601010 #define of_match_ptr(_ptr) NULL
....@@ -1144,7 +1194,7 @@
11441194 }
11451195
11461196 /**
1147
- * of_property_read_bool - Findfrom a property
1197
+ * of_property_read_bool - Find a property
11481198 * @np: device node from which the property value is to be read.
11491199 * @propname: name of the property to be searched.
11501200 *
....@@ -1228,6 +1278,10 @@
12281278 for (child = of_get_next_available_child(parent, NULL); child != NULL; \
12291279 child = of_get_next_available_child(parent, child))
12301280
1281
+#define for_each_of_cpu_node(cpu) \
1282
+ for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \
1283
+ cpu = of_get_next_cpu_node(cpu))
1284
+
12311285 #define for_each_node_with_property(dn, prop_name) \
12321286 for (dn = of_find_node_with_property(NULL, prop_name); dn; \
12331287 dn = of_find_node_with_property(dn, prop_name))
....@@ -1257,7 +1311,7 @@
12571311 #if defined(CONFIG_OF) && !defined(MODULE)
12581312 #define _OF_DECLARE(table, name, compat, fn, fn_type) \
12591313 static const struct of_device_id __of_table_##name \
1260
- __used __section(__##table##_of_table) \
1314
+ __used __section("__" #table "_of_table") \
12611315 __aligned(__alignof__(struct of_device_id)) \
12621316 = { .compatible = compat, \
12631317 .data = (fn == (fn_type)NULL) ? fn : fn }