OvmfPkg: PlatformDxe: set preferred video resolution from platform config
authorLaszlo Ersek <lersek@redhat.com>
Sat, 22 Mar 2014 07:13:09 +0000 (07:13 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 22 Mar 2014 07:13:09 +0000 (07:13 +0000)
The GraphicsConsoleDxe driver (in MdeModulePkg/Universal/Console)
determines the preferred video resolution from the dynamic PCDs
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution

Setting the graphics resolution during boot is useful when the guest OS
(for lack of a dedicated display driver) continues to work with the
original GOP resolution and framebuffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15366 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/PlatformDxe/Platform.c
OvmfPkg/PlatformDxe/Platform.inf

index 7e2353035cfee6e8db0dca9eb225bc07daf83748..a6172a8018761f9a8c97e73eadff9b110a50782a 100644 (file)
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
+#include "PlatformConfig.h"\r
+\r
+/**\r
+  Load and execute the platform configuration.\r
+\r
+  @retval EFI_SUCCESS            Configuration loaded and executed.\r
+  @return                        Status codes from PlatformConfigLoad().\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+EFIAPI\r
+ExecutePlatformConfig (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS      Status;\r
+  PLATFORM_CONFIG PlatformConfig;\r
+  UINT64          OptionalElements;\r
+\r
+  Status = PlatformConfigLoad (&PlatformConfig, &OptionalElements);\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG (((Status == EFI_NOT_FOUND) ? EFI_D_VERBOSE : EFI_D_ERROR,\r
+      "%a: failed to load platform config: %r\n", __FUNCTION__, Status));\r
+    return Status;\r
+  }\r
+\r
+  if (OptionalElements & PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION) {\r
+    //\r
+    // Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.\r
+    //\r
+    PcdSet32 (PcdVideoHorizontalResolution,\r
+      PlatformConfig.HorizontalResolution);\r
+    PcdSet32 (PcdVideoVerticalResolution,\r
+      PlatformConfig.VerticalResolution);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
 /**\r
   Entry point for this driver.\r
 \r
@@ -33,6 +73,7 @@ PlatformInit (
   IN  EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
+  ExecutePlatformConfig ();\r
   return EFI_SUCCESS;\r
 }\r
 \r
index 47ed25b5c76166ce6044be56eff4694a0bbcaac8..315f55949d4a4f33e82d2cb6799d21e14608e143 100644 (file)
   UefiRuntimeServicesTableLib\r
   UefiDriverEntryPoint\r
 \r
+[Pcd]\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution\r
+\r
 [Guids]\r
   gOvmfPlatformConfigGuid\r
 \r