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
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
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
@ -10,14 +10,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
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"
@ -35,12 +27,8 @@ LIST_ENTRY mIScsiConfigFormList = {
/**
Convert the IPv4 address into a dotted string.
@param Ip[in] The IPv4 address.
@param Str[out] The dotted IP string.
@retval None.
@param[in] Ip The IPv4 address.
@param[out] Str The dotted IP string.
**/
VOID
IScsiIpToStr (
@ -54,10 +42,7 @@ IScsiIpToStr (
/**
Pop up an invalid notify which displays the message in Warning.
@param Warning[in] The warning message.
@retval None.
@param[in] Warning The warning message.
**/
VOID
PopUpInvalidNotify (
@ -72,10 +57,8 @@ PopUpInvalidNotify (
/**
Update the list of iSCSI devices the iSCSI driver is controlling.
@param None.
@retval None.
@retval EFI_SUCCESS The callback successfully handled the action.
@retval Others Some unexpected errors happened.
**/
EFI_STATUS
IScsiUpdateDeviceList (
@ -212,10 +195,9 @@ IScsiUpdateDeviceList (
/**
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.
@retval The iSCSI configuration form entry found.
@param[in] Index The 0-based index of the goto opcode actived.
@return The iSCSI configuration form entry found.
**/
ISCSI_CONFIG_FORM_ENTRY *
IScsiGetConfigFormEntryByIndex (
@ -244,12 +226,8 @@ IScsiGetConfigFormEntryByIndex (
/**
Convert the iSCSI configuration data into the IFR data.
@param ConfigFormEntry[in] The iSCSI configuration form entry.
@param IfrNvData[in] The IFR nv data.
@retval None.
@param[in] ConfigFormEntry The iSCSI configuration form entry.
@param[in] IfrNvData The IFR nv data.
**/
VOID
IScsiConvertDeviceConfigDataToIfrNvData (
@ -293,31 +271,66 @@ IScsiConvertDeviceConfigDataToIfrNvData (
}
/**
This function allows a caller to extract the current configuration for one
or more named elements from the target driver.
This function allows the caller to request the current
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 Request[in] A null-terminated Unicode string in <ConfigRequest> format.
@param Progress[out] On return, points to a character in the Request string.
Points to the string's null terminator if request was successful.
Points to the most recent '&' before the first failing name/value
pair (or the beginning of the string if the failure is in the
first name/value pair) if the request was not successful.
@param Results[out] A null-terminated Unicode string in <ConfigAltResp> format which
has all values filled in for the names in the Request string.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Request A null-terminated Unicode string in
<ConfigRequest> format. Note that this
includes the routing information as well as
the configurable name / value pairs. It is
invalid for this string to be in
<MultiConfigRequest> format.
@param[out] Progress On return, points to a character in the
Request string. Points to the string's null
terminator if request was successful. Points
to the most recent "&" before the first
failing name / value pair (or the beginning
of the string if the failure is in the first
name / value pair) if the request was not
successful.
@param[out] Results A null-terminated Unicode string in
<ConfigAltResp> format which has all values
filled in for the names in the Request string.
String to be allocated by the called function.
@retval EFI_SUCCESS The Results is filled with the requested values.
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
@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
EFIAPI
@ -336,7 +349,7 @@ IScsiFormExtractConfig (
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
if (Request == NULL) {
return EFI_NOT_FOUND;
return EFI_INVALID_PARAMETER;
}
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 Configuration[in] A null-terminated Unicode string in <ConfigResp> format.
@param Progress[out] A pointer to a string filled in with the offset of the most
recent '&' before the first failing name/value pair (or the
beginning of the string if the failure is in the first
name/value pair) or the terminating NULL if all was successful.
@retval EFI_SUCCESS The Results is processed successfully.
@retval EFI_INVALID_PARAMETER Configuration is NULL.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Configuration A null-terminated Unicode string in
<ConfigString> format.
@param[out] Progress A pointer to a string filled in with the
offset of the most recent '&' before the
first failing name / value pair (or the
beginn ing of the string if the failure
is in the first name / value pair) or
the terminating NULL if all was
successful.
@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
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 Action[in] Specifies the type of action taken by the browser.
@param QuestionId[in] A unique value which is sent to the original exporting driver
so that it can identify the type of data to expect.
@param Type[in] The type of value for the question.
@param Value[in] A pointer to the data being sent to the original exporting driver.
@param ActionRequest[out] On return, points to the action requested by the callback function.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Action 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
of data to expect. The format of the data tends to
vary based on the opcode that enerated the callback.
@param[in] Type The type of value for the question.
@param[in] Value 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.
@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_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_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
EFIAPI
IScsiFormCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID KeyValue,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
@ -474,7 +502,7 @@ IScsiFormCallback (
return Status;
}
switch (KeyValue) {
switch (QuestionId) {
case KEY_INITIATOR_NAME:
IScsiUnicodeStrToAsciiStr (IfrNvData->InitiatorName, IScsiName);
BufferSize = AsciiStrLen (IScsiName) + 1;
@ -668,11 +696,11 @@ IScsiFormCallback (
break;
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.
//
ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (KeyValue - KEY_DEVICE_ENTRY_BASE));
ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));
ASSERT (ConfigFormEntry != NULL);
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
device specified by the Controller.
@param DriverBindingHandle[in] The driverbinding handle.
@param Controller[in] The controller handle of the iSCSI device.
@param AddForm[in] Whether to add or delete a form entry.
@param[in] DriverBindingHandle The driverbinding handle.
@param[in] Controller The controller handle of the iSCSI device.
@param[in] AddForm Whether to add or delete a form entry.
@retval EFI_SUCCESS The iSCSI configuration form is updated.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval Others Some unexpected errors happened.
**/
EFI_STATUS
IScsiConfigUpdateForm (
@ -862,12 +887,11 @@ IScsiConfigUpdateForm (
/**
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 Others Some unexpected error happened.
**/
EFI_STATUS
IScsiConfigFormInit (
@ -951,12 +975,10 @@ IScsiConfigFormInit (
device configuration entries, uninstall the form callback protocol and
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_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
IScsiConfigFormUnload (