OvmfPkg: PlatformDxe: set preferred video resolution from platform config

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
This commit is contained in:
Laszlo Ersek 2014-03-22 07:13:09 +00:00 committed by jljusten
parent 5267c89b4d
commit bdaf30e4e6
2 changed files with 45 additions and 0 deletions

View File

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

View File

@ -42,6 +42,10 @@
UefiRuntimeServicesTableLib
UefiDriverEntryPoint
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution
[Guids]
gOvmfPlatformConfigGuid