]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiConfig.c
index 14e42e358ef51eafff1e517da907e2b815a0024c..86e41ba1a1814342270bc6ebec2d31fc353012f6 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  Helper functions for configuring or getting the parameters relating to ISCSI\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2008, 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
@@ -15,90 +16,71 @@ Module Name:
 \r
 Abstract:\r
 \r
---*/\r
+  Helper functions for configuring or getting the parameters relating to ISCSI\r
+\r
+**/\r
 \r
 #include "IScsiImpl.h"\r
 \r
-EFI_GUID        mVendorGuid             = ISCSI_CONFIG_GUID;\r
-BOOLEAN         mIScsiDeviceListUpdated = FALSE;\r
-UINTN           mNumberOfIScsiDevices   = 0;\r
-ISCSI_FORM_CALLBACK_INFO  *mCallbackInfo;\r
+EFI_GUID        mVendorGuid              = ISCSI_CONFIG_GUID;\r
+BOOLEAN         mIScsiDeviceListUpdated  = FALSE;\r
+UINTN           mNumberOfIScsiDevices    = 0;\r
+ISCSI_FORM_CALLBACK_INFO  *mCallbackInfo = NULL;\r
 \r
-NET_LIST_ENTRY  mIScsiConfigFormList = {\r
+LIST_ENTRY      mIScsiConfigFormList = {\r
   &mIScsiConfigFormList,\r
   &mIScsiConfigFormList\r
 };\r
 \r
-STATIC\r
-VOID\r
-IScsiIpToStr (\r
-  IN  EFI_IPv4_ADDRESS  *Ip,\r
-  OUT CHAR16            *Str\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Convert the IPv4 address into a dotted string.\r
 \r
-Arguments:\r
-\r
-  Ip  - The IPv4 address.\r
-  Str - The dotted IP string.\r
+  @param  Ip[in]   The IPv4 address.\r
 \r
-Returns:\r
+  @param  Str[out] The dotted IP string.\r
 \r
-  None.\r
+  @retval None.\r
 \r
---*/\r
+**/\r
+VOID\r
+IScsiIpToStr (\r
+  IN  EFI_IPv4_ADDRESS  *Ip,\r
+  OUT CHAR16            *Str\r
+  )\r
 {\r
   UnicodeSPrint ( Str, 2 * IP4_STR_MAX_SIZE, L"%d.%d.%d.%d", Ip->Addr[0], Ip->Addr[1], Ip->Addr[2], Ip->Addr[3]);\r
 }\r
 \r
-VOID\r
-PopUpInvalidNotify (\r
-  IN CHAR16 *Warning\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Pop up an invalid notify which displays the message in Warning.\r
 \r
-Arguments:\r
-\r
-  Warning - The warning message.\r
+  @param  Warning[in] The warning message.\r
 \r
-Returns:\r
+  @retval None.\r
 \r
-  None.\r
-\r
---*/\r
+**/\r
+VOID\r
+PopUpInvalidNotify (\r
+  IN CHAR16 *Warning\r
+  )\r
 {\r
   EFI_INPUT_KEY             Key;\r
 \r
   IfrLibCreatePopUp (1, &Key, Warning);\r
 }\r
 \r
-EFI_STATUS\r
-IScsiUpdateDeviceList (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Update the list of iSCSI devices the iSCSI driver is controlling.\r
 \r
-Arguments:\r
-\r
-  None.\r
+  @param  None.\r
 \r
-Returns:\r
+  @retval None.\r
 \r
-  None.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+IScsiUpdateDeviceList (\r
+  VOID\r
+  )\r
 {\r
   EFI_STATUS                  Status;\r
   ISCSI_DEVICE_LIST           *DeviceList;\r
@@ -138,7 +120,7 @@ Returns:
                   NULL\r
                   );\r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
-    DeviceList = (ISCSI_DEVICE_LIST *) NetAllocatePool (DataSize);\r
+    DeviceList = (ISCSI_DEVICE_LIST *) AllocatePool (DataSize);\r
 \r
     gRT->GetVariable (\r
           L"iSCSIDeviceList",\r
@@ -168,9 +150,9 @@ Returns:
             // Swap the current MAC address entry with the one indexed by\r
             // LastDeviceIndex.\r
             //\r
-            NetCopyMem (&TempMacInfo, CurMacInfo, sizeof (ISCSI_MAC_INFO));\r
-            NetCopyMem (CurMacInfo, &DeviceList->MacInfo[LastDeviceIndex], sizeof (ISCSI_MAC_INFO));\r
-            NetCopyMem (&DeviceList->MacInfo[LastDeviceIndex], &TempMacInfo, sizeof (ISCSI_MAC_INFO));\r
+            CopyMem (&TempMacInfo, CurMacInfo, sizeof (ISCSI_MAC_INFO));\r
+            CopyMem (CurMacInfo, &DeviceList->MacInfo[LastDeviceIndex], sizeof (ISCSI_MAC_INFO));\r
+            CopyMem (&DeviceList->MacInfo[LastDeviceIndex], &TempMacInfo, sizeof (ISCSI_MAC_INFO));\r
           }\r
 \r
           LastDeviceIndex++;\r
@@ -192,16 +174,16 @@ Returns:
       gRT->SetVariable (MacString, &mIScsiCHAPAuthInfoGuid, 0, 0, NULL);\r
     }\r
 \r
-    NetFreePool (DeviceList);\r
+    gBS->FreePool (DeviceList);\r
   } else if (Status != EFI_NOT_FOUND) {\r
-    NetFreePool (Handles);\r
+    gBS->FreePool (Handles);\r
     return Status;\r
   }\r
   //\r
   // Construct the new iSCSI device list.\r
   //\r
   DeviceListSize        = sizeof (ISCSI_DEVICE_LIST) + (NumHandles - 1) * sizeof (ISCSI_MAC_INFO);\r
-  DeviceList            = (ISCSI_DEVICE_LIST *) NetAllocatePool (DeviceListSize);\r
+  DeviceList            = (ISCSI_DEVICE_LIST *) AllocatePool (DeviceListSize);\r
   DeviceList->NumDevice = (UINT8) NumHandles;\r
 \r
   for (Index = 0; Index < NumHandles; Index++) {\r
@@ -209,7 +191,7 @@ Returns:
     Mode        = Snp->Mode;\r
 \r
     CurMacInfo  = &DeviceList->MacInfo[Index];\r
-    NetCopyMem (&CurMacInfo->Mac, &Mode->PermanentAddress, Mode->HwAddressSize);\r
+    CopyMem (&CurMacInfo->Mac, &Mode->PermanentAddress, Mode->HwAddressSize);\r
     CurMacInfo->Len = (UINT8) Mode->HwAddressSize;\r
   }\r
 \r
@@ -221,34 +203,27 @@ Returns:
         DeviceList\r
         );\r
 \r
-  NetFreePool (DeviceList);\r
+  gBS->FreePool (DeviceList);\r
+  gBS->FreePool (Handles);\r
 \r
   return Status;\r
 }\r
 \r
-STATIC\r
-ISCSI_CONFIG_FORM_ENTRY *\r
-IScsiGetConfigFormEntryByIndex (\r
-  IN UINT32 Index\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Get the iSCSI configuration form entry by the index of the goto opcode actived.\r
 \r
-Arguments:\r
-\r
-  Index - The 0-based index of the goto opcode actived.\r
-\r
-Returns:\r
+  @param  Index[in] The 0-based index of the goto opcode actived.\r
 \r
-  The iSCSI configuration form entry found.\r
+  @retval The iSCSI configuration form entry found.\r
 \r
---*/\r
+**/\r
+ISCSI_CONFIG_FORM_ENTRY *\r
+IScsiGetConfigFormEntryByIndex (\r
+  IN UINT32 Index\r
+  )\r
 {\r
   UINT32                  CurrentIndex;\r
-  NET_LIST_ENTRY          *Entry;\r
+  LIST_ENTRY              *Entry;\r
   ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;\r
 \r
   CurrentIndex    = 0;\r
@@ -266,28 +241,21 @@ Returns:
   return ConfigFormEntry;\r
 }\r
 \r
-STATIC\r
-VOID\r
-IScsiConvertDeviceConfigDataToIfrNvData (\r
-  IN ISCSI_CONFIG_FORM_ENTRY  *ConfigFormEntry,\r
-  IN ISCSI_CONFIG_IFR_NVDATA  *IfrNvData\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Convert the iSCSI configuration data into the IFR data.\r
 \r
-Arguments:\r
-\r
-  ConfigFormEntry - The iSCSI configuration form entry.\r
-  IfrNvData       - The IFR nv data.\r
+  @param  ConfigFormEntry[in] The iSCSI configuration form entry.\r
 \r
-Returns:\r
+  @param  IfrNvData[in]       The IFR nv data.\r
 \r
-  None.\r
+  @retval None.\r
 \r
---*/\r
+**/\r
+VOID\r
+IScsiConvertDeviceConfigDataToIfrNvData (\r
+  IN ISCSI_CONFIG_FORM_ENTRY  *ConfigFormEntry,\r
+  IN ISCSI_CONFIG_IFR_NVDATA  *IfrNvData\r
+  )\r
 {\r
   ISCSI_SESSION_CONFIG_NVDATA   *SessionConfigData;\r
   ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfigData;\r
@@ -324,7 +292,33 @@ Returns:
   IScsiAsciiStrToUnicodeStr (AuthConfigData->ReverseCHAPSecret, IfrNvData->ReverseCHAPSecret);\r
 }\r
 \r
+/**\r
+  This function allows a caller to extract the current configuration for one\r
+  or more named elements from the target driver.\r
+\r
+  @param  This[in]              Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+\r
+  @param  Request[in]           A null-terminated Unicode string in <ConfigRequest> format.\r
+\r
+  @param  Progress[out]         On return, points to a character in the Request string.\r
+                                Points to the string's null terminator if request was successful.\r
+                                Points to the most recent '&' before the first failing name/value\r
+                                pair (or the beginning of the string if the failure is in the\r
+                                first name/value pair) if the request was not successful.\r
 \r
+  @param  Results[out]          A null-terminated Unicode string in <ConfigAltResp> format which\r
+                                has all values filled in for the names in the Request string.\r
+                                String to be allocated by the called function.\r
+\r
+  @retval EFI_SUCCESS           The Results is filled with the requested values.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough memory to store the results.\r
+\r
+  @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+\r
+  @retval EFI_NOT_FOUND         Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiFormExtractConfig (\r
@@ -333,31 +327,6 @@ IScsiFormExtractConfig (
   OUT EFI_STRING                             *Progress,\r
   OUT EFI_STRING                             *Results\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function allows a caller to extract the current configuration for one\r
-    or more named elements from the target driver.\r
-\r
-  Arguments:\r
-    This       - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Request    - A null-terminated Unicode string in <ConfigRequest> format.\r
-    Progress   - On return, points to a character in the Request string.\r
-                 Points to the string's null terminator if request was successful.\r
-                 Points to the most recent '&' before the first failing name/value\r
-                 pair (or the beginning of the string if the failure is in the\r
-                 first name/value pair) if the request was not successful.\r
-    Results    - A null-terminated Unicode string in <ConfigAltResp> format which\r
-                 has all values filled in for the names in the Request string.\r
-                 String to be allocated by the called function.\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Results is filled with the requested values.\r
-    EFI_OUT_OF_RESOURCES  - Not enough memory to store the results.\r
-    EFI_INVALID_PARAMETER - Request is NULL, illegal syntax, or unknown name.\r
-    EFI_NOT_FOUND         - Routing data doesn't match any storage in this driver.\r
-\r
---*/\r
 {\r
   EFI_STATUS                       Status;\r
   CHAR8                            InitiatorName[ISCSI_NAME_IFR_MAX_SIZE];\r
@@ -366,6 +335,10 @@ IScsiFormExtractConfig (
   ISCSI_FORM_CALLBACK_INFO         *Private;\r
   EFI_HII_CONFIG_ROUTING_PROTOCOL  *HiiConfigRouting;\r
 \r
+  if (Request == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   if (!mIScsiDeviceListUpdated) {\r
     //\r
     // Update the device list.\r
@@ -402,10 +375,29 @@ IScsiFormExtractConfig (
                                Results,\r
                                Progress\r
                                );\r
-  NetFreePool (IfrNvData);\r
+  gBS->FreePool (IfrNvData);\r
   return Status;\r
 }\r
 \r
+/**\r
+  This function processes the results of changes in configuration.\r
+\r
+  @param  This[in]              Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+\r
+  @param  Configuration[in]     A null-terminated Unicode string in <ConfigResp> format.\r
+\r
+  @param  Progress[out]         A pointer to a string filled in with the offset of the most\r
+                                recent '&' before the first failing name/value pair (or the\r
+                                beginning of the string if the failure is in the first\r
+                                name/value pair) or the terminating NULL if all was successful.\r
+\r
+  @retval EFI_SUCCESS           The Results is processed successfully.\r
+\r
+  @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+\r
+  @retval EFI_NOT_FOUND         Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiFormRouteConfig (\r
@@ -413,29 +405,35 @@ IScsiFormRouteConfig (
   IN  CONST EFI_STRING                       Configuration,\r
   OUT EFI_STRING                             *Progress\r
   )\r
-/*++\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
 \r
-  Routine Description:\r
-    This function processes the results of changes in configuration.\r
+/**\r
+  This function processes the results of changes in configuration.\r
 \r
-  Arguments:\r
-    This          - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
-    Progress      - A pointer to a string filled in with the offset of the most\r
-                    recent '&' before the first failing name/value pair (or the\r
-                    beginning of the string if the failure is in the first\r
-                    name/value pair) or the terminating NULL if all was successful.\r
+  @param  This[in]             Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
 \r
-  Returns:\r
-    EFI_SUCCESS           - The Results is processed successfully.\r
-    EFI_INVALID_PARAMETER - Configuration is NULL.\r
-    EFI_NOT_FOUND         - Routing data doesn't match any storage in this driver.\r
+  @param  Action[in]           Specifies the type of action taken by the browser.\r
 \r
---*/\r
-{\r
-  return EFI_SUCCESS;\r
-}\r
+  @param  QuestionId[in]       A unique value which is sent to the original exporting driver\r
+                               so that it can identify the type of data to expect.\r
+\r
+  @param  Type[in]             The type of value for the question.\r
+\r
+  @param  Value[in]            A pointer to the data being sent to the original exporting driver.\r
+\r
+  @param  ActionRequest[out]   On return, points to the action requested by the callback function.\r
+\r
+  @retval EFI_SUCCESS          The callback successfully handled the action.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
 \r
+  @retval EFI_DEVICE_ERROR     The variable could not be saved.\r
+\r
+  @retval EFI_UNSUPPORTED      The specified Action is not supported by the callback.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiFormCallback (\r
@@ -446,27 +444,6 @@ IScsiFormCallback (
   IN  EFI_IFR_TYPE_VALUE                     *Value,\r
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    This function processes the results of changes in configuration.\r
-\r
-  Arguments:\r
-    This          - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
-    Action        - Specifies the type of action taken by the browser.\r
-    QuestionId    - A unique value which is sent to the original exporting driver\r
-                    so that it can identify the type of data to expect.\r
-    Type          - The type of value for the question.\r
-    Value         - A pointer to the data being sent to the original exporting driver.\r
-    ActionRequest - On return, points to the action requested by the callback function.\r
-\r
-  Returns:\r
-    EFI_SUCCESS          - The callback successfully handled the action.\r
-    EFI_OUT_OF_RESOURCES - Not enough storage is available to hold the variable and its data.\r
-    EFI_DEVICE_ERROR     - The variable could not be saved.\r
-    EFI_UNSUPPORTED      - The specified Action is not supported by the callback.\r
-\r
---*/\r
 {\r
   ISCSI_FORM_CALLBACK_INFO  *Private;\r
   UINTN                     BufferSize;\r
@@ -475,7 +452,7 @@ IScsiFormCallback (
   CHAR8                     Ip4String[IP4_STR_MAX_SIZE];\r
   CHAR8                     LunString[ISCSI_LUN_STR_MAX_LEN];\r
   UINT64                    Lun;\r
-  STRING_REF                DeviceFormTitleToken;\r
+  EFI_STRING_ID             DeviceFormTitleToken;\r
   ISCSI_CONFIG_IFR_NVDATA   *IfrNvData;\r
   ISCSI_CONFIG_FORM_ENTRY   *ConfigFormEntry;\r
   EFI_IP_ADDRESS            HostIp;\r
@@ -516,7 +493,7 @@ IScsiFormCallback (
       PopUpInvalidNotify (L"Invalid IP address!");\r
       Status = EFI_INVALID_PARAMETER;\r
     } else {\r
-      NetCopyMem (&Private->Current->SessionConfigData.LocalIp, &HostIp.v4, sizeof (HostIp.v4));\r
+      CopyMem (&Private->Current->SessionConfigData.LocalIp, &HostIp.v4, sizeof (HostIp.v4));\r
     }\r
 \r
     break;\r
@@ -528,7 +505,7 @@ IScsiFormCallback (
       PopUpInvalidNotify (L"Invalid Subnet Mask!");\r
       Status = EFI_INVALID_PARAMETER;\r
     } else {\r
-      NetCopyMem (&Private->Current->SessionConfigData.SubnetMask, &SubnetMask.v4, sizeof (SubnetMask.v4));\r
+      CopyMem (&Private->Current->SessionConfigData.SubnetMask, &SubnetMask.v4, sizeof (SubnetMask.v4));\r
     }\r
 \r
     break;\r
@@ -540,7 +517,7 @@ IScsiFormCallback (
       PopUpInvalidNotify (L"Invalid Gateway!");\r
       Status = EFI_INVALID_PARAMETER;\r
     } else {\r
-      NetCopyMem (&Private->Current->SessionConfigData.Gateway, &Gateway.v4, sizeof (Gateway.v4));\r
+      CopyMem (&Private->Current->SessionConfigData.Gateway, &Gateway.v4, sizeof (Gateway.v4));\r
     }\r
 \r
     break;\r
@@ -552,7 +529,7 @@ IScsiFormCallback (
       PopUpInvalidNotify (L"Invalid IP address!");\r
       Status = EFI_INVALID_PARAMETER;\r
     } else {\r
-      NetCopyMem (&Private->Current->SessionConfigData.TargetIp, &HostIp.v4, sizeof (HostIp.v4));\r
+      CopyMem (&Private->Current->SessionConfigData.TargetIp, &HostIp.v4, sizeof (HostIp.v4));\r
     }\r
 \r
     break;\r
@@ -581,7 +558,7 @@ IScsiFormCallback (
     if (EFI_ERROR (Status)) {\r
       PopUpInvalidNotify (L"Invalid LUN string!");\r
     } else {\r
-      NetCopyMem (Private->Current->SessionConfigData.BootLun, &Lun, sizeof (Lun));\r
+      CopyMem (Private->Current->SessionConfigData.BootLun, &Lun, sizeof (Lun));\r
     }\r
 \r
     break;\r
@@ -625,9 +602,9 @@ IScsiFormCallback (
       // deployed.\r
       //\r
       if (!Private->Current->SessionConfigData.InitiatorInfoFromDhcp) {\r
-        NetCopyMem (&HostIp.v4, &Private->Current->SessionConfigData.LocalIp, sizeof (HostIp.v4));\r
-        NetCopyMem (&SubnetMask.v4, &Private->Current->SessionConfigData.SubnetMask, sizeof (SubnetMask.v4));\r
-        NetCopyMem (&Gateway.v4, &Private->Current->SessionConfigData.Gateway, sizeof (Gateway.v4));\r
+        CopyMem (&HostIp.v4, &Private->Current->SessionConfigData.LocalIp, sizeof (HostIp.v4));\r
+        CopyMem (&SubnetMask.v4, &Private->Current->SessionConfigData.SubnetMask, sizeof (SubnetMask.v4));\r
+        CopyMem (&Gateway.v4, &Private->Current->SessionConfigData.Gateway, sizeof (Gateway.v4));\r
 \r
         if ((Gateway.Addr[0] != 0)) {\r
           if (SubnetMask.Addr[0] == 0) {\r
@@ -645,7 +622,7 @@ IScsiFormCallback (
       // Validate target configuration if DHCP isn't deployed.\r
       //\r
       if (!Private->Current->SessionConfigData.TargetInfoFromDhcp) {\r
-        NetCopyMem (&HostIp.v4, &Private->Current->SessionConfigData.TargetIp, sizeof (HostIp.v4));\r
+        CopyMem (&HostIp.v4, &Private->Current->SessionConfigData.TargetIp, sizeof (HostIp.v4));\r
         if (!Ip4IsUnicast (NTOHL (HostIp.Addr[0]), 0)) {\r
           PopUpInvalidNotify (L"Target IP is invalid!");\r
           Status = EFI_INVALID_PARAMETER;\r
@@ -699,8 +676,8 @@ IScsiFormCallback (
       ASSERT (ConfigFormEntry != NULL);\r
 \r
       UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);\r
-      DeviceFormTitleToken = (STRING_REF) STR_ISCSI_DEVICE_FORM_TITLE;\r
-      IfrLibSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString);\r
+      DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;\r
+      HiiLibSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString);\r
 \r
       IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);\r
 \r
@@ -718,38 +695,33 @@ IScsiFormCallback (
     Status = SetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);\r
   }\r
 \r
-  NetFreePool (IfrNvData);\r
+  gBS->FreePool (IfrNvData);\r
   return Status;\r
 }\r
 \r
-\r
-EFI_STATUS\r
-IScsiConfigUpdateForm (\r
-  IN EFI_HANDLE  DriverBindingHandle,\r
-  IN EFI_HANDLE  Controller,\r
-  IN BOOLEAN     AddForm\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Updates the iSCSI configuration form to add/delete an entry for the iSCSI\r
   device specified by the Controller.\r
 \r
-Arguments:\r
+  @param  DriverBindingHandle[in] The driverbinding handle.\r
+\r
+  @param  Controller[in]          The controller handle of the iSCSI device.\r
 \r
-  DriverBindingHandle - The driverbinding handle.\r
-  Controller          - The controller handle of the iSCSI device.\r
-  AddForm             - Whether to add or delete a form entry.\r
+  @param  AddForm[in]             Whether to add or delete a form entry.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS             The iSCSI configuration form is updated.\r
 \r
-  EFI_SUCCESS          - The iSCSI configuration form is updated.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+IScsiConfigUpdateForm (\r
+  IN EFI_HANDLE  DriverBindingHandle,\r
+  IN EFI_HANDLE  Controller,\r
+  IN BOOLEAN     AddForm\r
+  )\r
 {\r
-  NET_LIST_ENTRY              *Entry;\r
+  LIST_ENTRY                  *Entry;\r
   ISCSI_CONFIG_FORM_ENTRY     *ConfigFormEntry;\r
   BOOLEAN                     EntryExisted;\r
   EFI_STATUS                  Status;\r
@@ -779,12 +751,12 @@ Returns:
       //\r
       // Add a new form.\r
       //\r
-      ConfigFormEntry = (ISCSI_CONFIG_FORM_ENTRY *) NetAllocateZeroPool (sizeof (ISCSI_CONFIG_FORM_ENTRY));\r
+      ConfigFormEntry = (ISCSI_CONFIG_FORM_ENTRY *) AllocateZeroPool (sizeof (ISCSI_CONFIG_FORM_ENTRY));\r
       if (ConfigFormEntry == NULL) {\r
         return EFI_OUT_OF_RESOURCES;\r
       }\r
 \r
-      NetListInit (&ConfigFormEntry->Link);\r
+      InitializeListHead (&ConfigFormEntry->Link);\r
       ConfigFormEntry->Controller = Controller;\r
 \r
       //\r
@@ -812,7 +784,7 @@ Returns:
                       &ConfigFormEntry->SessionConfigData\r
                       );\r
       if (EFI_ERROR (Status)) {\r
-        NetZeroMem (&ConfigFormEntry->SessionConfigData, sizeof (ConfigFormEntry->SessionConfigData));\r
+        ZeroMem (&ConfigFormEntry->SessionConfigData, sizeof (ConfigFormEntry->SessionConfigData));\r
       }\r
       //\r
       // Get the CHAP authentication configuration data.\r
@@ -826,35 +798,35 @@ Returns:
                       &ConfigFormEntry->AuthConfigData\r
                       );\r
       if (EFI_ERROR (Status)) {\r
-        NetZeroMem (&ConfigFormEntry->AuthConfigData, sizeof (ConfigFormEntry->AuthConfigData));\r
+        ZeroMem (&ConfigFormEntry->AuthConfigData, sizeof (ConfigFormEntry->AuthConfigData));\r
       }\r
       //\r
-      // Compose the Port string and create a new STRING_REF.\r
+      // Compose the Port string and create a new EFI_STRING_ID.\r
       //\r
       UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);\r
-      IfrLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleToken, PortString);\r
+      HiiLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleToken, PortString);\r
 \r
       //\r
-      // Compose the help string of this port and create a new STRING_REF.\r
+      // Compose the help string of this port and create a new EFI_STRING_ID.\r
       //\r
       UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);\r
-      IfrLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleHelpToken, PortString);\r
+      HiiLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleHelpToken, PortString);\r
 \r
-      NetListInsertTail (&mIScsiConfigFormList, &ConfigFormEntry->Link);\r
+      InsertTailList (&mIScsiConfigFormList, &ConfigFormEntry->Link);\r
       mNumberOfIScsiDevices++;\r
     }\r
   } else {\r
     ASSERT (EntryExisted);\r
 \r
     mNumberOfIScsiDevices--;\r
-    NetListRemoveEntry (&ConfigFormEntry->Link);\r
-    NetFreePool (ConfigFormEntry);\r
+    RemoveEntryList (&ConfigFormEntry->Link);\r
+    gBS->FreePool (ConfigFormEntry);\r
   }\r
   //\r
   // Allocate space for creation of Buffer\r
   //\r
   UpdateData.BufferSize = 0x1000;\r
-  UpdateData.Data = NetAllocateZeroPool (0x1000);\r
+  UpdateData.Data = AllocateZeroPool (0x1000);\r
   UpdateData.Offset = 0;\r
 \r
   FormIndex = 0;\r
@@ -882,31 +854,25 @@ Returns:
     &UpdateData\r
     );\r
 \r
-  NetFreePool (UpdateData.Data);\r
+  gBS->FreePool (UpdateData.Data);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-IScsiConfigFormInit (\r
-  IN EFI_HANDLE  DriverBindingHandle\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Initialize the iSCSI configuration form.\r
 \r
-Arguments:\r
+  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.\r
 \r
-  DriverBindingHandle - The iSCSI driverbinding handle.\r
+  @retval EFI_SUCCESS             The iSCSI configuration form is initialized.\r
 \r
-Returns:\r
+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
 \r
-  EFI_SUCCESS          - The iSCSI configuration form is initialized.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+IScsiConfigFormInit (\r
+  IN EFI_HANDLE  DriverBindingHandle\r
+  )\r
 {\r
   EFI_STATUS                  Status;\r
   EFI_HII_DATABASE_PROTOCOL   *HiiDatabase;\r
@@ -918,14 +884,14 @@ Returns:
     return Status;\r
   }\r
 \r
-  CallbackInfo = (ISCSI_FORM_CALLBACK_INFO *) NetAllocatePool (sizeof (ISCSI_FORM_CALLBACK_INFO));\r
+  CallbackInfo = (ISCSI_FORM_CALLBACK_INFO *) AllocatePool (sizeof (ISCSI_FORM_CALLBACK_INFO));\r
   if (CallbackInfo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  CallbackInfo->Signature             = ISCSI_FORM_CALLBACK_INFO_SIGNATURE;\r
+  CallbackInfo->Signature   = ISCSI_FORM_CALLBACK_INFO_SIGNATURE;\r
   CallbackInfo->HiiDatabase = HiiDatabase;\r
-  CallbackInfo->Current               = NULL;\r
+  CallbackInfo->Current     = NULL;\r
 \r
   CallbackInfo->ConfigAccess.ExtractConfig = IScsiFormExtractConfig;\r
   CallbackInfo->ConfigAccess.RouteConfig = IScsiFormRouteConfig;\r
@@ -933,6 +899,7 @@ Returns:
 \r
   Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&CallbackInfo->ConfigRouting);\r
   if (EFI_ERROR (Status)) {\r
+    FreePool(CallbackInfo);\r
     return Status;\r
   }\r
 \r
@@ -941,6 +908,7 @@ Returns:
   //\r
   Status = HiiLibCreateHiiDriverHandle (&CallbackInfo->DriverHandle);\r
   if (EFI_ERROR (Status)) {\r
+    FreePool(CallbackInfo);\r
     return Status;\r
   }\r
   \r
@@ -958,7 +926,7 @@ Returns:
   //\r
   // Publish our HII data\r
   //\r
-  PackageList = PreparePackageList (2, &mVendorGuid, IScsiDxeStrings, IScsiConfigDxeBin);\r
+  PackageList = HiiLibPreparePackageList (2, &mVendorGuid, IScsiDxeStrings, IScsiConfigDxeBin);\r
   ASSERT (PackageList != NULL);\r
   \r
   Status = HiiDatabase->NewPackageList (\r
@@ -967,8 +935,9 @@ Returns:
                            CallbackInfo->DriverHandle,\r
                            &CallbackInfo->RegisteredHandle\r
                            );\r
-  NetFreePool (PackageList);\r
+  FreePool (PackageList);\r
   if (EFI_ERROR (Status)) {\r
+    FreePool(CallbackInfo);\r
     return Status;\r
   }\r
 \r
@@ -977,32 +946,26 @@ Returns:
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-IScsiConfigFormUnload (\r
-  IN EFI_HANDLE  DriverBindingHandle\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Unload the iSCSI configuration form, this includes: delete all the iSCSI\r
   device configuration entries, uninstall the form callback protocol and\r
   free the resources used.\r
 \r
-Arguments:\r
-\r
-  DriverBindingHandle - The iSCSI driverbinding handle.\r
+  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS             The iSCSI configuration form is unloaded.\r
 \r
-  EFI_SUCCESS          - The iSCSI configuration form is unloaded.\r
-  EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+IScsiConfigFormUnload (\r
+  IN EFI_HANDLE  DriverBindingHandle\r
+  )\r
 {\r
   ISCSI_CONFIG_FORM_ENTRY     *ConfigFormEntry;\r
 \r
-  while (!NetListIsEmpty (&mIScsiConfigFormList)) {\r
+  while (!IsListEmpty (&mIScsiConfigFormList)) {\r
     //\r
     // Uninstall the device forms as the iSCSI driver instance may fail to\r
     // control the controller but still install the device configuration form.\r
@@ -1032,7 +995,7 @@ Returns:
         );\r
   HiiLibDestroyHiiDriverHandle (mCallbackInfo->DriverHandle);\r
 \r
-  NetFreePool (mCallbackInfo);\r
+  gBS->FreePool (mCallbackInfo);\r
 \r
   return EFI_SUCCESS;\r
 }\r