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 | |
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')
-rw-r--r-- | src/include/ipxe/efi/efi.h | 22 | ||||
-rw-r--r-- | src/include/ipxe/efi/efi_driver.h | 2 | ||||
-rw-r--r-- | src/include/ipxe/efi/efi_pci.h | 6 | ||||
-rw-r--r-- | src/include/ipxe/errfile.h | 9 |
4 files changed, 23 insertions, 16 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 ); diff --git a/src/include/ipxe/efi/efi_driver.h b/src/include/ipxe/efi/efi_driver.h index e5872ce..d7eec96 100644 --- a/src/include/ipxe/efi/efi_driver.h +++ b/src/include/ipxe/efi/efi_driver.h @@ -44,6 +44,6 @@ struct efi_driver { extern EFI_DEVICE_PATH_PROTOCOL * efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL *path ); -extern EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ); +extern int efi_driver_install ( struct efi_driver *efidrv ); #endif /* _IPXE_EFI_DRIVER_H */ diff --git a/src/include/ipxe/efi/efi_pci.h b/src/include/ipxe/efi/efi_pci.h index 6429f21..e6b3197 100644 --- a/src/include/ipxe/efi/efi_pci.h +++ b/src/include/ipxe/efi/efi_pci.h @@ -38,11 +38,11 @@ struct efi_pci_device { extern struct efi_pci_device * efipci_create ( struct efi_driver *efidrv, EFI_HANDLE device ); -extern EFI_STATUS efipci_enable ( struct efi_pci_device *efipci ); +extern int efipci_enable ( struct efi_pci_device *efipci ); extern struct efi_pci_device * efipci_find_efi ( EFI_HANDLE device ); extern struct efi_pci_device * efipci_find ( struct device *dev ); -extern EFI_STATUS efipci_child_add ( struct efi_pci_device *efipci, - EFI_HANDLE device ); +extern int efipci_child_add ( struct efi_pci_device *efipci, + EFI_HANDLE device ); extern void efipci_child_del ( struct efi_pci_device *efipci, EFI_HANDLE device ); extern void efipci_destroy ( struct efi_driver *efidrv, diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h index f906dbd..67edcc9 100644 --- a/src/include/ipxe/errfile.h +++ b/src/include/ipxe/errfile.h @@ -266,6 +266,15 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define ERRFILE_nslookup ( ERRFILE_OTHER | 0x00300000 ) #define ERRFILE_efi_snp_hii ( ERRFILE_OTHER | 0x00310000 ) #define ERRFILE_readline ( ERRFILE_OTHER | 0x00320000 ) +#define ERRFILE_efi_bofm ( ERRFILE_OTHER | 0x00330000 ) +#define ERRFILE_efi_console ( ERRFILE_OTHER | 0x00340000 ) +#define ERRFILE_efi_debug ( ERRFILE_OTHER | 0x00350000 ) +#define ERRFILE_efi_download ( ERRFILE_OTHER | 0x00360000 ) +#define ERRFILE_efi_driver ( ERRFILE_OTHER | 0x00370000 ) +#define ERRFILE_efi_file ( ERRFILE_OTHER | 0x00380000 ) +#define ERRFILE_efi_init ( ERRFILE_OTHER | 0x00390000 ) +#define ERRFILE_efi_timer ( ERRFILE_OTHER | 0x003a0000 ) +#define ERRFILE_efi_umalloc ( ERRFILE_OTHER | 0x003b0000 ) /** @} */ |