update file header

update function header 
correct parameter mistake in IScsiFormCallback(), change KeyValue to QuestionId

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6942 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ywu21 2008-12-10 02:07:48 +00:00
parent fab4bd0444
commit 669314e58e
1 changed files with 136 additions and 114 deletions

View File

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