uefi-rs icon indicating copy to clipboard operation
uefi-rs copied to clipboard

Locale device tree address

Open sunshine-lcc opened this issue 2 years ago • 1 comments

I wonder if there is a way to get the address of the device tree by UEFI in aarch64? It's wonderful if the crate can provide an interface to get the address of device tree.

sunshine-lcc avatar Apr 05 '22 12:04 sunshine-lcc

Hello! You might want to look into navigating the EFI Configuration Table structure, accessible with the .config_table() method on the SystemTable. It provides access to a list of descriptors of well-known, predefined "configuration tables", and according to the UEFI spec (page 104), you should be able to find a config table entry for Device Tree:

//
// Devicetree table, in Flattened Devicetree Blob (DTB) format
//
#define EFI_DTB_TABLE_GUID \
{0xb1b621d5, 0xf19c, 0x41a5, \
{0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0}}

We have some constant GUIDs defined for common tables, but not for DeviceTree (yet). If you're interested in making it easier to access this information for users of the uefi-rs crate, we'd welcome a PR adding it to the list 🙂

GabrielMajeri avatar Apr 06 '22 20:04 GabrielMajeri