[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>
This commit is contained in:
Michael Brown
2013-04-18 21:29:53 +01:00
parent 7348035231
commit 54409583e2
20 changed files with 212 additions and 200 deletions

View File

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wchar.h>
#include <ipxe/image.h>
#include <ipxe/efi/efi.h>
@@ -549,6 +550,7 @@ static EFI_BLOCK_IO_PROTOCOL efi_block_io_protocol = {
int efi_file_install ( EFI_HANDLE *handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_STATUS efirc;
int rc;
/* Install the simple file system protocol and the block I/O
* protocol. We don't have a block device, but large parts of
@@ -563,9 +565,10 @@ int efi_file_install ( EFI_HANDLE *handle ) {
&efi_block_io_protocol,
&efi_simple_file_system_protocol_guid,
&efi_simple_file_system_protocol, NULL ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( handle, "Could not install simple file system protocol: "
"%s\n", efi_strerror ( efirc ) );
return EFIRC_TO_RC ( efirc );
"%s\n", strerror ( rc ) );
return rc;
}
return 0;