[lib][uefi] Update os configuration protocol

Two breaking changes:

* fixup_kernel_commandline was removed by upstream
* GblEfiDeviceTreeMetadata's reserve field is removed, instead a `type`
  variable is inserted earlier in the struct.

Both changes come from upstream GBL, update LK accordingly
This commit is contained in:
Kelvin Zhang
2025-06-11 10:34:58 -07:00
parent 62409f55f6
commit 953b519d69
4 changed files with 16 additions and 24 deletions

View File

@@ -233,7 +233,6 @@ EfiStatus open_protocol(EfiHandle handle, const EfiGuid *protocol, void **intf,
}
config->revision = GBL_EFI_OS_CONFIGURATION_PROTOCOL_REVISION;
config->fixup_bootconfig = fixup_bootconfig;
config->fixup_kernel_commandline = fixup_kernel_commandline;
config->select_device_trees = select_device_trees;
*intf = reinterpret_cast<void *>(config);
return SUCCESS;

View File

@@ -24,24 +24,35 @@
#include <uefi/types.h>
static constexpr size_t GBL_EFI_OS_CONFIGURATION_PROTOCOL_REVISION = 0x00000000;
typedef enum GBL_EFI_DEVICE_TREE_TYPE {
// HLOS device tree.
DEVICE_TREE,
// HLOS device tree overlay.
OVERLAY,
// pVM device assignment overlay.
PVM_DA_OVERLAY,
} GblEfiDeviceTreeType;
typedef enum GBL_EFI_DEVICE_TREE_SOURCE {
// Device tree loaded from boot partition.
BOOT,
// Device tree loaded from vendor_boot partition.
VENDOR_BOOT,
// Device tree loaded from dtbo partition.
DTBO,
DTB
// Device tree loaded from dtb partition.
DTB,
} GblEfiDeviceTreeSource;
typedef struct {
// GblDeviceTreeSource
uint32_t source;
// GblDeviceTreeType
uint32_t type;
// Values are zeroed and must not be used in case of BOOT / VENDOR_BOOT source
uint32_t id;
uint32_t rev;
uint32_t custom[4];
// Make sure GblDeviceTreeMetadata size is 8-bytes aligned. Also reserved for
// the future cases
uint32_t reserved;
} GblEfiDeviceTreeMetadata;
typedef struct {
@@ -57,15 +68,10 @@ typedef struct {
// Warning: API is UNSTABLE
// Documentation:
// https://cs.android.com/android/platform/superproject/main/+/main:bootable/libbootloader/gbl/docs/gbl_os_configuration_protocol.md
// https://cs.android.com/android/kernel/superproject/+/common-android-mainline:bootable/libbootloader/gbl/docs/gbl_os_configuration_protocol.md
typedef struct GblEfiOsConfigurationProtocol {
uint64_t revision;
// Generates fixups for the kernel command line built by GBL.
EfiStatus (*fixup_kernel_commandline)(
struct GblEfiOsConfigurationProtocol *self, const char *command_line,
char *fixup, size_t *fixup_buffer_size);
// Generates fixups for the bootconfig built by GBL.
EfiStatus (*fixup_bootconfig)(struct GblEfiOsConfigurationProtocol *self,
const char *bootconfig, size_t size,

View File

@@ -57,15 +57,6 @@ __WEAK EFI_STATUS efi_dt_fixup(struct EfiDtFixupProtocol *self, void *fdt,
return SUCCESS;
}
// Generates fixups for the kernel command line built by GBL.
__WEAK EfiStatus fixup_kernel_commandline(
struct GblEfiOsConfigurationProtocol *self, const char *command_line,
char *fixup, size_t *fixup_buffer_size) {
printf("%s(%p, \"%s\")\n", __FUNCTION__, self, command_line);
*fixup_buffer_size = 0;
return SUCCESS;
}
// Generates fixups for the bootconfig built by GBL.
__WEAK EfiStatus fixup_bootconfig(struct GblEfiOsConfigurationProtocol *self,
const char *bootconfig, size_t size,

View File

@@ -29,10 +29,6 @@
EFI_STATUS efi_dt_fixup(struct EfiDtFixupProtocol *self, void *fdt,
size_t *buffer_size, uint32_t flags);
EfiStatus fixup_kernel_commandline(struct GblEfiOsConfigurationProtocol *self,
const char *command_line, char *fixup,
size_t *fixup_buffer_size);
EfiStatus fixup_bootconfig(struct GblEfiOsConfigurationProtocol *self,
const char *bootconfig, size_t size, char *fixup,
size_t *fixup_buffer_size);