summaryrefslogtreecommitdiff
path: root/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2017-04-27 11:05:07 +0800
committerGuo Mang <mang.guo@intel.com>2017-04-27 11:05:07 +0800
commitc23f114d3cfbb29b8734b87213d1ec0de404197b (patch)
tree4f3612573be055139a88213559212a40b7862fee /Core/MdeModulePkg/Universal/HiiResourcesSampleDxe
parent001e57a103fce87245bfb7ae9c32ffb499a64135 (diff)
downloadedk2-platforms-c23f114d3cfbb29b8734b87213d1ec0de404197b.tar.xz
MdeModulePkg: Move to new location
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Core/MdeModulePkg/Universal/HiiResourcesSampleDxe')
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c152
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.uni24
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleDxe.inf60
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleExtra.uni20
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/Sample.vfr45
-rw-r--r--Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/SampleStrings.uni44
6 files changed, 345 insertions, 0 deletions
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c
new file mode 100644
index 0000000000..adce780e09
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.c
@@ -0,0 +1,152 @@
+/** @file
+This is an example of how a driver retrieve HII data using HII Package List
+Protocol, and how to publish the HII data.
+
+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.
+
+**/
+
+#include <Uefi.h>
+#include <Guid/HiiResourceSampleHii.h>
+#include <Protocol/HiiPackageList.h>
+#include <Library/DevicePathLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiHiiServicesLib.h>
+#include <Library/HiiLib.h>
+
+#pragma pack(1)
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+#pragma pack()
+
+
+EFI_HII_HANDLE mHiiHandle = NULL;
+EFI_HANDLE mDriverHandle = NULL;
+
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ HII_RESOURCE_SAMPLE_FORM_SET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Main entry for this driver.
+
+ @param[in] ImageHandle Image handle this driver.
+ @param[in] SystemTable Pointer to SystemTable.
+
+ @retval EFI_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+HiiResourcesSampleInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+
+ //
+ // Retrieve HII package list from ImageHandle
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **) &PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish sample Fromset
+ //
+ Status = gBS->InstallProtocolInterface (
+ &mDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mHiiVendorDevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish HII package list to HII Database.
+ //
+ Status = gHiiDatabase->NewPackageList (
+ gHiiDatabase,
+ PackageList,
+ mDriverHandle,
+ &mHiiHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+HiiResourcesSampleUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ if (mDriverHandle != NULL) {
+ gBS->UninstallProtocolInterface (
+ mDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath
+ );
+ mDriverHandle = NULL;
+ }
+
+ if (mHiiHandle != NULL) {
+ HiiRemovePackages (mHiiHandle);
+ mHiiHandle = NULL;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.uni b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.uni
new file mode 100644
index 0000000000..acef41e282
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSample.uni
@@ -0,0 +1,24 @@
+// /** @file
+// This is a sample HII resource driver.
+//
+// This driver show how a HII driver retrieve HII data using HII Package List protocol
+// and publish the HII data.
+//
+// Copyright (c) 2009 - 2014, 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.
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "A sample HII resource driver"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This driver show how a HII driver retrieve HII data using HII Package List protocol\n"
+ "and publish the HII data."
+
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleDxe.inf b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleDxe.inf
new file mode 100644
index 0000000000..51a598cb05
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleDxe.inf
@@ -0,0 +1,60 @@
+## @file
+# This is a sample HII resource driver.
+#
+# This driver show how a HII driver retrieve HII data using HII Package List protocol
+# and publish the HII data.
+#
+# Copyright (c) 2009 - 2014, 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.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = HiiResourcesSample
+ MODULE_UNI_FILE = HiiResourcesSample.uni
+ FILE_GUID = D49D2EB0-44D5-4621-9FD6-1A92C9109B99
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = HiiResourcesSampleInit
+ UNLOAD_IMAGE = HiiResourcesSampleUnload
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ HiiResourcesSample.c
+ SampleStrings.uni
+ Sample.vfr
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiHiiServicesLib
+ HiiLib
+
+[Protocols]
+ gEfiHiiPackageListProtocolGuid ## CONSUMES
+ gEfiDevicePathProtocolGuid ## PRODUCES
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ HiiResourcesSampleExtra.uni
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleExtra.uni b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleExtra.uni
new file mode 100644
index 0000000000..b7c85c1cc5
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/HiiResourcesSampleExtra.uni
@@ -0,0 +1,20 @@
+// /** @file
+// HiiResourcesSample Localized Strings and Content
+//
+// Copyright (c) 2013 - 2014, 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.
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"HII Resources Sample DXE Driver"
+
+
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/Sample.vfr b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/Sample.vfr
new file mode 100644
index 0000000000..3ca20988e8
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/Sample.vfr
@@ -0,0 +1,45 @@
+// *++
+//
+// 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:
+//
+// Sample.vfr
+//
+// Abstract:
+//
+// Sample Form.
+//
+// Revision History:
+//
+// --*/
+
+#include <Guid/HiiResourceSampleHii.h>
+
+formset
+ guid = HII_RESOURCE_SAMPLE_FORM_SET_GUID,
+ title = STRING_TOKEN(STR_SAMPLE_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_SAMPLE_FORM_SET_HELP),
+
+ form formid = 1,
+ title = STRING_TOKEN(STR_SAMPLE_FORM1_TITLE);
+
+ text
+ help = STRING_TOKEN(STR_SAMPLE_VERSION_HELP),
+ text = STRING_TOKEN(STR_SAMPLE_VERSION_TEXT),
+ text = STRING_TOKEN(STR_SAMPLE_EMPTY);
+
+ subtitle text = STRING_TOKEN(STR_SAMPLE_EMPTY);
+
+ subtitle text = STRING_TOKEN(STR_SAMPLE_ESC);
+
+ endform;
+
+endformset;
diff --git a/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/SampleStrings.uni b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/SampleStrings.uni
new file mode 100644
index 0000000000..f3464b38fe
--- /dev/null
+++ b/Core/MdeModulePkg/Universal/HiiResourcesSampleDxe/SampleStrings.uni
@@ -0,0 +1,44 @@
+// *++
+//
+// Copyright (c) 2009, 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:
+//
+// SampleStrings.uni
+//
+// Abstract:
+//
+// String definitions for Sample.vfr
+//
+// Revision History:
+//
+// --*/
+
+
+/=#
+
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+
+
+#string STR_SAMPLE_FORM_SET_TITLE #language en-US "HII Resource Section Sample"
+ #language fr-FR "HII Resource Section Sample"
+#string STR_SAMPLE_FORM_SET_HELP #language en-US "This HII Package List is built in PE/COFF .rsrc section"
+ #language fr-FR "This HII Package List is built in PE/COFF .rsrc section"
+#string STR_SAMPLE_FORM1_TITLE #language en-US "Sample Form"
+ #language fr-FR "Sample Form"
+#string STR_SAMPLE_VERSION_TEXT #language en-US "Firmware Revision EDKII"
+ #language fr-FR "Firmware Revision EDKII"
+#string STR_SAMPLE_VERSION_HELP #language en-US "The date of the revision of the Firmware being used."
+ #language fr-FR "The date of the revision of the Firmware being used."
+#string STR_SAMPLE_ESC #language en-US "Press ESC to exit."
+ #language fr-FR "Press ESC to exit."
+#string STR_SAMPLE_EMPTY #language en-US ""
+ #language fr-FR ""