0001
0002 #ifndef _LINUX_OF_PRIVATE_H
0003 #define _LINUX_OF_PRIVATE_H
0004
0005
0006
0007
0008
0009
0010
0011 #define FDT_ALIGN_SIZE 8
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 struct alias_prop {
0025 struct list_head link;
0026 const char *alias;
0027 struct device_node *np;
0028 int id;
0029 char stem[];
0030 };
0031
0032 #if defined(CONFIG_SPARC)
0033 #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2
0034 #else
0035 #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
0036 #endif
0037
0038 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
0039
0040 extern struct mutex of_mutex;
0041 extern struct list_head aliases_lookup;
0042 extern struct kset *of_kset;
0043
0044 #if defined(CONFIG_OF_DYNAMIC)
0045 extern int of_property_notify(int action, struct device_node *np,
0046 struct property *prop, struct property *old_prop);
0047 extern void of_node_release(struct kobject *kobj);
0048 extern int __of_changeset_apply_entries(struct of_changeset *ocs,
0049 int *ret_revert);
0050 extern int __of_changeset_apply_notify(struct of_changeset *ocs);
0051 extern int __of_changeset_revert_entries(struct of_changeset *ocs,
0052 int *ret_apply);
0053 extern int __of_changeset_revert_notify(struct of_changeset *ocs);
0054 #else
0055 static inline int of_property_notify(int action, struct device_node *np,
0056 struct property *prop, struct property *old_prop)
0057 {
0058 return 0;
0059 }
0060 #endif
0061
0062 #if defined(CONFIG_OF_KOBJ)
0063 int of_node_is_attached(const struct device_node *node);
0064 int __of_add_property_sysfs(struct device_node *np, struct property *pp);
0065 void __of_remove_property_sysfs(struct device_node *np, struct property *prop);
0066 void __of_update_property_sysfs(struct device_node *np, struct property *newprop,
0067 struct property *oldprop);
0068 int __of_attach_node_sysfs(struct device_node *np);
0069 void __of_detach_node_sysfs(struct device_node *np);
0070 #else
0071 static inline int __of_add_property_sysfs(struct device_node *np, struct property *pp)
0072 {
0073 return 0;
0074 }
0075 static inline void __of_remove_property_sysfs(struct device_node *np, struct property *prop) {}
0076 static inline void __of_update_property_sysfs(struct device_node *np,
0077 struct property *newprop, struct property *oldprop) {}
0078 static inline int __of_attach_node_sysfs(struct device_node *np)
0079 {
0080 return 0;
0081 }
0082 static inline void __of_detach_node_sysfs(struct device_node *np) {}
0083 #endif
0084
0085 #if defined(CONFIG_OF_RESOLVE)
0086 int of_resolve_phandles(struct device_node *tree);
0087 #endif
0088
0089 void __of_phandle_cache_inv_entry(phandle handle);
0090
0091 #if defined(CONFIG_OF_OVERLAY)
0092 void of_overlay_mutex_lock(void);
0093 void of_overlay_mutex_unlock(void);
0094 #else
0095 static inline void of_overlay_mutex_lock(void) {};
0096 static inline void of_overlay_mutex_unlock(void) {};
0097 #endif
0098
0099 #if defined(CONFIG_OF_UNITTEST) && defined(CONFIG_OF_OVERLAY)
0100 extern void __init unittest_unflatten_overlay_base(void);
0101 #else
0102 static inline void unittest_unflatten_overlay_base(void) {};
0103 #endif
0104
0105 extern void *__unflatten_device_tree(const void *blob,
0106 struct device_node *dad,
0107 struct device_node **mynodes,
0108 void *(*dt_alloc)(u64 size, u64 align),
0109 bool detached);
0110
0111
0112
0113
0114
0115
0116
0117
0118 struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags);
0119 struct device_node *__of_node_dup(const struct device_node *np,
0120 const char *full_name);
0121
0122 struct device_node *__of_find_node_by_path(struct device_node *parent,
0123 const char *path);
0124 struct device_node *__of_find_node_by_full_path(struct device_node *node,
0125 const char *path);
0126
0127 extern const void *__of_get_property(const struct device_node *np,
0128 const char *name, int *lenp);
0129 extern int __of_add_property(struct device_node *np, struct property *prop);
0130 extern int __of_remove_property(struct device_node *np, struct property *prop);
0131 extern int __of_update_property(struct device_node *np,
0132 struct property *newprop, struct property **oldprop);
0133
0134 extern void __of_detach_node(struct device_node *np);
0135
0136 extern void __of_sysfs_remove_bin_file(struct device_node *np,
0137 struct property *prop);
0138
0139
0140 #define OF_PHANDLE_ILLEGAL 0xdeadbeef
0141
0142
0143
0144 #define for_each_transaction_entry(_oft, _te) \
0145 list_for_each_entry(_te, &(_oft)->te_list, node)
0146
0147
0148 #define for_each_transaction_entry_reverse(_oft, _te) \
0149 list_for_each_entry_reverse(_te, &(_oft)->te_list, node)
0150
0151 extern int of_bus_n_addr_cells(struct device_node *np);
0152 extern int of_bus_n_size_cells(struct device_node *np);
0153
0154 struct bus_dma_region;
0155 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_HAS_DMA)
0156 int of_dma_get_range(struct device_node *np,
0157 const struct bus_dma_region **map);
0158 #else
0159 static inline int of_dma_get_range(struct device_node *np,
0160 const struct bus_dma_region **map)
0161 {
0162 return -ENODEV;
0163 }
0164 #endif
0165
0166 void fdt_init_reserved_mem(void);
0167 void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
0168 phys_addr_t base, phys_addr_t size);
0169
0170 #endif