diff options
author | Jan Janssen <medhefgo@web.de> | 2021-09-30 12:11:56 +0200 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2021-10-17 11:55:57 +0200 |
commit | 12f32748aa291db1e8c1305e7fb4310e9728aad4 (patch) | |
tree | c19933452b62ff7de743eaea6765d75a34d6371e /src/boot/efi/drivers.c | |
parent | sd-boot: Convert VOID -> void (diff) | |
download | systemd-12f32748aa291db1e8c1305e7fb4310e9728aad4.tar.xz systemd-12f32748aa291db1e8c1305e7fb4310e9728aad4.zip |
sd-boot: Get rid of uefi_call_wrapper
The uefi_call_wrapper exists to convert to the right calling convention
and presumably predates compilers that can do so natively. The only
architecture where this is even needed is x86_64.
But because we are building with GNU_EFI_USE_MS_ABI defined, the
EFIAPI macro tells the compiler to use the right calling convention
for EFI functions. Our shim callback (which is called by EFI itself)
already relies on this.
This also adds a safety check to make se we are compiling with
GNU_EFI_USE_MS_ABI defined and also adds it to the compiler args
unconditionally. It is only used with x86_64 anyways, so it should
be fine to do so. EFI_FUNCTION_WRAPPER is unused in gnu-efi, so
it is dropped.
Diffstat (limited to 'src/boot/efi/drivers.c')
-rw-r--r-- | src/boot/efi/drivers.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/boot/efi/drivers.c b/src/boot/efi/drivers.c index 5b2db2d502..f25b35ac96 100644 --- a/src/boot/efi/drivers.c +++ b/src/boot/efi/drivers.c @@ -8,7 +8,7 @@ static void efi_unload_image(EFI_HANDLE *h) { if (*h) - (void) uefi_call_wrapper(BS->UnloadImage, 1, *h); + (void) BS->UnloadImage(*h); } static EFI_STATUS load_one_driver( @@ -33,21 +33,11 @@ static EFI_STATUS load_one_driver( if (!path) return log_oom(); - err = uefi_call_wrapper( - BS->LoadImage, 6, - FALSE, - parent_image, - path, - NULL, 0, - &image); + err = BS->LoadImage(FALSE, parent_image, path, NULL, 0, &image); if (EFI_ERROR(err)) return log_error_status_stall(err, L"Failed to load image %s: %r", fname, err); - err = uefi_call_wrapper( - BS->HandleProtocol, 3, - image, - &LoadedImageProtocol, - (void **)&loaded_image); + err = BS->HandleProtocol(image, &LoadedImageProtocol, (void **)&loaded_image); if (EFI_ERROR(err)) return log_error_status_stall(err, L"Failed to find protocol in driver image s: %r", fname, err); @@ -55,11 +45,7 @@ static EFI_STATUS load_one_driver( loaded_image->ImageCodeType != EfiRuntimeServicesCode) return log_error_status_stall(EFI_INVALID_PARAMETER, L"Image %s is not a driver, refusing: %r", fname); - err = uefi_call_wrapper( - BS->StartImage, 3, - image, - NULL, - NULL); + err = BS->StartImage(image, NULL, NULL); if (EFI_ERROR(err)) return log_error_status_stall(err, L"Failed to start image %s: %r", fname, err); @@ -74,23 +60,12 @@ static EFI_STATUS reconnect(void) { /* Reconnects all handles, so that any loaded drivers can take effect. */ - err = uefi_call_wrapper( - BS->LocateHandleBuffer, 5, - AllHandles, - NULL, - NULL, - &n_handles, - &handles); + err = BS->LocateHandleBuffer(AllHandles, NULL, NULL, &n_handles, &handles); if (EFI_ERROR(err)) return log_error_status_stall(err, L"Failed to get list of handles: %r", err); for (UINTN i = 0; i < n_handles; i++) { - err = uefi_call_wrapper( - BS->ConnectController, 4, - handles[i], - NULL, - NULL, - TRUE); + err = BS->ConnectController(handles[i], NULL, NULL, TRUE); if (err == EFI_NOT_FOUND) /* No drivers for this handle */ continue; if (EFI_ERROR(err)) |