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