Lines Matching refs:fdt

109 dump_fdt(const void *fdt)  in dump_fdt()  argument
111 if (!fdt) in dump_fdt()
114 int err = fdt_check_header(fdt); in dump_fdt()
124 while ((node = fdt_next_node(fdt, node, &depth)) >= 0 && depth >= 0) { in dump_fdt()
128 dprintf("node('%s')\n", fdt_get_name(fdt, node, NULL)); in dump_fdt()
130 …for (int prop = fdt_first_property_offset(fdt, node); prop >= 0; prop = fdt_next_property_offset(f… in dump_fdt()
132 const struct fdt_property *property = fdt_get_property_by_offset(fdt, prop, &len); in dump_fdt()
141 dprintf("prop('%s'): ", fdt_string(fdt, fdt32_to_cpu(property->nameoff))); in dump_fdt()
143 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "compatible") == 0 || in dump_fdt()
144 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "model") == 0 || in dump_fdt()
145 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "serial-number") == 0 || in dump_fdt()
146 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "status") == 0 || in dump_fdt()
147 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "device_type") == 0 || in dump_fdt()
148 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "riscv,isa") == 0 || in dump_fdt()
149 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "mmu-type") == 0 || in dump_fdt()
150 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "format") == 0 || in dump_fdt()
151 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "bootargs") == 0 || in dump_fdt()
152 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "stdout-path") == 0 || in dump_fdt()
153 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "reg-names") == 0 || in dump_fdt()
154 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "reset-names") == 0 || in dump_fdt()
155 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "clock-names") == 0 || in dump_fdt()
156 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "clock-output-names") == 0 in dump_fdt()
159 } else if (strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "reg") == 0) { in dump_fdt()
167 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "phandle") == 0 || in dump_fdt()
168 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "clock-frequency") == 0 || in dump_fdt()
169 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "timebase-frequency") == 0 || in dump_fdt()
170 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "#address-cells") == 0 || in dump_fdt()
171 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "#size-cells") == 0 || in dump_fdt()
172 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "#interrupt-cells") == 0 || in dump_fdt()
173 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "interrupts") == 0 || in dump_fdt()
174 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "interrupt-parent") == 0 || in dump_fdt()
175 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "boot-hartid") == 0 || in dump_fdt()
176 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "riscv,ndev") == 0 || in dump_fdt()
177 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "value") == 0 || in dump_fdt()
178 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "offset") == 0 || in dump_fdt()
179 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "regmap") == 0 || in dump_fdt()
180 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "bank-width") == 0 || in dump_fdt()
181 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "width") == 0 || in dump_fdt()
182 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "height") == 0 || in dump_fdt()
183 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "stride") == 0 in dump_fdt()
187 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "interrupts-extended") == 0 in dump_fdt()
196 strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "ranges") == 0 in dump_fdt()
220 } else if (strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "bus-range") == 0) { in dump_fdt()
223 } else if (strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "interrupt-map-mask") == 0) { in dump_fdt()
234 } else if (strcmp(fdt_string(fdt, fdt32_to_cpu(property->nameoff)), "interrupt-map") == 0) { in dump_fdt()
244 prop = (uint32*)fdt_getprop(fdt, node, "#address-cells", NULL); in dump_fdt()
248 prop = (uint32*)fdt_getprop(fdt, node, "#interrupt-cells", NULL); in dump_fdt()
283 int parentNode = fdt_node_offset_by_phandle(fdt, parentPhandle); in dump_fdt()
285 prop = (uint32*)fdt_getprop(fdt, parentNode, "#address-cells", NULL); in dump_fdt()
289 prop = (uint32*)fdt_getprop(fdt, parentNode, "#interrupt-cells", NULL); in dump_fdt()
341 dtb_get_address_cells(const void* fdt, int node) in dtb_get_address_cells() argument
345 int parent = fdt_parent_offset(fdt, node); in dtb_get_address_cells()
349 uint32 *prop = (uint32*)fdt_getprop(fdt, parent, "#address-cells", NULL); in dtb_get_address_cells()
359 dtb_get_size_cells(const void* fdt, int node) in dtb_get_size_cells() argument
363 int parent = fdt_parent_offset(fdt, node); in dtb_get_size_cells()
367 uint32 *prop = (uint32*)fdt_getprop(fdt, parent, "#size-cells", NULL); in dtb_get_size_cells()
377 dtb_get_reg(const void* fdt, int node, size_t idx, addr_range& range) in dtb_get_reg() argument
379 uint32 addressCells = dtb_get_address_cells(fdt, node); in dtb_get_reg()
380 uint32 sizeCells = dtb_get_size_cells(fdt, node); in dtb_get_reg()
383 const uint8* prop = (const uint8*)fdt_getprop(fdt, node, "reg", &propSize); in dtb_get_reg()
404 int parent = fdt_parent_offset(fdt, node); in dtb_get_reg()
406 uint32 parentAddressCells = dtb_get_address_cells(fdt, parent); in dtb_get_reg()
409 uint32 *ranges = (uint32 *)fdt_getprop(fdt, parent, "ranges", (int *)&rangesSize); in dtb_get_reg()
453 dtb_get_interrupt_parent(const void* fdt, int node) in dtb_get_interrupt_parent() argument
457 prop = (uint32*)fdt_getprop(fdt, node, "interrupt-parent", NULL); in dtb_get_interrupt_parent()
460 return fdt_node_offset_by_phandle(fdt, phandle); in dtb_get_interrupt_parent()
463 node = fdt_parent_offset(fdt, node); in dtb_get_interrupt_parent()
471 dtb_get_interrupt_cells(const void* fdt, int node) in dtb_get_interrupt_cells() argument
473 int intc_node = dtb_get_interrupt_parent(fdt, node); in dtb_get_interrupt_cells()
475 uint32* prop = (uint32*)fdt_getprop(fdt, intc_node, "#interrupt-cells", NULL); in dtb_get_interrupt_cells()
486 dtb_get_interrupt(const void* fdt, int node) in dtb_get_interrupt() argument
488 uint32 interruptCells = dtb_get_interrupt_cells(fdt, node); in dtb_get_interrupt()
490 if (uint32* prop = (uint32*)fdt_getprop(fdt, node, "interrupts-extended", NULL)) { in dtb_get_interrupt()
493 if (uint32* prop = (uint32*)fdt_getprop(fdt, node, "interrupts", NULL)) { in dtb_get_interrupt()
515 dtb_get_clock_frequency(const void* fdt, int node) in dtb_get_clock_frequency() argument
520 prop = (uint32*)fdt_getprop(fdt, node, "clock-frequency", NULL); in dtb_get_clock_frequency()
525 prop = (uint32*)fdt_getprop(fdt, node, "clocks", &len); in dtb_get_clock_frequency()
528 int offset = fdt_node_offset_by_phandle(fdt, phandle); in dtb_get_clock_frequency()
530 uint32* prop2 = (uint32*)fdt_getprop(fdt, offset, "clock-frequency", NULL); in dtb_get_clock_frequency()
542 dtb_handle_fdt(const void* fdt, int node) in dtb_handle_fdt() argument
544 arch_handle_fdt(fdt, node); in dtb_handle_fdt()
547 const char* compatible = (const char*)fdt_getprop(fdt, node, in dtb_handle_fdt()
563 dtb_get_reg(fdt, node, 0, uart.regs); in dtb_handle_fdt()
564 uart.irq = dtb_get_interrupt(fdt, node); in dtb_handle_fdt()
565 uart.clock = dtb_get_clock_frequency(fdt, node); in dtb_handle_fdt()
569 gUARTSkipInit = fdt_getprop(fdt, node, "skip-init", NULL) != NULL; in dtb_handle_fdt()
577 dtb_handle_chosen_node(const void *fdt) in dtb_handle_chosen_node() argument
579 int chosen = fdt_path_offset(fdt, "/chosen"); in dtb_handle_chosen_node()
584 const char *stdoutPath = (const char *)fdt_getprop(fdt, chosen, "stdout-path", &len); in dtb_handle_chosen_node()
596 int stdoutNode = fdt_path_offset_namelen(fdt, stdoutPath, namelen); in dtb_handle_chosen_node()
600 dtb_handle_fdt(fdt, stdoutNode); in dtb_handle_chosen_node()
652 gKernelArgs.arch_args.fdt = (void*)(addr_t)kernel_args_malloc(sDtbSize, 8); in dtb_set_kernel_args()
654 if (gKernelArgs.arch_args.fdt != NULL) in dtb_set_kernel_args()
655 memcpy(gKernelArgs.arch_args.fdt, sDtbTable, sDtbSize); in dtb_set_kernel_args()