mirror of
https://github.com/ipxe/ipxe
synced 2026-01-01 09:09:32 +03:00
[efi] Install a device tree for the booted OS, if available
If we have a device tree available (e.g. because the user has explicitly downloaded a device tree using the "fdt" command), then provide it to the booted operating system as an EFI configuration table. Since x86 does not typically use device trees, we create weak symbols for efi_fdt_install() and efi_fdt_uninstall() to avoid dragging FDT support into all x86 UEFI binaries. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#include <ipxe/efi/efi_driver.h>
|
||||
#include <ipxe/efi/efi_image.h>
|
||||
#include <ipxe/efi/efi_shim.h>
|
||||
#include <ipxe/efi/efi_fdt.h>
|
||||
#include <ipxe/image.h>
|
||||
#include <ipxe/init.h>
|
||||
#include <ipxe/features.h>
|
||||
@@ -122,6 +123,24 @@ static wchar_t * efi_image_cmdline ( struct image *image ) {
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install EFI Flattened Device Tree table (when no FDT support is present)
|
||||
*
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
__weak int efi_fdt_install ( void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall EFI Flattened Device Tree table (when no FDT support is present)
|
||||
*
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
__weak int efi_fdt_uninstall ( void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute EFI image
|
||||
*
|
||||
@@ -187,6 +206,13 @@ static int efi_image_exec ( struct image *image ) {
|
||||
goto err_download_install;
|
||||
}
|
||||
|
||||
/* Install Flattened Device Tree table */
|
||||
if ( ( rc = efi_fdt_install() ) != 0 ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not install FDT: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
goto err_fdt_install;
|
||||
}
|
||||
|
||||
/* Create device path for image */
|
||||
path = efi_image_path ( exec, snpdev->path );
|
||||
if ( ! path ) {
|
||||
@@ -313,6 +339,8 @@ static int efi_image_exec ( struct image *image ) {
|
||||
err_cmdline:
|
||||
free ( path );
|
||||
err_image_path:
|
||||
efi_fdt_uninstall();
|
||||
err_fdt_install:
|
||||
efi_download_uninstall ( snpdev->handle );
|
||||
err_download_install:
|
||||
efi_pxe_uninstall ( snpdev->handle );
|
||||
|
||||
Reference in New Issue
Block a user