]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
update file header
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiConfig.c
index 86e41ba1a1814342270bc6ebec2d31fc353012f6..b0976731668cfd4bd8a3fb67fd2e9e14f4da7708 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Helper functions for configuring or getting the parameters relating to ISCSI\r
+  Helper functions for configuring or getting the parameters relating to ISCSI.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -10,14 +10,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  IScsiConfig.c\r
-\r
-Abstract:\r
-\r
-  Helper functions for configuring or getting the parameters relating to ISCSI\r
-\r
 **/\r
 \r
 #include "IScsiImpl.h"\r
@@ -35,12 +27,8 @@ LIST_ENTRY      mIScsiConfigFormList = {
 /**\r
   Convert the IPv4 address into a dotted string.\r
 \r
-  @param  Ip[in]   The IPv4 address.\r
-\r
-  @param  Str[out] The dotted IP string.\r
-\r
-  @retval None.\r
-\r
+  @param[in]   Ip   The IPv4 address.\r
+  @param[out]  Str  The dotted IP string.\r
 **/\r
 VOID\r
 IScsiIpToStr (\r
@@ -54,10 +42,7 @@ IScsiIpToStr (
 /**\r
   Pop up an invalid notify which displays the message in Warning.\r
 \r
-  @param  Warning[in] The warning message.\r
-\r
-  @retval None.\r
-\r
+  @param[in]  Warning  The warning message.\r
 **/\r
 VOID\r
 PopUpInvalidNotify (\r
@@ -71,11 +56,9 @@ PopUpInvalidNotify (
 \r
 /**\r
   Update the list of iSCSI devices the iSCSI driver is controlling.\r
-\r
-  @param  None.\r
-\r
-  @retval None.\r
-\r
+  \r
+  @retval EFI_SUCCESS            The callback successfully handled the action.\r
+  @retval Others                 Some unexpected errors happened.   \r
 **/\r
 EFI_STATUS\r
 IScsiUpdateDeviceList (\r
@@ -212,10 +195,9 @@ IScsiUpdateDeviceList (
 /**\r
   Get the iSCSI configuration form entry by the index of the goto opcode actived.\r
 \r
-  @param  Index[in] The 0-based index of the goto opcode actived.\r
-\r
-  @retval The iSCSI configuration form entry found.\r
+  @param[in]  Index The 0-based index of the goto opcode actived.\r
 \r
+  @return The iSCSI configuration form entry found.\r
 **/\r
 ISCSI_CONFIG_FORM_ENTRY *\r
 IScsiGetConfigFormEntryByIndex (\r
@@ -244,12 +226,8 @@ IScsiGetConfigFormEntryByIndex (
 /**\r
   Convert the iSCSI configuration data into the IFR data.\r
 \r
-  @param  ConfigFormEntry[in] The iSCSI configuration form entry.\r
-\r
-  @param  IfrNvData[in]       The IFR nv data.\r
-\r
-  @retval None.\r
-\r
+  @param[in]  ConfigFormEntry The iSCSI configuration form entry.\r
+  @param[in]  IfrNvData       The IFR nv data.\r
 **/\r
 VOID\r
 IScsiConvertDeviceConfigDataToIfrNvData (\r
@@ -293,31 +271,66 @@ IScsiConvertDeviceConfigDataToIfrNvData (
 }\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
+  This function allows the caller to request the current\r
+  configuration for one or more named elements. The resulting\r
+  string is in <ConfigAltResp> format. Any and all alternative\r
+  configuration strings shall also be appended to the end of the\r
+  current configuration string. If they are, they must appear\r
+  after the current configuration. They must contain the same\r
+  routing (GUID, NAME, PATH) as the current configuration string.\r
+  They must have an additional description indicating the type of\r
+  alternative configuration the string represents,\r
+  "ALTCFG=<StringToken>". That <StringToken> (when\r
+  converted from Hex UNICODE to binary) is a reference to a\r
+  string in the associated string pack.\r
+\r
+  @param[in] This       Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param[in] Request    A null-terminated Unicode string in\r
+                        <ConfigRequest> format. Note that this\r
+                        includes the routing information as well as\r
+                        the configurable name / value pairs. It is\r
+                        invalid for this string to be in\r
+                        <MultiConfigRequest> format.\r
+  @param[out] Progress  On return, points to a character in the\r
+                        Request string. Points to the string's null\r
+                        terminator if request was successful. Points\r
+                        to the most recent "&" before the first\r
+                        failing name / value pair (or the beginning\r
+                        of the string if the failure is in the first\r
+                        name / value pair) if the request was not\r
+                        successful.\r
+  @param[out] Results   A null-terminated Unicode string in\r
+                        <ConfigAltResp> format which has all values\r
+                        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 string is filled with the\r
+                                  values corresponding to all requested\r
+                                  names.\r
+  @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the\r
+                                  parts of the results that must be\r
+                                  stored awaiting possible future\r
+                                  protocols.\r
+  @retval EFI_INVALID_PARAMETER   For example, passing in a NULL\r
+                                  for the Request parameter\r
+                                  would result in this type of\r
+                                  error. In this case, the\r
+                                  Progress parameter would be\r
+                                  set to NULL. \r
+  @retval EFI_NOT_FOUND           Routing data doesn't match any\r
+                                  known driver. Progress set to the\r
+                                  first character in the routing header.\r
+                                  Note: There is no requirement that the\r
+                                  driver validate the routing data. It\r
+                                  must skip the <ConfigHdr> in order to\r
+                                  process the names.\r
+  @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set\r
+                                  to most recent & before the\r
+                                  error or the beginning of the\r
+                                  string.\r
+  @retval EFI_INVALID_PARAMETER   Unknown name. Progress points\r
+                                  to the & before the name in\r
+                                  question.Currently not implemented.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -336,7 +349,7 @@ IScsiFormExtractConfig (
   EFI_HII_CONFIG_ROUTING_PROTOCOL  *HiiConfigRouting;\r
 \r
   if (Request == NULL) {\r
-    return EFI_NOT_FOUND;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   if (!mIScsiDeviceListUpdated) {\r
@@ -380,23 +393,37 @@ IScsiFormExtractConfig (
 }\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
+  This function applies changes in a driver's configuration.\r
+  Input is a Configuration, which has the routing data for this\r
+  driver followed by name / value configuration pairs. The driver\r
+  must apply those pairs to its configurable storage. If the\r
+  driver's configuration is stored in a linear block of data\r
+  and the driver????s name / value pairs are in <BlockConfig>\r
+  format, it may use the ConfigToBlock helper function (above) to\r
+  simplify the job. Currently not implemented.\r
+\r
+  @param[in]  This           Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param[in]  Configuration  A null-terminated Unicode string in\r
+                             <ConfigString> format.   \r
+  @param[out] Progress       A pointer to a string filled in with the\r
+                             offset of the most recent '&' before the\r
+                             first failing name / value pair (or the\r
+                             beginn ing of the string if the failure\r
+                             is in the first name / value pair) or\r
+                             the terminating NULL if all was\r
+                             successful.\r
+\r
+  @retval EFI_SUCCESS             The results have been distributed or are\r
+                                  awaiting distribution.  \r
+  @retval EFI_OUT_OF_MEMORY       Not enough memory to store the\r
+                                  parts of the results that must be\r
+                                  stored awaiting possible future\r
+                                  protocols.\r
+  @retval EFI_INVALID_PARAMETERS  Passing in a NULL for the\r
+                                  Results parameter would result\r
+                                  in this type of error.\r
+  @retval EFI_NOT_FOUND           Target for the specified routing data\r
+                                  was not found.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -410,36 +437,37 @@ IScsiFormRouteConfig (
 }\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  Action[in]           Specifies the type of action taken by the browser.\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
+  This function is called to provide results data to the driver.\r
+  This data consists of a unique key that is used to identify\r
+  which data is either being passed back or being asked for.\r
+\r
+  @param[in]  This               Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param[in]  Action             Specifies the type of action taken by the browser.\r
+  @param[in]  QuestionId         A unique value which is sent to the original\r
+                                 exporting driver so that it can identify the type\r
+                                 of data to expect. The format of the data tends to \r
+                                 vary based on the opcode that enerated the callback.\r
+  @param[in]  Type               The type of value for the question.\r
+  @param[in]  Value              A pointer to the data being sent to the original\r
+                                 exporting driver.\r
+  @param[out]  ActionRequest     On return, points to the action requested by the\r
+                                 callback function.\r
+\r
+  @retval EFI_SUCCESS            The callback successfully handled the action.\r
+  @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the\r
+                                 variable and its data.\r
+  @retval EFI_DEVICE_ERROR       The variable could not be saved.\r
+  @retval EFI_UNSUPPORTED        The specified Action is not supported by the\r
+                                 callback.Currently not implemented.\r
+  @retval EFI_INVALID_PARAMETERS Passing in wrong parameter. \r
+  @retval Others                 Some unexpected error happened. \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 IScsiFormCallback (\r
   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
   IN  EFI_BROWSER_ACTION                     Action,\r
-  IN  EFI_QUESTION_ID                        KeyValue,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
   IN  UINT8                                  Type,\r
   IN  EFI_IFR_TYPE_VALUE                     *Value,\r
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
@@ -474,7 +502,7 @@ IScsiFormCallback (
     return Status;\r
   }\r
 \r
-  switch (KeyValue) {\r
+  switch (QuestionId) {\r
   case KEY_INITIATOR_NAME:\r
     IScsiUnicodeStrToAsciiStr (IfrNvData->InitiatorName, IScsiName);\r
     BufferSize  = AsciiStrLen (IScsiName) + 1;\r
@@ -668,11 +696,11 @@ IScsiFormCallback (
     break;\r
 \r
   default:\r
-    if ((KeyValue >= KEY_DEVICE_ENTRY_BASE) && (KeyValue < (mNumberOfIScsiDevices + KEY_DEVICE_ENTRY_BASE))) {\r
+    if ((QuestionId >= KEY_DEVICE_ENTRY_BASE) && (QuestionId < (mNumberOfIScsiDevices + KEY_DEVICE_ENTRY_BASE))) {\r
       //\r
       // In case goto the device configuration form, update the device form title.\r
       //\r
-      ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (KeyValue - KEY_DEVICE_ENTRY_BASE));\r
+      ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));\r
       ASSERT (ConfigFormEntry != NULL);\r
 \r
       UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);\r
@@ -703,16 +731,13 @@ IScsiFormCallback (
   Updates the iSCSI configuration form to add/delete an entry for the iSCSI\r
   device specified by the Controller.\r
 \r
-  @param  DriverBindingHandle[in] The driverbinding handle.\r
-\r
-  @param  Controller[in]          The controller handle of the iSCSI device.\r
-\r
-  @param  AddForm[in]             Whether to add or delete a form entry.\r
+  @param[in]  DriverBindingHandle The driverbinding handle.\r
+  @param[in]  Controller          The controller handle of the iSCSI device.\r
+  @param[in]  AddForm             Whether to add or delete a form entry.\r
 \r
   @retval EFI_SUCCESS             The iSCSI configuration form is updated.\r
-\r
   @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
-\r
+  @retval Others                  Some unexpected errors happened.\r
 **/\r
 EFI_STATUS\r
 IScsiConfigUpdateForm (\r
@@ -862,12 +887,11 @@ IScsiConfigUpdateForm (
 /**\r
   Initialize the iSCSI configuration form.\r
 \r
-  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.\r
-\r
-  @retval EFI_SUCCESS             The iSCSI configuration form is initialized.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
+  @param[in]  DriverBindingHandle  The iSCSI driverbinding handle.\r
 \r
+  @retval EFI_SUCCESS              The iSCSI configuration form is initialized.\r
+  @retval EFI_OUT_OF_RESOURCES     Failed to allocate memory.\r
+  @retval Others                   Some unexpected error happened.\r
 **/\r
 EFI_STATUS\r
 IScsiConfigFormInit (\r
@@ -951,12 +975,10 @@ IScsiConfigFormInit (
   device configuration entries, uninstall the form callback protocol and\r
   free the resources used.\r
 \r
-  @param  DriverBindingHandle[in] The iSCSI driverbinding handle.\r
-\r
+  @param[in]  DriverBindingHandle The iSCSI driverbinding handle.\r
+  \r
   @retval EFI_SUCCESS             The iSCSI configuration form is unloaded.\r
-\r
   @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.\r
-\r
 **/\r
 EFI_STATUS\r
 IScsiConfigFormUnload (\r