]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/SnpNt32Dxe/SnpNt32.h
IntelFrameworkModulePkg: Refine casting expression result to bigger size
[mirror_edk2.git] / Nt32Pkg / SnpNt32Dxe / SnpNt32.h
index 7769bbf295aaf76a9ea1730ece00009241811164..cb95c5711c228d3f8c61642d33baf729025fd329 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+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
@@ -20,7 +20,7 @@ Abstract:
 #ifndef _SNP_NT32_H_\r
 #define _SNP_NT32_H_\r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/SimpleNetwork.h>\r
 #include <Protocol/DevicePath.h>\r
@@ -58,6 +58,12 @@ typedef struct _NT_NET_INTERFACE_INFO {
 #define MAX_INTERFACE_INFO_NUMBER 16\r
 #define MAX_FILE_NAME_LENGTH      280\r
 \r
+#define SNP_MAX_TX_BUFFER_NUM         65536\r
+#define SNP_TX_BUFFER_INCREASEMENT    32\r
+\r
+\r
+\r
+\r
 //\r
 //  Functions in Net Library\r
 //\r
@@ -137,9 +143,9 @@ EFI_STATUS
 //\r
 //  Global data for this driver\r
 //\r
-#define SNP_NT32_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('W', 'S', 'N', 'P')\r
+#define SNP_NT32_DRIVER_SIGNATURE SIGNATURE_32 ('W', 'S', 'N', 'P')\r
 \r
-typedef struct _SNPNT32_GLOBAL_DATA {\r
+struct _SNPNT32_GLOBAL_DATA {\r
   UINT32                            Signature;\r
 \r
   //\r
@@ -154,20 +160,34 @@ typedef struct _SNPNT32_GLOBAL_DATA {
 \r
   EFI_LOCK                          Lock;\r
 \r
+  //\r
+  // Array of the recycled transmit buffer address.\r
+  //\r
+  UINT64                            *RecycledTxBuf;\r
+\r
+  //\r
+  // Current number of recycled buffer pointers in RecycledTxBuf.\r
+  //\r
+  UINT32                             RecycledTxBufCount;\r
+\r
+  // The maximum number of recycled buffer pointers in RecycledTxBuf.\r
+  //\r
+  UINT32                             MaxRecycledTxBuf;\r
+\r
   //\r
   //  Private functions\r
   //\r
   SNPNT32_INITIALIZE_GLOBAL_DATA    InitializeGlobalData;\r
   SNPNT32_INITIALIZE_INSTANCE_DATA  InitializeInstanceData;\r
   SNPNT32_CLOSE_INSTANCE            CloseInstance;\r
-} SNPNT32_GLOBAL_DATA;\r
+};\r
 \r
 //\r
 //  Instance data for each fake SNP instance\r
 //\r
-#define SNP_NT32_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('w', 'S', 'N', 'P')\r
+#define SNP_NT32_INSTANCE_SIGNATURE SIGNATURE_32 ('w', 'S', 'N', 'P')\r
 \r
-typedef struct _SNPNT32_INSTANCE_DATA {\r
+struct _SNPNT32_INSTANCE_DATA {\r
   UINT32                      Signature;\r
 \r
   //\r
@@ -188,7 +208,7 @@ typedef struct _SNPNT32_INSTANCE_DATA {
   //\r
   //  Private functions\r
   //\r
-} SNPNT32_INSTANCE_DATA;\r
+};\r
 \r
 #define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \\r
   CR ( \\r
@@ -198,10 +218,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 +247,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 +271,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 +297,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