[lib][uefi] Allow complete platform customization for UEFI

Added platform_setup_system_table, where platform/vendor can
make arbitrary changes to UEFI's system table, overriding
any of the UEFI protocols with custom one.
This commit is contained in:
Kelvin Zhang
2025-05-29 13:58:54 -07:00
committed by Travis Geiselbrecht
parent b8a584b69a
commit 32429c6c11
3 changed files with 10 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
#include "runtime_service_provider.h"
#include "switch_stack.h"
#include "text_protocol.h"
#include "uefi_platform.h"
namespace {
@@ -122,6 +123,7 @@ int load_sections_and_execute(bdev_t *dev,
reinterpret_cast<EfiConfigurationTable *>(alloc_page(PAGE_SIZE));
memset(table.configuration_table, 0, PAGE_SIZE);
setup_configuration_table(&table);
platform_setup_system_table(&table);
constexpr size_t kStackSize = 8 * 1024ul * 1024;
auto stack = reinterpret_cast<char *>(alloc_page(kStackSize, 23));

View File

@@ -99,3 +99,8 @@ __WEAK EfiStatus exit_boot_services(EfiHandle image_handle, size_t map_key) {
printf("%s is called\n", __FUNCTION__);
return SUCCESS;
}
__WEAK EfiStatus platform_setup_system_table(EfiSystemTable *table) {
printf("%s is called\n", __FUNCTION__);
return SUCCESS;
}

View File

@@ -41,4 +41,7 @@ EfiStatus select_device_trees(struct GblEfiOsConfigurationProtocol *self,
GblEfiVerifiedDeviceTree *device_trees,
size_t num_device_trees);
EfiStatus exit_boot_services(EfiHandle image_handle, size_t map_key);
EfiStatus platform_setup_system_table(EfiSystemTable *table);
#endif