Hi Pankaj, On 03/25/2018 07:26 PM, Pankaj Bansal wrote:
Bootloader may need to fixup the device tree before OS can use it. e.g. a UEFI/DXE driver that has initialized a controller can add controller's clock frequency in controller node. This way OS need not to call get/set clock for that controller.
Its usually better to include a cover letter to provide a description of what the patchset is adding/fixing. What I understand from looking at this patch is that you are providing the device tree to the kernel (via dtb= ? command) and trying to fix it via the bootloader - is this understanding correct? If yes, I am not sure why the bootloader would not pass the dtb in the first place to the kernel via the standard interface defined in <https://www.kernel.org/doc/Documentation/arm64/booting.txt>, i.e.: x0 = physical address of device tree blob (dtb) in system RAM. Normally bootloaders like UEFI/u-boot pass a fixed up dtb to the kernel, in such a case, the dtb would be fixed up by the bootloader itself and the kernel needs not worry about the same. Regards, Bhupesh
Therefore, install fdt used by OS in configuration tables and associate it with device tree guid. UEFI/DXE drivers can fixup this device tree in their respective ExitBootServices events. Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> Cc: linux-efi@xxxxxxxxxxxxxxx Signed-off-by: Pankaj Bansal <pankaj.bansal@xxxxxxx> --- drivers/firmware/efi/libstub/fdt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 177654e..df862e6 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -265,6 +265,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table_arg, int runtime_entry_count = 0; struct efi_boot_memmap map; struct exit_boot_struct priv; + efi_guid_t fdt_guid = DEVICE_TREE_GUID; map.map = &runtime_map; map.map_size = &map_size; @@ -314,6 +315,13 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table_arg, goto fail_free_new_fdt; } + status = efi_call_early(install_configuration_table, &fdt_guid, + (void *)*new_fdt_addr); + if (status != EFI_SUCCESS) { + pr_efi_err(sys_table_arg, "Unable to install new device tree.\n"); + goto fail_free_new_fdt; + } + priv.runtime_map = runtime_map; priv.runtime_entry_count = &runtime_entry_count; priv.new_fdt_addr = (void *)*new_fdt_addr;
-- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html