render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone

Blame SOURCES/0032-Revert-OvmfPkg-PlatformDxe-Handle-all-requests-in-Ex.patch

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