|
iPXE
|
Flattened Device Tree. More...
Go to the source code of this file.
Data Structures | |
| struct | fdt_header |
| Device tree header. More... | |
| struct | fdt_prop |
| Property fragment. More... | |
| struct | fdt_reservation |
| A memory reservation. More... | |
| struct | fdt |
| A device tree. More... | |
| struct | fdt_descriptor |
| A device tree token descriptor. More... | |
| struct | fdt_reg_cells |
| A device tree region cell size specification. More... | |
Macros | |
| #define | FDT_MAGIC 0xd00dfeed |
| Magic signature. More... | |
| #define | FDT_VERSION 16 |
| Expected device tree version. More... | |
| #define | FDT_BEGIN_NODE 0x00000001 |
| Begin node token. More... | |
| #define | FDT_END_NODE 0x00000002 |
| End node token. More... | |
| #define | FDT_PROP 0x00000003 |
| Property token. More... | |
| #define | FDT_NOP 0x00000004 |
| NOP token. More... | |
| #define | FDT_END 0x00000009 |
| End of structure block. More... | |
| #define | FDT_STRUCTURE_ALIGN ( sizeof ( fdt_token_t ) ) |
| Alignment of structure block. More... | |
| #define | FDT_MAX_ALIGN 8 |
| Maximum alignment of any block. More... | |
| #define | FDT_DEFAULT_ADDRESS_CELLS 2 |
| Default number of address cells, if not specified. More... | |
| #define | FDT_DEFAULT_SIZE_CELLS 1 |
| Default number of size cells, if not specified. More... | |
| #define | for_each_fdt_reservation(rsv, fdt) |
| Iterate over memory reservations. More... | |
Typedefs | |
| typedef uint32_t | fdt_token_t |
| Device tree token. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static const struct fdt_reservation * | fdt_reservations (struct fdt *fdt) |
| Get memory reservations. More... | |
| int | fdt_describe (struct fdt *fdt, unsigned int offset, struct fdt_descriptor *desc) |
| Describe device tree token. More... | |
| int | fdt_parent (struct fdt *fdt, unsigned int offset, unsigned int *parent) |
| Find parent node. More... | |
| int | fdt_path (struct fdt *fdt, const char *path, unsigned int *offset) |
| Find node by path. More... | |
| int | fdt_alias (struct fdt *fdt, const char *name, unsigned int *offset) |
| Find node by alias. More... | |
| const char * | fdt_strings (struct fdt *fdt, unsigned int offset, const char *name, unsigned int *count) |
| Find strings property. More... | |
| const char * | fdt_string (struct fdt *fdt, unsigned int offset, const char *name) |
| Find string property. More... | |
| int | fdt_cells (struct fdt *fdt, unsigned int offset, const char *name, unsigned int index, unsigned int count, uint64_t *value) |
| Get integer property. More... | |
| int | fdt_u64 (struct fdt *fdt, unsigned int offset, const char *name, uint64_t *value) |
| Get 64-bit integer property. More... | |
| int | fdt_u32 (struct fdt *fdt, unsigned int offset, const char *name, uint32_t *value) |
| Get 32-bit integer property. More... | |
| uint32_t | fdt_phandle (struct fdt *fdt, unsigned int offset) |
| Get package handle (phandle) property. More... | |
| void | fdt_reg_cells (struct fdt *fdt, unsigned int offset, struct fdt_reg_cells *regs) |
| Get region cell size specification. More... | |
| int | fdt_parent_reg_cells (struct fdt *fdt, unsigned int offset, struct fdt_reg_cells *regs) |
| Get parent region cell size specification. More... | |
| int | fdt_reg_count (struct fdt *fdt, unsigned int offset, struct fdt_reg_cells *regs) |
| Get number of regions. More... | |
| int | fdt_reg_address (struct fdt *fdt, unsigned int offset, struct fdt_reg_cells *regs, unsigned int index, uint64_t *address) |
| Get region address. More... | |
| int | fdt_reg_size (struct fdt *fdt, unsigned int offset, struct fdt_reg_cells *regs, unsigned int index, uint64_t *size) |
| Get region size. More... | |
| int | fdt_reg (struct fdt *fdt, unsigned int offset, uint64_t *region) |
| Get unsized single-entry region address. More... | |
| int | fdt_mac (struct fdt *fdt, unsigned int offset, struct net_device *netdev) |
| Get MAC address from property. More... | |
| int | fdt_parse (struct fdt *fdt, struct fdt_header *hdr, size_t max_len) |
| Parse device tree. More... | |
| int | fdt_create (struct fdt_header **hdr, const char *cmdline, physaddr_t initrd, size_t initrd_len) |
| Create device tree. More... | |
| void | fdt_remove (struct fdt_header *hdr) |
| Remove device tree. More... | |
Variables | |
| struct image_tag fdt_image | __image_tag |
| The downloaded flattened device tree tag. More... | |
| struct fdt | sysfdt |
| The system flattened device tree (if present) More... | |
Flattened Device Tree.
Definition in file fdt.h.
| #define FDT_STRUCTURE_ALIGN ( sizeof ( fdt_token_t ) ) |
| #define FDT_DEFAULT_ADDRESS_CELLS 2 |
| #define FDT_DEFAULT_SIZE_CELLS 1 |
| #define for_each_fdt_reservation | ( | rsv, | |
| fdt | |||
| ) |
| typedef uint32_t fdt_token_t |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Get memory reservations.
| fdt | Device tree |
| rsv | Memory reservations |
Definition at line 161 of file fdt.h.
References fdt::raw, and fdt::reservations.
| int fdt_describe | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_descriptor * | desc | ||
| ) |
Describe device tree token.
| fdt | Device tree |
| offset | Offset within structure block |
| desc | Token descriptor to fill in |
| rc | Return status code |
Definition at line 89 of file fdt.c.
References assert(), be32_to_cpu, cpu_to_be32, data, DBGC, desc, EINVAL, FDT_BEGIN_NODE, FDT_END_NODE, FDT_NOP, FDT_PROP, FDT_STRUCTURE_ALIGN, fdt_prop::len, fdt::len, len, memset(), fdt_prop::name_off, offset, fdt::raw, fdt::strings, fdt::strings_len, strnlen(), fdt::structure, and token.
Referenced by dt_probe_children(), dt_probe_node(), fdt_enter(), fdt_next(), fdt_test_exec(), and fdtmem_update_node().
| int fdt_parent | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| unsigned int * | parent | ||
| ) |
Find parent node.
| fdt | Device tree |
| offset | Starting node offset |
| parent | Parent node offset to fill in |
| rc | Return status code |
Definition at line 292 of file fdt.c.
References DBGC, DBGC2, fdt_descriptor::depth, desc, ENOENT, fdt_depth(), fdt_enter(), fdt_next(), offset, rc, and strerror().
Referenced by fdt_parent_reg_cells(), and fdt_test_exec().
| int fdt_path | ( | struct fdt * | fdt, |
| const char * | path, | ||
| unsigned int * | offset | ||
| ) |
Find node by path.
| fdt | Device tree |
| path | Node path |
| offset | Offset to fill in |
| rc | Return status code |
Definition at line 425 of file fdt.c.
References DBGC2, fdt_child(), offset, rc, strchr(), and tmp.
Referenced by fdt_alias(), fdt_test_exec(), fdtcon_default(), and fdtmem_update_tree().
| int fdt_alias | ( | struct fdt * | fdt, |
| const char * | name, | ||
| unsigned int * | offset | ||
| ) |
Find node by alias.
| fdt | Device tree |
| name | Alias name |
| offset | Offset to fill in |
| rc | Return status code |
Definition at line 465 of file fdt.c.
References DBGC, ENOENT, fdt_child(), fdt_path(), fdt_string(), name, NULL, offset, and rc.
Referenced by fdt_test_exec(), fdtcon_default(), and smscusb_fdt_fetch_mac().
| const char* fdt_strings | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| const char * | name, | ||
| unsigned int * | count | ||
| ) |
Find strings property.
| fdt | Device tree |
| offset | Starting node offset |
| name | Property name |
| count | String count to fill in |
| string | String property, or NULL on error |
Definition at line 539 of file fdt.c.
References count, data, DBGC, desc, fdt_property(), len, name, NULL, offset, and rc.
Referenced by dt_find_driver(), fdt_string(), and fdt_test_exec().
| const char* fdt_string | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| const char * | name | ||
| ) |
Find string property.
| fdt | Device tree |
| offset | Starting node offset |
| name | Property name |
| string | String property, or NULL on error |
Definition at line 578 of file fdt.c.
References count, fdt_strings(), name, and offset.
Referenced by fdt_alias(), fdt_parse(), fdt_test_exec(), fdtcon_default(), and fdtmem_update_node().
| int fdt_cells | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| const char * | name, | ||
| unsigned int | index, | ||
| unsigned int | count, | ||
| uint64_t * | value | ||
| ) |
Get integer property.
| fdt | Device tree |
| offset | Starting node offset |
| name | Property name |
| index | Starting cell index |
| count | Number of cells (or 0 to read all remaining cells) |
| value | Integer value to fill in |
| rc | Return status code |
Definition at line 597 of file fdt.c.
References be32_to_cpu, count, DBGC, desc, ERANGE, fdt_property(), index, name, offset, rc, and value.
Referenced by fdt_reg_address(), fdt_reg_size(), fdt_test_exec(), and fdt_u64().
Get 64-bit integer property.
| fdt | Device tree |
| offset | Starting node offset |
| name | Property name |
| value | Integer value to fill in |
| rc | Return status code |
Definition at line 643 of file fdt.c.
References fdt_cells(), name, offset, rc, and value.
Referenced by fdt_test_exec(), and fdt_u32().
Get 32-bit integer property.
| fdt | Device tree |
| offset | Starting node offset |
| name | Property name |
| value | Integer value to fill in |
| rc | Return status code |
Definition at line 663 of file fdt.c.
References DBGC, ERANGE, fdt_u64(), name, offset, rc, and value.
Referenced by dwgpio_probe(), dwuart_probe(), fdt_phandle(), fdt_reg_cells(), and fdt_test_exec().
Get package handle (phandle) property.
| fdt | Device tree |
| offset | Starting node offset |
| phandle | Package handle, or 0 on error |
Definition at line 689 of file fdt.c.
References assert(), fdt_u32(), offset, and rc.
Referenced by dt_probe_node(), and fdt_test_exec().
| void fdt_reg_cells | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_reg_cells * | regs | ||
| ) |
Get region cell size specification.
| fdt | Device tree |
| offset | Starting (parent) node offset |
| regs | Region cell size specification to fill in |
Note that address-cells and size-cells are defined on the immediate parent node, rather than on the node with the "reg" property itself.
Definition at line 715 of file fdt.c.
References FDT_DEFAULT_ADDRESS_CELLS, FDT_DEFAULT_SIZE_CELLS, fdt_u32(), offset, rc, and regs.
Referenced by fdt_parent_reg_cells(), and fdtmem_update_node().
| int fdt_parent_reg_cells | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_reg_cells * | regs | ||
| ) |
Get parent region cell size specification.
| fdt | Device tree |
| offset | Starting node offset |
| regs | Region cell size specification to fill in |
| rc | Return status code |
Definition at line 743 of file fdt.c.
References fdt_parent(), fdt_reg_cells(), offset, rc, and regs.
Referenced by dt_ioremap(), and fdt_reg().
| int fdt_reg_count | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_reg_cells * | regs | ||
| ) |
Get number of regions.
| fdt | Device tree |
| offset | Starting node offset |
| regs | Region cell size specification |
| count | Number of regions, or negative error |
Definition at line 766 of file fdt.c.
References count, desc, fdt_property(), offset, rc, and regs.
Referenced by fdtmem_update_node().
| int fdt_reg_address | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_reg_cells * | regs, | ||
| unsigned int | index, | ||
| uint64_t * | address | ||
| ) |
Get region address.
| fdt | Device tree |
| offset | Starting node offset |
| regs | Region cell size specification |
| index | Region index |
| address | Region starting address to fill in |
| rc | Return status code |
Definition at line 792 of file fdt.c.
References address, fdt_cells(), index, offset, rc, and regs.
Referenced by dt_ioremap(), fdt_reg(), and fdtmem_update_node().
| int fdt_reg_size | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct fdt_reg_cells * | regs, | ||
| unsigned int | index, | ||
| uint64_t * | size | ||
| ) |
Get region size.
| fdt | Device tree |
| offset | Starting node offset |
| regs | Region cell size specification |
| index | Region index |
| size | Region size to fill in |
| rc | Return status code |
Definition at line 817 of file fdt.c.
References fdt_cells(), index, offset, rc, regs, and size.
Referenced by dt_ioremap(), and fdtmem_update_node().
Get unsized single-entry region address.
| fdt | Device tree |
| offset | Starting node offset |
| address | Region address to fill in |
| rc | Return status code |
Many region types (e.g. I2C bus addresses) can only ever contain a single region with no size cells specified.
Definition at line 843 of file fdt.c.
References fdt_parent_reg_cells(), fdt_reg_address(), offset, rc, and regs.
Referenced by dwgpio_probe().
| int fdt_mac | ( | struct fdt * | fdt, |
| unsigned int | offset, | ||
| struct net_device * | netdev | ||
| ) |
Get MAC address from property.
| fdt | Device tree |
| offset | Starting node offset |
| netdev | Network device |
| rc | Return status code |
Definition at line 866 of file fdt.c.
References DBGC, DBGC_HDA, desc, ERANGE, fdt_property(), net_device::hw_addr, ll_protocol::hw_addr_len, len, net_device::ll_protocol, memcpy(), netdev, offset, and rc.
Referenced by cgem_probe(), dwmac_probe(), and smscusb_fdt_fetch_mac().
| int fdt_parse | ( | struct fdt * | fdt, |
| struct fdt_header * | hdr, | ||
| size_t | max_len | ||
| ) |
Parse device tree.
| fdt | Device tree |
| hdr | Device tree header |
| max_len | Maximum device tree length |
| rc | Return status code |
Definition at line 903 of file fdt.c.
References be32_to_cpu, cpu_to_be32, DBG_LOG, DBGC, DBGC_HDA, EINVAL, end, fdt_child(), FDT_MAGIC, fdt_string(), FDT_STRUCTURE_ALIGN, FDT_VERSION, fdt::hdr, hdr, fdt::len, memset(), fdt::raw, fdt::reservations, fdt::strings, fdt::strings_len, fdt::structure, fdt::structure_len, and fdt::used.
Referenced by efi_fdt_init(), fdt_parse_image(), fdt_test_exec(), fdtmem_register(), and fdtmem_relocate().
| int fdt_create | ( | struct fdt_header ** | hdr, |
| const char * | cmdline, | ||
| physaddr_t | initrd, | ||
| size_t | initrd_len | ||
| ) |
Create device tree.
| hdr | Device tree header to fill in (may be set to NULL) |
| cmdline | Command line, or NULL |
| initrd | Initial ramdisk address (or 0 for no initrd) |
| initrd_len | Initial ramdisk length (or 0 for no initrd) |
| rc | Return status code |
Definition at line 1407 of file fdt.c.
References cmdline, DBGC, ENOMEM, fdt_bootargs(), fdt_parse_image(), fdt_urealloc(), find_image_tag(), hdr, initrd_len, fdt::len, memcpy(), fdt::raw, rc, fdt::realloc, sysfdt, ufree(), and umalloc().
Referenced by efi_fdt_install(), fdt_test_exec(), and lkrn_exec().
| void fdt_remove | ( | struct fdt_header * | hdr | ) |
Remove device tree.
| hdr | Device tree header, or NULL |
Definition at line 1458 of file fdt.c.
Referenced by efi_fdt_install(), efi_fdt_uninstall(), fdt_test_exec(), and lkrn_exec().
| struct image_tag fdt_image __image_tag |
| struct fdt sysfdt |
The system flattened device tree (if present)
Definition at line 44 of file fdt.c.
Referenced by cgem_probe(), dt_find_driver(), dt_ioremap(), dt_probe_children(), dt_probe_node(), dwgpio_probe(), dwmac_probe(), dwuart_probe(), efi_fdt_init(), fdt_create(), fdtcon_default(), fdtmem_describe_region(), fdtmem_register(), and smscusb_fdt_fetch_mac().
1.8.15