Browse Source

[PXEXT] Add FILE_API_CHECK API function

Add FILE_API_CHECK to the PXEXT API so the NBP can query the
availability and status of the API.
tags/v0.9.4
H. Peter Anvin 16 years ago
parent
commit
d62e89d776

+ 5
- 0
src/arch/i386/interface/pxe/pxe_call.c View File

97
 	PXENV_EXIT_t ( * file_read ) ( struct s_PXENV_FILE_READ * );
97
 	PXENV_EXIT_t ( * file_read ) ( struct s_PXENV_FILE_READ * );
98
 	PXENV_EXIT_t ( * get_file_size ) ( struct s_PXENV_GET_FILE_SIZE * );
98
 	PXENV_EXIT_t ( * get_file_size ) ( struct s_PXENV_GET_FILE_SIZE * );
99
 	PXENV_EXIT_t ( * file_exec ) ( struct s_PXENV_FILE_EXEC * );
99
 	PXENV_EXIT_t ( * file_exec ) ( struct s_PXENV_FILE_EXEC * );
100
+	PXENV_EXIT_t ( * file_api_check ) ( struct s_PXENV_FILE_API_CHECK * );
100
 };
101
 };
101
 
102
 
102
 /**
103
 /**
299
 		pxenv_call.file_exec = pxenv_file_exec;
300
 		pxenv_call.file_exec = pxenv_file_exec;
300
 		param_len = sizeof ( pxenv_any.file_exec );
301
 		param_len = sizeof ( pxenv_any.file_exec );
301
 		break;
302
 		break;
303
+	case PXENV_FILE_API_CHECK:
304
+		pxenv_call.file_api_check = pxenv_file_api_check;
305
+		param_len = sizeof ( pxenv_any.file_api_check );
306
+		break;
302
 	default:
307
 	default:
303
 		DBG ( "PXENV_UNKNOWN_%hx", opcode );
308
 		DBG ( "PXENV_UNKNOWN_%hx", opcode );
304
 		pxenv_call.unknown = pxenv_unknown;
309
 		pxenv_call.unknown = pxenv_unknown;

+ 1
- 0
src/include/pxe.h View File

64
 	struct s_PXENV_FILE_READ		file_read;
64
 	struct s_PXENV_FILE_READ		file_read;
65
 	struct s_PXENV_GET_FILE_SIZE		get_file_size;
65
 	struct s_PXENV_GET_FILE_SIZE		get_file_size;
66
 	struct s_PXENV_FILE_EXEC		file_exec;
66
 	struct s_PXENV_FILE_EXEC		file_exec;
67
+	struct s_PXENV_FILE_API_CHECK		file_api_check;
67
 };
68
 };
68
 
69
 
69
 typedef union u_PXENV_ANY PXENV_ANY_t;
70
 typedef union u_PXENV_ANY PXENV_ANY_t;

+ 26
- 0
src/include/pxe_api.h View File

1706
 
1706
 
1707
 /** @} */ /* pxenv_file_exec */
1707
 /** @} */ /* pxenv_file_exec */
1708
 
1708
 
1709
+/** @defgroup pxenv_file_api_check PXENV_FILE_API_CHECK
1710
+ *
1711
+ * FILE API CHECK
1712
+ *
1713
+ * @{
1714
+ */
1715
+
1716
+/** PXE API function code for pxenv_file_api_check() */
1717
+#define PXENV_FILE_API_CHECK		0x00e6
1718
+
1719
+/** Parameter block for pxenv_file_api_check() */
1720
+struct s_PXENV_FILE_API_CHECK {
1721
+	PXENV_STATUS_t Status;		/**< PXE status code */
1722
+	UINT16_t Size;			/**< Size of structure  */
1723
+	UINT32_t Magic;			/**< Magic number */
1724
+	UINT32_t Provider;		/**< Implementation identifier */
1725
+	UINT32_t APIMask;		/**< Supported API functions */
1726
+	UINT32_t Flags;			/**< Reserved for the future */
1727
+} PACKED;
1728
+
1729
+typedef struct s_PXENV_FILE_API_CHECK PXENV_FILE_API_CHECK_t;
1730
+
1731
+extern PXENV_EXIT_t pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_check );
1732
+
1733
+/** @} */ /* pxenv_file_api_check */
1734
+
1709
 /** @} */ /* pxe_file_api */
1735
 /** @} */ /* pxe_file_api */
1710
 
1736
 
1711
 /** @defgroup pxe_loader_api PXE Loader API
1737
 /** @defgroup pxe_loader_api PXE Loader API

+ 35
- 0
src/interface/pxe/pxe_file.c View File

227
 	file_exec->Status = PXENV_STATUS_SUCCESS;
227
 	file_exec->Status = PXENV_STATUS_SUCCESS;
228
 	return PXENV_EXIT_SUCCESS;
228
 	return PXENV_EXIT_SUCCESS;
229
 }
229
 }
230
+
231
+/**
232
+ * FILE API CHECK
233
+ *
234
+ * @v file_exec				Pointer to a struct s_PXENV_FILE_API_CHECK
235
+ * @v s_PXENV_FILE_API_CHECK::Magic     Inbound magic number (0x91d447b2)
236
+ * @ret #PXENV_EXIT_SUCCESS		Command was executed successfully
237
+ * @ret #PXENV_EXIT_FAILURE		Command was not executed successfully
238
+ * @ret s_PXENV_FILE_API_CHECK::Status	PXE status code
239
+ * @ret s_PXENV_FILE_API_CHECK::Magic	Outbound magic number (0xe9c17b20)
240
+ * @ret s_PXENV_FILE_API_CHECK::Provider "gPXE" (0x45585067)
241
+ * @ret s_PXENV_FILE_API_CHECK::APIMask API function bitmask
242
+ * @ret s_PXENV_FILE_API_CHECK::Flags	Reserved
243
+ *
244
+ */
245
+PXENV_EXIT_t pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_check ) {
246
+	DBG ( "PXENV_FILE_API_CHECK" );
247
+
248
+	if ( file_api_check->Magic != 0x91d447b2 ) {
249
+		file_api_check->Status = PXENV_STATUS_BAD_FUNC;
250
+		return PXENV_EXIT_FAILURE;
251
+	} else if ( file_api_check->Size <
252
+		    sizeof(struct s_PXENV_FILE_API_CHECK) ) {
253
+		file_api_check->Status = PXENV_STATUS_OUT_OF_RESOURCES;
254
+		return PXENV_EXIT_FAILURE;
255
+	} else {
256
+		file_api_check->Status   = PXENV_STATUS_SUCCESS;
257
+		file_api_check->Size     = sizeof(struct s_PXENV_FILE_API_CHECK);
258
+		file_api_check->Magic    = 0xe9c17b20;
259
+		file_api_check->Provider = 0x45585067; /* "gPXE" */
260
+		file_api_check->APIMask  = 0x0000007f; /* Functions e0-e6 */
261
+		file_api_check->Flags    = 0;	       /* None defined */
262
+		return PXENV_EXIT_SUCCESS;
263
+	}
264
+}

Loading…
Cancel
Save