]>
Commit | Line | Data |
---|---|---|
f652e6af AJ |
1 | /* |
2 | * Header with function prototypes to help device tree manipulation using | |
3 | * libfdt. It also provides functions to read entries from device tree proc | |
4 | * interface. | |
5 | * | |
6 | * Copyright 2008 IBM Corporation. | |
7 | * Authors: Jerone Young <[email protected]> | |
8 | * Hollis Blanchard <[email protected]> | |
9 | * | |
10 | * This work is licensed under the GNU GPL license version 2 or later. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef __DEVICE_TREE_H__ | |
15 | #define __DEVICE_TREE_H__ | |
16 | ||
ce36252c | 17 | void *create_device_tree(int *sizep); |
7ec632b4 | 18 | void *load_device_tree(const char *filename_path, int *sizep); |
f652e6af AJ |
19 | |
20 | int qemu_devtree_setprop(void *fdt, const char *node_path, | |
45e9dfb2 | 21 | const char *property, const void *val_array, int size); |
f652e6af AJ |
22 | int qemu_devtree_setprop_cell(void *fdt, const char *node_path, |
23 | const char *property, uint32_t val); | |
bb28eb37 AG |
24 | int qemu_devtree_setprop_u64(void *fdt, const char *node_path, |
25 | const char *property, uint64_t val); | |
f652e6af AJ |
26 | int qemu_devtree_setprop_string(void *fdt, const char *node_path, |
27 | const char *property, const char *string); | |
8535ab12 AG |
28 | int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, |
29 | const char *property, | |
30 | const char *target_node_path); | |
f0aa713f PM |
31 | const void *qemu_devtree_getprop(void *fdt, const char *node_path, |
32 | const char *property, int *lenp); | |
33 | uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path, | |
34 | const char *property); | |
7d5fd108 | 35 | uint32_t qemu_devtree_get_phandle(void *fdt, const char *path); |
3601b572 | 36 | uint32_t qemu_devtree_alloc_phandle(void *fdt); |
d69a8e63 | 37 | int qemu_devtree_nop_node(void *fdt, const char *node_path); |
80ad7816 | 38 | int qemu_devtree_add_subnode(void *fdt, const char *name); |
f652e6af | 39 | |
7ae2291e AG |
40 | #define qemu_devtree_setprop_cells(fdt, node_path, property, ...) \ |
41 | do { \ | |
42 | uint32_t qdt_tmp[] = { __VA_ARGS__ }; \ | |
43 | int i; \ | |
44 | \ | |
45 | for (i = 0; i < ARRAY_SIZE(qdt_tmp); i++) { \ | |
46 | qdt_tmp[i] = cpu_to_be32(qdt_tmp[i]); \ | |
47 | } \ | |
48 | qemu_devtree_setprop(fdt, node_path, property, qdt_tmp, \ | |
49 | sizeof(qdt_tmp)); \ | |
50 | } while (0) | |
51 | ||
71193433 AG |
52 | void qemu_devtree_dumpdtb(void *fdt, int size); |
53 | ||
f652e6af | 54 | #endif /* __DEVICE_TREE_H__ */ |