mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 01:52:39 +03:00
[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:
@@ -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 );
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 )
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user