]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Scrubbed SnpNt32 c header and source.
authorjgong5 <jgong5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 10 Nov 2008 05:11:29 +0000 (05:11 +0000)
committerjgong5 <jgong5@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 10 Nov 2008 05:11:29 +0000 (05:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6436 6f19259b-4bc3-4df7-8a09-765794883524

Nt32Pkg/SnpNt32Dxe/SnpNt32.c
Nt32Pkg/SnpNt32Dxe/SnpNt32.h

index 965452660eefe94b3a400690384e1995ca350916..d995a6eecec7c324c9567d94e37343a8dac9895c 100644 (file)
@@ -52,17 +52,417 @@ SNPNT32_GLOBAL_DATA         gSnpNt32GlobalData = {
   SnpNt32CloseInstance                    //  CloseInstance\r
 };\r
 \r
+/**\r
+  Changes the state of a network interface from "stopped" to "started".\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Start (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
+  );\r
+  \r
+/**\r
+  Changes the state of a network interface from "started" to "stopped".\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Stop (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
+  );\r
+  \r
+/**\r
+  Resets a network adapter and allocates the transmit and receive buffers \r
+  required by the network interface; optionally, also requests allocation \r
+  of additional transmit and receive buffers.\r
+\r
+  @param  This              Protocol instance pointer.\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 extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            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 extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            being used.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Initialize (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINTN                       ExtraRxBufferSize OPTIONAL,\r
+  IN UINTN                       ExtraTxBufferSize OPTIONAL\r
+  );\r
+  \r
+/**\r
+  Resets a network adapter and re-initializes it with the parameters that were \r
+  provided in the previous call to Initialize().  \r
+\r
+  @param  This                 Protocol instance pointer.\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           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Reset (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This,\r
+  IN BOOLEAN                      ExtendedVerification\r
+  );\r
+\r
+/**\r
+  Resets a network adapter and leaves it in a state that is safe for \r
+  another driver to initialize.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Shutdown (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
+  );\r
+\r
+/**\r
+  Manages the multicast receive filters of a network interface.\r
+\r
+  @param  This               Protocol instance pointer.\r
+  @param  EnableBits         A bit mask of receive filters to enable on the network interface.\r
+  @param  DisableBits        A bit mask of receive filters to disable on the network interface.\r
+  @param  ResetMcastFilter   Set to TRUE to reset the contents of the multicast receive\r
+                             filters on the network interface to their default values.\r
+  @param  McastFilterCount   Number of multicast HW MAC addresses in the new\r
+                             MCastFilter list. This value must be less than or equal to\r
+                             the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This\r
+                             field is optional if ResetMCastFilter is TRUE.\r
+  @param  McastFilter        A pointer to a list of new multicast receive filter HW MAC\r
+                             addresses. This list will replace any existing multicast\r
+                             HW MAC address list. This field is optional if\r
+                             ResetMCastFilter is TRUE.\r
+\r
+  @retval EFI_SUCCESS           The multicast receive filter list was updated.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32ReceiveFilters (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN UINT32                      EnableBits,\r
+  IN UINT32                      DisableBits,\r
+  IN BOOLEAN                     ResetMcastFilter,\r
+  IN UINTN                       McastFilterCount OPTIONAL,\r
+  IN EFI_MAC_ADDRESS             *McastFilter     OPTIONAL\r
+  );\r
+\r
+/**\r
+  Modifies or resets the current station address, if supported.\r
+\r
+  @param  This         Protocol instance pointer.\r
+  @param  Reset        Flag used to reset the station address to the network interfaces\r
+                       permanent address.\r
+  @param  NewMacAddr   New station address to be used for the network interface.\r
+\r
+  @retval EFI_UNSUPPORTED       Not supported yet.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32StationAddress (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     Reset,\r
+  IN EFI_MAC_ADDRESS             *NewMacAddr OPTIONAL\r
+  );\r
+\r
+/**\r
+  Resets or collects the statistics on a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\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\r
+                          output the size, in bytes, of the resulting table of\r
+                          statistics.\r
+  @param  StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
+                          contains the statistics.\r
+\r
+  @retval EFI_SUCCESS           The statistics were collected from the network interface.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
+  @retval EFI_UNSUPPORTED       Not supported yet.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Statistics (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  * This,\r
+  IN BOOLEAN                      Reset,\r
+  IN OUT UINTN                    *StatisticsSize OPTIONAL,\r
+  OUT EFI_NETWORK_STATISTICS      *StatisticsTable OPTIONAL\r
+  );\r
+  \r
+/**\r
+  Converts a multicast IP address to a multicast HW MAC address.\r
+  \r
+  @param  This  Protocol instance pointer.\r
+  @param  Ipv6  Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set\r
+                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 multicast\r
+                                HW MAC address.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
+  @retval EFI_UNSUPPORTED       Not supported yet.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32McastIptoMac (\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
+/**\r
+  Performs read and write operations on the NVRAM device attached to a \r
+  network interface.\r
+\r
+  @param  This         Protocol instance pointer.\r
+  @param  ReadOrWrite  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 and\r
+                       less than NvRamSize.\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_UNSUPPORTED       Not supported yet.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Nvdata (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  IN BOOLEAN                     ReadOrWrite,\r
+  IN UINTN                       Offset,\r
+  IN UINTN                       BufferSize,\r
+  IN OUT VOID                    *Buffer\r
+  );\r
+\r
+/**\r
+  Reads the current interrupt status and recycled transmit buffer status from \r
+  a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  InterruptStatus A pointer to the bit mask of the currently active interrupts\r
+                          If this is NULL, the interrupt status will not be read from\r
+                          the device. If this is not NULL, the interrupt status will\r
+                          be read from the device. When the  interrupt status is read,\r
+                          it will also be cleared. Clearing the transmit  interrupt\r
+                          does not empty the recycled transmit buffer array.\r
+  @param  TxBuffer        Recycled transmit buffer address. The network interface will\r
+                          not transmit if its internal recycled transmit buffer array\r
+                          is full. Reading the transmit buffer does not clear the\r
+                          transmit interrupt. If this is NULL, then the transmit buffer\r
+                          status will not be read. If there are no transmit buffers to\r
+                          recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32GetStatus (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINT32                     *InterruptStatus,\r
+  OUT VOID                       **TxBuffer\r
+  );\r
+\r
+/**\r
+  Places a packet in the transmit queue of a network interface.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  HeaderSize The size, in bytes, of the media header to be filled in by\r
+                     the Transmit() function. If HeaderSize is non-zero, then it\r
+                     must be equal to This->Mode->MediaHeaderSize and the DestAddr\r
+                     and 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 zero,\r
+                     then the media header in Buffer must already be filled in by the\r
+                     caller. If HeaderSize is non-zero, then the media header will be\r
+                     filled in by the Transmit() function.\r
+  @param  SrcAddr    The source HW MAC address. If HeaderSize is zero, then this parameter\r
+                     is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r
+                     This->Mode->CurrentAddress is used for the source HW MAC address.\r
+  @param  DestAddr   The destination HW MAC address. If HeaderSize is zero, then this\r
+                     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", for\r
+                     examples.\r
+\r
+  @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_ACCESS_DENIED     Error acquire global lock for operation.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Transmit (\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
+  Receives a packet from a network interface.\r
+\r
+  @param  This             Protocol instance pointer.\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  BuffSize         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 header and\r
+                           the data.\r
+  @param  SourceAddr       The source HW MAC address. If this parameter is NULL, the\r
+                           HW MAC source address will not be extracted from the media\r
+                           header.\r
+  @param  DestinationAddr  The destination HW MAC address. If this parameter is NULL,\r
+                           the HW MAC destination address will not be extracted from the\r
+                           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 BufferSize has\r
+                                 been updated to the number of bytes received.\r
+  @retval  EFI_NOT_READY         The network interface is too busy to accept this transmit\r
+                                 request.\r
+  @retval  EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval  EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval  EFI_ACCESS_DENIED     Error acquire global lock for operation.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SnpNt32Receive (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+  OUT UINTN                      *HeaderSize,\r
+  IN OUT UINTN                   *BuffSize,\r
+  OUT VOID                       *Buffer,\r
+  OUT EFI_MAC_ADDRESS            *SourceAddr,\r
+  OUT EFI_MAC_ADDRESS            *DestinationAddr,\r
+  OUT UINT16                     *Protocol\r
+  );\r
+\r
+SNPNT32_INSTANCE_DATA gSnpNt32InstanceTemplate = {\r
+  SNP_NT32_INSTANCE_SIGNATURE,            //  Signature\r
+  {\r
+    NULL,\r
+    NULL\r
+  },                                      //  Entry\r
+  NULL,                                   //  GlobalData\r
+  NULL,                                   //  DeviceHandle\r
+  NULL,                                   //  DevicePath\r
+  {                                       //  Snp\r
+    EFI_SIMPLE_NETWORK_PROTOCOL_REVISION, //  Revision\r
+    SnpNt32Start,                         //  Start\r
+    SnpNt32Stop,                          //  Stop\r
+    SnpNt32Initialize,                    //  Initialize\r
+    SnpNt32Reset,                         //  Reset\r
+    SnpNt32Shutdown,                      //  Shutdown\r
+    SnpNt32ReceiveFilters,                //  ReceiveFilters\r
+    SnpNt32StationAddress,                //  StationAddress\r
+    SnpNt32Statistics,                    //  Statistics\r
+    SnpNt32McastIptoMac,                  //  MCastIpToMac\r
+    SnpNt32Nvdata,                        //  NvData\r
+    SnpNt32GetStatus,                     //  GetStatus\r
+    SnpNt32Transmit,                      //  Transmit\r
+    SnpNt32Receive,                       //  Receive\r
+    NULL,                                 //  WaitForPacket\r
+    NULL                                  //  Mode\r
+  },\r
+  {                                       //  Mode\r
+    EfiSimpleNetworkInitialized,          //  State\r
+    NET_ETHER_ADDR_LEN,                   //  HwAddressSize\r
+    NET_ETHER_HEADER_SIZE,                //  MediaHeaderSize\r
+    1500,                                 //  MaxPacketSize\r
+    0,                                    //  NvRamSize\r
+    0,                                    //  NvRamAccessSize\r
+    0,                                    //  ReceiveFilterMask\r
+    0,                                    //  ReceiveFilterSetting\r
+    MAX_MCAST_FILTER_CNT,                 //  MaxMCastFilterCount\r
+    0,                                    //  MCastFilterCount\r
+    {\r
+      0\r
+    },                                    //  MCastFilter\r
+    {\r
+      0\r
+    },                                    //  CurrentAddress\r
+    {\r
+      0\r
+    },                                    //  BroadcastAddress\r
+    {\r
+      0\r
+    },                                    //  PermanentAddress\r
+    NET_IFTYPE_ETHERNET,                  //  IfType\r
+    FALSE,                                //  MacAddressChangeable\r
+    FALSE,                                //  MultipleTxSupported\r
+    FALSE,                                //  MediaPresentSupported\r
+    TRUE                                  //  MediaPresent\r
+  },\r
+  {\r
+    0\r
+  }                                       //  InterfaceInfo\r
+};\r
 \r
 /**\r
-  Test to see if this driver supports ControllerHandle.\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
+  @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_SUCCES            This driver supports this device.\r
-  @retval other                 This driver does not support this device.\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_UNSUPPORTED     This driver does not support this device\r
 \r
 **/\r
 EFI_STATUS\r
@@ -95,14 +495,19 @@ SnpNt32DriverBindingSupported (
 \r
 \r
 /**\r
-  Start this driver on ControllerHandle.\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
-  @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
+  @param  This                 Protocol instance pointer.\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
-  @retval EFI_SUCCES            This driver is added to ControllerHandle.\r
+  @retval EFI_SUCCESS          Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -116,17 +521,21 @@ SnpNt32DriverBindingStart (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Stop this driver on ControllerHandle.\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\r
-                                of children is zero stop the entire bus driver.\r
-  @param  ChildHandleBuffer     List of Child Handles to Stop.\r
-\r
-  @retval EFI_SUCCES            This driver is removed ControllerHandle.\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       Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -138,20 +547,20 @@ SnpNt32DriverBindingStop (
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   )\r
 {\r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
 /**\r
-  Start the SnpNt32 interface.\r
+  Changes the state of a network interface from "stopped" to "started".\r
 \r
-  @param  This                  Context pointer.\r
+  @param  This Protocol instance pointer.\r
 \r
-  @retval EFI_SUCCESS           The interface is started.\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Start (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
@@ -161,14 +570,15 @@ SnpNt32Start (
 \r
 \r
 /**\r
-  Stop the SnpNt32 interface.\r
+  Changes the state of a network interface from "started" to "stopped".\r
 \r
-  @param  This                  Context pointer.\r
+  @param  This Protocol instance pointer.\r
 \r
-  @retval EFI_SUCCESS           The interface is stopped.\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Stop (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
@@ -176,18 +586,28 @@ SnpNt32Stop (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Initialize the SnpNt32 interface.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  ExtraRxBufferSize     Number of extra receive buffer.\r
-  @param  ExtraTxBufferSize     Number of extra transmit buffer.\r
-\r
-  @retval EFI_SUCCESS           The interface is initialized.\r
+  Resets a network adapter and allocates the transmit and receive buffers \r
+  required by the network interface; optionally, also requests allocation \r
+  of additional transmit and receive buffers.\r
+\r
+  @param  This              Protocol instance pointer.\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 extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            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 extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            being used.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Initialize (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN UINTN                       ExtraRxBufferSize OPTIONAL,\r
@@ -197,17 +617,20 @@ SnpNt32Initialize (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Reset the snpnt32 interface.\r
+  Resets a network adapter and re-initializes it with the parameters that were \r
+  provided in the previous call to Initialize().  \r
 \r
-  @param  This                  Context pointer.\r
-  @param  ExtendedVerification  Not implemented.\r
+  @param  This                 Protocol instance pointer.\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 interface is reseted.\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Reset (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL  *This,\r
   IN BOOLEAN                      ExtendedVerification\r
@@ -216,16 +639,17 @@ SnpNt32Reset (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Shut down the snpnt32 interface.\r
+  Resets a network adapter and leaves it in a state that is safe for \r
+  another driver to initialize.\r
 \r
-  @param  This                  Context pointer.\r
+  @param  This Protocol instance pointer.\r
 \r
-  @retval EFI_SUCCESS           The interface is shut down.\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Shutdown (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
   )\r
@@ -233,31 +657,36 @@ SnpNt32Shutdown (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Change the interface's receive filter setting.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  EnableBits            The receive filters to enable.\r
-  @param  DisableBits           The receive filters to disable\r
-  @param  ResetMcastFilter      Reset the multicast filters or not.\r
-  @param  McastFilterCount      The count of multicast filter to set.\r
-  @param  McastFilter           Pointer to the arrya of multicast addresses to set.\r
-\r
-  @retval EFI_SUCCESS           The receive filter is updated.\r
-  @retval EFI_ACCESS_DENIED     The snpnt32 lock is already owned by another\r
-                                routine.\r
-  @retval EFI_DEVICE_ERROR      Failed to update the receive filter.\r
+  Manages the multicast receive filters of a network interface.\r
+\r
+  @param  This               Protocol instance pointer.\r
+  @param  EnableBits         A bit mask of receive filters to enable on the network interface.\r
+  @param  DisableBits        A bit mask of receive filters to disable on the network interface.\r
+  @param  ResetMcastFilter   Set to TRUE to reset the contents of the multicast receive\r
+                             filters on the network interface to their default values.\r
+  @param  McastFilterCount   Number of multicast HW MAC addresses in the new\r
+                             MCastFilter list. This value must be less than or equal to\r
+                             the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This\r
+                             field is optional if ResetMCastFilter is TRUE.\r
+  @param  McastFilter        A pointer to a list of new multicast receive filter HW MAC\r
+                             addresses. This list will replace any existing multicast\r
+                             HW MAC address list. This field is optional if\r
+                             ResetMCastFilter is TRUE.\r
+\r
+  @retval EFI_SUCCESS           The multicast receive filter list was updated.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32ReceiveFilters (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN UINT32                      EnableBits,\r
   IN UINT32                      DisableBits,\r
   IN BOOLEAN                     ResetMcastFilter,\r
   IN UINTN                       McastFilterCount OPTIONAL,\r
-  IN EFI_MAC_ADDRESS             *McastFilter OPTIONAL\r
+  IN EFI_MAC_ADDRESS             *McastFilter     OPTIONAL\r
   )\r
 {\r
   SNPNT32_INSTANCE_DATA *Instance;\r
@@ -288,18 +717,19 @@ SnpNt32ReceiveFilters (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Change or reset the mac address of the interface.\r
+  Modifies or resets the current station address, if supported.\r
 \r
-  @param  This                  Context pointer.\r
-  @param  reset                 Reset the mac address to the original one or not.\r
-  @param  NewMacAddr            Pointer to the new mac address to set.\r
+  @param  This         Protocol instance pointer.\r
+  @param  Reset        Flag used to reset the station address to the network interfaces\r
+                       permanent address.\r
+  @param  NewMacAddr   New station address to be used for the network interface.\r
 \r
   @retval EFI_UNSUPPORTED       Not supported yet.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32StationAddress (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     Reset,\r
@@ -309,45 +739,58 @@ SnpNt32StationAddress (
   return EFI_UNSUPPORTED;\r
 }\r
 \r
-\r
 /**\r
-  Get or reset the statistics data.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  Reset                 Reset the statistics or not.\r
-  @param  StatisticsSize        The size of the buffer used to receive the\r
-                                statistics data.\r
-  @param  StatisticsTable       Pointer to the table used to receive the statistics\r
-                                data.\r
-\r
+  Resets or collects the statistics on a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\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\r
+                          output the size, in bytes, of the resulting table of\r
+                          statistics.\r
+  @param  StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
+                          contains the statistics.\r
+\r
+  @retval EFI_SUCCESS           The statistics were collected from the network interface.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
   @retval EFI_UNSUPPORTED       Not supported yet.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Statistics (\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
+  OUT EFI_NETWORK_STATISTICS      *StatisticsTable OPTIONAL\r
   )\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
-\r
 /**\r
-  Convert a multicast ip address to the multicast mac address.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  Ipv6                  The Ip is an Ipv6 address or not.\r
-  @param  Ip                    Pointer to the Ip address to convert.\r
-  @param  Mac                   Pointer to the buffer used to hold the converted\r
-                                mac address.\r
-\r
+  Converts a multicast IP address to a multicast HW MAC address.\r
+\r
+  @param  This Protocol instance pointer.\r
+  @param  Ipv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set\r
+               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 multicast\r
+                                HW MAC address.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
   @retval EFI_UNSUPPORTED       Not supported yet.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32McastIptoMac (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     Ipv6,\r
@@ -360,19 +803,23 @@ SnpNt32McastIptoMac (
 \r
 \r
 /**\r
-  Read or write the nv data.\r
-\r
-  @param  This                  Context pinter.\r
-  @param  ReadOrWrite           Read or write the nv data.\r
-  @param  Offset                The offset to the start of the nv data.\r
-  @param  BufferSize            Size of the buffer.\r
-  @param  Buffer                Pointer to the buffer containing the data to write\r
-                                or used to receive the data read.\r
+  Performs read and write operations on the NVRAM device attached to a \r
+  network interface.\r
+\r
+  @param  This         Protocol instance pointer.\r
+  @param  ReadOrWrite  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 and\r
+                       less than NvRamSize.\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_UNSUPPORTED       Not supported yet.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Nvdata (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN BOOLEAN                     ReadOrWrite,\r
@@ -386,18 +833,28 @@ SnpNt32Nvdata (
 \r
 \r
 /**\r
-  Get the status information of the interface.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  InterruptStatus       The storage to hold the interrupt status.\r
-  @param  TxBuffer              Pointer to get the list of pointers of previously\r
-                                transmitted buffers whose transmission was\r
-                                completed asynchrnously.\r
-\r
-  @retval EFI_SUCCESS           The status is got.\r
+  Reads the current interrupt status and recycled transmit buffer status from \r
+  a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  InterruptStatus A pointer to the bit mask of the currently active interrupts\r
+                          If this is NULL, the interrupt status will not be read from\r
+                          the device. If this is not NULL, the interrupt status will\r
+                          be read from the device. When the  interrupt status is read,\r
+                          it will also be cleared. Clearing the transmit  interrupt\r
+                          does not empty the recycled transmit buffer array.\r
+  @param  TxBuffer        Recycled transmit buffer address. The network interface will\r
+                          not transmit if its internal recycled transmit buffer array\r
+                          is full. Reading the transmit buffer does not clear the\r
+                          transmit interrupt. If this is NULL, then the transmit buffer\r
+                          status will not be read. If there are no transmit buffers to\r
+                          recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r
+\r
+  @retval EFI_SUCCESS           Always succeeds.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32GetStatus (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   OUT UINT32                     *InterruptStatus,\r
@@ -418,25 +875,36 @@ SnpNt32GetStatus (
 \r
 \r
 /**\r
-  Transmit a packet.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  HeaderSize            The media header size contained in the packet\r
-                                buffer.\r
-  @param  BufferSize            The size of the packet buffer.\r
-  @param  Buffer                Pointer to the buffer containing the packet data.\r
-  @param  SrcAddr               If non null, points to the source address of this\r
-                                packet.\r
-  @param  DestAddr              If non null, points to the destination address of\r
-                                this packet.\r
-  @param  Protocol              The protocol type of this packet.\r
-\r
-  @retval EFI_SUCCESS           The packet is transmitted or put into the transmit\r
-                                queue.\r
-  @retval other                 Some error occurs.\r
+  Places a packet in the transmit queue of a network interface.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  HeaderSize The size, in bytes, of the media header to be filled in by\r
+                     the Transmit() function. If HeaderSize is non-zero, then it\r
+                     must be equal to This->Mode->MediaHeaderSize and the DestAddr\r
+                     and 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 zero,\r
+                     then the media header in Buffer must already be filled in by the\r
+                     caller. If HeaderSize is non-zero, then the media header will be\r
+                     filled in by the Transmit() function.\r
+  @param  SrcAddr    The source HW MAC address. If HeaderSize is zero, then this parameter\r
+                     is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r
+                     This->Mode->CurrentAddress is used for the source HW MAC address.\r
+  @param  DestAddr   The destination HW MAC address. If HeaderSize is zero, then this\r
+                     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", for\r
+                     examples.\r
+\r
+  @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_ACCESS_DENIED     Error acquire global lock for operation.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Transmit (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   IN UINTN                       HeaderSize,\r
@@ -482,30 +950,38 @@ SnpNt32Transmit (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Receive network data.\r
-\r
-  @param  This                  Context pointer.\r
-  @param  HeaderSize            Optional parameter and is a pointer to the header\r
-                                portion of the data received.\r
-  @param  BuffSize              Pointer to the length of the Buffer on entry and\r
-                                contains the length of the received data on return\r
-  @param  Buffer                Pointer to the memory for the received data\r
-  @param  SourceAddr            Optional parameter, is a pointer to contain the\r
-                                source ethernet address on return\r
-  @param  DestinationAddr       Optional parameter, is a pointer to contain the\r
-                                destination ethernet address on return.\r
-  @param  Protocol              Optional parameter, is a pointer to contain the\r
-                                Protocol type from the ethernet header on return.\r
-\r
-  @retval EFI_SUCCESS           A packet is received and put into the buffer.\r
-  @retval EFI_BUFFER_TOO_SMALL  The provided buffer is too small to receive the\r
-                                packet.\r
-  @retval EFI_NOT_READY         There is no packet received.\r
+  Receives a packet from a network interface.\r
+\r
+  @param  This             Protocol instance pointer.\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  BuffSize         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 header and\r
+                           the data.\r
+  @param  SourceAddr       The source HW MAC address. If this parameter is NULL, the\r
+                           HW MAC source address will not be extracted from the media\r
+                           header.\r
+  @param  DestinationAddr  The destination HW MAC address. If this parameter is NULL,\r
+                           the HW MAC destination address will not be extracted from the\r
+                           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 BufferSize has\r
+                                 been updated to the number of bytes received.\r
+  @retval  EFI_NOT_READY         The network interface is too busy to accept this transmit\r
+                                 request.\r
+  @retval  EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval  EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval  EFI_ACCESS_DENIED     Error acquire global lock for operation.\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 SnpNt32Receive (\r
   IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
   OUT UINTN                      *HeaderSize,\r
@@ -569,68 +1045,6 @@ SnpNt32Receive (
   return EFI_SUCCESS;\r
 }\r
 \r
-SNPNT32_INSTANCE_DATA gSnpNt32InstanceTemplate = {\r
-  SNP_NT32_INSTANCE_SIGNATURE,            //  Signature\r
-  {\r
-    NULL,\r
-    NULL\r
-  },                                      //  Entry\r
-  NULL,                                   //  GlobalData\r
-  NULL,                                   //  DeviceHandle\r
-  NULL,                                   //  DevicePath\r
-  {                                       //  Snp\r
-    EFI_SIMPLE_NETWORK_PROTOCOL_REVISION, //  Revision\r
-    SnpNt32Start,                         //  Start\r
-    SnpNt32Stop,                          //  Stop\r
-    SnpNt32Initialize,                    //  Initialize\r
-    SnpNt32Reset,                         //  Reset\r
-    SnpNt32Shutdown,                      //  Shutdown\r
-    SnpNt32ReceiveFilters,                //  ReceiveFilters\r
-    SnpNt32StationAddress,                //  StationAddress\r
-    SnpNt32Statistics,                    //  Statistics\r
-    SnpNt32McastIptoMac,                  //  MCastIpToMac\r
-    SnpNt32Nvdata,                        //  NvData\r
-    SnpNt32GetStatus,                     //  GetStatus\r
-    SnpNt32Transmit,                      //  Transmit\r
-    SnpNt32Receive,                       //  Receive\r
-    NULL,                                 //  WaitForPacket\r
-    NULL                                  //  Mode\r
-  },\r
-  {                                       //  Mode\r
-    EfiSimpleNetworkInitialized,          //  State\r
-    NET_ETHER_ADDR_LEN,                   //  HwAddressSize\r
-    NET_ETHER_HEADER_SIZE,                //  MediaHeaderSize\r
-    1500,                                 //  MaxPacketSize\r
-    0,                                    //  NvRamSize\r
-    0,                                    //  NvRamAccessSize\r
-    0,                                    //  ReceiveFilterMask\r
-    0,                                    //  ReceiveFilterSetting\r
-    MAX_MCAST_FILTER_CNT,                 //  MaxMCastFilterCount\r
-    0,                                    //  MCastFilterCount\r
-    {\r
-      0\r
-    },                                    //  MCastFilter\r
-    {\r
-      0\r
-    },                                    //  CurrentAddress\r
-    {\r
-      0\r
-    },                                    //  BroadcastAddress\r
-    {\r
-      0\r
-    },                                    //  PermanentAddress\r
-    NET_IFTYPE_ETHERNET,                  //  IfType\r
-    FALSE,                                //  MacAddressChangeable\r
-    FALSE,                                //  MultipleTxSupported\r
-    FALSE,                                //  MediaPresentSupported\r
-    TRUE                                  //  MediaPresent\r
-  },\r
-  {\r
-    0\r
-  }                                       //  InterfaceInfo\r
-};\r
-\r
-\r
 /**\r
   Initialize the driver's global data.\r
 \r
@@ -638,11 +1052,14 @@ SNPNT32_INSTANCE_DATA gSnpNt32InstanceTemplate = {
 \r
   @retval EFI_SUCCESS           The global data is initialized.\r
   @retval EFI_NOT_FOUND         The required DLL is not found.\r
+  @retval EFI_DEVICE_ERROR      Error initialize network utility library.\r
+  @retval EFI_OUT_OF_RESOURCES  Out of resource.\r
+  @retval other                 Other errors.\r
 \r
 **/\r
 EFI_STATUS\r
 SnpNt32InitializeGlobalData (\r
-  IN SNPNT32_GLOBAL_DATA *This\r
+  IN OUT SNPNT32_GLOBAL_DATA *This\r
   )\r
 {\r
   EFI_STATUS            Status;\r
@@ -686,9 +1103,9 @@ SnpNt32InitializeGlobalData (
   }\r
 \r
   This->NtNetUtilityTable.Initialize = (NT_NET_INITIALIZE) This->WinNtThunk->GetProcAddress (\r
-                                                                              This->NetworkLibraryHandle,\r
-                                                                              NETWORK_LIBRARY_INITIALIZE\r
-                                                                              );\r
+                                                                               This->NetworkLibraryHandle,\r
+                                                                               NETWORK_LIBRARY_INITIALIZE\r
+                                                                               );\r
 \r
   if (NULL == This->NtNetUtilityTable.Initialize) {\r
     Status = EFI_NOT_FOUND;\r
@@ -696,9 +1113,9 @@ SnpNt32InitializeGlobalData (
   }\r
 \r
   This->NtNetUtilityTable.Finalize = (NT_NET_FINALIZE) This->WinNtThunk->GetProcAddress (\r
-                                                                          This->NetworkLibraryHandle,\r
-                                                                          NETWORK_LIBRARY_FINALIZE\r
-                                                                          );\r
+                                                                           This->NetworkLibraryHandle,\r
+                                                                           NETWORK_LIBRARY_FINALIZE\r
+                                                                           );\r
 \r
   if (NULL == This->NtNetUtilityTable.Finalize) {\r
     Status = EFI_NOT_FOUND;\r
@@ -706,9 +1123,9 @@ SnpNt32InitializeGlobalData (
   }\r
 \r
   This->NtNetUtilityTable.SetReceiveFilter = (NT_NET_SET_RECEIVE_FILTER) This->WinNtThunk->GetProcAddress (\r
-                                                                                            This->NetworkLibraryHandle,\r
-                                                                                            NETWORK_LIBRARY_SET_RCV_FILTER\r
-                                                                                            );\r
+                                                                                             This->NetworkLibraryHandle,\r
+                                                                                             NETWORK_LIBRARY_SET_RCV_FILTER\r
+                                                                                             );\r
 \r
   if (NULL == This->NtNetUtilityTable.SetReceiveFilter) {\r
     Status = EFI_NOT_FOUND;\r
@@ -716,9 +1133,9 @@ SnpNt32InitializeGlobalData (
   }\r
 \r
   This->NtNetUtilityTable.Receive = (NT_NET_RECEIVE) This->WinNtThunk->GetProcAddress (\r
-                                                                        This->NetworkLibraryHandle,\r
-                                                                        NETWORK_LIBRARY_RECEIVE\r
-                                                                        );\r
+                                                                         This->NetworkLibraryHandle,\r
+                                                                         NETWORK_LIBRARY_RECEIVE\r
+                                                                         );\r
 \r
   if (NULL == This->NtNetUtilityTable.Receive) {\r
     Status = EFI_NOT_FOUND;\r
@@ -726,9 +1143,9 @@ SnpNt32InitializeGlobalData (
   }\r
 \r
   This->NtNetUtilityTable.Transmit = (NT_NET_TRANSMIT) This->WinNtThunk->GetProcAddress (\r
-                                                                          This->NetworkLibraryHandle,\r
-                                                                          NETWORK_LIBRARY_TRANSMIT\r
-                                                                          );\r
+                                                                           This->NetworkLibraryHandle,\r
+                                                                           NETWORK_LIBRARY_TRANSMIT\r
+                                                                           );\r
 \r
   if (NULL == This->NtNetUtilityTable.Transmit) {\r
     Status = EFI_NOT_FOUND;\r
@@ -822,12 +1239,13 @@ ErrorReturn:
   @param  Instance              Pointer to the instance context data.\r
 \r
   @retval EFI_SUCCESS           The driver instance is initialized.\r
+  @retval other                 Initialization errors.\r
 \r
 **/\r
 EFI_STATUS\r
 SnpNt32InitializeInstanceData (\r
-  IN SNPNT32_GLOBAL_DATA    *This,\r
-  IN SNPNT32_INSTANCE_DATA  *Instance\r
+  IN SNPNT32_GLOBAL_DATA        *This,\r
+  IN OUT SNPNT32_INSTANCE_DATA  *Instance\r
   )\r
 {\r
   EFI_STATUS    Status;\r
@@ -874,9 +1292,9 @@ SnpNt32InitializeInstanceData (
   SetDevicePathEndNode (&EndNode.DevPath);\r
 \r
   Instance->DevicePath = AppendDevicePathNode (\r
-                          &EndNode.DevPath,\r
-                          &Node.DevPath\r
-                          );\r
+                           &EndNode.DevPath,\r
+                           &Node.DevPath\r
+                           );\r
 \r
   //\r
   //  Create a fake device handle for the fake SNP\r
@@ -889,13 +1307,6 @@ SnpNt32InitializeInstanceData (
                   Instance->DevicePath,\r
                   NULL\r
                   );\r
-  if (EFI_ERROR (Status)) {\r
-    goto ErrorReturn;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-\r
-ErrorReturn:\r
   return Status;\r
 }\r
 \r
@@ -911,21 +1322,21 @@ ErrorReturn:
 **/\r
 EFI_STATUS\r
 SnpNt32CloseInstance (\r
-  IN SNPNT32_GLOBAL_DATA    *This,\r
-  IN SNPNT32_INSTANCE_DATA  *Instance\r
+  IN SNPNT32_GLOBAL_DATA        *This,\r
+  IN OUT SNPNT32_INSTANCE_DATA  *Instance\r
   )\r
 {\r
   ASSERT (This != NULL);\r
   ASSERT (Instance != NULL);\r
 \r
   gBS->UninstallMultipleProtocolInterfaces (\r
-        Instance->DeviceHandle,\r
-        &gEfiSimpleNetworkProtocolGuid,\r
-        &Instance->Snp,\r
-        &gEfiDevicePathProtocolGuid,\r
-        Instance->DevicePath,\r
-        NULL\r
-        );\r
+         Instance->DeviceHandle,\r
+         &gEfiSimpleNetworkProtocolGuid,\r
+         &Instance->Snp,\r
+         &gEfiDevicePathProtocolGuid,\r
+         Instance->DevicePath,\r
+         NULL\r
+         );\r
 \r
   if (Instance->DevicePath != NULL) {\r
     gBS->FreePool (Instance->DevicePath);\r
@@ -934,14 +1345,13 @@ SnpNt32CloseInstance (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  Unload the SnpNt32 driver.\r
+  Unloads an image.\r
 \r
-  @param  ImageHandle           The handle of the driver image.\r
+  @param  ImageHandle           Handle that identifies the image to be unloaded.\r
 \r
-  @retval EFI_SUCCESS           The driver is unloaded.\r
-  @retval other                 Some error occurs.\r
+  @retval EFI_SUCCESS           The image has been unloaded.\r
+  @return Exit code from the image's unload handler\r
 \r
 **/\r
 EFI_STATUS\r
@@ -986,30 +1396,23 @@ SnpNt32Unload (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  This is the declaration of an EFI image entry point. This entry point is\r
+  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
+  both device drivers and bus drivers.\r
+\r
+  @param  ImageHandle           The firmware allocated handle for the UEFI image.\r
+  @param  SystemTable           A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
 \r
+**/\r
 EFI_STATUS\r
 InitializeSnpNt32river (\r
   IN EFI_HANDLE        ImageHandle,\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Install DriverBinding Protocol for the Win NT Bus driver on the drivers\r
-  image handle.\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The handle of this image.\r
-  SystemTable - Pointer to the EFI system table.\r
-\r
-Returns:\r
-\r
-  EFI_SUCEESS -  The protocols are installed and the SnpNt32 is initialized.\r
-  other       -  Some error occurs.\r
-\r
---*/\r
 {\r
 \r
   EFI_STATUS  Status;\r
index 0c135621381b9a085f7115c36eaad65ff8c137fb..6e9dafd2b7177c0c47f0b0f6bf64bf1a51fb3d9a 100644 (file)
@@ -198,10 +198,27 @@ typedef struct _SNPNT32_INSTANCE_DATA {
   SNP_NT32_INSTANCE_SIGNATURE \\r
   )\r
 \r
-extern EFI_DRIVER_BINDING_PROTOCOL   gSnpNt32DriverBinding;\r
+extern EFI_DRIVER_BINDING_PROTOCOL    gSnpNt32DriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL    gSnpNt32DriverComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL   gSnpNt32DriverComponentName2;\r
 \r
+/**\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_UNSUPPORTED     This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SnpNt32DriverBindingSupported (\r
@@ -210,6 +227,22 @@ SnpNt32DriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL     * RemainingDevicePath OPTIONAL\r
   );\r
 \r
+/**\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
+  @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
+  @retval EFI_SUCCESS          Always succeeds.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SnpNt32DriverBindingStart (\r
@@ -218,6 +251,23 @@ SnpNt32DriverBindingStart (
   IN EFI_DEVICE_PATH_PROTOCOL     * RemainingDevicePath OPTIONAL\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       Always succeeds.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SnpNt32DriverBindingStop (\r
@@ -227,21 +277,52 @@ SnpNt32DriverBindingStop (
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
+/**\r
+  Initialize the driver's global data.\r
+\r
+  @param  This                  Pointer to the global context data.\r
+\r
+  @retval EFI_SUCCESS           The global data is initialized.\r
+  @retval EFI_NOT_FOUND         The required DLL is not found.\r
+  @retval EFI_DEVICE_ERROR      Error initialize network utility library.\r
+  @retval EFI_OUT_OF_RESOURCES  Out of resource.\r
+  @retval other                 Other errors.\r
+\r
+**/\r
 EFI_STATUS\r
 SnpNt32InitializeGlobalData (\r
-  IN SNPNT32_GLOBAL_DATA *This\r
+  IN OUT SNPNT32_GLOBAL_DATA *This\r
   );\r
 \r
+/**\r
+  Initialize the snpnt32 driver instance.\r
+\r
+  @param  This                  Pointer to the SnpNt32 global data.\r
+  @param  Instance              Pointer to the instance context data.\r
+\r
+  @retval EFI_SUCCESS           The driver instance is initialized.\r
+  @retval other                 Initialization errors.\r
+\r
+**/\r
 EFI_STATUS\r
 SnpNt32InitializeInstanceData (\r
-  IN SNPNT32_GLOBAL_DATA    *This,\r
-  IN SNPNT32_INSTANCE_DATA  *Instance\r
+  IN SNPNT32_GLOBAL_DATA        *This,\r
+  IN OUT SNPNT32_INSTANCE_DATA  *Instance\r
   );\r
 \r
+/**\r
+  Close the SnpNt32 driver instance.\r
+\r
+  @param  This                  Pointer to the SnpNt32 global data.\r
+  @param  Instance              Pointer to the instance context data.\r
+\r
+  @retval EFI_SUCCESS           The instance is closed.\r
+\r
+**/\r
 EFI_STATUS\r
 SnpNt32CloseInstance (\r
-  IN SNPNT32_GLOBAL_DATA    *This,\r
-  IN SNPNT32_INSTANCE_DATA  *Instance\r
+  IN SNPNT32_GLOBAL_DATA        *This,\r
+  IN OUT SNPNT32_INSTANCE_DATA  *Instance\r
   );\r
 \r
 #endif\r