diff options
author | Michael Brown | 2013-04-18 22:29:53 +0200 |
---|---|---|
committer | Michael Brown | 2013-04-19 14:34:19 +0200 |
commit | 54409583e29c481556e94a99dc73316d18aafc74 (patch) | |
tree | 150a8ceb85c1b523dc8dd8dd36daf8f6260e6538 /src/interface/efi/efi_driver.c | |
parent | [libc] Redefine low 8 bits of error code as "platform error code" (diff) | |
download | ipxe-54409583e29c481556e94a99dc73316d18aafc74.tar.gz ipxe-54409583e29c481556e94a99dc73316d18aafc74.tar.xz ipxe-54409583e29c481556e94a99dc73316d18aafc74.zip |
[efi] Perform meaningful error code conversions
Exploit the redefinition of iPXE error codes to include a "platform
error code" to allow for meaningful conversion of EFI_STATUS values to
iPXE errors and vice versa.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_driver.c')
-rw-r--r-- | src/interface/efi/efi_driver.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/interface/efi/efi_driver.c b/src/interface/efi/efi_driver.c index deb3cf2c..13ed1f50 100644 --- a/src/interface/efi/efi_driver.c +++ b/src/interface/efi/efi_driver.c @@ -21,6 +21,8 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <stddef.h> #include <stdio.h> +#include <string.h> +#include <errno.h> #include <ipxe/efi/efi.h> #include <ipxe/efi/Protocol/DriverBinding.h> #include <ipxe/efi/Protocol/ComponentName2.h> @@ -122,11 +124,12 @@ efi_driver_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, * @v efidrv EFI driver * @ret efirc EFI status code */ -EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ) { +int efi_driver_install ( struct efi_driver *efidrv ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_DRIVER_BINDING_PROTOCOL *driver = &efidrv->driver; EFI_COMPONENT_NAME2_PROTOCOL *wtf = &efidrv->wtf; EFI_STATUS efirc; + int rc; /* Configure driver binding protocol */ driver->ImageHandle = efi_image_handle; @@ -148,9 +151,10 @@ EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ) { &efi_driver_binding_protocol_guid, driver, &efi_component_name2_protocol_guid, wtf, NULL ) ) != 0 ) { + rc = -EEFI ( efirc ); DBGC ( efidrv, "EFIDRV %s could not install protocol: %s\n", - efidrv->name, efi_strerror ( efirc ) ); - return efirc; + efidrv->name, strerror ( rc ) ); + return rc; } DBGC ( efidrv, "EFIDRV %s installed\n", efidrv->name ); |