... which opens from the Device Manager window.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
Notes:
- make dependency on HiiDatabaseDxe explicit
OvmfPkg/PlatformDxe/Platform.inf | 9 ++
OvmfPkg/PlatformDxe/Platform.h | 24 +++++
OvmfPkg/PlatformDxe/PlatformForms.vfr | 38 ++++++++
OvmfPkg/PlatformDxe/Platform.c | 165 ++++++++++++++++++++++++++++++++++
OvmfPkg/PlatformDxe/Platform.uni | Bin 0 -> 1920 bytes
5 files changed, 236 insertions(+)
create mode 100644 OvmfPkg/PlatformDxe/Platform.h
create mode 100644 OvmfPkg/PlatformDxe/PlatformForms.vfr
create mode 100644 OvmfPkg/PlatformDxe/Platform.uni
diff --git a/OvmfPkg/PlatformDxe/Platform.inf b/OvmfPkg/PlatformDxe/Platform.inf
index 315f559..e3701d4 100644
--- a/OvmfPkg/PlatformDxe/Platform.inf
+++ b/OvmfPkg/PlatformDxe/Platform.inf
@@ -26,7 +26,9 @@
[Sources]
Platform.c
+ Platform.uni
PlatformConfig.c
+ PlatformForms.vfr
[Packages]
MdePkg/MdePkg.dec
@@ -36,6 +38,8 @@
[LibraryClasses]
BaseMemoryLib
DebugLib
+ DevicePathLib
+ HiiLib
MemoryAllocationLib
UefiBootServicesTableLib
UefiLib
@@ -46,9 +50,14 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution
+[Protocols]
+ gEfiDevicePathProtocolGuid ## PRODUCES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+
[Guids]
gOvmfPlatformConfigGuid
[Depex]
+ gEfiHiiDatabaseProtocolGuid AND
gEfiVariableArchProtocolGuid AND
gEfiVariableWriteArchProtocolGuid
diff --git a/OvmfPkg/PlatformDxe/Platform.h b/OvmfPkg/PlatformDxe/Platform.h
new file mode 100644
index 0000000..1ee580e
--- /dev/null
+++ b/OvmfPkg/PlatformDxe/Platform.h
@@ -0,0 +1,24 @@
+/** @file
+ This driver effectuates OVMF's platform configuration settings and exposes
+ them via HII.
+
+ Copyright (C) 2014, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef _PLATFORM_H_
+#define _PLATFORM_H_
+
+//
+// Macro and type definitions that connect the form with the HII driver code.
+//
+#define FORMID_MAIN_FORM 1
+
+#endif // _PLATFORM_H_
diff --git a/OvmfPkg/PlatformDxe/PlatformForms.vfr
b/OvmfPkg/PlatformDxe/PlatformForms.vfr
new file mode 100644
index 0000000..e9ae0de
--- /dev/null
+++ b/OvmfPkg/PlatformDxe/PlatformForms.vfr
@@ -0,0 +1,38 @@
+// *++
+//
+// Copyright (C) 2014, Red Hat, Inc.
+// Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made available
+// under the terms and conditions of the BSD License which accompanies this
+// distribution. The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+// IMPLIED.
+//
+// Module Name:
+//
+// PlatformForms.vfr
+//
+// Abstract:
+//
+// Form definitions for exposing some of OVMF's platform knobs via HII.
+//
+// --*/
+
+#include <Guid/OvmfPlatformConfig.h>
+#include "Platform.h"
+
+formset
+ guid = OVMF_PLATFORM_CONFIG_GUID,
+ title = STRING_TOKEN(STR_FORMSET_TITLE),
+ help = STRING_TOKEN(STR_FORMSET_HELP),
+
+ form
+ formid = FORMID_MAIN_FORM,
+ title = STRING_TOKEN(STR_MAIN_FORM_TITLE);
+ endform;
+
+endformset;
diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index a6172a8..16066a0 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -15,10 +15,128 @@
**/
#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/HiiLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/HiiConfigAccess.h>
#include "PlatformConfig.h"
+//
+// The HiiAddPackages() library function requires that any controller (or
+// image) handle, to be associated with the HII packages under installation, be
+// "decorated" with a device path. The tradition seems to be a vendor device
+// path.
+//
+// We'd like to associate our HII packages with the driver's image handle. The
+// first idea is to use the driver image's device path. Unfortunately, loaded
+// images only come with an EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL (not the
+// usual EFI_DEVICE_PATH_PROTOCOL), ie. a different GUID. In addition, even the
+// EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL interface may be NULL, if the image
+// has been loaded from an "unnamed" memory source buffer.
+//
+// Hence let's just stick with the tradition -- use a dedicated vendor device
+// path, with the driver's FILE_GUID.
+//
+#pragma pack(1)
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} PKG_DEVICE_PATH;
+#pragma pack()
+
+STATIC PKG_DEVICE_PATH mPkgDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH) ),
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH) >> 8)
+ }
+ },
+ EFI_CALLER_ID_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH ),
+ (UINT8) (END_DEVICE_PATH_LENGTH >> 8)
+ }
+ }
+};
+
+//
+// The configuration interface between the HII engine (form display etc) and
+// this driver.
+//
+STATIC EFI_HII_CONFIG_ACCESS_PROTOCOL mConfigAccess;
+
+//
+// The handle representing our list of packages after installation.
+//
+STATIC EFI_HII_HANDLE mInstalledPackages;
+
+//
+// The arrays below constitute our HII package list. They are auto-generated by
+// the VFR compiler and linked into the driver image during the build.
+//
+// - The strings package receives its C identifier from the driver's BASE_NAME,
+// plus "Strings".
+//
+// - The forms package receives its C identifier from the VFR file's basename,
+// plus "Bin".
+//
+//
+extern UINT8 PlatformDxeStrings[];
+extern UINT8 PlatformFormsBin[];
+
+
+STATIC
+EFI_STATUS
+EFIAPI
+ExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+)
+{
+ return EFI_SUCCESS;
+}
+
+
+STATIC
+EFI_STATUS
+EFIAPI
+RouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+)
+{
+ return EFI_SUCCESS;
+}
+
+
+STATIC
+EFI_STATUS
+EFIAPI
+Callback (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN OUT EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
/**
Load and execute the platform configuration.
@@ -64,6 +182,8 @@ ExecutePlatformConfig (
@param[in] SystemTable Pointer to SystemTable.
@retval EFI_SUCESS Driver has loaded successfully.
+ @retval EFI_OUT_OF_RESOURCES Failed to install HII packages.
+ @return Error codes from lower level functions.
**/
EFI_STATUS
@@ -73,8 +193,48 @@ PlatformInit (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ EFI_STATUS Status;
+
ExecutePlatformConfig ();
+
+ mConfigAccess.ExtractConfig = &ExtractConfig;
+ mConfigAccess.RouteConfig = &RouteConfig;
+ mConfigAccess.Callback = &Callback;
+
+ //
+ // Declare ourselves suitable for HII communication.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
+ &gEfiDevicePathProtocolGuid, &mPkgDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
+ NULL);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish the HII package list to HII Database.
+ //
+ mInstalledPackages = HiiAddPackages (
+ &gEfiCallerIdGuid, // PackageListGuid
+ ImageHandle, // associated DeviceHandle
+ PlatformDxeStrings, // 1st package
+ PlatformFormsBin, // 2nd package
+ NULL // terminator
+ );
+ if (mInstalledPackages == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto UninstallProtocols;
+ }
+
return EFI_SUCCESS;
+
+UninstallProtocols:
+ gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
+ &gEfiDevicePathProtocolGuid, &mPkgDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
+ NULL);
+ return Status;
}
/**
@@ -90,5 +250,10 @@ PlatformUnload (
IN EFI_HANDLE ImageHandle
)
{
+ HiiRemovePackages (mInstalledPackages);
+ gBS->UninstallMultipleProtocolInterfaces (ImageHandle,
+ &gEfiDevicePathProtocolGuid, &mPkgDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid, &mConfigAccess,
+ NULL);
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/PlatformDxe/Platform.uni b/OvmfPkg/PlatformDxe/Platform.uni
new file mode 100644
index
0000000000000000000000000000000000000000..9d41e446c6ebdb2b0f43646946d5c7774fe55449
GIT binary patch
literal 1920
zcmah}*=`y^5Ul4&`G*m_B#r?m%1f*y64(%<m_r8Vc(S;?5{I>mN%;9BRXxiNY<vi@
zGd<H?U46~pKNVEqaD+Gfy~GPjm27o5!wPrUB1VK6Zn38BE1tgQ`VJ>}i}yI@{t6R}
zxn5vE9i23>#0ceQu|^rz2|i?&YvRp`BL6WN=qu!iyCqQ_s=Sv*V3wFPK|<RY8)H<)
zN7TsfbH-yAqeGwZMAUY~kBK`o9}CI@`cO1$YD`QXF_sk;)YRRUc1!9zo`{wFMcmB|
zZ9qv@bDoX3TN)$b?Qmr^PLVg<N7Nl)$nPZM>2Pl>gdLc8UyIa_XDMddMOl6n(+bl)
zyBc~pr+j(9$>EpfV8pN39Yz_EjgXWD<tb!Nz7n1*>LGdV*F{-X^i!Vu3W@V?>f|{c
z=Evu9ORZsQze+P8X6rrg>cTZEacaG){`5JPery>pGy0hIspM*q@MK8lW0Z0?Wun~j
zzl(9Vs!J|VC#x>IsDm&3R?(u|WJVoxs<qG4Cj0D~ySnB18f~t1o(F_bgC_gBPK}-+
zceqnO>s#O|T%i`Y)=ZXkoN;sb&U^9dm`BM~dJ?lX&znRQM#sEgQ4)8Z$!DKh(verM
z)u65{e{%iG8!^`e*HbS(iaLH|I6L%^r6zOIWp~N<`QFqAjTUP%ww_RTv{};y>voz&
z6*L|1yR46@KDA0Nh^T3Z9?-5@Mb(Sy-}R%2J>IEb{oHE$rY0RujraGz|3=CqA(IU)
z;|G|O*i}dA>*=HUgrez5Dq2MH?tMG!+7c_MY!;X|-DxHgc4A@AZZ~P3x$m|cG_1ZY
zt7;!NR?|K!pk6)v1<&`)(TslczB~BF`l%1{dG{~y(sDJk`3kSF=UB{Mf~WauiY|$N
z$W7Ao{LYvWy`7%BUQAU|^PbQ?u)oW7jpO}<b=UhOYgO-Q)-6tgCLrYZvCKZtI`Hb{
IScK~S1HjrLApigX
literal 0
HcmV?d00001
--
1.8.3.1
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel