Blame view
include/linux/of_fdt.h
3.99 KB
d8678b587
|
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
|
14 15 |
#include <linux/types.h> #include <linux/init.h> |
d503187b6
|
16 |
#include <linux/errno.h> |
8482f5680
|
17 |
|
d8678b587
|
18 19 |
/* Definitions used by the flattened device tree */ #define OF_DT_HEADER 0xd00dfeed /* marker */ |
d8678b587
|
20 |
|
d45d94f67
|
21 |
#ifndef __ASSEMBLY__ |
d45d94f67
|
22 |
|
cf32eb89c
|
23 |
#if defined(CONFIG_OF_FLATTREE) |
9706a36e3
|
24 |
|
a08174873
|
25 |
struct device_node; |
9706a36e3
|
26 |
/* For scanning an arbitrary device-tree at any time */ |
c972de149
|
27 28 |
extern char *of_fdt_get_string(const void *blob, u32 offset); extern void *of_fdt_get_property(const void *blob, |
9706a36e3
|
29 30 |
unsigned long node, const char *name, |
9d0c4dfed
|
31 |
int *size); |
c972de149
|
32 |
extern int of_fdt_is_compatible(const void *blob, |
9706a36e3
|
33 34 |
unsigned long node, const char *compat); |
cc7837867
|
35 36 |
extern bool of_fdt_is_big_endian(const void *blob, unsigned long node); |
c972de149
|
37 |
extern int of_fdt_match(const void *blob, unsigned long node, |
7b482c836
|
38 |
const char *const *compat); |
83262418b
|
39 40 41 |
extern void *of_fdt_unflatten_tree(const unsigned long *blob, struct device_node *dad, struct device_node **mynodes); |
9706a36e3
|
42 |
|
e169cfbef
|
43 |
/* TBD: Temporary export of fdt globals - remove when code fully merged */ |
f00abd949
|
44 45 |
extern int __initdata dt_root_addr_cells; extern int __initdata dt_root_size_cells; |
1daa0c4ce
|
46 |
extern void *initial_boot_params; |
e169cfbef
|
47 |
|
ccf3356e6
|
48 49 |
extern char __dtb_start[]; extern char __dtb_end[]; |
8482f5680
|
50 |
/* For scanning the flat device-tree at boot time */ |
31a6a87df
|
51 52 53 |
extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, int depth, void *data), void *data); |
9c6098685
|
54 55 |
extern int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname); |
9d0c4dfed
|
56 57 |
extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, int *size); |
31a6a87df
|
58 |
extern int of_flat_dt_is_compatible(unsigned long node, const char *name); |
7b482c836
|
59 |
extern int of_flat_dt_match(unsigned long node, const char *const *matches); |
31a6a87df
|
60 |
extern unsigned long of_get_flat_dt_root(void); |
c0556d3f2
|
61 |
extern int of_get_flat_dt_size(void); |
32c97689c
|
62 |
|
86e032213
|
63 64 |
extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, int depth, void *data); |
51975db0b
|
65 66 |
extern int early_init_dt_scan_memory(unsigned long node, const char *uname, int depth, void *data); |
d503187b6
|
67 |
extern int early_init_dt_scan_chosen_stdout(void); |
e8d9d1f54
|
68 |
extern void early_init_fdt_scan_reserved_mem(void); |
24bbd929e
|
69 |
extern void early_init_fdt_reserve_self(void); |
51975db0b
|
70 |
extern void early_init_dt_add_memory_arch(u64 base, u64 size); |
e8d9d1f54
|
71 72 |
extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, bool no_map); |
fe55c1844
|
73 |
extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); |
9d0c4dfed
|
74 |
extern u64 dt_mem_next_cell(int s, const __be32 **cellp); |
8482f5680
|
75 |
|
f00abd949
|
76 77 78 |
/* Early flat tree scan hooks */ extern int early_init_dt_scan_root(unsigned long node, const char *uname, int depth, void *data); |
0288ffcbf
|
79 |
extern bool early_init_dt_scan(void *params); |
4972a74b8
|
80 81 |
extern bool early_init_dt_verify(void *params); extern void early_init_dt_scan_nodes(void); |
0288ffcbf
|
82 |
|
6a903a255
|
83 84 85 |
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
|
86 |
/* Other Prototypes */ |
82b2928c9
|
87 |
extern void unflatten_device_tree(void); |
a8bf7527a
|
88 |
extern void unflatten_and_copy_device_tree(void); |
82b2928c9
|
89 |
extern void early_init_devtree(void *); |
b27652dd2
|
90 |
extern void early_get_first_memblock_info(void *, phys_addr_t *); |
c90fe9c03
|
91 |
extern u64 of_flat_dt_translate_address(unsigned long node); |
704033cee
|
92 |
extern void of_fdt_limit_memory(int limit); |
8bfe9b5c3
|
93 |
#else /* CONFIG_OF_FLATTREE */ |
d503187b6
|
94 |
static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; } |
e8d9d1f54
|
95 |
static inline void early_init_fdt_scan_reserved_mem(void) {} |
24bbd929e
|
96 |
static inline void early_init_fdt_reserve_self(void) {} |
6a903a255
|
97 |
static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } |
8bfe9b5c3
|
98 |
static inline void unflatten_device_tree(void) {} |
a8bf7527a
|
99 |
static inline void unflatten_and_copy_device_tree(void) {} |
cf32eb89c
|
100 |
#endif /* CONFIG_OF_FLATTREE */ |
82b2928c9
|
101 |
|
d45d94f67
|
102 |
#endif /* __ASSEMBLY__ */ |
d8678b587
|
103 |
#endif /* _LINUX_OF_FDT_H */ |