]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.h
IntelFrameworkModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / Snp16Dxe / BiosSnp16.h
1 /** @file
2
3 Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _BIOS_SNP_16_H_
10 #define _BIOS_SNP_16_H_
11
12 #include <Uefi.h>
13
14 #include <Protocol/LegacyBios.h>
15 #include <Protocol/SimpleNetwork.h>
16 #include <Protocol/PciIo.h>
17 #include <Protocol/NetworkInterfaceIdentifier.h>
18 #include <Protocol/DevicePath.h>
19
20 #include <Library/UefiDriverEntryPoint.h>
21 #include <Library/DebugLib.h>
22 #include <Library/BaseMemoryLib.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/UefiLib.h>
25 #include <Library/BaseLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Library/MemoryAllocationLib.h>
28
29 #include <Guid/EventGroup.h>
30
31 #include <IndustryStandard/Pci.h>
32
33 #include "Pxe.h"
34
35 //
36 // BIOS Simple Network Protocol Device Structure
37 //
38 #define EFI_SIMPLE_NETWORK_DEV_SIGNATURE SIGNATURE_32 ('s', 'n', '1', '6')
39
40 #define INIT_PXE_STATUS 0xabcd
41
42 #define EFI_SIMPLE_NETWORK_MAX_TX_FIFO_SIZE 64
43
44 typedef struct {
45 UINT32 First;
46 UINT32 Last;
47 VOID * Data[EFI_SIMPLE_NETWORK_MAX_TX_FIFO_SIZE];
48 } EFI_SIMPLE_NETWORK_DEV_FIFO;
49
50 typedef struct {
51 UINTN Signature;
52 EFI_HANDLE Handle;
53 EFI_SIMPLE_NETWORK_PROTOCOL SimpleNetwork;
54 EFI_SIMPLE_NETWORK_MODE SimpleNetworkMode;
55 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL Nii;
56 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
57 EFI_PCI_IO_PROTOCOL *PciIo;
58 EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
59
60 //
61 // Local Data for Simple Network Protocol interface goes here
62 //
63 BOOLEAN UndiLoaded;
64 EFI_EVENT EfiBootEvent;
65 EFI_EVENT LegacyBootEvent;
66 UINT16 PxeEntrySegment;
67 UINT16 PxeEntryOffset;
68 EFI_SIMPLE_NETWORK_DEV_FIFO TxBufferFifo;
69 EFI_DEVICE_PATH_PROTOCOL *BaseDevicePath;
70 PXE_T *Pxe; ///< Pointer to !PXE structure
71 PXENV_UNDI_GET_INFORMATION_T GetInformation; ///< Data from GET INFORMATION
72 PXENV_UNDI_GET_NIC_TYPE_T GetNicType; ///< Data from GET NIC TYPE
73 PXENV_UNDI_GET_NDIS_INFO_T GetNdisInfo; ///< Data from GET NDIS INFO
74 BOOLEAN IsrValid; ///< TRUE if Isr contains valid data
75 PXENV_UNDI_ISR_T Isr; ///< Data from ISR
76 PXENV_UNDI_TBD_T *Xmit; //
77 VOID *TxRealModeMediaHeader; ///< < 1 MB Size = 0x100
78 VOID *TxRealModeDataBuffer; ///< < 1 MB Size = GetInformation.MaxTranUnit
79 VOID *TxDestAddr; ///< < 1 MB Size = 16
80 UINT8 InterruptStatus; ///< returned/cleared by GetStatus, set in ISR
81 UINTN UndiLoaderTablePages;
82 UINTN DestinationDataSegmentPages;
83 UINTN DestinationStackSegmentPages;
84 UINTN DestinationCodeSegmentPages;
85 VOID *UndiLoaderTable;
86 VOID *DestinationDataSegment;
87 VOID *DestinationStackSegment;
88 VOID *DestinationCodeSegment;
89 } EFI_SIMPLE_NETWORK_DEV;
90
91 #define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) \
92 CR (a, \
93 EFI_SIMPLE_NETWORK_DEV, \
94 SimpleNetwork, \
95 EFI_SIMPLE_NETWORK_DEV_SIGNATURE \
96 )
97
98 //
99 // Global Variables
100 //
101 extern EFI_DRIVER_BINDING_PROTOCOL gBiosSnp16DriverBinding;
102 extern EFI_COMPONENT_NAME_PROTOCOL gBiosSnp16ComponentName;
103 extern EFI_COMPONENT_NAME2_PROTOCOL gBiosSnp16ComponentName2;
104
105
106 //
107 // Driver Binding Protocol functions
108 //
109 /**
110 Tests to see if this driver supports a given controller.
111
112 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
113 @param Controller The handle of the controller to test.
114 @param RemainingDevicePath A pointer to the remaining portion of a device path.
115
116 @retval EFI_SUCCESS The driver supports given controller.
117 @retval EFI_UNSUPPORT The driver doesn't support given controller.
118 @retval Other Other errors prevent driver finishing to test
119 if the driver supports given controller.
120 **/
121 EFI_STATUS
122 EFIAPI
123 BiosSnp16DriverBindingSupported (
124 IN EFI_DRIVER_BINDING_PROTOCOL *This,
125 IN EFI_HANDLE Controller,
126 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
127 )
128 ;
129
130 /**
131 Starts the Snp device controller
132
133 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
134 @param Controller The handle of the controller to test.
135 @param RemainingDevicePath A pointer to the remaining portion of a device path.
136
137 @retval EFI_SUCCESS - The device was started.
138 @retval EFI_DEVICE_ERROR - The device could not be started due to a device error.
139 @retval EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
140 **/
141 EFI_STATUS
142 EFIAPI
143 BiosSnp16DriverBindingStart (
144 IN EFI_DRIVER_BINDING_PROTOCOL *This,
145 IN EFI_HANDLE Controller,
146 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
147 )
148 ;
149
150 /**
151 Stops the device by given device controller.
152
153 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
154 @param Controller The handle of the controller to test.
155 @param NumberOfChildren The number of child device handles in ChildHandleBuffer.
156 @param ChildHandleBuffer An array of child handles to be freed. May be NULL if
157 NumberOfChildren is 0.
158
159 @retval EFI_SUCCESS - The device was stopped.
160 @retval EFI_DEVICE_ERROR - The device could not be stopped due to a device error.
161 **/
162 EFI_STATUS
163 EFIAPI
164 BiosSnp16DriverBindingStop (
165 IN EFI_DRIVER_BINDING_PROTOCOL *This,
166 IN EFI_HANDLE Controller,
167 IN UINTN NumberOfChildren,
168 IN EFI_HANDLE *ChildHandleBuffer
169 )
170 ;
171
172 //
173 // Simple Network Protocol functions
174 //
175 /**
176 Call 16 bit UNDI ROM to start the network interface
177
178 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
179
180 @retval EFI_DEVICE_ERROR Network interface has not be initialized.
181 @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.
182 @retval EFI_SUCESS Success operation.
183 **/
184 EFI_STATUS
185 EFIAPI
186 Undi16SimpleNetworkStart (
187 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
188 )
189 ;
190
191 /**
192 Call 16 bit UNDI ROM to stop the network interface
193
194 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
195
196 @retval EFI_DEVICE_ERROR Network interface has not be initialized.
197 @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.
198 @retval EFI_SUCESS Success operation.
199 **/
200 EFI_STATUS
201 EFIAPI
202 Undi16SimpleNetworkStop (
203 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
204 )
205 ;
206
207 /**
208 Initialize network interface
209
210 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
211 @param ExtraRxBufferSize The size of extra request receive buffer.
212 @param ExtraTxBufferSize The size of extra request transmit buffer.
213
214 @retval EFI_DEVICE_ERROR Fail to execute 16 bit ROM call.
215 @retval EFI_SUCESS Success operation.
216 **/
217 EFI_STATUS
218 EFIAPI
219 Undi16SimpleNetworkInitialize (
220 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
221 IN UINTN ExtraRxBufferSize OPTIONAL,
222 IN UINTN ExtraTxBufferSize OPTIONAL
223 )
224 ;
225
226 /**
227 Reset network interface.
228
229 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
230 @param ExtendedVerification Need extended verfication.
231
232 @retval EFI_INVALID_PARAMETER Invalid This parameter.
233 @retval EFI_DEVICE_ERROR Network device has not been initialized.
234 @retval EFI_NOT_STARTED Network device has been stopped.
235 @retval EFI_DEVICE_ERROR Invalid status for network device
236 @retval EFI_SUCCESS Success operation.
237 **/
238 EFI_STATUS
239 EFIAPI
240 Undi16SimpleNetworkReset (
241 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
242 IN BOOLEAN ExtendedVerification
243 )
244 ;
245
246 /**
247 Shutdown network interface.
248
249 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
250
251 @retval EFI_INVALID_PARAMETER Invalid This parameter.
252 @retval EFI_DEVICE_ERROR Network device has not been initialized.
253 @retval EFI_NOT_STARTED Network device has been stopped.
254 @retval EFI_DEVICE_ERROR Invalid status for network device
255 @retval EFI_SUCCESS Success operation.
256 **/
257 EFI_STATUS
258 EFIAPI
259 Undi16SimpleNetworkShutdown (
260 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
261 )
262 ;
263
264 /**
265 Reset network interface.
266
267 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
268 @param Enable Enable mask value
269 @param Disable Disable mask value
270 @param ResetMCastFilter Whether reset multi cast filter or not
271 @param MCastFilterCnt Count of mutli cast filter for different MAC address
272 @param MCastFilter Buffer for mustli cast filter for different MAC address.
273
274 @retval EFI_INVALID_PARAMETER Invalid This parameter.
275 @retval EFI_DEVICE_ERROR Network device has not been initialized.
276 @retval EFI_NOT_STARTED Network device has been stopped.
277 @retval EFI_DEVICE_ERROR Invalid status for network device
278 @retval EFI_SUCCESS Success operation.
279 **/
280 EFI_STATUS
281 EFIAPI
282 Undi16SimpleNetworkReceiveFilters (
283 IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
284 IN UINT32 Enable,
285 IN UINT32 Disable,
286 IN BOOLEAN ResetMCastFilter,
287 IN UINTN MCastFilterCnt OPTIONAL,
288 IN EFI_MAC_ADDRESS * MCastFilter OPTIONAL
289 )
290 ;
291
292 /**
293 Set new MAC address.
294
295 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
296 @param Reset Whether reset station MAC address to permanent address
297 @param New A pointer to New address
298
299 @retval EFI_INVALID_PARAMETER Invalid This parameter.
300 @retval EFI_DEVICE_ERROR Network device has not been initialized.
301 @retval EFI_NOT_STARTED Network device has been stopped.
302 @retval EFI_DEVICE_ERROR Invalid status for network device
303 @retval EFI_SUCCESS Success operation.
304 **/
305 EFI_STATUS
306 EFIAPI
307 Undi16SimpleNetworkStationAddress (
308 IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
309 IN BOOLEAN Reset,
310 IN EFI_MAC_ADDRESS * New OPTIONAL
311 )
312 ;
313
314 /**
315 Collect statistics.
316
317 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
318 @param Reset Whether cleanup old statistics data.
319 @param StatisticsSize The buffer of statistics table.
320 @param StatisticsTable A pointer to statistics buffer.
321
322 @retval EFI_INVALID_PARAMETER Invalid This parameter.
323 @retval EFI_DEVICE_ERROR Network device has not been initialized.
324 @retval EFI_NOT_STARTED Network device has been stopped.
325 @retval EFI_DEVICE_ERROR Invalid status for network device
326 @retval EFI_SUCCESS Success operation.
327 **/
328 EFI_STATUS
329 EFIAPI
330 Undi16SimpleNetworkStatistics (
331 IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
332 IN BOOLEAN Reset,
333 IN OUT UINTN *StatisticsSize OPTIONAL,
334 OUT EFI_NETWORK_STATISTICS * StatisticsTable OPTIONAL
335 )
336 ;
337
338 /**
339 Translate IP address to MAC address.
340
341 @param This A pointer to EFI_SIMPLE_NETWORK_PROTOCOL structure.
342 @param IPv6 IPv6 or IPv4
343 @param IP A pointer to given Ip address.
344 @param MAC On return, translated MAC address.
345
346 @retval EFI_INVALID_PARAMETER Invalid This parameter.
347 @retval EFI_INVALID_PARAMETER Invalid IP address.
348 @retval EFI_INVALID_PARAMETER Invalid return buffer for holding MAC address.
349 @retval EFI_UNSUPPORTED Do not support IPv6
350 @retval EFI_DEVICE_ERROR Network device has not been initialized.
351 @retval EFI_NOT_STARTED Network device has been stopped.
352 @retval EFI_DEVICE_ERROR Invalid status for network device
353 @retval EFI_SUCCESS Success operation.
354 **/
355 EFI_STATUS
356 EFIAPI
357 Undi16SimpleNetworkMCastIpToMac (
358 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
359 IN BOOLEAN IPv6,
360 IN EFI_IP_ADDRESS *IP,
361 OUT EFI_MAC_ADDRESS *MAC
362 )
363 ;
364
365 /**
366 Performs read and write operations on the NVRAM device attached to a
367 network interface.
368
369 @param This The protocol instance pointer.
370 @param ReadWrite TRUE for read operations, FALSE for write operations.
371 @param Offset Byte offset in the NVRAM device at which to start the read or
372 write operation. This must be a multiple of NvRamAccessSize and
373 less than NvRamSize.
374 @param BufferSize The number of bytes to read or write from the NVRAM device.
375 This must also be a multiple of NvramAccessSize.
376 @param Buffer A pointer to the data buffer.
377
378 @retval EFI_SUCCESS The NVRAM access was performed.
379 @retval EFI_NOT_STARTED The network interface has not been started.
380 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
381 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
382 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
383
384 **/
385 EFI_STATUS
386 EFIAPI
387 Undi16SimpleNetworkNvData (
388 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
389 IN BOOLEAN Write,
390 IN UINTN Offset,
391 IN UINTN BufferSize,
392 IN OUT VOID *Buffer
393 )
394 ;
395
396 /**
397 Reads the current interrupt status and recycled transmit buffer status from
398 a network interface.
399
400 @param This The protocol instance pointer.
401 @param InterruptStatus A pointer to the bit mask of the currently active interrupts
402 If this is NULL, the interrupt status will not be read from
403 the device. If this is not NULL, the interrupt status will
404 be read from the device. When the interrupt status is read,
405 it will also be cleared. Clearing the transmit interrupt
406 does not empty the recycled transmit buffer array.
407 @param TxBuf Recycled transmit buffer address. The network interface will
408 not transmit if its internal recycled transmit buffer array
409 is full. Reading the transmit buffer does not clear the
410 transmit interrupt. If this is NULL, then the transmit buffer
411 status will not be read. If there are no transmit buffers to
412 recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
413
414 @retval EFI_SUCCESS The status of the network interface was retrieved.
415 @retval EFI_NOT_STARTED The network interface has not been started.
416 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
417 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
418 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
419
420 **/
421 EFI_STATUS
422 EFIAPI
423 Undi16SimpleNetworkGetStatus (
424 IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
425 OUT UINT32 *InterruptStatus OPTIONAL,
426 OUT VOID **TxBuf OPTIONAL
427 )
428 ;
429
430 /**
431 Places a packet in the transmit queue of a network interface.
432
433 @param This The protocol instance pointer.
434 @param HeaderSize The size, in bytes, of the media header to be filled in by
435 the Transmit() function. If HeaderSize is non-zero, then it
436 must be equal to This->Mode->MediaHeaderSize and the DestAddr
437 and Protocol parameters must not be NULL.
438 @param BufferSize The size, in bytes, of the entire packet (media header and
439 data) to be transmitted through the network interface.
440 @param Buffer A pointer to the packet (media header followed by data) to be
441 transmitted. This parameter cannot be NULL. If HeaderSize is zero,
442 then the media header in Buffer must already be filled in by the
443 caller. If HeaderSize is non-zero, then the media header will be
444 filled in by the Transmit() function.
445 @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
446 is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
447 This->Mode->CurrentAddress is used for the source HW MAC address.
448 @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this
449 parameter is ignored.
450 @param Protocol The type of header to build. If HeaderSize is zero, then this
451 parameter is ignored. See RFC 1700, section "Ether Types", for
452 examples.
453
454 @retval EFI_SUCCESS The packet was placed on the transmit queue.
455 @retval EFI_NOT_STARTED The network interface has not been started.
456 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
457 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
458 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
459 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
460 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
461
462 **/
463 EFI_STATUS
464 EFIAPI
465 Undi16SimpleNetworkTransmit (
466 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
467 IN UINTN HeaderSize,
468 IN UINTN BufferSize,
469 IN VOID *Buffer,
470 IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
471 IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
472 IN UINT16 *Protocol OPTIONAL
473 )
474 ;
475
476 /**
477 Receives a packet from a network interface.
478
479 @param This The protocol instance pointer.
480 @param HeaderSize The size, in bytes, of the media header received on the network
481 interface. If this parameter is NULL, then the media header size
482 will not be returned.
483 @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in
484 bytes, of the packet that was received on the network interface.
485 @param Buffer A pointer to the data buffer to receive both the media header and
486 the data.
487 @param SrcAddr The source HW MAC address. If this parameter is NULL, the
488 HW MAC source address will not be extracted from the media
489 header.
490 @param DestAddr The destination HW MAC address. If this parameter is NULL,
491 the HW MAC destination address will not be extracted from the
492 media header.
493 @param Protocol The media header type. If this parameter is NULL, then the
494 protocol will not be extracted from the media header. See
495 RFC 1700 section "Ether Types" for examples.
496
497 @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
498 been updated to the number of bytes received.
499 @retval EFI_NOT_STARTED The network interface has not been started.
500 @retval EFI_NOT_READY The network interface is too busy to accept this transmit
501 request.
502 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
503 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
504 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
505 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
506
507 **/
508 EFI_STATUS
509 EFIAPI
510 Undi16SimpleNetworkReceive (
511 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
512 OUT UINTN *HeaderSize OPTIONAL,
513 IN OUT UINTN *BufferSize,
514 OUT VOID *Buffer,
515 OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
516 OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
517 OUT UINT16 *Protocol OPTIONAL
518 )
519 ;
520
521 /**
522 wait for a packet to be received.
523
524 @param Event Event used with WaitForEvent() to wait for a packet to be received.
525 @param Context Event Context
526
527 **/
528 VOID
529 EFIAPI
530 Undi16SimpleNetworkWaitForPacket (
531 IN EFI_EVENT Event,
532 IN VOID *Context
533 )
534 ;
535
536 /**
537 Check whether packet is ready for receive.
538
539 @param This The protocol instance pointer.
540
541 @retval EFI_SUCCESS Receive data is ready.
542 @retval EFI_NOT_STARTED The network interface has not been started.
543 @retval EFI_NOT_READY The network interface is too busy to accept this transmit
544 request.
545 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
546 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
547 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
548 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
549 **/
550 EFI_STATUS
551 Undi16SimpleNetworkCheckForPacket (
552 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
553 )
554 ;
555
556 /**
557 Cache Interrupt verctor address converted from IVT number.
558
559 @param VectorNumber IVT number
560
561 @retval EFI_SUCCESS Success to operation.
562 **/
563 EFI_STATUS
564 CacheVectorAddress (
565 UINT8 VectorNumber
566 )
567 ;
568
569 /**
570 Get interrupt vector address according to IVT number.
571
572 @param VectorNumber Given IVT number
573
574 @return cached interrupt vector address.
575 **/
576 EFI_STATUS
577 RestoreCachedVectorAddress (
578 UINT8 VectorNumber
579 )
580 ;
581
582 /**
583 If available, launch the BaseCode from a NIC option ROM.
584 This should install the !PXE and PXENV+ structures in memory for
585 subsequent use.
586
587
588 @param SimpleNetworkDevice Simple network device instance
589 @param RomAddress The ROM base address for NIC rom.
590
591 @retval EFI_NOT_FOUND The check sum does not match
592 @retval EFI_NOT_FOUND Rom ID offset is wrong
593 @retval EFI_NOT_FOUND No Rom ID structure is found
594 **/
595 EFI_STATUS
596 LaunchBaseCode (
597 EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
598 UINTN RomAddress
599 )
600 ;
601
602 /**
603 PXE
604 START UNDI
605 Op-Code: PXENV_START_UNDI (0000h)
606 Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.
607 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
608 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
609 constants.
610 Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is
611 responsible for saving the information it needs to communicate with the hardware.
612 This service is also responsible for hooking the Int 1Ah service routine
613 Note: This API service must be called only once during UNDI Option ROM boot.
614 The UNDI driver is responsible for saving this information and using it every time
615 PXENV_UNDI_STARTUP is called.
616 Service cannot be used in protected mode.
617 typedef struct {
618 PXENV_STATUS Status;
619 UINT16 AX;
620 UINT16 BX;
621 UINT16 DX;
622 UINT16 DI;
623 UINT16 ES;
624 } PXENV_START_UNDI_T;
625 Set before calling API service
626 AX, BX, DX, DI, ES: BIOS initialization parameter registers. These
627 fields should contain the same information passed to the option ROM
628 initialization routine by the Host System BIOS. Information about the
629 contents of these registers can be found in the [PnP], [PCI] and
630 [BBS] specifications.
631 Returned from API service
632 Status: See the PXENV_STATUS_xxx constants.
633
634 @param SimpleNetworkDevice Device instance
635 @param PxeUndiTable Point to structure which hold parameter and return value
636 for option ROM call.
637
638 @return Return value of PXE option ROM far call.
639 **/
640 EFI_STATUS
641 PxeStartUndi (
642 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
643 IN OUT PXENV_START_UNDI_T *PxeUndiTable
644 )
645 ;
646
647 /**
648 PXE
649 UNDI STARTUP
650 Op-Code: PXENV_UNDI_STARTUP (0001h)
651 Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the
652 caller.
653 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
654 the parameter structure must be set to one of the values represented by the
655 PXENV_STATUS_xxx constants.
656 Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper
657 operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used
658 to complete this initialization. The rest of the UNDI APIs will not be available until this call has
659 been completed.
660 Note: PXENV_UNDI_STARTUP must not be called again without first calling
661 PXENV_UNDI_SHUTDOWN.
662 PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for
663 chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and
664 PXENV_STOP_UNDI API calls.
665 This service cannot be used in protected mode.
666 typedef struct
667 {
668 PXENV_STATUS Status;
669 } PXENV_UNDI_STARTUP_T;
670 Set before calling API service
671 N/A
672 Returned from API service
673 Status: See the PXENV_STATUS_xxx constants.
674
675 @param SimpleNetworkDevice Device instance
676 @param PxeUndiTable Point to structure which hold parameter and return value
677 for option ROM call.
678
679 @return Return value of PXE option ROM far call.
680 **/
681 EFI_STATUS
682 PxeUndiStartup (
683 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
684 IN OUT PXENV_UNDI_STARTUP_T *PxeUndiTable
685 )
686 ;
687
688 /**
689 PXE
690 UNDI CLEANUP
691 Op-Code: PXENV_UNDI_CLEANUP (0002h)
692 Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.
693 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field
694 in the parameter structure must be set to one of the values represented by the
695 PXENV_STATUS_xxx constants.
696 Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be
697 made just before unloading the Universal NIC Driver. The rest of the API will not be available
698 after this call executes.
699 This service cannot be used in protected mode.
700 typedef struct {
701 PXENX_STATUS Status;
702 } PXENV_UNDI_CLEANUP_T;
703 Set before calling API service
704 N/A
705 Returned from API service
706 Status: See the PXENV_STATUS_xxx constants.
707
708 @param SimpleNetworkDevice Device instance
709 @param PxeUndiTable Point to structure which hold parameter and return value
710 for option ROM call.
711
712 @return Return value of PXE option ROM far call.
713 **/
714 EFI_STATUS
715 PxeUndiCleanup (
716 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
717 IN OUT PXENV_UNDI_CLEANUP_T *PxeUndiTable
718 )
719 ;
720
721 /**
722 PXE
723 UNDI INITIALIZE
724 Op-Code: PXENV_UNDI_INITIALIZE (0003h)
725 Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the
726 caller.
727 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
728 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
729 constants.
730 Description: This call resets the adapter and programs it with default parameters. The default parameters used
731 are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the
732 receive and transmit units of the network adapter to readily receive or transmit packets. The
733 application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.
734 This call must be made by an application to establish an interface to the network adapter driver.
735 Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for
736 the Protocol field in the parameter structure.
737 typedef struct {
738 PXENV_STATUS Status;
739 ADDR32 ProtocolIni;
740 UINT8 reserved[8];
741 } PXENV_UNDI_INITIALIZE_T;
742 Set before calling API service
743 ProtocolIni: Physical address of a memory copy of the driver
744 module from the protocol.ini file obtained from the protocol manager
745 driver (refer to the NDIS 2.0 specification). This parameter is
746 supported for the universal NDIS driver to pass the information
747 contained in the protocol.ini file to the NIC driver for any specific
748 configuration of the NIC. (Note that the module identification in the
749 protocol.ini file was done by NDIS.) This value can be NULL for any
750 other application interfacing to the universal NIC driver
751 Returned from API service
752 Status: See the PXENV_STATUS_xxx constants.
753
754 @param SimpleNetworkDevice Device instance.
755 @param PxeUndiTable Point to structure which hold parameter and return value
756 for option ROM call.
757
758 @return Return value of PXE option ROM far call.
759 **/
760 EFI_STATUS
761 PxeUndiInitialize (
762 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
763 IN OUT PXENV_UNDI_INITIALIZE_T *PxeUndiTable
764 )
765 ;
766
767 /**
768 Wrapper routine for reset adapter.
769
770 PXE
771 UNDI RESET ADAPTER
772 Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)
773 Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized
774 by the caller.
775 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
776 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
777 constants.
778 Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to
779 Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the
780 network. This routine cannot be used to replace Initialize or Shutdown calls.
781 typedef struct {
782 PXENV_STATUS Status;
783 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
784 } PXENV_UNDI_RESET_T;
785
786 #define MAXNUM_MCADDR 8
787
788 typedef struct {
789 UINT16 MCastAddrCount;
790 MAC_ADDR McastAddr[MAXNUM_MCADDR];
791 } PXENV_UNDI_MCAST_ADDRESS_t;
792
793 Set before calling API service
794 R_Mcast_Buf: This is a structure of MCastAddrCount and
795 McastAddr.
796 MCastAddrCount: Number of multicast MAC addresses in the
797 buffer.
798 McastAddr: List of up to MAXNUM_MCADDR multicast MAC
799 addresses.
800 Returned from API service
801 Status: See the PXENV_STATUS_xxx constants.
802
803 @param SimpleNetworkDevice Device instance.
804 @param PxeUndiTable Point to structure which hold parameter and return value
805 for option ROM call.
806 @param RxFilter Filter setting mask value for PXE recive .
807
808 @return Return value of PXE option ROM far call.
809 **/
810 EFI_STATUS
811 PxeUndiResetNic (
812 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
813 IN OUT PXENV_UNDI_RESET_T *PxeUndiTable,
814 IN UINT16 RxFilter
815 )
816 ;
817
818 /**
819 PXE
820 UNDI SHUTDOWN
821 Op-Code: PXENV_UNDI_SHUTDOWN (0005h)
822 Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.
823 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
824 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
825 constants.
826 Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.
827 Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the
828 Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.
829 typedef struct
830 {
831 PXENV_STATUS Status;
832 } PXENV_UNDI_SHUTDOWN_T;
833 Set before calling API service
834 N/A
835 Returned from API service
836 Status: See the PXENV_STATUS_xxx constants.
837
838 @param SimpleNetworkDevice Device instance
839 @param PxeUndiTable Point to structure which hold parameter and return value
840 for option ROM call.
841
842 @return Return value of PXE option ROM far call.
843 **/
844 EFI_STATUS
845 PxeUndiShutdown (
846 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
847 IN OUT PXENV_UNDI_SHUTDOWN_T *PxeUndiTable
848 )
849 ;
850
851 /**
852 PXE
853 UNDI OPEN
854 Op-Code: PXENV_UNDI_OPEN (0006h)
855 Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.
856 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
857 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
858 constants.
859 Description: This call activates the adapter network connection and sets the adapter ready to accept packets
860 for transmit and receive.
861 typedef struct {
862 PXENV_STATUS Status;
863 UINT16 OpenFlag;
864 UINT16 PktFilter;
865 #define FLTR_DIRECTED 0x0001
866 #define FLTR_BRDCST 0x0002
867 #define FLTR_PRMSCS 0x0004
868 #define FLTR_SRC_RTG 0x0008
869 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
870 } PXENV_UNDI_OPEN_T;
871 Set before calling API service
872 OpenFlag: This is an adapter specific input parameter. This is
873 supported for the universal NDIS 2.0 driver to pass in the open flags
874 provided by the protocol driver. (See the NDIS 2.0 specification.)
875 This can be zero.
876 PktFilter: Filter for receiving packets. This can be one, or more, of
877 the FLTR_xxx constants. Multiple values are arithmetically or-ed
878 together.
879 directed packets are packets that may come to your MAC address
880 or the multicast MAC address.
881 R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).
882 Returned from API service
883 Status: See the PXENV_STATUS_xxx constants.
884
885 @param SimpleNetworkDevice Device instance
886 @param PxeUndiTable Point to structure which hold parameter and return value
887 for option ROM call.
888
889 @return Return value of PXE option ROM far call.
890 **/
891 EFI_STATUS
892 PxeUndiOpen (
893 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
894 IN OUT PXENV_UNDI_OPEN_T *PxeUndiTable
895 )
896 ;
897
898 /**
899 PXE
900 UNDI CLOSE
901 Op-Code: PXENV_UNDI_CLOSE (0007h)
902 Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.
903 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
904 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
905 constants.
906 Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or
907 received until the network adapter is open again.
908 typedef struct {
909 PXENV_STATUS Status;
910 } PXENV_UNDI_CLOSE_T;
911 Set before calling API service
912 N/A
913 Returned from API service
914 Status: See the PXENV_STATUS_xxx constants.
915
916 @param SimpleNetworkDevice Device instance
917 @param PxeUndiTable Point to structure which hold parameter and return value
918 for option ROM call.
919
920 @return Return value of PXE option ROM far call.
921 **/
922 EFI_STATUS
923 PxeUndiClose (
924 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
925 IN OUT PXENV_UNDI_CLOSE_T *PxeUndiTable
926 )
927 ;
928
929 /**
930 PXE
931 UNDI TRANSMIT PACKET
932 Op-Code: PXENV_UNDI_TRANSMIT (0008h)
933 Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that
934 has been initialized by the caller.
935 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.
936 The status code must be set to one of the values represented by the
937 PXENV_STATUS_xxx constants.
938 Description: This call transmits a buffer to the network. The media header
939 for the packet can be filled by the calling protocol, but it might not be.
940 The network adapter driver will fill it if required by the values in the
941 parameter block. The packet is buffered for transmission provided there is
942 an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no
943 buffer is available the function returns PXENV_EXIT_FAILURE with a status
944 code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is
945 implementation-dependent. An interrupt is generated on completion of the
946 transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is
947 permitted in the context of a transmit complete interrupt.
948
949 typedef struct {
950 PXENV_STATUS Status;
951 UINT8 Protocol;
952 #define P_UNKNOWN 0
953 #define P_IP 1
954 #define P_ARP 2
955 #define P_RARP 3
956 UINT8 XmitFlag;
957 #define XMT_DESTADDR 0x0000
958 #define XMT_BROADCAST 0x0001
959 SEGOFF16 DestAddr;
960 SEGOFF16 TBD;
961 UINT32 Reserved[2];
962 } t_PXENV_UNDI_TRANSMIT;
963
964 #define MAX_DATA_BLKS 8
965
966 typedef struct {
967 UINT16 ImmedLength;
968 SEGOFF16 Xmit;
969 UINT16 DataBlkCount;
970 struct DataBlk {
971 UINT8 TDPtrType;
972 UINT8 TDRsvdByte;
973 UINT16 TDDataLen;
974 SEGOFF16 TDDataPtr;
975 } DataBlock[MAX_DATA_BLKS];
976 } PXENV_UNDI_TBD_T
977
978 Set before calling API service
979 Protocol: This is the protocol of the upper layer that is calling UNDI
980 TRANSMIT call. If the upper layer has filled the media header, this
981 field must be P_UNKNOWN.
982 XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a
983 pointer to the destination media address in the field DestAddr. If
984 XMT_BROADCAST, the NIC driver fills the broadcast address for the
985 destination.
986 TBD: Segment:Offset address of the transmit buffer descriptor.
987 ImmedLength: Length of the immediate transmit buffer: Xmit.
988 Xmit: Segment:Offset of the immediate transmit buffer.
989 DataBlkCount: Number of blocks in this transmit buffer.
990 TDPtrType:
991 0 => 32-bit physical address in TDDataPtr (not supported in this
992 version of PXE)
993 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit
994 protected mode pointer
995 TDRsvdByte: Reserved must be zero.
996 TDDatalen: Data block length in bytes.
997 TDDataPtr: Segment:Offset of the transmit block.
998 DataBlock: Array of transmit data blocks.
999 Returned from API service
1000 Status: See the PXENV_STATUS_xxx constants
1001
1002 @param SimpleNetworkDevice Device instance
1003 @param PxeUndiTable Point to structure which hold parameter and return value
1004 for option ROM call.
1005
1006 @return Return value of PXE option ROM far call.
1007 **/
1008 EFI_STATUS
1009 PxeUndiTransmit (
1010 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1011 IN OUT PXENV_UNDI_TRANSMIT_T *PxeUndiTable
1012 )
1013 ;
1014
1015
1016 /**
1017 PXE
1018 UNDI SET STATION ADDRESS
1019 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)
1020 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been
1021 initialized by the caller.
1022 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1023 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1024 constants.
1025 Description: This call sets the MAC address to be the input value and is called before opening the network
1026 adapter. Later, the open call uses this variable as a temporary MAC address to program the
1027 adapter individual address registers.
1028 typedef struct {
1029 PXENV_STATUS Status;
1030 MAC_ADDR StationAddress;
1031 } PXENV_UNDI_SET_STATION_ADDR_T;
1032 Set before calling API service
1033 StationAddress: Temporary MAC address to be used for
1034 transmit and receive.
1035 Returned from API service
1036 Status: See the PXENV_STATUS_xxx constants.
1037
1038 @param SimpleNetworkDevice Device instance
1039 @param PxeUndiTable Point to structure which hold parameter and return value
1040 for option ROM call.
1041
1042 @return Return value of PXE option ROM far call.
1043 **/
1044 EFI_STATUS
1045 PxeUndiSetStationAddr (
1046 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1047 IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable
1048 )
1049 ;
1050
1051
1052 /**
1053 PXE
1054 UNDI GET INFORMATION
1055 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)
1056 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been
1057 initialized by the caller.
1058 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1059 the parameter structure must be set to one of the values represented by the
1060 PXENV_STATUS_xxx constants.
1061 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.
1062 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and
1063 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after
1064 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been
1065 called.
1066 typedef struct {
1067 PXENV_STATUS Status;
1068 UINT16 BaseIo;
1069 UINT16 IntNumber;
1070 UINT16 MaxTranUnit;
1071 UINT16 HwType;
1072 #define ETHER_TYPE 1
1073 #define EXP_ETHER_TYPE 2
1074 #define IEEE_TYPE 6
1075 #define ARCNET_TYPE 7
1076 UINT16 HwAddrLen;
1077 MAC_ADDR CurrentNodeAddress;
1078 MAC_ADDR PermNodeAddress;
1079 SEGSEL ROMAddress;
1080 UINT16 RxBufCt;
1081 UINT16 TxBufCt;
1082 } PXENV_UNDI_GET_INFORMATION_T;
1083 Set before calling API service
1084 N/A
1085 Returned from API service
1086 Status: See the PXENV_STATUS_xxx constants.
1087 BaseIO: Adapter base I/O address.
1088 IntNumber: Adapter IRQ number.
1089 MaxTranUnit: Adapter maximum transmit unit.
1090 HWType: Type of protocol at the hardware level.
1091 HWAddrLen: Length of the hardware address.
1092 CurrentNodeAddress: Current hardware address.
1093 PermNodeAddress: Permanent hardware address.
1094 ROMAddress: Real mode ROM segment address.
1095 RxBufCnt: Receive queue length.
1096 TxBufCnt: Transmit queue length.
1097
1098 @param SimpleNetworkDevice Device instance
1099 @param PxeUndiTable Point to structure which hold parameter and return value
1100 for option ROM call.
1101
1102 @return Return value of PXE option ROM far call.
1103 **/
1104 EFI_STATUS
1105 PxeUndiGetInformation (
1106 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1107 IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable
1108 )
1109 ;
1110
1111 /**
1112 PXE
1113 UNDI GET STATISTICS
1114 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)
1115 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized
1116 by the caller.
1117 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1118 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1119 constants.
1120 Description: This call reads statistical information from the network adapter, and returns.
1121 typedef struct {
1122 PXENV_STATUS Status;
1123 UINT32 XmtGoodFrames;
1124 UINT32 RcvGoodFrames;
1125 UINT32 RcvCRCErrors;
1126 UINT32 RcvResourceErrors;
1127 } PXENV_UNDI_GET_STATISTICS_T;
1128 Set before calling API service
1129 N/A
1130 Returned from API service
1131 Status: See the PXENV_STATUS_xxx constants.
1132 XmtGoodFrames: Number of successful transmissions.
1133 RcvGoodFrames: Number of good frames received.
1134 RcvCRCErrors: Number of frames received with CRC
1135 error.
1136 RcvResourceErrors: Number of frames discarded
1137 because receive queue was full.
1138
1139 @param SimpleNetworkDevice Device instance
1140 @param PxeUndiTable Point to structure which hold parameter and return value
1141 for option ROM call.
1142
1143 @return Return value of PXE option ROM far call.
1144 **/
1145 EFI_STATUS
1146 PxeUndiGetStatistics (
1147 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1148 IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable
1149 )
1150 ;
1151
1152 /**
1153 PXE
1154 UNDI CLEAR STATISTICS
1155 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)
1156 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.
1157 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1158 the parameter structure must be set to one of the values represented by the
1159 PXENV_STATUS_xxx constants.
1160 Description: This call clears the statistical information from the network adapter.
1161 typedef struct {
1162 PXENV_STATUS Status;
1163 } PXENV_UNDI_CLEAR_STATISTICS_T;
1164 Set before calling API service
1165 N/A
1166 Returned from API service
1167 Status: See the PXENV_STATUS_xxx constants.
1168
1169 @param SimpleNetworkDevice Device instance
1170 @param PxeUndiTable Point to structure which hold parameter and return value
1171 for option ROM call.
1172
1173 @return Return value of PXE option ROM far call.
1174 **/
1175 EFI_STATUS
1176 PxeUndiClearStatistics (
1177 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1178 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable
1179 )
1180 ;
1181
1182
1183 /**
1184 PXE
1185 UNDI GET MULTICAST ADDRESS
1186 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)
1187 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized
1188 by the caller.
1189 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1190 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1191 constants.
1192 Description: This call converts the given IP multicast address to a hardware multicast address.
1193 typedef struct {
1194 PXENV_STATUS Status;
1195 IP4 InetAddr;
1196 MAC_ADDR MediaAddr;
1197 } PXENV_UNDI_GET_MCAST_ADDR_T;
1198 Set before calling API service
1199 InetAddr: IP multicast address.
1200 Returned from API service
1201 Status: See the PXENV_STATUS_xxx constants.
1202 MediaAddr: MAC multicast address.
1203
1204 @param SimpleNetworkDevice Device instance
1205 @param PxeUndiTable Point to structure which hold parameter and return value
1206 for option ROM call.
1207
1208 @return Return value of PXE option ROM far call.
1209 **/
1210 EFI_STATUS
1211 PxeUndiGetMcastAddr (
1212 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1213 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable
1214 )
1215 ;
1216
1217 /**
1218 PXE
1219 UNDI GET NIC TYPE
1220 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)
1221 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE_T parameter structure that has been initialized by
1222 the caller.
1223 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1224 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1225 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the
1226 NIC information.
1227 Description: This call, if successful, provides the NIC-specific information necessary to identify the network
1228 adapter that is used to boot the system.
1229 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if
1230 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific
1231 information can be obtained from the DHCPDISCOVER packet itself.
1232 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
1233 before the information provided is valid.
1234 typedef {
1235 PXENV_STATUS Status;
1236 UINT8 NicType;
1237 #define PCI_NIC 2
1238 #define PnP_NIC 3
1239 #define CardBus_NIC 4
1240 Union {
1241 Struct {
1242 UINT16 Vendor_ID;
1243 UINT16 Dev_ID;
1244 UINT8 Base_Class;
1245 UINT8 Sub_Class;
1246 UINT8 Prog_Intf;
1247 UINT8 Rev;
1248 UINT16 BusDevFunc;
1249 UINT16 SubVendor_ID;
1250 UINT16 SubDevice_ID;
1251 } pci, cardbus;
1252 struct {
1253 UINT32 EISA_Dev_ID;
1254 UINT8 Base_Class;
1255 UINT8 Sub_Class;
1256 UINT8 Prog_Intf;
1257 UINT16 CardSelNum;
1258 } pnp;
1259 } info;
1260 } PXENV_UNDI_GET_NIC_TYPE_T;
1261 Set before calling API service
1262 N/A
1263 Returned from API service
1264 Status: See the PXENV_STATUS_xxx constants.
1265 NICType: Type of NIC information stored in the parameter
1266 structure.
1267 Info: Information about the fields in this union can be found
1268 in the [PnP] and [PCI] specifications
1269
1270 @param SimpleNetworkDevice Device instance
1271 @param PxeUndiTable Point to structure which hold parameter and return value
1272 for option ROM call.
1273
1274 @return Return value of PXE option ROM far call.
1275 **/
1276 EFI_STATUS
1277 PxeUndiGetNicType (
1278 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1279 IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable
1280 )
1281 ;
1282
1283 /**
1284 PXE
1285 UNDI GET IFACE INFO
1286 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)
1287 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized
1288 by the caller.
1289 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1290 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1291 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the
1292 interface specific information.
1293 Description: This call, if successful, provides the network interface specific information such as the interface
1294 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the
1295 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.
1296 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the
1297 universal driver to translate/convert this information into a format that is required in its specification
1298 or to suit the expectation of the upper level protocol modules.
1299 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
1300 before the information provided is valid.
1301 typedef struct {
1302 PXENV_STATUS Status
1303 UINT8 IfaceType[16];
1304 UINT32 LinkSpeed;
1305 UINT32 ServiceFlags;
1306 UINT32 Reserved[4];
1307 } PXENV_UNDI_GET_NDIS_INFO_T;
1308 Set before calling API service
1309 N/A
1310 Returned from API service
1311 Status: See the PXENV_STATUS_xxx constants.
1312 IfaceType: Name of MAC type in ASCIIZ format. This is
1313 used by the universal NDIS driver to specify its driver type
1314 to the protocol driver.
1315 LinkSpeed: Defined in the NDIS 2.0 specification.
1316 ServiceFlags: Defined in the NDIS 2.0 specification.
1317 Reserved: Must be zero.
1318
1319 @param SimpleNetworkDevice Device instance
1320 @param PxeUndiTable Point to structure which hold parameter and return value
1321 for option ROM call.
1322
1323 @return Return value of PXE option ROM far call.
1324 **/
1325 EFI_STATUS
1326 PxeUndiGetNdisInfo (
1327 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1328 IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable
1329 )
1330 ;
1331
1332 /**
1333 PXE
1334 UNDI ISR
1335 Op-Code: PXENV_UNDI_ISR (0014h)
1336 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.
1337 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1338 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1339 constants.
1340 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1341 the parameter block indicates the operation to be performed for the call. This field is filled with the
1342 status of that operation on return.
1343 Note: Interrupt Service Routine Operation:
1344 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the
1345 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR
1346 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing
1347 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).
1348 When the Network Interface HW generates an interrupt the protocol driver interrupt service
1349 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then
1350 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for
1351 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface
1352 level and read any status values required to further process the interrupt. UNDI must return as
1353 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or
1354 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the
1355 interrupt was generated by this particular Network Interface or not.
1356 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was
1357 not generated by our NIC, and interrupt processing is complete.
1358 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start
1359 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is
1360 now complete.
1361 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to
1362 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and
1363 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the
1364 first buffer pointer of that frame in the parameter block.
1365 The protocol driver calls UNDI repeatedly with the FuncFlag equal to
1366 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received
1367 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l
1368 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous
1369 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter
1370 block. Otherwise it must return the first buffer in the next frame.
1371 If there is no received frame pending to be processed, UNDI processes the transmit completes and
1372 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the
1373 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.
1374 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the
1375 strategy routine when the UNDI re-enables interrupts.
1376
1377 @param SimpleNetworkDevice Device instance
1378 @param PxeUndiTable Point to structure which hold parameter and return value
1379 for option ROM call.
1380
1381 @return Return value of PXE option ROM far call.
1382 **/
1383 EFI_STATUS
1384 PxeUndiIsr (
1385 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1386 IN OUT PXENV_UNDI_ISR_T *PxeUndiTable
1387 )
1388 ;
1389
1390 /**
1391 PXE
1392 STOP UNDI
1393 Op-Code: PXENV_STOP_UNDI (0015h)
1394 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.
1395 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1396 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1397 constants.
1398 Description: This routine is responsible for unhooking the Int 1Ah service routine.
1399 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid
1400 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from
1401 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base
1402 memory.
1403 Service cannot be used in protected mode.
1404 typedef struct {
1405 PXENV_STATUS Status;
1406 } PXENV_STOP_UNDI_T;
1407 Set before calling API service
1408 N/A
1409 Returned from API service
1410 Status: See the PXENV_STATUS_xxx constants.
1411
1412 @param SimpleNetworkDevice Device instance
1413 @param PxeUndiTable Point to structure which hold parameter and return value
1414 for option ROM call.
1415
1416 @return Return value of PXE option ROM far call.
1417 **/
1418 EFI_STATUS
1419 PxeUndiStop (
1420 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1421 IN OUT PXENV_STOP_UNDI_T *PxeUndiTable
1422 )
1423 ;
1424
1425
1426 /**
1427 Effect the Far Call into the PXE Layer
1428
1429 Note: When using a 32-bit stack segment do not push 32-bit words onto the stack. The PXE API
1430 services will not work, unless there are three 16-bit parameters pushed onto the stack.
1431 push DS ;Far pointer to parameter structure
1432 push offset pxe_data_call_struct ;is pushed onto stack.
1433 push Index ;UINT16 is pushed onto stack.
1434 call dword ptr (s_PXE ptr es:[di]).EntryPointSP
1435 add sp, 6 ;Caller cleans up stack.
1436
1437 @param SimpleNetworkDevice Device instance for simple network
1438 @param Table Point to parameter/retun value table for legacy far call
1439 @param TableSize The size of parameter/return value table
1440 @param CallIndex The index of legacy call.
1441
1442 @return EFI_STATUS
1443 **/
1444 EFI_STATUS
1445 MakePxeCall (
1446 EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1447 IN OUT VOID *Table,
1448 IN UINTN TableSize,
1449 IN UINT16 CallIndex
1450 )
1451 ;
1452
1453 /**
1454 Allocate buffer below 1M for real mode.
1455
1456 @param NumPages The number pages want to be allocated.
1457 @param Buffer On return, allocated buffer.
1458
1459 @return Status of allocating pages.
1460 **/
1461 EFI_STATUS
1462 BiosSnp16AllocatePagesBelowOneMb (
1463 UINTN NumPages,
1464 VOID **Buffer
1465 )
1466 ;
1467
1468 #endif