]>
Commit | Line | Data |
---|---|---|
0a6f4824 LG |
1 | /** @file\r |
2 | Wrapper routines that use a PXE-enabled NIC option ROM to\r | |
3 | supply internal routines for an EFI SNI (Simple Network\r | |
bcecde14 | 4 | Interface) Protocol.\r |
5 | \r | |
6 | This file relies upon the existence of a PXE-compliant ROM\r | |
0a6f4824 | 7 | in memory, as defined by the Preboot Execution Environment\r |
bcecde14 | 8 | Specification (PXE), Version 2.1, located at\r |
9 | \r | |
10 | http://developer.intel.com/ial/wfm/wfmspecs.htm\r | |
11 | \r | |
0a6f4824 | 12 | Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r |
bcecde14 | 13 | \r |
c0a00b14 | 14 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
bcecde14 | 15 | \r |
16 | **/\r | |
17 | \r | |
18 | #include "BiosSnp16.h"\r | |
19 | \r | |
20 | /**\r | |
0a6f4824 | 21 | PXE\r |
bcecde14 | 22 | START UNDI\r |
23 | Op-Code: PXENV_START_UNDI (0000h)\r | |
24 | Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.\r | |
25 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
26 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
27 | constants.\r | |
28 | Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is\r | |
29 | responsible for saving the information it needs to communicate with the hardware.\r | |
30 | This service is also responsible for hooking the Int 1Ah service routine\r | |
31 | Note: This API service must be called only once during UNDI Option ROM boot.\r | |
32 | The UNDI driver is responsible for saving this information and using it every time\r | |
33 | PXENV_UNDI_STARTUP is called.\r | |
34 | Service cannot be used in protected mode.\r | |
35 | typedef struct {\r | |
36 | PXENV_STATUS Status;\r | |
37 | UINT16 AX;\r | |
38 | UINT16 BX;\r | |
39 | UINT16 DX;\r | |
40 | UINT16 DI;\r | |
41 | UINT16 ES;\r | |
42 | } PXENV_START_UNDI_T;\r | |
43 | Set before calling API service\r | |
44 | AX, BX, DX, DI, ES: BIOS initialization parameter registers. These\r | |
45 | fields should contain the same information passed to the option ROM\r | |
46 | initialization routine by the Host System BIOS. Information about the\r | |
47 | contents of these registers can be found in the [PnP], [PCI] and\r | |
48 | [BBS] specifications.\r | |
49 | Returned from API service\r | |
0a6f4824 | 50 | Status: See the PXENV_STATUS_xxx constants.\r |
bcecde14 | 51 | \r |
52 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 53 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 54 | for option ROM call.\r |
0a6f4824 LG |
55 | \r |
56 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 57 | **/\r |
58 | EFI_STATUS\r | |
59 | PxeStartUndi (\r | |
60 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
61 | IN OUT PXENV_START_UNDI_T *PxeUndiTable\r | |
62 | )\r | |
63 | {\r | |
64 | return MakePxeCall (\r | |
65 | SimpleNetworkDevice,\r | |
66 | PxeUndiTable,\r | |
67 | sizeof (PXENV_START_UNDI_T),\r | |
68 | PXENV_START_UNDI\r | |
69 | );\r | |
70 | }\r | |
71 | \r | |
72 | /**\r | |
0a6f4824 LG |
73 | PXE\r |
74 | UNDI STARTUP\r | |
bcecde14 | 75 | Op-Code: PXENV_UNDI_STARTUP (0001h)\r |
76 | Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the\r | |
77 | caller.\r | |
78 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
79 | the parameter structure must be set to one of the values represented by the\r | |
80 | PXENV_STATUS_xxx constants.\r | |
81 | Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper\r | |
82 | operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used\r | |
83 | to complete this initialization. The rest of the UNDI APIs will not be available until this call has\r | |
84 | been completed.\r | |
85 | Note: PXENV_UNDI_STARTUP must not be called again without first calling\r | |
86 | PXENV_UNDI_SHUTDOWN.\r | |
87 | PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for\r | |
88 | chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and\r | |
89 | PXENV_STOP_UNDI API calls.\r | |
90 | This service cannot be used in protected mode.\r | |
0a6f4824 | 91 | typedef struct\r |
bcecde14 | 92 | {\r |
93 | PXENV_STATUS Status;\r | |
94 | } PXENV_UNDI_STARTUP_T;\r | |
95 | Set before calling API service\r | |
96 | N/A\r | |
97 | Returned from API service\r | |
98 | Status: See the PXENV_STATUS_xxx constants.\r | |
99 | \r | |
100 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 101 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 102 | for option ROM call.\r |
0a6f4824 LG |
103 | \r |
104 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 105 | **/\r |
106 | EFI_STATUS\r | |
107 | PxeUndiStartup (\r | |
108 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
109 | IN OUT PXENV_UNDI_STARTUP_T *PxeUndiTable\r | |
110 | )\r | |
111 | {\r | |
112 | return MakePxeCall (\r | |
113 | SimpleNetworkDevice,\r | |
114 | PxeUndiTable,\r | |
115 | sizeof (PXENV_UNDI_STARTUP_T),\r | |
116 | PXENV_UNDI_STARTUP\r | |
117 | );\r | |
118 | }\r | |
119 | \r | |
120 | /**\r | |
0a6f4824 | 121 | PXE\r |
bcecde14 | 122 | UNDI CLEANUP\r |
123 | Op-Code: PXENV_UNDI_CLEANUP (0002h)\r | |
124 | Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.\r | |
125 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field\r | |
126 | in the parameter structure must be set to one of the values represented by the\r | |
127 | PXENV_STATUS_xxx constants.\r | |
128 | Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be\r | |
129 | made just before unloading the Universal NIC Driver. The rest of the API will not be available\r | |
130 | after this call executes.\r | |
131 | This service cannot be used in protected mode.\r | |
132 | typedef struct {\r | |
133 | PXENX_STATUS Status;\r | |
134 | } PXENV_UNDI_CLEANUP_T;\r | |
135 | Set before calling API service\r | |
136 | N/A\r | |
137 | Returned from API service\r | |
138 | Status: See the PXENV_STATUS_xxx constants.\r | |
139 | \r | |
140 | @param SimpleNetworkDevice Device instance\r | |
0a6f4824 | 141 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 142 | for option ROM call.\r |
0a6f4824 LG |
143 | \r |
144 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 145 | **/\r |
146 | EFI_STATUS\r | |
147 | PxeUndiCleanup (\r | |
148 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
149 | IN OUT PXENV_UNDI_CLEANUP_T *PxeUndiTable\r | |
150 | )\r | |
151 | {\r | |
152 | return MakePxeCall (\r | |
153 | SimpleNetworkDevice,\r | |
154 | PxeUndiTable,\r | |
155 | sizeof (PXENV_UNDI_CLEANUP_T),\r | |
156 | PXENV_UNDI_CLEANUP\r | |
157 | );\r | |
158 | }\r | |
159 | \r | |
160 | /**\r | |
0a6f4824 | 161 | PXE\r |
bcecde14 | 162 | UNDI INITIALIZE\r |
163 | Op-Code: PXENV_UNDI_INITIALIZE (0003h)\r | |
164 | Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the\r | |
165 | caller.\r | |
166 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
167 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
168 | constants.\r | |
169 | Description: This call resets the adapter and programs it with default parameters. The default parameters used\r | |
170 | are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the\r | |
171 | receive and transmit units of the network adapter to readily receive or transmit packets. The\r | |
172 | application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.\r | |
173 | This call must be made by an application to establish an interface to the network adapter driver.\r | |
174 | Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for\r | |
175 | the Protocol field in the parameter structure.\r | |
176 | typedef struct {\r | |
177 | PXENV_STATUS Status;\r | |
178 | ADDR32 ProtocolIni;\r | |
179 | UINT8 reserved[8];\r | |
180 | } PXENV_UNDI_INITIALIZE_T;\r | |
181 | Set before calling API service\r | |
182 | ProtocolIni: Physical address of a memory copy of the driver\r | |
183 | module from the protocol.ini file obtained from the protocol manager\r | |
184 | driver (refer to the NDIS 2.0 specification). This parameter is\r | |
185 | supported for the universal NDIS driver to pass the information\r | |
186 | contained in the protocol.ini file to the NIC driver for any specific\r | |
187 | configuration of the NIC. (Note that the module identification in the\r | |
188 | protocol.ini file was done by NDIS.) This value can be NULL for any\r | |
189 | other application interfacing to the universal NIC driver\r | |
190 | Returned from API service\r | |
0a6f4824 LG |
191 | Status: See the PXENV_STATUS_xxx constants.\r |
192 | \r | |
bcecde14 | 193 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 194 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 195 | for option ROM call.\r |
0a6f4824 LG |
196 | \r |
197 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 198 | **/\r |
199 | EFI_STATUS\r | |
200 | PxeUndiInitialize (\r | |
201 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
202 | IN OUT PXENV_UNDI_INITIALIZE_T *PxeUndiTable\r | |
203 | )\r | |
204 | {\r | |
205 | return MakePxeCall (\r | |
206 | SimpleNetworkDevice,\r | |
207 | PxeUndiTable,\r | |
208 | sizeof (PXENV_UNDI_INITIALIZE_T),\r | |
209 | PXENV_UNDI_INITIALIZE\r | |
210 | );\r | |
211 | }\r | |
212 | \r | |
213 | /**\r | |
214 | Wrapper routine for reset adapter.\r | |
0a6f4824 LG |
215 | \r |
216 | PXE\r | |
bcecde14 | 217 | UNDI RESET ADAPTER\r |
218 | Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)\r | |
219 | Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized\r | |
220 | by the caller.\r | |
221 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
222 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
223 | constants.\r | |
224 | Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to\r | |
225 | Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the\r | |
226 | network. This routine cannot be used to replace Initialize or Shutdown calls.\r | |
227 | typedef struct {\r | |
228 | PXENV_STATUS Status;\r | |
229 | PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r | |
230 | } PXENV_UNDI_RESET_T;\r | |
231 | \r | |
232 | #define MAXNUM_MCADDR 8\r | |
233 | \r | |
234 | typedef struct {\r | |
235 | UINT16 MCastAddrCount;\r | |
236 | MAC_ADDR McastAddr[MAXNUM_MCADDR];\r | |
237 | } PXENV_UNDI_MCAST_ADDRESS_t;\r | |
238 | \r | |
239 | Set before calling API service\r | |
240 | R_Mcast_Buf: This is a structure of MCastAddrCount and\r | |
241 | McastAddr.\r | |
242 | MCastAddrCount: Number of multicast MAC addresses in the\r | |
243 | buffer.\r | |
244 | McastAddr: List of up to MAXNUM_MCADDR multicast MAC\r | |
245 | addresses.\r | |
246 | Returned from API service\r | |
247 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 248 | \r |
bcecde14 | 249 | @param SimpleNetworkDevice Device instance.\r |
0a6f4824 | 250 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 251 | for option ROM call.\r |
0a6f4824 LG |
252 | @param RxFilter Filter setting mask value for PXE recive .\r |
253 | \r | |
254 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 255 | **/\r |
256 | EFI_STATUS\r | |
257 | PxeUndiResetNic (\r | |
258 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
259 | IN OUT PXENV_UNDI_RESET_T *PxeUndiTable,\r | |
260 | IN UINT16 RxFilter\r | |
261 | )\r | |
262 | {\r | |
263 | PXENV_UNDI_OPEN_T Open;\r | |
264 | PXENV_UNDI_CLOSE_T Close;\r | |
265 | UINTN Status;\r | |
266 | \r | |
267 | Status = MakePxeCall (\r | |
268 | SimpleNetworkDevice,\r | |
269 | PxeUndiTable,\r | |
270 | sizeof (PXENV_UNDI_RESET_T),\r | |
271 | PXENV_UNDI_RESET_NIC\r | |
272 | );\r | |
273 | if (!EFI_ERROR(Status)) {\r | |
274 | return Status;\r | |
275 | }\r | |
276 | \r | |
277 | Close.Status = PXENV_STATUS_SUCCESS;\r | |
278 | \r | |
279 | Status = MakePxeCall (\r | |
280 | SimpleNetworkDevice,\r | |
281 | &Close,\r | |
282 | sizeof (Close),\r | |
283 | PXENV_UNDI_CLOSE\r | |
284 | );\r | |
285 | if (EFI_ERROR(Status)) {\r | |
286 | return EFI_DEVICE_ERROR;\r | |
287 | }\r | |
288 | \r | |
289 | Status = MakePxeCall (\r | |
290 | SimpleNetworkDevice,\r | |
291 | PxeUndiTable,\r | |
292 | sizeof (PXENV_UNDI_RESET_T),\r | |
293 | PXENV_UNDI_RESET_NIC\r | |
294 | );\r | |
295 | if (EFI_ERROR(Status)) {\r | |
296 | return EFI_DEVICE_ERROR;\r | |
297 | }\r | |
298 | \r | |
299 | Open.Status = PXENV_STATUS_SUCCESS;\r | |
300 | Open.OpenFlag = 0;\r | |
301 | Open.PktFilter = RxFilter;\r | |
302 | CopyMem (\r | |
303 | &Open.McastBuffer,\r | |
304 | &PxeUndiTable->R_Mcast_Buf,\r | |
305 | sizeof (PXENV_UNDI_MCAST_ADDR_T)\r | |
0a6f4824 LG |
306 | );\r |
307 | \r | |
bcecde14 | 308 | \r |
309 | Status = MakePxeCall (\r | |
310 | SimpleNetworkDevice,\r | |
311 | &Open,\r | |
312 | sizeof (Open),\r | |
313 | PXENV_UNDI_OPEN\r | |
314 | );\r | |
315 | if (EFI_ERROR(Status)) {\r | |
316 | return EFI_DEVICE_ERROR;\r | |
317 | }\r | |
318 | \r | |
319 | return EFI_SUCCESS;\r | |
320 | }\r | |
321 | \r | |
322 | /**\r | |
0a6f4824 | 323 | PXE\r |
bcecde14 | 324 | UNDI SHUTDOWN\r |
325 | Op-Code: PXENV_UNDI_SHUTDOWN (0005h)\r | |
326 | Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.\r | |
327 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
328 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
329 | constants.\r | |
330 | Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.\r | |
331 | Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the\r | |
332 | Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.\r | |
0a6f4824 | 333 | typedef struct\r |
bcecde14 | 334 | {\r |
335 | PXENV_STATUS Status;\r | |
336 | } PXENV_UNDI_SHUTDOWN_T;\r | |
337 | Set before calling API service\r | |
338 | N/A\r | |
339 | Returned from API service\r | |
340 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 341 | \r |
bcecde14 | 342 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 343 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 344 | for option ROM call.\r |
0a6f4824 LG |
345 | \r |
346 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 347 | **/\r |
348 | EFI_STATUS\r | |
349 | PxeUndiShutdown (\r | |
350 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
351 | IN OUT PXENV_UNDI_SHUTDOWN_T *PxeUndiTable\r | |
352 | )\r | |
353 | {\r | |
354 | return MakePxeCall (\r | |
355 | SimpleNetworkDevice,\r | |
356 | PxeUndiTable,\r | |
357 | sizeof (PXENV_UNDI_SHUTDOWN_T),\r | |
358 | PXENV_UNDI_SHUTDOWN\r | |
359 | );\r | |
360 | }\r | |
361 | \r | |
362 | /**\r | |
0a6f4824 | 363 | PXE\r |
bcecde14 | 364 | UNDI OPEN\r |
365 | Op-Code: PXENV_UNDI_OPEN (0006h)\r | |
366 | Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.\r | |
367 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
368 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
369 | constants.\r | |
370 | Description: This call activates the adapter network connection and sets the adapter ready to accept packets\r | |
371 | for transmit and receive.\r | |
372 | typedef struct {\r | |
373 | PXENV_STATUS Status;\r | |
374 | UINT16 OpenFlag;\r | |
375 | UINT16 PktFilter;\r | |
376 | #define FLTR_DIRECTED 0x0001\r | |
377 | #define FLTR_BRDCST 0x0002\r | |
378 | #define FLTR_PRMSCS 0x0004\r | |
379 | #define FLTR_SRC_RTG 0x0008\r | |
380 | PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r | |
381 | } PXENV_UNDI_OPEN_T;\r | |
382 | Set before calling API service\r | |
383 | OpenFlag: This is an adapter specific input parameter. This is\r | |
384 | supported for the universal NDIS 2.0 driver to pass in the open flags\r | |
385 | provided by the protocol driver. (See the NDIS 2.0 specification.)\r | |
386 | This can be zero.\r | |
387 | PktFilter: Filter for receiving packets. This can be one, or more, of\r | |
388 | the FLTR_xxx constants. Multiple values are arithmetically or-ed\r | |
389 | together.\r | |
390 | directed packets are packets that may come to your MAC address\r | |
391 | or the multicast MAC address.\r | |
392 | R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).\r | |
393 | Returned from API service\r | |
394 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 395 | \r |
bcecde14 | 396 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 397 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 398 | for option ROM call.\r |
0a6f4824 LG |
399 | \r |
400 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 401 | **/\r |
402 | EFI_STATUS\r | |
403 | PxeUndiOpen (\r | |
404 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
405 | IN OUT PXENV_UNDI_OPEN_T *PxeUndiTable\r | |
406 | )\r | |
407 | {\r | |
408 | return MakePxeCall (\r | |
409 | SimpleNetworkDevice,\r | |
410 | PxeUndiTable,\r | |
411 | sizeof (PXENV_UNDI_OPEN_T),\r | |
412 | PXENV_UNDI_OPEN\r | |
413 | );\r | |
414 | }\r | |
415 | \r | |
416 | /**\r | |
0a6f4824 | 417 | PXE\r |
bcecde14 | 418 | UNDI CLOSE\r |
419 | Op-Code: PXENV_UNDI_CLOSE (0007h)\r | |
420 | Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.\r | |
421 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
422 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
423 | constants.\r | |
424 | Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or\r | |
425 | received until the network adapter is open again.\r | |
426 | typedef struct {\r | |
427 | PXENV_STATUS Status;\r | |
428 | } PXENV_UNDI_CLOSE_T;\r | |
429 | Set before calling API service\r | |
430 | N/A\r | |
431 | Returned from API service\r | |
432 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 433 | \r |
bcecde14 | 434 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 435 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 436 | for option ROM call.\r |
0a6f4824 LG |
437 | \r |
438 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 439 | **/\r |
440 | EFI_STATUS\r | |
441 | PxeUndiClose (\r | |
442 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
443 | IN OUT PXENV_UNDI_CLOSE_T *PxeUndiTable\r | |
444 | )\r | |
445 | {\r | |
446 | return MakePxeCall (\r | |
447 | SimpleNetworkDevice,\r | |
448 | PxeUndiTable,\r | |
449 | sizeof (PXENV_UNDI_CLOSE_T),\r | |
450 | PXENV_UNDI_CLOSE\r | |
451 | );\r | |
452 | }\r | |
453 | \r | |
454 | /**\r | |
0a6f4824 | 455 | PXE\r |
bcecde14 | 456 | UNDI TRANSMIT PACKET\r |
457 | Op-Code: PXENV_UNDI_TRANSMIT (0008h)\r | |
458 | Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that\r | |
459 | has been initialized by the caller.\r | |
460 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.\r | |
461 | The status code must be set to one of the values represented by the\r | |
462 | PXENV_STATUS_xxx constants.\r | |
463 | Description: This call transmits a buffer to the network. The media header\r | |
464 | for the packet can be filled by the calling protocol, but it might not be.\r | |
465 | The network adapter driver will fill it if required by the values in the\r | |
466 | parameter block. The packet is buffered for transmission provided there is\r | |
467 | an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no\r | |
468 | buffer is available the function returns PXENV_EXIT_FAILURE with a status\r | |
469 | code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is\r | |
470 | implementation-dependent. An interrupt is generated on completion of the\r | |
471 | transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is\r | |
472 | permitted in the context of a transmit complete interrupt.\r | |
473 | \r | |
474 | typedef struct {\r | |
475 | PXENV_STATUS Status;\r | |
476 | UINT8 Protocol;\r | |
477 | #define P_UNKNOWN 0\r | |
478 | #define P_IP 1\r | |
479 | #define P_ARP 2\r | |
480 | #define P_RARP 3\r | |
481 | UINT8 XmitFlag;\r | |
482 | #define XMT_DESTADDR 0x0000\r | |
483 | #define XMT_BROADCAST 0x0001\r | |
484 | SEGOFF16 DestAddr;\r | |
485 | SEGOFF16 TBD;\r | |
486 | UINT32 Reserved[2];\r | |
487 | } t_PXENV_UNDI_TRANSMIT;\r | |
488 | \r | |
489 | #define MAX_DATA_BLKS 8\r | |
490 | \r | |
491 | typedef struct {\r | |
492 | UINT16 ImmedLength;\r | |
493 | SEGOFF16 Xmit;\r | |
494 | UINT16 DataBlkCount;\r | |
495 | struct DataBlk {\r | |
496 | UINT8 TDPtrType;\r | |
497 | UINT8 TDRsvdByte;\r | |
498 | UINT16 TDDataLen;\r | |
499 | SEGOFF16 TDDataPtr;\r | |
500 | } DataBlock[MAX_DATA_BLKS];\r | |
501 | } PXENV_UNDI_TBD_T\r | |
502 | \r | |
503 | Set before calling API service\r | |
504 | Protocol: This is the protocol of the upper layer that is calling UNDI\r | |
505 | TRANSMIT call. If the upper layer has filled the media header, this\r | |
506 | field must be P_UNKNOWN.\r | |
507 | XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a\r | |
508 | pointer to the destination media address in the field DestAddr. If\r | |
509 | XMT_BROADCAST, the NIC driver fills the broadcast address for the\r | |
510 | destination.\r | |
511 | TBD: Segment:Offset address of the transmit buffer descriptor.\r | |
512 | ImmedLength: Length of the immediate transmit buffer: Xmit.\r | |
513 | Xmit: Segment:Offset of the immediate transmit buffer.\r | |
514 | DataBlkCount: Number of blocks in this transmit buffer.\r | |
515 | TDPtrType:\r | |
516 | 0 => 32-bit physical address in TDDataPtr (not supported in this\r | |
517 | version of PXE)\r | |
518 | 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit\r | |
519 | protected mode pointer\r | |
520 | TDRsvdByte: Reserved must be zero.\r | |
521 | TDDatalen: Data block length in bytes.\r | |
522 | TDDataPtr: Segment:Offset of the transmit block.\r | |
523 | DataBlock: Array of transmit data blocks.\r | |
524 | Returned from API service\r | |
0a6f4824 LG |
525 | Status: See the PXENV_STATUS_xxx constants\r |
526 | \r | |
bcecde14 | 527 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 528 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 529 | for option ROM call.\r |
0a6f4824 LG |
530 | \r |
531 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 532 | **/\r |
533 | EFI_STATUS\r | |
534 | PxeUndiTransmit (\r | |
535 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
536 | IN OUT PXENV_UNDI_TRANSMIT_T *PxeUndiTable\r | |
537 | )\r | |
538 | {\r | |
539 | EFI_STATUS Status;\r | |
540 | \r | |
541 | Status = MakePxeCall (\r | |
542 | SimpleNetworkDevice,\r | |
543 | PxeUndiTable,\r | |
544 | sizeof (PXENV_UNDI_TRANSMIT_T),\r | |
545 | PXENV_UNDI_TRANSMIT\r | |
546 | );\r | |
547 | if (Status == EFI_SUCCESS) {\r | |
548 | return EFI_SUCCESS;\r | |
549 | }\r | |
550 | \r | |
551 | switch (PxeUndiTable->Status) {\r | |
552 | case PXENV_STATUS_OUT_OF_RESOURCES:\r | |
553 | return EFI_NOT_READY;\r | |
554 | \r | |
555 | default:\r | |
556 | return EFI_DEVICE_ERROR;\r | |
557 | }\r | |
558 | }\r | |
559 | \r | |
0a6f4824 | 560 | \r |
bcecde14 | 561 | \r |
562 | /**\r | |
0a6f4824 | 563 | PXE\r |
bcecde14 | 564 | UNDI SET STATION ADDRESS\r |
565 | Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)\r | |
566 | Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been\r | |
567 | initialized by the caller.\r | |
568 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
569 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
570 | constants.\r | |
571 | Description: This call sets the MAC address to be the input value and is called before opening the network\r | |
572 | adapter. Later, the open call uses this variable as a temporary MAC address to program the\r | |
573 | adapter individual address registers.\r | |
574 | typedef struct {\r | |
575 | PXENV_STATUS Status;\r | |
576 | MAC_ADDR StationAddress;\r | |
577 | } PXENV_UNDI_SET_STATION_ADDR_T;\r | |
578 | Set before calling API service\r | |
579 | StationAddress: Temporary MAC address to be used for\r | |
580 | transmit and receive.\r | |
581 | Returned from API service\r | |
0a6f4824 LG |
582 | Status: See the PXENV_STATUS_xxx constants.\r |
583 | \r | |
bcecde14 | 584 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 585 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 586 | for option ROM call.\r |
0a6f4824 LG |
587 | \r |
588 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 589 | **/\r |
590 | EFI_STATUS\r | |
591 | PxeUndiSetStationAddr (\r | |
592 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
593 | IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable\r | |
594 | )\r | |
595 | {\r | |
596 | return MakePxeCall (\r | |
597 | SimpleNetworkDevice,\r | |
598 | PxeUndiTable,\r | |
599 | sizeof (PXENV_UNDI_SET_STATION_ADDR_T),\r | |
600 | PXENV_UNDI_SET_STATION_ADDR\r | |
601 | );\r | |
602 | }\r | |
603 | \r | |
604 | /**\r | |
0a6f4824 | 605 | PXE\r |
bcecde14 | 606 | UNDI SET PACKET FILTER\r |
607 | Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)\r | |
608 | Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been\r | |
609 | initialized by the caller.\r | |
610 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
611 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
612 | constants.\r | |
613 | Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with\r | |
614 | the open call.\r | |
615 | typedef struct {\r | |
616 | PXENV_STATUS Status;\r | |
617 | UINT8 filter;\r | |
618 | } PXENV_UNDI_SET_PACKET_FILTER_T;\r | |
619 | Set before calling API service\r | |
620 | Filter: See the receive filter values in the UNDI OPEN\r | |
621 | (0006h) API description.\r | |
622 | Returned from API service\r | |
0a6f4824 LG |
623 | Status: See the PXENV_STATUS_xxx constants.\r |
624 | \r | |
bcecde14 | 625 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 626 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 627 | for option ROM call.\r |
0a6f4824 LG |
628 | \r |
629 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 630 | **/\r |
bcecde14 | 631 | \r |
632 | /**\r | |
0a6f4824 | 633 | PXE\r |
bcecde14 | 634 | UNDI GET INFORMATION\r |
635 | Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)\r | |
636 | Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been\r | |
637 | initialized by the caller.\r | |
638 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
639 | the parameter structure must be set to one of the values represented by the\r | |
640 | PXENV_STATUS_xxx constants.\r | |
641 | Description: This call copies the network adapter variables, including the MAC address, into the input buffer.\r | |
642 | Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and\r | |
643 | PXENV_UNDI_STARTUP have been issued. All other fields must be valid after\r | |
644 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been\r | |
645 | called.\r | |
646 | typedef struct {\r | |
647 | PXENV_STATUS Status;\r | |
648 | UINT16 BaseIo;\r | |
649 | UINT16 IntNumber;\r | |
650 | UINT16 MaxTranUnit;\r | |
651 | UINT16 HwType;\r | |
652 | #define ETHER_TYPE 1\r | |
653 | #define EXP_ETHER_TYPE 2\r | |
654 | #define IEEE_TYPE 6\r | |
655 | #define ARCNET_TYPE 7\r | |
656 | UINT16 HwAddrLen;\r | |
657 | MAC_ADDR CurrentNodeAddress;\r | |
658 | MAC_ADDR PermNodeAddress;\r | |
659 | SEGSEL ROMAddress;\r | |
660 | UINT16 RxBufCt;\r | |
661 | UINT16 TxBufCt;\r | |
662 | } PXENV_UNDI_GET_INFORMATION_T;\r | |
663 | Set before calling API service\r | |
664 | N/A\r | |
665 | Returned from API service\r | |
666 | Status: See the PXENV_STATUS_xxx constants.\r | |
667 | BaseIO: Adapter base I/O address.\r | |
668 | IntNumber: Adapter IRQ number.\r | |
669 | MaxTranUnit: Adapter maximum transmit unit.\r | |
670 | HWType: Type of protocol at the hardware level.\r | |
671 | HWAddrLen: Length of the hardware address.\r | |
672 | CurrentNodeAddress: Current hardware address.\r | |
673 | PermNodeAddress: Permanent hardware address.\r | |
674 | ROMAddress: Real mode ROM segment address.\r | |
675 | RxBufCnt: Receive queue length.\r | |
0a6f4824 LG |
676 | TxBufCnt: Transmit queue length.\r |
677 | \r | |
bcecde14 | 678 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 679 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 680 | for option ROM call.\r |
0a6f4824 LG |
681 | \r |
682 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 683 | **/\r |
684 | EFI_STATUS\r | |
685 | PxeUndiGetInformation (\r | |
686 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
687 | IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable\r | |
688 | )\r | |
689 | {\r | |
690 | return MakePxeCall (\r | |
691 | SimpleNetworkDevice,\r | |
692 | PxeUndiTable,\r | |
693 | sizeof (PXENV_UNDI_GET_INFORMATION_T),\r | |
694 | PXENV_UNDI_GET_INFORMATION\r | |
695 | );\r | |
696 | }\r | |
697 | \r | |
698 | /**\r | |
0a6f4824 | 699 | PXE\r |
bcecde14 | 700 | UNDI GET STATISTICS\r |
701 | Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)\r | |
702 | Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized\r | |
703 | by the caller.\r | |
704 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
705 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
706 | constants.\r | |
707 | Description: This call reads statistical information from the network adapter, and returns.\r | |
708 | typedef struct {\r | |
709 | PXENV_STATUS Status;\r | |
710 | UINT32 XmtGoodFrames;\r | |
711 | UINT32 RcvGoodFrames;\r | |
712 | UINT32 RcvCRCErrors;\r | |
713 | UINT32 RcvResourceErrors;\r | |
714 | } PXENV_UNDI_GET_STATISTICS_T;\r | |
715 | Set before calling API service\r | |
716 | N/A\r | |
717 | Returned from API service\r | |
718 | Status: See the PXENV_STATUS_xxx constants.\r | |
719 | XmtGoodFrames: Number of successful transmissions.\r | |
720 | RcvGoodFrames: Number of good frames received.\r | |
721 | RcvCRCErrors: Number of frames received with CRC\r | |
722 | error.\r | |
723 | RcvResourceErrors: Number of frames discarded\r | |
724 | because receive queue was full.\r | |
0a6f4824 | 725 | \r |
bcecde14 | 726 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 727 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 728 | for option ROM call.\r |
0a6f4824 LG |
729 | \r |
730 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 731 | **/\r |
732 | EFI_STATUS\r | |
733 | PxeUndiGetStatistics (\r | |
734 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
735 | IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable\r | |
736 | )\r | |
737 | {\r | |
738 | return MakePxeCall (\r | |
739 | SimpleNetworkDevice,\r | |
740 | PxeUndiTable,\r | |
741 | sizeof (PXENV_UNDI_GET_STATISTICS_T),\r | |
742 | PXENV_UNDI_GET_STATISTICS\r | |
743 | );\r | |
744 | }\r | |
745 | \r | |
746 | /**\r | |
0a6f4824 | 747 | PXE\r |
bcecde14 | 748 | UNDI CLEAR STATISTICS\r |
749 | Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)\r | |
750 | Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.\r | |
751 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
752 | the parameter structure must be set to one of the values represented by the\r | |
753 | PXENV_STATUS_xxx constants.\r | |
754 | Description: This call clears the statistical information from the network adapter.\r | |
755 | typedef struct {\r | |
756 | PXENV_STATUS Status;\r | |
757 | } PXENV_UNDI_CLEAR_STATISTICS_T;\r | |
758 | Set before calling API service\r | |
759 | N/A\r | |
760 | Returned from API service\r | |
761 | Status: See the PXENV_STATUS_xxx constants.\r | |
0a6f4824 | 762 | \r |
bcecde14 | 763 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 764 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 765 | for option ROM call.\r |
0a6f4824 LG |
766 | \r |
767 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 768 | **/\r |
769 | EFI_STATUS\r | |
770 | PxeUndiClearStatistics (\r | |
771 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
772 | IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable\r | |
773 | )\r | |
774 | {\r | |
775 | return MakePxeCall (\r | |
776 | SimpleNetworkDevice,\r | |
777 | PxeUndiTable,\r | |
778 | sizeof (PXENV_UNDI_CLEAR_STATISTICS_T),\r | |
779 | PXENV_UNDI_CLEAR_STATISTICS\r | |
780 | );\r | |
781 | }\r | |
782 | \r | |
783 | /**\r | |
0a6f4824 | 784 | PXE\r |
bcecde14 | 785 | UNDI INITIATE DIAGS\r |
786 | Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)\r | |
787 | Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.\r | |
788 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
789 | the parameter structure must be set to one of the values represented by the\r | |
790 | PXENV_STATUS_xxx constants.\r | |
791 | Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run\r | |
792 | hardware diagnostics and to update its status information.\r | |
793 | typedef struct {\r | |
794 | PXENV_STATUS Status;\r | |
795 | } PXENV_UNDI_INITIATE_DIAGS_T;\r | |
796 | Set before calling API service\r | |
797 | N/A\r | |
798 | Returned from API service\r | |
0a6f4824 LG |
799 | Status: See the PXENV_STATUS_xxx constants.\r |
800 | \r | |
bcecde14 | 801 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 802 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 803 | for option ROM call.\r |
0a6f4824 LG |
804 | \r |
805 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 806 | **/\r |
bcecde14 | 807 | \r |
808 | /**\r | |
0a6f4824 | 809 | PXE\r |
bcecde14 | 810 | UNDI FORCE INTERRUPT\r |
811 | Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)\r | |
812 | Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been\r | |
813 | initialized by the caller.\r | |
814 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
815 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
816 | constants.\r | |
817 | Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the\r | |
818 | network adapter driver usually queues the packet and calls the application's callback receive\r | |
819 | routine with a pointer to the packet received. Then, the callback routine either can copy the packet\r | |
820 | to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,\r | |
821 | the network adapter driver does not remove it from the input queue. When the application wants to\r | |
822 | copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive\r | |
823 | interrupt.\r | |
824 | typedef struct {\r | |
825 | PXENV_STATUS Status;\r | |
826 | } PXENV_UNDI_FORCE_INTERRUPT_T;\r | |
827 | Set before calling API service\r | |
828 | N/A\r | |
829 | Returned from API service\r | |
0a6f4824 LG |
830 | Status: See the PXENV_STATUS_xxx constants.\r |
831 | \r | |
bcecde14 | 832 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 833 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 834 | for option ROM call.\r |
0a6f4824 LG |
835 | \r |
836 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 837 | **/\r |
bcecde14 | 838 | \r |
839 | /**\r | |
0a6f4824 | 840 | PXE\r |
bcecde14 | 841 | UNDI GET MULTICAST ADDRESS\r |
842 | Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)\r | |
843 | Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized\r | |
844 | by the caller.\r | |
845 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
846 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
847 | constants.\r | |
848 | Description: This call converts the given IP multicast address to a hardware multicast address.\r | |
849 | typedef struct {\r | |
850 | PXENV_STATUS Status;\r | |
851 | IP4 InetAddr;\r | |
852 | MAC_ADDR MediaAddr;\r | |
853 | } PXENV_UNDI_GET_MCAST_ADDR_T;\r | |
854 | Set before calling API service\r | |
855 | InetAddr: IP multicast address.\r | |
856 | Returned from API service\r | |
857 | Status: See the PXENV_STATUS_xxx constants.\r | |
858 | MediaAddr: MAC multicast address.\r | |
0a6f4824 | 859 | \r |
bcecde14 | 860 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 861 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 862 | for option ROM call.\r |
0a6f4824 LG |
863 | \r |
864 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 865 | **/\r |
866 | EFI_STATUS\r | |
867 | PxeUndiGetMcastAddr (\r | |
868 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
869 | IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable\r | |
870 | )\r | |
871 | {\r | |
872 | return MakePxeCall (\r | |
873 | SimpleNetworkDevice,\r | |
874 | PxeUndiTable,\r | |
875 | sizeof (PXENV_UNDI_GET_MCAST_ADDR_T),\r | |
876 | PXENV_UNDI_GET_MCAST_ADDR\r | |
877 | );\r | |
878 | }\r | |
879 | \r | |
880 | /**\r | |
0a6f4824 | 881 | PXE\r |
bcecde14 | 882 | UNDI GET NIC TYPE\r |
883 | Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)\r | |
884 | Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by\r | |
885 | the caller.\r | |
886 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
887 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
888 | constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the\r | |
889 | NIC information.\r | |
890 | Description: This call, if successful, provides the NIC-specific information necessary to identify the network\r | |
891 | adapter that is used to boot the system.\r | |
892 | Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if\r | |
893 | the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific\r | |
894 | information can be obtained from the DHCPDISCOVER packet itself.\r | |
895 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r | |
896 | before the information provided is valid.\r | |
897 | typedef {\r | |
898 | PXENV_STATUS Status;\r | |
899 | UINT8 NicType;\r | |
900 | #define PCI_NIC 2\r | |
901 | #define PnP_NIC 3\r | |
902 | #define CardBus_NIC 4\r | |
903 | Union {\r | |
904 | Struct {\r | |
905 | UINT16 Vendor_ID;\r | |
906 | UINT16 Dev_ID;\r | |
907 | UINT8 Base_Class;\r | |
908 | UINT8 Sub_Class;\r | |
909 | UINT8 Prog_Intf;\r | |
910 | UINT8 Rev;\r | |
911 | UINT16 BusDevFunc;\r | |
912 | UINT16 SubVendor_ID;\r | |
913 | UINT16 SubDevice_ID;\r | |
914 | } pci, cardbus;\r | |
915 | struct {\r | |
916 | UINT32 EISA_Dev_ID;\r | |
917 | UINT8 Base_Class;\r | |
918 | UINT8 Sub_Class;\r | |
919 | UINT8 Prog_Intf;\r | |
920 | UINT16 CardSelNum;\r | |
921 | } pnp;\r | |
922 | } info;\r | |
923 | } PXENV_UNDI_GET_NIC_TYPE_T;\r | |
924 | Set before calling API service\r | |
925 | N/A\r | |
926 | Returned from API service\r | |
927 | Status: See the PXENV_STATUS_xxx constants.\r | |
928 | NICType: Type of NIC information stored in the parameter\r | |
929 | structure.\r | |
930 | Info: Information about the fields in this union can be found\r | |
0a6f4824 LG |
931 | in the [PnP] and [PCI] specifications\r |
932 | \r | |
bcecde14 | 933 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 934 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 935 | for option ROM call.\r |
0a6f4824 LG |
936 | \r |
937 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 938 | **/\r |
939 | EFI_STATUS\r | |
940 | PxeUndiGetNicType (\r | |
941 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
942 | IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable\r | |
943 | )\r | |
944 | {\r | |
945 | return MakePxeCall (\r | |
946 | SimpleNetworkDevice,\r | |
947 | PxeUndiTable,\r | |
948 | sizeof (PXENV_UNDI_GET_NIC_TYPE_T),\r | |
949 | PXENV_UNDI_GET_NIC_TYPE\r | |
950 | );\r | |
951 | }\r | |
952 | \r | |
953 | /**\r | |
0a6f4824 | 954 | PXE\r |
bcecde14 | 955 | UNDI GET IFACE INFO\r |
956 | Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)\r | |
957 | Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized\r | |
958 | by the caller.\r | |
959 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
960 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
961 | constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the\r | |
962 | interface specific information.\r | |
963 | Description: This call, if successful, provides the network interface specific information such as the interface\r | |
964 | type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the\r | |
965 | universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.\r | |
966 | Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the\r | |
967 | universal driver to translate/convert this information into a format that is required in its specification\r | |
968 | or to suit the expectation of the upper level protocol modules.\r | |
969 | PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r | |
970 | before the information provided is valid.\r | |
971 | typedef struct {\r | |
972 | PXENV_STATUS Status\r | |
973 | UINT8 IfaceType[16];\r | |
974 | UINT32 LinkSpeed;\r | |
975 | UINT32 ServiceFlags;\r | |
976 | UINT32 Reserved[4];\r | |
977 | } PXENV_UNDI_GET_NDIS_INFO_T;\r | |
978 | Set before calling API service\r | |
979 | N/A\r | |
980 | Returned from API service\r | |
981 | Status: See the PXENV_STATUS_xxx constants.\r | |
982 | IfaceType: Name of MAC type in ASCIIZ format. This is\r | |
983 | used by the universal NDIS driver to specify its driver type\r | |
984 | to the protocol driver.\r | |
985 | LinkSpeed: Defined in the NDIS 2.0 specification.\r | |
986 | ServiceFlags: Defined in the NDIS 2.0 specification.\r | |
0a6f4824 LG |
987 | Reserved: Must be zero.\r |
988 | \r | |
bcecde14 | 989 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 990 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 991 | for option ROM call.\r |
0a6f4824 LG |
992 | \r |
993 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 994 | **/\r |
995 | EFI_STATUS\r | |
996 | PxeUndiGetNdisInfo (\r | |
997 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
998 | IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable\r | |
999 | )\r | |
1000 | {\r | |
1001 | return MakePxeCall (\r | |
1002 | SimpleNetworkDevice,\r | |
1003 | PxeUndiTable,\r | |
1004 | sizeof (PXENV_UNDI_GET_NDIS_INFO_T),\r | |
1005 | PXENV_UNDI_GET_NDIS_INFO\r | |
1006 | );\r | |
1007 | }\r | |
1008 | \r | |
1009 | /**\r | |
0a6f4824 | 1010 | PXE\r |
bcecde14 | 1011 | UNDI ISR\r |
1012 | Op-Code: PXENV_UNDI_ISR (0014h)\r | |
1013 | Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.\r | |
1014 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1015 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1016 | constants.\r | |
1017 | Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r | |
1018 | the parameter block indicates the operation to be performed for the call. This field is filled with the\r | |
1019 | status of that operation on return.\r | |
1020 | Note: Interrupt Service Routine Operation:\r | |
1021 | In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the\r | |
1022 | application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR\r | |
1023 | API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing\r | |
1024 | (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).\r | |
1025 | When the Network Interface HW generates an interrupt the protocol driver interrupt service\r | |
1026 | routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then\r | |
1027 | calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for\r | |
1028 | the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface\r | |
1029 | level and read any status values required to further process the interrupt. UNDI must return as\r | |
1030 | quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or\r | |
1031 | PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the\r | |
1032 | interrupt was generated by this particular Network Interface or not.\r | |
1033 | If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was\r | |
1034 | not generated by our NIC, and interrupt processing is complete.\r | |
1035 | If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start\r | |
1036 | a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is\r | |
1037 | now complete.\r | |
1038 | The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to\r | |
1039 | PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and\r | |
1040 | return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the\r | |
1041 | first buffer pointer of that frame in the parameter block.\r | |
1042 | The protocol driver calls UNDI repeatedly with the FuncFlag equal to\r | |
1043 | PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received\r | |
1044 | frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l\r | |
1045 | remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous\r | |
1046 | buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter\r | |
1047 | block. Otherwise it must return the first buffer in the next frame.\r | |
1048 | If there is no received frame pending to be processed, UNDI processes the transmit completes and\r | |
1049 | if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the\r | |
1050 | NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.\r | |
1051 | IMPORTANT: It is possible for the protocol driver to be interrupted again while in the\r | |
0a6f4824 LG |
1052 | strategy routine when the UNDI re-enables interrupts.\r |
1053 | \r | |
bcecde14 | 1054 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1055 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1056 | for option ROM call.\r |
0a6f4824 LG |
1057 | \r |
1058 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1059 | **/\r |
1060 | EFI_STATUS\r | |
1061 | PxeUndiIsr (\r | |
1062 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1063 | IN OUT PXENV_UNDI_ISR_T *PxeUndiTable\r | |
1064 | )\r | |
1065 | {\r | |
1066 | return MakePxeCall (\r | |
1067 | SimpleNetworkDevice,\r | |
1068 | PxeUndiTable,\r | |
1069 | sizeof (PXENV_UNDI_ISR_T),\r | |
1070 | PXENV_UNDI_ISR\r | |
1071 | );\r | |
1072 | }\r | |
1073 | \r | |
1074 | /**\r | |
0a6f4824 | 1075 | PXE\r |
bcecde14 | 1076 | STOP UNDI\r |
1077 | Op-Code: PXENV_STOP_UNDI (0015h)\r | |
1078 | Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.\r | |
1079 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1080 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1081 | constants.\r | |
1082 | Description: This routine is responsible for unhooking the Int 1Ah service routine.\r | |
1083 | Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid\r | |
1084 | status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from\r | |
1085 | base memory. Also, UNDI must not be removed from base memory if BC is not removed from base\r | |
1086 | memory.\r | |
1087 | Service cannot be used in protected mode.\r | |
1088 | typedef struct {\r | |
1089 | PXENV_STATUS Status;\r | |
1090 | } PXENV_STOP_UNDI_T;\r | |
1091 | Set before calling API service\r | |
1092 | N/A\r | |
1093 | Returned from API service\r | |
0a6f4824 LG |
1094 | Status: See the PXENV_STATUS_xxx constants.\r |
1095 | \r | |
bcecde14 | 1096 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1097 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1098 | for option ROM call.\r |
0a6f4824 LG |
1099 | \r |
1100 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1101 | **/\r |
1102 | EFI_STATUS\r | |
1103 | PxeUndiStop (\r | |
1104 | IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r | |
1105 | IN OUT PXENV_STOP_UNDI_T *PxeUndiTable\r | |
1106 | )\r | |
1107 | {\r | |
1108 | return MakePxeCall (\r | |
1109 | SimpleNetworkDevice,\r | |
1110 | PxeUndiTable,\r | |
1111 | sizeof (PXENV_STOP_UNDI_T),\r | |
1112 | PXENV_STOP_UNDI\r | |
1113 | );\r | |
1114 | }\r | |
1115 | \r | |
1116 | /**\r | |
0a6f4824 | 1117 | PXE\r |
bcecde14 | 1118 | UNDI GET STATE\r |
1119 | Op-Code: PXENV_UNDI_GET_STATE (0015h)\r | |
1120 | Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.\r | |
1121 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1122 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1123 | constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state\r | |
1124 | constants\r | |
1125 | Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call\r | |
1126 | sequences\r | |
1127 | typedef struct {\r | |
1128 | #define PXE_UNDI_GET_STATE_STARTED 1\r | |
1129 | #define PXE_UNDI_GET_STATE_INITIALIZED 2\r | |
1130 | #define PXE_UNDI_GET_STATE_OPENED 3\r | |
1131 | PXENV_STATUS Status;\r | |
1132 | UINT8 UNDIstate;\r | |
1133 | } PXENV_UNDI_GET_STATE_T;\r | |
1134 | Set before calling API service\r | |
1135 | N/A\r | |
1136 | Returned from API service\r | |
1137 | Status: See the PXENV_STATUS_xxx constants.\r | |
1138 | State: See definitions of the state constants.\r | |
1139 | Note. UNDI implementation is responsible for maintaining\r | |
1140 | internal state machine.\r | |
1141 | UNDI ISR\r | |
1142 | Op-Code: PXENV_UNDI_ISR (0014h)\r | |
1143 | Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.\r | |
1144 | Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r | |
1145 | the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r | |
1146 | constants.\r | |
1147 | Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r | |
1148 | the parameter block indicates the operation to be performed for the call. This field is filled with the\r | |
0a6f4824 LG |
1149 | status of that operation on return.\r |
1150 | \r | |
bcecde14 | 1151 | @param SimpleNetworkDevice Device instance\r |
0a6f4824 | 1152 | @param PxeUndiTable Point to structure which hold parameter and return value\r |
bcecde14 | 1153 | for option ROM call.\r |
0a6f4824 LG |
1154 | \r |
1155 | @return Return value of PXE option ROM far call.\r | |
bcecde14 | 1156 | **/\r |