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