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