]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/of_fdt.h
KVM: arm64: vgic-its: Implement vgic_mmio_uaccess_write_its_iidr
[mirror_ubuntu-artful-kernel.git] / include / linux / of_fdt.h
CommitLineData
d8678b58
GL
1/*
2 * Definitions for working with the Flattened Device Tree data format
3 *
4 * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
5 * benh@kernel.crashing.org
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_OF_FDT_H
13#define _LINUX_OF_FDT_H
14
8482f568
GL
15#include <linux/types.h>
16#include <linux/init.h>
d503187b 17#include <linux/errno.h>
8482f568 18
d8678b58
GL
19/* Definitions used by the flattened device tree */
20#define OF_DT_HEADER 0xd00dfeed /* marker */
d8678b58 21
d45d94f6 22#ifndef __ASSEMBLY__
d45d94f6 23
cf32eb89 24#if defined(CONFIG_OF_FLATTREE)
9706a36e 25
a0817487
GL
26struct device_node;
27
9706a36e 28/* For scanning an arbitrary device-tree at any time */
c972de14
RH
29extern char *of_fdt_get_string(const void *blob, u32 offset);
30extern void *of_fdt_get_property(const void *blob,
9706a36e
SN
31 unsigned long node,
32 const char *name,
9d0c4dfe 33 int *size);
c972de14 34extern int of_fdt_is_compatible(const void *blob,
9706a36e
SN
35 unsigned long node,
36 const char *compat);
cc783786
KC
37extern bool of_fdt_is_big_endian(const void *blob,
38 unsigned long node);
c972de14 39extern int of_fdt_match(const void *blob, unsigned long node,
7b482c83 40 const char *const *compat);
83262418
GS
41extern void *of_fdt_unflatten_tree(const unsigned long *blob,
42 struct device_node *dad,
43 struct device_node **mynodes);
9706a36e 44
e169cfbe 45/* TBD: Temporary export of fdt globals - remove when code fully merged */
f00abd94
GL
46extern int __initdata dt_root_addr_cells;
47extern int __initdata dt_root_size_cells;
1daa0c4c 48extern void *initial_boot_params;
e169cfbe 49
ccf3356e
RH
50extern char __dtb_start[];
51extern char __dtb_end[];
52
8482f568 53/* For scanning the flat device-tree at boot time */
31a6a87d
GL
54extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
55 int depth, void *data),
56 void *data);
9c609868
SZ
57extern int of_get_flat_dt_subnode_by_name(unsigned long node,
58 const char *uname);
9d0c4dfe
RH
59extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
60 int *size);
31a6a87d 61extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
7b482c83 62extern int of_flat_dt_match(unsigned long node, const char *const *matches);
31a6a87d 63extern unsigned long of_get_flat_dt_root(void);
c0556d3f 64extern int of_get_flat_dt_size(void);
32c97689 65
86e03221
GL
66extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
67 int depth, void *data);
51975db0
GL
68extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
69 int depth, void *data);
d503187b 70extern int early_init_dt_scan_chosen_stdout(void);
e8d9d1f5 71extern void early_init_fdt_scan_reserved_mem(void);
24bbd929 72extern void early_init_fdt_reserve_self(void);
51975db0 73extern void early_init_dt_add_memory_arch(u64 base, u64 size);
41a9ada3 74extern int early_init_dt_mark_hotplug_memory_arch(u64 base, u64 size);
e8d9d1f5
MS
75extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
76 bool no_map);
fe55c184 77extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
9d0c4dfe 78extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
8482f568 79
f00abd94
GL
80/* Early flat tree scan hooks */
81extern int early_init_dt_scan_root(unsigned long node, const char *uname,
82 int depth, void *data);
83
0288ffcb 84extern bool early_init_dt_scan(void *params);
4972a74b
LA
85extern bool early_init_dt_verify(void *params);
86extern void early_init_dt_scan_nodes(void);
0288ffcb 87
6a903a25
RH
88extern const char *of_flat_dt_get_machine_name(void);
89extern const void *of_flat_dt_match_machine(const void *default_match,
90 const void * (*get_next_compat)(const char * const**));
91
82b2928c 92/* Other Prototypes */
82b2928c 93extern void unflatten_device_tree(void);
a8bf7527 94extern void unflatten_and_copy_device_tree(void);
82b2928c 95extern void early_init_devtree(void *);
b27652dd 96extern void early_get_first_memblock_info(void *, phys_addr_t *);
c90fe9c0 97extern u64 of_flat_dt_translate_address(unsigned long node);
704033ce 98extern void of_fdt_limit_memory(int limit);
8bfe9b5c 99#else /* CONFIG_OF_FLATTREE */
d503187b 100static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; }
e8d9d1f5 101static inline void early_init_fdt_scan_reserved_mem(void) {}
24bbd929 102static inline void early_init_fdt_reserve_self(void) {}
6a903a25 103static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
8bfe9b5c 104static inline void unflatten_device_tree(void) {}
a8bf7527 105static inline void unflatten_and_copy_device_tree(void) {}
cf32eb89 106#endif /* CONFIG_OF_FLATTREE */
82b2928c 107
d45d94f6 108#endif /* __ASSEMBLY__ */
d8678b58 109#endif /* _LINUX_OF_FDT_H */