diff --git a/src/arch/i386/drivers/net/undiload.c b/src/arch/i386/drivers/net/undiload.c index 0edfa35d..f0f15e6a 100644 --- a/src/arch/i386/drivers/net/undiload.c +++ b/src/arch/i386/drivers/net/undiload.c @@ -38,6 +38,12 @@ FILE_LICENCE ( GPL2_OR_LATER ); * */ +/* Disambiguate the various error causes */ +#define EINFO_EUNDILOAD \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "UNDI loader error" ) +#define EUNDILOAD( status ) EPLATFORM ( EINFO_EUNDILOAD, status ) + /** Parameter block for calling UNDI loader */ static struct s_UNDI_LOADER __bss16 ( undi_loader ); #define undi_loader __use_data16 ( undi_loader ) @@ -109,9 +115,7 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) { /* Clear entry point */ memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) ); - rc = -undi_loader.Status; - if ( rc == 0 ) /* Paranoia */ - rc = -EIO; + rc = -EUNDILOAD ( undi_loader.Status ); DBGC ( undi, "UNDI %p loader failed: %s\n", undi, strerror ( rc ) ); return rc; diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c index b8e73a06..7fce75a9 100644 --- a/src/arch/i386/interface/pxe/pxe_call.c +++ b/src/arch/i386/interface/pxe/pxe_call.c @@ -32,6 +32,12 @@ FILE_LICENCE ( GPL2_OR_LATER ); * PXE API entry point */ +/* Disambiguate the various error causes */ +#define EINFO_EPXENBP \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "External PXE NBP error" ) +#define EPXENBP( status ) EPLATFORM ( EINFO_EPXENBP, status ) + /** Vector for chaining INT 1A */ extern struct segoff __text16 ( pxe_int_1a_vector ); #define pxe_int_1a_vector __use_text16 ( pxe_int_1a_vector ) @@ -257,7 +263,7 @@ rmjmp_buf pxe_restart_nbp; int pxe_start_nbp ( void ) { int jmp; int discard_b, discard_c, discard_d, discard_D; - uint16_t rc; + uint16_t status; /* Allow restarting NBP via PXENV_RESTART_TFTP */ jmp = rmsetjmp ( pxe_restart_nbp ); @@ -271,7 +277,7 @@ int pxe_start_nbp ( void ) { "sti\n\t" "lcall $0, $0x7c00\n\t" "addw $4, %%sp\n\t" ) - : "=a" ( rc ), "=b" ( discard_b ), + : "=a" ( status ), "=b" ( discard_b ), "=c" ( discard_c ), "=d" ( discard_d ), "=D" ( discard_D ) : "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ), @@ -279,8 +285,10 @@ int pxe_start_nbp ( void ) { "d" ( virt_to_phys ( &pxenv ) ), "D" ( __from_text16 ( &ppxe ) ) : "esi", "ebp", "memory" ); + if ( status ) + return -EPXENBP ( status ); - return rc; + return 0; } REQUIRE_OBJECT ( pxe_preboot ); diff --git a/src/arch/i386/interface/pxeparent/pxeparent.c b/src/arch/i386/interface/pxeparent/pxeparent.c index 8b2a2c88..b2c6ffba 100644 --- a/src/arch/i386/interface/pxeparent/pxeparent.c +++ b/src/arch/i386/interface/pxeparent/pxeparent.c @@ -31,6 +31,12 @@ FILE_LICENCE ( GPL2_OR_LATER ); * */ +/* Disambiguate the various error causes */ +#define EINFO_EPXECALL \ + __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \ + "External PXE API error" ) +#define EPXECALL( status ) EPLATFORM ( EINFO_EPXECALL, status ) + /** * Name PXE API call * @@ -151,16 +157,8 @@ int pxeparent_call ( SEGOFF16_t entry, unsigned int function, /* Determine return status code based on PXENV_EXIT and * PXENV_STATUS */ - if ( exit == PXENV_EXIT_SUCCESS ) { - rc = 0; - } else { - rc = -pxeparent_params.Status; - /* Paranoia; don't return success for the combination - * of PXENV_EXIT_FAILURE but PXENV_STATUS_SUCCESS - */ - if ( rc == 0 ) - rc = -EIO; - } + rc = ( ( exit == PXENV_EXIT_SUCCESS ) ? + 0 : -EPXECALL ( pxeparent_params.Status ) ); /* If anything goes wrong, print as much debug information as * it's possible to give. diff --git a/src/arch/x86/include/bits/errfile.h b/src/arch/x86/include/bits/errfile.h index 7b9f3702..5f676c87 100644 --- a/src/arch/x86/include/bits/errfile.h +++ b/src/arch/x86/include/bits/errfile.h @@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define ERRFILE_comboot_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 ) #define ERRFILE_sdi ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 ) #define ERRFILE_initrd ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 ) +#define ERRFILE_pxe_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000d0000 ) #define ERRFILE_undi ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 ) #define ERRFILE_undiload ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )