Lines Matching refs:fdt

58 static int make_fdt(void *fdt, int size, const char *aliases,  in make_fdt()  argument
67 CHECK(fdt_create(fdt, size)); in make_fdt()
68 CHECK(fdt_finish_reservemap(fdt)); in make_fdt()
69 CHECK(fdt_begin_node(fdt, "")); in make_fdt()
71 CHECK(fdt_begin_node(fdt, "aliases")); in make_fdt()
75 CHECK(fdt_property_string(fdt, name, value)); in make_fdt()
78 CHECK(fdt_end_node(fdt)); in make_fdt()
82 CHECK(fdt_begin_node(fdt, value)); in make_fdt()
83 CHECK(fdt_property_string(fdt, "compatible", in make_fdt()
86 CHECK(fdt_property_string(fdt, "status", "disabled")); in make_fdt()
87 CHECK(fdt_end_node(fdt)); in make_fdt()
90 CHECK(fdt_end_node(fdt)); in make_fdt()
91 CHECK(fdt_finish(fdt)); in make_fdt()
92 CHECK(fdt_pack(fdt)); in make_fdt()
99 os_write(fd, fdt, size); in make_fdt()
146 static int make_fdt_carveout_device(void *fdt, uint32_t na, uint32_t ns) in make_fdt_carveout_device() argument
189 offset = CHECK(fdt_add_subnode(fdt, 0, name + 1)); in make_fdt_carveout_device()
190 CHECK(fdt_setprop(fdt, offset, "reg", cells, (na + ns) * sizeof(*cells))); in make_fdt_carveout_device()
192 return fdtdec_set_carveout(fdt, name, "memory-region", 0, in make_fdt_carveout_device()
196 static int check_fdt_carveout(void *fdt, uint32_t address_cells, in check_fdt_carveout() argument
217 CHECK(fdtdec_get_carveout(fdt, name, "memory-region", 0, &carveout)); in check_fdt_carveout()
231 static int make_fdt_carveout(void *fdt, int size, uint32_t address_cells, in make_fdt_carveout() argument
242 CHECK(fdt_create(fdt, size)); in make_fdt_carveout()
243 CHECK(fdt_finish_reservemap(fdt)); in make_fdt_carveout()
244 CHECK(fdt_begin_node(fdt, "")); in make_fdt_carveout()
245 CHECK(fdt_property(fdt, "#address-cells", &na, sizeof(na))); in make_fdt_carveout()
246 CHECK(fdt_property(fdt, "#size-cells", &ns, sizeof(ns))); in make_fdt_carveout()
247 CHECK(fdt_end_node(fdt)); in make_fdt_carveout()
248 CHECK(fdt_finish(fdt)); in make_fdt_carveout()
249 CHECK(fdt_pack(fdt)); in make_fdt_carveout()
251 CHECK(fdt_open_into(fdt, fdt, FDT_SIZE)); in make_fdt_carveout()
253 err = make_fdt_carveout_device(fdt, address_cells, size_cells); in make_fdt_carveout()
265 os_write(fd, fdt, size); in make_fdt_carveout()
275 void *fdt; in check_carveout() local
277 fdt = malloc(FDT_SIZE); in check_carveout()
278 if (!fdt) { in check_carveout()
284 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 1, 1), 0); in check_carveout()
285 CHECKOK(check_fdt_carveout(fdt, 1, 1)); in check_carveout()
286 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 1, 2), 0); in check_carveout()
287 CHECKOK(check_fdt_carveout(fdt, 1, 2)); in check_carveout()
289 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 1, 1), -FDT_ERR_BADVALUE); in check_carveout()
290 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 1, 2), -FDT_ERR_BADVALUE); in check_carveout()
292 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 2, 1), 0); in check_carveout()
293 CHECKOK(check_fdt_carveout(fdt, 2, 1)); in check_carveout()
294 CHECKVAL(make_fdt_carveout(fdt, FDT_SIZE, 2, 2), 0); in check_carveout()
295 CHECKOK(check_fdt_carveout(fdt, 2, 2)); in check_carveout()
297 free(fdt); in check_carveout()