]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/Network/SnpDxe/Snp.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / Snp.h
... / ...
CommitLineData
1/** @file\r
2 Declaration of strctures and functions for SnpDxe driver.\r
3\r
4Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials are licensed\r
6and made available under the terms and conditions of the BSD License which\r
7accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14#ifndef _SNP_H_\r
15#define _SNP_H_\r
16\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Protocol/SimpleNetwork.h>\r
21#include <Protocol/PciIo.h>\r
22#include <Protocol/NetworkInterfaceIdentifier.h>\r
23#include <Protocol/DevicePath.h>\r
24\r
25#include <Guid/EventGroup.h>\r
26\r
27#include <Library/DebugLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/BaseLib.h>\r
32#include <Library/UefiLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34\r
35#include <IndustryStandard/Pci.h>\r
36\r
37#define FOUR_GIGABYTES (UINT64) 0x100000000ULL\r
38\r
39\r
40#define SNP_DRIVER_SIGNATURE SIGNATURE_32 ('s', 'n', 'd', 's')\r
41#define MAX_MAP_LENGTH 100\r
42\r
43#define PCI_BAR_IO_MASK 0x00000003\r
44#define PCI_BAR_IO_MODE 0x00000001\r
45\r
46#define PCI_BAR_MEM_MASK 0x0000000F\r
47#define PCI_BAR_MEM_MODE 0x00000000\r
48#define PCI_BAR_MEM_64BIT 0x00000004\r
49\r
50typedef\r
51EFI_STATUS\r
52(*ISSUE_UNDI32_COMMAND) (\r
53 UINT64 Cdb\r
54 );\r
55\r
56typedef struct {\r
57 UINT32 Signature;\r
58 EFI_LOCK Lock;\r
59\r
60 EFI_SIMPLE_NETWORK_PROTOCOL Snp;\r
61 EFI_SIMPLE_NETWORK_MODE Mode;\r
62\r
63 EFI_HANDLE DeviceHandle;\r
64 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
65\r
66 //\r
67 // Local instance data needed by SNP driver\r
68 //\r
69 // Pointer to S/W UNDI API entry point\r
70 // This will be NULL for H/W UNDI\r
71 //\r
72 ISSUE_UNDI32_COMMAND IssueUndi32Command;\r
73\r
74 BOOLEAN IsSwUndi;\r
75\r
76 //\r
77 // undi interface number, if one undi manages more nics\r
78 //\r
79 PXE_IFNUM IfNum;\r
80\r
81 //\r
82 // Allocated tx/rx buffer that was passed to UNDI Initialize.\r
83 //\r
84 UINT32 TxRxBufferSize;\r
85 VOID *TxRxBuffer;\r
86 //\r
87 // mappable buffers for receive and fill header for undi3.0\r
88 // these will be used if the user buffers are above 4GB limit (instead of\r
89 // mapping the user buffers)\r
90 //\r
91 UINT8 *ReceiveBufffer;\r
92 VOID *ReceiveBufferUnmap;\r
93 UINT8 *FillHeaderBuffer;\r
94 VOID *FillHeaderBufferUnmap;\r
95\r
96 EFI_PCI_IO_PROTOCOL *PciIo;\r
97 UINT8 IoBarIndex;\r
98 UINT8 MemoryBarIndex;\r
99\r
100 //\r
101 // Buffers for command descriptor block, command parameter block\r
102 // and data block.\r
103 //\r
104 PXE_CDB Cdb;\r
105 VOID *Cpb;\r
106 VOID *CpbUnmap;\r
107 VOID *Db;\r
108\r
109 //\r
110 // UNDI structure, we need to remember the init info for a long time!\r
111 //\r
112 PXE_DB_GET_INIT_INFO InitInfo;\r
113\r
114 VOID *SnpDriverUnmap;\r
115 //\r
116 // when ever we map an address, we must remember it's address and the un-map\r
117 // cookie so that we can unmap later\r
118 //\r
119 struct MAP_LIST {\r
120 EFI_PHYSICAL_ADDRESS VirtualAddress;\r
121 VOID *MapCookie;\r
122 } MapList[MAX_MAP_LENGTH];\r
123\r
124 EFI_EVENT ExitBootServicesEvent;\r
125\r
126 //\r
127 // Whether UNDI support reporting media status from GET_STATUS command,\r
128 // i.e. PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED\r
129 //\r
130 BOOLEAN MediaStatusSupported;\r
131} SNP_DRIVER;\r
132\r
133#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)\r
134\r
135//\r
136// Global Variables\r
137//\r
138extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;\r
139extern EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2;\r
140\r
141//\r
142// Virtual to physical mapping for all UNDI 3.0s.\r
143//\r
144typedef struct _V2P V2P;\r
145\r
146struct _V2P {\r
147 V2P *Next;\r
148 VOID *VirtualAddress;\r
149 UINTN BufferSize;\r
150 EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
151 VOID *Unmap;\r
152};\r
153\r
154/**\r
155 This routine maps the given CPU address to a Device address. It creates a\r
156 an entry in the map list with the virtual and physical addresses and the\r
157 un map cookie.\r
158\r
159 @param V2p pointer to return a map list node pointer.\r
160 @param Type the direction in which the data flows from the given\r
161 virtual address device->cpu or cpu->device or both\r
162 ways.\r
163 @param VirtualAddress virtual address (or CPU address) to be mapped.\r
164 @param BufferSize size of the buffer to be mapped.\r
165\r
166 @retval EFI_SUCEESS routine has completed the mapping.\r
167 @retval other error as indicated.\r
168\r
169**/\r
170EFI_STATUS\r
171AddV2p (\r
172 V2P **V2p,\r
173 EFI_PCI_IO_PROTOCOL_OPERATION Type,\r
174 VOID *VirtualAddress,\r
175 UINTN BufferSize\r
176 );\r
177\r
178/**\r
179 This routine searches the linked list of mapped address nodes (for undi3.0\r
180 interface) to find the node that corresponds to the given virtual address and\r
181 returns a pointer to that node.\r
182\r
183 @param V2p pointer to return a map list node pointer.\r
184 @param VirtualAddress virtual address (or CPU address) to be searched in\r
185 the map list\r
186\r
187 @retval EFI_SUCEESS if a match found!\r
188 @retval Other match not found\r
189\r
190**/\r
191EFI_STATUS\r
192FindV2p (\r
193 V2P **V2p,\r
194 VOID *VirtualAddress\r
195 );\r
196\r
197/**\r
198 this routine calls undi to start the interface and changes the snp state.\r
199\r
200 @param Snp pointer to snp driver structure\r
201\r
202 @retval EFI_DEVICE_ERROR UNDI could not be started\r
203 @retval EFI_SUCCESS UNDI is started successfully\r
204\r
205**/\r
206EFI_STATUS\r
207PxeStart (\r
208 IN SNP_DRIVER *Snp\r
209 );\r
210\r
211/**\r
212 this routine calls undi to stop the interface and changes the snp state.\r
213\r
214 @param Snp pointer to snp driver structure\r
215\r
216 @retval EFI_INVALID_PARAMETER invalid parameter\r
217 @retval EFI_NOT_STARTED SNP is not started\r
218 @retval EFI_DEVICE_ERROR SNP is not initialized\r
219 @retval EFI_UNSUPPORTED operation unsupported\r
220\r
221**/\r
222EFI_STATUS\r
223PxeStop (\r
224 SNP_DRIVER *Snp\r
225 );\r
226\r
227/**\r
228 this routine calls undi to initialize the interface.\r
229\r
230 @param Snp pointer to snp driver structure\r
231 @param CableDetectFlag Do/don't detect the cable (depending on what undi supports)\r
232\r
233 @retval EFI_SUCCESS UNDI is initialized successfully\r
234 @retval EFI_DEVICE_ERROR UNDI could not be initialized\r
235 @retval Other other errors\r
236\r
237**/\r
238EFI_STATUS\r
239PxeInit (\r
240 SNP_DRIVER *Snp,\r
241 UINT16 CableDetectFlag\r
242 );\r
243\r
244/**\r
245 this routine calls undi to shut down the interface.\r
246\r
247 @param Snp pointer to snp driver structure\r
248\r
249 @retval EFI_SUCCESS UNDI is shut down successfully\r
250 @retval EFI_DEVICE_ERROR UNDI could not be shut down\r
251\r
252**/\r
253EFI_STATUS\r
254PxeShutdown (\r
255 IN SNP_DRIVER *Snp\r
256 );\r
257\r
258/**\r
259 this routine calls undi to read the MAC address of the NIC and updates the\r
260 mode structure with the address.\r
261\r
262 @param Snp pointer to snp driver structure.\r
263\r
264 @retval EFI_SUCCESS the MAC address of the NIC is read successfully.\r
265 @retval EFI_DEVICE_ERROR failed to read the MAC address of the NIC.\r
266\r
267**/\r
268EFI_STATUS\r
269PxeGetStnAddr (\r
270 SNP_DRIVER *Snp\r
271 );\r
272\r
273/**\r
274 This routine unmaps the given virtual address and frees the memory allocated\r
275 for the map list node corresponding to that address.\r
276\r
277 @param VirtualAddress virtual address (or CPU address) to be unmapped\r
278\r
279 @retval EFI_SUCEESS if successfully unmapped\r
280 @retval Other as indicated by the error\r
281\r
282**/\r
283EFI_STATUS\r
284DelV2p (\r
285 VOID *VirtualAddress\r
286 );\r
287\r
288/**\r
289 This is a callback routine supplied to UNDI at undi_start time.\r
290 UNDI call this routine when it wants to have exclusive access to a critical\r
291 section of the code/data.\r
292\r
293 @param Enable non-zero indicates acquire\r
294 zero indicates release\r
295\r
296**/\r
297VOID\r
298SnpUndi32CallbackBlock30 (\r
299 IN UINT32 Enable\r
300 );\r
301\r
302/**\r
303 This is a callback routine supplied to UNDI at undi_start time.\r
304 UNDI call this routine with the number of micro seconds when it wants to\r
305 pause.\r
306\r
307 @param MicroSeconds number of micro seconds to pause, ususlly multiple of 10.\r
308\r
309**/\r
310VOID\r
311SnpUndi32CallbackDelay30 (\r
312 IN UINT64 MicroSeconds\r
313 );\r
314\r
315/**\r
316 This is a callback routine supplied to UNDI at undi_start time.\r
317 This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
318 because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
319 io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
320 start of the device's io/mem addresses. Since SNP cannot retrive the context\r
321 of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
322 that NIC and uses one global IO functions structure, this does not work.\r
323 This however works fine for EFI1.0 Undis because they use absolute addresses\r
324 for io/mem access.\r
325\r
326 @param ReadOrWrite indicates read or write, IO or Memory\r
327 @param NumBytes number of bytes to read or write\r
328 @param Address IO or memory address to read from or write to\r
329 @param BufferAddr memory location to read into or that contains the bytes to\r
330 write\r
331\r
332**/\r
333VOID\r
334SnpUndi32CallbackMemio30 (\r
335 IN UINT8 ReadOrWrite,\r
336 IN UINT8 NumBytes,\r
337 IN UINT64 Address,\r
338 IN OUT UINT64 BufferAddr\r
339 );\r
340\r
341/**\r
342 This is a callback routine supplied to UNDI at undi_start time.\r
343 UNDI call this routine with a virtual or CPU address that SNP provided to\r
344 convert it to a physical or device address. Since EFI uses the identical\r
345 mapping, this routine returns the physical address same as the virtual address\r
346 for most of the addresses. an address above 4GB cannot generally be used as a\r
347 device address, it needs to be mapped to a lower physical address. This\r
348 routine does not call the map routine itself, but it assumes that the mapping\r
349 was done at the time of providing the address to UNDI. This routine just\r
350 looks up the address in a map table (which is the v2p structure chain).\r
351\r
352 @param CpuAddr virtual address of a buffer.\r
353 @param DeviceAddrPtr pointer to the physical address.\r
354 The DeviceAddrPtr will contain 0 in case of any error.\r
355\r
356**/\r
357VOID\r
358SnpUndi32CallbackV2p30 (\r
359 IN UINT64 CpuAddr,\r
360 IN OUT UINT64 DeviceAddrPtr\r
361 );\r
362\r
363/**\r
364 This is a callback routine supplied to UNDI3.1 at undi_start time.\r
365 UNDI call this routine when it wants to have exclusive access to a critical\r
366 section of the code/data.\r
367 New callbacks for 3.1:\r
368 there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
369 the MemMap call to map the required address by itself!\r
370\r
371 @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to\r
372 store Undi interface context (Undi does not read or write\r
373 this variable)\r
374 @param Enable non-zero indicates acquire\r
375 zero indicates release\r
376**/\r
377VOID\r
378SnpUndi32CallbackBlock (\r
379 IN UINT64 UniqueId,\r
380 IN UINT32 Enable\r
381 );\r
382\r
383/**\r
384 This is a callback routine supplied to UNDI at undi_start time.\r
385 UNDI call this routine with the number of micro seconds when it wants to\r
386 pause.\r
387\r
388 @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to\r
389 store Undi interface context (Undi does not read or write\r
390 this variable)\r
391 @param MicroSeconds number of micro seconds to pause, ususlly multiple of 10.\r
392**/\r
393VOID\r
394SnpUndi32CallbackDelay (\r
395 IN UINT64 UniqueId,\r
396 IN UINT64 MicroSeconds\r
397 );\r
398\r
399/**\r
400 This is a callback routine supplied to UNDI at undi_start time.\r
401 This is the IO routine for UNDI3.1 to start CPB.\r
402\r
403 @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this\r
404 to store Undi interface context (Undi does not read or\r
405 write this variable)\r
406 @param ReadOrWrite indicates read or write, IO or Memory.\r
407 @param NumBytes number of bytes to read or write.\r
408 @param MemOrPortAddr IO or memory address to read from or write to.\r
409 @param BufferPtr memory location to read into or that contains the bytes\r
410 to write.\r
411**/\r
412VOID\r
413SnpUndi32CallbackMemio (\r
414 IN UINT64 UniqueId,\r
415 IN UINT8 ReadOrWrite,\r
416 IN UINT8 NumBytes,\r
417 IN UINT64 MemOrPortAddr,\r
418 IN OUT UINT64 BufferPtr\r
419 );\r
420\r
421/**\r
422 This is a callback routine supplied to UNDI at undi_start time.\r
423 UNDI call this routine when it has to map a CPU address to a device\r
424 address.\r
425\r
426 @param UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
427 Undi interface context (Undi does not read or write this variable)\r
428 @param CpuAddr - Virtual address to be mapped!\r
429 @param NumBytes - size of memory to be mapped\r
430 @param Direction - direction of data flow for this memory's usage:\r
431 cpu->device, device->cpu or both ways\r
432 @param DeviceAddrPtr - pointer to return the mapped device address\r
433\r
434**/\r
435VOID\r
436SnpUndi32CallbackMap (\r
437 IN UINT64 UniqueId,\r
438 IN UINT64 CpuAddr,\r
439 IN UINT32 NumBytes,\r
440 IN UINT32 Direction,\r
441 IN OUT UINT64 DeviceAddrPtr\r
442 );\r
443\r
444/**\r
445 This is a callback routine supplied to UNDI at undi_start time.\r
446 UNDI call this routine when it wants to unmap an address that was previously\r
447 mapped using map callback.\r
448\r
449 @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to store.\r
450 Undi interface context (Undi does not read or write this variable)\r
451 @param CpuAddr Virtual address that was mapped!\r
452 @param NumBytes size of memory mapped\r
453 @param Direction direction of data flow for this memory's usage:\r
454 cpu->device, device->cpu or both ways\r
455 @param DeviceAddr the mapped device address\r
456\r
457**/\r
458VOID\r
459SnpUndi32CallbackUnmap (\r
460 IN UINT64 UniqueId,\r
461 IN UINT64 CpuAddr,\r
462 IN UINT32 NumBytes,\r
463 IN UINT32 Direction,\r
464 IN UINT64 DeviceAddr\r
465 );\r
466\r
467/**\r
468 This is a callback routine supplied to UNDI at undi_start time.\r
469 UNDI call this routine when it wants synchronize the virtual buffer contents\r
470 with the mapped buffer contents. The virtual and mapped buffers need not\r
471 correspond to the same physical memory (especially if the virtual address is\r
472 > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
473 need to synchronize their contents whenever it writes to/reads from the buffer\r
474 using either the cpu address or the device address.\r
475\r
476 EFI does not provide a sync call, since virt=physical, we sould just do\r
477 the synchronization ourself here!\r
478\r
479 @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to store\r
480 Undi interface context (Undi does not read or write this variable)\r
481 @param CpuAddr Virtual address that was mapped!\r
482 @param NumBytes size of memory mapped.\r
483 @param Direction direction of data flow for this memory's usage:\r
484 cpu->device, device->cpu or both ways.\r
485 @param DeviceAddr the mapped device address.\r
486\r
487**/\r
488VOID\r
489SnpUndi32CallbackSync (\r
490 IN UINT64 UniqueId,\r
491 IN UINT64 CpuAddr,\r
492 IN UINT32 NumBytes,\r
493 IN UINT32 Direction,\r
494 IN UINT64 DeviceAddr\r
495 );\r
496\r
497/**\r
498 Changes the state of a network interface from "stopped" to "started".\r
499\r
500 This function starts a network interface. If the network interface successfully\r
501 starts, then EFI_SUCCESS will be returned.\r
502\r
503 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
504\r
505 @retval EFI_SUCCESS The network interface was started.\r
506 @retval EFI_ALREADY_STARTED The network interface is already in the started state.\r
507 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
508 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
509 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
510 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
511\r
512**/\r
513EFI_STATUS\r
514EFIAPI\r
515SnpUndi32Start (\r
516 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
517 );\r
518\r
519/**\r
520 Changes the state of a network interface from "started" to "stopped".\r
521\r
522 This function stops a network interface. This call is only valid if the network\r
523 interface is in the started state. If the network interface was successfully\r
524 stopped, then EFI_SUCCESS will be returned.\r
525\r
526 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
527\r
528\r
529 @retval EFI_SUCCESS The network interface was stopped.\r
530 @retval EFI_NOT_STARTED The network interface has not been started.\r
531 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
532 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
533 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
534 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
535\r
536**/\r
537EFI_STATUS\r
538EFIAPI\r
539SnpUndi32Stop (\r
540 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
541 );\r
542\r
543/**\r
544 Resets a network adapter and allocates the transmit and receive buffers\r
545 required by the network interface; optionally, also requests allocation of\r
546 additional transmit and receive buffers.\r
547\r
548 This function allocates the transmit and receive buffers required by the network\r
549 interface. If this allocation fails, then EFI_OUT_OF_RESOURCES is returned.\r
550 If the allocation succeeds and the network interface is successfully initialized,\r
551 then EFI_SUCCESS will be returned.\r
552\r
553 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
554\r
555 @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space\r
556 that the driver should allocate for the network interface.\r
557 Some network interfaces will not be able to use the\r
558 extra buffer, and the caller will not know if it is\r
559 actually being used.\r
560 @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space\r
561 that the driver should allocate for the network interface.\r
562 Some network interfaces will not be able to use the\r
563 extra buffer, and the caller will not know if it is\r
564 actually being used.\r
565\r
566 @retval EFI_SUCCESS The network interface was initialized.\r
567 @retval EFI_NOT_STARTED The network interface has not been started.\r
568 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and\r
569 receive buffers.\r
570 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
571 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
572 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
573 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.\r
574\r
575**/\r
576EFI_STATUS\r
577EFIAPI\r
578SnpUndi32Initialize (\r
579 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
580 IN UINTN ExtraRxBufferSize OPTIONAL,\r
581 IN UINTN ExtraTxBufferSize OPTIONAL\r
582 );\r
583\r
584/**\r
585 Resets a network adapter and reinitializes it with the parameters that were\r
586 provided in the previous call to Initialize().\r
587\r
588 This function resets a network adapter and reinitializes it with the parameters\r
589 that were provided in the previous call to Initialize(). The transmit and\r
590 receive queues are emptied and all pending interrupts are cleared.\r
591 Receive filters, the station address, the statistics, and the multicast-IP-to-HW\r
592 MAC addresses are not reset by this call. If the network interface was\r
593 successfully reset, then EFI_SUCCESS will be returned. If the driver has not\r
594 been initialized, EFI_DEVICE_ERROR will be returned.\r
595\r
596 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
597 @param ExtendedVerification Indicates that the driver may perform a more\r
598 exhaustive verification operation of the device\r
599 during reset.\r
600\r
601 @retval EFI_SUCCESS The network interface was reset.\r
602 @retval EFI_NOT_STARTED The network interface has not been started.\r
603 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
604 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
605 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
606\r
607**/\r
608EFI_STATUS\r
609EFIAPI\r
610SnpUndi32Reset (\r
611 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
612 IN BOOLEAN ExtendedVerification\r
613 );\r
614\r
615/**\r
616 Resets a network adapter and leaves it in a state that is safe for another\r
617 driver to initialize.\r
618\r
619 This function releases the memory buffers assigned in the Initialize() call.\r
620 Pending transmits and receives are lost, and interrupts are cleared and disabled.\r
621 After this call, only the Initialize() and Stop() calls may be used. If the\r
622 network interface was successfully shutdown, then EFI_SUCCESS will be returned.\r
623 If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
624\r
625 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
626\r
627 @retval EFI_SUCCESS The network interface was shutdown.\r
628 @retval EFI_NOT_STARTED The network interface has not been started.\r
629 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
630 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
631 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
632\r
633**/\r
634EFI_STATUS\r
635EFIAPI\r
636SnpUndi32Shutdown (\r
637 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
638 );\r
639\r
640/**\r
641 Manages the multicast receive filters of a network interface.\r
642\r
643 This function is used enable and disable the hardware and software receive\r
644 filters for the underlying network device.\r
645 The receive filter change is broken down into three steps:\r
646 * The filter mask bits that are set (ON) in the Enable parameter are added to\r
647 the current receive filter settings.\r
648 * The filter mask bits that are set (ON) in the Disable parameter are subtracted\r
649 from the updated receive filter settings.\r
650 * If the resulting receive filter setting is not supported by the hardware a\r
651 more liberal setting is selected.\r
652 If the same bits are set in the Enable and Disable parameters, then the bits\r
653 in the Disable parameter takes precedence.\r
654 If the ResetMCastFilter parameter is TRUE, then the multicast address list\r
655 filter is disabled (irregardless of what other multicast bits are set in the\r
656 Enable and Disable parameters). The SNP->Mode->MCastFilterCount field is set\r
657 to zero. The Snp->Mode->MCastFilter contents are undefined.\r
658 After enabling or disabling receive filter settings, software should verify\r
659 the new settings by checking the Snp->Mode->ReceiveFilterSettings,\r
660 Snp->Mode->MCastFilterCount and Snp->Mode->MCastFilter fields.\r
661 Note: Some network drivers and/or devices will automatically promote receive\r
662 filter settings if the requested setting can not be honored. For example, if\r
663 a request for four multicast addresses is made and the underlying hardware\r
664 only supports two multicast addresses the driver might set the promiscuous\r
665 or promiscuous multicast receive filters instead. The receiving software is\r
666 responsible for discarding any extra packets that get through the hardware\r
667 receive filters.\r
668 Note: Note: To disable all receive filter hardware, the network driver must\r
669 be Shutdown() and Stopped(). Calling ReceiveFilters() with Disable set to\r
670 Snp->Mode->ReceiveFilterSettings will make it so no more packets are\r
671 returned by the Receive() function, but the receive hardware may still be\r
672 moving packets into system memory before inspecting and discarding them.\r
673 Unexpected system errors, reboots and hangs can occur if an OS is loaded\r
674 and the network devices are not Shutdown() and Stopped().\r
675 If ResetMCastFilter is TRUE, then the multicast receive filter list on the\r
676 network interface will be reset to the default multicast receive filter list.\r
677 If ResetMCastFilter is FALSE, and this network interface allows the multicast\r
678 receive filter list to be modified, then the MCastFilterCnt and MCastFilter\r
679 are used to update the current multicast receive filter list. The modified\r
680 receive filter list settings can be found in the MCastFilter field of\r
681 EFI_SIMPLE_NETWORK_MODE. If the network interface does not allow the multicast\r
682 receive filter list to be modified, then EFI_INVALID_PARAMETER will be returned.\r
683 If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
684 If the receive filter mask and multicast receive filter list have been\r
685 successfully updated on the network interface, EFI_SUCCESS will be returned.\r
686\r
687 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
688 @param Enable A bit mask of receive filters to enable on the network\r
689 interface.\r
690 @param Disable A bit mask of receive filters to disable on the network\r
691 interface. For backward compatibility with EFI 1.1\r
692 platforms, the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit\r
693 must be set when the ResetMCastFilter parameter is TRUE.\r
694 @param ResetMCastFilter Set to TRUE to reset the contents of the multicast\r
695 receive filters on the network interface to their\r
696 default values.\r
697 @param MCastFilterCnt Number of multicast HW MAC addresses in the new MCastFilter\r
698 list. This value must be less than or equal to the\r
699 MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE.\r
700 This field is optional if ResetMCastFilter is TRUE.\r
701 @param MCastFilter A pointer to a list of new multicast receive filter HW\r
702 MAC addresses. This list will replace any existing\r
703 multicast HW MAC address list. This field is optional\r
704 if ResetMCastFilter is TRUE.\r
705\r
706 @retval EFI_SUCCESS The multicast receive filter list was updated.\r
707 @retval EFI_NOT_STARTED The network interface has not been started.\r
708 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
709 * This is NULL\r
710 * There are bits set in Enable that are not set\r
711 in Snp->Mode->ReceiveFilterMask\r
712 * There are bits set in Disable that are not set\r
713 in Snp->Mode->ReceiveFilterMask\r
714 * Multicast is being enabled (the\r
715 EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit is\r
716 set in Enable, it is not set in Disable, and\r
717 ResetMCastFilter is FALSE) and MCastFilterCount\r
718 is zero\r
719 * Multicast is being enabled and MCastFilterCount\r
720 is greater than Snp->Mode->MaxMCastFilterCount\r
721 * Multicast is being enabled and MCastFilter is NULL\r
722 * Multicast is being enabled and one or more of\r
723 the addresses in the MCastFilter list are not\r
724 valid multicast MAC addresses\r
725 @retval EFI_DEVICE_ERROR One or more of the following conditions is TRUE:\r
726 * The network interface has been started but has\r
727 not been initialized\r
728 * An unexpected error was returned by the\r
729 underlying network driver or device\r
730 @retval EFI_UNSUPPORTED This function is not supported by the network\r
731 interface.\r
732\r
733**/\r
734EFI_STATUS\r
735EFIAPI\r
736SnpUndi32ReceiveFilters (\r
737 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
738 IN UINT32 Enable,\r
739 IN UINT32 Disable,\r
740 IN BOOLEAN ResetMCastFilter,\r
741 IN UINTN MCastFilterCnt, OPTIONAL\r
742 IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL\r
743 );\r
744\r
745/**\r
746 Modifies or resets the current station address, if supported.\r
747\r
748 This function modifies or resets the current station address of a network\r
749 interface, if supported. If Reset is TRUE, then the current station address is\r
750 set to the network interface's permanent address. If Reset is FALSE, and the\r
751 network interface allows its station address to be modified, then the current\r
752 station address is changed to the address specified by New. If the network\r
753 interface does not allow its station address to be modified, then\r
754 EFI_INVALID_PARAMETER will be returned. If the station address is successfully\r
755 updated on the network interface, EFI_SUCCESS will be returned. If the driver\r
756 has not been initialized, EFI_DEVICE_ERROR will be returned.\r
757\r
758 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
759 @param Reset Flag used to reset the station address to the network interface's\r
760 permanent address.\r
761 @param New New station address to be used for the network interface.\r
762\r
763\r
764 @retval EFI_SUCCESS The network interface's station address was updated.\r
765 @retval EFI_NOT_STARTED The Simple Network Protocol interface has not been\r
766 started by calling Start().\r
767 @retval EFI_INVALID_PARAMETER The New station address was not accepted by the NIC.\r
768 @retval EFI_INVALID_PARAMETER Reset is FALSE and New is NULL.\r
769 @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not\r
770 been initialized by calling Initialize().\r
771 @retval EFI_DEVICE_ERROR An error occurred attempting to set the new\r
772 station address.\r
773 @retval EFI_UNSUPPORTED The NIC does not support changing the network\r
774 interface's station address.\r
775\r
776**/\r
777EFI_STATUS\r
778EFIAPI\r
779SnpUndi32StationAddress (\r
780 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
781 IN BOOLEAN Reset,\r
782 IN EFI_MAC_ADDRESS *New OPTIONAL\r
783 );\r
784\r
785/**\r
786 Resets or collects the statistics on a network interface.\r
787\r
788 This function resets or collects the statistics on a network interface. If the\r
789 size of the statistics table specified by StatisticsSize is not big enough for\r
790 all the statistics that are collected by the network interface, then a partial\r
791 buffer of statistics is returned in StatisticsTable, StatisticsSize is set to\r
792 the size required to collect all the available statistics, and\r
793 EFI_BUFFER_TOO_SMALL is returned.\r
794 If StatisticsSize is big enough for all the statistics, then StatisticsTable\r
795 will be filled, StatisticsSize will be set to the size of the returned\r
796 StatisticsTable structure, and EFI_SUCCESS is returned.\r
797 If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
798 If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then\r
799 no operations will be performed, and EFI_SUCCESS will be returned.\r
800 If Reset is TRUE, then all of the supported statistics counters on this network\r
801 interface will be reset to zero.\r
802\r
803 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
804 @param Reset Set to TRUE to reset the statistics for the network interface.\r
805 @param StatisticsSize On input the size, in bytes, of StatisticsTable. On output\r
806 the size, in bytes, of the resulting table of statistics.\r
807 @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
808 contains the statistics. Type EFI_NETWORK_STATISTICS is\r
809 defined in "Related Definitions" below.\r
810\r
811 @retval EFI_SUCCESS The requested operation succeeded.\r
812 @retval EFI_NOT_STARTED The Simple Network Protocol interface has not been\r
813 started by calling Start().\r
814 @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is\r
815 NULL. The current buffer size that is needed to\r
816 hold all the statistics is returned in StatisticsSize.\r
817 @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is\r
818 not NULL. The current buffer size that is needed\r
819 to hold all the statistics is returned in\r
820 StatisticsSize. A partial set of statistics is\r
821 returned in StatisticsTable.\r
822 @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not\r
823 NULL.\r
824 @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not\r
825 been initialized by calling Initialize().\r
826 @retval EFI_DEVICE_ERROR An error was encountered collecting statistics\r
827 from the NIC.\r
828 @retval EFI_UNSUPPORTED The NIC does not support collecting statistics\r
829 from the network interface.\r
830\r
831**/\r
832EFI_STATUS\r
833EFIAPI\r
834SnpUndi32Statistics (\r
835 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
836 IN BOOLEAN Reset,\r
837 IN OUT UINTN *StatisticsSize, OPTIONAL\r
838 IN OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL\r
839 );\r
840\r
841/**\r
842 Converts a multicast IP address to a multicast HW MAC address.\r
843\r
844 This function converts a multicast IP address to a multicast HW MAC address\r
845 for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will\r
846 be returned.\r
847\r
848 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
849 @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460].\r
850 Set to FALSE if the multicast IP address is IPv4 [RFC 791].\r
851 @param IP The multicast IP address that is to be converted to a multicast\r
852 HW MAC address.\r
853 @param MAC The multicast HW MAC address that is to be generated from IP.\r
854\r
855 @retval EFI_SUCCESS The multicast IP address was mapped to the\r
856 multicast HW MAC address.\r
857 @retval EFI_NOT_STARTED The Simple Network Protocol interface has not\r
858 been started by calling Start().\r
859 @retval EFI_INVALID_PARAMETER IP is NULL.\r
860 @retval EFI_INVALID_PARAMETER MAC is NULL.\r
861 @retval EFI_INVALID_PARAMETER IP does not point to a valid IPv4 or IPv6\r
862 multicast address.\r
863 @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not\r
864 been initialized by calling Initialize().\r
865 @retval EFI_UNSUPPORTED IPv6 is TRUE and the implementation does not\r
866 support IPv6 multicast to MAC address conversion.\r
867\r
868**/\r
869EFI_STATUS\r
870EFIAPI\r
871SnpUndi32McastIpToMac (\r
872 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
873 IN BOOLEAN IPv6,\r
874 IN EFI_IP_ADDRESS *IP,\r
875 OUT EFI_MAC_ADDRESS *MAC\r
876 );\r
877\r
878/**\r
879 Performs read and write operations on the NVRAM device attached to a network\r
880 interface.\r
881\r
882 This function performs read and write operations on the NVRAM device attached\r
883 to a network interface. If ReadWrite is TRUE, a read operation is performed.\r
884 If ReadWrite is FALSE, a write operation is performed. Offset specifies the\r
885 byte offset at which to start either operation. Offset must be a multiple of\r
886 NvRamAccessSize , and it must have a value between zero and NvRamSize.\r
887 BufferSize specifies the length of the read or write operation. BufferSize must\r
888 also be a multiple of NvRamAccessSize, and Offset + BufferSize must not exceed\r
889 NvRamSize.\r
890 If any of the above conditions is not met, then EFI_INVALID_PARAMETER will be\r
891 returned.\r
892 If all the conditions are met and the operation is "read," the NVRAM device\r
893 attached to the network interface will be read into Buffer and EFI_SUCCESS\r
894 will be returned. If this is a write operation, the contents of Buffer will be\r
895 used to update the contents of the NVRAM device attached to the network\r
896 interface and EFI_SUCCESS will be returned.\r
897\r
898 It does the basic checking on the input parameters and retrieves snp structure\r
899 and then calls the read_nvdata() call which does the actual reading\r
900\r
901 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
902 @param ReadWrite TRUE for read operations, FALSE for write operations.\r
903 @param Offset Byte offset in the NVRAM device at which to start the read or\r
904 write operation. This must be a multiple of NvRamAccessSize\r
905 and less than NvRamSize. (See EFI_SIMPLE_NETWORK_MODE)\r
906 @param BufferSize The number of bytes to read or write from the NVRAM device.\r
907 This must also be a multiple of NvramAccessSize.\r
908 @param Buffer A pointer to the data buffer.\r
909\r
910 @retval EFI_SUCCESS The NVRAM access was performed.\r
911 @retval EFI_NOT_STARTED The network interface has not been started.\r
912 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
913 * The This parameter is NULL\r
914 * The This parameter does not point to a valid\r
915 EFI_SIMPLE_NETWORK_PROTOCOL structure\r
916 * The Offset parameter is not a multiple of\r
917 EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
918 * The Offset parameter is not less than\r
919 EFI_SIMPLE_NETWORK_MODE.NvRamSize\r
920 * The BufferSize parameter is not a multiple of\r
921 EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
922 * The Buffer parameter is NULL\r
923 @retval EFI_DEVICE_ERROR The command could not be sent to the network\r
924 interface.\r
925 @retval EFI_UNSUPPORTED This function is not supported by the network\r
926 interface.\r
927\r
928**/\r
929EFI_STATUS\r
930EFIAPI\r
931SnpUndi32NvData (\r
932 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
933 IN BOOLEAN ReadWrite,\r
934 IN UINTN Offset,\r
935 IN UINTN BufferSize,\r
936 IN OUT VOID *Buffer\r
937 );\r
938\r
939/**\r
940 Reads the current interrupt status and recycled transmit buffer status from a\r
941 network interface.\r
942\r
943 This function gets the current interrupt and recycled transmit buffer status\r
944 from the network interface. The interrupt status is returned as a bit mask in\r
945 InterruptStatus. If InterruptStatus is NULL, the interrupt status will not be\r
946 read. If TxBuf is not NULL, a recycled transmit buffer address will be retrieved.\r
947 If a recycled transmit buffer address is returned in TxBuf, then the buffer has\r
948 been successfully transmitted, and the status for that buffer is cleared. If\r
949 the status of the network interface is successfully collected, EFI_SUCCESS\r
950 will be returned. If the driver has not been initialized, EFI_DEVICE_ERROR will\r
951 be returned.\r
952\r
953 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
954 @param InterruptStatus A pointer to the bit mask of the currently active\r
955 interrupts (see "Related Definitions"). If this is NULL,\r
956 the interrupt status will not be read from the device.\r
957 If this is not NULL, the interrupt status will be read\r
958 from the device. When the interrupt status is read, it\r
959 will also be cleared. Clearing the transmit interrupt does\r
960 not empty the recycled transmit buffer array.\r
961 @param TxBuf Recycled transmit buffer address. The network interface\r
962 will not transmit if its internal recycled transmit\r
963 buffer array is full. Reading the transmit buffer does\r
964 not clear the transmit interrupt. If this is NULL, then\r
965 the transmit buffer status will not be read. If there\r
966 are no transmit buffers to recycle and TxBuf is not NULL,\r
967 TxBuf will be set to NULL.\r
968\r
969 @retval EFI_SUCCESS The status of the network interface was retrieved.\r
970 @retval EFI_NOT_STARTED The network interface has not been started.\r
971 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
972 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
973 @retval EFI_DEVICE_ERROR The command could not be sent to the network\r
974 interface.\r
975\r
976**/\r
977EFI_STATUS\r
978EFIAPI\r
979SnpUndi32GetStatus (\r
980 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
981 OUT UINT32 *InterruptStatus, OPTIONAL\r
982 OUT VOID **TxBuf OPTIONAL\r
983 );\r
984\r
985/**\r
986 Places a packet in the transmit queue of a network interface.\r
987\r
988 This function places the packet specified by Header and Buffer on the transmit\r
989 queue. If HeaderSize is nonzero and HeaderSize is not equal to\r
990 This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If\r
991 BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL\r
992 will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be\r
993 returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then\r
994 EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network\r
995 interface is busy, then EFI_NOT_READY will be returned. If this packet can be\r
996 accepted by the transmit engine of the network interface, the packet contents\r
997 specified by Buffer will be placed on the transmit queue of the network\r
998 interface, and EFI_SUCCESS will be returned. GetStatus() can be used to\r
999 determine when the packet has actually been transmitted. The contents of the\r
1000 Buffer must not be modified until the packet has actually been transmitted.\r
1001 The Transmit() function performs nonblocking I/O. A caller who wants to perform\r
1002 blocking I/O, should call Transmit(), and then GetStatus() until the\r
1003 transmitted buffer shows up in the recycled transmit buffer.\r
1004 If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
1005\r
1006 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
1007 @param HeaderSize The size, in bytes, of the media header to be filled in by the\r
1008 Transmit() function. If HeaderSize is nonzero, then it must\r
1009 be equal to This->Mode->MediaHeaderSize and the DestAddr and\r
1010 Protocol parameters must not be NULL.\r
1011 @param BufferSize The size, in bytes, of the entire packet (media header and\r
1012 data) to be transmitted through the network interface.\r
1013 @param Buffer A pointer to the packet (media header followed by data) to be\r
1014 transmitted. This parameter cannot be NULL. If HeaderSize is\r
1015 zero, then the media header in Buffer must already be filled\r
1016 in by the caller. If HeaderSize is nonzero, then the media\r
1017 header will be filled in by the Transmit() function.\r
1018 @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this\r
1019 parameter is ignored. If HeaderSize is nonzero and SrcAddr\r
1020 is NULL, then This->Mode->CurrentAddress is used for the\r
1021 source HW MAC address.\r
1022 @param DestAddr The destination HW MAC address. If HeaderSize is zero, then\r
1023 this parameter is ignored.\r
1024 @param Protocol The type of header to build. If HeaderSize is zero, then this\r
1025 parameter is ignored. See RFC 1700, section "Ether Types,"\r
1026 for examples.\r
1027\r
1028 @retval EFI_SUCCESS The packet was placed on the transmit queue.\r
1029 @retval EFI_NOT_STARTED The network interface has not been started.\r
1030 @retval EFI_NOT_READY The network interface is too busy to accept this\r
1031 transmit request.\r
1032 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
1033 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported\r
1034 value.\r
1035 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
1036 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
1037\r
1038**/\r
1039EFI_STATUS\r
1040EFIAPI\r
1041SnpUndi32Transmit (\r
1042 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
1043 IN UINTN HeaderSize,\r
1044 IN UINTN BufferSize,\r
1045 IN VOID *Buffer,\r
1046 IN EFI_MAC_ADDRESS *SrcAddr, OPTIONAL\r
1047 IN EFI_MAC_ADDRESS *DestAddr, OPTIONAL\r
1048 IN UINT16 *Protocol OPTIONAL\r
1049 );\r
1050\r
1051/**\r
1052 Receives a packet from a network interface.\r
1053\r
1054 This function retrieves one packet from the receive queue of a network interface.\r
1055 If there are no packets on the receive queue, then EFI_NOT_READY will be\r
1056 returned. If there is a packet on the receive queue, and the size of the packet\r
1057 is smaller than BufferSize, then the contents of the packet will be placed in\r
1058 Buffer, and BufferSize will be updated with the actual size of the packet.\r
1059 In addition, if SrcAddr, DestAddr, and Protocol are not NULL, then these values\r
1060 will be extracted from the media header and returned. EFI_SUCCESS will be\r
1061 returned if a packet was successfully received.\r
1062 If BufferSize is smaller than the received packet, then the size of the receive\r
1063 packet will be placed in BufferSize and EFI_BUFFER_TOO_SMALL will be returned.\r
1064 If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
1065\r
1066 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
1067 @param HeaderSize The size, in bytes, of the media header received on the network\r
1068 interface. If this parameter is NULL, then the media header size\r
1069 will not be returned.\r
1070 @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in\r
1071 bytes, of the packet that was received on the network interface.\r
1072 @param Buffer A pointer to the data buffer to receive both the media\r
1073 header and the data.\r
1074 @param SrcAddr The source HW MAC address. If this parameter is NULL, the HW\r
1075 MAC source address will not be extracted from the media header.\r
1076 @param DestAddr The destination HW MAC address. If this parameter is NULL,\r
1077 the HW MAC destination address will not be extracted from\r
1078 the media header.\r
1079 @param Protocol The media header type. If this parameter is NULL, then the\r
1080 protocol will not be extracted from the media header. See\r
1081 RFC 1700 section "Ether Types" for examples.\r
1082\r
1083 @retval EFI_SUCCESS The received data was stored in Buffer, and\r
1084 BufferSize has been updated to the number of\r
1085 bytes received.\r
1086 @retval EFI_NOT_STARTED The network interface has not been started.\r
1087 @retval EFI_NOT_READY No packets have been received on the network interface.\r
1088 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the received packets.\r
1089 BufferSize has been updated to the required size.\r
1090 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
1091 * The This parameter is NULL\r
1092 * The This parameter does not point to a valid\r
1093 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
1094 * The BufferSize parameter is NULL\r
1095 * The Buffer parameter is NULL\r
1096 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
1097\r
1098**/\r
1099EFI_STATUS\r
1100EFIAPI\r
1101SnpUndi32Receive (\r
1102 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
1103 OUT UINTN *HeaderSize OPTIONAL,\r
1104 IN OUT UINTN *BufferSize,\r
1105 OUT VOID *Buffer,\r
1106 OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
1107 OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
1108 OUT UINT16 *Protocol OPTIONAL\r
1109 );\r
1110\r
1111/**\r
1112 Nofication call back function for WaitForPacket event.\r
1113\r
1114 @param Event EFI Event.\r
1115 @param SnpPtr Pointer to SNP_DRIVER structure.\r
1116\r
1117**/\r
1118VOID\r
1119EFIAPI\r
1120SnpWaitForPacketNotify (\r
1121 EFI_EVENT Event,\r
1122 VOID *SnpPtr\r
1123 );\r
1124\r
1125#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)\r
1126\r
1127\r
1128#endif /* _SNP_H_ */\r