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