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