From 59aefb7e0dc811a3e66ae23c1730028365354361 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Thu, 4 Mar 2010 06:48:52 +0000 Subject: 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 --- .../PlatformDriOverrideDxe/PlatDriOverrideDxe.c | 56 ++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'MdeModulePkg/Universal/PlatformDriOverrideDxe') diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c index 241918691e..ad045e86f4 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c @@ -13,7 +13,7 @@ 4. It save all the mapping info in NV variables which will be consumed by platform override protocol driver to publish the platform override protocol. -Copyright (c) 2007 - 2009, Intel Corporation +Copyright (c) 2007 - 2010, Intel Corporation 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 @@ -1161,25 +1161,73 @@ PlatOverMngrExtractConfig ( EFI_STATUS Status; EFI_CALLBACK_INFO *Private; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequestHdr; + EFI_STRING ConfigRequest; + BOOLEAN AllocatedRequest; + UINTN Size; + UINTN BufferSize; - if (Progress == NULL || Results == NULL || Request == NULL) { + if (Progress == NULL || Results == NULL) { return EFI_INVALID_PARAMETER; } - *Progress = Request; + + *Progress = Request; + if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mPlatformOverridesManagerGuid, mVariableName)) { + return EFI_NOT_FOUND; + } + + ConfigRequestHdr = NULL; + ConfigRequest = NULL; + Size = 0; + AllocatedRequest = FALSE; + Private = EFI_CALLBACK_INFO_FROM_THIS (This); HiiConfigRouting = Private->HiiConfigRouting; + 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 template + // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator + // + ConfigRequestHdr = HiiConstructConfigHdr (&mPlatformOverridesManagerGuid, mVariableName, Private->DriverHandle); + Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest = AllocateZeroPool (Size); + ASSERT (ConfigRequest != NULL); + AllocatedRequest = TRUE; + BufferSize = sizeof (PLAT_OVER_MNGR_DATA); + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + } // // Convert buffer data to by helper function BlockToConfig() // Status = HiiConfigRouting->BlockToConfig ( HiiConfigRouting, - Request, + ConfigRequest, (UINT8 *) &Private->FakeNvData, sizeof (PLAT_OVER_MNGR_DATA), Results, Progress ); + + // + // 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; } -- cgit v1.2.3