summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/IScsiDxe
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-04 06:48:52 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-03-04 06:48:52 +0000
commit59aefb7e0dc811a3e66ae23c1730028365354361 (patch)
treebabbb70bfd114b0c20187722bb4058de4e1502aa /MdeModulePkg/Universal/Network/IScsiDxe
parent5bdfa4e58ad64cbc825d03397b15f5b2bcebda4e (diff)
downloadedk2-59aefb7e0dc811a3e66ae23c1730028365354361.zip
edk2-59aefb7e0dc811a3e66ae23c1730028365354361.tar.gz
edk2-59aefb7e0dc811a3e66ae23c1730028365354361.tar.bz2
Update HiiConfigAccess.ExtractConfig interface to support NULL request string and ConfigHdr request string.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10180 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/IScsiDxe')
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
index 35214f2..32b43f6 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
@@ -1,7 +1,7 @@
/** @file
Helper functions for configuring or getting the parameters relating to iSCSI.
-Copyright (c) 2004 - 2009, Intel Corporation.<BR>
+Copyright (c) 2004 - 2010, 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
@@ -360,11 +360,24 @@ IScsiFormExtractConfig (
ISCSI_CONFIG_IFR_NVDATA *IfrNvData;
ISCSI_FORM_CALLBACK_INFO *Private;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
+ EFI_STRING ConfigRequestHdr;
+ EFI_STRING ConfigRequest;
+ BOOLEAN AllocatedRequest;
+ UINTN Size;
- if (Request == NULL || Progress == NULL || Results == NULL) {
+ if (Progress == NULL || Results == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*Progress = Request;
+ if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mVendorGuid, mVendorStorageName)) {
+ return EFI_NOT_FOUND;
+ }
+
+ ConfigRequestHdr = NULL;
+ ConfigRequest = NULL;
+ AllocatedRequest = FALSE;
+ Size = 0;
if (!mIScsiDeviceListUpdated) {
//
@@ -394,15 +407,47 @@ IScsiFormExtractConfig (
//
HiiConfigRouting = Private->ConfigRouting;
BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
+ ConfigRequest = Request;
+ if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
+ //
+ // Request has no request element, construct full request string.
+ // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
+ // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
+ //
+ ConfigRequestHdr = HiiConstructConfigHdr (&mVendorGuid, mVendorStorageName, Private->DriverHandle);
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
+ ASSERT (ConfigRequest != NULL);
+ AllocatedRequest = TRUE;
+ UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
+ FreePool (ConfigRequestHdr);
+ }
Status = HiiConfigRouting->BlockToConfig (
HiiConfigRouting,
- Request,
+ ConfigRequest,
(UINT8 *) IfrNvData,
BufferSize,
Results,
Progress
);
FreePool (IfrNvData);
+ //
+ // Free the allocated config request string.
+ //
+ if (AllocatedRequest) {
+ FreePool (ConfigRequest);
+ ConfigRequest = NULL;
+ }
+
+ //
+ // Set Progress string to the original request string.
+ //
+ if (Request == NULL) {
+ *Progress = NULL;
+ } else if (StrStr (Request, L"OFFSET") == NULL) {
+ *Progress = Request + StrLen (Request);
+ }
+
return Status;
}