edk2/0032-Revert-OvmfPkg-PlatformDxe-Handle-all-requests-in-Ex.patch
Camilla Conte 0bde85a20e * Thu Dec 15 2022 Camilla Conte <cconte@redhat.com> - 20221207gitfff6d81270b5-1
- Rebase to edk2-stable202211 tag
  Resolves: RHEL-119
  (rebase edk2 to edk2-stable202211)
- Resolves: RHEL-75
  (edk2 builds should show the build version)
- Resolves: bz#2132951
  (edk2: Sort traditional virtualization builds before Confidential Computing builds)
2022-12-15 12:45:35 +00:00

217 lines
6.1 KiB
Diff

From b6a0dcb7a035aef12e1466fd1017194b9430c948 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 13 Dec 2022 10:31:05 +0100
Subject: Revert "OvmfPkg/PlatformDxe: Handle all requests in ExtractConfig and
RouteConfig"
This reverts commit aefcc91805fd69e4aad4bc08a9f708db11cae5f0.
Fixes regression, patch breaks setting display resolution via ovmf
platform config.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
OvmfPkg/PlatformDxe/Platform.c | 115 +--------------------------
OvmfPkg/PlatformDxe/PlatformConfig.c | 2 +-
OvmfPkg/PlatformDxe/PlatformConfig.h | 2 -
3 files changed, 3 insertions(+), 116 deletions(-)
diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index ac31fafbdc..4d432f18df 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -108,11 +108,6 @@ STATIC EFI_EVENT mGopEvent;
//
STATIC VOID *mGopTracker;
-//
-// The driver image handle, used to obtain the device path for <ConfigHdr>.
-//
-STATIC EFI_HANDLE mImageHandle;
-
//
// Cache the resolutions we get from the GOP.
//
@@ -234,10 +229,6 @@ ExtractConfig (
{
MAIN_FORM_STATE MainFormState;
EFI_STATUS Status;
- EFI_STRING ConfigRequestHdr;
- EFI_STRING ConfigRequest;
- UINTN Size;
- BOOLEAN AllocatedRequest;
DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
@@ -245,73 +236,18 @@ ExtractConfig (
return EFI_INVALID_PARAMETER;
}
- ConfigRequestHdr = NULL;
- ConfigRequest = NULL;
- Size = 0;
- AllocatedRequest = FALSE;
-
- //
- // Check if <ConfigHdr> matches the GUID and name
- //
- *Progress = Request;
- if ((Request != NULL) &&
- !HiiIsConfigHdrMatch (
- Request,
- &gOvmfPlatformConfigGuid,
- mVariableName
- )
- )
- {
- return EFI_NOT_FOUND;
- }
-
Status = PlatformConfigToFormState (&MainFormState);
if (EFI_ERROR (Status)) {
+ *Progress = Request;
return Status;
}
- if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
- //
- // Request has no <RequestElement>, so construct full request string.
- // Allocate and fill a buffer large enough to hold <ConfigHdr>
- // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a
- // null terminator.
- //
- ConfigRequestHdr = HiiConstructConfigHdr (
- &gOvmfPlatformConfigGuid,
- mVariableName,
- mImageHandle
- );
- if (ConfigRequestHdr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
- ConfigRequest = AllocateZeroPool (Size);
- AllocatedRequest = TRUE;
- if (ConfigRequest == NULL) {
- FreePool (ConfigRequestHdr);
- return EFI_OUT_OF_RESOURCES;
- }
-
- UnicodeSPrint (
- ConfigRequest,
- Size,
- L"%s&OFFSET=0&WIDTH=%016LX",
- ConfigRequestHdr,
- sizeof MainFormState
- );
- FreePool (ConfigRequestHdr);
- } else {
- ConfigRequest = Request;
- }
-
//
// Answer the textual request keying off the binary form state.
//
Status = gHiiConfigRouting->BlockToConfig (
gHiiConfigRouting,
- ConfigRequest,
+ Request,
(VOID *)&MainFormState,
sizeof MainFormState,
Results,
@@ -329,33 +265,6 @@ ExtractConfig (
DEBUG ((DEBUG_VERBOSE, "%a: Results=\"%s\"\n", __FUNCTION__, *Results));
}
- //
- // If we used a newly allocated ConfigRequest, update Progress to point to
- // original Request instead of ConfigRequest.
- //
- if (Request == NULL) {
- *Progress = NULL;
- } else if (StrStr (Request, L"OFFSET") == NULL) {
- if (EFI_ERROR (Status)) {
- //
- // Since we constructed ConfigRequest, failure can only occur if there
- // is not enough memory. In this case, we point Progress to the first
- // character of Request.
- //
- *Progress = Request;
- } else {
- //
- // In case of success, we point Progress to the null terminator of
- // Request.
- //
- *Progress = Request + StrLen (Request);
- }
- }
-
- if (AllocatedRequest) {
- FreePool (ConfigRequest);
- }
-
return Status;
}
@@ -439,21 +348,6 @@ RouteConfig (
return EFI_INVALID_PARAMETER;
}
- //
- // Check if <ConfigHdr> matches the GUID and name
- //
- *Progress = Configuration;
- if ((Configuration != NULL) &&
- !HiiIsConfigHdrMatch (
- Configuration,
- &gOvmfPlatformConfigGuid,
- mVariableName
- )
- )
- {
- return EFI_NOT_FOUND;
- }
-
//
// the "read" step in RMW
//
@@ -972,11 +866,6 @@ PlatformInit (
return Status;
}
- //
- // Save the driver image handle.
- //
- mImageHandle = ImageHandle;
-
//
// Publish the HII package list to HII Database.
//
diff --git a/OvmfPkg/PlatformDxe/PlatformConfig.c b/OvmfPkg/PlatformDxe/PlatformConfig.c
index f5ac2d0609..e202ac5b47 100644
--- a/OvmfPkg/PlatformDxe/PlatformConfig.c
+++ b/OvmfPkg/PlatformDxe/PlatformConfig.c
@@ -21,7 +21,7 @@
//
// Name of the UEFI variable that we use for persistent storage.
//
-CHAR16 mVariableName[] = L"PlatformConfig";
+STATIC CHAR16 mVariableName[] = L"PlatformConfig";
/**
Serialize and persistently save platform configuration.
diff --git a/OvmfPkg/PlatformDxe/PlatformConfig.h b/OvmfPkg/PlatformDxe/PlatformConfig.h
index 5d9b457b1b..902c9b2ce0 100644
--- a/OvmfPkg/PlatformDxe/PlatformConfig.h
+++ b/OvmfPkg/PlatformDxe/PlatformConfig.h
@@ -50,6 +50,4 @@ PlatformConfigLoad (
#define PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION BIT0
#define PLATFORM_CONFIG_F_DOWNGRADE BIT63
-extern CHAR16 mVariableName[];
-
#endif // _PLATFORM_CONFIG_H_
--
2.38.1