]> git.proxmox.com Git - mirror_edk2.git/commitdiff
sync comments, fix function header, rename variable name to follow coding style.
authorniry <niry@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Nov 2008 03:42:21 +0000 (03:42 +0000)
committerniry <niry@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Nov 2008 03:42:21 +0000 (03:42 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6481 6f19259b-4bc3-4df7-8a09-765794883524

18 files changed:
MdeModulePkg/Universal/Network/SnpDxe/Callback.c
MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c
MdeModulePkg/Universal/Network/SnpDxe/Get_status.c
MdeModulePkg/Universal/Network/SnpDxe/Initialize.c
MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c
MdeModulePkg/Universal/Network/SnpDxe/Nvdata.c
MdeModulePkg/Universal/Network/SnpDxe/Receive.c
MdeModulePkg/Universal/Network/SnpDxe/Receive_filters.c
MdeModulePkg/Universal/Network/SnpDxe/Reset.c
MdeModulePkg/Universal/Network/SnpDxe/Shutdown.c
MdeModulePkg/Universal/Network/SnpDxe/Snp.c
MdeModulePkg/Universal/Network/SnpDxe/Snp.h
MdeModulePkg/Universal/Network/SnpDxe/Start.c
MdeModulePkg/Universal/Network/SnpDxe/Station_address.c
MdeModulePkg/Universal/Network/SnpDxe/Statistics.c
MdeModulePkg/Universal/Network/SnpDxe/Stop.c
MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
MdeModulePkg/Universal/Network/SnpDxe/WaitForPacket.c

index 6dc9943cf60721727c9d6f2593d4d7d35db26862..c4789ba11dc81be576666a40eb7e1bca2e180f9e 100644 (file)
@@ -3,7 +3,7 @@
   the callback routines for Undi3.1 have an extra parameter UniqueId which\r
   stores the interface context for the NIC that snp is trying to talk.\r
 \r
   the callback routines for Undi3.1 have an extra parameter UniqueId which\r
   stores the interface context for the NIC that snp is trying to talk.\r
 \r
-Copyright (c) 2006, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -28,43 +28,38 @@ EFI_LOCK             mLock;
 //\r
 // End Global variables\r
 //\r
 //\r
 // End Global variables\r
 //\r
-extern EFI_PCI_IO_PROTOCOL  *mPciIoFncs;\r
+extern EFI_PCI_IO_PROTOCOL  *mPciIo;\r
 \r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with a virtual or CPU address that SNP provided to \r
+  convert it to a physical or device address. Since EFI uses the identical \r
+  mapping, this routine returns the physical address same as the virtual address\r
+  for most of the addresses. an address above 4GB cannot generally be used as a \r
+  device address, it needs to be mapped to a lower physical address. This \r
+  routine does not call the map routine itself, but it assumes that the mapping\r
+  was done at the time of providing the address to UNDI. This routine just \r
+  looks up the address in a map table (which is the v2p structure chain). \r
+  \r
+  @param  CpuAddr        virtual address of a buffer.\r
+  @param  DeviceAddrPtr  pointer to the physical address.\r
+                         The DeviceAddrPtr will contain 0 in case of any error.\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_v2p_30 (\r
+SnpUndi32CallbackV2p30 (\r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
   )\r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine with a virtual or CPU address that SNP provided\r
- to convert it to a physical or device address. Since EFI uses the identical\r
- mapping, this routine returns the physical address same as the virtual address\r
- for most of the addresses. an address above 4GB cannot generally be used as a\r
- device address, it needs to be mapped to a lower physical address. This routine\r
- does not call the map routine itself, but it assumes that the mapping was done\r
- at the time of providing the address to UNDI. This routine just looks up the\r
- address in a map table (which is the v2p structure chain)\r
-\r
-Arguments:\r
- CpuAddr - virtual address of a buffer\r
- DeviceAddrPtr - pointer to the physical address\r
-\r
-Returns:\r
- void - The DeviceAddrPtr will contain 0 in case of any error\r
-\r
---*/\r
 {\r
 {\r
-  struct s_v2p  *v2p;\r
+  V2P  *V2p;\r
   //\r
   // Do nothing if virtual address is zero or physical pointer is NULL.\r
   // No need to map if the virtual address is within 4GB limit since\r
   // EFI uses identical mapping\r
   //\r
   if ((CpuAddr == 0) || (DeviceAddrPtr == 0)) {\r
   //\r
   // Do nothing if virtual address is zero or physical pointer is NULL.\r
   // No need to map if the virtual address is within 4GB limit since\r
   // EFI uses identical mapping\r
   //\r
   if ((CpuAddr == 0) || (DeviceAddrPtr == 0)) {\r
-    DEBUG ((EFI_D_ERROR, "\nv2p: Null virtual address or physical pointer.\n"));\r
+    DEBUG ((EFI_D_NET, "\nv2p: Null virtual address or physical pointer.\n"));\r
     return ;\r
   }\r
 \r
     return ;\r
   }\r
 \r
@@ -77,31 +72,26 @@ Returns:
   // big address, this callback routine just looks up in the v2p list and\r
   // returns the physical address for any given virtual address.\r
   //\r
   // big address, this callback routine just looks up in the v2p list and\r
   // returns the physical address for any given virtual address.\r
   //\r
-  if (find_v2p (&v2p, (VOID *) (UINTN) CpuAddr) != EFI_SUCCESS) {\r
+  if (FindV2p (&V2p, (VOID *) (UINTN) CpuAddr) != EFI_SUCCESS) {\r
     *(UINT64 *) (UINTN) DeviceAddrPtr = CpuAddr;\r
   } else {\r
     *(UINT64 *) (UINTN) DeviceAddrPtr = CpuAddr;\r
   } else {\r
-    *(UINT64 *) (UINTN) DeviceAddrPtr = v2p->paddr;\r
+    *(UINT64 *) (UINTN) DeviceAddrPtr = V2p->PhysicalAddress;\r
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants to have exclusive access to a critical\r
+  section of the code/data.\r
+\r
+  @param Enable   non-zero indicates acquire\r
+                  zero indicates release\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_block_30 (\r
+SnpUndi32CallbackBlock30 (\r
   IN UINT32 Enable\r
   )\r
   IN UINT32 Enable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine when it wants to have exclusive access to a critical\r
- section of the code/data\r
-\r
-Arguments:\r
- Enable - non-zero indicates acquire\r
-          zero indicates release\r
-\r
-Returns:\r
- void\r
---*/\r
 {\r
   //\r
   // tcpip was calling snp at tpl_notify and if we acquire a lock that was\r
 {\r
   //\r
   // tcpip was calling snp at tpl_notify and if we acquire a lock that was\r
@@ -119,59 +109,49 @@ Returns:
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with the number of micro seconds when it wants to\r
+  pause.\r
+\r
+  @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_delay_30 (\r
+SnpUndi32CallbackDelay30 (\r
   IN UINT64 MicroSeconds\r
   )\r
   IN UINT64 MicroSeconds\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine with the number of micro seconds when it wants to\r
- pause.\r
-\r
-Arguments:\r
- MicroSeconds - number of micro seconds to pause, ususlly multiple of 10\r
-\r
-Returns:\r
- void\r
---*/\r
 {\r
   if (MicroSeconds != 0) {\r
     gBS->Stall ((UINTN) MicroSeconds);\r
   }\r
 }\r
 \r
 {\r
   if (MicroSeconds != 0) {\r
     gBS->Stall ((UINTN) MicroSeconds);\r
   }\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
+  because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
+  io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
+  start of the device's io/mem addresses. Since SNP cannot retrive the context\r
+  of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
+  that NIC and uses one global IO functions structure, this does not work.\r
+  This however works fine for EFI1.0 Undis because they use absolute addresses\r
+  for io/mem access.\r
+\r
+  @param ReadOrWrite  indicates read or write, IO or Memory\r
+  @param NumBytes     number of bytes to read or write\r
+  @param Address      IO or memory address to read from or write to\r
+  @param BufferAddr   memory location to read into or that contains the bytes to \r
+                      write\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_memio_30 (\r
+SnpUndi32CallbackMemio30 (\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
   IN UINT64     Address,\r
   IN OUT UINT64 BufferAddr\r
   )\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
   IN UINT64     Address,\r
   IN OUT UINT64 BufferAddr\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
- because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
- io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
- start of the device's io/mem addresses. Since SNP cannot retrive the context\r
- of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
- that NIC and uses one global IO functions structure, this does not work.\r
- This however works fine for EFI1.0 Undis because they use absolute addresses\r
- for io/mem access.\r
-\r
-Arguments:\r
-  ReadOrWrite - indicates read or write, IO or Memory\r
-  NumBytes    - number of bytes to read or write\r
-  Address     - IO or memory address to read from or write to\r
-  BufferAddr  - memory location to read into or that contains the bytes\r
-                to write\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
 \r
 {\r
   EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
 \r
@@ -194,150 +174,134 @@ Returns:
 \r
   switch (ReadOrWrite) {\r
   case PXE_IO_READ:\r
 \r
   switch (ReadOrWrite) {\r
   case PXE_IO_READ:\r
-    mPciIoFncs->Io.Read (\r
-                    mPciIoFncs,\r
-                    Width,\r
-                    1,    // BAR 1, IO base address\r
-                    Address,\r
-                    1,    // count\r
-                    (VOID *) (UINTN) BufferAddr\r
-                    );\r
+    mPciIo->Io.Read (\r
+                 mPciIo,\r
+                 Width,\r
+                 1,    // BAR 1, IO base address\r
+                 Address,\r
+                 1,    // count\r
+                 (VOID *) (UINTN) BufferAddr\r
+                 );\r
     break;\r
 \r
   case PXE_IO_WRITE:\r
     break;\r
 \r
   case PXE_IO_WRITE:\r
-    mPciIoFncs->Io.Write (\r
-                    mPciIoFncs,\r
-                    Width,\r
-                    1,    // BAR 1, IO base address\r
-                    Address,\r
-                    1,    // count\r
-                    (VOID *) (UINTN) BufferAddr\r
-                    );\r
+    mPciIo->Io.Write (\r
+                 mPciIo,\r
+                 Width,\r
+                 1,    // BAR 1, IO base address\r
+                 Address,\r
+                 1,    // count\r
+                 (VOID *) (UINTN) BufferAddr\r
+                 );\r
     break;\r
 \r
   case PXE_MEM_READ:\r
     break;\r
 \r
   case PXE_MEM_READ:\r
-    mPciIoFncs->Mem.Read (\r
-                      mPciIoFncs,\r
-                      Width,\r
-                      0,  // BAR 0, Memory base address\r
-                      Address,\r
-                      1,  // count\r
-                      (VOID *) (UINTN) BufferAddr\r
-                      );\r
+    mPciIo->Mem.Read (\r
+                  mPciIo,\r
+                  Width,\r
+                  0,  // BAR 0, Memory base address\r
+                  Address,\r
+                  1,  // count\r
+                  (VOID *) (UINTN) BufferAddr\r
+                  );\r
     break;\r
 \r
   case PXE_MEM_WRITE:\r
     break;\r
 \r
   case PXE_MEM_WRITE:\r
-    mPciIoFncs->Mem.Write (\r
-                      mPciIoFncs,\r
-                      Width,\r
-                      0,  // BAR 0, Memory base address\r
-                      Address,\r
-                      1,  // count\r
-                      (VOID *) (UINTN) BufferAddr\r
-                      );\r
+    mPciIo->Mem.Write (\r
+                  mPciIo,\r
+                  Width,\r
+                  0,  // BAR 0, Memory base address\r
+                  Address,\r
+                  1,  // count\r
+                  (VOID *) (UINTN) BufferAddr\r
+                  );\r
     break;\r
   }\r
 \r
   return ;\r
 }\r
     break;\r
   }\r
 \r
   return ;\r
 }\r
-//\r
-// New callbacks for 3.1:\r
-// there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
-// the MemMap call to map the required address by itself!\r
-//\r
+\r
+/**\r
+  This is a callback routine supplied to UNDI3.1 at undi_start time.\r
+  UNDI call this routine when it wants to have exclusive access to a critical\r
+  section of the code/data.\r
+  New callbacks for 3.1:\r
+  there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
+  the MemMap call to map the required address by itself!\r
+\r
+  @param UniqueId  This was supplied to UNDI at Undi_Start, SNP uses this to \r
+                                                                store Undi interface context (Undi does not read or write\r
+                                                                this variable)\r
+  @param Enable    non-zero indicates acquire\r
+                   zero indicates release\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_block (\r
+SnpUndi32CallbackBlock (\r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
   )\r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI3.1 at undi_start time.\r
- UNDI call this routine when it wants to have exclusive access to a critical\r
- section of the code/data\r
-\r
-Arguments:\r
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-            Undi interface context (Undi does not read or write this variable)\r
- Enable   - non-zero indicates acquire\r
-            zero indicates release\r
-\r
-Returns:\r
- void\r
-\r
---*/\r
 {\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
 \r
 \r
-  snp = (SNP_DRIVER *) (UINTN) UniqueId;\r
+  Snp = (SNP_DRIVER *) (UINTN) UniqueId;\r
   //\r
   // tcpip was calling snp at tpl_notify and when we acquire a lock that was\r
   // created at a lower level (TPL_CALLBACK) it gives an assert!\r
   //\r
   if (Enable != 0) {\r
   //\r
   // tcpip was calling snp at tpl_notify and when we acquire a lock that was\r
   // created at a lower level (TPL_CALLBACK) it gives an assert!\r
   //\r
   if (Enable != 0) {\r
-    EfiAcquireLock (&snp->lock);\r
+    EfiAcquireLock (&Snp->Lock);\r
   } else {\r
   } else {\r
-    EfiReleaseLock (&snp->lock);\r
+    EfiReleaseLock (&Snp->Lock);\r
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with the number of micro seconds when it wants to\r
+  pause.\r
+\r
+  @param UniqueId      This was supplied to UNDI at Undi_Start, SNP uses this to\r
+                                                                    store Undi interface context (Undi does not read or write\r
+                                                                    this variable)\r
+  @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_delay (\r
+SnpUndi32CallbackDelay (\r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
   )\r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine with the number of micro seconds when it wants to\r
- pause.\r
-\r
-Arguments:\r
- MicroSeconds - number of micro seconds to pause, ususlly multiple of 10\r
-\r
-Returns:\r
- void\r
---*/\r
 {\r
   if (MicroSeconds != 0) {\r
     gBS->Stall ((UINTN) MicroSeconds);\r
   }\r
 }\r
 \r
 {\r
   if (MicroSeconds != 0) {\r
     gBS->Stall ((UINTN) MicroSeconds);\r
   }\r
 }\r
 \r
-/*\r
- *  IO routine for UNDI start CPB.\r
- */\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  This is the IO routine for UNDI3.1 to start CPB.\r
+\r
+  @param UniqueId       This was supplied to UNDI at Undi_Start, SNP uses this \r
+                                                                                       to store Undi interface context (Undi does not read or\r
+                                                                                       write this variable)\r
+  @param ReadOrWrite    indicates read or write, IO or Memory.\r
+  @param NumBytes       number of bytes to read or write.\r
+  @param MemOrPortAddr  IO or memory address to read from or write to.\r
+  @param BufferPtr      memory location to read into or that contains the bytes\r
+                        to write.\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_memio (\r
-  UINT64 UniqueId,\r
-  UINT8  ReadOrWrite,\r
-  UINT8  NumBytes,\r
-  UINT64 Address,\r
-  UINT64 BufferAddr\r
+SnpUndi32CallbackMemio (\r
+  IN UINT64     UniqueId,\r
+  IN UINT8      ReadOrWrite,\r
+  IN UINT8      NumBytes,\r
+  IN UINT64     MemOrPortAddr,\r
+  IN OUT UINT64 BufferPtr\r
   )\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- This is the IO routine for UNDI3.1.\r
-\r
-Arguments:\r
-  ReadOrWrite - indicates read or write, IO or Memory\r
-  NumBytes    - number of bytes to read or write\r
-  Address     - IO or memory address to read from or write to\r
-  BufferAddr  - memory location to read into or that contains the bytes\r
-                to write\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
 {\r
-  SNP_DRIVER                *snp;\r
+  SNP_DRIVER                *Snp;\r
   EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
 \r
   EFI_PCI_IO_PROTOCOL_WIDTH Width;\r
 \r
-  snp   = (SNP_DRIVER *) (UINTN) UniqueId;\r
+  Snp   = (SNP_DRIVER *) (UINTN) UniqueId;\r
 \r
   Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;\r
   switch (NumBytes) {\r
 \r
   Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;\r
   switch (NumBytes) {\r
@@ -356,46 +320,46 @@ Returns:
 \r
   switch (ReadOrWrite) {\r
   case PXE_IO_READ:\r
 \r
   switch (ReadOrWrite) {\r
   case PXE_IO_READ:\r
-    snp->IoFncs->Io.Read (\r
-                      snp->IoFncs,\r
-                      Width,\r
-                      snp->IoBarIndex,      // BAR 1 (for 32bit regs), IO base address\r
-                      Address,\r
-                      1,                    // count\r
-                      (VOID *) (UINTN) BufferAddr\r
-                      );\r
+    Snp->PciIo->Io.Read (\r
+                     Snp->PciIo,\r
+                     Width,\r
+                     Snp->IoBarIndex,      // BAR 1 (for 32bit regs), IO base address\r
+                     MemOrPortAddr,\r
+                     1,                    // count\r
+                     (VOID *) (UINTN) BufferPtr\r
+                     );\r
     break;\r
 \r
   case PXE_IO_WRITE:\r
     break;\r
 \r
   case PXE_IO_WRITE:\r
-    snp->IoFncs->Io.Write (\r
-                      snp->IoFncs,\r
-                      Width,\r
-                      snp->IoBarIndex,      // BAR 1 (for 32bit regs), IO base address\r
-                      Address,\r
-                      1,                    // count\r
-                      (VOID *) (UINTN) BufferAddr\r
-                      );\r
+    Snp->PciIo->Io.Write (\r
+                     Snp->PciIo,\r
+                     Width,\r
+                     Snp->IoBarIndex,      // BAR 1 (for 32bit regs), IO base address\r
+                     MemOrPortAddr,\r
+                     1,                    // count\r
+                     (VOID *) (UINTN) BufferPtr\r
+                     );\r
     break;\r
 \r
   case PXE_MEM_READ:\r
     break;\r
 \r
   case PXE_MEM_READ:\r
-    snp->IoFncs->Mem.Read (\r
-                      snp->IoFncs,\r
+    Snp->PciIo->Mem.Read (\r
+                      Snp->PciIo,\r
                       Width,\r
                       Width,\r
-                      snp->MemoryBarIndex,  // BAR 0, Memory base address\r
-                      Address,\r
+                      Snp->MemoryBarIndex,  // BAR 0, Memory base address\r
+                      MemOrPortAddr,\r
                       1,                    // count\r
                       1,                    // count\r
-                      (VOID *) (UINTN) BufferAddr\r
+                      (VOID *) (UINTN) BufferPtr\r
                       );\r
     break;\r
 \r
   case PXE_MEM_WRITE:\r
                       );\r
     break;\r
 \r
   case PXE_MEM_WRITE:\r
-    snp->IoFncs->Mem.Write (\r
-                      snp->IoFncs,\r
+    Snp->PciIo->Mem.Write (\r
+                      Snp->PciIo,\r
                       Width,\r
                       Width,\r
-                      snp->MemoryBarIndex,  // BAR 0, Memory base address\r
-                      Address,\r
+                      Snp->MemoryBarIndex,  // BAR 0, Memory base address\r
+                      MemOrPortAddr,\r
                       1,                    // count\r
                       1,                    // count\r
-                      (VOID *) (UINTN) BufferAddr\r
+                      (VOID *) (UINTN) BufferPtr\r
                       );\r
     break;\r
   }\r
                       );\r
     break;\r
   }\r
@@ -403,44 +367,38 @@ Returns:
   return ;\r
 }\r
 \r
   return ;\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it has to map a CPU address to a device\r
+  address.\r
+\r
+  @param UniqueId      - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+                         Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr       - Virtual address to be mapped!\r
+  @param NumBytes      - size of memory to be mapped\r
+  @param Direction     - direction of data flow for this memory's usage:\r
+                         cpu->device, device->cpu or both ways\r
+  @param DeviceAddrPtr - pointer to return the mapped device address\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_map (\r
+SnpUndi32CallbackMap (\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
   IN UINT32     NumBytes,\r
   IN UINT32     Direction,\r
   IN OUT UINT64 DeviceAddrPtr\r
   )\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
   IN UINT32     NumBytes,\r
   IN UINT32     Direction,\r
   IN OUT UINT64 DeviceAddrPtr\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  This is a callback routine supplied to UNDI at undi_start time.\r
-  UNDI call this routine when it has to map a CPU address to a device\r
-  address.\r
-\r
-Arguments:\r
-  UniqueId      - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-                  Undi interface context (Undi does not read or write this variable)\r
-  CpuAddr       - Virtual address to be mapped!\r
-  NumBytes      - size of memory to be mapped\r
-  Direction     - direction of data flow for this memory's usage:\r
-                  cpu->device, device->cpu or both ways\r
-  DeviceAddrPtr - pointer to return the mapped device address\r
-\r
-Returns:\r
-  None\r
-\r
---*/\r
 {\r
   EFI_PHYSICAL_ADDRESS          *DevAddrPtr;\r
   EFI_PCI_IO_PROTOCOL_OPERATION DirectionFlag;\r
   UINTN                         BuffSize;\r
 {\r
   EFI_PHYSICAL_ADDRESS          *DevAddrPtr;\r
   EFI_PCI_IO_PROTOCOL_OPERATION DirectionFlag;\r
   UINTN                         BuffSize;\r
-  SNP_DRIVER                    *snp;\r
+  SNP_DRIVER                    *Snp;\r
   UINTN                         Index;\r
   EFI_STATUS                    Status;\r
 \r
   BuffSize    = (UINTN) NumBytes;\r
   UINTN                         Index;\r
   EFI_STATUS                    Status;\r
 \r
   BuffSize    = (UINTN) NumBytes;\r
-  snp         = (SNP_DRIVER *) (UINTN) UniqueId;\r
+  Snp         = (SNP_DRIVER *) (UINTN) UniqueId;\r
   DevAddrPtr  = (EFI_PHYSICAL_ADDRESS *) (UINTN) DeviceAddrPtr;\r
 \r
   if (CpuAddr == 0) {\r
   DevAddrPtr  = (EFI_PHYSICAL_ADDRESS *) (UINTN) DeviceAddrPtr;\r
 \r
   if (CpuAddr == 0) {\r
@@ -472,7 +430,7 @@ Returns:
   // find an unused map_list entry\r
   //\r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
   // find an unused map_list entry\r
   //\r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
-    if (snp->map_list[Index].virt == 0) {\r
+    if (Snp->MapList[Index].VirtualAddress == 0) {\r
       break;\r
     }\r
   }\r
       break;\r
     }\r
   }\r
@@ -483,59 +441,54 @@ Returns:
     return ;\r
   }\r
 \r
     return ;\r
   }\r
 \r
-  snp->map_list[Index].virt = (EFI_PHYSICAL_ADDRESS) CpuAddr;\r
+  Snp->MapList[Index].VirtualAddress = (EFI_PHYSICAL_ADDRESS) CpuAddr;\r
 \r
 \r
-  Status = snp->IoFncs->Map (\r
-                          snp->IoFncs,\r
-                          DirectionFlag,\r
-                          (VOID *) (UINTN) CpuAddr,\r
-                          &BuffSize,\r
-                          DevAddrPtr,\r
-                          &(snp->map_list[Index].map_cookie)\r
-                          );\r
+  Status = Snp->PciIo->Map (\r
+                         Snp->PciIo,\r
+                         DirectionFlag,\r
+                         (VOID *) (UINTN) CpuAddr,\r
+                         &BuffSize,\r
+                         DevAddrPtr,\r
+                         &(Snp->MapList[Index].MapCookie)\r
+                         );\r
   if (Status != EFI_SUCCESS) {\r
   if (Status != EFI_SUCCESS) {\r
-    *DevAddrPtr               = 0;\r
-    snp->map_list[Index].virt = 0;\r
+    *DevAddrPtr                        = 0;\r
+    Snp->MapList[Index].VirtualAddress = 0;\r
   }\r
 \r
   return ;\r
 }\r
 \r
   }\r
 \r
   return ;\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants to unmap an address that was previously\r
+  mapped using map callback.\r
+\r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store.\r
+                     Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr     Virtual address that was mapped!\r
+  @param NumBytes    size of memory mapped\r
+  @param Direction   direction of data flow for this memory's usage:\r
+                     cpu->device, device->cpu or both ways\r
+  @param DeviceAddr  the mapped device address\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_unmap (\r
+SnpUndi32CallbackUnmap (\r
   IN UINT64 UniqueId,\r
   IN UINT64 CpuAddr,\r
   IN UINT32 NumBytes,\r
   IN UINT32 Direction,\r
   IN UINT64 DeviceAddr\r
   )\r
   IN UINT64 UniqueId,\r
   IN UINT64 CpuAddr,\r
   IN UINT32 NumBytes,\r
   IN UINT32 Direction,\r
   IN UINT64 DeviceAddr\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine when it wants to unmap an address that was previously\r
- mapped using map callback\r
-\r
-Arguments:\r
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-            Undi interface context (Undi does not read or write this variable)\r
- CpuAddr  - Virtual address that was mapped!\r
- NumBytes - size of memory mapped\r
- Direction- direction of data flow for this memory's usage:\r
-            cpu->device, device->cpu or both ways\r
- DeviceAddr - the mapped device address\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   UINT16      Index;\r
 \r
   UINT16      Index;\r
 \r
-  snp = (SNP_DRIVER *) (UINTN) UniqueId;\r
+  Snp = (SNP_DRIVER *) (UINTN) UniqueId;\r
 \r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
 \r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
-    if (snp->map_list[Index].virt == CpuAddr) {\r
+    if (Snp->MapList[Index].VirtualAddress == CpuAddr) {\r
       break;\r
     }\r
   }\r
       break;\r
     }\r
   }\r
@@ -546,46 +499,41 @@ Returns:
     return ;\r
   }\r
 \r
     return ;\r
   }\r
 \r
-  snp->IoFncs->Unmap (snp->IoFncs, snp->map_list[Index].map_cookie);\r
-  snp->map_list[Index].virt       = 0;\r
-  snp->map_list[Index].map_cookie = NULL;\r
+  Snp->PciIo->Unmap (Snp->PciIo, Snp->MapList[Index].MapCookie);\r
+  Snp->MapList[Index].VirtualAddress = 0;\r
+  Snp->MapList[Index].MapCookie      = NULL;\r
   return ;\r
 }\r
 \r
   return ;\r
 }\r
 \r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants synchronize the virtual buffer contents\r
+  with the mapped buffer contents. The virtual and mapped buffers need not\r
+  correspond to the same physical memory (especially if the virtual address is\r
+  > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
+  need to synchronize their contents whenever it writes to/reads from the buffer\r
+  using either the cpu address or the device address.\r
+\r
+  EFI does not provide a sync call, since virt=physical, we sould just do\r
+  the synchronization ourself here!\r
+\r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+                     Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr     Virtual address that was mapped!\r
+  @param NumBytes    size of memory mapped.\r
+  @param Direction   direction of data flow for this memory's usage:\r
+                     cpu->device, device->cpu or both ways.\r
+  @param DeviceAddr  the mapped device address.\r
+\r
+**/\r
 VOID\r
 VOID\r
-snp_undi32_callback_sync (\r
-  UINT64 UniqueId,\r
-  UINT64 CpuAddr,\r
-  UINT32 NumBytes,\r
-  UINT32 Direction,\r
-  UINT64 DeviceAddr\r
+SnpUndi32CallbackSync (\r
+  IN UINT64             UniqueId,\r
+  IN UINT64             CpuAddr,\r
+  IN UINT32             NumBytes,\r
+  IN UINT32             Direction,\r
+  IN UINT64             DeviceAddr\r
   )\r
   )\r
-/*++\r
-\r
-Routine Description:\r
- This is a callback routine supplied to UNDI at undi_start time.\r
- UNDI call this routine when it wants synchronize the virtual buffer contents\r
- with the mapped buffer contents. The virtual and mapped buffers need not\r
- correspond to the same physical memory (especially if the virtual address is\r
- > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
- need to synchronize their contents whenever it writes to/reads from the buffer\r
- using either the cpu address or the device address.\r
-\r
- EFI does not provide a sync call, since virt=physical, we sould just do\r
- the synchronization ourself here!\r
-\r
-Arguments:\r
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
-            Undi interface context (Undi does not read or write this variable)\r
- CpuAddr  - Virtual address that was mapped!\r
- NumBytes - size of memory mapped\r
- Direction- direction of data flow for this memory's usage:\r
-            cpu->device, device->cpu or both ways\r
- DeviceAddr - the mapped device address\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   if ((CpuAddr == 0) || (DeviceAddr == 0) || (NumBytes == 0)) {\r
     return ;\r
 {\r
   if ((CpuAddr == 0) || (DeviceAddr == 0) || (NumBytes == 0)) {\r
     return ;\r
index e8da93010ce4aac347c8fe0de6bcb4ea2398427f..304e6205fda2821d446cf1624d05d17e366e24a3 100644 (file)
@@ -1,25 +1,18 @@
 /** @file\r
 /** @file\r
+    UEFI Component Name(2) protocol implementation for SnpDxe driver.\r
 \r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  ComponentName.c\r
-\r
-Abstract:\r
-\r
-\r
 **/\r
 \r
 \r
 **/\r
 \r
 \r
-\r
 #include "Snp.h"\r
 \r
 //\r
 #include "Snp.h"\r
 \r
 //\r
index 9eaafb932c522356a0d7d5e0643ada947e374093..17078c81cfc9339e330d84289990d9e1587ac806 100644 (file)
@@ -1,21 +1,16 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+               Implementation of reading the current interrupt status and recycled transmit\r
+         buffer status from a network interface.\r
+\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  get_status.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-03 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 **/\r
 \r
 #include "Snp.h"\r
@@ -24,7 +19,7 @@ Revision history:
   this routine calls undi to get the status of the interrupts, get the list of\r
   transmit buffers that completed transmitting!\r
 \r
   this routine calls undi to get the status of the interrupts, get the list of\r
   transmit buffers that completed transmitting!\r
 \r
-  @param  snp                     pointer to snp driver structure\r
+  @param  Snp                     pointer to snp driver structure\r
   @param  InterruptStatusPtr      a non null pointer gets the interrupt status\r
   @param  TransmitBufferListPtrs  a non null ointer gets the list of pointers of\r
                                   previously  transmitted buffers whose\r
   @param  InterruptStatusPtr      a non null pointer gets the interrupt status\r
   @param  TransmitBufferListPtrs  a non null ointer gets the list of pointers of\r
                                   previously  transmitted buffers whose\r
@@ -33,56 +28,56 @@ Revision history:
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_getstatus (\r
-  SNP_DRIVER *snp,\r
+PxeGetStatus (\r
+  SNP_DRIVER *Snp,\r
   UINT32     *InterruptStatusPtr,\r
   VOID       **TransmitBufferListPtr\r
   )\r
 {\r
   UINT32     *InterruptStatusPtr,\r
   VOID       **TransmitBufferListPtr\r
   )\r
 {\r
-  PXE_DB_GET_STATUS *db;\r
+  PXE_DB_GET_STATUS *Db;\r
   UINT16            InterruptFlags;\r
 \r
   UINT16            InterruptFlags;\r
 \r
-  db                = snp->db;\r
-  snp->cdb.OpCode   = PXE_OPCODE_GET_STATUS;\r
+  Db                = Snp->Db;\r
+  Snp->Cdb.OpCode   = PXE_OPCODE_GET_STATUS;\r
 \r
 \r
-  snp->cdb.OpFlags  = 0;\r
+  Snp->Cdb.OpFlags  = 0;\r
 \r
   if (TransmitBufferListPtr != NULL) {\r
 \r
   if (TransmitBufferListPtr != NULL) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS;\r
   }\r
 \r
   if (InterruptStatusPtr != NULL) {\r
   }\r
 \r
   if (InterruptStatusPtr != NULL) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_GET_INTERRUPT_STATUS;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_GET_INTERRUPT_STATUS;\r
   }\r
 \r
   }\r
 \r
-  snp->cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
 \r
   //\r
   // size DB for return of one buffer\r
   //\r
 \r
   //\r
   // size DB for return of one buffer\r
   //\r
-  snp->cdb.DBsize = (UINT16) (((UINT16) (sizeof (PXE_DB_GET_STATUS)) - (UINT16) (sizeof db->TxBuffer)) + (UINT16) (sizeof db->TxBuffer[0]));\r
+  Snp->Cdb.DBsize     = (UINT16) ((sizeof (PXE_DB_GET_STATUS) - sizeof (Db->TxBuffer)) + sizeof (Db->TxBuffer[0]));\r
 \r
 \r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.get_status()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.get_status()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != EFI_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != EFI_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_NET,\r
     DEBUG (\r
       (EFI_D_NET,\r
-      "\nsnp->undi.get_status()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatFlags)\r
+      "\nSnp->undi.get_status()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatFlags)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -91,23 +86,23 @@ pxe_getstatus (
   // report the values back..\r
   //\r
   if (InterruptStatusPtr != NULL) {\r
   // report the values back..\r
   //\r
   if (InterruptStatusPtr != NULL) {\r
-    InterruptFlags      = (UINT16) (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK);\r
+    InterruptFlags      = (UINT16) (Snp->Cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK);\r
 \r
     *InterruptStatusPtr = 0;\r
 \r
 \r
     *InterruptStatusPtr = 0;\r
 \r
-    if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_RECEIVE) {\r
+    if ((InterruptFlags & PXE_STATFLAGS_GET_STATUS_RECEIVE) == PXE_STATFLAGS_GET_STATUS_RECEIVE) {\r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;\r
     }\r
 \r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;\r
     }\r
 \r
-    if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_TRANSMIT) {\r
+    if ((InterruptFlags & PXE_STATFLAGS_GET_STATUS_TRANSMIT) == PXE_STATFLAGS_GET_STATUS_TRANSMIT) {\r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;\r
     }\r
 \r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;\r
     }\r
 \r
-    if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_COMMAND) {\r
+    if ((InterruptFlags & PXE_STATFLAGS_GET_STATUS_COMMAND) == PXE_STATFLAGS_GET_STATUS_COMMAND) {\r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;\r
     }\r
 \r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;\r
     }\r
 \r
-    if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_SOFTWARE) {\r
+    if ((InterruptFlags & PXE_STATFLAGS_GET_STATUS_SOFTWARE) == PXE_STATFLAGS_GET_STATUS_SOFTWARE) {\r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;\r
     }\r
 \r
       *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;\r
     }\r
 \r
@@ -116,58 +111,82 @@ pxe_getstatus (
   if (TransmitBufferListPtr != NULL) {\r
     *TransmitBufferListPtr =\r
       (\r
   if (TransmitBufferListPtr != NULL) {\r
     *TransmitBufferListPtr =\r
       (\r
-        (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN) ||\r
-        (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY)\r
-      ) ? 0 : (VOID *) (UINTN) db->TxBuffer[0];\r
+        (Snp->Cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN) ||\r
+        (Snp->Cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY)\r
+      ) ? 0 : (VOID *) (UINTN) Db->TxBuffer[0];\r
 \r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
 /**\r
-  This is the SNP interface routine for getting the status\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_getstatus routine to actually get the undi status\r
-\r
-  @param  this                    context pointer\r
-  @param  InterruptStatusPtr      a non null pointer gets the interrupt status\r
-  @param  TransmitBufferListPtrs  a non null ointer gets the list of pointers of\r
-                                  previously  transmitted buffers whose\r
-                                  transmission was completed  asynchrnously.\r
-\r
+  Reads the current interrupt status and recycled transmit buffer status from a\r
+  network interface.\r
+  \r
+  This function gets the current interrupt and recycled transmit buffer status \r
+  from the network interface. The interrupt status is returned as a bit mask in\r
+  InterruptStatus. If InterruptStatus is NULL, the interrupt status will not be\r
+  read. If TxBuf is not NULL, a recycled transmit buffer address will be retrieved.\r
+  If a recycled transmit buffer address is returned in TxBuf, then the buffer has\r
+  been successfully transmitted, and the status for that buffer is cleared. If\r
+  the status of the network interface is successfully collected, EFI_SUCCESS \r
+  will be returned. If the driver has not been initialized, EFI_DEVICE_ERROR will\r
+  be returned.\r
+\r
+  @param This            A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param InterruptStatus A pointer to the bit mask of the currently active \r
+                         interrupts (see "Related Definitions"). If this is NULL,\r
+                         the interrupt status will not be read from the device.\r
+                         If this is not NULL, the interrupt status will be read\r
+                         from the device. When the interrupt status is read, it \r
+                         will also be cleared. Clearing the transmit interrupt does \r
+                         not empty the recycled transmit buffer array.\r
+  @param TxBuf           Recycled transmit buffer address. The network interface\r
+                         will not transmit if its internal recycled transmit \r
+                         buffer array is full. Reading the transmit buffer does\r
+                         not clear the transmit interrupt. If this is NULL, then\r
+                         the transmit buffer status will not be read. If there \r
+                         are no transmit buffers to recycle and TxBuf is not NULL, \r
+                         TxBuf will be set to NULL.\r
+\r
+  @retval EFI_SUCCESS           The status of the network interface was retrieved.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network \r
+                                interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_get_status (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  OUT UINT32                     *InterruptStatusPtr OPTIONAL,\r
-  OUT VOID                       **TransmitBufferListPtr OPTIONAL\r
+SnpUndi32GetStatus (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINT32                     *InterruptStatus, OPTIONAL\r
+  OUT VOID                       **TxBuf           OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (InterruptStatusPtr == NULL && TransmitBufferListPtr == NULL) {\r
+  if (InterruptStatus == NULL && TxBuf == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  if (snp == NULL) {\r
+  if (Snp == NULL) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -180,7 +199,7 @@ snp_undi32_get_status (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_getstatus (snp, InterruptStatusPtr, TransmitBufferListPtr);\r
+  Status = PxeGetStatus (Snp, InterruptStatus, TxBuf);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 69154fc0c71e831396bd8b55b9754f90c168d52f..5337b1cc2eab3124a750e26695f9107f9a3ab22a 100644 (file)
@@ -1,68 +1,56 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+               Implementation of initializing a network adapter.\r
+\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  initialize.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-09 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 \r
 #include "Snp.h"\r
 \r
 **/\r
 \r
 \r
 #include "Snp.h"\r
 \r
-VOID\r
-EFIAPI\r
-SnpWaitForPacketNotify (\r
-  IN EFI_EVENT  Event,\r
-  IN VOID       *SnpPtr\r
-  );\r
-\r
-\r
 /**\r
   this routine calls undi to initialize the interface.\r
 \r
 /**\r
   this routine calls undi to initialize the interface.\r
 \r
-  @param  snp                   pointer to snp driver structure\r
-  @param  CableDetectFlag       Do/don't detect the cable (depending on what undi\r
-                                supports)\r
-\r
+  @param  Snp                   pointer to snp driver structure\r
+  @param  CableDetectFlag       Do/don't detect the cable (depending on what undi supports)\r
+  \r
+  @retval EFI_SUCCESS           UNDI is initialized successfully\r
+  @retval EFI_DEVICE_ERROR      UNDI could not be initialized\r
+  @retval Other                 other errors \r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_init (\r
-  SNP_DRIVER *snp,\r
+PxeInit (\r
+  SNP_DRIVER *Snp,\r
   UINT16     CableDetectFlag\r
   )\r
 {\r
   UINT16     CableDetectFlag\r
   )\r
 {\r
-  PXE_CPB_INITIALIZE  *cpb;\r
-  VOID                *addr;\r
+  PXE_CPB_INITIALIZE  *Cpb;\r
+  VOID                *Addr;\r
   EFI_STATUS          Status;\r
 \r
   EFI_STATUS          Status;\r
 \r
-  cpb = snp->cpb;\r
-  if (snp->tx_rx_bufsize != 0) {\r
-    Status = snp->IoFncs->AllocateBuffer (\r
-                            snp->IoFncs,\r
-                            AllocateAnyPages,\r
-                            EfiBootServicesData,\r
-                            SNP_MEM_PAGES (snp->tx_rx_bufsize),\r
-                            &addr,\r
-                            0\r
-                            );\r
+  Cpb = Snp->Cpb;\r
+  if (Snp->TxRxBufferSize != 0) {\r
+    Status = Snp->PciIo->AllocateBuffer (\r
+                           Snp->PciIo,\r
+                           AllocateAnyPages,\r
+                           EfiBootServicesData,\r
+                           SNP_MEM_PAGES (Snp->TxRxBufferSize),\r
+                           &Addr,\r
+                           0\r
+                           );\r
 \r
     if (Status != EFI_SUCCESS) {\r
       DEBUG (\r
         (EFI_D_ERROR,\r
 \r
     if (Status != EFI_SUCCESS) {\r
       DEBUG (\r
         (EFI_D_ERROR,\r
-        "\nsnp->pxe_init()  AllocateBuffer  %xh (%r)\n",\r
+        "\nSnp->PxeInit()  AllocateBuffer  %xh (%r)\n",\r
         Status,\r
         Status)\r
         );\r
         Status,\r
         Status)\r
         );\r
@@ -70,69 +58,69 @@ pxe_init (
       return Status;\r
     }\r
 \r
       return Status;\r
     }\r
 \r
-    ASSERT (addr);\r
+    ASSERT (Addr);\r
 \r
 \r
-    snp->tx_rx_buffer = addr;\r
+    Snp->TxRxBuffer = Addr;\r
   }\r
 \r
   }\r
 \r
-  cpb->MemoryAddr   = (UINT64)(UINTN) snp->tx_rx_buffer;\r
+  Cpb->MemoryAddr   = (UINT64)(UINTN) Snp->TxRxBuffer;\r
 \r
 \r
-  cpb->MemoryLength = snp->tx_rx_bufsize;\r
+  Cpb->MemoryLength = Snp->TxRxBufferSize;\r
 \r
   //\r
   // let UNDI decide/detect these values\r
   //\r
 \r
   //\r
   // let UNDI decide/detect these values\r
   //\r
-  cpb->LinkSpeed      = 0;\r
-  cpb->TxBufCnt       = 0;\r
-  cpb->TxBufSize      = 0;\r
-  cpb->RxBufCnt       = 0;\r
-  cpb->RxBufSize      = 0;\r
+  Cpb->LinkSpeed      = 0;\r
+  Cpb->TxBufCnt       = 0;\r
+  Cpb->TxBufSize      = 0;\r
+  Cpb->RxBufCnt       = 0;\r
+  Cpb->RxBufSize      = 0;\r
 \r
 \r
-  cpb->DuplexMode         = PXE_DUPLEX_DEFAULT;\r
+  Cpb->DuplexMode         = PXE_DUPLEX_DEFAULT;\r
 \r
 \r
-  cpb->LoopBackMode       = LOOPBACK_NORMAL;\r
+  Cpb->LoopBackMode       = LOOPBACK_NORMAL;\r
 \r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_INITIALIZE;\r
-  snp->cdb.OpFlags    = CableDetectFlag;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_INITIALIZE;\r
+  Snp->Cdb.OpFlags    = CableDetectFlag;\r
 \r
 \r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_INITIALIZE);\r
-  snp->cdb.DBsize     = sizeof (PXE_DB_INITIALIZE);\r
+  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_INITIALIZE);\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_INITIALIZE);\r
 \r
 \r
-  snp->cdb.CPBaddr    = (UINT64)(UINTN) snp->cpb;\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) snp->db;\r
+  Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Snp->Cpb;\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Snp->Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
 \r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.initialize()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.initialize()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode == PXE_STATCODE_SUCCESS) {\r
-    snp->mode.State = EfiSimpleNetworkInitialized;\r
+  if (Snp->Cdb.StatCode == PXE_STATCODE_SUCCESS) {\r
+    Snp->Mode.State = EfiSimpleNetworkInitialized;\r
 \r
     Status          = EFI_SUCCESS;\r
   } else {\r
     DEBUG (\r
       (EFI_D_WARN,\r
 \r
     Status          = EFI_SUCCESS;\r
   } else {\r
     DEBUG (\r
       (EFI_D_WARN,\r
-      "\nsnp->undi.initialize()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      "\nSnp->undi.initialize()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
       );\r
 \r
-    if (snp->tx_rx_buffer != NULL) {\r
-      snp->IoFncs->FreeBuffer (\r
-                    snp->IoFncs,\r
-                    SNP_MEM_PAGES (snp->tx_rx_bufsize),\r
-                    (VOID *) snp->tx_rx_buffer\r
+    if (Snp->TxRxBuffer != NULL) {\r
+      Snp->PciIo->FreeBuffer (\r
+                    Snp->PciIo,\r
+                    SNP_MEM_PAGES (Snp->TxRxBufferSize),\r
+                    (VOID *) Snp->TxRxBuffer\r
                     );\r
     }\r
 \r
                     );\r
     }\r
 \r
-    snp->tx_rx_buffer = NULL;\r
+    Snp->TxRxBuffer = NULL;\r
 \r
 \r
-    Status            = EFI_DEVICE_ERROR;\r
+    Status          = EFI_DEVICE_ERROR;\r
   }\r
 \r
   return Status;\r
   }\r
 \r
   return Status;\r
@@ -140,47 +128,64 @@ pxe_init (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for initializing the interface\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_initialize routine to actually do the undi initialization\r
-\r
-  @param  this                  context pointer\r
-  @param  extra_rx_buffer_size  optional parameter, indicates extra space for\r
-                                rx_buffers\r
-  @param  extra_tx_buffer_size  optional parameter, indicates extra space for\r
-                                tx_buffers\r
-\r
+  Resets a network adapter and allocates the transmit and receive buffers \r
+  required by the network interface; optionally, also requests allocation of \r
+  additional transmit and receive buffers.\r
+\r
+  This function allocates the transmit and receive buffers required by the network\r
+  interface. If this allocation fails, then EFI_OUT_OF_RESOURCES is returned.\r
+  If the allocation succeeds and the network interface is successfully initialized,\r
+  then EFI_SUCCESS will be returned.\r
+\r
+  @param This               A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @param ExtraRxBufferSize  The size, in bytes, of the extra receive buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the \r
+                            extra buffer, and the caller will not know if it is \r
+                            actually being used.\r
+  @param ExtraTxBufferSize  The size, in bytes, of the extra transmit buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the\r
+                            extra buffer, and the caller will not know if it is\r
+                            actually being used.\r
+\r
+  @retval EFI_SUCCESS           The network interface was initialized.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory for the transmit and\r
+                                receive buffers.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       The increased buffer size feature is not supported.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_initialize (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
-  IN UINTN                       extra_rx_buffer_size OPTIONAL,\r
-  IN UINTN                       extra_tx_buffer_size OPTIONAL\r
+SnpUndi32Initialize (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINTN                       ExtraRxBufferSize OPTIONAL,\r
+  IN UINTN                       ExtraTxBufferSize OPTIONAL\r
   )\r
 {\r
   EFI_STATUS  EfiStatus;\r
   )\r
 {\r
   EFI_STATUS  EfiStatus;\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
 \r
   EFI_TPL     OldTpl;\r
 \r
-  //\r
-  //\r
-  //\r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  if (snp == NULL) {\r
+  if (Snp == NULL) {\r
     EfiStatus = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
     EfiStatus = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
@@ -197,45 +202,45 @@ snp_undi32_initialize (
                     EVT_NOTIFY_WAIT,\r
                     TPL_NOTIFY,\r
                     &SnpWaitForPacketNotify,\r
                     EVT_NOTIFY_WAIT,\r
                     TPL_NOTIFY,\r
                     &SnpWaitForPacketNotify,\r
-                    snp,\r
-                    &snp->snp.WaitForPacket\r
+                    Snp,\r
+                    &Snp->Snp.WaitForPacket\r
                     );\r
 \r
   if (EFI_ERROR (EfiStatus)) {\r
                     );\r
 \r
   if (EFI_ERROR (EfiStatus)) {\r
-    snp->snp.WaitForPacket = NULL;\r
+    Snp->Snp.WaitForPacket = NULL;\r
     EfiStatus = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
   //\r
   //\r
   //\r
     EfiStatus = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
   //\r
   //\r
   //\r
-  snp->mode.MCastFilterCount      = 0;\r
-  snp->mode.ReceiveFilterSetting  = 0;\r
-  ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);\r
+  Snp->Mode.MCastFilterCount      = 0;\r
+  Snp->Mode.ReceiveFilterSetting  = 0;\r
+  ZeroMem (Snp->Mode.MCastFilter, sizeof Snp->Mode.MCastFilter);\r
   CopyMem (\r
   CopyMem (\r
-    &snp->mode.CurrentAddress,\r
-    &snp->mode.PermanentAddress,\r
+    &Snp->Mode.CurrentAddress,\r
+    &Snp->Mode.PermanentAddress,\r
     sizeof (EFI_MAC_ADDRESS)\r
     );\r
 \r
   //\r
   // Compute tx/rx buffer sizes based on UNDI init info and parameters.\r
   //\r
     sizeof (EFI_MAC_ADDRESS)\r
     );\r
 \r
   //\r
   // Compute tx/rx buffer sizes based on UNDI init info and parameters.\r
   //\r
-  snp->tx_rx_bufsize = (UINT32) (snp->init_info.MemoryRequired + extra_rx_buffer_size + extra_tx_buffer_size);\r
+  Snp->TxRxBufferSize = (UINT32) (Snp->InitInfo.MemoryRequired + ExtraRxBufferSize + ExtraTxBufferSize);\r
 \r
 \r
-  if (snp->mode.MediaPresentSupported) {\r
-    if (pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) == EFI_SUCCESS) {\r
-      snp->mode.MediaPresent = TRUE;\r
+  if (Snp->Mode.MediaPresentSupported) {\r
+    if (PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) == EFI_SUCCESS) {\r
+      Snp->Mode.MediaPresent = TRUE;\r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
-  snp->mode.MediaPresent  = FALSE;\r
+  Snp->Mode.MediaPresent  = FALSE;\r
 \r
 \r
-  EfiStatus               = pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);\r
+  EfiStatus               = PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);\r
 \r
   if (EFI_ERROR (EfiStatus)) {\r
 \r
   if (EFI_ERROR (EfiStatus)) {\r
-    gBS->CloseEvent (snp->snp.WaitForPacket);\r
+    gBS->CloseEvent (Snp->Snp.WaitForPacket);\r
   }\r
 \r
 ON_EXIT:\r
   }\r
 \r
 ON_EXIT:\r
index 6c5bf15e8b4cbede41271ebfceaf8c59c2797969..00c80eb95f179c353804a2f10a257348161d91a8 100644 (file)
@@ -1,29 +1,24 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+               Implementation of converting an multicast IP address to multicast HW MAC\r
+               address.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  mcast_ip_to_mac.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-17 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 /**\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 /**\r
-  this routine calls undi to convert an multicast IP address to a MAC address\r
+  this routine calls undi to convert an multicast IP address to a MAC address.\r
 \r
 \r
-  @param  snp   pointer to snp driver structure\r
+  @param  Snp   pointer to snp driver structure\r
   @param  IPv6  flag to indicate if this is an ipv6 address\r
   @param  IP    multicast IP address\r
   @param  MAC   pointer to hold the return MAC address\r
   @param  IPv6  flag to indicate if this is an ipv6 address\r
   @param  IP    multicast IP address\r
   @param  MAC   pointer to hold the return MAC address\r
@@ -31,41 +26,41 @@ Revision history:
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_ip2mac (\r
-  IN SNP_DRIVER          *snp,\r
+PxeIp2Mac (\r
+  IN SNP_DRIVER          *Snp,\r
   IN BOOLEAN             IPv6,\r
   IN EFI_IP_ADDRESS      *IP,\r
   IN OUT EFI_MAC_ADDRESS *MAC\r
   )\r
 {\r
   IN BOOLEAN             IPv6,\r
   IN EFI_IP_ADDRESS      *IP,\r
   IN OUT EFI_MAC_ADDRESS *MAC\r
   )\r
 {\r
-  PXE_CPB_MCAST_IP_TO_MAC *cpb;\r
-  PXE_DB_MCAST_IP_TO_MAC  *db;\r
+  PXE_CPB_MCAST_IP_TO_MAC *Cpb;\r
+  PXE_DB_MCAST_IP_TO_MAC  *Db;\r
 \r
 \r
-  cpb                 = snp->cpb;\r
-  db                  = snp->db;\r
-  snp->cdb.OpCode     = PXE_OPCODE_MCAST_IP_TO_MAC;\r
-  snp->cdb.OpFlags    = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);\r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_MCAST_IP_TO_MAC);\r
-  snp->cdb.DBsize     = sizeof (PXE_DB_MCAST_IP_TO_MAC);\r
+  Cpb                 = Snp->Cpb;\r
+  Db                  = Snp->Db;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_MCAST_IP_TO_MAC;\r
+  Snp->Cdb.OpFlags    = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);\r
+  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_MCAST_IP_TO_MAC);\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_MCAST_IP_TO_MAC);\r
 \r
 \r
-  snp->cdb.CPBaddr    = (UINT64)(UINTN) cpb;\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
 \r
-  CopyMem (&cpb->IP, IP, sizeof (PXE_IP_ADDR));\r
+  CopyMem (&Cpb->IP, IP, sizeof (PXE_IP_ADDR));\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.mcast_ip_to_mac()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.mcast_ip_to_mac()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
@@ -75,9 +70,9 @@ pxe_ip2mac (
   case PXE_STATCODE_UNSUPPORTED:\r
     DEBUG (\r
       (EFI_D_NET,\r
   case PXE_STATCODE_UNSUPPORTED:\r
     DEBUG (\r
       (EFI_D_NET,\r
-      "\nsnp->undi.mcast_ip_to_mac()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      "\nSnp->undi.mcast_ip_to_mac()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
     return EFI_UNSUPPORTED;\r
 \r
       );\r
     return EFI_UNSUPPORTED;\r
 \r
@@ -88,49 +83,64 @@ pxe_ip2mac (
     //\r
     DEBUG (\r
       (EFI_D_NET,\r
     //\r
     DEBUG (\r
       (EFI_D_NET,\r
-      "\nsnp->undi.mcast_ip_to_mac()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      "\nSnp->undi.mcast_ip_to_mac()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  CopyMem (MAC, &db->MAC, sizeof (PXE_MAC_ADDR));\r
+  CopyMem (MAC, &Db->MAC, sizeof (PXE_MAC_ADDR));\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for converting a multicast IP address to\r
-  a MAC address.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_ip2mac routine to actually do the conversion\r
-\r
-  @param  this  context pointer\r
-  @param  IPv6  flag to indicate if this is an ipv6 address\r
-  @param  IP    multicast IP address\r
-  @param  MAC   pointer to hold the return MAC address\r
-\r
+  Converts a multicast IP address to a multicast HW MAC address.\r
+  \r
+  This function converts a multicast IP address to a multicast HW MAC address \r
+  for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will\r
+  be returned.\r
+\r
+  @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460].\r
+              Set to FALSE if the multicast IP address is IPv4 [RFC 791]. \r
+  @param IP   The multicast IP address that is to be converted to a multicast \r
+              HW MAC address.\r
+  @param MAC  The multicast HW MAC address that is to be generated from IP.\r
+\r
+  @retval EFI_SUCCESS           The multicast IP address was mapped to the\r
+                                multicast HW MAC address.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not \r
+                                been started by calling Start().\r
+  @retval EFI_INVALID_PARAMETER IP is NULL.\r
+  @retval EFI_INVALID_PARAMETER MAC is NULL.\r
+  @retval EFI_INVALID_PARAMETER IP does not point to a valid IPv4 or IPv6 \r
+                                multicast address.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_UNSUPPORTED       IPv6 is TRUE and the implementation does not \r
+                                support IPv6 multicast to MAC address conversion.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_mcast_ip_to_mac (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
+SnpUndi32McastIpToMac (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     IPv6,\r
   IN EFI_IP_ADDRESS              *IP,\r
   OUT EFI_MAC_ADDRESS            *MAC\r
   )\r
 {\r
   IN BOOLEAN                     IPv6,\r
   IN EFI_IP_ADDRESS              *IP,\r
   OUT EFI_MAC_ADDRESS            *MAC\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   //\r
   // Get pointer to SNP driver instance for *this.\r
   //\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   //\r
   // Get pointer to SNP driver instance for *this.\r
   //\r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -138,11 +148,11 @@ snp_undi32_mcast_ip_to_mac (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -155,7 +165,7 @@ snp_undi32_mcast_ip_to_mac (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_ip2mac (snp, IPv6, IP, MAC);\r
+  Status = PxeIp2Mac (Snp, IPv6, IP, MAC);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 19d43be8bdb92821a194f0e1f43bd011ce0da36a..4b9259f87a0d48bb51155504e085e5a7ba508e13 100644 (file)
@@ -1,21 +1,16 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+               Implementation of reading and writing operations on the NVRAM device\r
+               attached to a network interface.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  nvdata.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-03 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 **/\r
 \r
 #include "Snp.h"\r
@@ -24,47 +19,47 @@ Revision history:
 /**\r
   This routine calls Undi to read the desired number of eeprom bytes.\r
 \r
 /**\r
   This routine calls Undi to read the desired number of eeprom bytes.\r
 \r
-  @param  snp          pointer to the snp driver structure\r
-  @param  RegOffset    eeprom register value relative to the base address\r
-  @param  NumBytes     number of bytes to read\r
-  @param  BufferPtr    pointer where to read into\r
+  @param  Snp          pointer to the snp driver structure\r
+  @param  Offset       eeprom register value relative to the base address\r
+  @param  BufferSize   number of bytes to read\r
+  @param  Buffer       pointer where to read into\r
 \r
 \r
 **/\r
 EFI_STATUS\r
 \r
 \r
 **/\r
 EFI_STATUS\r
-pxe_nvdata_read (\r
-  IN SNP_DRIVER *snp,\r
-  IN UINTN      RegOffset,\r
-  IN UINTN      NumBytes,\r
-  IN OUT VOID   *BufferPtr\r
+PxeNvDataRead (\r
+  IN SNP_DRIVER *Snp,\r
+  IN UINTN      Offset,\r
+  IN UINTN      BufferSize,\r
+  IN OUT VOID   *Buffer\r
   )\r
 {\r
   )\r
 {\r
-  PXE_DB_NVDATA *db;\r
+  PXE_DB_NVDATA *Db;\r
 \r
 \r
-  db                  = snp->db;\r
-  snp->cdb.OpCode     = PXE_OPCODE_NVDATA;\r
+  Db                  = Snp->Db;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_NVDATA;\r
 \r
 \r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NVDATA_READ;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NVDATA_READ;\r
 \r
 \r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
 \r
 \r
-  snp->cdb.DBsize     = sizeof (PXE_DB_NVDATA);\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_NVDATA);\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.nvdata ()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.nvdata ()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
@@ -72,8 +67,8 @@ pxe_nvdata_read (
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.nvdata()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.nvdata()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_UNSUPPORTED;\r
       );\r
 \r
     return EFI_UNSUPPORTED;\r
@@ -82,61 +77,99 @@ pxe_nvdata_read (
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.nvdata()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.nvdata()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  CopyMem (BufferPtr, db->Data.Byte + RegOffset, NumBytes);\r
+  CopyMem (Buffer, Db->Data.Byte + Offset, BufferSize);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is an interface call provided by SNP.\r
+  Performs read and write operations on the NVRAM device attached to a network \r
+  interface.\r
+  \r
+  This function performs read and write operations on the NVRAM device attached \r
+  to a network interface. If ReadWrite is TRUE, a read operation is performed.\r
+  If ReadWrite is FALSE, a write operation is performed. Offset specifies the \r
+  byte offset at which to start either operation. Offset must be a multiple of \r
+  NvRamAccessSize , and it must have a value between zero and NvRamSize. \r
+  BufferSize specifies the length of the read or write operation. BufferSize must\r
+  also be a multiple of NvRamAccessSize, and Offset + BufferSize must not exceed\r
+  NvRamSize. \r
+  If any of the above conditions is not met, then EFI_INVALID_PARAMETER will be \r
+  returned. \r
+  If all the conditions are met and the operation is "read," the NVRAM device \r
+  attached to the network interface will be read into Buffer and EFI_SUCCESS \r
+  will be returned. If this is a write operation, the contents of Buffer will be\r
+  used to update the contents of the NVRAM device attached to the network \r
+  interface and EFI_SUCCESS will be returned.\r
+  \r
   It does the basic checking on the input parameters and retrieves snp structure\r
   and then calls the read_nvdata() call which does the actual reading\r
 \r
   It does the basic checking on the input parameters and retrieves snp structure\r
   and then calls the read_nvdata() call which does the actual reading\r
 \r
-  @param  this         context pointer\r
-  @param  ReadOrWrite  true for reading and false for writing\r
-  @param  RegOffset    eeprom register relative to the base\r
-  @param  NumBytes     how many bytes to read\r
-  @param  BufferPtr    address of memory to read into\r
-\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param ReadWrite  TRUE for read operations, FALSE for write operations.\r
+  @param Offset     Byte offset in the NVRAM device at which to start the read or \r
+                    write operation. This must be a multiple of NvRamAccessSize \r
+                    and less than NvRamSize. (See EFI_SIMPLE_NETWORK_MODE)  \r
+  @param BufferSize The number of bytes to read or write from the NVRAM device. \r
+                    This must also be a multiple of NvramAccessSize.\r
+  @param Buffer     A pointer to the data buffer.\r
+\r
+  @retval EFI_SUCCESS           The NVRAM access was performed.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                * The This parameter is NULL \r
+                                * The This parameter does not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL  structure\r
+                                * The Offset parameter is not a multiple of \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+                                * The Offset parameter is not less than \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamSize\r
+                                * The BufferSize parameter is not a multiple of \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+                                * The Buffer parameter is NULL\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network \r
+                                interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network\r
+                                interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_nvdata (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
-  IN BOOLEAN                     ReadOrWrite,\r
-  IN UINTN                       RegOffset,\r
-  IN UINTN                       NumBytes,\r
-  IN OUT VOID                    *BufferPtr\r
+SnpUndi32NvData (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     ReadWrite,\r
+  IN UINTN                       Offset,\r
+  IN UINTN                       BufferSize,\r
+  IN OUT VOID                    *Buffer\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   //\r
   // Get pointer to SNP driver instance for *this.\r
   //\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   //\r
   // Get pointer to SNP driver instance for *this.\r
   //\r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -151,19 +184,19 @@ snp_undi32_nvdata (
   //\r
   // Return error if non-volatile memory variables are not valid.\r
   //\r
   //\r
   // Return error if non-volatile memory variables are not valid.\r
   //\r
-  if (snp->mode.NvRamSize == 0 || snp->mode.NvRamAccessSize == 0) {\r
+  if (Snp->Mode.NvRamSize == 0 || Snp->Mode.NvRamAccessSize == 0) {\r
     Status = EFI_UNSUPPORTED;\r
     goto ON_EXIT;\r
   }\r
   //\r
   // Check for invalid parameter combinations.\r
   //\r
     Status = EFI_UNSUPPORTED;\r
     goto ON_EXIT;\r
   }\r
   //\r
   // Check for invalid parameter combinations.\r
   //\r
-  if ((NumBytes == 0) ||\r
-      (BufferPtr == NULL) ||\r
-      (RegOffset >= snp->mode.NvRamSize) ||\r
-      (RegOffset + NumBytes > snp->mode.NvRamSize) ||\r
-      (NumBytes % snp->mode.NvRamAccessSize != 0) ||\r
-      (RegOffset % snp->mode.NvRamAccessSize != 0)\r
+  if ((BufferSize == 0) ||\r
+      (Buffer == NULL) ||\r
+      (Offset >= Snp->Mode.NvRamSize) ||\r
+      (Offset + BufferSize > Snp->Mode.NvRamSize) ||\r
+      (BufferSize % Snp->Mode.NvRamAccessSize != 0) ||\r
+      (Offset % Snp->Mode.NvRamAccessSize != 0)\r
       ) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
       ) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
@@ -171,10 +204,10 @@ snp_undi32_nvdata (
   //\r
   // check the implementation flags of undi if we can write the nvdata!\r
   //\r
   //\r
   // check the implementation flags of undi if we can write the nvdata!\r
   //\r
-  if (!ReadOrWrite) {\r
+  if (!ReadWrite) {\r
     Status = EFI_UNSUPPORTED;\r
   } else {\r
     Status = EFI_UNSUPPORTED;\r
   } else {\r
-    Status = pxe_nvdata_read (snp, RegOffset, NumBytes, BufferPtr);\r
+    Status = PxeNvDataRead (Snp, Offset, BufferSize, Buffer);\r
   }\r
 \r
 ON_EXIT:\r
   }\r
 \r
 ON_EXIT:\r
index 48c47f15e0556ddc0e6768c1b0c5707e3ee259ed..bfabe11aa5e61e63348a90ca09f33e4ae03a8c4c 100644 (file)
@@ -1,21 +1,15 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+               Implementation of receiving a packet from a network interface.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-    receive.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-    2000-Feb-03 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 \r
 **/\r
 \r
 \r
@@ -25,66 +19,66 @@ Revision history:
   this routine calls undi to receive a packet and fills in the data in the\r
   input pointers!\r
 \r
   this routine calls undi to receive a packet and fills in the data in the\r
   input pointers!\r
 \r
-  @param  snp                 pointer to snp driver structure\r
-  @param  BufferPtr           pointer to the memory for the received data\r
-  @param  BuffSizePtr         is a pointer to the length of the buffer on entry and\r
+  @param  Snp                 pointer to snp driver structure\r
+  @param  Buffer           pointer to the memory for the received data\r
+  @param  BufferSize         is a pointer to the length of the buffer on entry and\r
                               contains the length of the received data on return\r
                               contains the length of the received data on return\r
-  @param  HeaderSizePtr       pointer to the header portion of the data received.\r
-  @param  SourceAddrPtr       optional parameter, is a pointer to contain the\r
+  @param  HeaderSize       pointer to the header portion of the data received.\r
+  @param  SrcAddr       optional parameter, is a pointer to contain the\r
                               source ethernet address on return\r
                               source ethernet address on return\r
-  @param  DestinationAddrPtr  optional parameter, is a pointer to contain the\r
+  @param  DestAddr  optional parameter, is a pointer to contain the\r
                               destination ethernet address on return\r
                               destination ethernet address on return\r
-  @param  ProtocolPtr         optional parameter, is a pointer to contain the\r
+  @param  Protocol         optional parameter, is a pointer to contain the\r
                               protocol type from the ethernet header on return\r
 \r
 \r
 **/\r
 EFI_STATUS\r
                               protocol type from the ethernet header on return\r
 \r
 \r
 **/\r
 EFI_STATUS\r
-pxe_receive (\r
-  SNP_DRIVER      *snp,\r
-  VOID            *BufferPtr,\r
-  UINTN           *BuffSizePtr,\r
-  UINTN           *HeaderSizePtr,\r
-  EFI_MAC_ADDRESS *SourceAddrPtr,\r
-  EFI_MAC_ADDRESS *DestinationAddrPtr,\r
-  UINT16          *ProtocolPtr\r
+PxeReceive (\r
+  SNP_DRIVER      *Snp,\r
+  VOID            *Buffer,\r
+  UINTN           *BufferSize,\r
+  UINTN           *HeaderSize,\r
+  EFI_MAC_ADDRESS *SrcAddr,\r
+  EFI_MAC_ADDRESS *DestAddr,\r
+  UINT16          *Protocol\r
   )\r
 {\r
   )\r
 {\r
-  PXE_CPB_RECEIVE *cpb;\r
-  PXE_DB_RECEIVE  *db;\r
-  UINTN           buf_size;\r
+  PXE_CPB_RECEIVE *Cpb;\r
+  PXE_DB_RECEIVE  *Db;\r
+  UINTN           BuffSize;\r
 \r
 \r
-  cpb       = snp->cpb;\r
-  db        = snp->db;\r
-  buf_size  = *BuffSizePtr;\r
+  Cpb       = Snp->Cpb;\r
+  Db        = Snp->Db;\r
+  BuffSize  = *BufferSize;\r
 \r
 \r
-  cpb->BufferAddr = (UINT64)(UINTN) BufferPtr;\r
-  cpb->BufferLen  = (UINT32) *BuffSizePtr;\r
+  Cpb->BufferAddr = (UINT64)(UINTN) Buffer;\r
+  Cpb->BufferLen  = (UINT32) *BufferSize;\r
 \r
 \r
-  cpb->reserved       = 0;\r
+  Cpb->reserved       = 0;\r
 \r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_RECEIVE;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_RECEIVE;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
 \r
 \r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_RECEIVE);\r
-  snp->cdb.CPBaddr    = (UINT64)(UINTN) cpb;\r
+  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_RECEIVE);\r
+  Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
 \r
 \r
-  snp->cdb.DBsize     = sizeof (PXE_DB_RECEIVE);\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_RECEIVE);\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive ()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive ()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
@@ -92,8 +86,8 @@ pxe_receive (
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.receive ()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_NET,\r
       "\nsnp->undi.receive ()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_NOT_READY;\r
       );\r
 \r
     return EFI_NOT_READY;\r
@@ -102,80 +96,107 @@ pxe_receive (
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  *BuffSizePtr = db->FrameLen;\r
+  *BufferSize = Db->FrameLen;\r
 \r
 \r
-  if (HeaderSizePtr != NULL) {\r
-    *HeaderSizePtr = db->MediaHeaderLen;\r
+  if (HeaderSize != NULL) {\r
+    *HeaderSize = Db->MediaHeaderLen;\r
   }\r
 \r
   }\r
 \r
-  if (SourceAddrPtr != NULL) {\r
-    CopyMem (SourceAddrPtr, &db->SrcAddr, snp->mode.HwAddressSize);\r
+  if (SrcAddr != NULL) {\r
+    CopyMem (SrcAddr, &Db->SrcAddr, Snp->Mode.HwAddressSize);\r
   }\r
 \r
   }\r
 \r
-  if (DestinationAddrPtr != NULL) {\r
-    CopyMem (DestinationAddrPtr, &db->DestAddr, snp->mode.HwAddressSize);\r
+  if (DestAddr != NULL) {\r
+    CopyMem (DestAddr, &Db->DestAddr, Snp->Mode.HwAddressSize);\r
   }\r
 \r
   }\r
 \r
-  if (ProtocolPtr != NULL) {\r
-    *ProtocolPtr = (UINT16) PXE_SWAP_UINT16 (db->Protocol); /*  we need to do the byte swapping */\r
+  if (Protocol != NULL) {\r
+    *Protocol = (UINT16) PXE_SWAP_UINT16 (Db->Protocol); /*  we need to do the byte swapping */\r
   }\r
 \r
   }\r
 \r
-  return (*BuffSizePtr <= buf_size) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;\r
+  return (*BufferSize <= BuffSize) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;\r
 }\r
 \r
 }\r
 \r
-\r
 /**\r
 /**\r
-  This is the SNP interface routine for receiving network data.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_receive routine to actually do the receive!\r
-\r
-  @param  this                context pointer\r
-  @param  HeaderSizePtr       optional parameter and is a pointer to the header\r
-                              portion of the data received.\r
-  @param  BuffSizePtr         is a pointer to the length of the buffer on entry and\r
-                              contains the length of the received data on return\r
-  @param  BufferPtr           pointer to the memory for the received data\r
-  @param  SourceAddrPtr       optional parameter, is a pointer to contain the\r
-                              source ethernet address on return\r
-  @param  DestinationAddrPtr  optional parameter, is a pointer to contain the\r
-                              destination ethernet address on return\r
-  @param  ProtocolPtr         optional parameter, is a pointer to contain the\r
-                              protocol type from the ethernet header on return\r
-\r
+  Receives a packet from a network interface.\r
+\r
+  This function retrieves one packet from the receive queue of a network interface.\r
+  If there are no packets on the receive queue, then EFI_NOT_READY will be \r
+  returned. If there is a packet on the receive queue, and the size of the packet\r
+  is smaller than BufferSize, then the contents of the packet will be placed in\r
+  Buffer, and BufferSize will be updated with the actual size of the packet.\r
+  In addition, if SrcAddr, DestAddr, and Protocol are not NULL, then these values\r
+  will be extracted from the media header and returned. EFI_SUCCESS will be \r
+  returned if a packet was successfully received.\r
+  If BufferSize is smaller than the received packet, then the size of the receive\r
+  packet will be placed in BufferSize and EFI_BUFFER_TOO_SMALL will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param HeaderSize The size, in bytes, of the media header received on the network \r
+                    interface. If this parameter is NULL, then the media header size \r
+                    will not be returned.\r
+  @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in \r
+                    bytes, of the packet that was received on the network interface.\r
+  @param Buffer     A pointer to the data buffer to receive both the media\r
+                    header and the data.\r
+  @param SrcAddr    The source HW MAC address. If this parameter is NULL, the HW\r
+                    MAC source address will not be extracted from the media header. \r
+  @param DestAddr   The destination HW MAC address. If this parameter is NULL, \r
+                    the HW MAC destination address will not be extracted from \r
+                    the media header.\r
+  @param Protocol   The media header type. If this parameter is NULL, then the \r
+                    protocol will not be extracted from the media header. See \r
+                    RFC 1700 section "Ether Types" for examples.\r
+\r
+  @retval EFI_SUCCESS           The received data was stored in Buffer, and \r
+                                BufferSize has been updated to the number of \r
+                                bytes received.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_NOT_READY         No packets have been received on the network interface.\r
+  @retval EFI_BUFFER_TOO_SMALL  BufferSize is too small for the received packets. \r
+                                BufferSize has been updated to the required size.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                * The This parameter is NULL\r
+                                * The This parameter does not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+                                * The BufferSize parameter is NULL\r
+                                * The Buffer parameter is NULL\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_receive (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  OUT UINTN                      *HeaderSizePtr OPTIONAL,\r
-  IN OUT UINTN                   *BuffSizePtr,\r
-  OUT VOID                       *BufferPtr,\r
-  OUT EFI_MAC_ADDRESS            * SourceAddrPtr OPTIONAL,\r
-  OUT EFI_MAC_ADDRESS            * DestinationAddrPtr OPTIONAL,\r
-  OUT UINT16                     *ProtocolPtr OPTIONAL\r
+SnpUndi32Receive (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINTN                      *HeaderSize OPTIONAL,\r
+  IN OUT UINTN                   *BufferSize,\r
+  OUT VOID                       *Buffer,\r
+  OUT EFI_MAC_ADDRESS            *SrcAddr OPTIONAL,\r
+  OUT EFI_MAC_ADDRESS            *DestAddr OPTIONAL,\r
+  OUT UINT16                     *Protocol OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -188,24 +209,24 @@ snp_undi32_receive (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  if ((BuffSizePtr == NULL) || (BufferPtr == NULL)) {\r
+  if ((BufferSize == NULL) || (Buffer == NULL)) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if (!snp->mode.ReceiveFilterSetting) {\r
+  if (!Snp->Mode.ReceiveFilterSetting) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_receive (\r
-             snp,\r
-             BufferPtr,\r
-             BuffSizePtr,\r
-             HeaderSizePtr,\r
-             SourceAddrPtr,\r
-             DestinationAddrPtr,\r
-             ProtocolPtr\r
+  Status = PxeReceive (\r
+             Snp,\r
+             Buffer,\r
+             BufferSize,\r
+             HeaderSize,\r
+             SrcAddr,\r
+             DestAddr,\r
+             Protocol\r
              );\r
 \r
 ON_EXIT:\r
              );\r
 \r
 ON_EXIT:\r
index 343b516d9e09d2b9ae8d7b71b8f9bb8b03a24a7a..db116330cd15207fcc04e61b727e6c5105bff3a3 100644 (file)
@@ -25,7 +25,7 @@ Revision history:
 /**\r
   this routine calls undi to enable the receive filters.\r
 \r
 /**\r
   this routine calls undi to enable the receive filters.\r
 \r
-  @param  snp                pointer to snp driver structure\r
+  @param  Snp                pointer to snp driver structure\r
   @param  EnableFlags        bit mask for enabling the receive filters\r
   @param  MCastAddressCount  multicast address count for a new multicast address\r
                              list\r
   @param  EnableFlags        bit mask for enabling the receive filters\r
   @param  MCastAddressCount  multicast address count for a new multicast address\r
                              list\r
@@ -34,68 +34,68 @@ Revision history:
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_rcvfilter_enable (\r
-  SNP_DRIVER      *snp,\r
+PxeRecvFilterEnable (\r
+  SNP_DRIVER      *Snp,\r
   UINT32          EnableFlags,\r
   UINTN           MCastAddressCount,\r
   EFI_MAC_ADDRESS *MCastAddressList\r
   )\r
 {\r
   UINT32          EnableFlags,\r
   UINTN           MCastAddressCount,\r
   EFI_MAC_ADDRESS *MCastAddressList\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_RECEIVE_FILTERS;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_RECEIVE_FILTER_ENABLE;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_RECEIVE_FILTERS;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_RECEIVE_FILTER_ENABLE;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {\r
   }\r
 \r
   if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;\r
   }\r
 \r
   if (MCastAddressCount != 0) {\r
   }\r
 \r
   if (MCastAddressCount != 0) {\r
-    snp->cdb.CPBsize  = (UINT16) (MCastAddressCount * sizeof (EFI_MAC_ADDRESS));\r
-    snp->cdb.CPBaddr  = (UINT64)(UINTN) snp->cpb;\r
-    CopyMem (snp->cpb, MCastAddressList, snp->cdb.CPBsize);\r
+    Snp->Cdb.CPBsize  = (UINT16) (MCastAddressCount * sizeof (EFI_MAC_ADDRESS));\r
+    Snp->Cdb.CPBaddr  = (UINT64)(UINTN)Snp->Cpb;\r
+    CopyMem (Snp->Cpb, MCastAddressList, Snp->Cdb.CPBsize);\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != EFI_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != EFI_SUCCESS) {\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
       );\r
 \r
-    switch (snp->cdb.StatCode) {\r
+    switch (Snp->Cdb.StatCode) {\r
     case PXE_STATCODE_INVALID_CDB:\r
     case PXE_STATCODE_INVALID_CPB:\r
     case PXE_STATCODE_INVALID_PARAMETER:\r
     case PXE_STATCODE_INVALID_CDB:\r
     case PXE_STATCODE_INVALID_CPB:\r
     case PXE_STATCODE_INVALID_PARAMETER:\r
@@ -114,70 +114,70 @@ pxe_rcvfilter_enable (
 /**\r
   this routine calls undi to disable the receive filters.\r
 \r
 /**\r
   this routine calls undi to disable the receive filters.\r
 \r
-  @param  snp                pointer to snp driver structure\r
+  @param  Snp                pointer to snp driver structure\r
   @param  DisableFlags       bit mask for disabling the receive filters\r
   @param  ResetMCastList     boolean flag to reset/delete the multicast filter list\r
 \r
 \r
 **/\r
 EFI_STATUS\r
   @param  DisableFlags       bit mask for disabling the receive filters\r
   @param  ResetMCastList     boolean flag to reset/delete the multicast filter list\r
 \r
 \r
 **/\r
 EFI_STATUS\r
-pxe_rcvfilter_disable (\r
-  SNP_DRIVER *snp,\r
+PxeRecvFilterDisable (\r
+  SNP_DRIVER *Snp,\r
   UINT32     DisableFlags,\r
   BOOLEAN    ResetMCastList\r
   )\r
 {\r
   UINT32     DisableFlags,\r
   BOOLEAN    ResetMCastList\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_RECEIVE_FILTERS;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
-\r
-  snp->cdb.OpFlags    = (UINT16) (DisableFlags ? PXE_OPFLAGS_RECEIVE_FILTER_DISABLE : PXE_OPFLAGS_NOT_USED);\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_RECEIVE_FILTERS;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+\r
+  Snp->Cdb.OpFlags    = (UINT16) ((DisableFlags != 0) ? PXE_OPFLAGS_RECEIVE_FILTER_DISABLE : PXE_OPFLAGS_NOT_USED);\r
 \r
   if (ResetMCastList) {\r
 \r
   if (ResetMCastList) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST;\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {\r
   }\r
 \r
   if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {\r
-    snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;\r
+    Snp->Cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != EFI_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != EFI_SUCCESS) {\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -189,45 +189,45 @@ pxe_rcvfilter_disable (
 /**\r
   this routine calls undi to read the receive filters.\r
 \r
 /**\r
   this routine calls undi to read the receive filters.\r
 \r
-  @param  snp                pointer to snp driver structure\r
+  @param  Snp                pointer to snp driver structure\r
 \r
 \r
 **/\r
 EFI_STATUS\r
 \r
 \r
 **/\r
 EFI_STATUS\r
-pxe_rcvfilter_read (\r
-  SNP_DRIVER *snp\r
+PxeRecvFilterRead (\r
+  SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  snp->cdb.OpCode   = PXE_OPCODE_RECEIVE_FILTERS;\r
-  snp->cdb.OpFlags  = PXE_OPFLAGS_RECEIVE_FILTER_READ;\r
-  snp->cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize   = (UINT16) (snp->mode.MaxMCastFilterCount * sizeof (EFI_MAC_ADDRESS));\r
-  snp->cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
-  if (snp->cdb.DBsize == 0) {\r
-    snp->cdb.DBaddr = (UINT64)(UINTN) NULL;\r
+  Snp->Cdb.OpCode   = PXE_OPCODE_RECEIVE_FILTERS;\r
+  Snp->Cdb.OpFlags  = PXE_OPFLAGS_RECEIVE_FILTER_READ;\r
+  Snp->Cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize   = (UINT16) (Snp->Mode.MaxMCastFilterCount * sizeof (EFI_MAC_ADDRESS));\r
+  Snp->Cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
+  if (Snp->Cdb.DBsize == 0) {\r
+    Snp->Cdb.DBaddr = (UINT64)(UINTN) NULL;\r
   } else {\r
   } else {\r
-    snp->cdb.DBaddr = (UINT64)(UINTN) snp->db;\r
-    ZeroMem (snp->db, snp->cdb.DBsize);\r
+    Snp->Cdb.DBaddr = (UINT64)(UINTN) Snp->Db;\r
+    ZeroMem (Snp->Db, Snp->Cdb.DBsize);\r
   }\r
 \r
   }\r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
 \r
   DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != EFI_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != EFI_SUCCESS) {\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
     //\r
     // UNDI command failed.  Return UNDI status to caller.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.receive_filters()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -235,29 +235,29 @@ pxe_rcvfilter_read (
   //\r
   // Convert UNDI32 StatFlags to EFI SNP filter flags.\r
   //\r
   //\r
   // Convert UNDI32 StatFlags to EFI SNP filter flags.\r
   //\r
-  snp->mode.ReceiveFilterSetting = 0;\r
+  Snp->Mode.ReceiveFilterSetting = 0;\r
 \r
 \r
-  if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_UNICAST) != 0) {\r
-    snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;\r
+  if ((Snp->Cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_UNICAST) != 0) {\r
+    Snp->Mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;\r
   }\r
 \r
   }\r
 \r
-  if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST) != 0) {\r
-    snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;\r
+  if ((Snp->Cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST) != 0) {\r
+    Snp->Mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;\r
   }\r
 \r
   }\r
 \r
-  if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS) != 0) {\r
-    snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;\r
+  if ((Snp->Cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS) != 0) {\r
+    Snp->Mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;\r
   }\r
 \r
   }\r
 \r
-  if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST) != 0) {\r
-    snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
+  if ((Snp->Cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST) != 0) {\r
+    Snp->Mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
   }\r
 \r
   }\r
 \r
-  if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) != 0) {\r
-    snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;\r
+  if ((Snp->Cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) != 0) {\r
+    Snp->Mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;\r
   }\r
 \r
   }\r
 \r
-  CopyMem (snp->mode.MCastFilter, snp->db, snp->cdb.DBsize);\r
+  CopyMem (Snp->Mode.MCastFilter, Snp->Db, Snp->Cdb.DBsize);\r
 \r
   //\r
   // Count number of active entries in multicast filter list.\r
 \r
   //\r
   // Count number of active entries in multicast filter list.\r
@@ -267,12 +267,12 @@ pxe_rcvfilter_read (
 \r
     SetMem (&ZeroMacAddr, sizeof ZeroMacAddr, 0);\r
 \r
 \r
     SetMem (&ZeroMacAddr, sizeof ZeroMacAddr, 0);\r
 \r
-    for (snp->mode.MCastFilterCount = 0;\r
-         snp->mode.MCastFilterCount < snp->mode.MaxMCastFilterCount;\r
-         snp->mode.MCastFilterCount++\r
+    for (Snp->Mode.MCastFilterCount = 0;\r
+         Snp->Mode.MCastFilterCount < Snp->Mode.MaxMCastFilterCount;\r
+         Snp->Mode.MCastFilterCount++\r
         ) {\r
       if (CompareMem (\r
         ) {\r
       if (CompareMem (\r
-            &snp->mode.MCastFilter[snp->mode.MCastFilterCount],\r
+            &Snp->Mode.MCastFilter[Snp->Mode.MCastFilterCount],\r
             &ZeroMacAddr,\r
             sizeof ZeroMacAddr\r
             ) == 0) {\r
             &ZeroMacAddr,\r
             sizeof ZeroMacAddr\r
             ) == 0) {\r
@@ -286,46 +286,123 @@ pxe_rcvfilter_read (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for reading/enabling/disabling the\r
-  receive filters.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  checks the parameter validity, calls one of the above routines to actually\r
-  do the work\r
-\r
-  @param  this               context pointer\r
-  @param  EnableFlags        bit mask for enabling the receive filters\r
-  @param  DisableFlags       bit mask for disabling the receive filters\r
-  @param  ResetMCastList     boolean flag to reset/delete the multicast filter list\r
-  @param  MCastAddressCount  multicast address count for a new multicast address\r
-                             list\r
-  @param  MCastAddressList   list of new multicast addresses\r
-\r
+  Manages the multicast receive filters of a network interface.\r
+  \r
+  This function is used enable and disable the hardware and software receive \r
+  filters for the underlying network device.\r
+  The receive filter change is broken down into three steps: \r
+  * The filter mask bits that are set (ON) in the Enable parameter are added to \r
+    the current receive filter settings. \r
+  * The filter mask bits that are set (ON) in the Disable parameter are subtracted\r
+    from the updated receive filter settings.\r
+  * If the resulting receive filter setting is not supported by the hardware a\r
+    more liberal setting is selected.\r
+  If the same bits are set in the Enable and Disable parameters, then the bits \r
+  in the Disable parameter takes precedence.\r
+  If the ResetMCastFilter parameter is TRUE, then the multicast address list \r
+  filter is disabled (irregardless of what other multicast bits are set in the \r
+  Enable and Disable parameters). The SNP->Mode->MCastFilterCount field is set \r
+  to zero. The Snp->Mode->MCastFilter contents are undefined.\r
+  After enabling or disabling receive filter settings, software should verify \r
+  the new settings by checking the Snp->Mode->ReceiveFilterSettings, \r
+  Snp->Mode->MCastFilterCount and Snp->Mode->MCastFilter fields.\r
+  Note: Some network drivers and/or devices will automatically promote receive \r
+    filter settings if the requested setting can not be honored. For example, if\r
+    a request for four multicast addresses is made and the underlying hardware \r
+    only supports two multicast addresses the driver might set the promiscuous \r
+    or promiscuous multicast receive filters instead. The receiving software is\r
+    responsible for discarding any extra packets that get through the hardware \r
+    receive filters.\r
+    Note: Note: To disable all receive filter hardware, the network driver must \r
+      be Shutdown() and Stopped(). Calling ReceiveFilters() with Disable set to\r
+      Snp->Mode->ReceiveFilterSettings will make it so no more packets are \r
+      returned by the Receive() function, but the receive hardware may still be \r
+      moving packets into system memory before inspecting and discarding them.\r
+      Unexpected system errors, reboots and hangs can occur if an OS is loaded \r
+      and the network devices are not Shutdown() and Stopped().\r
+  If ResetMCastFilter is TRUE, then the multicast receive filter list on the \r
+  network interface will be reset to the default multicast receive filter list.\r
+  If ResetMCastFilter is FALSE, and this network interface allows the multicast \r
+  receive filter list to be modified, then the MCastFilterCnt and MCastFilter \r
+  are used to update the current multicast receive filter list. The modified \r
+  receive filter list settings can be found in the MCastFilter field of \r
+  EFI_SIMPLE_NETWORK_MODE. If the network interface does not allow the multicast\r
+  receive filter list to be modified, then EFI_INVALID_PARAMETER will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+  If the receive filter mask and multicast receive filter list have been \r
+  successfully updated on the network interface, EFI_SUCCESS will be returned.\r
+\r
+  @param This             A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Enable           A bit mask of receive filters to enable on the network\r
+                          interface.\r
+  @param Disable          A bit mask of receive filters to disable on the network\r
+                          interface. For backward compatibility with EFI 1.1 \r
+                          platforms, the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit\r
+                          must be set when the ResetMCastFilter parameter is TRUE.\r
+  @param ResetMCastFilter Set to TRUE to reset the contents of the multicast \r
+                          receive filters on the network interface to their \r
+                          default values. \r
+  @param MCastFilterCnt   Number of multicast HW MAC addresses in the new MCastFilter\r
+                          list. This value must be less than or equal to the \r
+                          MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. \r
+                          This field is optional if ResetMCastFilter is TRUE.\r
+  @param MCastFilter      A pointer to a list of new multicast receive filter HW\r
+                          MAC addresses. This list will replace any existing \r
+                          multicast HW MAC address list. This field is optional \r
+                          if ResetMCastFilter is TRUE.\r
+   \r
+  @retval EFI_SUCCESS            The multicast receive filter list was updated.\r
+  @retval EFI_NOT_STARTED        The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 * This is NULL\r
+                                 * There are bits set in Enable that are not set\r
+                                   in Snp->Mode->ReceiveFilterMask\r
+                                 * There are bits set in Disable that are not set\r
+                                   in Snp->Mode->ReceiveFilterMask\r
+                                 * Multicast is being enabled (the \r
+                                   EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit is \r
+                                   set in Enable, it is not set in Disable, and \r
+                                   ResetMCastFilter is FALSE) and MCastFilterCount\r
+                                   is zero\r
+                                 * Multicast is being enabled and MCastFilterCount\r
+                                   is greater than Snp->Mode->MaxMCastFilterCount\r
+                                 * Multicast is being enabled and MCastFilter is NULL\r
+                                 * Multicast is being enabled and one or more of\r
+                                   the addresses in the MCastFilter list are not\r
+                                   valid multicast MAC addresses\r
+  @retval EFI_DEVICE_ERROR       One or more of the following conditions is TRUE:\r
+                                 * The network interface has been started but has\r
+                                   not been initialized\r
+                                 * An unexpected error was returned by the \r
+                                   underlying network driver or device\r
+  @retval EFI_UNSUPPORTED        This function is not supported by the network\r
+                                 interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_receive_filters (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN UINT32                      EnableFlags,\r
-  IN UINT32                      DisableFlags,\r
-  IN BOOLEAN                     ResetMCastList,\r
-  IN UINTN                       MCastAddressCount OPTIONAL,\r
-  IN EFI_MAC_ADDRESS             * MCastAddressList OPTIONAL\r
+SnpUndi32ReceiveFilters (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINT32                      Enable,\r
+  IN UINT32                      Disable,\r
+  IN BOOLEAN                     ResetMCastFilter,\r
+  IN UINTN                       MCastFilterCnt,  OPTIONAL\r
+  IN EFI_MAC_ADDRESS             *MCastFilter     OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -341,21 +418,21 @@ snp_undi32_receive_filters (
   // check if we are asked to enable or disable something that the UNDI\r
   // does not even support!\r
   //\r
   // check if we are asked to enable or disable something that the UNDI\r
   // does not even support!\r
   //\r
-  if (((EnableFlags &~snp->mode.ReceiveFilterMask) != 0) ||\r
-    ((DisableFlags &~snp->mode.ReceiveFilterMask) != 0)) {\r
+  if (((Enable &~Snp->Mode.ReceiveFilterMask) != 0) ||\r
+    ((Disable &~Snp->Mode.ReceiveFilterMask) != 0)) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if (ResetMCastList) {\r
+  if (ResetMCastFilter) {\r
 \r
 \r
-    DisableFlags |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST & snp->mode.ReceiveFilterMask;\r
-    MCastAddressCount = 0;\r
-    MCastAddressList  = NULL;\r
+    Disable |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST & Snp->Mode.ReceiveFilterMask;\r
+    MCastFilterCnt = 0;\r
+    MCastFilter    = NULL;\r
   } else {\r
   } else {\r
-    if (MCastAddressCount != 0) {\r
-      if ((MCastAddressCount > snp->mode.MaxMCastFilterCount) ||\r
-        (MCastAddressList == NULL)) {\r
+    if (MCastFilterCnt != 0) {\r
+      if ((MCastFilterCnt > Snp->Mode.MaxMCastFilterCount) ||\r
+          (MCastFilter == NULL)) {\r
 \r
         Status = EFI_INVALID_PARAMETER;\r
         goto ON_EXIT;\r
 \r
         Status = EFI_INVALID_PARAMETER;\r
         goto ON_EXIT;\r
@@ -363,38 +440,38 @@ snp_undi32_receive_filters (
     }\r
   }\r
 \r
     }\r
   }\r
 \r
-  if (EnableFlags == 0 && DisableFlags == 0 && !ResetMCastList && MCastAddressCount == 0) {\r
+  if (Enable == 0 && Disable == 0 && !ResetMCastFilter && MCastFilterCnt == 0) {\r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0 && MCastAddressCount == 0) {\r
+  if ((Enable & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0 && MCastFilterCnt == 0) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if ((EnableFlags != 0) || (MCastAddressCount != 0)) {\r
-    Status = pxe_rcvfilter_enable (\r
-              snp,\r
-              EnableFlags,\r
-              MCastAddressCount,\r
-              MCastAddressList\r
-              );\r
+  if ((Enable != 0) || (MCastFilterCnt != 0)) {\r
+    Status = PxeRecvFilterEnable (\r
+               Snp,\r
+               Enable,\r
+               MCastFilterCnt,\r
+               MCastFilter\r
+               );\r
 \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
 \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
-  if ((DisableFlags != 0) || ResetMCastList) {\r
-    Status = pxe_rcvfilter_disable (snp, DisableFlags, ResetMCastList);\r
+  if ((Disable != 0) || ResetMCastFilter) {\r
+    Status = PxeRecvFilterDisable (Snp, Disable, ResetMCastFilter);\r
 \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
 \r
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
   }\r
 \r
-  Status = pxe_rcvfilter_read (snp);\r
+  Status = PxeRecvFilterRead (Snp);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index cd396bbb096eb5a49998430d3b4a042c532f8e2e..f616d43584ccbf974ee5999f31f1a06a8c141ae8 100644 (file)
@@ -24,41 +24,41 @@ Revision history:
 /**\r
   This routine calls undi to reset the nic.\r
 \r
 /**\r
   This routine calls undi to reset the nic.\r
 \r
-  @param  snp                   pointer to the snp driver structure\r
+  @param  Snp                   pointer to the snp driver structure\r
 \r
   @return EFI_SUCCESSFUL for a successful completion\r
   @return other for failed calls\r
 \r
 **/\r
 EFI_STATUS\r
 \r
   @return EFI_SUCCESSFUL for a successful completion\r
   @return other for failed calls\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_reset (\r
-  SNP_DRIVER *snp\r
+PxeReset (\r
+  SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_RESET;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_RESET;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.reset()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.reset()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi32.reset()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi32.reset()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     //\r
       );\r
 \r
     //\r
@@ -72,23 +72,37 @@ pxe_reset (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for resetting the NIC\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_reset routine to actually do the reset!\r
-\r
-  @param  this                  context pointer\r
-  @param  ExtendedVerification  not implemented\r
-\r
+  Resets a network adapter and reinitializes it with the parameters that were\r
+  provided in the previous call to Initialize().\r
+\r
+  This function resets a network adapter and reinitializes it with the parameters\r
+  that were provided in the previous call to Initialize(). The transmit and \r
+  receive queues are emptied and all pending interrupts are cleared.\r
+  Receive filters, the station address, the statistics, and the multicast-IP-to-HW \r
+  MAC addresses are not reset by this call. If the network interface was \r
+  successfully reset, then EFI_SUCCESS will be returned. If the driver has not \r
+  been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This                 A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param ExtendedVerification Indicates that the driver may perform a more \r
+                              exhaustive verification operation of the device \r
+                              during reset.\r
+\r
+  @retval EFI_SUCCESS           The network interface was reset.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_reset (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
+SnpUndi32Reset (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     ExtendedVerification\r
   )\r
 {\r
   IN BOOLEAN                     ExtendedVerification\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
@@ -98,15 +112,15 @@ snp_undi32_reset (
   ExtendedVerification = 0;\r
   DEBUG ((EFI_D_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification));\r
 \r
   ExtendedVerification = 0;\r
   DEBUG ((EFI_D_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification));\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -119,7 +133,7 @@ snp_undi32_reset (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_reset (snp);\r
+  Status = PxeReset (Snp);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 8e0ae45503a15f1d3db8b28f566dbca15dc1deae..a996c2c50ae6e90bd6c6ce8e9b3a53f0b016f596 100644 (file)
@@ -1,21 +1,15 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of shuting down a network adapter.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  shutdown.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-14 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 **/\r
 \r
 #include "Snp.h"\r
@@ -24,93 +18,105 @@ Revision history:
 /**\r
   this routine calls undi to shut down the interface.\r
 \r
 /**\r
   this routine calls undi to shut down the interface.\r
 \r
-  @param  snp   pointer to snp driver structure\r
+  @param  Snp   pointer to snp driver structure\r
 \r
 \r
+  @retval EFI_SUCCESS        UNDI is shut down successfully\r
+  @retval EFI_DEVICE_ERROR   UNDI could not be shut down\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_shutdown (\r
-  IN SNP_DRIVER *snp\r
+PxeShutdown (\r
+  IN SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_SHUTDOWN;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_SHUTDOWN;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.shutdown()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.shutdown()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     //\r
     // UNDI could not be shutdown. Return UNDI error.\r
     //\r
     //\r
     // UNDI could not be shutdown. Return UNDI error.\r
     //\r
-    DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown()  %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));\r
+    DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown()  %xh:%xh\n", Snp->Cdb.StatFlags, Snp->Cdb.StatCode));\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
   //\r
   // Free allocated memory.\r
   //\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
   //\r
   // Free allocated memory.\r
   //\r
-  if (snp->tx_rx_buffer != NULL) {\r
-    snp->IoFncs->FreeBuffer (\r
-                  snp->IoFncs,\r
-                  SNP_MEM_PAGES (snp->tx_rx_bufsize),\r
-                  (VOID *) snp->tx_rx_buffer\r
+  if (Snp->TxRxBuffer != NULL) {\r
+    Snp->PciIo->FreeBuffer (\r
+                  Snp->PciIo,\r
+                  SNP_MEM_PAGES (Snp->TxRxBufferSize),\r
+                  (VOID *) Snp->TxRxBuffer\r
                   );\r
   }\r
 \r
                   );\r
   }\r
 \r
-  snp->tx_rx_buffer   = NULL;\r
-  snp->tx_rx_bufsize  = 0;\r
+  Snp->TxRxBuffer      = NULL;\r
+  Snp->TxRxBufferSize  = 0;\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for shutting down the interface\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_shutdown routine to actually do the undi shutdown\r
-\r
-  @param  this  context pointer\r
-\r
+  Resets a network adapter and leaves it in a state that is safe for another \r
+  driver to initialize. \r
+  \r
+  This function releases the memory buffers assigned in the Initialize() call.\r
+  Pending transmits and receives are lost, and interrupts are cleared and disabled.\r
+  After this call, only the Initialize() and Stop() calls may be used. If the \r
+  network interface was successfully shutdown, then EFI_SUCCESS will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param  This  A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The network interface was shutdown.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_shutdown (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Shutdown (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   //\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   //\r
+  // Get pointer to SNP driver instance for *This.\r
   //\r
   //\r
-  //\r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
+  // Return error if the SNP is not initialized.\r
   //\r
   //\r
-  //\r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -122,24 +128,22 @@ snp_undi32_shutdown (
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
-  //\r
-  //\r
-  //\r
-  Status                          = pxe_shutdown (snp);\r
+  \r
+  Status                          = PxeShutdown (Snp);\r
 \r
 \r
-  snp->mode.State                 = EfiSimpleNetworkStarted;\r
-  snp->mode.ReceiveFilterSetting  = 0;\r
+  Snp->Mode.State                 = EfiSimpleNetworkStarted;\r
+  Snp->Mode.ReceiveFilterSetting  = 0;\r
 \r
 \r
-  snp->mode.MCastFilterCount      = 0;\r
-  snp->mode.ReceiveFilterSetting  = 0;\r
-  ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);\r
+  Snp->Mode.MCastFilterCount      = 0;\r
+  Snp->Mode.ReceiveFilterSetting  = 0;\r
+  ZeroMem (Snp->Mode.MCastFilter, sizeof Snp->Mode.MCastFilter);\r
   CopyMem (\r
   CopyMem (\r
-    &snp->mode.CurrentAddress,\r
-    &snp->mode.PermanentAddress,\r
+    &Snp->Mode.CurrentAddress,\r
+    &Snp->Mode.PermanentAddress,\r
     sizeof (EFI_MAC_ADDRESS)\r
     );\r
 \r
     sizeof (EFI_MAC_ADDRESS)\r
     );\r
 \r
-  gBS->CloseEvent (snp->snp.WaitForPacket);\r
+  gBS->CloseEvent (Snp->Snp.WaitForPacket);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 267dde67d58dc0e55f8f3e70932946b9ee8d1ce3..80a05f102f90f261a92c74d50c9661c126f38ec3 100644 (file)
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2005, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of driver entry point and driver binding protocol.\r
\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-    snp.c\r
-\r
-Abstract:\r
-\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 **/\r
 \r
 #include "Snp.h"\r
 \r
-EFI_STATUS\r
-pxe_start (\r
-  SNP_DRIVER *snp\r
-  );\r
-EFI_STATUS\r
-pxe_stop (\r
-  SNP_DRIVER *snp\r
-  );\r
-EFI_STATUS\r
-pxe_init (\r
-  SNP_DRIVER *snp,\r
-  UINT16     OpFlags\r
-  );\r
-EFI_STATUS\r
-pxe_shutdown (\r
-  SNP_DRIVER *snp\r
-  );\r
-EFI_STATUS\r
-pxe_get_stn_addr (\r
-  SNP_DRIVER *snp\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeSnpNiiDriver (\r
-  IN EFI_HANDLE       image_handle,\r
-  IN EFI_SYSTEM_TABLE *system_table\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-SimpleNetworkDriverSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-SimpleNetworkDriverStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-SimpleNetworkDriverStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  UINTN                          NumberOfChildren,\r
-  IN  EFI_HANDLE                     *ChildHandleBuffer\r
-  );\r
-\r
-//\r
-// Simple Network Protocol Driver Global Variables\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {\r
-  SimpleNetworkDriverSupported,\r
-  SimpleNetworkDriverStart,\r
-  SimpleNetworkDriverStop,\r
-  0xa,\r
-  NULL,\r
-  NULL\r
-};\r
-\r
 //\r
 //  Module global variables needed to support undi 3.0 interface\r
 //\r
 //\r
 //  Module global variables needed to support undi 3.0 interface\r
 //\r
-EFI_PCI_IO_PROTOCOL         *mPciIoFncs;\r
-struct s_v2p                *_v2p = NULL; // undi3.0 map_list head\r
+EFI_PCI_IO_PROTOCOL         *mPciIo;\r
+V2P                         *mV2p = NULL; // undi3.0 map_list head\r
 // End Global variables\r
 //\r
 \r
 // End Global variables\r
 //\r
 \r
-/**\r
-  This routine maps the given CPU address to a Device address. It creates a\r
-  an entry in the map list with the virtual and physical addresses and the\r
-  un map cookie.\r
-\r
-  @param  v2p                  pointer to return a map list node pointer.\r
-  @param  type                 the direction in which the data flows from the given\r
-                               virtual address device->cpu or cpu->device or both\r
-                               ways.\r
-  @param  vaddr                virtual address (or CPU address) to be mapped\r
-  @param  bsize                size of the buffer to be mapped.\r
-\r
-  @retval EFI_SUCEESS          routine has completed the mapping\r
-  @retval other                error as indicated.\r
-\r
-**/\r
-EFI_STATUS\r
-add_v2p (\r
-  IN OUT struct s_v2p           **v2p,\r
-  EFI_PCI_IO_PROTOCOL_OPERATION type,\r
-  VOID                          *vaddr,\r
-  UINTN                         bsize\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  if ((v2p == NULL) || (vaddr == NULL) || (bsize == 0)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  *v2p = AllocatePool (sizeof (struct s_v2p));\r
-  if (*v2p != NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  Status = mPciIoFncs->Map (\r
-                        mPciIoFncs,\r
-                        type,\r
-                        vaddr,\r
-                        &bsize,\r
-                        &(*v2p)->paddr,\r
-                        &(*v2p)->unmap\r
-                        );\r
-  if (Status != EFI_SUCCESS) {\r
-    FreePool (*v2p);\r
-    return Status;\r
-  }\r
-  (*v2p)->vaddr = vaddr;\r
-  (*v2p)->bsize = bsize;\r
-  (*v2p)->next  = _v2p;\r
-  _v2p          = *v2p;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 \r
 /**\r
 \r
 /**\r
-  This routine searches the linked list of mapped address nodes (for undi3.0\r
-  interface) to find the node that corresponds to the given virtual address and\r
-  returns a pointer to that node.\r
-\r
-  @param  v2p                  pointer to return a map list node pointer.\r
-  @param  vaddr                virtual address (or CPU address) to be searched in\r
-                               the map list\r
-\r
-  @retval EFI_SUCEESS          if a match found!\r
-  @retval Other                match not found\r
+  Unsupport currently.\r
+  \r
+  @param Cdb   command to be sent to UNDI.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-find_v2p (\r
-  struct s_v2p **v2p,\r
-  VOID         *vaddr\r
+IssueHwUndiCommand (\r
+  UINT64 Cdb\r
   )\r
 {\r
   )\r
 {\r
-  struct s_v2p  *v;\r
+  DEBUG ((EFI_D_ERROR, "\nIssueHwUndiCommand() - This should not be called!"));\r
 \r
 \r
-  if (v2p == NULL || vaddr == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  for (v = _v2p; v != NULL; v = v->next) {\r
-    if (v->vaddr == vaddr) {\r
-      *v2p = v;\r
-      return EFI_SUCCESS;\r
-    }\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-\r
-/**\r
-  This routine unmaps the given virtual address and frees the memory allocated\r
-  for the map list node corresponding to that address.\r
-\r
-  @param  vaddr                virtual address (or CPU address) to be unmapped\r
-\r
-  @retval EFI_SUCEESS          if successfully unmapped\r
-  @retval Other                as indicated by the error\r
-\r
-**/\r
-EFI_STATUS\r
-del_v2p (\r
-  VOID *vaddr\r
-  )\r
-{\r
-  struct s_v2p  *v;\r
-  struct s_v2p  *t;\r
-  EFI_STATUS    Status;\r
-\r
-  if (vaddr == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (_v2p == NULL) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-  //\r
-  // Is our node at the head of the list??\r
-  //\r
-  if ((v = _v2p)->vaddr == vaddr) {\r
-    _v2p    = _v2p->next;\r
-\r
-    Status  = mPciIoFncs->Unmap (mPciIoFncs, v->unmap);\r
-\r
-    FreePool (v);\r
-\r
-    if (Status) {\r
-      DEBUG ((EFI_D_ERROR, "Unmap failed with status = %r\n", Status));\r
-    }\r
-    return Status;\r
-  }\r
-\r
-  for (; v->next != NULL; v = t) {\r
-    if ((t = v->next)->vaddr == vaddr) {\r
-      v->next = t->next;\r
-      Status  = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);\r
-      FreePool (t);\r
-\r
-      if (Status) {\r
-        DEBUG ((EFI_D_ERROR, "Unmap failed with status = %r\n", Status));\r
-      }\r
-      return Status;\r
-    }\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-EFI_STATUS\r
-issue_hwundi_command (\r
-  UINT64 cdb\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
-{\r
-  DEBUG ((EFI_D_ERROR, "\nissue_hwundi_command() - This should not be called!"));\r
-\r
-  if (cdb == 0) {\r
+  if (Cdb == 0) {\r
     return EFI_INVALID_PARAMETER;\r
 \r
   }\r
     return EFI_INVALID_PARAMETER;\r
 \r
   }\r
@@ -272,48 +50,52 @@ Returns:
 /**\r
   Compute 8-bit checksum of a buffer.\r
 \r
 /**\r
   Compute 8-bit checksum of a buffer.\r
 \r
-  @param  ptr                  Pointer to buffer.\r
-  @param  len                  Length of buffer in bytes.\r
+  @param  Buffer               Pointer to buffer.\r
+  @param  Length               Length of buffer in bytes.\r
 \r
   @return 8-bit checksum of all bytes in buffer.\r
   @return If ptr is NULL or len is zero, zero is returned.\r
 \r
 **/\r
 UINT8\r
 \r
   @return 8-bit checksum of all bytes in buffer.\r
   @return If ptr is NULL or len is zero, zero is returned.\r
 \r
 **/\r
 UINT8\r
-calc_8bit_cksum (\r
-  VOID  *ptr,\r
-  UINTN len\r
+Calc8BitCksum (\r
+  VOID  *Buffer,\r
+  UINTN Length\r
   )\r
 {\r
   )\r
 {\r
-  UINT8 *bptr;\r
-  UINT8 cksum;\r
+  UINT8 *Ptr;\r
+  UINT8 Cksum;\r
 \r
 \r
-  bptr  = ptr;\r
-  cksum = 0;\r
+  Ptr   = Buffer;\r
+  Cksum = 0;\r
 \r
 \r
-  if (ptr == NULL || len == 0) {\r
+  if (Ptr == NULL || Length == 0) {\r
     return 0;\r
   }\r
 \r
     return 0;\r
   }\r
 \r
-  while (len--) {\r
-    cksum = (UINT8) (cksum +*bptr++);\r
+  while (Length-- != 0) {\r
+    Cksum = (UINT8) (Cksum + *Ptr++);\r
   }\r
 \r
   }\r
 \r
-  return cksum;\r
+  return Cksum;\r
 }\r
 \r
 }\r
 \r
-\r
 /**\r
 /**\r
-  Test to see if this driver supports Controller. Any Controller\r
-  that contains a Nii protocol can be supported.\r
-\r
-  @param  This                 Protocol instance pointer.\r
-  @param  Controller           Handle of device to test.\r
-  @param  RemainingDevicePath  Not used.\r
-\r
-  @retval EFI_SUCCESS          This driver supports this device.\r
-  @retval EFI_ALREADY_STARTED  This driver is already running on this device.\r
-  @retval other                This driver does not support this device.\r
+  Test to see if this driver supports ControllerHandle. This service\r
+  is called by the EFI boot service ConnectController(). In\r
+  order to make drivers as small as possible, there are a few calling\r
+  restrictions for this service. ConnectController() must\r
+  follow these calling restrictions. If any other agent wishes to call\r
+  Supported() it must also follow these calling restrictions.\r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -326,7 +108,7 @@ SimpleNetworkDriverSupported (
 {\r
   EFI_STATUS                                Status;\r
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiProtocol;\r
 {\r
   EFI_STATUS                                Status;\r
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiProtocol;\r
-  PXE_UNDI                                  *pxe;\r
+  PXE_UNDI                                  *Pxe;\r
 \r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
 \r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
@@ -374,30 +156,30 @@ SimpleNetworkDriverSupported (
     goto Done;\r
   }\r
 \r
     goto Done;\r
   }\r
 \r
-  pxe = (PXE_UNDI *) (UINTN) (NiiProtocol->ID);\r
+  Pxe = (PXE_UNDI *) (UINTN) (NiiProtocol->ID);\r
 \r
   //\r
   //  Verify !PXE revisions.\r
   //\r
 \r
   //\r
   //  Verify !PXE revisions.\r
   //\r
-  if (pxe->hw.Signature != PXE_ROMID_SIGNATURE) {\r
+  if (Pxe->hw.Signature != PXE_ROMID_SIGNATURE) {\r
     DEBUG ((EFI_D_NET, "\n!PXE signature is not valid.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
   }\r
 \r
     DEBUG ((EFI_D_NET, "\n!PXE signature is not valid.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
   }\r
 \r
-  if (pxe->hw.Rev < PXE_ROMID_REV) {\r
+  if (Pxe->hw.Rev < PXE_ROMID_REV) {\r
     DEBUG ((EFI_D_NET, "\n!PXE.Rev is not supported.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
   }\r
 \r
     DEBUG ((EFI_D_NET, "\n!PXE.Rev is not supported.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
   }\r
 \r
-  if (pxe->hw.MajorVer < PXE_ROMID_MAJORVER) {\r
+  if (Pxe->hw.MajorVer < PXE_ROMID_MAJORVER) {\r
 \r
     DEBUG ((EFI_D_NET, "\n!PXE.MajorVer is not supported.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
 \r
 \r
     DEBUG ((EFI_D_NET, "\n!PXE.MajorVer is not supported.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
 \r
-  } else if (pxe->hw.MajorVer == PXE_ROMID_MAJORVER && pxe->hw.MinorVer < PXE_ROMID_MINORVER) {\r
+  } else if (Pxe->hw.MajorVer == PXE_ROMID_MAJORVER && Pxe->hw.MinorVer < PXE_ROMID_MINORVER) {\r
     DEBUG ((EFI_D_NET, "\n!PXE.MinorVer is not supported."));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
     DEBUG ((EFI_D_NET, "\n!PXE.MinorVer is not supported."));\r
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
@@ -405,14 +187,14 @@ SimpleNetworkDriverSupported (
   //\r
   // Do S/W UNDI specific checks.\r
   //\r
   //\r
   // Do S/W UNDI specific checks.\r
   //\r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) == 0) {\r
-    if (pxe->sw.EntryPoint < pxe->sw.Len) {\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) == 0) {\r
+    if (Pxe->sw.EntryPoint < Pxe->sw.Len) {\r
       DEBUG ((EFI_D_NET, "\n!PXE S/W entry point is not valid."));\r
       Status = EFI_UNSUPPORTED;\r
       goto Done;\r
     }\r
 \r
       DEBUG ((EFI_D_NET, "\n!PXE S/W entry point is not valid."));\r
       Status = EFI_UNSUPPORTED;\r
       goto Done;\r
     }\r
 \r
-    if (pxe->sw.BusCnt == 0) {\r
+    if (Pxe->sw.BusCnt == 0) {\r
       DEBUG ((EFI_D_NET, "\n!PXE.BusCnt is zero."));\r
       Status = EFI_UNSUPPORTED;\r
       goto Done;\r
       DEBUG ((EFI_D_NET, "\n!PXE.BusCnt is zero."));\r
       Status = EFI_UNSUPPORTED;\r
       goto Done;\r
@@ -433,16 +215,22 @@ Done:
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
-\r
 /**\r
 /**\r
-  called for any handle that we said "supported" in the above call!\r
+  Start this driver on ControllerHandle. This service is called by the\r
+  EFI boot service ConnectController(). In order to make\r
+  drivers as small as possible, there are a few calling restrictions for\r
+  this service. ConnectController() must follow these\r
+  calling restrictions. If any other agent wishes to call Start() it\r
+  must also follow these calling restrictions.\r
 \r
   @param  This                 Protocol instance pointer.\r
 \r
   @param  This                 Protocol instance pointer.\r
-  @param  Controller           Handle of device to start\r
-  @param  RemainingDevicePath  Not used.\r
+  @param  ControllerHandle     Handle of device to bind driver to.\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
 \r
 \r
-  @retval EFI_SUCCESS          This driver supports this device.\r
-  @retval other                This driver failed to start this device.\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -456,9 +244,9 @@ SimpleNetworkDriverStart (
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;\r
   EFI_DEVICE_PATH_PROTOCOL                  *NiiDevicePath;\r
   EFI_STATUS                                Status;\r
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;\r
   EFI_DEVICE_PATH_PROTOCOL                  *NiiDevicePath;\r
   EFI_STATUS                                Status;\r
-  PXE_UNDI                                  *pxe;\r
-  SNP_DRIVER                                *snp;\r
-  VOID                                      *addr;\r
+  PXE_UNDI                                  *Pxe;\r
+  SNP_DRIVER                                *Snp;\r
+  VOID                                      *Address;\r
   EFI_HANDLE                                Handle;\r
   PXE_PCI_CONFIG_INFO                       ConfigInfo;\r
   PCI_TYPE00                                *ConfigHeader;\r
   EFI_HANDLE                                Handle;\r
   PXE_PCI_CONFIG_INFO                       ConfigInfo;\r
   PCI_TYPE00                                *ConfigHeader;\r
@@ -494,7 +282,7 @@ SimpleNetworkDriverStart (
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiPciIoProtocolGuid,\r
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiPciIoProtocolGuid,\r
-                  (VOID **) &mPciIoFncs,\r
+                  (VOID **) &mPciIo,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -525,18 +313,18 @@ SimpleNetworkDriverStart (
 \r
   DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));\r
 \r
 \r
   DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));\r
 \r
-  pxe = (PXE_UNDI *) (UINTN) (Nii->ID);\r
+  Pxe = (PXE_UNDI *) (UINTN) (Nii->ID);\r
 \r
 \r
-  if (calc_8bit_cksum (pxe, pxe->hw.Len) != 0) {\r
+  if (Calc8BitCksum (Pxe, Pxe->hw.Len) != 0) {\r
     DEBUG ((EFI_D_NET, "\n!PXE checksum is not correct.\n"));\r
     goto NiiError;\r
   }\r
 \r
     DEBUG ((EFI_D_NET, "\n!PXE checksum is not correct.\n"));\r
     goto NiiError;\r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {\r
     //\r
     //  We can get any packets.\r
     //\r
     //\r
     //  We can get any packets.\r
     //\r
-  } else if ((pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {\r
+  } else if ((Pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {\r
     //\r
     //  We need to be able to get broadcast packets for DHCP.\r
     //  If we do not have promiscuous support, we must at least have\r
     //\r
     //  We need to be able to get broadcast packets for DHCP.\r
     //  If we do not have promiscuous support, we must at least have\r
@@ -550,12 +338,12 @@ SimpleNetworkDriverStart (
   // OK, we like this UNDI, and we know snp is not already there on this handle\r
   // Allocate and initialize a new simple network protocol structure.\r
   //\r
   // OK, we like this UNDI, and we know snp is not already there on this handle\r
   // Allocate and initialize a new simple network protocol structure.\r
   //\r
-  Status = mPciIoFncs->AllocateBuffer (\r
-                        mPciIoFncs,\r
+  Status = mPciIo->AllocateBuffer (\r
+                        mPciIo,\r
                         AllocateAnyPages,\r
                         EfiBootServicesData,\r
                         SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
                         AllocateAnyPages,\r
                         EfiBootServicesData,\r
                         SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
-                        &addr,\r
+                        &Address,\r
                         0\r
                         );\r
 \r
                         0\r
                         );\r
 \r
@@ -564,48 +352,48 @@ SimpleNetworkDriverStart (
     goto NiiError;\r
   }\r
 \r
     goto NiiError;\r
   }\r
 \r
-  snp = (SNP_DRIVER *) (UINTN) addr;\r
+  Snp = (SNP_DRIVER *) (UINTN) Address;\r
 \r
 \r
-  ZeroMem (snp, sizeof (SNP_DRIVER));\r
+  ZeroMem (Snp, sizeof (SNP_DRIVER));\r
 \r
 \r
-  snp->IoFncs     = mPciIoFncs;\r
-  snp->Signature  = SNP_DRIVER_SIGNATURE;\r
+  Snp->PciIo      = mPciIo;\r
+  Snp->Signature  = SNP_DRIVER_SIGNATURE;\r
 \r
 \r
-  EfiInitializeLock (&snp->lock, TPL_NOTIFY);\r
+  EfiInitializeLock (&Snp->Lock, TPL_NOTIFY);\r
 \r
 \r
-  snp->snp.Revision       = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;\r
-  snp->snp.Start          = snp_undi32_start;\r
-  snp->snp.Stop           = snp_undi32_stop;\r
-  snp->snp.Initialize     = snp_undi32_initialize;\r
-  snp->snp.Reset          = snp_undi32_reset;\r
-  snp->snp.Shutdown       = snp_undi32_shutdown;\r
-  snp->snp.ReceiveFilters = snp_undi32_receive_filters;\r
-  snp->snp.StationAddress = snp_undi32_station_address;\r
-  snp->snp.Statistics     = snp_undi32_statistics;\r
-  snp->snp.MCastIpToMac   = snp_undi32_mcast_ip_to_mac;\r
-  snp->snp.NvData         = snp_undi32_nvdata;\r
-  snp->snp.GetStatus      = snp_undi32_get_status;\r
-  snp->snp.Transmit       = snp_undi32_transmit;\r
-  snp->snp.Receive        = snp_undi32_receive;\r
-  snp->snp.WaitForPacket  = NULL;\r
+  Snp->Snp.Revision       = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;\r
+  Snp->Snp.Start          = SnpUndi32Start;\r
+  Snp->Snp.Stop           = SnpUndi32Stop;\r
+  Snp->Snp.Initialize     = SnpUndi32Initialize;\r
+  Snp->Snp.Reset          = SnpUndi32Reset;\r
+  Snp->Snp.Shutdown       = SnpUndi32Shutdown;\r
+  Snp->Snp.ReceiveFilters = SnpUndi32ReceiveFilters;\r
+  Snp->Snp.StationAddress = SnpUndi32StationAddress;\r
+  Snp->Snp.Statistics     = SnpUndi32Statistics;\r
+  Snp->Snp.MCastIpToMac   = SnpUndi32McastIpToMac;\r
+  Snp->Snp.NvData         = SnpUndi32NvData;\r
+  Snp->Snp.GetStatus      = SnpUndi32GetStatus;\r
+  Snp->Snp.Transmit       = SnpUndi32Transmit;\r
+  Snp->Snp.Receive        = SnpUndi32Receive;\r
+  Snp->Snp.WaitForPacket  = NULL;\r
 \r
 \r
-  snp->snp.Mode           = &snp->mode;\r
+  Snp->Snp.Mode           = &Snp->Mode;\r
 \r
 \r
-  snp->tx_rx_bufsize      = 0;\r
-  snp->tx_rx_buffer       = NULL;\r
+  Snp->TxRxBufferSize     = 0;\r
+  Snp->TxRxBuffer         = NULL;\r
 \r
 \r
-  snp->if_num             = Nii->IfNum;\r
+  Snp->IfNum              = Nii->IfNum;\r
 \r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) != 0) {\r
-    snp->is_swundi            = FALSE;\r
-    snp->issue_undi32_command = &issue_hwundi_command;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) != 0) {\r
+    Snp->IsSwUndi             = FALSE;\r
+    Snp->IssueUndi32Command   = &IssueHwUndiCommand;\r
   } else {\r
   } else {\r
-    snp->is_swundi = TRUE;\r
+    Snp->IsSwUndi = TRUE;\r
 \r
 \r
-    if ((pxe->sw.Implementation & PXE_ROMID_IMP_SW_VIRT_ADDR) != 0) {\r
-      snp->issue_undi32_command = (issue_undi32_command) (UINTN) pxe->sw.EntryPoint;\r
+    if ((Pxe->sw.Implementation & PXE_ROMID_IMP_SW_VIRT_ADDR) != 0) {\r
+      Snp->IssueUndi32Command = (ISSUE_UNDI32_COMMAND) (UINTN) Pxe->sw.EntryPoint;\r
     } else {\r
     } else {\r
-      snp->issue_undi32_command = (issue_undi32_command) (UINTN) ((UINT8) (UINTN) pxe + pxe->sw.EntryPoint);\r
+      Snp->IssueUndi32Command = (ISSUE_UNDI32_COMMAND) (UINTN) ((UINT8) (UINTN) Pxe + Pxe->sw.EntryPoint);\r
     }\r
   }\r
   //\r
     }\r
   }\r
   //\r
@@ -624,12 +412,12 @@ SimpleNetworkDriverStart (
   // -it is OK to allocate one global set of CPB, DB pair for each UNDI\r
   // interface as EFI does not multi-task and so SNP will not be re-entered!\r
   //\r
   // -it is OK to allocate one global set of CPB, DB pair for each UNDI\r
   // interface as EFI does not multi-task and so SNP will not be re-entered!\r
   //\r
-  Status = mPciIoFncs->AllocateBuffer (\r
-                        mPciIoFncs,\r
+  Status = mPciIo->AllocateBuffer (\r
+                        mPciIo,\r
                         AllocateAnyPages,\r
                         EfiBootServicesData,\r
                         SNP_MEM_PAGES (4096),\r
                         AllocateAnyPages,\r
                         EfiBootServicesData,\r
                         SNP_MEM_PAGES (4096),\r
-                        &addr,\r
+                        &Address,\r
                         0\r
                         );\r
 \r
                         0\r
                         );\r
 \r
@@ -638,81 +426,81 @@ SimpleNetworkDriverStart (
     goto Error_DeleteSNP;\r
   }\r
 \r
     goto Error_DeleteSNP;\r
   }\r
 \r
-  snp->cpb  = (VOID *) (UINTN) addr;\r
-  snp->db   = (VOID *) ((UINTN) addr + 2048);\r
+  Snp->Cpb  = (VOID *) (UINTN) Address;\r
+  Snp->Db   = (VOID *) ((UINTN) Address + 2048);\r
 \r
   //\r
 \r
   //\r
-  // pxe_start call is going to give the callback functions to UNDI, these callback\r
+  // PxeStart call is going to give the callback functions to UNDI, these callback\r
   // functions use the BarIndex values from the snp structure, so these must be initialized\r
   // functions use the BarIndex values from the snp structure, so these must be initialized\r
-  // with default values before doing a pxe_start. The correct values can be obtained after\r
+  // with default values before doing a PxeStart. The correct values can be obtained after\r
   // getting the config information from UNDI\r
   //\r
   // getting the config information from UNDI\r
   //\r
-  snp->MemoryBarIndex = 0;\r
-  snp->IoBarIndex     = 1;\r
+  Snp->MemoryBarIndex = 0;\r
+  Snp->IoBarIndex     = 1;\r
 \r
   //\r
   // we need the undi init information many times in this snp code, just get it\r
   // once here and store it in the snp driver structure. to get Init Info\r
   // from UNDI we have to start undi first.\r
   //\r
 \r
   //\r
   // we need the undi init information many times in this snp code, just get it\r
   // once here and store it in the snp driver structure. to get Init Info\r
   // from UNDI we have to start undi first.\r
   //\r
-  Status = pxe_start (snp);\r
+  Status = PxeStart (Snp);\r
 \r
   if (Status != EFI_SUCCESS) {\r
     goto Error_DeleteSNP;\r
   }\r
 \r
 \r
   if (Status != EFI_SUCCESS) {\r
     goto Error_DeleteSNP;\r
   }\r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_GET_INIT_INFO;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_GET_INIT_INFO;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
 \r
 \r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_DBADDR_NOT_USED;\r
 \r
 \r
-  snp->cdb.DBsize     = sizeof snp->init_info;\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) &snp->init_info;\r
+  Snp->Cdb.DBsize     = sizeof Snp->InitInfo;\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) &Snp->InitInfo;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
 \r
 \r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
 \r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.get_init_info()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.get_init_info()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
   //\r
   // Save the INIT Stat Code...\r
   //\r
 \r
   //\r
   // Save the INIT Stat Code...\r
   //\r
-  InitStatFlags = snp->cdb.StatFlags;\r
+  InitStatFlags = Snp->Cdb.StatFlags;\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
-    DEBUG ((EFI_D_NET, "\nsnp->undi.init_info()  %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));\r
-    pxe_stop (snp);\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+    DEBUG ((EFI_D_NET, "\nSnp->undi.init_info()  %xh:%xh\n", Snp->Cdb.StatFlags, Snp->Cdb.StatCode));\r
+    PxeStop (Snp);\r
     goto Error_DeleteSNP;\r
   }\r
 \r
     goto Error_DeleteSNP;\r
   }\r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_GET_CONFIG_INFO;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_GET_CONFIG_INFO;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
 \r
 \r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_DBADDR_NOT_USED;\r
 \r
 \r
-  snp->cdb.DBsize     = sizeof ConfigInfo;\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) &ConfigInfo;\r
+  Snp->Cdb.DBsize     = sizeof ConfigInfo;\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) &ConfigInfo;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
 \r
 \r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
 \r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.get_config_info()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.get_config_info()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
-    DEBUG ((EFI_D_NET, "\nsnp->undi.config_info()  %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));\r
-    pxe_stop (snp);\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+    DEBUG ((EFI_D_NET, "\nSnp->undi.config_info()  %xh:%xh\n", Snp->Cdb.StatFlags, Snp->Cdb.StatCode));\r
+    PxeStop (Snp);\r
     goto Error_DeleteSNP;\r
   }\r
   //\r
     goto Error_DeleteSNP;\r
   }\r
   //\r
@@ -735,7 +523,7 @@ SimpleNetworkDriverStart (
     }\r
 \r
     if ((*TempBar & PCI_BAR_IO_MASK) == PCI_BAR_IO_MODE) {\r
     }\r
 \r
     if ((*TempBar & PCI_BAR_IO_MASK) == PCI_BAR_IO_MODE) {\r
-      snp->IoBarIndex = BarIndex;\r
+      Snp->IoBarIndex = BarIndex;\r
       break;\r
     }\r
 \r
       break;\r
     }\r
 \r
@@ -745,102 +533,102 @@ SimpleNetworkDriverStart (
   //\r
   //  Initialize simple network protocol mode structure\r
   //\r
   //\r
   //  Initialize simple network protocol mode structure\r
   //\r
-  snp->mode.State               = EfiSimpleNetworkStopped;\r
-  snp->mode.HwAddressSize       = snp->init_info.HWaddrLen;\r
-  snp->mode.MediaHeaderSize     = snp->init_info.MediaHeaderLen;\r
-  snp->mode.MaxPacketSize       = snp->init_info.FrameDataLen;\r
-  snp->mode.NvRamAccessSize     = snp->init_info.NvWidth;\r
-  snp->mode.NvRamSize           = snp->init_info.NvCount * snp->mode.NvRamAccessSize;\r
-  snp->mode.IfType              = snp->init_info.IFtype;\r
-  snp->mode.MaxMCastFilterCount = snp->init_info.MCastFilterCnt;\r
-  snp->mode.MCastFilterCount    = 0;\r
+  Snp->Mode.State               = EfiSimpleNetworkStopped;\r
+  Snp->Mode.HwAddressSize       = Snp->InitInfo.HWaddrLen;\r
+  Snp->Mode.MediaHeaderSize     = Snp->InitInfo.MediaHeaderLen;\r
+  Snp->Mode.MaxPacketSize       = Snp->InitInfo.FrameDataLen;\r
+  Snp->Mode.NvRamAccessSize     = Snp->InitInfo.NvWidth;\r
+  Snp->Mode.NvRamSize           = Snp->InitInfo.NvCount * Snp->Mode.NvRamAccessSize;\r
+  Snp->Mode.IfType              = Snp->InitInfo.IFtype;\r
+  Snp->Mode.MaxMCastFilterCount = Snp->InitInfo.MCastFilterCnt;\r
+  Snp->Mode.MCastFilterCount    = 0;\r
 \r
   switch (InitStatFlags & PXE_STATFLAGS_CABLE_DETECT_MASK) {\r
   case PXE_STATFLAGS_CABLE_DETECT_SUPPORTED:\r
 \r
   switch (InitStatFlags & PXE_STATFLAGS_CABLE_DETECT_MASK) {\r
   case PXE_STATFLAGS_CABLE_DETECT_SUPPORTED:\r
-    snp->mode.MediaPresentSupported = TRUE;\r
+    Snp->Mode.MediaPresentSupported = TRUE;\r
     break;\r
 \r
   case PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED:\r
   default:\r
     break;\r
 \r
   case PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED:\r
   default:\r
-    snp->mode.MediaPresentSupported = FALSE;\r
+    Snp->Mode.MediaPresentSupported = FALSE;\r
   }\r
 \r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) {\r
-    snp->mode.MacAddressChangeable = TRUE;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) {\r
+    Snp->Mode.MacAddressChangeable = TRUE;\r
   } else {\r
   } else {\r
-    snp->mode.MacAddressChangeable = FALSE;\r
+    Snp->Mode.MacAddressChangeable = FALSE;\r
   }\r
 \r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED) != 0) {\r
-    snp->mode.MultipleTxSupported = TRUE;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED) != 0) {\r
+    Snp->Mode.MultipleTxSupported = TRUE;\r
   } else {\r
   } else {\r
-    snp->mode.MultipleTxSupported = FALSE;\r
+    Snp->Mode.MultipleTxSupported = FALSE;\r
   }\r
 \r
   }\r
 \r
-  snp->mode.ReceiveFilterMask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;\r
+  Snp->Mode.ReceiveFilterMask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;\r
 \r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {\r
-    snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {\r
+    Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
 \r
   }\r
 \r
 \r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {\r
-    snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {\r
+    Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;\r
 \r
   }\r
 \r
 \r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {\r
-    snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {\r
+    Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;\r
 \r
   }\r
 \r
 \r
   }\r
 \r
-  if ((pxe->hw.Implementation & PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED) != 0) {\r
-    snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;\r
+  if ((Pxe->hw.Implementation & PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED) != 0) {\r
+    Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;\r
 \r
   }\r
 \r
 \r
   }\r
 \r
-  if (pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) {\r
-    snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
+  if (Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) {\r
+    Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;\r
 \r
   }\r
 \r
 \r
   }\r
 \r
-  snp->mode.ReceiveFilterSetting = 0;\r
+  Snp->Mode.ReceiveFilterSetting = 0;\r
 \r
   //\r
   //  need to get the station address to save in the mode structure. we need to\r
   // initialize the UNDI first for this.\r
   //\r
 \r
   //\r
   //  need to get the station address to save in the mode structure. we need to\r
   // initialize the UNDI first for this.\r
   //\r
-  snp->tx_rx_bufsize  = snp->init_info.MemoryRequired;\r
-  Status              = pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);\r
+  Snp->TxRxBufferSize = Snp->InitInfo.MemoryRequired;\r
+  Status              = PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);\r
 \r
 \r
-  if (Status) {\r
-    pxe_stop (snp);\r
+  if (EFI_ERROR (Status)) {\r
+    PxeStop (Snp);\r
     goto Error_DeleteSNP;\r
   }\r
 \r
     goto Error_DeleteSNP;\r
   }\r
 \r
-  Status = pxe_get_stn_addr (snp);\r
+  Status = PxeGetStnAddr (Snp);\r
 \r
   if (Status != EFI_SUCCESS) {\r
 \r
   if (Status != EFI_SUCCESS) {\r
-    DEBUG ((EFI_D_ERROR, "\nsnp->undi.get_station_addr()  failed.\n"));\r
-    pxe_shutdown (snp);\r
-    pxe_stop (snp);\r
+    DEBUG ((EFI_D_ERROR, "\nSnp->undi.get_station_addr()  failed.\n"));\r
+    PxeShutdown (Snp);\r
+    PxeStop (Snp);\r
     goto Error_DeleteSNP;\r
   }\r
 \r
     goto Error_DeleteSNP;\r
   }\r
 \r
-  snp->mode.MediaPresent = FALSE;\r
+  Snp->Mode.MediaPresent = FALSE;\r
 \r
   //\r
   // We should not leave UNDI started and initialized here. this DriverStart()\r
   // routine must only find and attach the SNP interface to UNDI layer that it\r
   // finds on the given handle!\r
 \r
   //\r
   // We should not leave UNDI started and initialized here. this DriverStart()\r
   // routine must only find and attach the SNP interface to UNDI layer that it\r
   // finds on the given handle!\r
-  // The UNDI layer will be started when upper layers call snp->start.\r
+  // The UNDI layer will be started when upper layers call Snp->start.\r
   // How ever, this DriverStart() must fill up the snp mode structure which\r
   // contains the MAC address of the NIC. For this reason we started and\r
   // initialized UNDI here, now we are done, do a shutdown and stop of the\r
   // UNDI interface!\r
   //\r
   // How ever, this DriverStart() must fill up the snp mode structure which\r
   // contains the MAC address of the NIC. For this reason we started and\r
   // initialized UNDI here, now we are done, do a shutdown and stop of the\r
   // UNDI interface!\r
   //\r
-  pxe_shutdown (snp);\r
-  pxe_stop (snp);\r
+  PxeShutdown (Snp);\r
+  PxeStop (Snp);\r
 \r
   //\r
   //  add SNP to the undi handle\r
 \r
   //\r
   //  add SNP to the undi handle\r
@@ -849,25 +637,25 @@ SimpleNetworkDriverStart (
                   &Controller,\r
                   &gEfiSimpleNetworkProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
                   &Controller,\r
                   &gEfiSimpleNetworkProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
-                  &(snp->snp)\r
+                  &(Snp->Snp)\r
                   );\r
 \r
   if (!EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
                   );\r
 \r
   if (!EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  Status = mPciIoFncs->FreeBuffer (\r
-                        mPciIoFncs,\r
+  Status = mPciIo->FreeBuffer (\r
+                        mPciIo,\r
                         SNP_MEM_PAGES (4096),\r
                         SNP_MEM_PAGES (4096),\r
-                        snp->cpb\r
+                        Snp->Cpb\r
                         );\r
 \r
 Error_DeleteSNP:\r
 \r
                         );\r
 \r
 Error_DeleteSNP:\r
 \r
-  mPciIoFncs->FreeBuffer (\r
-                mPciIoFncs,\r
+  mPciIo->FreeBuffer (\r
+                mPciIo,\r
                 SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
                 SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
-                snp\r
+                Snp\r
                 );\r
 NiiError:\r
   gBS->CloseProtocol (\r
                 );\r
 NiiError:\r
   gBS->CloseProtocol (\r
@@ -887,10 +675,22 @@ NiiError:
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
-\r
 /**\r
 /**\r
-\r
-\r
+  Stop this driver on ControllerHandle. This service is called by the\r
+  EFI boot service DisconnectController(). In order to\r
+  make drivers as small as possible, there are a few calling\r
+  restrictions for this service. DisconnectController()\r
+  must follow these calling restrictions. If any other agent wishes\r
+  to call Stop() it must also follow these calling restrictions.\r
+  \r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -927,7 +727,7 @@ SimpleNetworkDriverStop (
   Status = gBS->UninstallProtocolInterface (\r
                   Controller,\r
                   &gEfiSimpleNetworkProtocolGuid,\r
   Status = gBS->UninstallProtocolInterface (\r
                   Controller,\r
                   &gEfiSimpleNetworkProtocolGuid,\r
-                  &Snp->snp\r
+                  &Snp->Snp\r
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
@@ -948,17 +748,17 @@ SimpleNetworkDriverStop (
                   Controller\r
                   );\r
 \r
                   Controller\r
                   );\r
 \r
-  pxe_shutdown (Snp);\r
-  pxe_stop (Snp);\r
+  PxeShutdown (Snp);\r
+  PxeStop (Snp);\r
 \r
 \r
-  mPciIoFncs->FreeBuffer (\r
-                mPciIoFncs,\r
+  mPciIo->FreeBuffer (\r
+                mPciIo,\r
                 SNP_MEM_PAGES (4096),\r
                 SNP_MEM_PAGES (4096),\r
-                Snp->cpb\r
+                Snp->Cpb\r
                 );\r
 \r
                 );\r
 \r
-  mPciIoFncs->FreeBuffer (\r
-                mPciIoFncs,\r
+  mPciIo->FreeBuffer (\r
+                mPciIo,\r
                 SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
                 Snp\r
                 );\r
                 SNP_MEM_PAGES (sizeof (SNP_DRIVER)),\r
                 Snp\r
                 );\r
@@ -966,18 +766,183 @@ SimpleNetworkDriverStop (
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
+//\r
+// Simple Network Protocol Driver Global Variables\r
+//\r
+EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {\r
+  SimpleNetworkDriverSupported,\r
+  SimpleNetworkDriverStart,\r
+  SimpleNetworkDriverStop,\r
+  0xa,\r
+  NULL,\r
+  NULL\r
+};\r
+\r
+\r
+/**\r
+  This routine maps the given CPU address to a Device address. It creates a\r
+  an entry in the map list with the virtual and physical addresses and the\r
+  un map cookie.\r
+\r
+  @param  V2p                  pointer to return a map list node pointer.\r
+  @param  Type                 the direction in which the data flows from the given\r
+                               virtual address device->cpu or cpu->device or both\r
+                               ways.\r
+  @param  VirtualAddress       virtual address (or CPU address) to be mapped.\r
+  @param  BufferSize           size of the buffer to be mapped.\r
+\r
+  @retval EFI_SUCEESS           routine has completed the mapping.\r
+  @retval EFI_INVALID_PARAMETER invalid parameter.\r
+  @retval EFI_OUT_OF_RESOURCES  out of resource.\r
+  @retval other                 error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+AddV2P (\r
+  IN OUT V2P                    **V2p,\r
+  EFI_PCI_IO_PROTOCOL_OPERATION Type,\r
+  VOID                          *VirtualAddress,\r
+  UINTN                         BufferSize\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  if ((V2p == NULL) || (VirtualAddress == NULL) || (BufferSize == 0)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *V2p = AllocatePool (sizeof (V2P  ));\r
+  if (*V2p != NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  Status = mPciIo->Map (\r
+                        mPciIo,\r
+                        Type,\r
+                        VirtualAddress,\r
+                        &BufferSize,\r
+                        &(*V2p)->PhysicalAddress,\r
+                        &(*V2p)->Unmap\r
+                        );\r
+  if (Status != EFI_SUCCESS) {\r
+    FreePool (*V2p);\r
+    return Status;\r
+  }\r
+  (*V2p)->VirtualAddress = VirtualAddress;\r
+  (*V2p)->BufferSize = BufferSize;\r
+  (*V2p)->Next  = mV2p;\r
+  mV2p          = *V2p;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+  This routine searches the linked list of mapped address nodes (for undi3.0\r
+  interface) to find the node that corresponds to the given virtual address and\r
+  returns a pointer to that node.\r
+\r
+  @param  V2p                  pointer to return a map list node pointer.\r
+  @param  VirtualAddr          virtual address (or CPU address) to be searched in\r
+                               the map list\r
+\r
+  @retval EFI_SUCEESS          if a match found!\r
+  @retval Other                match not found\r
+\r
+**/\r
+EFI_STATUS\r
+FindV2p (\r
+  V2P          **V2p,\r
+  VOID         *VirtualAddr\r
+  )\r
+{\r
+  V2P    *Ptr;\r
+\r
+  if (V2p == NULL || VirtualAddr == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  for (Ptr = mV2p; Ptr != NULL; Ptr = Ptr->Next) {\r
+    if (Ptr->VirtualAddress == VirtualAddr) {\r
+      *V2p = Ptr;\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
+\r
+\r
+/**\r
+  This routine unmaps the given virtual address and frees the memory allocated\r
+  for the map list node corresponding to that address.\r
+\r
+  @param  VirtualAddress       virtual address (or CPU address) to be unmapped\r
+\r
+  @retval EFI_SUCEESS          if successfully unmapped\r
+  @retval Other                as indicated by the error\r
+\r
+**/\r
+EFI_STATUS\r
+DelV2p (\r
+  VOID *VirtualAddress\r
+  )\r
+{\r
+  V2P           *Current;\r
+  V2P           *Next;\r
+  EFI_STATUS    Status;\r
+\r
+  if (VirtualAddress == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (mV2p == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+  //\r
+  // Is our node at the head of the list??\r
+  //\r
+  if ((Current = mV2p)->VirtualAddress == VirtualAddress) {\r
+    mV2p    = mV2p->Next;\r
+\r
+    Status  = mPciIo->Unmap (mPciIo, Current->Unmap);\r
+\r
+    FreePool (Current);\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "Unmap failed with status = %r\n", Status));\r
+    }\r
+    return Status;\r
+  }\r
+\r
+  for (; Current->Next != NULL; Current = Next) {\r
+    if ((Next = Current->Next)->VirtualAddress == VirtualAddress) {\r
+      Current->Next = Next->Next;\r
+      Status  = mPciIo->Unmap (mPciIo, Next->Unmap);\r
+      FreePool (Next);\r
+\r
+      if (EFI_ERROR (Status)) {\r
+        DEBUG ((EFI_D_ERROR, "Unmap failed with status = %r\n", Status));\r
+      }\r
+      return Status;\r
+    }\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
 \r
 /**\r
 \r
 /**\r
-  Install all the driver protocol\r
+  The SNP driver entry point.\r
 \r
 \r
-  @param  entry                EFI_IMAGE_ENTRY_POINT)\r
+  @param ImageHandle       The driver image handle.\r
+  @param SystemTable       The system table.\r
 \r
 \r
-  @retval EFI_SUCEESS          Initialization routine has found UNDI hardware,\r
-                               loaded it's ROM, and installed a notify event for\r
-                               the Network Indentifier Interface Protocol\r
-                               successfully.\r
-  @retval Other                Return value from HandleProtocol for\r
-                               DeviceIoProtocol or LoadedImageProtocol\r
+  @retval EFI_SUCEESS      Initialization routine has found UNDI hardware,\r
+                           loaded it's ROM, and installed a notify event for\r
+                           the Network Indentifier Interface Protocol\r
+                           successfully.\r
+  @retval Other            Return value from HandleProtocol for\r
+                           DeviceIoProtocol or LoadedImageProtocol\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
index 4532ab479628055a6e44579ff4dd62cfe2902b04..8ef5f97a80d4170bd014de20cce1da1d9f7790c6 100644 (file)
@@ -1,25 +1,18 @@
 /** @file\r
 /** @file\r
+    Declaration of strctures and functions for SnpDxe driver.\r
 \r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-    snp.h\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-\r
-\r
 **/\r
 **/\r
-#ifndef _SNP_H\r
-#define _SNP_H\r
+#ifndef _SNP_H_\r
+#define _SNP_H_\r
 \r
 \r
 #include <PiDxe.h>\r
 \r
 \r
 #include <PiDxe.h>\r
@@ -52,15 +45,21 @@ Revision history:
 #define PCI_BAR_MEM_MODE      0x00000000\r
 #define PCI_BAR_MEM_64BIT     0x00000004\r
 \r
 #define PCI_BAR_MEM_MODE      0x00000000\r
 #define PCI_BAR_MEM_64BIT     0x00000004\r
 \r
+typedef\r
+EFI_STATUS\r
+(*ISSUE_UNDI32_COMMAND) (\r
+  UINT64         Cdb\r
+  );\r
+  \r
 typedef struct {\r
   UINT32                      Signature;\r
 typedef struct {\r
   UINT32                      Signature;\r
-  EFI_LOCK                    lock;\r
+  EFI_LOCK                    Lock;\r
 \r
 \r
-  EFI_SIMPLE_NETWORK_PROTOCOL snp;\r
-  EFI_SIMPLE_NETWORK_MODE     mode;\r
+  EFI_SIMPLE_NETWORK_PROTOCOL Snp;\r
+  EFI_SIMPLE_NETWORK_MODE     Mode;\r
 \r
 \r
-  EFI_HANDLE                  device_handle;\r
-  EFI_DEVICE_PATH_PROTOCOL    *device_path;\r
+  EFI_HANDLE                  DeviceHandle;\r
+  EFI_DEVICE_PATH_PROTOCOL    *DevicePath;\r
 \r
   //\r
   //  Local instance data needed by SNP driver\r
 \r
   //\r
   //  Local instance data needed by SNP driver\r
@@ -68,31 +67,31 @@ typedef struct {
   //  Pointer to S/W UNDI API entry point\r
   //  This will be NULL for H/W UNDI\r
   //\r
   //  Pointer to S/W UNDI API entry point\r
   //  This will be NULL for H/W UNDI\r
   //\r
-  EFI_STATUS (*issue_undi32_command) (UINT64 cdb);\r
+  ISSUE_UNDI32_COMMAND  IssueUndi32Command;\r
 \r
 \r
-  BOOLEAN               is_swundi;\r
+  BOOLEAN               IsSwUndi;\r
 \r
   //\r
   // undi interface number, if one undi manages more nics\r
   //\r
 \r
   //\r
   // undi interface number, if one undi manages more nics\r
   //\r
-  PXE_IFNUM             if_num;\r
+  PXE_IFNUM             IfNum;\r
 \r
   //\r
   //  Allocated tx/rx buffer that was passed to UNDI Initialize.\r
   //\r
 \r
   //\r
   //  Allocated tx/rx buffer that was passed to UNDI Initialize.\r
   //\r
-  UINT32                tx_rx_bufsize;\r
-  VOID                  *tx_rx_buffer;\r
+  UINT32                TxRxBufferSize;\r
+  VOID                  *TxRxBuffer;\r
   //\r
   // mappable buffers for receive and fill header for undi3.0\r
   // these will be used if the user buffers are above 4GB limit (instead of\r
   // mapping the user buffers)\r
   //\r
   //\r
   // mappable buffers for receive and fill header for undi3.0\r
   // these will be used if the user buffers are above 4GB limit (instead of\r
   // mapping the user buffers)\r
   //\r
-  UINT8                 *receive_buf;\r
-  VOID                  *ReceiveBufUnmap;\r
-  UINT8                 *fill_hdr_buf;\r
-  VOID                  *FillHdrBufUnmap;\r
+  UINT8                 *ReceiveBufffer;\r
+  VOID                  *ReceiveBufferUnmap;\r
+  UINT8                 *FillHeaderBuffer;\r
+  VOID                  *FillHeaderBufferUnmap;\r
 \r
 \r
-  EFI_PCI_IO_PROTOCOL   *IoFncs;\r
+  EFI_PCI_IO_PROTOCOL   *PciIo;\r
   UINT8                 IoBarIndex;\r
   UINT8                 MemoryBarIndex;\r
 \r
   UINT8                 IoBarIndex;\r
   UINT8                 MemoryBarIndex;\r
 \r
@@ -100,29 +99,28 @@ typedef struct {
   // Buffers for command descriptor block, command parameter block\r
   // and data block.\r
   //\r
   // Buffers for command descriptor block, command parameter block\r
   // and data block.\r
   //\r
-  PXE_CDB               cdb;\r
-  VOID                  *cpb;\r
+  PXE_CDB               Cdb;\r
+  VOID                  *Cpb;\r
   VOID                  *CpbUnmap;\r
   VOID                  *CpbUnmap;\r
-  VOID                  *db;\r
+  VOID                  *Db;\r
 \r
   //\r
   // UNDI structure, we need to remember the init info for a long time!\r
   //\r
 \r
   //\r
   // UNDI structure, we need to remember the init info for a long time!\r
   //\r
-  PXE_DB_GET_INIT_INFO  init_info;\r
+  PXE_DB_GET_INIT_INFO  InitInfo;\r
 \r
   VOID                  *SnpDriverUnmap;\r
   //\r
   // when ever we map an address, we must remember it's address and the un-map\r
   // cookie so that we can unmap later\r
   //\r
 \r
   VOID                  *SnpDriverUnmap;\r
   //\r
   // when ever we map an address, we must remember it's address and the un-map\r
   // cookie so that we can unmap later\r
   //\r
-  struct s_map_list {\r
-    EFI_PHYSICAL_ADDRESS  virt;\r
-    VOID                  *map_cookie;\r
-  } map_list[MAX_MAP_LENGTH];\r
-}\r
-SNP_DRIVER;\r
+  struct MAP_LIST {\r
+    EFI_PHYSICAL_ADDRESS  VirtualAddress;\r
+    VOID                  *MapCookie;\r
+  } MapList[MAX_MAP_LENGTH];\r
+} SNP_DRIVER;\r
 \r
 \r
-#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)\r
+#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)\r
 \r
 //\r
 // Global Variables\r
 \r
 //\r
 // Global Variables\r
@@ -133,79 +131,274 @@ extern EFI_COMPONENT_NAME2_PROTOCOL   gSimpleNetworkComponentName2;
 //\r
 //  Virtual to physical mapping for all UNDI 3.0s.\r
 //\r
 //\r
 //  Virtual to physical mapping for all UNDI 3.0s.\r
 //\r
-extern struct                       s_v2p {\r
-  struct s_v2p          *next;\r
-  VOID                  *vaddr;\r
-  UINTN                 bsize;\r
-  EFI_PHYSICAL_ADDRESS  paddr;\r
-  VOID                  *unmap;\r
-}\r
-*_v2p;\r
+typedef struct _V2P {\r
+  struct _V2P           *Next;\r
+  VOID                  *VirtualAddress;\r
+  UINTN                 BufferSize;\r
+  EFI_PHYSICAL_ADDRESS  PhysicalAddress;\r
+  VOID                  *Unmap;\r
+} V2P;\r
+\r
+/**\r
+  This routine maps the given CPU address to a Device address. It creates a\r
+  an entry in the map list with the virtual and physical addresses and the\r
+  un map cookie.\r
+\r
+  @param  V2p                  pointer to return a map list node pointer.\r
+  @param  Type                 the direction in which the data flows from the given\r
+                               virtual address device->cpu or cpu->device or both\r
+                               ways.\r
+  @param  VirtualAddress       virtual address (or CPU address) to be mapped.\r
+  @param  BufferSize           size of the buffer to be mapped.\r
+\r
+  @retval EFI_SUCEESS          routine has completed the mapping.\r
+  @retval other                error as indicated.\r
 \r
 \r
+**/\r
 EFI_STATUS\r
 EFI_STATUS\r
-add_v2p (\r
-  struct s_v2p                  **v2p,\r
-  EFI_PCI_IO_PROTOCOL_OPERATION type,\r
-  VOID                          *vaddr,\r
-  UINTN                         bsize\r
+AddV2p (\r
+  V2P                           **V2p,\r
+  EFI_PCI_IO_PROTOCOL_OPERATION Type,\r
+  VOID                          *VirtualAddress,\r
+  UINTN                         BufferSize\r
   );\r
 \r
   );\r
 \r
+/**\r
+  This routine searches the linked list of mapped address nodes (for undi3.0\r
+  interface) to find the node that corresponds to the given virtual address and\r
+  returns a pointer to that node.\r
+\r
+  @param  V2p                  pointer to return a map list node pointer.\r
+  @param  VirtualAddress                virtual address (or CPU address) to be searched in\r
+                               the map list\r
+\r
+  @retval EFI_SUCEESS          if a match found!\r
+  @retval Other                match not found\r
+\r
+**/\r
 EFI_STATUS\r
 EFI_STATUS\r
-find_v2p (\r
-  struct s_v2p **v2p,\r
-  VOID         *vaddr\r
+FindV2p (\r
+  V2P          **V2p,\r
+  VOID         *VirtualAddress\r
   );\r
 \r
   );\r
 \r
+/**\r
+  this routine calls undi to start the interface and changes the snp state.\r
+\r
+  @param  Snp                    pointer to snp driver structure\r
+\r
+  @retval EFI_DEVICE_ERROR       UNDI could not be started\r
+  @retval EFI_SUCCESS            UNDI is started successfully\r
+  \r
+**/\r
+EFI_STATUS\r
+PxeStart (\r
+  IN SNP_DRIVER *Snp\r
+  );\r
+\r
+/**\r
+  this routine calls undi to stop the interface and changes the snp state.\r
+\r
+  @param  Snp   pointer to snp driver structure\r
+\r
+  @retval EFI_INVALID_PARAMETER  invalid parameter\r
+  @retval EFI_NOT_STARTED        SNP is not started\r
+  @retval EFI_DEVICE_ERROR       SNP is not initialized\r
+  @retval EFI_UNSUPPORTED        operation unsupported\r
+\r
+**/\r
+EFI_STATUS\r
+PxeStop (\r
+  SNP_DRIVER *Snp\r
+  );\r
+\r
+/**\r
+  this routine calls undi to initialize the interface.\r
+\r
+  @param  Snp                   pointer to snp driver structure\r
+  @param  CableDetectFlag       Do/don't detect the cable (depending on what undi supports)\r
+  \r
+  @retval EFI_SUCCESS           UNDI is initialized successfully\r
+  @retval EFI_DEVICE_ERROR      UNDI could not be initialized\r
+  @retval Other                 other errors \r
+\r
+**/\r
+EFI_STATUS\r
+PxeInit (\r
+  SNP_DRIVER *Snp,\r
+  UINT16     CableDetectFlag\r
+  );\r
+  \r
+/**\r
+  this routine calls undi to shut down the interface.\r
+\r
+  @param  Snp   pointer to snp driver structure\r
+\r
+  @retval EFI_SUCCESS        UNDI is shut down successfully\r
+  @retval EFI_DEVICE_ERROR   UNDI could not be shut down\r
+\r
+**/\r
 EFI_STATUS\r
 EFI_STATUS\r
-del_v2p (\r
-  VOID *vaddr\r
+PxeShutdown (\r
+  IN SNP_DRIVER *Snp\r
   );\r
 \r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_block_30 (\r
+/**\r
+  this routine calls undi to read the MAC address of the NIC and updates the\r
+  mode structure with the address.\r
+\r
+  @param  Snp         pointer to snp driver structure.\r
+   \r
+  @retval EFI_SUCCESS       the MAC address of the NIC is read successfully.\r
+  @retval EFI_DEVICE_ERROR  failed to read the MAC address of the NIC.\r
+\r
+**/\r
+EFI_STATUS\r
+PxeGetStnAddr (\r
+  SNP_DRIVER *Snp\r
+  );\r
+\r
+/**\r
+  This routine unmaps the given virtual address and frees the memory allocated\r
+  for the map list node corresponding to that address.\r
+\r
+  @param  VirtualAddress       virtual address (or CPU address) to be unmapped\r
+\r
+  @retval EFI_SUCEESS          if successfully unmapped\r
+  @retval Other                as indicated by the error\r
+\r
+**/\r
+EFI_STATUS\r
+DelV2p (\r
+  VOID *VirtualAddress\r
+  );\r
+\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants to have exclusive access to a critical\r
+  section of the code/data.\r
+\r
+  @param Enable   non-zero indicates acquire\r
+                  zero indicates release\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackBlock30 (\r
   IN UINT32 Enable\r
   );\r
 \r
   IN UINT32 Enable\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_delay_30 (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with the number of micro seconds when it wants to\r
+  pause.\r
+\r
+  @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackDelay30 (\r
   IN UINT64 MicroSeconds\r
   );\r
 \r
   IN UINT64 MicroSeconds\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_memio_30 (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
+  because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
+  io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
+  start of the device's io/mem addresses. Since SNP cannot retrive the context\r
+  of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
+  that NIC and uses one global IO functions structure, this does not work.\r
+  This however works fine for EFI1.0 Undis because they use absolute addresses\r
+  for io/mem access.\r
+\r
+  @param ReadOrWrite  indicates read or write, IO or Memory\r
+  @param NumBytes     number of bytes to read or write\r
+  @param Address      IO or memory address to read from or write to\r
+  @param BufferAddr   memory location to read into or that contains the bytes to \r
+                      write\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackMemio30 (\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
-  IN UINT64     MemOrPortAddress,\r
-  IN OUT UINT64 BufferPtr\r
+  IN UINT64     Address,\r
+  IN OUT UINT64 BufferAddr\r
   );\r
 \r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_v2p_30 (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with a virtual or CPU address that SNP provided to \r
+  convert it to a physical or device address. Since EFI uses the identical \r
+  mapping, this routine returns the physical address same as the virtual address\r
+  for most of the addresses. an address above 4GB cannot generally be used as a \r
+  device address, it needs to be mapped to a lower physical address. This \r
+  routine does not call the map routine itself, but it assumes that the mapping\r
+  was done at the time of providing the address to UNDI. This routine just \r
+  looks up the address in a map table (which is the v2p structure chain). \r
+  \r
+  @param  CpuAddr        virtual address of a buffer.\r
+  @param  DeviceAddrPtr  pointer to the physical address.\r
+                         The DeviceAddrPtr will contain 0 in case of any error.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackV2p30 (\r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
   );\r
 \r
   IN UINT64     CpuAddr,\r
   IN OUT UINT64 DeviceAddrPtr\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_block (\r
+/**\r
+  This is a callback routine supplied to UNDI3.1 at undi_start time.\r
+  UNDI call this routine when it wants to have exclusive access to a critical\r
+  section of the code/data.\r
+  New callbacks for 3.1:\r
+  there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
+  the MemMap call to map the required address by itself!\r
+\r
+  @param UniqueId  This was supplied to UNDI at Undi_Start, SNP uses this to \r
+                                                                store Undi interface context (Undi does not read or write\r
+                                                                this variable)\r
+  @param Enable    non-zero indicates acquire\r
+                   zero indicates release\r
+**/\r
+VOID\r
+SnpUndi32CallbackBlock (\r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
   );\r
 \r
   IN UINT64 UniqueId,\r
   IN UINT32 Enable\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_delay (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine with the number of micro seconds when it wants to\r
+  pause.\r
+\r
+  @param UniqueId      This was supplied to UNDI at Undi_Start, SNP uses this to\r
+                                                                    store Undi interface context (Undi does not read or write\r
+                                                                    this variable)\r
+  @param MicroSeconds  number of micro seconds to pause, ususlly multiple of 10.\r
+**/\r
+VOID\r
+SnpUndi32CallbackDelay (\r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
   );\r
 \r
   IN UINT64 UniqueId,\r
   IN UINT64 MicroSeconds\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_memio (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  This is the IO routine for UNDI3.1 to start CPB.\r
+\r
+  @param UniqueId       This was supplied to UNDI at Undi_Start, SNP uses this \r
+                                                                                       to store Undi interface context (Undi does not read or\r
+                                                                                       write this variable)\r
+  @param ReadOrWrite    indicates read or write, IO or Memory.\r
+  @param NumBytes       number of bytes to read or write.\r
+  @param MemOrPortAddr  IO or memory address to read from or write to.\r
+  @param BufferPtr      memory location to read into or that contains the bytes\r
+                        to write.\r
+**/\r
+VOID\r
+SnpUndi32CallbackMemio (\r
   IN UINT64     UniqueId,\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
   IN UINT64     UniqueId,\r
   IN UINT8      ReadOrWrite,\r
   IN UINT8      NumBytes,\r
@@ -213,9 +406,22 @@ snp_undi32_callback_memio (
   IN OUT UINT64 BufferPtr\r
   );\r
 \r
   IN OUT UINT64 BufferPtr\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_map (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it has to map a CPU address to a device\r
+  address.\r
+\r
+  @param UniqueId      - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+                         Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr       - Virtual address to be mapped!\r
+  @param NumBytes      - size of memory to be mapped\r
+  @param Direction     - direction of data flow for this memory's usage:\r
+                         cpu->device, device->cpu or both ways\r
+  @param DeviceAddrPtr - pointer to return the mapped device address\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackMap (\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
   IN UINT32     NumBytes,\r
   IN UINT64     UniqueId,\r
   IN UINT64     CpuAddr,\r
   IN UINT32     NumBytes,\r
@@ -223,184 +429,688 @@ snp_undi32_callback_map (
   IN OUT UINT64 DeviceAddrPtr\r
   );\r
 \r
   IN OUT UINT64 DeviceAddrPtr\r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_unmap (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants to unmap an address that was previously\r
+  mapped using map callback.\r
+\r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store.\r
+                     Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr     Virtual address that was mapped!\r
+  @param NumBytes    size of memory mapped\r
+  @param Direction   direction of data flow for this memory's usage:\r
+                     cpu->device, device->cpu or both ways\r
+  @param DeviceAddr  the mapped device address\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackUnmap (\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
   IN UINT32             NumBytes,\r
   IN UINT32             Direction,\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
   IN UINT32             NumBytes,\r
   IN UINT32             Direction,\r
-  IN UINT64 DeviceAddr  // not a pointer to device address\r
+  IN UINT64             DeviceAddr\r
   );\r
 \r
   );\r
 \r
-extern\r
-VOID \r
-snp_undi32_callback_sync (\r
+/**\r
+  This is a callback routine supplied to UNDI at undi_start time.\r
+  UNDI call this routine when it wants synchronize the virtual buffer contents\r
+  with the mapped buffer contents. The virtual and mapped buffers need not\r
+  correspond to the same physical memory (especially if the virtual address is\r
+  > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
+  need to synchronize their contents whenever it writes to/reads from the buffer\r
+  using either the cpu address or the device address.\r
+\r
+  EFI does not provide a sync call, since virt=physical, we sould just do\r
+  the synchronization ourself here!\r
+\r
+  @param UniqueId    This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+                     Undi interface context (Undi does not read or write this variable)\r
+  @param CpuAddr     Virtual address that was mapped!\r
+  @param NumBytes    size of memory mapped.\r
+  @param Direction   direction of data flow for this memory's usage:\r
+                     cpu->device, device->cpu or both ways.\r
+  @param DeviceAddr  the mapped device address.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackSync (\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
   IN UINT32             NumBytes,\r
   IN UINT32             Direction,\r
   IN UINT64             UniqueId,\r
   IN UINT64             CpuAddr,\r
   IN UINT32             NumBytes,\r
   IN UINT32             Direction,\r
-  IN UINT64 DeviceAddr  // not a pointer to device address\r
+  IN UINT64             DeviceAddr\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Changes the state of a network interface from "stopped" to "started".\r
+  \r
+  This function starts a network interface. If the network interface successfully\r
+  starts, then EFI_SUCCESS will be returned.\r
+\r
+  @param  This                   A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS            The network interface was started.\r
+  @retval EFI_ALREADY_STARTED    The network interface is already in the started state.\r
+  @retval EFI_INVALID_PARAMETER  This parameter was NULL or did not point to a valid \r
+                                 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR       The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED        This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_start (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Start (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Changes the state of a network interface from "started" to "stopped".\r
+  \r
+  This function stops a network interface. This call is only valid if the network\r
+  interface is in the started state. If the network interface was successfully\r
+  stopped, then EFI_SUCCESS will be returned.\r
+  \r
+  @param  This                    A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  \r
+  \r
+  @retval EFI_SUCCESS             The network interface was stopped.\r
+  @retval EFI_NOT_STARTED         The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER   This parameter was NULL or did not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR        The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED         This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_stop (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Stop (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   );\r
 \r
   );\r
 \r
-extern\r
+/**\r
+  Resets a network adapter and allocates the transmit and receive buffers \r
+  required by the network interface; optionally, also requests allocation of \r
+  additional transmit and receive buffers.\r
+\r
+  This function allocates the transmit and receive buffers required by the network\r
+  interface. If this allocation fails, then EFI_OUT_OF_RESOURCES is returned.\r
+  If the allocation succeeds and the network interface is successfully initialized,\r
+  then EFI_SUCCESS will be returned.\r
+\r
+  @param This               A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @param ExtraRxBufferSize  The size, in bytes, of the extra receive buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the \r
+                            extra buffer, and the caller will not know if it is \r
+                            actually being used.\r
+  @param ExtraTxBufferSize  The size, in bytes, of the extra transmit buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the\r
+                            extra buffer, and the caller will not know if it is\r
+                            actually being used.\r
+\r
+  @retval EFI_SUCCESS           The network interface was initialized.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory for the transmit and\r
+                                receive buffers.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       The increased buffer size feature is not supported.\r
+\r
+**/\r
 EFI_STATUS \r
 EFIAPI\r
 EFI_STATUS \r
 EFIAPI\r
-snp_undi32_initialize (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
-  IN UINTN                       extra_rx_buffer_size OPTIONAL,\r
-  IN UINTN                       extra_tx_buffer_size OPTIONAL\r
+SnpUndi32Initialize (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINTN                       ExtraRxBufferSize OPTIONAL,\r
+  IN UINTN                       ExtraTxBufferSize OPTIONAL\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Resets a network adapter and reinitializes it with the parameters that were\r
+  provided in the previous call to Initialize().\r
+\r
+  This function resets a network adapter and reinitializes it with the parameters\r
+  that were provided in the previous call to Initialize(). The transmit and \r
+  receive queues are emptied and all pending interrupts are cleared.\r
+  Receive filters, the station address, the statistics, and the multicast-IP-to-HW \r
+  MAC addresses are not reset by this call. If the network interface was \r
+  successfully reset, then EFI_SUCCESS will be returned. If the driver has not \r
+  been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This                 A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param ExtendedVerification Indicates that the driver may perform a more \r
+                              exhaustive verification operation of the device \r
+                              during reset.\r
+\r
+  @retval EFI_SUCCESS           The network interface was reset.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_reset (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL  *this,\r
+SnpUndi32Reset (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This,\r
   IN BOOLEAN                      ExtendedVerification\r
   );\r
 \r
   IN BOOLEAN                      ExtendedVerification\r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Resets a network adapter and leaves it in a state that is safe for another \r
+  driver to initialize. \r
+  \r
+  This function releases the memory buffers assigned in the Initialize() call.\r
+  Pending transmits and receives are lost, and interrupts are cleared and disabled.\r
+  After this call, only the Initialize() and Stop() calls may be used. If the \r
+  network interface was successfully shutdown, then EFI_SUCCESS will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param  This  A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The network interface was shutdown.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_shutdown (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Shutdown (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Manages the multicast receive filters of a network interface.\r
+  \r
+  This function is used enable and disable the hardware and software receive \r
+  filters for the underlying network device.\r
+  The receive filter change is broken down into three steps: \r
+  * The filter mask bits that are set (ON) in the Enable parameter are added to \r
+    the current receive filter settings. \r
+  * The filter mask bits that are set (ON) in the Disable parameter are subtracted\r
+    from the updated receive filter settings.\r
+  * If the resulting receive filter setting is not supported by the hardware a\r
+    more liberal setting is selected.\r
+  If the same bits are set in the Enable and Disable parameters, then the bits \r
+  in the Disable parameter takes precedence.\r
+  If the ResetMCastFilter parameter is TRUE, then the multicast address list \r
+  filter is disabled (irregardless of what other multicast bits are set in the \r
+  Enable and Disable parameters). The SNP->Mode->MCastFilterCount field is set \r
+  to zero. The Snp->Mode->MCastFilter contents are undefined.\r
+  After enabling or disabling receive filter settings, software should verify \r
+  the new settings by checking the Snp->Mode->ReceiveFilterSettings, \r
+  Snp->Mode->MCastFilterCount and Snp->Mode->MCastFilter fields.\r
+  Note: Some network drivers and/or devices will automatically promote receive \r
+    filter settings if the requested setting can not be honored. For example, if\r
+    a request for four multicast addresses is made and the underlying hardware \r
+    only supports two multicast addresses the driver might set the promiscuous \r
+    or promiscuous multicast receive filters instead. The receiving software is\r
+    responsible for discarding any extra packets that get through the hardware \r
+    receive filters.\r
+    Note: Note: To disable all receive filter hardware, the network driver must \r
+      be Shutdown() and Stopped(). Calling ReceiveFilters() with Disable set to\r
+      Snp->Mode->ReceiveFilterSettings will make it so no more packets are \r
+      returned by the Receive() function, but the receive hardware may still be \r
+      moving packets into system memory before inspecting and discarding them.\r
+      Unexpected system errors, reboots and hangs can occur if an OS is loaded \r
+      and the network devices are not Shutdown() and Stopped().\r
+  If ResetMCastFilter is TRUE, then the multicast receive filter list on the \r
+  network interface will be reset to the default multicast receive filter list.\r
+  If ResetMCastFilter is FALSE, and this network interface allows the multicast \r
+  receive filter list to be modified, then the MCastFilterCnt and MCastFilter \r
+  are used to update the current multicast receive filter list. The modified \r
+  receive filter list settings can be found in the MCastFilter field of \r
+  EFI_SIMPLE_NETWORK_MODE. If the network interface does not allow the multicast\r
+  receive filter list to be modified, then EFI_INVALID_PARAMETER will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+  If the receive filter mask and multicast receive filter list have been \r
+  successfully updated on the network interface, EFI_SUCCESS will be returned.\r
+\r
+  @param This             A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Enable           A bit mask of receive filters to enable on the network\r
+                          interface.\r
+  @param Disable          A bit mask of receive filters to disable on the network\r
+                          interface. For backward compatibility with EFI 1.1 \r
+                          platforms, the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit\r
+                          must be set when the ResetMCastFilter parameter is TRUE.\r
+  @param ResetMCastFilter Set to TRUE to reset the contents of the multicast \r
+                          receive filters on the network interface to their \r
+                          default values. \r
+  @param MCastFilterCnt   Number of multicast HW MAC addresses in the new MCastFilter\r
+                          list. This value must be less than or equal to the \r
+                          MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. \r
+                          This field is optional if ResetMCastFilter is TRUE.\r
+  @param MCastFilter      A pointer to a list of new multicast receive filter HW\r
+                          MAC addresses. This list will replace any existing \r
+                          multicast HW MAC address list. This field is optional \r
+                          if ResetMCastFilter is TRUE.\r
+   \r
+  @retval EFI_SUCCESS            The multicast receive filter list was updated.\r
+  @retval EFI_NOT_STARTED        The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 * This is NULL\r
+                                 * There are bits set in Enable that are not set\r
+                                   in Snp->Mode->ReceiveFilterMask\r
+                                 * There are bits set in Disable that are not set\r
+                                   in Snp->Mode->ReceiveFilterMask\r
+                                 * Multicast is being enabled (the \r
+                                   EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit is \r
+                                   set in Enable, it is not set in Disable, and \r
+                                   ResetMCastFilter is FALSE) and MCastFilterCount\r
+                                   is zero\r
+                                 * Multicast is being enabled and MCastFilterCount\r
+                                   is greater than Snp->Mode->MaxMCastFilterCount\r
+                                 * Multicast is being enabled and MCastFilter is NULL\r
+                                 * Multicast is being enabled and one or more of\r
+                                   the addresses in the MCastFilter list are not\r
+                                   valid multicast MAC addresses\r
+  @retval EFI_DEVICE_ERROR       One or more of the following conditions is TRUE:\r
+                                 * The network interface has been started but has\r
+                                   not been initialized\r
+                                 * An unexpected error was returned by the \r
+                                   underlying network driver or device\r
+  @retval EFI_UNSUPPORTED        This function is not supported by the network\r
+                                 interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_receive_filters (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN UINT32                      enable,\r
-  IN UINT32                      disable,\r
-  IN BOOLEAN                     reset_mcast_filter,\r
-  IN UINTN                       mcast_filter_count OPTIONAL,\r
-  IN EFI_MAC_ADDRESS             * mcast_filter OPTIONAL\r
+SnpUndi32ReceiveFilters (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINT32                      Enable,\r
+  IN UINT32                      Disable,\r
+  IN BOOLEAN                     ResetMCastFilter,\r
+  IN UINTN                       MCastFilterCnt,  OPTIONAL\r
+  IN EFI_MAC_ADDRESS             *MCastFilter     OPTIONAL\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Modifies or resets the current station address, if supported.\r
+  \r
+  This function modifies or resets the current station address of a network \r
+  interface, if supported. If Reset is TRUE, then the current station address is\r
+  set to the network interface's permanent address. If Reset is FALSE, and the \r
+  network interface allows its station address to be modified, then the current \r
+  station address is changed to the address specified by New. If the network \r
+  interface does not allow its station address to be modified, then \r
+  EFI_INVALID_PARAMETER will be returned. If the station address is successfully\r
+  updated on the network interface, EFI_SUCCESS will be returned. If the driver\r
+  has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This  A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Reset Flag used to reset the station address to the network interface's \r
+               permanent address.\r
+  @param New   New station address to be used for the network interface.\r
+\r
+\r
+  @retval EFI_SUCCESS           The network interface's station address was updated.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not been \r
+                                started by calling Start().\r
+  @retval EFI_INVALID_PARAMETER The New station address was not accepted by the NIC.\r
+  @retval EFI_INVALID_PARAMETER Reset is FALSE and New is NULL.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_DEVICE_ERROR      An error occurred attempting to set the new \r
+                                station address.\r
+  @retval EFI_UNSUPPORTED       The NIC does not support changing the network \r
+                                interface's station address.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_station_address (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN BOOLEAN                     reset,\r
-  IN EFI_MAC_ADDRESS             *new OPTIONAL\r
+SnpUndi32StationAddress (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     Reset,\r
+  IN EFI_MAC_ADDRESS             *New  OPTIONAL\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Resets or collects the statistics on a network interface.\r
+  \r
+  This function resets or collects the statistics on a network interface. If the\r
+  size of the statistics table specified by StatisticsSize is not big enough for\r
+  all the statistics that are collected by the network interface, then a partial\r
+  buffer of statistics is returned in StatisticsTable, StatisticsSize is set to \r
+  the size required to collect all the available statistics, and \r
+  EFI_BUFFER_TOO_SMALL is returned.\r
+  If StatisticsSize is big enough for all the statistics, then StatisticsTable \r
+  will be filled, StatisticsSize will be set to the size of the returned \r
+  StatisticsTable structure, and EFI_SUCCESS is returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+  If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then\r
+  no operations will be performed, and EFI_SUCCESS will be returned.\r
+  If Reset is TRUE, then all of the supported statistics counters on this network\r
+  interface will be reset to zero.\r
+\r
+  @param This            A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Reset           Set to TRUE to reset the statistics for the network interface.\r
+  @param StatisticsSize  On input the size, in bytes, of StatisticsTable. On output \r
+                         the size, in bytes, of the resulting table of statistics.\r
+  @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that \r
+                         contains the statistics. Type EFI_NETWORK_STATISTICS is \r
+                         defined in "Related Definitions" below. \r
+  \r
+  @retval EFI_SUCCESS           The requested operation succeeded.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not been\r
+                                started by calling Start().\r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
+                                NULL. The current buffer size that is needed to \r
+                                hold all the statistics is returned in StatisticsSize.\r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
+                                not NULL. The current buffer size that is needed\r
+                                to hold all the statistics is returned in \r
+                                StatisticsSize. A partial set of statistics is \r
+                                returned in StatisticsTable.\r
+  @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not \r
+                                NULL.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_DEVICE_ERROR      An error was encountered collecting statistics \r
+                                from the NIC.\r
+  @retval EFI_UNSUPPORTED       The NIC does not support collecting statistics \r
+                                from the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_statistics (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL  * this,\r
-  IN BOOLEAN                      reset,\r
-  IN OUT UINTN                    *statistics_size OPTIONAL,\r
-  IN OUT EFI_NETWORK_STATISTICS   * statistics_table OPTIONAL\r
+SnpUndi32Statistics (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     Reset,\r
+  IN OUT UINTN                   *StatisticsSize,  OPTIONAL\r
+  IN OUT EFI_NETWORK_STATISTICS  *StatisticsTable  OPTIONAL\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Converts a multicast IP address to a multicast HW MAC address.\r
+  \r
+  This function converts a multicast IP address to a multicast HW MAC address \r
+  for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will\r
+  be returned.\r
+\r
+  @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460].\r
+              Set to FALSE if the multicast IP address is IPv4 [RFC 791]. \r
+  @param IP   The multicast IP address that is to be converted to a multicast \r
+              HW MAC address.\r
+  @param MAC  The multicast HW MAC address that is to be generated from IP.\r
+  \r
+  @retval EFI_SUCCESS           The multicast IP address was mapped to the\r
+                                multicast HW MAC address.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not\r
+                                been started by calling Start().\r
+  @retval EFI_INVALID_PARAMETER IP is NULL.\r
+  @retval EFI_INVALID_PARAMETER MAC is NULL.\r
+  @retval EFI_INVALID_PARAMETER IP does not point to a valid IPv4 or IPv6 \r
+                                multicast address.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_UNSUPPORTED       IPv6 is TRUE and the implementation does not \r
+                                support IPv6 multicast to MAC address conversion.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_mcast_ip_to_mac (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
+SnpUndi32McastIpToMac (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     IPv6,\r
   IN EFI_IP_ADDRESS              *IP,\r
   OUT EFI_MAC_ADDRESS            *MAC\r
   );\r
 \r
   IN BOOLEAN                     IPv6,\r
   IN EFI_IP_ADDRESS              *IP,\r
   OUT EFI_MAC_ADDRESS            *MAC\r
   );\r
 \r
-extern\r
-EFI_STATUS \r
-EFIAPI\r
-snp_undi32_nvdata (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
-  IN BOOLEAN                     read_write,\r
-  IN UINTN                       offset,\r
-  IN UINTN                       buffer_size,\r
-  IN OUT VOID                    *buffer\r
-  );\r
+/**\r
+  Performs read and write operations on the NVRAM device attached to a network \r
+  interface.\r
+  \r
+  This function performs read and write operations on the NVRAM device attached \r
+  to a network interface. If ReadWrite is TRUE, a read operation is performed.\r
+  If ReadWrite is FALSE, a write operation is performed. Offset specifies the \r
+  byte offset at which to start either operation. Offset must be a multiple of \r
+  NvRamAccessSize , and it must have a value between zero and NvRamSize. \r
+  BufferSize specifies the length of the read or write operation. BufferSize must\r
+  also be a multiple of NvRamAccessSize, and Offset + BufferSize must not exceed\r
+  NvRamSize. \r
+  If any of the above conditions is not met, then EFI_INVALID_PARAMETER will be \r
+  returned. \r
+  If all the conditions are met and the operation is "read," the NVRAM device \r
+  attached to the network interface will be read into Buffer and EFI_SUCCESS \r
+  will be returned. If this is a write operation, the contents of Buffer will be\r
+  used to update the contents of the NVRAM device attached to the network \r
+  interface and EFI_SUCCESS will be returned.\r
+  \r
+  It does the basic checking on the input parameters and retrieves snp structure\r
+  and then calls the read_nvdata() call which does the actual reading\r
+\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param ReadWrite  TRUE for read operations, FALSE for write operations.\r
+  @param Offset     Byte offset in the NVRAM device at which to start the read or \r
+                    write operation. This must be a multiple of NvRamAccessSize \r
+                    and less than NvRamSize. (See EFI_SIMPLE_NETWORK_MODE)  \r
+  @param BufferSize The number of bytes to read or write from the NVRAM device. \r
+                    This must also be a multiple of NvramAccessSize.\r
+  @param Buffer     A pointer to the data buffer.\r
+\r
+  @retval EFI_SUCCESS           The NVRAM access was performed.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                * The This parameter is NULL \r
+                                * The This parameter does not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL  structure\r
+                                * The Offset parameter is not a multiple of \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+                                * The Offset parameter is not less than \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamSize\r
+                                * The BufferSize parameter is not a multiple of \r
+                                  EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+                                * The Buffer parameter is NULL\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network \r
+                                interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network\r
+                                interface.\r
 \r
 \r
-extern\r
-EFI_STATUS \r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_get_status (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  OUT UINT32                     *interrupt_status OPTIONAL,\r
-  OUT VOID                       **tx_buffer OPTIONAL\r
+SnpUndi32NvData (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     ReadWrite,\r
+  IN UINTN                       Offset,\r
+  IN UINTN                       BufferSize,\r
+  IN OUT VOID                    *Buffer\r
   );\r
 \r
   );\r
 \r
-extern\r
-EFI_STATUS \r
+/**\r
+  Reads the current interrupt status and recycled transmit buffer status from a\r
+  network interface.\r
+  \r
+  This function gets the current interrupt and recycled transmit buffer status \r
+  from the network interface. The interrupt status is returned as a bit mask in\r
+  InterruptStatus. If InterruptStatus is NULL, the interrupt status will not be\r
+  read. If TxBuf is not NULL, a recycled transmit buffer address will be retrieved.\r
+  If a recycled transmit buffer address is returned in TxBuf, then the buffer has\r
+  been successfully transmitted, and the status for that buffer is cleared. If\r
+  the status of the network interface is successfully collected, EFI_SUCCESS \r
+  will be returned. If the driver has not been initialized, EFI_DEVICE_ERROR will\r
+  be returned.\r
+\r
+  @param This            A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param InterruptStatus A pointer to the bit mask of the currently active \r
+                         interrupts (see "Related Definitions"). If this is NULL,\r
+                         the interrupt status will not be read from the device.\r
+                         If this is not NULL, the interrupt status will be read\r
+                         from the device. When the interrupt status is read, it \r
+                         will also be cleared. Clearing the transmit interrupt does \r
+                         not empty the recycled transmit buffer array.\r
+  @param TxBuf           Recycled transmit buffer address. The network interface\r
+                         will not transmit if its internal recycled transmit \r
+                         buffer array is full. Reading the transmit buffer does\r
+                         not clear the transmit interrupt. If this is NULL, then\r
+                         the transmit buffer status will not be read. If there \r
+                         are no transmit buffers to recycle and TxBuf is not NULL, \r
+                         TxBuf will be set to NULL.\r
+\r
+  @retval EFI_SUCCESS           The status of the network interface was retrieved.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+                                EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network \r
+                                interface.\r
+\r
+**/\r
+EFI_STATUS\r
 EFIAPI\r
 EFIAPI\r
-snp_undi32_transmit (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN UINTN                       header_size,\r
-  IN UINTN                       buffer_size,\r
-  IN VOID                        *buffer,\r
-  IN EFI_MAC_ADDRESS             * src_addr OPTIONAL,\r
-  IN EFI_MAC_ADDRESS             * dest_addr OPTIONAL,\r
-  IN UINT16                      *protocol OPTIONAL\r
+SnpUndi32GetStatus (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINT32                     *InterruptStatus, OPTIONAL\r
+  OUT VOID                       **TxBuf           OPTIONAL\r
   );\r
 \r
   );\r
 \r
-extern\r
+/**\r
+  Places a packet in the transmit queue of a network interface.\r
+  \r
+  This function places the packet specified by Header and Buffer on the transmit\r
+  queue. If HeaderSize is nonzero and HeaderSize is not equal to \r
+  This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If \r
+  BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL\r
+  will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be \r
+  returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then\r
+  EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network\r
+  interface is busy, then EFI_NOT_READY will be returned. If this packet can be \r
+  accepted by the transmit engine of the network interface, the packet contents \r
+  specified by Buffer will be placed on the transmit queue of the network \r
+  interface, and EFI_SUCCESS will be returned. GetStatus() can be used to \r
+  determine when the packet has actually been transmitted. The contents of the \r
+  Buffer must not be modified until the packet has actually been transmitted. \r
+  The Transmit() function performs nonblocking I/O. A caller who wants to perform\r
+  blocking I/O, should call Transmit(), and then GetStatus() until the \r
+  transmitted buffer shows up in the recycled transmit buffer.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param HeaderSize The size, in bytes, of the media header to be filled in by the \r
+                    Transmit() function. If HeaderSize is nonzero, then it must\r
+                    be equal to This->Mode->MediaHeaderSize and the DestAddr and\r
+                    Protocol parameters must not be NULL.\r
+  @param BufferSize The size, in bytes, of the entire packet (media header and\r
+                    data) to be transmitted through the network interface.\r
+  @param Buffer     A pointer to the packet (media header followed by data) to be \r
+                    transmitted. This parameter cannot be NULL. If HeaderSize is \r
+                    zero, then the media header in Buffer must already be filled\r
+                    in by the caller. If HeaderSize is nonzero, then the media \r
+                    header will be filled in by the Transmit() function.\r
+  @param SrcAddr    The source HW MAC address. If HeaderSize is zero, then this \r
+                    parameter is ignored. If HeaderSize is nonzero and SrcAddr \r
+                    is NULL, then This->Mode->CurrentAddress is used for the \r
+                    source HW MAC address.\r
+  @param DestAddr   The destination HW MAC address. If HeaderSize is zero, then \r
+                    this parameter is ignored.\r
+  @param Protocol   The type of header to build. If HeaderSize is zero, then this \r
+                    parameter is ignored. See RFC 1700, section "Ether Types," \r
+                    for examples.\r
+\r
+  @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_NOT_READY         The network interface is too busy to accept this\r
+                                transmit request.\r
+  @retval EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported\r
+                                value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
 EFI_STATUS \r
 EFIAPI\r
 EFI_STATUS \r
 EFIAPI\r
-snp_undi32_receive (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  OUT UINTN                      *header_size OPTIONAL,\r
-  IN OUT UINTN                   *buffer_size,\r
-  OUT VOID                       *buffer,\r
-  OUT EFI_MAC_ADDRESS            * src_addr OPTIONAL,\r
-  OUT EFI_MAC_ADDRESS            * dest_addr OPTIONAL,\r
-  OUT UINT16                     *protocol OPTIONAL\r
+SnpUndi32Transmit (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINTN                       HeaderSize,\r
+  IN UINTN                       BufferSize,\r
+  IN VOID                        *Buffer,\r
+  IN EFI_MAC_ADDRESS             *SrcAddr,  OPTIONAL\r
+  IN EFI_MAC_ADDRESS             *DestAddr, OPTIONAL\r
+  IN UINT16                      *Protocol  OPTIONAL\r
   );\r
 \r
   );\r
 \r
-typedef\r
+/**\r
+  Receives a packet from a network interface.\r
+\r
+  This function retrieves one packet from the receive queue of a network interface.\r
+  If there are no packets on the receive queue, then EFI_NOT_READY will be \r
+  returned. If there is a packet on the receive queue, and the size of the packet\r
+  is smaller than BufferSize, then the contents of the packet will be placed in\r
+  Buffer, and BufferSize will be updated with the actual size of the packet.\r
+  In addition, if SrcAddr, DestAddr, and Protocol are not NULL, then these values\r
+  will be extracted from the media header and returned. EFI_SUCCESS will be \r
+  returned if a packet was successfully received.\r
+  If BufferSize is smaller than the received packet, then the size of the receive\r
+  packet will be placed in BufferSize and EFI_BUFFER_TOO_SMALL will be returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param HeaderSize The size, in bytes, of the media header received on the network \r
+                    interface. If this parameter is NULL, then the media header size \r
+                    will not be returned.\r
+  @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in \r
+                    bytes, of the packet that was received on the network interface.\r
+  @param Buffer     A pointer to the data buffer to receive both the media\r
+                    header and the data.\r
+  @param SrcAddr    The source HW MAC address. If this parameter is NULL, the HW\r
+                    MAC source address will not be extracted from the media header. \r
+  @param DestAddr   The destination HW MAC address. If this parameter is NULL, \r
+                    the HW MAC destination address will not be extracted from \r
+                    the media header.\r
+  @param Protocol   The media header type. If this parameter is NULL, then the \r
+                    protocol will not be extracted from the media header. See \r
+                    RFC 1700 section "Ether Types" for examples.\r
+\r
+  @retval EFI_SUCCESS           The received data was stored in Buffer, and \r
+                                BufferSize has been updated to the number of \r
+                                bytes received.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_NOT_READY         No packets have been received on the network interface.\r
+  @retval EFI_BUFFER_TOO_SMALL  BufferSize is too small for the received packets. \r
+                                BufferSize has been updated to the required size.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                * The This parameter is NULL\r
+                                * The This parameter does not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+                                * The BufferSize parameter is NULL\r
+                                * The Buffer parameter is NULL\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+\r
+**/\r
 EFI_STATUS\r
 EFI_STATUS\r
-(*issue_undi32_command) (\r
-  UINT64 cdb\r
-  );\r
-typedef\r
-VOID\r
-(*ptr) (\r
-  VOID\r
+EFIAPI\r
+SnpUndi32Receive (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINTN                      *HeaderSize OPTIONAL,\r
+  IN OUT UINTN                   *BufferSize,\r
+  OUT VOID                       *Buffer,\r
+  OUT EFI_MAC_ADDRESS            *SrcAddr OPTIONAL,\r
+  OUT EFI_MAC_ADDRESS            *DestAddr OPTIONAL,\r
+  OUT UINT16                     *Protocol OPTIONAL\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
 /**\r
-  Install all the driver protocol\r
-\r
-  @param  ImageHandle  Driver image handle\r
-  @param  SystemTable  System services table\r
+  Nofication call back function for WaitForPacket event.\r
 \r
 \r
-  @retval EFI_SUCEESS  Initialization routine has found UNDI hardware, loaded it's\r
-                       ROM, and installed a notify event for the Network\r
-                       Indentifier Interface Protocol successfully.\r
-  @retval Other        Return value from HandleProtocol for DeviceIoProtocol or\r
-                       LoadedImageProtocol\r
+  @param  Event       EFI Event.\r
+  @param  SnpPtr      Pointer to SNP_DRIVER structure.\r
 \r
 **/\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 EFIAPI\r
 EFIAPI\r
-InitializeSnpNiiDriver (\r
-  IN EFI_HANDLE       ImageHandle,\r
-  IN EFI_SYSTEM_TABLE *SystemTable\r
+SnpWaitForPacketNotify (\r
+  EFI_EVENT Event,\r
+  VOID      *SnpPtr\r
   );\r
 \r
 #define SNP_MEM_PAGES(x)  (((x) - 1) / 4096 + 1)\r
 \r
 \r
   );\r
 \r
 #define SNP_MEM_PAGES(x)  (((x) - 1) / 4096 + 1)\r
 \r
 \r
-#endif /*  _SNP_H  */\r
+#endif /*  _SNP_H_  */\r
index eaba03c57dbe657cf8c914ab6d7f2d6990843b6d..5c5daeaa6039bffdfa0b42a4fb5550aa95a3b5f0 100644 (file)
@@ -1,94 +1,90 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of starting a network adapter.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  start.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-07 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
-  this routine calls undi to start the interface and changes the snp state!\r
-\r
-  @param  snp                    pointer to snp driver structure\r
+  this routine calls undi to start the interface and changes the snp state.\r
 \r
 \r
+  @param  Snp                    pointer to snp driver structure\r
 \r
 \r
+  @retval EFI_DEVICE_ERROR       UNDI could not be started\r
+  @retval EFI_SUCCESS            UNDI is started successfully\r
+  \r
 **/\r
 EFI_STATUS\r
 **/\r
 EFI_STATUS\r
-pxe_start (\r
-  SNP_DRIVER *snp\r
+PxeStart (\r
+  IN SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  PXE_CPB_START_31  *cpb_31;\r
+  PXE_CPB_START_31  *Cpb31;\r
 \r
 \r
-  cpb_31  = snp->cpb;\r
+  Cpb31  = Snp->Cpb;\r
   //\r
   // Initialize UNDI Start CDB for H/W UNDI\r
   //\r
   //\r
   // Initialize UNDI Start CDB for H/W UNDI\r
   //\r
-  snp->cdb.OpCode     = PXE_OPCODE_START;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_START;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Make changes to H/W UNDI Start CDB if this is\r
   // a S/W UNDI.\r
   //\r
 \r
   //\r
   // Make changes to H/W UNDI Start CDB if this is\r
   // a S/W UNDI.\r
   //\r
-  if (snp->is_swundi) {\r
-    snp->cdb.CPBsize  = sizeof (PXE_CPB_START_31);\r
-    snp->cdb.CPBaddr  = (UINT64)(UINTN) cpb_31;\r
+  if (Snp->IsSwUndi) {\r
+    Snp->Cdb.CPBsize  = sizeof (PXE_CPB_START_31);\r
+    Snp->Cdb.CPBaddr  = (UINT64)(UINTN) Cpb31;\r
 \r
 \r
-    cpb_31->Delay     = (UINT64)(UINTN) &snp_undi32_callback_delay;\r
-    cpb_31->Block     = (UINT64)(UINTN) &snp_undi32_callback_block;\r
+    Cpb31->Delay     = (UINT64)(UINTN) &SnpUndi32CallbackDelay;\r
+    Cpb31->Block     = (UINT64)(UINTN) &SnpUndi32CallbackBlock;\r
 \r
     //\r
     // Virtual == Physical.  This can be set to zero.\r
     //\r
 \r
     //\r
     // Virtual == Physical.  This can be set to zero.\r
     //\r
-    cpb_31->Virt2Phys = (UINT64)(UINTN) 0;\r
-    cpb_31->Mem_IO    = (UINT64)(UINTN) &snp_undi32_callback_memio;\r
+    Cpb31->Virt2Phys = (UINT64)(UINTN) 0;\r
+    Cpb31->Mem_IO    = (UINT64)(UINTN) &SnpUndi32CallbackMemio;\r
 \r
 \r
-    cpb_31->Map_Mem   = (UINT64)(UINTN) &snp_undi32_callback_map;\r
-    cpb_31->UnMap_Mem = (UINT64)(UINTN) &snp_undi32_callback_unmap;\r
-    cpb_31->Sync_Mem  = (UINT64)(UINTN) &snp_undi32_callback_sync;\r
+    Cpb31->Map_Mem   = (UINT64)(UINTN) &SnpUndi32CallbackMap;\r
+    Cpb31->UnMap_Mem = (UINT64)(UINTN) &SnpUndi32CallbackUnmap;\r
+    Cpb31->Sync_Mem  = (UINT64)(UINTN) &SnpUndi32CallbackSync;\r
 \r
 \r
-    cpb_31->Unique_ID = (UINT64)(UINTN) snp;\r
+    Cpb31->Unique_ID = (UINT64)(UINTN) Snp;\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.start()  "));\r
 \r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.start()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     //\r
     // UNDI could not be started. Return UNDI error.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.start()  %xh:%xh\n",\r
     //\r
     // UNDI could not be started. Return UNDI error.\r
     //\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.start()  %xh:%xh\n",\r
-      snp->cdb.StatCode,\r
-      snp->cdb.StatFlags)\r
+      Snp->Cdb.StatCode,\r
+      Snp->Cdb.StatFlags)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -96,34 +92,31 @@ pxe_start (
   //\r
   // Set simple network state to Started and return success.\r
   //\r
   //\r
   // Set simple network state to Started and return success.\r
   //\r
-  snp->mode.State = EfiSimpleNetworkStarted;\r
+  Snp->Mode.State = EfiSimpleNetworkStarted;\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for starting the interface\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_start routine to actually do start undi interface\r
-\r
-  @param  This                   context pointer\r
-\r
-  @retval EFI_INVALID_PARAMETER  "This" is Null\r
-  @retval      No                SNP driver can be extracted from "This"\r
-  @retval EFI_ALREADY_STARTED    The state of SNP is EfiSimpleNetworkStarted or\r
-                                 EfiSimpleNetworkInitialized\r
-  @retval EFI_DEVICE_ERROR       The state of SNP is other than\r
-                                 EfiSimpleNetworkStarted,\r
-                                 EfiSimpleNetworkInitialized, and\r
-                                 EfiSimpleNetworkStopped\r
-  @retval EFI_SUCCESS            UNDI interface is succesfully started\r
-  @retval Other                  Error occurs while calling pxe_start function.\r
+  Changes the state of a network interface from "stopped" to "started."\r
+  \r
+  This function starts a network interface. If the network interface successfully\r
+  starts, then EFI_SUCCESS will be returned.\r
+\r
+  @param  This                   A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS            The network interface was started.\r
+  @retval EFI_ALREADY_STARTED    The network interface is already in the started state.\r
+  @retval EFI_INVALID_PARAMETER  This parameter was NULL or did not point to a valid \r
+                                 EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR       The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED        This function is not supported by the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_start (\r
+SnpUndi32Start (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
@@ -140,7 +133,7 @@ snp_undi32_start (
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (Snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkStopped:\r
     break;\r
 \r
   case EfiSimpleNetworkStopped:\r
     break;\r
 \r
@@ -154,7 +147,7 @@ snp_undi32_start (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_start (Snp);\r
+  Status = PxeStart (Snp);\r
   if (EFI_ERROR (Status)) {\r
     goto ON_EXIT;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     goto ON_EXIT;\r
   }\r
@@ -162,11 +155,11 @@ snp_undi32_start (
   // clear the map_list in SNP structure\r
   //\r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
   // clear the map_list in SNP structure\r
   //\r
   for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {\r
-    Snp->map_list[Index].virt       = 0;\r
-    Snp->map_list[Index].map_cookie = 0;\r
+    Snp->MapList[Index].VirtualAddress = 0;\r
+    Snp->MapList[Index].MapCookie      = 0;\r
   }\r
 \r
   }\r
 \r
-  Snp->mode.MCastFilterCount = 0;\r
+  Snp->Mode.MCastFilterCount = 0;\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index e4c268f575ff108261825c8ba56f5dc695b71319..07df584a07cb88c998ac50425867f9f3b62da59b 100644 (file)
@@ -1,21 +1,15 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of reading the MAC address of a network adapter.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  station_address.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-17 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 **/\r
 \r
 #include "Snp.h"\r
@@ -25,45 +19,47 @@ Revision history:
   this routine calls undi to read the MAC address of the NIC and updates the\r
   mode structure with the address.\r
 \r
   this routine calls undi to read the MAC address of the NIC and updates the\r
   mode structure with the address.\r
 \r
-  @param  snp         pointer to snp driver structure\r
-\r
+  @param  Snp         pointer to snp driver structure.\r
+   \r
+  @retval EFI_SUCCESS       the MAC address of the NIC is read successfully.\r
+  @retval EFI_DEVICE_ERROR  failed to read the MAC address of the NIC.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_get_stn_addr (\r
-  SNP_DRIVER *snp\r
+PxeGetStnAddr (\r
+  SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  PXE_DB_STATION_ADDRESS  *db;\r
+  PXE_DB_STATION_ADDRESS  *Db;\r
 \r
 \r
-  db                  = snp->db;\r
-  snp->cdb.OpCode     = PXE_OPCODE_STATION_ADDRESS;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_STATION_ADDRESS_READ;\r
+  Db                  = Snp->Db;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_STATION_ADDRESS;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_STATION_ADDRESS_READ;\r
 \r
 \r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
 \r
 \r
-  snp->cdb.DBsize     = sizeof (PXE_DB_STATION_ADDRESS);\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_STATION_ADDRESS);\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.station_addr()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.station_addr()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -72,21 +68,21 @@ pxe_get_stn_addr (
   // Set new station address in SNP->Mode structure and return success.\r
   //\r
   CopyMem (\r
   // Set new station address in SNP->Mode structure and return success.\r
   //\r
   CopyMem (\r
-    &(snp->mode.CurrentAddress),\r
-    &db->StationAddr,\r
-    snp->mode.HwAddressSize\r
+    &(Snp->Mode.CurrentAddress),\r
+    &Db->StationAddr,\r
+    Snp->Mode.HwAddressSize\r
     );\r
 \r
   CopyMem (\r
     );\r
 \r
   CopyMem (\r
-    &snp->mode.BroadcastAddress,\r
-    &db->BroadcastAddr,\r
-    snp->mode.HwAddressSize\r
+    &Snp->Mode.BroadcastAddress,\r
+    &Db->BroadcastAddr,\r
+    Snp->Mode.HwAddressSize\r
     );\r
 \r
   CopyMem (\r
     );\r
 \r
   CopyMem (\r
-    &snp->mode.PermanentAddress,\r
-    &db->PermanentAddr,\r
-    snp->mode.HwAddressSize\r
+    &Snp->Mode.PermanentAddress,\r
+    &Db->PermanentAddr,\r
+    Snp->Mode.HwAddressSize\r
     );\r
 \r
   return EFI_SUCCESS;\r
     );\r
 \r
   return EFI_SUCCESS;\r
@@ -96,7 +92,7 @@ pxe_get_stn_addr (
 /**\r
   this routine calls undi to set a new MAC address for the NIC,\r
 \r
 /**\r
   this routine calls undi to set a new MAC address for the NIC,\r
 \r
-  @param  snp         pointer to snp driver structure\r
+  @param  Snp         pointer to Snp driver structure\r
   @param  NewMacAddr  pointer to a mac address to be set for the nic, if this is\r
                       NULL then this routine resets the mac address to the NIC's\r
                       original address.\r
   @param  NewMacAddr  pointer to a mac address to be set for the nic, if this is\r
                       NULL then this routine resets the mac address to the NIC's\r
                       original address.\r
@@ -104,55 +100,55 @@ pxe_get_stn_addr (
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_set_stn_addr (\r
-  SNP_DRIVER      *snp,\r
+PxeSetStnAddr (\r
+  SNP_DRIVER      *Snp,\r
   EFI_MAC_ADDRESS *NewMacAddr\r
   )\r
 {\r
   EFI_MAC_ADDRESS *NewMacAddr\r
   )\r
 {\r
-  PXE_CPB_STATION_ADDRESS *cpb;\r
-  PXE_DB_STATION_ADDRESS  *db;\r
+  PXE_CPB_STATION_ADDRESS *Cpb;\r
+  PXE_DB_STATION_ADDRESS  *Db;\r
 \r
 \r
-  cpb             = snp->cpb;\r
-  db              = snp->db;\r
-  snp->cdb.OpCode = PXE_OPCODE_STATION_ADDRESS;\r
+  Cpb             = Snp->Cpb;\r
+  Db              = Snp->Db;\r
+  Snp->Cdb.OpCode = PXE_OPCODE_STATION_ADDRESS;\r
 \r
   if (NewMacAddr == NULL) {\r
 \r
   if (NewMacAddr == NULL) {\r
-    snp->cdb.OpFlags  = PXE_OPFLAGS_STATION_ADDRESS_RESET;\r
-    snp->cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
-    snp->cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
+    Snp->Cdb.OpFlags  = PXE_OPFLAGS_STATION_ADDRESS_RESET;\r
+    Snp->Cdb.CPBsize  = PXE_CPBSIZE_NOT_USED;\r
+    Snp->Cdb.CPBaddr  = PXE_CPBADDR_NOT_USED;\r
   } else {\r
   } else {\r
-    snp->cdb.OpFlags = PXE_OPFLAGS_STATION_ADDRESS_READ;\r
+    Snp->Cdb.OpFlags = PXE_OPFLAGS_STATION_ADDRESS_READ;\r
     //\r
     // even though the OPFLAGS are set to READ, supplying a new address\r
     // in the CPB will make undi change the mac address to the new one.\r
     //\r
     //\r
     // even though the OPFLAGS are set to READ, supplying a new address\r
     // in the CPB will make undi change the mac address to the new one.\r
     //\r
-    CopyMem (&cpb->StationAddr, NewMacAddr, snp->mode.HwAddressSize);\r
+    CopyMem (&Cpb->StationAddr, NewMacAddr, Snp->Mode.HwAddressSize);\r
 \r
 \r
-    snp->cdb.CPBsize  = sizeof (PXE_CPB_STATION_ADDRESS);\r
-    snp->cdb.CPBaddr  = (UINT64)(UINTN) cpb;\r
+    Snp->Cdb.CPBsize  = sizeof (PXE_CPB_STATION_ADDRESS);\r
+    Snp->Cdb.CPBaddr  = (UINT64)(UINTN) Cpb;\r
   }\r
 \r
   }\r
 \r
-  snp->cdb.DBsize     = sizeof (PXE_DB_STATION_ADDRESS);\r
-  snp->cdb.DBaddr     = (UINT64)(UINTN) db;\r
+  Snp->Cdb.DBsize     = sizeof (PXE_DB_STATION_ADDRESS);\r
+  Snp->Cdb.DBaddr     = (UINT64)(UINTN) Db;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.station_addr()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.station_addr()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     //\r
       );\r
 \r
     //\r
@@ -163,54 +159,72 @@ pxe_set_stn_addr (
   //\r
   // read the changed address and save it in SNP->Mode structure\r
   //\r
   //\r
   // read the changed address and save it in SNP->Mode structure\r
   //\r
-  pxe_get_stn_addr (snp);\r
+  PxeGetStnAddr (Snp);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for changing the NIC's mac address.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the above routines to actually do the work\r
-\r
-  @param  this        context pointer\r
-  @param  NewMacAddr  pointer to a mac address to be set for the nic, if this is\r
-                      NULL then this routine resets the mac address to the NIC's\r
-                      original address.\r
-  @param  ResetFlag   If true, the mac address will change to NIC's original\r
-                      address\r
-\r
+  Modifies or resets the current station address, if supported.\r
+  \r
+  This function modifies or resets the current station address of a network \r
+  interface, if supported. If Reset is TRUE, then the current station address is\r
+  set to the network interface’s permanent address. If Reset is FALSE, and the \r
+  network interface allows its station address to be modified, then the current \r
+  station address is changed to the address specified by New. If the network \r
+  interface does not allow its station address to be modified, then \r
+  EFI_INVALID_PARAMETER will be returned. If the station address is successfully\r
+  updated on the network interface, EFI_SUCCESS will be returned. If the driver\r
+  has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This  A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Reset Flag used to reset the station address to the network interface’s \r
+               permanent address.\r
+  @param New   New station address to be used for the network interface.\r
+\r
+\r
+  @retval EFI_SUCCESS           The network interface’s station address was updated.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not been \r
+                                started by calling Start().\r
+  @retval EFI_INVALID_PARAMETER The New station address was not accepted by the NIC.\r
+  @retval EFI_INVALID_PARAMETER Reset is FALSE and New is NULL.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_DEVICE_ERROR      An error occurred attempting to set the new \r
+                                station address.\r
+  @retval EFI_UNSUPPORTED       The NIC does not support changing the network \r
+                                interface’s station address.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_station_address (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN BOOLEAN                     ResetFlag,\r
-  IN EFI_MAC_ADDRESS             * NewMacAddr OPTIONAL\r
+SnpUndi32StationAddress (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     Reset,\r
+  IN EFI_MAC_ADDRESS             *New OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   //\r
   // Check for invalid parameter combinations.\r
   //\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   //\r
   // Check for invalid parameter combinations.\r
   //\r
-  if ((this == NULL) ||\r
-    (!ResetFlag && (NewMacAddr == NULL))) {\r
+  if ((This == NULL) ||\r
+    (!Reset && (New == NULL))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -223,10 +237,10 @@ snp_undi32_station_address (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  if (ResetFlag) {\r
-    Status = pxe_set_stn_addr (snp, NULL);\r
+  if (Reset) {\r
+    Status = PxeSetStnAddr (Snp, NULL);\r
   } else {\r
   } else {\r
-    Status = pxe_set_stn_addr (snp, NewMacAddr);\r
+    Status = PxeSetStnAddr (Snp, New);\r
   }\r
 \r
 ON_EXIT:\r
   }\r
 \r
 ON_EXIT:\r
index 19f28239a5e0a5df3cf88c2ae80d04ca019213ec..c52fc23db36c01207c8eba78b2f23ddf377a86b9 100644 (file)
@@ -1,21 +1,15 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of collecting the statistics on a network interface.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  statistics.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-17 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 \r
 **/\r
 \r
 \r
@@ -23,50 +17,85 @@ Revision history:
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for getting the NIC's statistics.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_ routine to actually do the\r
-\r
-  @param  this              context pointer\r
-  @param  ResetFlag         true to reset the NIC's statistics counters to zero.\r
-  @param  StatTableSizePtr  pointer to the statistics table size\r
-  @param  StatTablePtr      pointer to the statistics table\r
-\r
+  Resets or collects the statistics on a network interface.\r
+  \r
+  This function resets or collects the statistics on a network interface. If the\r
+  size of the statistics table specified by StatisticsSize is not big enough for\r
+  all the statistics that are collected by the network interface, then a partial\r
+  buffer of statistics is returned in StatisticsTable, StatisticsSize is set to \r
+  the size required to collect all the available statistics, and \r
+  EFI_BUFFER_TOO_SMALL is returned.\r
+  If StatisticsSize is big enough for all the statistics, then StatisticsTable \r
+  will be filled, StatisticsSize will be set to the size of the returned \r
+  StatisticsTable structure, and EFI_SUCCESS is returned.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+  If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then\r
+  no operations will be performed, and EFI_SUCCESS will be returned.\r
+  If Reset is TRUE, then all of the supported statistics counters on this network\r
+  interface will be reset to zero.\r
+\r
+  @param This            A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param Reset           Set to TRUE to reset the statistics for the network interface.\r
+  @param StatisticsSize  On input the size, in bytes, of StatisticsTable. On output \r
+                         the size, in bytes, of the resulting table of statistics.\r
+  @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that \r
+                         contains the statistics. Type EFI_NETWORK_STATISTICS is \r
+                         defined in "Related Definitions" below. \r
+  \r
+  @retval EFI_SUCCESS           The requested operation succeeded.\r
+  @retval EFI_NOT_STARTED       The Simple Network Protocol interface has not been\r
+                                started by calling Start().\r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
+                                NULL. The current buffer size that is needed to \r
+                                hold all the statistics is returned in StatisticsSize.\r
+  @retval EFI_BUFFER_TOO_SMALL  StatisticsSize is not NULL and StatisticsTable is \r
+                                not NULL. The current buffer size that is needed\r
+                                to hold all the statistics is returned in \r
+                                StatisticsSize. A partial set of statistics is \r
+                                returned in StatisticsTable.\r
+  @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not \r
+                                NULL.\r
+  @retval EFI_DEVICE_ERROR      The Simple Network Protocol interface has not \r
+                                been initialized by calling Initialize().\r
+  @retval EFI_DEVICE_ERROR      An error was encountered collecting statistics \r
+                                from the NIC.\r
+  @retval EFI_UNSUPPORTED       The NIC does not support collecting statistics \r
+                                from the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_statistics (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN BOOLEAN                     ResetFlag,\r
-  IN OUT UINTN                   *StatTableSizePtr OPTIONAL,\r
-  IN OUT EFI_NETWORK_STATISTICS  * StatTablePtr OPTIONAL\r
+SnpUndi32Statistics (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     Reset,\r
+  IN OUT UINTN                   *StatisticsSize, OPTIONAL\r
+  IN OUT EFI_NETWORK_STATISTICS  *StatisticsTable OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER        *snp;\r
-  PXE_DB_STATISTICS *db;\r
-  UINT64            *stp;\r
-  UINT64            mask;\r
-  UINTN             size;\r
-  UINTN             n;\r
+  SNP_DRIVER        *Snp;\r
+  PXE_DB_STATISTICS *Db;\r
+  UINT64            *Stp;\r
+  UINT64            Mask;\r
+  UINTN             Size;\r
+  UINTN             Index;\r
   EFI_TPL           OldTpl;\r
   EFI_STATUS        Status;\r
 \r
   //\r
   EFI_TPL           OldTpl;\r
   EFI_STATUS        Status;\r
 \r
   //\r
-  // Get pointer to SNP driver instance for *this.\r
+  // Get pointer to SNP driver instance for *This.\r
   //\r
   //\r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   //\r
   // Return error if the SNP is not initialized.\r
   //\r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -82,39 +111,39 @@ snp_undi32_statistics (
   // if we are not resetting the counters, we have to have a valid stat table\r
   // with >0 size. if no reset, no table and no size, return success.\r
   //\r
   // if we are not resetting the counters, we have to have a valid stat table\r
   // with >0 size. if no reset, no table and no size, return success.\r
   //\r
-  if (!ResetFlag && StatTableSizePtr == NULL) {\r
-    Status = StatTablePtr ? EFI_INVALID_PARAMETER : EFI_SUCCESS;\r
+  if (!Reset && StatisticsSize == NULL) {\r
+    Status = (StatisticsTable != NULL) ? EFI_INVALID_PARAMETER : EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
   //\r
   // Initialize UNDI Statistics CDB\r
   //\r
     goto ON_EXIT;\r
   }\r
   //\r
   // Initialize UNDI Statistics CDB\r
   //\r
-  snp->cdb.OpCode     = PXE_OPCODE_STATISTICS;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
-\r
-  if (ResetFlag) {\r
-    snp->cdb.OpFlags  = PXE_OPFLAGS_STATISTICS_RESET;\r
-    snp->cdb.DBsize   = PXE_DBSIZE_NOT_USED;\r
-    snp->cdb.DBaddr   = PXE_DBADDR_NOT_USED;\r
-    db                = snp->db;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_STATISTICS;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+\r
+  if (Reset) {\r
+    Snp->Cdb.OpFlags  = PXE_OPFLAGS_STATISTICS_RESET;\r
+    Snp->Cdb.DBsize   = PXE_DBSIZE_NOT_USED;\r
+    Snp->Cdb.DBaddr   = PXE_DBADDR_NOT_USED;\r
+    Db                = Snp->Db;\r
   } else {\r
   } else {\r
-    snp->cdb.OpFlags                = PXE_OPFLAGS_STATISTICS_READ;\r
-    snp->cdb.DBsize                 = sizeof (PXE_DB_STATISTICS);\r
-    snp->cdb.DBaddr                 = (UINT64)(UINTN) (db = snp->db);\r
+    Snp->Cdb.OpFlags                = PXE_OPFLAGS_STATISTICS_READ;\r
+    Snp->Cdb.DBsize                 = sizeof (PXE_DB_STATISTICS);\r
+    Snp->Cdb.DBaddr                 = (UINT64)(UINTN) (Db = Snp->Db);\r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.statistics()  "));\r
 \r
   }\r
   //\r
   // Issue UNDI command and check result.\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.statistics()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
   case PXE_STATCODE_SUCCESS:\r
     break;\r
 \r
@@ -122,8 +151,8 @@ snp_undi32_statistics (
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.statistics()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.statistics()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     Status = EFI_UNSUPPORTED;\r
       );\r
 \r
     Status = EFI_UNSUPPORTED;\r
@@ -133,21 +162,21 @@ snp_undi32_statistics (
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.statistics()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_ERROR,\r
       "\nsnp->undi.statistics()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
 \r
       );\r
 \r
     Status = EFI_DEVICE_ERROR;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if (ResetFlag) {\r
+  if (Reset) {\r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_SUCCESS;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if (StatTablePtr == NULL) {\r
-    *StatTableSizePtr = sizeof (EFI_NETWORK_STATISTICS);\r
+  if (StatisticsTable == NULL) {\r
+    *StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);\r
     Status = EFI_BUFFER_TOO_SMALL;\r
     goto ON_EXIT;\r
   }\r
     Status = EFI_BUFFER_TOO_SMALL;\r
     goto ON_EXIT;\r
   }\r
@@ -155,42 +184,42 @@ snp_undi32_statistics (
   // Convert the UNDI statistics information to SNP statistics\r
   // information.\r
   //\r
   // Convert the UNDI statistics information to SNP statistics\r
   // information.\r
   //\r
-  ZeroMem (StatTablePtr, *StatTableSizePtr);\r
-  stp   = (UINT64 *) StatTablePtr;\r
-  size  = 0;\r
+  ZeroMem (StatisticsTable, *StatisticsSize);\r
+  Stp   = (UINT64 *) StatisticsTable;\r
+  Size  = 0;\r
 \r
 \r
-  for (n = 0, mask = 1; n < 64; n++, mask = LShiftU64 (mask, 1), stp++) {\r
+  for (Index = 0, Mask = 1; Index < 64; Index++, Mask = LShiftU64 (Mask, 1), Stp++) {\r
     //\r
     // There must be room for a full UINT64.  Partial\r
     // numbers will not be stored.\r
     //\r
     //\r
     // There must be room for a full UINT64.  Partial\r
     // numbers will not be stored.\r
     //\r
-    if ((n + 1) * sizeof (UINT64) > *StatTableSizePtr) {\r
+    if ((Index + 1) * sizeof (UINT64) > *StatisticsSize) {\r
       break;\r
     }\r
 \r
       break;\r
     }\r
 \r
-    if (db->Supported & mask) {\r
-      *stp  = db->Data[n];\r
-      size  = n + 1;\r
+    if (Db->Supported & Mask) {\r
+      *Stp  = Db->Data[Index];\r
+      Size  = Index + 1;\r
     } else {\r
     } else {\r
-      SetMem (stp, sizeof (UINT64), 0xFF);\r
+      SetMem (Stp, sizeof (UINT64), 0xFF);\r
     }\r
   }\r
   //\r
   // Compute size up to last supported statistic.\r
   //\r
     }\r
   }\r
   //\r
   // Compute size up to last supported statistic.\r
   //\r
-  while (++n < 64) {\r
-    if (db->Supported & (mask = LShiftU64 (mask, 1))) {\r
-      size = n;\r
+  while (++Index < 64) {\r
+    if (Db->Supported & (Mask = LShiftU64 (Mask, 1))) {\r
+      Size = Index;\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
-  size *= sizeof (UINT64);\r
+  Size *= sizeof (UINT64);\r
 \r
 \r
-  if (*StatTableSizePtr >= size) {\r
-    *StatTableSizePtr = size;\r
+  if (*StatisticsSize >= Size) {\r
+    *StatisticsSize = Size;\r
     Status = EFI_SUCCESS;\r
   } else {\r
     Status = EFI_SUCCESS;\r
   } else {\r
-    *StatTableSizePtr = size;\r
+    *StatisticsSize = Size;\r
     Status = EFI_BUFFER_TOO_SMALL;\r
   }\r
 \r
     Status = EFI_BUFFER_TOO_SMALL;\r
   }\r
 \r
index 63725237b7c465916812e44e2675185af27d6cad..2eedfcd72617f880d4b7f91a5270a3daeb4110b3 100644 (file)
@@ -1,62 +1,60 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of stopping a network interface.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  stop.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-09 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
-  this routine calls undi to stop the interface and changes the snp state\r
+  this routine calls undi to stop the interface and changes the snp state.\r
 \r
 \r
-  @param  snp   pointer to snp driver structure\r
+  @param  Snp   pointer to snp driver structure\r
 \r
 \r
+  @retval EFI_INVALID_PARAMETER  invalid parameter\r
+  @retval EFI_NOT_STARTED        SNP is not started\r
+  @retval EFI_DEVICE_ERROR       SNP is not initialized\r
+  @retval EFI_UNSUPPORTED        operation unsupported\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_stop (\r
-  SNP_DRIVER *snp\r
+PxeStop (\r
+  SNP_DRIVER *Snp\r
   )\r
 {\r
   )\r
 {\r
-  snp->cdb.OpCode     = PXE_OPCODE_STOP;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
-  snp->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_STOP;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_NOT_USED;\r
+  Snp->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.stop()  "));\r
 \r
 \r
   //\r
   // Issue UNDI command\r
   //\r
   DEBUG ((EFI_D_NET, "\nsnp->undi.stop()  "));\r
 \r
-  (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);\r
 \r
 \r
-  if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
+  if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi.stop()  %xh:%xh\n",\r
     DEBUG (\r
       (EFI_D_WARN,\r
       "\nsnp->undi.stop()  %xh:%xh\n",\r
-      snp->cdb.StatCode,\r
-      snp->cdb.StatFlags)\r
+      Snp->Cdb.StatCode,\r
+      Snp->Cdb.StatFlags)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -64,39 +62,48 @@ pxe_stop (
   //\r
   // Set simple network state to Started and return success.\r
   //\r
   //\r
   // Set simple network state to Started and return success.\r
   //\r
-  snp->mode.State = EfiSimpleNetworkStopped;\r
+  Snp->Mode.State = EfiSimpleNetworkStopped;\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  This is the SNP interface routine for stopping the interface.\r
-  This routine basically retrieves snp structure, checks the SNP state and\r
-  calls the pxe_stop routine to actually stop the undi interface\r
-\r
-  @param  this  context pointer\r
-\r
+  Changes the state of a network interface from "started" to "stopped."\r
+  \r
+  This function stops a network interface. This call is only valid if the network\r
+  interface is in the started state. If the network interface was successfully\r
+  stopped, then EFI_SUCCESS will be returned.\r
+  \r
+  @param  This                    A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  \r
+  \r
+  @retval EFI_SUCCESS             The network interface was stopped.\r
+  @retval EFI_NOT_STARTED         The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER   This parameter was NULL or did not point to a valid \r
+                                  EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+  @retval EFI_DEVICE_ERROR        The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED         This function is not supported by the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_stop (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Stop (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
   EFI_TPL     OldTpl;\r
   EFI_STATUS  Status;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
   case EfiSimpleNetworkStarted:\r
     break;\r
 \r
@@ -109,7 +116,7 @@ snp_undi32_stop (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  Status = pxe_stop (snp);\r
+  Status = PxeStop (Snp);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 72012fada4a38193e2d29d07f3c37fdac7ff487a..c9d8e715aa1ff18d6ed7f7964d80f35ee555c05a 100644 (file)
@@ -1,22 +1,15 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Implementation of transmitting a packet.\r
\r
+Copyright (c) 2004 - 2007, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-\r
-    transmit.c\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-  2000-Feb-03 M(f)J   Genesis.\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 **/\r
 \r
 #include "Snp.h"\r
@@ -25,13 +18,13 @@ Revision history:
 /**\r
   This routine calls undi to create the meadia header for the given data buffer.\r
 \r
 /**\r
   This routine calls undi to create the meadia header for the given data buffer.\r
 \r
-  @param  snp                 pointer to SNP driver structure\r
+  @param  Snp                 pointer to SNP driver structure\r
   @param  MacHeaderPtr        address where the media header will be filled in.\r
   @param  MacHeaderPtr        address where the media header will be filled in.\r
-  @param  MacHeaderSize       size of the memory at MacHeaderPtr\r
-  @param  BufferPtr           data buffer pointer\r
-  @param  BufferLength        Size of data in the BufferPtr\r
-  @param  DestinationAddrPtr  address of the destination mac address buffer\r
-  @param  SourceAddrPtr       address of the source mac address buffer\r
+  @param  HeaderSize       size of the memory at MacHeaderPtr\r
+  @param  Buffer           data buffer pointer\r
+  @param  BufferSize        Size of data in the Buffer\r
+  @param  DestAddr  address of the destination mac address buffer\r
+  @param  SrcAddr       address of the source mac address buffer\r
   @param  ProtocolPtr         address of the protocol type\r
 \r
   @retval EFI_SUCCESS         if successfully completed the undi call\r
   @param  ProtocolPtr         address of the protocol type\r
 \r
   @retval EFI_SUCCESS         if successfully completed the undi call\r
@@ -39,89 +32,89 @@ Revision history:
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_fillheader (\r
-  SNP_DRIVER      *snp,\r
+PxeFillHeader (\r
+  SNP_DRIVER      *Snp,\r
   VOID            *MacHeaderPtr,\r
   VOID            *MacHeaderPtr,\r
-  UINTN           MacHeaderSize,\r
-  VOID            *BufferPtr,\r
-  UINTN           BufferLength,\r
-  EFI_MAC_ADDRESS *DestinationAddrPtr,\r
-  EFI_MAC_ADDRESS *SourceAddrPtr,\r
+  UINTN           HeaderSize,\r
+  VOID            *Buffer,\r
+  UINTN           BufferSize,\r
+  EFI_MAC_ADDRESS *DestAddr,\r
+  EFI_MAC_ADDRESS *SrcAddr,\r
   UINT16          *ProtocolPtr\r
   )\r
 {\r
   UINT16          *ProtocolPtr\r
   )\r
 {\r
-  PXE_CPB_FILL_HEADER_FRAGMENTED  *cpb;\r
+  PXE_CPB_FILL_HEADER_FRAGMENTED  *Cpb;\r
 \r
 \r
-  cpb = snp->cpb;\r
-  if (SourceAddrPtr) {\r
+  Cpb = Snp->Cpb;\r
+  if (SrcAddr != NULL) {\r
     CopyMem (\r
     CopyMem (\r
-      (VOID *) cpb->SrcAddr,\r
-      (VOID *) SourceAddrPtr,\r
-      snp->mode.HwAddressSize\r
+      (VOID *) Cpb->SrcAddr,\r
+      (VOID *) SrcAddr,\r
+      Snp->Mode.HwAddressSize\r
       );\r
   } else {\r
     CopyMem (\r
       );\r
   } else {\r
     CopyMem (\r
-      (VOID *) cpb->SrcAddr,\r
-      (VOID *) &(snp->mode.CurrentAddress),\r
-      snp->mode.HwAddressSize\r
+      (VOID *) Cpb->SrcAddr,\r
+      (VOID *) &(Snp->Mode.CurrentAddress),\r
+      Snp->Mode.HwAddressSize\r
       );\r
   }\r
 \r
   CopyMem (\r
       );\r
   }\r
 \r
   CopyMem (\r
-    (VOID *) cpb->DestAddr,\r
-    (VOID *) DestinationAddrPtr,\r
-    snp->mode.HwAddressSize\r
+    (VOID *) Cpb->DestAddr,\r
+    (VOID *) DestAddr,\r
+    Snp->Mode.HwAddressSize\r
     );\r
 \r
   //\r
   // we need to do the byte swapping\r
   //\r
     );\r
 \r
   //\r
   // we need to do the byte swapping\r
   //\r
-  cpb->Protocol             = (UINT16) PXE_SWAP_UINT16 (*ProtocolPtr);\r
+  Cpb->Protocol             = (UINT16) PXE_SWAP_UINT16 (*ProtocolPtr);\r
 \r
 \r
-  cpb->PacketLen            = (UINT32) (BufferLength);\r
-  cpb->MediaHeaderLen       = (UINT16) MacHeaderSize;\r
+  Cpb->PacketLen            = (UINT32) (BufferSize);\r
+  Cpb->MediaHeaderLen       = (UINT16) HeaderSize;\r
 \r
 \r
-  cpb->FragCnt              = 2;\r
-  cpb->reserved             = 0;\r
+  Cpb->FragCnt              = 2;\r
+  Cpb->reserved             = 0;\r
 \r
 \r
-  cpb->FragDesc[0].FragAddr = (UINT64)(UINTN) MacHeaderPtr;\r
-  cpb->FragDesc[0].FragLen  = (UINT32) MacHeaderSize;\r
-  cpb->FragDesc[1].FragAddr = (UINT64)(UINTN) BufferPtr;\r
-  cpb->FragDesc[1].FragLen  = (UINT32) BufferLength;\r
+  Cpb->FragDesc[0].FragAddr = (UINT64)(UINTN) MacHeaderPtr;\r
+  Cpb->FragDesc[0].FragLen  = (UINT32) HeaderSize;\r
+  Cpb->FragDesc[1].FragAddr = (UINT64)(UINTN) Buffer;\r
+  Cpb->FragDesc[1].FragLen  = (UINT32) BufferSize;\r
 \r
 \r
-  cpb->FragDesc[0].reserved = cpb->FragDesc[1].reserved = 0;\r
+  Cpb->FragDesc[0].reserved = Cpb->FragDesc[1].reserved = 0;\r
 \r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_FILL_HEADER;\r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_FILL_HEADER;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED;\r
 \r
 \r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
 \r
 \r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);\r
-  snp->cdb.CPBaddr    = (UINT64)(UINTN) cpb;\r
+  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);\r
+  Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.fill_header()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.fill_header()  "));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64) (UINTN) &Snp->Cdb);\r
 \r
 \r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     return EFI_SUCCESS;\r
 \r
   case PXE_STATCODE_INVALID_PARAMETER:\r
     DEBUG (\r
       (EFI_D_ERROR,\r
   case PXE_STATCODE_SUCCESS:\r
     return EFI_SUCCESS;\r
 \r
   case PXE_STATCODE_INVALID_PARAMETER:\r
     DEBUG (\r
       (EFI_D_ERROR,\r
-      "\nsnp->undi.fill_header()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      "\nSnp->undi.fill_header()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_INVALID_PARAMETER;\r
       );\r
 \r
     return EFI_INVALID_PARAMETER;\r
@@ -129,9 +122,9 @@ pxe_fillheader (
   default:\r
     DEBUG (\r
       (EFI_D_ERROR,\r
   default:\r
     DEBUG (\r
       (EFI_D_ERROR,\r
-      "\nsnp->undi.fill_header()  %xh:%xh\n",\r
-      snp->cdb.StatFlags,\r
-      snp->cdb.StatCode)\r
+      "\nSnp->undi.fill_header()  %xh:%xh\n",\r
+      Snp->Cdb.StatFlags,\r
+      Snp->Cdb.StatCode)\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
       );\r
 \r
     return EFI_DEVICE_ERROR;\r
@@ -142,63 +135,63 @@ pxe_fillheader (
 /**\r
   This routine calls undi to transmit the given data buffer\r
 \r
 /**\r
   This routine calls undi to transmit the given data buffer\r
 \r
-  @param  snp                 pointer to SNP driver structure\r
-  @param  BufferPtr           data buffer pointer\r
-  @param  BufferLength        Size of data in the BufferPtr\r
+  @param  Snp                 pointer to SNP driver structure\r
+  @param  Buffer           data buffer pointer\r
+  @param  BufferSize        Size of data in the Buffer\r
 \r
   @retval EFI_SUCCESS         if successfully completed the undi call\r
   @retval Other               error return from undi call.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
   @retval EFI_SUCCESS         if successfully completed the undi call\r
   @retval Other               error return from undi call.\r
 \r
 **/\r
 EFI_STATUS\r
-pxe_transmit (\r
-  SNP_DRIVER *snp,\r
-  VOID       *BufferPtr,\r
-  UINTN      BufferLength\r
+PxeTransmit (\r
+  SNP_DRIVER *Snp,\r
+  VOID       *Buffer,\r
+  UINTN      BufferSize\r
   )\r
 {\r
   )\r
 {\r
-  PXE_CPB_TRANSMIT  *cpb;\r
+  PXE_CPB_TRANSMIT  *Cpb;\r
   EFI_STATUS        Status;\r
 \r
   EFI_STATUS        Status;\r
 \r
-  cpb             = snp->cpb;\r
-  cpb->FrameAddr  = (UINT64) (UINTN) BufferPtr;\r
-  cpb->DataLen    = (UINT32) BufferLength;\r
+  Cpb             = Snp->Cpb;\r
+  Cpb->FrameAddr  = (UINT64) (UINTN) Buffer;\r
+  Cpb->DataLen    = (UINT32) BufferSize;\r
 \r
 \r
-  cpb->MediaheaderLen = 0;\r
-  cpb->reserved       = 0;\r
+  Cpb->MediaheaderLen = 0;\r
+  Cpb->reserved       = 0;\r
 \r
 \r
-  snp->cdb.OpFlags    = PXE_OPFLAGS_TRANSMIT_WHOLE;\r
+  Snp->Cdb.OpFlags    = PXE_OPFLAGS_TRANSMIT_WHOLE;\r
 \r
 \r
-  snp->cdb.CPBsize    = sizeof (PXE_CPB_TRANSMIT);\r
-  snp->cdb.CPBaddr    = (UINT64)(UINTN) cpb;\r
+  Snp->Cdb.CPBsize    = sizeof (PXE_CPB_TRANSMIT);\r
+  Snp->Cdb.CPBaddr    = (UINT64)(UINTN) Cpb;\r
 \r
 \r
-  snp->cdb.OpCode     = PXE_OPCODE_TRANSMIT;\r
-  snp->cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
-  snp->cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
+  Snp->Cdb.OpCode     = PXE_OPCODE_TRANSMIT;\r
+  Snp->Cdb.DBsize     = PXE_DBSIZE_NOT_USED;\r
+  Snp->Cdb.DBaddr     = PXE_DBADDR_NOT_USED;\r
 \r
 \r
-  snp->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  snp->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  snp->cdb.IFnum      = snp->if_num;\r
-  snp->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  Snp->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  Snp->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  Snp->Cdb.IFnum      = Snp->IfNum;\r
+  Snp->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  DEBUG ((EFI_D_NET, "\nsnp->undi.transmit()  "));\r
-  DEBUG ((EFI_D_NET, "\nsnp->cdb.OpCode  == %x", snp->cdb.OpCode));\r
-  DEBUG ((EFI_D_NET, "\nsnp->cdb.CPBaddr == %LX", snp->cdb.CPBaddr));\r
-  DEBUG ((EFI_D_NET, "\nsnp->cdb.DBaddr  == %LX", snp->cdb.DBaddr));\r
-  DEBUG ((EFI_D_NET, "\ncpb->FrameAddr   == %LX\n", cpb->FrameAddr));\r
+  DEBUG ((EFI_D_NET, "\nSnp->undi.transmit()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->Cdb.OpCode  == %x", Snp->Cdb.OpCode));\r
+  DEBUG ((EFI_D_NET, "\nSnp->Cdb.CPBaddr == %LX", Snp->Cdb.CPBaddr));\r
+  DEBUG ((EFI_D_NET, "\nSnp->Cdb.DBaddr  == %LX", Snp->Cdb.DBaddr));\r
+  DEBUG ((EFI_D_NET, "\nCpb->FrameAddr   == %LX\n", Cpb->FrameAddr));\r
 \r
 \r
-  (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);\r
+  (*Snp->IssueUndi32Command) ((UINT64) (UINTN) &Snp->Cdb);\r
 \r
 \r
-  DEBUG ((EFI_D_NET, "\nexit snp->undi.transmit()  "));\r
-  DEBUG ((EFI_D_NET, "\nsnp->cdb.StatCode == %r", snp->cdb.StatCode));\r
+  DEBUG ((EFI_D_NET, "\nexit Snp->undi.transmit()  "));\r
+  DEBUG ((EFI_D_NET, "\nSnp->Cdb.StatCode == %r", Snp->Cdb.StatCode));\r
 \r
   //\r
   // we will unmap the buffers in get_status call, not here\r
   //\r
 \r
   //\r
   // we will unmap the buffers in get_status call, not here\r
   //\r
-  switch (snp->cdb.StatCode) {\r
+  switch (Snp->Cdb.StatCode) {\r
   case PXE_STATCODE_SUCCESS:\r
     return EFI_SUCCESS;\r
 \r
   case PXE_STATCODE_SUCCESS:\r
     return EFI_SUCCESS;\r
 \r
@@ -213,61 +206,97 @@ pxe_transmit (
 \r
   DEBUG (\r
     (EFI_D_ERROR,\r
 \r
   DEBUG (\r
     (EFI_D_ERROR,\r
-    "\nsnp->undi.transmit()  %xh:%xh\n",\r
-    snp->cdb.StatFlags,\r
-    snp->cdb.StatCode)\r
+    "\nSnp->undi.transmit()  %xh:%xh\n",\r
+    Snp->Cdb.StatFlags,\r
+    Snp->Cdb.StatCode)\r
     );\r
 \r
   return Status;\r
 }\r
 \r
     );\r
 \r
   return Status;\r
 }\r
 \r
-\r
 /**\r
 /**\r
-  This is the snp interface routine for transmitting a packet. this routine\r
-  basically retrieves the snp structure, checks the snp state and calls\r
-  pxe_fill_header and pxe_transmit calls to complete the transmission.\r
-\r
-  @param  this                pointer to SNP driver context\r
-  @param  MacHeaderSize       size of the memory at MacHeaderPtr\r
-  @param  BufferLength        Size of data in the BufferPtr\r
-  @param  BufferPtr           data buffer pointer\r
-  @param  SourceAddrPtr       address of the source mac address buffer\r
-  @param  DestinationAddrPtr  address of the destination mac address buffer\r
-  @param  ProtocolPtr         address of the protocol type\r
-\r
-  @retval EFI_SUCCESS         if successfully completed the undi call\r
-  @retval Other               error return from undi call.\r
+  Places a packet in the transmit queue of a network interface.\r
+  \r
+  This function places the packet specified by Header and Buffer on the transmit\r
+  queue. If HeaderSize is nonzero and HeaderSize is not equal to \r
+  This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If \r
+  BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL\r
+  will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be \r
+  returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then\r
+  EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network\r
+  interface is busy, then EFI_NOT_READY will be returned. If this packet can be \r
+  accepted by the transmit engine of the network interface, the packet contents \r
+  specified by Buffer will be placed on the transmit queue of the network \r
+  interface, and EFI_SUCCESS will be returned. GetStatus() can be used to \r
+  determine when the packet has actually been transmitted. The contents of the \r
+  Buffer must not be modified until the packet has actually been transmitted. \r
+  The Transmit() function performs nonblocking I/O. A caller who wants to perform\r
+  blocking I/O, should call Transmit(), and then GetStatus() until the \r
+  transmitted buffer shows up in the recycled transmit buffer.\r
+  If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+  @param This       A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+  @param HeaderSize The size, in bytes, of the media header to be filled in by the \r
+                    Transmit() function. If HeaderSize is nonzero, then it must\r
+                    be equal to This->Mode->MediaHeaderSize and the DestAddr and\r
+                    Protocol parameters must not be NULL.\r
+  @param BufferSize The size, in bytes, of the entire packet (media header and\r
+                    data) to be transmitted through the network interface.\r
+  @param Buffer     A pointer to the packet (media header followed by data) to be \r
+                    transmitted. This parameter cannot be NULL. If HeaderSize is \r
+                    zero, then the media header in Buffer must already be filled\r
+                    in by the caller. If HeaderSize is nonzero, then the media \r
+                    header will be filled in by the Transmit() function.\r
+  @param SrcAddr    The source HW MAC address. If HeaderSize is zero, then this \r
+                    parameter is ignored. If HeaderSize is nonzero and SrcAddr \r
+                    is NULL, then This->Mode->CurrentAddress is used for the \r
+                    source HW MAC address.\r
+  @param DestAddr   The destination HW MAC address. If HeaderSize is zero, then \r
+                    this parameter is ignored.\r
+  @param Protocol   The type of header to build. If HeaderSize is zero, then this \r
+                    parameter is ignored. See RFC 1700, section "Ether Types," \r
+                    for examples.\r
+\r
+  @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_NOT_READY         The network interface is too busy to accept this\r
+                                transmit request.\r
+  @retval EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported\r
+                                value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-snp_undi32_transmit (\r
-  IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
-  IN UINTN                       MacHeaderSize,\r
-  IN UINTN                       BufferLength,\r
-  IN VOID                        *BufferPtr,\r
-  IN EFI_MAC_ADDRESS             * SourceAddrPtr OPTIONAL,\r
-  IN EFI_MAC_ADDRESS             * DestinationAddrPtr OPTIONAL,\r
-  IN UINT16                      *ProtocolPtr OPTIONAL\r
+SnpUndi32Transmit (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINTN                       HeaderSize,\r
+  IN UINTN                       BufferSize,\r
+  IN VOID                        *Buffer,\r
+  IN EFI_MAC_ADDRESS             *SrcAddr,  OPTIONAL\r
+  IN EFI_MAC_ADDRESS             *DestAddr, OPTIONAL\r
+  IN UINT16                      *Protocol  OPTIONAL\r
   )\r
 {\r
   )\r
 {\r
-  SNP_DRIVER  *snp;\r
+  SNP_DRIVER  *Snp;\r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
   EFI_STATUS  Status;\r
   EFI_TPL     OldTpl;\r
 \r
-  if (this == NULL) {\r
+  if (This == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);\r
+  Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  if (snp == NULL) {\r
+  if (Snp == NULL) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  switch (snp->mode.State) {\r
+  switch (Snp->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -280,35 +309,35 @@ snp_undi32_transmit (
     goto ON_EXIT;\r
   }\r
 \r
     goto ON_EXIT;\r
   }\r
 \r
-  if (BufferPtr == NULL) {\r
+  if (Buffer == NULL) {\r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
     Status = EFI_INVALID_PARAMETER;\r
     goto ON_EXIT;\r
   }\r
 \r
-  if (BufferLength < snp->mode.MediaHeaderSize) {\r
+  if (BufferSize < Snp->Mode.MediaHeaderSize) {\r
     Status = EFI_BUFFER_TOO_SMALL;\r
     goto ON_EXIT;\r
   }\r
 \r
   //\r
     Status = EFI_BUFFER_TOO_SMALL;\r
     goto ON_EXIT;\r
   }\r
 \r
   //\r
-  // if the MacHeaderSize is non-zero, we need to fill up the header and for that\r
+  // if the HeaderSize is non-zero, we need to fill up the header and for that\r
   // we need the destination address and the protocol\r
   //\r
   // we need the destination address and the protocol\r
   //\r
-  if (MacHeaderSize != 0) {\r
-    if (MacHeaderSize != snp->mode.MediaHeaderSize || DestinationAddrPtr == 0 || ProtocolPtr == 0) {\r
+  if (HeaderSize != 0) {\r
+    if (HeaderSize != Snp->Mode.MediaHeaderSize || DestAddr == 0 || Protocol == 0) {\r
       Status = EFI_INVALID_PARAMETER;\r
       goto ON_EXIT;\r
     }\r
 \r
       Status = EFI_INVALID_PARAMETER;\r
       goto ON_EXIT;\r
     }\r
 \r
-    Status = pxe_fillheader (\r
-              snp,\r
-              BufferPtr,\r
-              MacHeaderSize,\r
-              (UINT8 *) BufferPtr + MacHeaderSize,\r
-              BufferLength - MacHeaderSize,\r
-              DestinationAddrPtr,\r
-              SourceAddrPtr,\r
-              ProtocolPtr\r
+    Status = PxeFillHeader (\r
+              Snp,\r
+              Buffer,\r
+              HeaderSize,\r
+              (UINT8 *) Buffer + HeaderSize,\r
+              BufferSize - HeaderSize,\r
+              DestAddr,\r
+              SrcAddr,\r
+              Protocol\r
               );\r
 \r
     if (EFI_ERROR (Status)) {\r
               );\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -316,7 +345,7 @@ snp_undi32_transmit (
     }\r
   }\r
 \r
     }\r
   }\r
 \r
-  Status = pxe_transmit (snp, BufferPtr, BufferLength);\r
+  Status = PxeTransmit (Snp, Buffer, BufferSize);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
 \r
 ON_EXIT:\r
   gBS->RestoreTPL (OldTpl);\r
index 57d82ea160203fc5f3b2da8a387f5812ac3fe0d7..8dd8fd997e8c6b3730132712b80eeecf15adb7fd 100644 (file)
@@ -1,28 +1,25 @@
 /** @file\r
 /** @file\r
-Copyright (c) 2004, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+    Event handler to check for available packet.\r
+\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module name:\r
-  WaitForPacket.c\r
-\r
-Abstract:\r
-  Event handler to check for available packet.\r
-\r
-\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
 **/\r
 \r
 #include "Snp.h"\r
 \r
 \r
 /**\r
+  Nofication call back function for WaitForPacket event.\r
 \r
 \r
-\r
+  @param  Event       EFI Event.\r
+  @param  SnpPtr      Pointer to SNP_DRIVER structure.\r
 \r
 **/\r
 VOID\r
 \r
 **/\r
 VOID\r
@@ -43,7 +40,7 @@ SnpWaitForPacketNotify (
   //\r
   // Do nothing if the SNP interface is not initialized.\r
   //\r
   //\r
   // Do nothing if the SNP interface is not initialized.\r
   //\r
-  switch (((SNP_DRIVER *) SnpPtr)->mode.State) {\r
+  switch (((SNP_DRIVER *) SnpPtr)->Mode.State) {\r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
   case EfiSimpleNetworkInitialized:\r
     break;\r
 \r
@@ -55,28 +52,28 @@ SnpWaitForPacketNotify (
   //\r
   // Fill in CDB for UNDI GetStatus().\r
   //\r
   //\r
   // Fill in CDB for UNDI GetStatus().\r
   //\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.OpCode     = PXE_OPCODE_GET_STATUS;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.OpFlags    = 0;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.DBsize     = sizeof (UINT32) * 2;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.DBaddr     = (UINT64)(UINTN) (((SNP_DRIVER *) SnpPtr)->db);\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.IFnum      = ((SNP_DRIVER *) SnpPtr)->if_num;\r
-  ((SNP_DRIVER *) SnpPtr)->cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.OpCode     = PXE_OPCODE_GET_STATUS;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.OpFlags    = 0;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.CPBsize    = PXE_CPBSIZE_NOT_USED;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.CPBaddr    = PXE_CPBADDR_NOT_USED;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.DBsize     = sizeof (UINT32) * 2;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.DBaddr     = (UINT64)(UINTN) (((SNP_DRIVER *) SnpPtr)->Db);\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.StatCode   = PXE_STATCODE_INITIALIZE;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.StatFlags  = PXE_STATFLAGS_INITIALIZE;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.IFnum      = ((SNP_DRIVER *) SnpPtr)->IfNum;\r
+  ((SNP_DRIVER *) SnpPtr)->Cdb.Control    = PXE_CONTROL_LAST_CDB_IN_LIST;\r
 \r
   //\r
   // Clear contents of DB buffer.\r
   //\r
 \r
   //\r
   // Clear contents of DB buffer.\r
   //\r
-  ZeroMem (((SNP_DRIVER *) SnpPtr)->db, sizeof (UINT32) * 2);\r
+  ZeroMem (((SNP_DRIVER *) SnpPtr)->Db, sizeof (UINT32) * 2);\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
 \r
   //\r
   // Issue UNDI command and check result.\r
   //\r
-  (*((SNP_DRIVER *) SnpPtr)->issue_undi32_command) ((UINT64)(UINTN) &((SNP_DRIVER *) SnpPtr)->cdb);\r
+  (*((SNP_DRIVER *) SnpPtr)->IssueUndi32Command) ((UINT64)(UINTN) &((SNP_DRIVER *) SnpPtr)->Cdb);\r
 \r
 \r
-  if (((SNP_DRIVER *) SnpPtr)->cdb.StatCode != EFI_SUCCESS) {\r
+  if (((SNP_DRIVER *) SnpPtr)->Cdb.StatCode != EFI_SUCCESS) {\r
     return ;\r
   }\r
   //\r
     return ;\r
   }\r
   //\r
@@ -85,7 +82,7 @@ SnpWaitForPacketNotify (
   //\r
   CopyMem (\r
     &PxeDbGetStatus,\r
   //\r
   CopyMem (\r
     &PxeDbGetStatus,\r
-    ((SNP_DRIVER *) SnpPtr)->db,\r
+    ((SNP_DRIVER *) SnpPtr)->Db,\r
     sizeof (UINT32) * 2\r
     );\r
 \r
     sizeof (UINT32) * 2\r
     );\r
 \r