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