]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - OvmfPkg/PlatformDxe/Platform.c
OvmfPkg: PlatformDxe: set preferred video resolution from platform config
[mirror_edk2.git] / OvmfPkg / PlatformDxe / Platform.c
... / ...
CommitLineData
1/** @file\r
2 This driver effectuates OVMF's platform configuration settings and exposes\r
3 them via HII.\r
4\r
5 Copyright (C) 2014, Red Hat, Inc.\r
6 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
7\r
8 This program and the accompanying materials are licensed and made available\r
9 under the terms and conditions of the BSD License which accompanies this\r
10 distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
14 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15**/\r
16\r
17#include <Library/DebugLib.h>\r
18#include <Library/UefiBootServicesTableLib.h>\r
19\r
20#include "PlatformConfig.h"\r
21\r
22/**\r
23 Load and execute the platform configuration.\r
24\r
25 @retval EFI_SUCCESS Configuration loaded and executed.\r
26 @return Status codes from PlatformConfigLoad().\r
27**/\r
28STATIC\r
29EFI_STATUS\r
30EFIAPI\r
31ExecutePlatformConfig (\r
32 VOID\r
33 )\r
34{\r
35 EFI_STATUS Status;\r
36 PLATFORM_CONFIG PlatformConfig;\r
37 UINT64 OptionalElements;\r
38\r
39 Status = PlatformConfigLoad (&PlatformConfig, &OptionalElements);\r
40 if (EFI_ERROR (Status)) {\r
41 DEBUG (((Status == EFI_NOT_FOUND) ? EFI_D_VERBOSE : EFI_D_ERROR,\r
42 "%a: failed to load platform config: %r\n", __FUNCTION__, Status));\r
43 return Status;\r
44 }\r
45\r
46 if (OptionalElements & PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION) {\r
47 //\r
48 // Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.\r
49 //\r
50 PcdSet32 (PcdVideoHorizontalResolution,\r
51 PlatformConfig.HorizontalResolution);\r
52 PcdSet32 (PcdVideoVerticalResolution,\r
53 PlatformConfig.VerticalResolution);\r
54 }\r
55\r
56 return EFI_SUCCESS;\r
57}\r
58\r
59\r
60/**\r
61 Entry point for this driver.\r
62\r
63 @param[in] ImageHandle Image handle of this driver.\r
64 @param[in] SystemTable Pointer to SystemTable.\r
65\r
66 @retval EFI_SUCESS Driver has loaded successfully.\r
67\r
68**/\r
69EFI_STATUS\r
70EFIAPI\r
71PlatformInit (\r
72 IN EFI_HANDLE ImageHandle,\r
73 IN EFI_SYSTEM_TABLE *SystemTable\r
74 )\r
75{\r
76 ExecutePlatformConfig ();\r
77 return EFI_SUCCESS;\r
78}\r
79\r
80/**\r
81 Unload the driver.\r
82\r
83 @param[in] ImageHandle Handle that identifies the image to evict.\r
84\r
85 @retval EFI_SUCCESS The image has been unloaded.\r
86**/\r
87EFI_STATUS\r
88EFIAPI\r
89PlatformUnload (\r
90 IN EFI_HANDLE ImageHandle\r
91 )\r
92{\r
93 return EFI_SUCCESS;\r
94}\r