Revision 5a4348d1 include/sysemu/device_tree.h

b/include/sysemu/device_tree.h
17 17
void *create_device_tree(int *sizep);
18 18
void *load_device_tree(const char *filename_path, int *sizep);
19 19

  
20
int qemu_devtree_setprop(void *fdt, const char *node_path,
21
                         const char *property, const void *val_array, int size);
22
int qemu_devtree_setprop_cell(void *fdt, const char *node_path,
23
                              const char *property, uint32_t val);
24
int qemu_devtree_setprop_u64(void *fdt, const char *node_path,
25
                             const char *property, uint64_t val);
26
int qemu_devtree_setprop_string(void *fdt, const char *node_path,
27
                                const char *property, const char *string);
28
int qemu_devtree_setprop_phandle(void *fdt, const char *node_path,
29
                                 const char *property,
30
                                 const char *target_node_path);
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);
35
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path);
36
uint32_t qemu_devtree_alloc_phandle(void *fdt);
37
int qemu_devtree_nop_node(void *fdt, const char *node_path);
38
int qemu_devtree_add_subnode(void *fdt, const char *name);
20
int qemu_fdt_setprop(void *fdt, const char *node_path,
21
                     const char *property, const void *val_array, int size);
22
int qemu_fdt_setprop_cell(void *fdt, const char *node_path,
23
                          const char *property, uint32_t val);
24
int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
25
                         const char *property, uint64_t val);
26
int qemu_fdt_setprop_string(void *fdt, const char *node_path,
27
                            const char *property, const char *string);
28
int qemu_fdt_setprop_phandle(void *fdt, const char *node_path,
29
                             const char *property,
30
                             const char *target_node_path);
31
const void *qemu_fdt_getprop(void *fdt, const char *node_path,
32
                             const char *property, int *lenp);
33
uint32_t qemu_fdt_getprop_cell(void *fdt, const char *node_path,
34
                               const char *property);
35
uint32_t qemu_fdt_get_phandle(void *fdt, const char *path);
36
uint32_t qemu_fdt_alloc_phandle(void *fdt);
37
int qemu_fdt_nop_node(void *fdt, const char *node_path);
38
int qemu_fdt_add_subnode(void *fdt, const char *name);
39 39

  
40
#define qemu_devtree_setprop_cells(fdt, node_path, property, ...)             \
40
#define qemu_fdt_setprop_cells(fdt, node_path, property, ...)                 \
41 41
    do {                                                                      \
42 42
        uint32_t qdt_tmp[] = { __VA_ARGS__ };                                 \
43 43
        int i;                                                                \
......
45 45
        for (i = 0; i < ARRAY_SIZE(qdt_tmp); i++) {                           \
46 46
            qdt_tmp[i] = cpu_to_be32(qdt_tmp[i]);                             \
47 47
        }                                                                     \
48
        qemu_devtree_setprop(fdt, node_path, property, qdt_tmp,               \
49
                             sizeof(qdt_tmp));                                \
48
        qemu_fdt_setprop(fdt, node_path, property, qdt_tmp,                   \
49
                         sizeof(qdt_tmp));                                    \
50 50
    } while (0)
51 51

  
52
void qemu_devtree_dumpdtb(void *fdt, int size);
52
void qemu_fdt_dumpdtb(void *fdt, int size);
53 53

  
54 54
/**
55
 * qemu_devtree_setprop_sized_cells_from_array:
55
 * qemu_fdt_setprop_sized_cells_from_array:
56 56
 * @fdt: device tree blob
57 57
 * @node_path: node to set property on
58 58
 * @property: property to set
......
72 72
 * the number of cells used for each element vary depending on the
73 73
 * #address-cells and #size-cells properties of their parent node.
74 74
 * If you know all your cell elements are one cell wide you can use the
75
 * simpler qemu_devtree_setprop_cells(). If you're not setting up the
76
 * array programmatically, qemu_devtree_setprop_sized_cells may be more
75
 * simpler qemu_fdt_setprop_cells(). If you're not setting up the
76
 * array programmatically, qemu_fdt_setprop_sized_cells may be more
77 77
 * convenient.
78 78
 *
79 79
 * Return value: 0 on success, <0 on error.
80 80
 */
81
int qemu_devtree_setprop_sized_cells_from_array(void *fdt,
82
                                                const char *node_path,
83
                                                const char *property,
84
                                                int numvalues,
85
                                                uint64_t *values);
81
int qemu_fdt_setprop_sized_cells_from_array(void *fdt,
82
                                            const char *node_path,
83
                                            const char *property,
84
                                            int numvalues,
85
                                            uint64_t *values);
86 86

  
87 87
/**
88
 * qemu_devtree_setprop_sized_cells:
88
 * qemu_fdt_setprop_sized_cells:
89 89
 * @fdt: device tree blob
90 90
 * @node_path: node to set property on
91 91
 * @property: property to set
......
97 97
 * used by this value" and "value".
98 98
 *
99 99
 * This is a convenience wrapper for the function
100
 * qemu_devtree_setprop_sized_cells_from_array().
100
 * qemu_fdt_setprop_sized_cells_from_array().
101 101
 *
102 102
 * Return value: 0 on success, <0 on error.
103 103
 */
104
#define qemu_devtree_setprop_sized_cells(fdt, node_path, property, ...)       \
105
    ({                                                                        \
106
        uint64_t qdt_tmp[] = { __VA_ARGS__ };                                 \
107
        qemu_devtree_setprop_sized_cells_from_array(fdt, node_path,           \
108
                                                    property,                 \
109
                                                    ARRAY_SIZE(qdt_tmp) / 2,  \
110
                                                    qdt_tmp);                 \
104
#define qemu_fdt_setprop_sized_cells(fdt, node_path, property, ...)       \
105
    ({                                                                    \
106
        uint64_t qdt_tmp[] = { __VA_ARGS__ };                             \
107
        qemu_fdt_setprop_sized_cells_from_array(fdt, node_path,           \
108
                                                property,                 \
109
                                                ARRAY_SIZE(qdt_tmp) / 2,  \
110
                                                qdt_tmp);                 \
111 111
    })
112 112

  
113 113
#endif /* __DEVICE_TREE_H__ */

Also available in: Unified diff