Revision f0aa713f
b/device_tree.c | ||
---|---|---|
178 | 178 |
return r; |
179 | 179 |
} |
180 | 180 |
|
181 |
const void *qemu_devtree_getprop(void *fdt, const char *node_path, |
|
182 |
const char *property, int *lenp) |
|
183 |
{ |
|
184 |
int len; |
|
185 |
const void *r; |
|
186 |
if (!lenp) { |
|
187 |
lenp = &len; |
|
188 |
} |
|
189 |
r = fdt_getprop(fdt, findnode_nofail(fdt, node_path), property, lenp); |
|
190 |
if (!r) { |
|
191 |
fprintf(stderr, "%s: Couldn't get %s/%s: %s\n", __func__, |
|
192 |
node_path, property, fdt_strerror(*lenp)); |
|
193 |
exit(1); |
|
194 |
} |
|
195 |
return r; |
|
196 |
} |
|
197 |
|
|
198 |
uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path, |
|
199 |
const char *property) |
|
200 |
{ |
|
201 |
int len; |
|
202 |
const uint32_t *p = qemu_devtree_getprop(fdt, node_path, property, &len); |
|
203 |
if (len != 4) { |
|
204 |
fprintf(stderr, "%s: %s/%s not 4 bytes long (not a cell?)\n", |
|
205 |
__func__, node_path, property); |
|
206 |
exit(1); |
|
207 |
} |
|
208 |
return be32_to_cpu(*p); |
|
209 |
} |
|
210 |
|
|
181 | 211 |
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path) |
182 | 212 |
{ |
183 | 213 |
uint32_t r; |
b/device_tree.h | ||
---|---|---|
28 | 28 |
int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, |
29 | 29 |
const char *property, |
30 | 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); |
|
31 | 35 |
uint32_t qemu_devtree_get_phandle(void *fdt, const char *path); |
32 | 36 |
uint32_t qemu_devtree_alloc_phandle(void *fdt); |
33 | 37 |
int qemu_devtree_nop_node(void *fdt, const char *node_path); |
Also available in: Unified diff