-/*++\r
+/** @file\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
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
---*/\r
+**/\r
\r
#include "IScsiImpl.h"\r
\r
&mIScsiConfigFormList\r
};\r
\r
-STATIC\r
+/**\r
+ Convert the IPv4 address into a dotted string.\r
+\r
+ @param[in] Ip The IPv4 address.\r
+ @param[out] Str The dotted IP string.\r
+**/\r
VOID\r
IScsiIpToStr (\r
IN EFI_IPv4_ADDRESS *Ip,\r
OUT CHAR16 *Str\r
)\r
-/*++\r
-\r
-Routine Description:\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
-\r
-Returns:\r
-\r
- None.\r
-\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
+/**\r
+ Pop up an invalid notify which displays the message in Warning.\r
+\r
+ @param[in] Warning The warning message.\r
+**/\r
VOID\r
PopUpInvalidNotify (\r
IN CHAR16 *Warning\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Pop up an invalid notify which displays the message in Warning.\r
-\r
-Arguments:\r
-\r
- Warning - The warning message.\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
EFI_INPUT_KEY Key;\r
\r
IfrLibCreatePopUp (1, &Key, Warning);\r
}\r
\r
+/**\r
+ Update the list of iSCSI devices the iSCSI driver is controlling.\r
+ \r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval Others Other errors as indicated. \r
+**/\r
EFI_STATUS\r
IScsiUpdateDeviceList (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Update the list of iSCSI devices the iSCSI driver is controlling.\r
-\r
-Arguments:\r
-\r
- None.\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
ISCSI_DEVICE_LIST *DeviceList;\r
);\r
\r
gBS->FreePool (DeviceList);\r
+ gBS->FreePool (Handles);\r
\r
return Status;\r
}\r
\r
-STATIC\r
+/**\r
+ Get the iSCSI configuration form entry by the index of the goto opcode actived.\r
+\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
IN UINT32 Index\r
)\r
-/*++\r
-\r
-Routine Description:\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
-\r
- The iSCSI configuration form entry found.\r
-\r
---*/\r
{\r
UINT32 CurrentIndex;\r
LIST_ENTRY *Entry;\r
return ConfigFormEntry;\r
}\r
\r
-STATIC\r
+/**\r
+ Convert the iSCSI configuration data into the IFR data.\r
+\r
+ @param[in] ConfigFormEntry The iSCSI configuration form entry.\r
+ @param[out] IfrNvData The IFR nv data.\r
+**/\r
VOID\r
IScsiConvertDeviceConfigDataToIfrNvData (\r
- IN ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry,\r
- IN ISCSI_CONFIG_IFR_NVDATA *IfrNvData\r
+ IN ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry,\r
+ OUT ISCSI_CONFIG_IFR_NVDATA *IfrNvData\r
)\r
-/*++\r
-\r
-Routine Description:\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
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
ISCSI_SESSION_CONFIG_NVDATA *SessionConfigData;\r
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfigData;\r
IScsiAsciiStrToUnicodeStr (AuthConfigData->ReverseCHAPSecret, IfrNvData->ReverseCHAPSecret);\r
}\r
\r
-\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
IScsiFormExtractConfig (\r
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
ISCSI_FORM_CALLBACK_INFO *Private;\r
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
\r
+ if (Request == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
if (!mIScsiDeviceListUpdated) {\r
//\r
// Update the device list.\r
return Status;\r
}\r
\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
IScsiFormRouteConfig (\r
IN CONST EFI_STRING Configuration,\r
OUT EFI_STRING *Progress\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
- 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
-\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
-\r
---*/\r
{\r
return EFI_SUCCESS;\r
}\r
\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 Other errors as indicated. \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
)\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
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
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
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
- DeviceFormTitleToken = (STRING_REF) STR_ISCSI_DEVICE_FORM_TITLE;\r
+ DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;\r
HiiLibSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString);\r
\r
IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);\r
return Status;\r
}\r
\r
+/**\r
+ Updates the iSCSI configuration form to add/delete an entry for the iSCSI\r
+ device specified by the Controller.\r
+\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
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval Others Other errors as indicated.\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
- Updates the iSCSI configuration form to add/delete an entry for the iSCSI\r
- device specified by the Controller.\r
-\r
-Arguments:\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
-\r
-Returns:\r
-\r
- EFI_SUCCESS - The iSCSI configuration form is updated.\r
- EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
{\r
LIST_ENTRY *Entry;\r
ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;\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
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
HiiLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleHelpToken, PortString);\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
-\r
- DriverBindingHandle - The iSCSI driverbinding handle.\r
+ @param[in] DriverBindingHandle The iSCSI driverbinding handle.\r
\r
-Returns:\r
-\r
- EFI_SUCCESS - The iSCSI configuration form is initialized.\r
- EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
+ @retval EFI_SUCCESS The iSCSI configuration form is initialized.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval Others Other errors as indicated.\r
+**/\r
+EFI_STATUS\r
+IScsiConfigFormInit (\r
+ VOID\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;\r
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
-\r
-Returns:\r
-\r
- EFI_SUCCESS - The iSCSI configuration form is unloaded.\r
- EFI_OUT_OF_RESOURCES - Failed to allocate memory.\r
-\r
---*/\r
+ @param[in] DriverBindingHandle The iSCSI driverbinding handle.\r
+ \r
+ @retval EFI_SUCCESS The iSCSI configuration form is unloaded.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+**/\r
+EFI_STATUS\r
+IScsiConfigFormUnload (\r
+ IN EFI_HANDLE DriverBindingHandle\r
+ )\r
{\r
ISCSI_CONFIG_FORM_ENTRY *ConfigFormEntry;\r
\r