Blame view

include/linux/of_fdt.h 4.19 KB
d8678b587   Grant Likely   of: add common he...
1
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   * Definitions for working with the Flattened Device Tree data format
   *
   * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
   * benh@kernel.crashing.org
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * version 2 as published by the Free Software Foundation.
   */
  
  #ifndef _LINUX_OF_FDT_H
  #define _LINUX_OF_FDT_H
8482f5680   Grant Likely   of: merge of_*_fl...
14
15
  #include <linux/types.h>
  #include <linux/init.h>
d503187b6   Leif Lindholm   of/serial: move e...
16
  #include <linux/errno.h>
8482f5680   Grant Likely   of: merge of_*_fl...
17

d8678b587   Grant Likely   of: add common he...
18
19
  /* Definitions used by the flattened device tree */
  #define OF_DT_HEADER		0xd00dfeed	/* marker */
d8678b587   Grant Likely   of: add common he...
20

d45d94f67   Grant Likely   of: merge struct ...
21
  #ifndef __ASSEMBLY__
d45d94f67   Grant Likely   of: merge struct ...
22

cf32eb89c   Grant Likely   of/flattree: make...
23
  #if defined(CONFIG_OF_FLATTREE)
9706a36e3   Stephen Neuendorffer   of/flattree: Add ...
24

a08174873   Grant Likely   of/flattree: forw...
25
  struct device_node;
9706a36e3   Stephen Neuendorffer   of/flattree: Add ...
26
  /* For scanning an arbitrary device-tree at any time */
c972de149   Rob Herring   of/fdt: use libfd...
27
28
  extern char *of_fdt_get_string(const void *blob, u32 offset);
  extern void *of_fdt_get_property(const void *blob,
9706a36e3   Stephen Neuendorffer   of/flattree: Add ...
29
30
  				 unsigned long node,
  				 const char *name,
9d0c4dfed   Rob Herring   of/fdt: update of...
31
  				 int *size);
cc7837867   Kevin Cernekee   of/fdt: Add endia...
32
33
  extern bool of_fdt_is_big_endian(const void *blob,
  				 unsigned long node);
c972de149   Rob Herring   of/fdt: use libfd...
34
  extern int of_fdt_match(const void *blob, unsigned long node,
7b482c836   Uwe Kleine-König   ARM/of: allow *ma...
35
  			const char *const *compat);
83262418b   Gavin Shan   drivers/of: Retur...
36
37
38
  extern void *of_fdt_unflatten_tree(const unsigned long *blob,
  				   struct device_node *dad,
  				   struct device_node **mynodes);
9706a36e3   Stephen Neuendorffer   of/flattree: Add ...
39

e169cfbef   Grant Likely   of/flattree: merg...
40
  /* TBD: Temporary export of fdt globals - remove when code fully merged */
f00abd949   Grant Likely   of/flattree: Merg...
41
42
  extern int __initdata dt_root_addr_cells;
  extern int __initdata dt_root_size_cells;
1daa0c4ce   Rob Herring   of/fdt: convert i...
43
  extern void *initial_boot_params;
e169cfbef   Grant Likely   of/flattree: merg...
44

ccf3356e6   Rob Herring   of/fdt: consolida...
45
46
  extern char __dtb_start[];
  extern char __dtb_end[];
8482f5680   Grant Likely   of: merge of_*_fl...
47
  /* For scanning the flat device-tree at boot time */
31a6a87df   Grant Likely   of/flattree: remo...
48
49
50
  extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
  				     int depth, void *data),
  			   void *data);
ea47dd191   Nicholas Piggin   of/fdt: introduce...
51
52
53
54
55
  extern int of_scan_flat_dt_subnodes(unsigned long node,
  				    int (*it)(unsigned long node,
  					      const char *uname,
  					      void *data),
  				    void *data);
9c6098685   Shannon Zhao   FDT: Add a helper...
56
57
  extern int of_get_flat_dt_subnode_by_name(unsigned long node,
  					  const char *uname);
9d0c4dfed   Rob Herring   of/fdt: update of...
58
59
  extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
  				       int *size);
31a6a87df   Grant Likely   of/flattree: remo...
60
  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
7b482c836   Uwe Kleine-König   ARM/of: allow *ma...
61
  extern int of_flat_dt_match(unsigned long node, const char *const *matches);
31a6a87df   Grant Likely   of/flattree: remo...
62
  extern unsigned long of_get_flat_dt_root(void);
c0556d3f2   Rob Herring   of/fdt: introduce...
63
  extern int of_get_flat_dt_size(void);
ea47dd191   Nicholas Piggin   of/fdt: introduce...
64
  extern uint32_t of_get_flat_dt_phandle(unsigned long node);
32c97689c   Grant Likely   of/flattree: Elim...
65

86e032213   Grant Likely   of/flattree: merg...
66
67
  extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
  				     int depth, void *data);
51975db0b   Grant Likely   of/flattree: merg...
68
69
  extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
  				     int depth, void *data);
d503187b6   Leif Lindholm   of/serial: move e...
70
  extern int early_init_dt_scan_chosen_stdout(void);
e8d9d1f54   Marek Szyprowski   drivers: of: add ...
71
  extern void early_init_fdt_scan_reserved_mem(void);
24bbd929e   Ard Biesheuvel   of/fdt: split off...
72
  extern void early_init_fdt_reserve_self(void);
51975db0b   Grant Likely   of/flattree: merg...
73
  extern void early_init_dt_add_memory_arch(u64 base, u64 size);
41a9ada3e   Reza Arbab   of/fdt: mark hotp...
74
  extern int early_init_dt_mark_hotplug_memory_arch(u64 base, u64 size);
e8d9d1f54   Marek Szyprowski   drivers: of: add ...
75
76
  extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
  					     bool no_map);
fe55c1844   Grant Likely   Revert "dt: add o...
77
  extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
9d0c4dfed   Rob Herring   of/fdt: update of...
78
  extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
8482f5680   Grant Likely   of: merge of_*_fl...
79

f00abd949   Grant Likely   of/flattree: Merg...
80
81
82
  /* Early flat tree scan hooks */
  extern int early_init_dt_scan_root(unsigned long node, const char *uname,
  				   int depth, void *data);
0288ffcbf   Rob Herring   of: Introduce com...
83
  extern bool early_init_dt_scan(void *params);
4972a74b8   Laura Abbott   of: Split early_i...
84
85
  extern bool early_init_dt_verify(void *params);
  extern void early_init_dt_scan_nodes(void);
0288ffcbf   Rob Herring   of: Introduce com...
86

6a903a255   Rob Herring   of: introduce com...
87
88
89
  extern const char *of_flat_dt_get_machine_name(void);
  extern const void *of_flat_dt_match_machine(const void *default_match,
  		const void * (*get_next_compat)(const char * const**));
82b2928c9   Grant Likely   of: merge other m...
90
  /* Other Prototypes */
82b2928c9   Grant Likely   of: merge other m...
91
  extern void unflatten_device_tree(void);
a8bf7527a   Rob Herring   of: create unflat...
92
  extern void unflatten_and_copy_device_tree(void);
82b2928c9   Grant Likely   of: merge other m...
93
  extern void early_init_devtree(void *);
b27652dd2   Kevin Hao   powerpc: introduc...
94
  extern void early_get_first_memblock_info(void *, phys_addr_t *);
c90fe9c03   Peter Hurley   of: earlycon: Mov...
95
  extern u64 of_flat_dt_translate_address(unsigned long node);
704033cee   Laura Abbott   of: Add memory li...
96
  extern void of_fdt_limit_memory(int limit);
8bfe9b5c3   Grant Likely   of/flattree: Make...
97
  #else /* CONFIG_OF_FLATTREE */
d503187b6   Leif Lindholm   of/serial: move e...
98
  static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; }
e8d9d1f54   Marek Szyprowski   drivers: of: add ...
99
  static inline void early_init_fdt_scan_reserved_mem(void) {}
24bbd929e   Ard Biesheuvel   of/fdt: split off...
100
  static inline void early_init_fdt_reserve_self(void) {}
6a903a255   Rob Herring   of: introduce com...
101
  static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
8bfe9b5c3   Grant Likely   of/flattree: Make...
102
  static inline void unflatten_device_tree(void) {}
a8bf7527a   Rob Herring   of: create unflat...
103
  static inline void unflatten_and_copy_device_tree(void) {}
cf32eb89c   Grant Likely   of/flattree: make...
104
  #endif /* CONFIG_OF_FLATTREE */
82b2928c9   Grant Likely   of: merge other m...
105

d45d94f67   Grant Likely   of: merge struct ...
106
  #endif /* __ASSEMBLY__ */
d8678b587   Grant Likely   of: add common he...
107
  #endif /* _LINUX_OF_FDT_H */