Browse Source

[pxe] Convert external PXE API errors into iPXE platform-generated errors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
e411b37eb1

+ 7
- 3
src/arch/i386/drivers/net/undiload.c View File

38
  *
38
  *
39
  */
39
  */
40
 
40
 
41
+/* Disambiguate the various error causes */
42
+#define EINFO_EUNDILOAD							\
43
+	__einfo_uniqify ( EINFO_EPLATFORM, 0x01,			\
44
+			  "UNDI loader error" )
45
+#define EUNDILOAD( status ) EPLATFORM ( EINFO_EUNDILOAD, status )
46
+
41
 /** Parameter block for calling UNDI loader */
47
 /** Parameter block for calling UNDI loader */
42
 static struct s_UNDI_LOADER __bss16 ( undi_loader );
48
 static struct s_UNDI_LOADER __bss16 ( undi_loader );
43
 #define undi_loader __use_data16 ( undi_loader )
49
 #define undi_loader __use_data16 ( undi_loader )
109
 		/* Clear entry point */
115
 		/* Clear entry point */
110
 		memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
116
 		memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
111
 
117
 
112
-		rc = -undi_loader.Status;
113
-		if ( rc == 0 ) /* Paranoia */
114
-			rc = -EIO;
118
+		rc = -EUNDILOAD ( undi_loader.Status );
115
 		DBGC ( undi, "UNDI %p loader failed: %s\n",
119
 		DBGC ( undi, "UNDI %p loader failed: %s\n",
116
 		       undi, strerror ( rc ) );
120
 		       undi, strerror ( rc ) );
117
 		return rc;
121
 		return rc;

+ 11
- 3
src/arch/i386/interface/pxe/pxe_call.c View File

32
  * PXE API entry point
32
  * PXE API entry point
33
  */
33
  */
34
 
34
 
35
+/* Disambiguate the various error causes */
36
+#define EINFO_EPXENBP							\
37
+	__einfo_uniqify ( EINFO_EPLATFORM, 0x01,			\
38
+			  "External PXE NBP error" )
39
+#define EPXENBP( status ) EPLATFORM ( EINFO_EPXENBP, status )
40
+
35
 /** Vector for chaining INT 1A */
41
 /** Vector for chaining INT 1A */
36
 extern struct segoff __text16 ( pxe_int_1a_vector );
42
 extern struct segoff __text16 ( pxe_int_1a_vector );
37
 #define pxe_int_1a_vector __use_text16 ( pxe_int_1a_vector )
43
 #define pxe_int_1a_vector __use_text16 ( pxe_int_1a_vector )
257
 int pxe_start_nbp ( void ) {
263
 int pxe_start_nbp ( void ) {
258
 	int jmp;
264
 	int jmp;
259
 	int discard_b, discard_c, discard_d, discard_D;
265
 	int discard_b, discard_c, discard_d, discard_D;
260
-	uint16_t rc;
266
+	uint16_t status;
261
 
267
 
262
 	/* Allow restarting NBP via PXENV_RESTART_TFTP */
268
 	/* Allow restarting NBP via PXENV_RESTART_TFTP */
263
 	jmp = rmsetjmp ( pxe_restart_nbp );
269
 	jmp = rmsetjmp ( pxe_restart_nbp );
271
 					   "sti\n\t"
277
 					   "sti\n\t"
272
 					   "lcall $0, $0x7c00\n\t"
278
 					   "lcall $0, $0x7c00\n\t"
273
 					   "addw $4, %%sp\n\t" )
279
 					   "addw $4, %%sp\n\t" )
274
-			       : "=a" ( rc ), "=b" ( discard_b ),
280
+			       : "=a" ( status ), "=b" ( discard_b ),
275
 				 "=c" ( discard_c ), "=d" ( discard_d ),
281
 				 "=c" ( discard_c ), "=d" ( discard_d ),
276
 				 "=D" ( discard_D )
282
 				 "=D" ( discard_D )
277
 			       : "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ),
283
 			       : "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ),
279
 			         "d" ( virt_to_phys ( &pxenv ) ),
285
 			         "d" ( virt_to_phys ( &pxenv ) ),
280
 				 "D" ( __from_text16 ( &ppxe ) )
286
 				 "D" ( __from_text16 ( &ppxe ) )
281
 			       : "esi", "ebp", "memory" );
287
 			       : "esi", "ebp", "memory" );
288
+	if ( status )
289
+		return -EPXENBP ( status );
282
 
290
 
283
-	return rc;
291
+	return 0;
284
 }
292
 }
285
 
293
 
286
 REQUIRE_OBJECT ( pxe_preboot );
294
 REQUIRE_OBJECT ( pxe_preboot );

+ 8
- 10
src/arch/i386/interface/pxeparent/pxeparent.c View File

31
  *
31
  *
32
  */
32
  */
33
 
33
 
34
+/* Disambiguate the various error causes */
35
+#define EINFO_EPXECALL							\
36
+	__einfo_uniqify ( EINFO_EPLATFORM, 0x01,			\
37
+			  "External PXE API error" )
38
+#define EPXECALL( status ) EPLATFORM ( EINFO_EPXECALL, status )
39
+
34
 /**
40
 /**
35
  * Name PXE API call
41
  * Name PXE API call
36
  *
42
  *
151
 	/* Determine return status code based on PXENV_EXIT and
157
 	/* Determine return status code based on PXENV_EXIT and
152
 	 * PXENV_STATUS
158
 	 * PXENV_STATUS
153
 	 */
159
 	 */
154
-	if ( exit == PXENV_EXIT_SUCCESS ) {
155
-		rc = 0;
156
-	} else {
157
-		rc = -pxeparent_params.Status;
158
-		/* Paranoia; don't return success for the combination
159
-		 * of PXENV_EXIT_FAILURE but PXENV_STATUS_SUCCESS
160
-		 */
161
-		if ( rc == 0 )
162
-			rc = -EIO;
163
-	}
160
+	rc = ( ( exit == PXENV_EXIT_SUCCESS ) ?
161
+	       0 : -EPXECALL ( pxeparent_params.Status ) );
164
 
162
 
165
 	/* If anything goes wrong, print as much debug information as
163
 	/* If anything goes wrong, print as much debug information as
166
 	 * it's possible to give.
164
 	 * it's possible to give.

+ 1
- 0
src/arch/x86/include/bits/errfile.h View File

33
 #define ERRFILE_comboot_call   ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 )
33
 #define ERRFILE_comboot_call   ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 )
34
 #define ERRFILE_sdi	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 )
34
 #define ERRFILE_sdi	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 )
35
 #define ERRFILE_initrd	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 )
35
 #define ERRFILE_initrd	       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 )
36
+#define ERRFILE_pxe_call       ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000d0000 )
36
 
37
 
37
 #define ERRFILE_undi		 ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 )
38
 #define ERRFILE_undi		 ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 )
38
 #define ERRFILE_undiload	 ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )
39
 #define ERRFILE_undiload	 ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )

Loading…
Cancel
Save