]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/BiosSnp16.h
IntelFrameworkModulePkg Snp16Dxe: Remove redundant functions
[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 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 /**
1024 PXE
1025 UNDI SET STATION ADDRESS
1026 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)
1027 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been
1028 initialized by the caller.
1029 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1030 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1031 constants.
1032 Description: This call sets the MAC address to be the input value and is called before opening the network
1033 adapter. Later, the open call uses this variable as a temporary MAC address to program the
1034 adapter individual address registers.
1035 typedef struct {
1036 PXENV_STATUS Status;
1037 MAC_ADDR StationAddress;
1038 } PXENV_UNDI_SET_STATION_ADDR_T;
1039 Set before calling API service
1040 StationAddress: Temporary MAC address to be used for
1041 transmit and receive.
1042 Returned from API service
1043 Status: See the PXENV_STATUS_xxx constants.
1044
1045 @param SimpleNetworkDevice Device instance
1046 @param PxeUndiTable Point to structure which hold parameter and return value
1047 for option ROM call.
1048
1049 @return Return value of PXE option ROM far call.
1050 **/
1051 EFI_STATUS
1052 PxeUndiSetStationAddr (
1053 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1054 IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable
1055 )
1056 ;
1057
1058
1059 /**
1060 PXE
1061 UNDI GET INFORMATION
1062 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)
1063 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been
1064 initialized by the caller.
1065 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1066 the parameter structure must be set to one of the values represented by the
1067 PXENV_STATUS_xxx constants.
1068 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.
1069 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and
1070 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after
1071 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been
1072 called.
1073 typedef struct {
1074 PXENV_STATUS Status;
1075 UINT16 BaseIo;
1076 UINT16 IntNumber;
1077 UINT16 MaxTranUnit;
1078 UINT16 HwType;
1079 #define ETHER_TYPE 1
1080 #define EXP_ETHER_TYPE 2
1081 #define IEEE_TYPE 6
1082 #define ARCNET_TYPE 7
1083 UINT16 HwAddrLen;
1084 MAC_ADDR CurrentNodeAddress;
1085 MAC_ADDR PermNodeAddress;
1086 SEGSEL ROMAddress;
1087 UINT16 RxBufCt;
1088 UINT16 TxBufCt;
1089 } PXENV_UNDI_GET_INFORMATION_T;
1090 Set before calling API service
1091 N/A
1092 Returned from API service
1093 Status: See the PXENV_STATUS_xxx constants.
1094 BaseIO: Adapter base I/O address.
1095 IntNumber: Adapter IRQ number.
1096 MaxTranUnit: Adapter maximum transmit unit.
1097 HWType: Type of protocol at the hardware level.
1098 HWAddrLen: Length of the hardware address.
1099 CurrentNodeAddress: Current hardware address.
1100 PermNodeAddress: Permanent hardware address.
1101 ROMAddress: Real mode ROM segment address.
1102 RxBufCnt: Receive queue length.
1103 TxBufCnt: Transmit queue length.
1104
1105 @param SimpleNetworkDevice Device instance
1106 @param PxeUndiTable Point to structure which hold parameter and return value
1107 for option ROM call.
1108
1109 @return Return value of PXE option ROM far call.
1110 **/
1111 EFI_STATUS
1112 PxeUndiGetInformation (
1113 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1114 IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable
1115 )
1116 ;
1117
1118 /**
1119 PXE
1120 UNDI GET STATISTICS
1121 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)
1122 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized
1123 by the caller.
1124 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1125 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1126 constants.
1127 Description: This call reads statistical information from the network adapter, and returns.
1128 typedef struct {
1129 PXENV_STATUS Status;
1130 UINT32 XmtGoodFrames;
1131 UINT32 RcvGoodFrames;
1132 UINT32 RcvCRCErrors;
1133 UINT32 RcvResourceErrors;
1134 } PXENV_UNDI_GET_STATISTICS_T;
1135 Set before calling API service
1136 N/A
1137 Returned from API service
1138 Status: See the PXENV_STATUS_xxx constants.
1139 XmtGoodFrames: Number of successful transmissions.
1140 RcvGoodFrames: Number of good frames received.
1141 RcvCRCErrors: Number of frames received with CRC
1142 error.
1143 RcvResourceErrors: Number of frames discarded
1144 because receive queue was full.
1145
1146 @param SimpleNetworkDevice Device instance
1147 @param PxeUndiTable Point to structure which hold parameter and return value
1148 for option ROM call.
1149
1150 @return Return value of PXE option ROM far call.
1151 **/
1152 EFI_STATUS
1153 PxeUndiGetStatistics (
1154 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1155 IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable
1156 )
1157 ;
1158
1159 /**
1160 PXE
1161 UNDI CLEAR STATISTICS
1162 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)
1163 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.
1164 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1165 the parameter structure must be set to one of the values represented by the
1166 PXENV_STATUS_xxx constants.
1167 Description: This call clears the statistical information from the network adapter.
1168 typedef struct {
1169 PXENV_STATUS Status;
1170 } PXENV_UNDI_CLEAR_STATISTICS_T;
1171 Set before calling API service
1172 N/A
1173 Returned from API service
1174 Status: See the PXENV_STATUS_xxx constants.
1175
1176 @param SimpleNetworkDevice Device instance
1177 @param PxeUndiTable Point to structure which hold parameter and return value
1178 for option ROM call.
1179
1180 @return Return value of PXE option ROM far call.
1181 **/
1182 EFI_STATUS
1183 PxeUndiClearStatistics (
1184 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1185 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable
1186 )
1187 ;
1188
1189
1190 /**
1191 PXE
1192 UNDI GET MULTICAST ADDRESS
1193 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)
1194 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized
1195 by the caller.
1196 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1197 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1198 constants.
1199 Description: This call converts the given IP multicast address to a hardware multicast address.
1200 typedef struct {
1201 PXENV_STATUS Status;
1202 IP4 InetAddr;
1203 MAC_ADDR MediaAddr;
1204 } PXENV_UNDI_GET_MCAST_ADDR_T;
1205 Set before calling API service
1206 InetAddr: IP multicast address.
1207 Returned from API service
1208 Status: See the PXENV_STATUS_xxx constants.
1209 MediaAddr: MAC multicast address.
1210
1211 @param SimpleNetworkDevice Device instance
1212 @param PxeUndiTable Point to structure which hold parameter and return value
1213 for option ROM call.
1214
1215 @return Return value of PXE option ROM far call.
1216 **/
1217 EFI_STATUS
1218 PxeUndiGetMcastAddr (
1219 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1220 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable
1221 )
1222 ;
1223
1224 /**
1225 PXE
1226 UNDI GET NIC TYPE
1227 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)
1228 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE_T parameter structure that has been initialized by
1229 the caller.
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 PXENV_STATUS_xxx
1232 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the
1233 NIC information.
1234 Description: This call, if successful, provides the NIC-specific information necessary to identify the network
1235 adapter that is used to boot the system.
1236 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if
1237 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific
1238 information can be obtained from the DHCPDISCOVER packet itself.
1239 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
1240 before the information provided is valid.
1241 typedef {
1242 PXENV_STATUS Status;
1243 UINT8 NicType;
1244 #define PCI_NIC 2
1245 #define PnP_NIC 3
1246 #define CardBus_NIC 4
1247 Union {
1248 Struct {
1249 UINT16 Vendor_ID;
1250 UINT16 Dev_ID;
1251 UINT8 Base_Class;
1252 UINT8 Sub_Class;
1253 UINT8 Prog_Intf;
1254 UINT8 Rev;
1255 UINT16 BusDevFunc;
1256 UINT16 SubVendor_ID;
1257 UINT16 SubDevice_ID;
1258 } pci, cardbus;
1259 struct {
1260 UINT32 EISA_Dev_ID;
1261 UINT8 Base_Class;
1262 UINT8 Sub_Class;
1263 UINT8 Prog_Intf;
1264 UINT16 CardSelNum;
1265 } pnp;
1266 } info;
1267 } PXENV_UNDI_GET_NIC_TYPE_T;
1268 Set before calling API service
1269 N/A
1270 Returned from API service
1271 Status: See the PXENV_STATUS_xxx constants.
1272 NICType: Type of NIC information stored in the parameter
1273 structure.
1274 Info: Information about the fields in this union can be found
1275 in the [PnP] and [PCI] specifications
1276
1277 @param SimpleNetworkDevice Device instance
1278 @param PxeUndiTable Point to structure which hold parameter and return value
1279 for option ROM call.
1280
1281 @return Return value of PXE option ROM far call.
1282 **/
1283 EFI_STATUS
1284 PxeUndiGetNicType (
1285 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1286 IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable
1287 )
1288 ;
1289
1290 /**
1291 PXE
1292 UNDI GET IFACE INFO
1293 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)
1294 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized
1295 by the caller.
1296 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1297 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1298 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the
1299 interface specific information.
1300 Description: This call, if successful, provides the network interface specific information such as the interface
1301 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the
1302 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.
1303 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the
1304 universal driver to translate/convert this information into a format that is required in its specification
1305 or to suit the expectation of the upper level protocol modules.
1306 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
1307 before the information provided is valid.
1308 typedef struct {
1309 PXENV_STATUS Status
1310 UINT8 IfaceType[16];
1311 UINT32 LinkSpeed;
1312 UINT32 ServiceFlags;
1313 UINT32 Reserved[4];
1314 } PXENV_UNDI_GET_NDIS_INFO_T;
1315 Set before calling API service
1316 N/A
1317 Returned from API service
1318 Status: See the PXENV_STATUS_xxx constants.
1319 IfaceType: Name of MAC type in ASCIIZ format. This is
1320 used by the universal NDIS driver to specify its driver type
1321 to the protocol driver.
1322 LinkSpeed: Defined in the NDIS 2.0 specification.
1323 ServiceFlags: Defined in the NDIS 2.0 specification.
1324 Reserved: Must be zero.
1325
1326 @param SimpleNetworkDevice Device instance
1327 @param PxeUndiTable Point to structure which hold parameter and return value
1328 for option ROM call.
1329
1330 @return Return value of PXE option ROM far call.
1331 **/
1332 EFI_STATUS
1333 PxeUndiGetNdisInfo (
1334 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1335 IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable
1336 )
1337 ;
1338
1339 /**
1340 PXE
1341 UNDI ISR
1342 Op-Code: PXENV_UNDI_ISR (0014h)
1343 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.
1344 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1345 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1346 constants.
1347 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1348 the parameter block indicates the operation to be performed for the call. This field is filled with the
1349 status of that operation on return.
1350 Note: Interrupt Service Routine Operation:
1351 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the
1352 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR
1353 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing
1354 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).
1355 When the Network Interface HW generates an interrupt the protocol driver interrupt service
1356 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then
1357 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for
1358 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface
1359 level and read any status values required to further process the interrupt. UNDI must return as
1360 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or
1361 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the
1362 interrupt was generated by this particular Network Interface or not.
1363 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was
1364 not generated by our NIC, and interrupt processing is complete.
1365 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start
1366 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is
1367 now complete.
1368 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to
1369 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and
1370 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the
1371 first buffer pointer of that frame in the parameter block.
1372 The protocol driver calls UNDI repeatedly with the FuncFlag equal to
1373 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received
1374 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l
1375 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous
1376 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter
1377 block. Otherwise it must return the first buffer in the next frame.
1378 If there is no received frame pending to be processed, UNDI processes the transmit completes and
1379 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the
1380 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.
1381 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the
1382 strategy routine when the UNDI re-enables interrupts.
1383
1384 @param SimpleNetworkDevice Device instance
1385 @param PxeUndiTable Point to structure which hold parameter and return value
1386 for option ROM call.
1387
1388 @return Return value of PXE option ROM far call.
1389 **/
1390 EFI_STATUS
1391 PxeUndiIsr (
1392 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1393 IN OUT PXENV_UNDI_ISR_T *PxeUndiTable
1394 )
1395 ;
1396
1397 /**
1398 PXE
1399 STOP UNDI
1400 Op-Code: PXENV_STOP_UNDI (0015h)
1401 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.
1402 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1403 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1404 constants.
1405 Description: This routine is responsible for unhooking the Int 1Ah service routine.
1406 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid
1407 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from
1408 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base
1409 memory.
1410 Service cannot be used in protected mode.
1411 typedef struct {
1412 PXENV_STATUS Status;
1413 } PXENV_STOP_UNDI_T;
1414 Set before calling API service
1415 N/A
1416 Returned from API service
1417 Status: See the PXENV_STATUS_xxx constants.
1418
1419 @param SimpleNetworkDevice Device instance
1420 @param PxeUndiTable Point to structure which hold parameter and return value
1421 for option ROM call.
1422
1423 @return Return value of PXE option ROM far call.
1424 **/
1425 EFI_STATUS
1426 PxeUndiStop (
1427 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1428 IN OUT PXENV_STOP_UNDI_T *PxeUndiTable
1429 )
1430 ;
1431
1432
1433 /**
1434 Effect the Far Call into the PXE Layer
1435
1436 Note: When using a 32-bit stack segment do not push 32-bit words onto the stack. The PXE API
1437 services will not work, unless there are three 16-bit parameters pushed onto the stack.
1438 push DS ;Far pointer to parameter structure
1439 push offset pxe_data_call_struct ;is pushed onto stack.
1440 push Index ;UINT16 is pushed onto stack.
1441 call dword ptr (s_PXE ptr es:[di]).EntryPointSP
1442 add sp, 6 ;Caller cleans up stack.
1443
1444 @param SimpleNetworkDevice Device instance for simple network
1445 @param Table Point to parameter/retun value table for legacy far call
1446 @param TableSize The size of parameter/return value table
1447 @param CallIndex The index of legacy call.
1448
1449 @return EFI_STATUS
1450 **/
1451 EFI_STATUS
1452 MakePxeCall (
1453 EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,
1454 IN OUT VOID *Table,
1455 IN UINTN TableSize,
1456 IN UINT16 CallIndex
1457 )
1458 ;
1459
1460 /**
1461 Allocate buffer below 1M for real mode.
1462
1463 @param NumPages The number pages want to be allocated.
1464 @param Buffer On return, allocated buffer.
1465
1466 @return Status of allocating pages.
1467 **/
1468 EFI_STATUS
1469 BiosSnp16AllocatePagesBelowOneMb (
1470 UINTN NumPages,
1471 VOID **Buffer
1472 )
1473 ;
1474
1475 #endif