diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-04-18 21:29:53 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-04-19 13:34:19 +0100 |
commit | 54409583e29c481556e94a99dc73316d18aafc74 (patch) | |
tree | 150a8ceb85c1b523dc8dd8dd36daf8f6260e6538 /src/include/ipxe/efi/efi.h | |
parent | 73480352315a12fdef467402ea41be9ac285e4e7 (diff) | |
download | ipxe-54409583e29c481556e94a99dc73316d18aafc74.zip ipxe-54409583e29c481556e94a99dc73316d18aafc74.tar.gz ipxe-54409583e29c481556e94a99dc73316d18aafc74.tar.bz2 |
[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/include/ipxe/efi/efi.h')
-rw-r--r-- | src/include/ipxe/efi/efi.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/include/ipxe/efi/efi.h b/src/include/ipxe/efi/efi.h index 3aaac60..0a21c6e 100644 --- a/src/include/ipxe/efi/efi.h +++ b/src/include/ipxe/efi/efi.h @@ -108,29 +108,27 @@ struct efi_config_table { .required = (_required), \ } -/** Convert a iPXE status code to an EFI status code +/** + * Convert an iPXE status code to an EFI status code * - * FIXME: actually perform some kind of conversion. iPXE error codes - * will be detected as EFI error codes; both have the top bit set, and - * the success return code is zero for both. Anything that just - * reports a numerical error will be OK, anything attempting to - * interpret the value or to display a text equivalent will be - * screwed. + * @v rc iPXE status code + * @ret efirc EFI status code */ -#define RC_TO_EFIRC( rc ) (rc) +#define EFIRC( rc ) ERRNO_TO_PLATFORM ( -(rc) ) -/** Convert an EFI status code to a iPXE status code +/** + * Convert an EFI status code to an iPXE status code * - * FIXME: as above + * @v efirc EFI status code + * @ret rc iPXE status code (before negation) */ -#define EFIRC_TO_RC( efirc ) (efirc) +#define EEFI( efirc ) EPLATFORM ( EINFO_EPLATFORM, efirc ) extern EFI_HANDLE efi_image_handle; extern EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image; extern EFI_DEVICE_PATH_PROTOCOL *efi_loaded_image_path; extern EFI_SYSTEM_TABLE *efi_systab; -extern const char * efi_strerror ( EFI_STATUS efirc ); extern const char * efi_guid_ntoa ( EFI_GUID *guid ); extern void dbg_efi_protocols ( EFI_HANDLE handle ); |