mirror of https://github.com/acidanthera/audk.git
Port DriverSample.inf, HiiDatabase.inf and SetupBrowser.inf
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2915 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
61a30832e1
commit
103b65209d
|
@ -77,8 +77,11 @@
|
|||
DxeServicesTableLib|${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
FvbServiceLib|${WORKSPACE}/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
|
||||
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
HiiLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf
|
||||
IfrSupportLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf
|
||||
PciIncompatibleDeviceSupportLib|${WORKSPACE}/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf
|
||||
|
||||
|
||||
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
|
||||
HobLib|${WORKSPACE}/MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
MemoryAllocationLib|${WORKSPACE}/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
|
||||
|
@ -91,6 +94,8 @@
|
|||
UefiRuntimeLib|${WORKSPACE}/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
UefiRuntimeServicesTableLib|${WORKSPACE}/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
HiiLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf
|
||||
IfrSupportLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
@ -159,3 +164,7 @@
|
|||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHubStdErr\Dxe\DataHubStdErr.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\StatusCode\Dxe\DxeStatusCode.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\HiiDataBaseDxe\HiiDatabase.inf
|
||||
# $(WORKSPACE)\IntelFrameworkModulePkg\Universal\UserInterface\SetupBrowser\Dxe\SetupBrowser.inf
|
||||
# $(WORKSPACE)\IntelFrameworkModulePkg\Universal\DriverSampleDxe\DriverSample.inf
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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 __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/FormCallback.h>
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/IfrSupportLibFramework.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/HiiLibFramework.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,598 @@
|
|||
/*++
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
DriverSample.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This is an example of how a driver might export data to the HII protocol to be
|
||||
later utilized by the Setup Protocol
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DriverSample.h"
|
||||
|
||||
#define DISPLAY_ONLY_MY_ITEM 0x0001
|
||||
|
||||
#define STRING_PACK_GUID \
|
||||
{ \
|
||||
0x8160a85f, 0x934d, 0x468b, { 0xa2, 0x35, 0x72, 0x89, 0x59, 0x14, 0xf6, 0xfc } \
|
||||
}
|
||||
|
||||
EFI_GUID mFormSetGuid = FORMSET_GUID;
|
||||
EFI_GUID mStringPackGuid = STRING_PACK_GUID;
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DriverCallback (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *Data,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the function that is called to provide results data to the driver. This data
|
||||
consists of a unique key which is used to identify what data is either being passed back
|
||||
or being asked for.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyValue - A unique value which is sent to the original exporting driver so that it
|
||||
can identify the type of data to expect. The format of the data tends to
|
||||
vary based on the op-code that geerated the callback.
|
||||
|
||||
Data - A pointer to the data being sent to the original exporting driver.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_CALLBACK_INFO *Private;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
UINT8 *Location;
|
||||
EFI_HII_CALLBACK_PACKET *DataPacket;
|
||||
UINT16 Value;
|
||||
CHAR16 VariableName[40];
|
||||
STATIC UINT16 QuestionId = 0;
|
||||
IFR_OPTION *OptionList;
|
||||
UINTN Index;
|
||||
MyIfrNVData NVStruc;
|
||||
|
||||
Private = EFI_CALLBACK_INFO_FROM_THIS (This);
|
||||
|
||||
//
|
||||
// This should tell me the first offset AFTER the end of the compiled NV map
|
||||
// If op-code results are not going to be saved to NV locations ensure the QuestionId
|
||||
// is beyond the end of the NVRAM mapping.
|
||||
//
|
||||
if (QuestionId == 0) {
|
||||
QuestionId = sizeof (MyIfrNVData);
|
||||
}
|
||||
|
||||
ZeroMem (VariableName, (sizeof (CHAR16) * 40));
|
||||
|
||||
switch (KeyValue) {
|
||||
case 0x0001:
|
||||
//
|
||||
// Create a small boot order list
|
||||
//
|
||||
QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));
|
||||
|
||||
//
|
||||
// Need some memory for OptionList. Allow for up to 8 options.
|
||||
//
|
||||
OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
|
||||
ASSERT (OptionList != NULL);
|
||||
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
//
|
||||
// Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
|
||||
// so we don't have to keep track of how many op-codes we added or subtracted. The rules for removal
|
||||
// of op-codes are simply that the removal will always stop as soon as a label or the end of a form is
|
||||
// encountered. Therefore, giving a large obnoxious count such as below takes care of other complexities.
|
||||
//
|
||||
UpdateData->DataCount = 0xFF;
|
||||
|
||||
//
|
||||
// Delete set of op-codes
|
||||
//
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x2222,
|
||||
FALSE, // If we aren't adding, we are deleting
|
||||
UpdateData
|
||||
);
|
||||
|
||||
//
|
||||
// Create 3 options
|
||||
//
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);
|
||||
OptionList[Index].Value = (UINT16) (Index + 1);
|
||||
OptionList[Index].Flags = RESET_REQUIRED;
|
||||
}
|
||||
|
||||
CreateOrderedListOpCode (
|
||||
QuestionId, // Question ID
|
||||
8, // Max Entries
|
||||
(UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt
|
||||
(UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help
|
||||
OptionList,
|
||||
3,
|
||||
&UpdateData->Data // Buffer location to place op-codes
|
||||
);
|
||||
|
||||
//
|
||||
// For one-of/ordered lists commands, they really consist of 2 op-codes (a header and a footer)
|
||||
// Each option within a one-of/ordered list is also an op-code
|
||||
// So this example has 5 op-codes it is adding since we have a one-of header + 3 options + one-of footer
|
||||
//
|
||||
UpdateData->DataCount = 0x5;
|
||||
|
||||
//
|
||||
// Add one op-code
|
||||
//
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x2222,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
FreePool (UpdateData);
|
||||
FreePool (OptionList);
|
||||
break;
|
||||
|
||||
case 0x0002:
|
||||
//
|
||||
// Create a large boot order list
|
||||
//
|
||||
QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));
|
||||
|
||||
//
|
||||
// Need some memory for OptionList. Allow for up to 8 options.
|
||||
//
|
||||
OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
|
||||
ASSERT (OptionList != NULL);
|
||||
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
//
|
||||
// Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
|
||||
// so we don't have to keep track of how many op-codes we added or subtracted
|
||||
//
|
||||
UpdateData->DataCount = 0xFF;
|
||||
|
||||
//
|
||||
// Delete one op-code
|
||||
//
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x2222,
|
||||
FALSE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
//
|
||||
// Create 4 options
|
||||
//
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);
|
||||
OptionList[Index].Value = (UINT16) (Index + 1);
|
||||
OptionList[Index].Flags = RESET_REQUIRED;
|
||||
}
|
||||
|
||||
CreateOrderedListOpCode (
|
||||
QuestionId, // Question ID
|
||||
8, // Max Entries
|
||||
(UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt
|
||||
(UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help
|
||||
OptionList,
|
||||
4,
|
||||
&UpdateData->Data // Buffer location to place op-codes
|
||||
);
|
||||
|
||||
//
|
||||
// For one-of commands, they really consist of 2 op-codes (a header and a footer)
|
||||
// Each option within a one-of is also an op-code
|
||||
// So this example has 6 op-codes it is adding since we have a one-of header + 4 options + one-of footer
|
||||
//
|
||||
UpdateData->DataCount = 0x6;
|
||||
|
||||
//
|
||||
// Add one op-code
|
||||
//
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x2222,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
FreePool (UpdateData);
|
||||
FreePool (OptionList);
|
||||
break;
|
||||
|
||||
case 0x1234:
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
QuestionId = (UINT16) ((UINTN) (&NVStruc.DynamicCheck) - (UINTN) (&NVStruc));
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
Location = (UINT8 *) &UpdateData->Data;
|
||||
|
||||
UpdateData->FormSetUpdate = TRUE;
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->CallbackHandle;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 2;
|
||||
|
||||
CreateGotoOpCode (
|
||||
1,
|
||||
STR_GOTO_FORM1, // Token value for the Prompt
|
||||
0, // Goto Help
|
||||
0, // Flags
|
||||
0, // Key
|
||||
&UpdateData->Data // Buffer location to place op-codes
|
||||
);
|
||||
|
||||
Location = Location + ((EFI_IFR_OP_HEADER *) &UpdateData->Data)->Length;
|
||||
|
||||
CreateCheckBoxOpCode (
|
||||
QuestionId, // Question ID
|
||||
1, // Data width (BOOLEAN = 1)
|
||||
(UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_PROMPT), // Token value for the Prompt
|
||||
(UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_HELP), // Token value for the Help
|
||||
EFI_IFR_FLAG_INTERACTIVE, // Flags
|
||||
0x1236, // Key
|
||||
Location // Buffer location to place op-codes
|
||||
);
|
||||
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x1234,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
FreePool (UpdateData);
|
||||
QuestionId++;
|
||||
break;
|
||||
|
||||
case 0x1235:
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
//
|
||||
// Initialize DataPacket with information intended to remove all
|
||||
// previously created op-codes in the dynamic page
|
||||
//
|
||||
UpdateData->FormSetUpdate = FALSE;
|
||||
UpdateData->FormCallbackHandle = 0;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
//
|
||||
// Unlikely to be more than 0xff op-codes in the dynamic page to remove
|
||||
//
|
||||
UpdateData->DataCount = 0xff;
|
||||
UpdateData->Data = NULL;
|
||||
|
||||
//
|
||||
// Remove all op-codes from dynamic page
|
||||
//
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x1234, // Label 0x1234
|
||||
FALSE, // Remove Op-codes (will never remove form/endform)
|
||||
UpdateData // Significant value is UpdateData->DataCount
|
||||
);
|
||||
|
||||
UpdateData->FormSetUpdate = FALSE;
|
||||
UpdateData->FormCallbackHandle = 0;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
CreateGotoOpCode (
|
||||
1,
|
||||
STR_GOTO_FORM1, // Token value for the Prompt
|
||||
0, // Goto Help
|
||||
0, // Flags
|
||||
0, // Key
|
||||
&UpdateData->Data // Buffer location to place op-codes
|
||||
);
|
||||
|
||||
Private->Hii->UpdateForm (
|
||||
Private->Hii,
|
||||
Private->RegisteredHandle,
|
||||
(EFI_FORM_LABEL) 0x1234,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
FreePool (UpdateData);
|
||||
break;
|
||||
|
||||
case 0x1236:
|
||||
//
|
||||
// If I hit the checkbox, I enter this case statement...
|
||||
//
|
||||
//
|
||||
// Since I am returning an error (for test purposes) I need to pass in the string for the error
|
||||
// I will allocate space for the return value. If an error occurs (which is the case) I can simply return
|
||||
// an error and fill in the string parameter, otherwise, I will return information in the DataArray structure.
|
||||
// The browser will free this packet structure
|
||||
//
|
||||
*Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);
|
||||
ASSERT (*Packet != NULL);
|
||||
|
||||
//
|
||||
// Assign the buffer address to DataPacket
|
||||
//
|
||||
DataPacket = *Packet;
|
||||
|
||||
StrCpy (DataPacket->String, (CHAR16 *) SAMPLE_STRING);
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
||||
case 0x1237:
|
||||
|
||||
*Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
|
||||
ASSERT (*Packet != NULL);
|
||||
|
||||
//
|
||||
// Assign the buffer address to DataPacket
|
||||
//
|
||||
DataPacket = *Packet;
|
||||
|
||||
DataPacket->DataArray.EntryCount = 1;
|
||||
DataPacket->DataArray.NvRamMap = NULL;
|
||||
((EFI_IFR_DATA_ENTRY *) (&DataPacket->DataArray + 1))->Flags = EXIT_REQUIRED;
|
||||
break;
|
||||
|
||||
case 0x1555:
|
||||
Value = 0x0001;
|
||||
UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
|
||||
|
||||
gRT->SetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
2,
|
||||
(VOID *) &Value
|
||||
);
|
||||
break;
|
||||
|
||||
case 0x1556:
|
||||
Value = 0x1000;
|
||||
UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
|
||||
|
||||
gRT->SetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
2,
|
||||
(VOID *) &Value
|
||||
);
|
||||
break;
|
||||
|
||||
case 0x1557:
|
||||
Value = 0x0000;
|
||||
UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
|
||||
|
||||
gRT->SetVariable (
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
2,
|
||||
(VOID *) &Value
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DriverSampleInit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
//
|
||||
// EFI_FORM_BROWSER_PROTOCOL *FormConfig;
|
||||
//
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
STRING_REF TokenToUpdate;
|
||||
STRING_REF TokenToUpdate2;
|
||||
STRING_REF TokenToUpdate3;
|
||||
CHAR16 *NewString;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
EFI_CALLBACK_INFO *CallbackInfo;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_SCREEN_DESCRIPTOR Screen;
|
||||
|
||||
ZeroMem (&Screen, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Screen.RightColumn, &Screen.BottomRow);
|
||||
|
||||
//
|
||||
// Remove 3 characters from top and bottom
|
||||
//
|
||||
Screen.TopRow = 3;
|
||||
Screen.BottomRow = Screen.BottomRow - 3;
|
||||
|
||||
//
|
||||
// There should only be one HII protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &Hii
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;;
|
||||
}
|
||||
|
||||
CallbackInfo = AllocatePool (sizeof (EFI_CALLBACK_INFO));
|
||||
if (CallbackInfo == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;
|
||||
CallbackInfo->Hii = Hii;
|
||||
|
||||
//
|
||||
// This example does not implement worker functions for the NV accessor functions. Only a callback evaluator
|
||||
//
|
||||
CallbackInfo->DriverCallback.NvRead = NULL;
|
||||
CallbackInfo->DriverCallback.NvWrite = NULL;
|
||||
CallbackInfo->DriverCallback.Callback = DriverCallback;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
&gEfiFormCallbackProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&CallbackInfo->DriverCallback
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
CallbackInfo->CallbackHandle = Handle;
|
||||
|
||||
PackageList = PreparePackages (1, &mStringPackGuid, DriverSampleStrings);
|
||||
Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
|
||||
FreePool (PackageList);
|
||||
|
||||
PackageList = PreparePackages (1, &mStringPackGuid, InventoryBin);
|
||||
Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
|
||||
FreePool (PackageList);
|
||||
|
||||
PackageList = PreparePackages (1, &mStringPackGuid, VfrBin);
|
||||
Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
|
||||
FreePool (PackageList);
|
||||
|
||||
CallbackInfo->RegisteredHandle = HiiHandle;
|
||||
|
||||
//
|
||||
// Very simple example of how one would update a string that is already
|
||||
// in the HII database
|
||||
//
|
||||
TokenToUpdate = (STRING_REF) STR_CPU_STRING2;
|
||||
NewString = (CHAR16 *) L"700 Mhz";
|
||||
|
||||
Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, NewString);
|
||||
|
||||
//
|
||||
// Add a string - if 0 will be updated with new Token number
|
||||
//
|
||||
TokenToUpdate = (STRING_REF) 0;
|
||||
|
||||
//
|
||||
// Add a string - if 0 will be updated with new Token number
|
||||
//
|
||||
TokenToUpdate2 = (STRING_REF) 0;
|
||||
|
||||
//
|
||||
// Add a string - if 0 will be updated with new Token number
|
||||
//
|
||||
TokenToUpdate3 = (STRING_REF) 0;
|
||||
|
||||
Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, (CHAR16 *) L"Desired Speed");
|
||||
Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate2, (CHAR16 *) L"5 Thz");
|
||||
Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate3, (CHAR16 *) L"This is next year's desired speed - right?");
|
||||
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
//
|
||||
// Flag update pending in FormSet
|
||||
//
|
||||
UpdateData->FormSetUpdate = TRUE;
|
||||
//
|
||||
// Register CallbackHandle data for FormSet
|
||||
//
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackInfo->CallbackHandle;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
CreateTextOpCode (TokenToUpdate, TokenToUpdate2, TokenToUpdate3, 0, 0, &UpdateData->Data);
|
||||
|
||||
Hii->UpdateForm (Hii, HiiHandle, (EFI_FORM_LABEL) 100, TRUE, UpdateData);
|
||||
|
||||
FreePool (UpdateData);
|
||||
|
||||
//
|
||||
// Example of how to display only the item we sent to HII
|
||||
//
|
||||
if (DISPLAY_ONLY_MY_ITEM == 0x0001) {
|
||||
//
|
||||
// Have the browser pull out our copy of the data, and only display our data
|
||||
//
|
||||
// Status = FormConfig->SendForm (FormConfig, TRUE, HiiHandle, NULL, NULL, NULL, &Screen, NULL);
|
||||
//
|
||||
} else {
|
||||
//
|
||||
// Have the browser pull out all the data in the HII Database and display it.
|
||||
//
|
||||
// Status = FormConfig->SendForm (FormConfig, TRUE, 0, NULL, NULL, NULL, NULL, NULL);
|
||||
//
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
DriverSample.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file.
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID
|
||||
DEPENDENCY_END
|
|
@ -0,0 +1,64 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
DriverSample.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _DRIVER_SAMPLE_H
|
||||
#define _DRIVER_SAMPLE_H
|
||||
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "NVDataStruc.h"
|
||||
|
||||
//
|
||||
// This is the generated header file which includes whatever needs to be exported (strings + IFR)
|
||||
//
|
||||
|
||||
extern UINT8 VfrBin[];
|
||||
//
|
||||
// extern UINT8 VfrStringsStr[];
|
||||
//
|
||||
extern UINT8 InventoryBin[];
|
||||
//
|
||||
// extern UINT8 InventoryStringsStr[];
|
||||
//
|
||||
extern UINT8 DriverSampleStrings[];
|
||||
|
||||
#define SAMPLE_STRING L"This is an error!"
|
||||
|
||||
#define EFI_CALLBACK_INFO_SIGNATURE EFI_SIGNATURE_32 ('C', 'l', 'b', 'k')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE CallbackHandle;
|
||||
EFI_FORM_CALLBACK_PROTOCOL DriverCallback;
|
||||
UINT16 *KeyList;
|
||||
VOID *FormBuffer;
|
||||
EFI_HII_HANDLE RegisteredHandle;
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
} EFI_CALLBACK_INFO;
|
||||
|
||||
#define EFI_CALLBACK_INFO_FROM_THIS(a) CR (a, EFI_CALLBACK_INFO, DriverCallback, EFI_CALLBACK_INFO_SIGNATURE)
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
#/** @file
|
||||
# Component description file for DriverSample module.
|
||||
#
|
||||
# This is an example driver to introduce how to export data to the HII protocol to be later utilized by the Setup Protocol.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
#
|
||||
# All rights reserved. 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 Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DriverSample
|
||||
FILE_GUID = FE3542FE-C1D3-4EF8-657C-8048606FF670
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = DriverSampleInit
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
DriverSample.dxs
|
||||
DriverSample.h
|
||||
NVDataStruc.h
|
||||
DriverSample.c
|
||||
Vfr.vfr
|
||||
VfrStrings.uni
|
||||
Inventory.vfr
|
||||
InventoryStrings.uni
|
||||
CommonHeader.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/IntelFrameworkPkg/Include/Library
|
||||
$(WORKSPACE)/MdePkg/Include/Library
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
HiiLibFramework
|
||||
MemoryAllocationLib
|
||||
BaseMemoryLib
|
||||
IfrSupportLibFramework
|
||||
PrintLib
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiFormCallbackProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiHiiProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>DriverSample</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>FE3542FE-C1D3-4EF8-657C-8048606FF670</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for DriverSample module.</Abstract>
|
||||
<Description>This is an example driver to introduce how to export data to the HII protocol to be later utilized by the Setup Protocol. </Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. 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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>DriverSample</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is BasePrintLib instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkIfrSupportLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HiiLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>InventoryStrings.uni</Filename>
|
||||
<Filename>Inventory.vfr</Filename>
|
||||
<Filename>VfrStrings.uni</Filename>
|
||||
<Filename>Vfr.vfr</Filename>
|
||||
<Filename>DriverSample.c</Filename>
|
||||
<Filename>NVDataStruc.h</Filename>
|
||||
<Filename>DriverSample.h</Filename>
|
||||
<Filename>DriverSample.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<HiiPackages>
|
||||
<HiiPackage Usage="ALWAYS_PRODUCED">
|
||||
<HiiCName>DriverSampleStrings</HiiCName>
|
||||
<HelpText>EFI_HII_STRING type string package from UNI file.</HelpText>
|
||||
</HiiPackage>
|
||||
<HiiPackage Usage="ALWAYS_PRODUCED">
|
||||
<HiiCName>InventoryBin</HiiCName>
|
||||
<HelpText>EFI_HII_IFR type form package from VFR file.</HelpText>
|
||||
</HiiPackage>
|
||||
<HiiPackage Usage="ALWAYS_PRODUCED">
|
||||
<HiiCName>VfrBin</HiiCName>
|
||||
<HelpText>EFI_HII_IFR type form package from VFR file.</HelpText>
|
||||
</HiiPackage>
|
||||
</HiiPackages>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>DriverSampleInit</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,128 @@
|
|||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
// *++
|
||||
//
|
||||
// Copyright (c) 2006, Intel Corporation
|
||||
// All rights reserved. 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:
|
||||
//
|
||||
// Inventory.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Sample Inventory Data.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "DriverSampleStrDefs.h"
|
||||
|
||||
#define INVENTORY_GUID { 0xb3f56470, 0x6141, 0x4621, { 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 } }
|
||||
|
||||
formset
|
||||
guid = INVENTORY_GUID,
|
||||
title = STRING_TOKEN(STR_INV_FORM_SET_TITLE),
|
||||
help = STRING_TOKEN(STR_INV_FORM_SET_HELP),
|
||||
class = 0x04,
|
||||
subclass = 0x03,
|
||||
|
||||
form formid = 1,
|
||||
title = STRING_TOKEN(STR_INV_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_VERSION_HELP),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT2),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT3),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT4),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT5),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT6),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT7),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT8),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT9),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT10),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
text = STRING_TOKEN(STR_INV_VERSION_TEXT11),
|
||||
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INV_VERSION_TEXT12);
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
Binary file not shown.
|
@ -0,0 +1,67 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
NVDataStruc.h
|
||||
|
||||
Abstract:
|
||||
|
||||
NVData structure used by the sample driver
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _NVDATASTRUC_H
|
||||
#define _NVDATASTRUC_H
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#define FORMSET_GUID \
|
||||
{ \
|
||||
0xA04A27f4, 0xDF00, 0x4D42, { 0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D } \
|
||||
}
|
||||
|
||||
#define INVENTORY_GUID \
|
||||
{ \
|
||||
0xb3f56470, 0x6141, 0x4621, { 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 } \
|
||||
}
|
||||
|
||||
#define VAR_EQ_TEST_NAME 0x100
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 WhatIsThePassword[20];
|
||||
UINT16 WhatIsThePassword2[20];
|
||||
UINT16 MyStringData[20];
|
||||
UINT16 SomethingHiddenForHtml;
|
||||
UINT8 HowOldAreYouInYearsManual;
|
||||
UINT16 HowTallAreYouManual;
|
||||
UINT8 HowOldAreYouInYears;
|
||||
UINT16 HowTallAreYou;
|
||||
UINT8 MyFavoriteNumber;
|
||||
UINT8 TestLateCheck;
|
||||
UINT8 TestLateCheck2;
|
||||
UINT8 QuestionAboutTreeHugging;
|
||||
UINT8 ChooseToActivateNuclearWeaponry;
|
||||
UINT8 SuppressGrayOutSomething;
|
||||
UINT8 OrderedList[8];
|
||||
UINT8 BootOrder[8];
|
||||
UINT8 BootOrderLarge;
|
||||
UINT8 DynamicCheck;
|
||||
} MyIfrNVData;
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
|
@ -0,0 +1,627 @@
|
|||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
// *++
|
||||
//
|
||||
// Copyright (c) 2006, Intel Corporation
|
||||
// All rights reserved. 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:
|
||||
//
|
||||
// Vfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Sample Setup formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
|
||||
#include "DriverSampleStrDefs.h"
|
||||
|
||||
#include "NVDataStruc.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT8 Field8;
|
||||
UINT16 Field16;
|
||||
UINT8 OrderedList[3];
|
||||
} MyIfrNVData2;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Field8;
|
||||
UINT16 Field16;
|
||||
UINT8 OrderedList[3];
|
||||
} MyIfrNVData3;
|
||||
|
||||
#define MY_TEXT_KEY 0x100
|
||||
|
||||
#define LABEL_1_VALUE 0x01
|
||||
#define LABEL_2_VALUE 0x1000
|
||||
#define LABEL_UPDATE_BBS 0x2222
|
||||
#define LABEL_END_UPDATE_BBS 0x2223
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
|
||||
class = 0x10,
|
||||
subclass = 0,
|
||||
|
||||
varstore MyIfrNVData2, key = 0x1234, name = MY_DATA2, guid = FORMSET_GUID;
|
||||
|
||||
|
||||
varstore MyIfrNVData3, key = 0x4321, name = MY_DATA3, guid = FORMSET_GUID;
|
||||
|
||||
form formid = 1,
|
||||
title = STRING_TOKEN(STR_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_BANNER_TITLE),
|
||||
line 1,
|
||||
align center;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_BANNER_TITLE),
|
||||
line 2,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_BANNER_TITLE),
|
||||
line 2,
|
||||
align right;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_CPU_STRING),
|
||||
text = STRING_TOKEN(STR_CPU_STRING2),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
text = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
text = STRING_TOKEN(STR_EXIT_TEXT),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1237;
|
||||
|
||||
oneof varid = MyIfrNVData.SuppressGrayOutSomething,
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.BootOrderLarge,
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = INTERACTIVE, key = 1;
|
||||
option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = INTERACTIVE | DEFAULT, key = 2;
|
||||
endoneof;
|
||||
|
||||
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
|
||||
label 0;
|
||||
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
|
||||
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
|
||||
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
|
||||
flags = 1, // Flags behavior for checkbox is overloaded so that it equals a DEFAULT value. 1 = ON, 0 = off
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
endif;
|
||||
|
||||
|
||||
//
|
||||
// Ordered list:
|
||||
// sizeof(MyIfrNVData) storage must be UINT8 array, and
|
||||
// size written for the variable must be size of the entire
|
||||
// variable.
|
||||
//
|
||||
//
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
|
||||
label LABEL_UPDATE_BBS;
|
||||
orderedlist
|
||||
varid = MyIfrNVData.BootOrder,
|
||||
prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
|
||||
endlist;
|
||||
label LABEL_END_UPDATE_BBS;
|
||||
endif;
|
||||
|
||||
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
|
||||
orderedlist
|
||||
varid = MyIfrNVData.OrderedList,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE),
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 4, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 3, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 2, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_TEXT_HELP), value = 1, flags = RESET_REQUIRED;
|
||||
endlist;
|
||||
endif;
|
||||
|
||||
label 100;
|
||||
|
||||
goto 0x1234,
|
||||
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC),
|
||||
help = STRING_TOKEN(STR_GOTO_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1234;
|
||||
|
||||
goto 0x1234,
|
||||
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
|
||||
help = STRING_TOKEN(STR_GOTO_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1235;
|
||||
|
||||
//
|
||||
// VARSTORE tests
|
||||
//
|
||||
// Till now, been using variable NvData (must be reserved)
|
||||
// now we do a varselect for variable NvData3
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqid MyIfrNVData3.Field16 == MyIfrNVData3.Field16
|
||||
endif;
|
||||
// now we do a varselect_pair for variable NvData2 and NvData3
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqid MyIfrNVData2.Field16 == MyIfrNVData3.Field16
|
||||
endif;
|
||||
|
||||
|
||||
// now we do a varselect_pair for variable NvData and NvData2
|
||||
// inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
// ideqid MyIfrNVData2.Field16 == MyIfrNVData.TestLateCheck
|
||||
// endif;
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
|
||||
endif;
|
||||
|
||||
oneof varid = MyIfrNVData.TestLateCheck,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = LATE_CHECK | RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = LATE_CHECK | DEFAULT | RESET_REQUIRED;
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.TestLateCheck2,
|
||||
prompt = STRING_TOKEN(STR_TEST_OPCODE2),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = LATE_CHECK | DEFAULT | RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = LATE_CHECK | RESET_REQUIRED;
|
||||
|
||||
endoneof;
|
||||
|
||||
oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
|
||||
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
|
||||
help = STRING_TOKEN(STR_ONE_OF_HELP),
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
|
||||
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
|
||||
|
||||
endoneof;
|
||||
|
||||
string varid = MyIfrNVData.MyStringData,
|
||||
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
|
||||
help = STRING_TOKEN(STR_MY_STRING_HELP2),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1234,
|
||||
minsize = 6,
|
||||
maxsize = 0x14,
|
||||
endstring;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_GRAYOUT_TEST),
|
||||
text = STRING_TOKEN(STR_GRAYOUT_TEST),
|
||||
text = STRING_TOKEN(STR_GRAYOUT_TEST),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1555;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_SUPPRESS_TEST),
|
||||
text = STRING_TOKEN(STR_SUPPRESS_TEST),
|
||||
text = STRING_TOKEN(STR_SUPPRESS_TEST),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1556;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_CLEAR_TEST),
|
||||
text = STRING_TOKEN(STR_CLEAR_TEST),
|
||||
text = STRING_TOKEN(STR_CLEAR_TEST),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x1557;
|
||||
|
||||
grayoutif vareqval var(VAR_EQ_TEST_NAME) == 0x1;
|
||||
suppressif vareqval var(VAR_EQ_TEST_NAME) == 0x1000;
|
||||
label 30;
|
||||
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
|
||||
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
|
||||
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
|
||||
flags = 1,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
endif;
|
||||
|
||||
|
||||
numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP0),
|
||||
minimum = 0,
|
||||
maximum = 0xf0, // 0xf0 = 240 in decimal
|
||||
step = 0, // Stepping of 0 equates to a manual entering
|
||||
// of a value, otherwise it will auto-increment
|
||||
// with a left/right arrow
|
||||
default = 21,
|
||||
|
||||
endnumeric;
|
||||
|
||||
numeric varid = MyIfrNVData.HowTallAreYouManual,
|
||||
prompt = STRING_TOKEN(STR_TALL_MANUAL_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP1),
|
||||
minimum = 0,
|
||||
maximum = 300,
|
||||
step = 0, // Stepping of 0 equates to a manual entering
|
||||
// of a value, otherwise it will auto-increment
|
||||
// with a left/right arrow
|
||||
default = 175,
|
||||
|
||||
endnumeric;
|
||||
|
||||
inventory
|
||||
help = STRING_TOKEN(STR_INVENTORY_HELP),
|
||||
text = STRING_TOKEN(STR_INVENTORY_TEXT1),
|
||||
text = STRING_TOKEN(STR_INVENTORY_TEXT2);
|
||||
|
||||
|
||||
restore defaults,
|
||||
formid = 4,
|
||||
prompt = STRING_TOKEN(STR_RESTORE_DEFAULTS_PROMPT),
|
||||
help = STRING_TOKEN(STR_RESTORE_DEFAULTS_HELP),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
save defaults,
|
||||
formid = 4,
|
||||
prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
|
||||
help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
|
||||
flags = 0,
|
||||
key = 0;
|
||||
|
||||
//
|
||||
// Case with no flags or key
|
||||
//
|
||||
save defaults,
|
||||
formid = 4,
|
||||
prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
|
||||
help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP);
|
||||
//
|
||||
// Case with no key
|
||||
//
|
||||
save defaults,
|
||||
formid = 4,
|
||||
prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
|
||||
help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
|
||||
flags = 0;
|
||||
//
|
||||
// Case with no flags
|
||||
//
|
||||
save defaults,
|
||||
formid = 4,
|
||||
prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
|
||||
help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
|
||||
key = 0;
|
||||
|
||||
label LABEL_2_VALUE;
|
||||
|
||||
grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
numeric varid = MyIfrNVData.HowOldAreYouInYears,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_PROMPT),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP2),
|
||||
minimum = 0,
|
||||
maximum = 243,
|
||||
step = 3,
|
||||
default = 18,
|
||||
|
||||
endnumeric;
|
||||
|
||||
label LABEL_1_VALUE;
|
||||
|
||||
//
|
||||
// Numeric with no step or default specified
|
||||
//
|
||||
numeric varid = MyIfrNVData.HowTallAreYou,
|
||||
prompt = STRING_TOKEN(STR_NUMERIC_PROMPT1),
|
||||
help = STRING_TOKEN(STR_NUMERIC_HELP3),
|
||||
minimum = 0,
|
||||
maximum = 190,
|
||||
// step = 1, // Stepping of 1 if not specified
|
||||
// default = minimum; // if not specified
|
||||
endnumeric;
|
||||
endif;
|
||||
|
||||
string varid = MyIfrNVData.MyStringData,
|
||||
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
|
||||
help = STRING_TOKEN(STR_MY_STRING_HELP),
|
||||
minsize = 6,
|
||||
maxsize = 0x14,
|
||||
endstring;
|
||||
|
||||
password varid = MyIfrNVData.WhatIsThePassword,
|
||||
prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
|
||||
help = STRING_TOKEN(STR_PASSWORD_HELP),
|
||||
minsize = 6,
|
||||
maxsize = 20, // new opcode
|
||||
encoding = 1,
|
||||
endpassword;
|
||||
password varid = MyIfrNVData.WhatIsThePassword2,
|
||||
prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
|
||||
help = STRING_TOKEN(STR_PASSWORD_HELP),
|
||||
minsize = 6,
|
||||
maxsize = 20, // new opcode
|
||||
encoding = 1,
|
||||
endpassword;
|
||||
//
|
||||
// Test with flags and key fields
|
||||
//
|
||||
password varid = MyIfrNVData.WhatIsThePassword,
|
||||
prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
|
||||
help = STRING_TOKEN(STR_PASSWORD_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = 0x2000,
|
||||
minsize = 6,
|
||||
maxsize = 20, // new opcode
|
||||
encoding = 1,
|
||||
endpassword;
|
||||
|
||||
goto 2,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
goto 3,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 2, // SecondSetupPage,
|
||||
title = STRING_TOKEN(STR_FORM2_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
|
||||
date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_YEAR_HELP),
|
||||
minimum = 1998,
|
||||
maximum = 2099,
|
||||
step = 1,
|
||||
default = 2004,
|
||||
|
||||
month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_MONTH_HELP),
|
||||
minimum = 1,
|
||||
maximum = 12,
|
||||
step = 1,
|
||||
default = 1,
|
||||
|
||||
day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_DAY_HELP),
|
||||
minimum = 1,
|
||||
maximum = 31,
|
||||
step = 0x1,
|
||||
default = 1,
|
||||
|
||||
enddate;
|
||||
|
||||
time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_HOUR_HELP),
|
||||
minimum = 0,
|
||||
maximum = 23,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_SECOND_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
endtime;
|
||||
|
||||
date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_YEAR_HELP),
|
||||
minimum = 1939,
|
||||
maximum = 2101,
|
||||
step = 1,
|
||||
default = 1964,
|
||||
|
||||
month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_MONTH_HELP),
|
||||
minimum = 1,
|
||||
maximum = 12,
|
||||
step = 1,
|
||||
default = 1,
|
||||
|
||||
day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_DATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_DATE_DAY_HELP),
|
||||
minimum = 1,
|
||||
maximum = 31,
|
||||
step = 0x1,
|
||||
default = 1,
|
||||
|
||||
enddate;
|
||||
|
||||
time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_HOUR_HELP),
|
||||
minimum = 0,
|
||||
maximum = 23,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
|
||||
prompt = STRING_TOKEN(STR_TIME_PROMPT),
|
||||
help = STRING_TOKEN(STR_TIME_SECOND_HELP),
|
||||
minimum = 0,
|
||||
maximum = 59,
|
||||
step = 1,
|
||||
default = 0,
|
||||
|
||||
endtime;
|
||||
|
||||
grayoutif
|
||||
ideqval Date.Day == 21
|
||||
AND
|
||||
ideqval Date.Month == 8;
|
||||
|
||||
hidden value = 32, key = 0x7777;
|
||||
|
||||
endif; // grayoutif
|
||||
|
||||
suppressif
|
||||
ideqval Date.Day == 8
|
||||
AND
|
||||
ideqval Date.Month == 21;
|
||||
|
||||
hidden value = 32, key = 0x7777;
|
||||
|
||||
endif; // suppressif
|
||||
|
||||
|
||||
hidden value = 32, key = 0x1234;
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval MyIfrNVData.HowOldAreYouInYearsManual == 4
|
||||
endif;
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 2 3 4
|
||||
endif;
|
||||
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyIfrNVData.MyFavoriteNumber
|
||||
endif;
|
||||
|
||||
// grayoutif
|
||||
//
|
||||
// If the day is 31 AND months is any of the following 2, 4, 6, 9, 11
|
||||
//
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 31
|
||||
AND
|
||||
ideqvallist Date.Month == 2 4 6 9 11
|
||||
endif;
|
||||
|
||||
//
|
||||
// If the day is 30 AND month is 2
|
||||
//
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 30
|
||||
AND
|
||||
ideqval Date.Month == 2
|
||||
endif;
|
||||
|
||||
//
|
||||
// If the day is 29 AND month is 2 AND it year is NOT a leapyear
|
||||
//
|
||||
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
|
||||
ideqval Date.Day == 0x1D
|
||||
AND
|
||||
ideqval Date.Month == 2
|
||||
AND
|
||||
NOT
|
||||
ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
|
||||
endif;
|
||||
|
||||
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
|
||||
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
|
||||
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
|
||||
flags = 1,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_2),
|
||||
flags = 0,
|
||||
key = MY_TEXT_KEY;
|
||||
|
||||
goto 1,
|
||||
prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
|
||||
help = STRING_TOKEN(STR_GOTO_HELP);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1);
|
||||
|
||||
endif; //end grayoutif
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_TEXT_HELP),
|
||||
text = STRING_TOKEN(STR_TEXT_TEXT_1);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
|
||||
|
||||
endform;
|
||||
|
||||
form formid = 0x1234, // Dynamically created page,
|
||||
title = STRING_TOKEN(STR_DYNAMIC_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
|
||||
|
||||
label 0x1234;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
Binary file not shown.
|
@ -0,0 +1,41 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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 __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <FrameworkDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Protocol/FormCallback.h>
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/IfrSupportLibFramework.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,271 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Fonts.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the Glyph/Font processing code to the HII database.
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "HiiDatabase.h"
|
||||
|
||||
//
|
||||
// We only need to define a wide glyph, since we will seed the narrow glyph with EFI_NARROW_GLYPH size of
|
||||
// this data structure
|
||||
//
|
||||
UINT8 mUnknownGlyph[38] = {
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xAA,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xaa,
|
||||
0x55,
|
||||
0xAA
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetGlyph (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN CHAR16 *Source,
|
||||
IN OUT UINT16 *Index,
|
||||
OUT UINT8 **GlyphBuffer,
|
||||
OUT UINT16 *BitWidth,
|
||||
IN OUT UINT32 *InternalStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Translates a Unicode character into the corresponding font glyph.
|
||||
If the Source was pointing to a non-spacing character, the next Source[*Index]
|
||||
character will be parsed and OR'd to the GlyphBuffer until a spacing character
|
||||
is found in the Source. Since non-spacing characters are considered to be the
|
||||
same pixel width as a regular character their BitWidth will be reflected correctly
|
||||
however due to their special attribute, they are considered to be zero advancing width.
|
||||
This basically means that the cursor would not advance, thus the character that follows
|
||||
it would overlay the non-spacing character. The Index is modified to reflect both the
|
||||
incoming array entry into the Source string but also the outgoing array entry after having
|
||||
parsed the equivalent of a single Glyph's worth of data.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_GLOBAL_DATA *GlobalData;
|
||||
EFI_HII_DATA *HiiData;
|
||||
UINTN Count;
|
||||
BOOLEAN Narrow;
|
||||
UINTN Location;
|
||||
UINTN SearchLocation;
|
||||
UINTN Value;
|
||||
CHAR16 Character;
|
||||
UINTN Attributes;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
GlobalData = HiiData->GlobalData;
|
||||
Count = sizeof (GlobalData->NarrowGlyphs->GlyphCol1);
|
||||
|
||||
Location = *Index;
|
||||
SearchLocation = *Index;
|
||||
Narrow = TRUE;
|
||||
|
||||
if (Source[Location] == NARROW_CHAR || Source[Location] == WIDE_CHAR) {
|
||||
*InternalStatus = 0;
|
||||
}
|
||||
//
|
||||
// We don't know what glyph database to look in - let's figure it out
|
||||
//
|
||||
if (*InternalStatus == 0) {
|
||||
//
|
||||
// Determine if we are looking for narrow or wide glyph data
|
||||
//
|
||||
do {
|
||||
if (Source[SearchLocation] == NARROW_CHAR || Source[SearchLocation] == WIDE_CHAR) {
|
||||
//
|
||||
// We found something that identifies what glyph database to look in
|
||||
//
|
||||
if (Source[SearchLocation] == WIDE_CHAR) {
|
||||
Narrow = FALSE;
|
||||
*BitWidth = WIDE_WIDTH;
|
||||
*InternalStatus = WIDE_CHAR;
|
||||
Location++;
|
||||
break;
|
||||
} else {
|
||||
Narrow = TRUE;
|
||||
*BitWidth = NARROW_WIDTH;
|
||||
*InternalStatus = NARROW_CHAR;
|
||||
Location++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (SearchLocation-- > 0);
|
||||
}
|
||||
|
||||
if (*InternalStatus == NARROW_CHAR) {
|
||||
Narrow = TRUE;
|
||||
*BitWidth = NARROW_WIDTH;
|
||||
} else if (*InternalStatus == WIDE_CHAR) {
|
||||
Narrow = FALSE;
|
||||
*BitWidth = WIDE_WIDTH;
|
||||
} else {
|
||||
//
|
||||
// Without otherwise knowing what the width is narrow (e.g. someone passed in a string with index of 0
|
||||
// we wouldn't be able to determine the width of the data.)
|
||||
// BUGBUG - do we go to wide database and if exist, ignore narrow? Check Unicode spec....
|
||||
//
|
||||
Narrow = TRUE;
|
||||
*BitWidth = NARROW_WIDTH;
|
||||
}
|
||||
|
||||
Character = Source[Location];
|
||||
|
||||
if (Narrow) {
|
||||
if (GlobalData->NarrowGlyphs[Character].UnicodeWeight != 0x0000) {
|
||||
*GlyphBuffer = (UINT8 *) (&GlobalData->NarrowGlyphs[Character]);
|
||||
Attributes = GlobalData->NarrowGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
|
||||
} else {
|
||||
//
|
||||
// Glyph is uninitialized - return an error, but hand back the glyph
|
||||
//
|
||||
*GlyphBuffer = (UINT8 *) (&GlobalData->NarrowGlyphs[Character]);
|
||||
*Index = (UINT16) (Location + 1);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Wide character
|
||||
//
|
||||
if (GlobalData->WideGlyphs[Character].UnicodeWeight != 0x0000) {
|
||||
*GlyphBuffer = (UINT8 *) (&GlobalData->WideGlyphs[Character]);
|
||||
Attributes = GlobalData->WideGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
|
||||
} else {
|
||||
//
|
||||
// Glyph is uninitialized - return an error, but hand back the glyph
|
||||
//
|
||||
*GlyphBuffer = (UINT8 *) (&GlobalData->WideGlyphs[Character]);
|
||||
*Index = (UINT16) (Location + 1);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
//
|
||||
// This is a non-spacing character. It will be followed by either more non-spacing
|
||||
// characters or a regular character. We need to OR together the data associated with each.
|
||||
//
|
||||
for (; Attributes != 0; Location++) {
|
||||
//
|
||||
// Character is the Unicode value which is the index into the Glyph array.
|
||||
//
|
||||
Character = Source[Location];
|
||||
|
||||
if (Narrow) {
|
||||
for (Value = 0; Value != Count; Value++) {
|
||||
*GlyphBuffer[Location + Value] = (UINT8) (*GlyphBuffer[Location + Value] |
|
||||
GlobalData->NarrowGlyphs[Character].GlyphCol1[Value]);
|
||||
}
|
||||
|
||||
Attributes = GlobalData->NarrowGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
|
||||
} else {
|
||||
for (Value = 0; Value != Count; Value++) {
|
||||
*GlyphBuffer[Location + Value] = (UINT8) (*GlyphBuffer[Location + Value] |
|
||||
GlobalData->WideGlyphs[Character].GlyphCol1[Value]);
|
||||
*GlyphBuffer[Location + Value + Count] = (UINT8) (*GlyphBuffer[Location + Value + Count] |
|
||||
GlobalData->WideGlyphs[Character].GlyphCol2[Value]);
|
||||
}
|
||||
|
||||
Attributes = GlobalData->WideGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Source[*Index] should point to the next character to process
|
||||
//
|
||||
*Index = (UINT16) (Location + 1);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGlyphToBlt (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN UINT8 *GlyphBuffer,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
|
||||
IN UINTN Count,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
|
||||
)
|
||||
{
|
||||
UINTN X;
|
||||
UINTN Y;
|
||||
|
||||
//
|
||||
// Convert Monochrome bitmap of the Glyph to BltBuffer structure
|
||||
//
|
||||
for (Y = 0; Y < Height; Y++) {
|
||||
for (X = 0; X < Width; X++) {
|
||||
if ((((EFI_NARROW_GLYPH *) GlyphBuffer)->GlyphCol1[Y] & (1 << X)) != 0) {
|
||||
BltBuffer[Y * Width * Count + (Width - X - 1)] = Foreground;
|
||||
} else {
|
||||
BltBuffer[Y * Width * Count + (Width - X - 1)] = Background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,412 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
HiiDatabase.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the entry code to the HII database.
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "HiiDatabase.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeHiiDatabase (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Initialize HII Database
|
||||
|
||||
Arguments:
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Setup loaded.
|
||||
other - Setup Error
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_GLOBAL_DATA *GlobalData;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
EFI_HANDLE Handle;
|
||||
UINTN HandleCount;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// There will be only one HII Database in the system
|
||||
// If there is another out there, someone is trying to install us
|
||||
// again. Fail that scenario.
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiHiiProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// If there was no error, assume there is an installation and fail to load
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
HiiData = AllocatePool (sizeof (EFI_HII_DATA));
|
||||
|
||||
ASSERT (HiiData);
|
||||
|
||||
GlobalData = AllocateZeroPool (sizeof (EFI_HII_GLOBAL_DATA));
|
||||
|
||||
ASSERT (GlobalData);
|
||||
|
||||
//
|
||||
// Seed the Font Database with a known non-character glyph
|
||||
//
|
||||
for (Index = 0; Index <= MAX_GLYPH_COUNT; Index++) {
|
||||
//
|
||||
// Seeding the UnicodeWeight with 0 signifies that it is uninitialized
|
||||
//
|
||||
GlobalData->NarrowGlyphs[Index].UnicodeWeight = 0;
|
||||
GlobalData->WideGlyphs[Index].UnicodeWeight = 0;
|
||||
GlobalData->NarrowGlyphs[Index].Attributes = 0;
|
||||
GlobalData->WideGlyphs[Index].Attributes = 0;
|
||||
CopyMem (GlobalData->NarrowGlyphs[Index].GlyphCol1, &mUnknownGlyph, NARROW_GLYPH_ARRAY_SIZE);
|
||||
CopyMem (GlobalData->WideGlyphs[Index].GlyphCol1, &mUnknownGlyph, WIDE_GLYPH_ARRAY_SIZE);
|
||||
}
|
||||
//
|
||||
// Fill in HII data
|
||||
//
|
||||
HiiData->Signature = EFI_HII_DATA_SIGNATURE;
|
||||
HiiData->GlobalData = GlobalData;
|
||||
HiiData->GlobalData->SystemKeyboardUpdate = FALSE;
|
||||
HiiData->DatabaseHead = NULL;
|
||||
HiiData->Hii.NewPack = HiiNewPack;
|
||||
HiiData->Hii.RemovePack = HiiRemovePack;
|
||||
HiiData->Hii.FindHandles = HiiFindHandles;
|
||||
HiiData->Hii.ExportDatabase = HiiExportDatabase;
|
||||
HiiData->Hii.GetGlyph = HiiGetGlyph;
|
||||
HiiData->Hii.GetPrimaryLanguages = HiiGetPrimaryLanguages;
|
||||
HiiData->Hii.GetSecondaryLanguages = HiiGetSecondaryLanguages;
|
||||
HiiData->Hii.NewString = HiiNewString;
|
||||
HiiData->Hii.GetString = HiiGetString;
|
||||
HiiData->Hii.ResetStrings = HiiResetStrings;
|
||||
HiiData->Hii.TestString = HiiTestString;
|
||||
HiiData->Hii.GetLine = HiiGetLine;
|
||||
HiiData->Hii.GetForms = HiiGetForms;
|
||||
HiiData->Hii.GetDefaultImage = HiiGetDefaultImage;
|
||||
HiiData->Hii.UpdateForm = HiiUpdateForm;
|
||||
HiiData->Hii.GetKeyboardLayout = HiiGetKeyboardLayout;
|
||||
HiiData->Hii.GlyphToBlt = HiiGlyphToBlt;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
&gEfiHiiProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&HiiData->Hii
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiFindHandles (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN OUT UINT16 *HandleBufferLength,
|
||||
OUT EFI_HII_HANDLE Handle[1]
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determines the handles that are currently active in the database.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_HANDLE_DATABASE *Database;
|
||||
EFI_HII_DATA *HiiData;
|
||||
UINTN HandleCount;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
Database = HiiData->DatabaseHead;
|
||||
|
||||
if (Database == NULL) {
|
||||
*HandleBufferLength = 0;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (HandleCount = 0; Database != NULL; HandleCount++) {
|
||||
Database = Database->NextHandleDatabase;
|
||||
}
|
||||
//
|
||||
// Is there a sufficient buffer for the data being passed back?
|
||||
//
|
||||
if (*HandleBufferLength >= (sizeof (EFI_HII_HANDLE) * HandleCount)) {
|
||||
Database = HiiData->DatabaseHead;
|
||||
|
||||
//
|
||||
// Copy the Head information
|
||||
//
|
||||
if (Database->Handle != 0) {
|
||||
CopyMem (&Handle[0], &Database->Handle, sizeof (EFI_HII_HANDLE));
|
||||
Database = Database->NextHandleDatabase;
|
||||
}
|
||||
//
|
||||
// Copy more data if appropriate
|
||||
//
|
||||
for (HandleCount = 1; Database != NULL; HandleCount++) {
|
||||
CopyMem (&Handle[HandleCount], &Database->Handle, sizeof (EFI_HII_HANDLE));
|
||||
Database = Database->NextHandleDatabase;
|
||||
}
|
||||
|
||||
*HandleBufferLength = (UINT16) (sizeof (EFI_HII_HANDLE) * HandleCount);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
//
|
||||
// Insufficient buffer length
|
||||
//
|
||||
*HandleBufferLength = (UINT16) (sizeof (EFI_HII_HANDLE) * HandleCount);
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetPrimaryLanguages (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
OUT EFI_STRING *LanguageString
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function allows a program to determine what the primary languages that are supported on a given handle.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Count;
|
||||
EFI_HII_PACKAGE_INSTANCE *PackageInstance;
|
||||
EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_HANDLE_DATABASE *HandleDatabase;
|
||||
EFI_HII_STRING_PACK *StringPack;
|
||||
EFI_HII_STRING_PACK *Location;
|
||||
UINT32 Length;
|
||||
RELOFST Token;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
PackageInstance = NULL;
|
||||
//
|
||||
// Find matching handle in the handle database. Then get the package instance.
|
||||
//
|
||||
for (HandleDatabase = HiiData->DatabaseHead;
|
||||
HandleDatabase != NULL;
|
||||
HandleDatabase = HandleDatabase->NextHandleDatabase
|
||||
) {
|
||||
if (Handle == HandleDatabase->Handle) {
|
||||
PackageInstance = HandleDatabase->Buffer;
|
||||
}
|
||||
}
|
||||
//
|
||||
// No handle was found - error condition
|
||||
//
|
||||
if (PackageInstance == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
|
||||
|
||||
//
|
||||
// Based on if there is IFR data in this package instance, determine
|
||||
// what the location is of the beginning of the string data.
|
||||
//
|
||||
if (StringPackageInstance->IfrSize > 0) {
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
|
||||
} else {
|
||||
StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
|
||||
}
|
||||
|
||||
Location = StringPack;
|
||||
//
|
||||
// Remember that the string packages are formed into contiguous blocks of language data.
|
||||
//
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
|
||||
for (Count = 0; Length != 0; Count = Count + 3) {
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
|
||||
}
|
||||
|
||||
*LanguageString = AllocateZeroPool (2 * (Count + 1));
|
||||
|
||||
ASSERT (*LanguageString);
|
||||
|
||||
StringPack = (EFI_HII_STRING_PACK *) Location;
|
||||
|
||||
//
|
||||
// Copy the 6 bytes to LanguageString - keep concatenating it. Shouldn't we just store uint8's since the ISO
|
||||
// standard defines the lettering as all US English characters anyway? Save a few bytes.
|
||||
//
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
|
||||
for (Count = 0; Length != 0; Count = Count + 3) {
|
||||
CopyMem (&Token, &StringPack->LanguageNameString, sizeof (RELOFST));
|
||||
CopyMem (*LanguageString + Count, (VOID *) ((CHAR8 *) (StringPack) + Token), 6);
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetSecondaryLanguages (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN CHAR16 *PrimaryLanguage,
|
||||
OUT EFI_STRING *LanguageString
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function allows a program to determine which secondary languages are supported
|
||||
on a given handle for a given primary language.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Count;
|
||||
EFI_HII_PACKAGE_INSTANCE *PackageInstance;
|
||||
EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_HANDLE_DATABASE *HandleDatabase;
|
||||
EFI_HII_STRING_PACK *StringPack;
|
||||
RELOFST Token;
|
||||
UINT32 Length;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
//
|
||||
// Check numeric value against the head of the database
|
||||
//
|
||||
PackageInstance = NULL;
|
||||
for (HandleDatabase = HiiData->DatabaseHead;
|
||||
HandleDatabase != NULL;
|
||||
HandleDatabase = HandleDatabase->NextHandleDatabase
|
||||
) {
|
||||
//
|
||||
// Match the numeric value with the database entry - if matched, extract PackageInstance
|
||||
//
|
||||
if (Handle == HandleDatabase->Handle) {
|
||||
PackageInstance = HandleDatabase->Buffer;
|
||||
}
|
||||
}
|
||||
//
|
||||
// No handle was found - error condition
|
||||
//
|
||||
if (PackageInstance == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
|
||||
|
||||
//
|
||||
// Based on if there is IFR data in this package instance, determine
|
||||
// what the location is of the beginning of the string data.
|
||||
//
|
||||
if (StringPackageInstance->IfrSize > 0) {
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
|
||||
} else {
|
||||
StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
|
||||
}
|
||||
|
||||
//
|
||||
// Remember that the string packages are formed into contiguous blocks of language data.
|
||||
//
|
||||
for (; StringPack->Header.Length != 0;) {
|
||||
//
|
||||
// Find the PrimaryLanguage being requested
|
||||
//
|
||||
Token = StringPack->LanguageNameString;
|
||||
if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + Token), PrimaryLanguage, 3) == 0) {
|
||||
//
|
||||
// Now that we found the primary, the secondary languages will follow immediately
|
||||
// or the next character is a NULL if there are no secondary languages. We determine
|
||||
// the number by getting the stringsize based on the StringPack origination + the LanguageNameString
|
||||
// offset + 6 (which is the size of the first 3 letter ISO primary language name). If we get 2, there
|
||||
// are no secondary languages (2 = null-terminator).
|
||||
//
|
||||
Count = StrSize ((VOID *) ((CHAR8 *) (StringPack) + Token + 6));
|
||||
|
||||
*LanguageString = AllocateZeroPool (2 * (Count + 1));
|
||||
|
||||
ASSERT (*LanguageString);
|
||||
|
||||
CopyMem (*LanguageString, (VOID *) ((CHAR8 *) (StringPack) + Token + 6), Count);
|
||||
break;
|
||||
}
|
||||
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
HiiDatabase.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file.
|
||||
|
||||
--*/
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
TRUE
|
||||
DEPENDENCY_END
|
|
@ -0,0 +1,307 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
HiiDatabase.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains global defines and prototype definitions
|
||||
for the HII database.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _HIIDATABASE_H
|
||||
#define _HIIDATABASE_H
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// HII Database Global data
|
||||
//
|
||||
#define EFI_HII_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'i', 'P')
|
||||
|
||||
#define MAX_GLYPH_COUNT 65535
|
||||
#define NARROW_GLYPH_ARRAY_SIZE 19
|
||||
#define WIDE_GLYPH_ARRAY_SIZE 38
|
||||
|
||||
#define SETUP_MAP_NAME L"Setup"
|
||||
#define HII_VARIABLE_SUFFIX_USER_DATA L"UserSavedData"
|
||||
#define HII_VARIABLE_SUFFIX_DEFAULT_OVERRIDE L"DefaultOverride"
|
||||
#define HII_VARIABLE_SUFFIX_MANUFACTURING_OVERRIDE L"ManufacturingOverride"
|
||||
|
||||
typedef struct _EFI_HII_HANDLE_DATABASE {
|
||||
VOID *Buffer; // Actual buffer pointer
|
||||
EFI_HII_HANDLE Handle; // Monotonically increasing value to signify the value returned to caller
|
||||
UINT32 NumberOfTokens; // The initial number of tokens when first registered
|
||||
struct _EFI_HII_HANDLE_DATABASE *NextHandleDatabase;
|
||||
} EFI_HII_HANDLE_DATABASE;
|
||||
|
||||
typedef struct {
|
||||
EFI_NARROW_GLYPH NarrowGlyphs[MAX_GLYPH_COUNT];
|
||||
EFI_WIDE_GLYPH WideGlyphs[MAX_GLYPH_COUNT];
|
||||
EFI_KEY_DESCRIPTOR SystemKeyboardLayout[106];
|
||||
EFI_KEY_DESCRIPTOR OverrideKeyboardLayout[106];
|
||||
BOOLEAN SystemKeyboardUpdate; // Has the SystemKeyboard been updated?
|
||||
} EFI_HII_GLOBAL_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HII_GLOBAL_DATA *GlobalData;
|
||||
EFI_HII_HANDLE_DATABASE *DatabaseHead; // Head of the Null-terminated singly-linked list of handles.
|
||||
EFI_HII_PROTOCOL Hii;
|
||||
} EFI_HII_DATA;
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE Handle;
|
||||
EFI_GUID Guid;
|
||||
EFI_HII_HANDLE_PACK HandlePack;
|
||||
UINTN IfrSize;
|
||||
UINTN StringSize;
|
||||
EFI_HII_IFR_PACK *IfrData; // All the IFR data stored here
|
||||
EFI_HII_STRING_PACK *StringData; // All the String data stored at &IfrData + IfrSize (StringData is just a label - never referenced)
|
||||
} EFI_HII_PACKAGE_INSTANCE;
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_PACK_HEADER Header;
|
||||
EFI_IFR_FORM_SET FormSet;
|
||||
EFI_IFR_END_FORM_SET EndFormSet;
|
||||
} EFI_FORM_SET_STUB;
|
||||
|
||||
#define EFI_HII_DATA_FROM_THIS(a) CR (a, EFI_HII_DATA, Hii, EFI_HII_DATA_SIGNATURE)
|
||||
|
||||
#define NARROW_WIDTH 8
|
||||
#define WIDE_WIDTH 16
|
||||
|
||||
extern UINT8 mUnknownGlyph[38];
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
GetPackSize (
|
||||
IN VOID *Pack,
|
||||
OUT UINTN *PackSize,
|
||||
OUT UINT32 *NumberOfTokens
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ValidatePack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_PACKAGE_INSTANCE *PackageInstance,
|
||||
OUT EFI_HII_PACKAGE_INSTANCE **StringPackageInstance,
|
||||
OUT UINT32 *TotalStringCount
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// Public Interface Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeHiiDatabase (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiNewPack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_PACKAGES *PackageList,
|
||||
OUT EFI_HII_HANDLE *Handle
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiRemovePack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiFindHandles (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN OUT UINT16 *HandleBufferLength,
|
||||
OUT EFI_HII_HANDLE *Handle
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiExportDatabase (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetGlyph (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN CHAR16 *Source,
|
||||
IN OUT UINT16 *Index,
|
||||
OUT UINT8 **GlyphBuffer,
|
||||
OUT UINT16 *BitWidth,
|
||||
IN OUT UINT32 *InternalStatus
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGlyphToBlt (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN UINT8 *GlyphBuffer,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
|
||||
IN UINTN Count,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiNewString (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN CHAR16 *Language,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN OUT STRING_REF *Reference,
|
||||
IN CHAR16 *NewString
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetString (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN STRING_REF Token,
|
||||
IN BOOLEAN Raw,
|
||||
IN CHAR16 *LanguageString,
|
||||
IN OUT UINTN *BufferLength,
|
||||
OUT EFI_STRING StringBuffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiResetStrings (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiTestString (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN CHAR16 *StringToTest,
|
||||
IN OUT UINT32 *FirstMissing,
|
||||
OUT UINT32 *GlyphBufferSize
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetPrimaryLanguages (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
OUT EFI_STRING *LanguageString
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetSecondaryLanguages (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN CHAR16 *PrimaryLanguage,
|
||||
OUT EFI_STRING *LanguageString
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetLine (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN STRING_REF Token,
|
||||
IN OUT UINT16 *Index,
|
||||
IN UINT16 LineWidth,
|
||||
IN CHAR16 *LanguageString,
|
||||
IN OUT UINT16 *BufferLength,
|
||||
OUT EFI_STRING StringBuffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetForms (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN EFI_FORM_ID FormId,
|
||||
IN OUT UINTN *BufferLength,
|
||||
OUT UINT8 *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetDefaultImage (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN UINTN DefaultMask,
|
||||
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiUpdateForm (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN EFI_FORM_LABEL Label,
|
||||
IN BOOLEAN AddData,
|
||||
IN EFI_HII_UPDATE_DATA *Data
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetKeyboardLayout (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
OUT UINT16 *DescriptorCount,
|
||||
OUT EFI_KEY_DESCRIPTOR *Descriptor
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
HiiCompareLanguage (
|
||||
IN CHAR16 *LanguageStringLocation,
|
||||
IN CHAR16 *Language
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,116 @@
|
|||
#/** @file
|
||||
# Component description file for HiiDatabase module.
|
||||
#
|
||||
# This module inits HII database and installs HII protocol.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
#
|
||||
# All rights reserved. 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 Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = HiiDatabase
|
||||
FILE_GUID = FCD337AB-B1D3-4EF8-957C-8048606FF670
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeHiiDatabase
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
HiiDatabase.dxs
|
||||
Keyboard.c
|
||||
Fonts.c
|
||||
Package.c
|
||||
Strings.c
|
||||
Forms.c
|
||||
HiiDatabase.h
|
||||
HiiDatabase.c
|
||||
CommonHeader.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/MdePkg/Include/Library
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
IfrSupportLibFramework
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
BaseLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiGlobalVariableGuid # SOMETIMES_CONSUMED L"Lang"
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiFormCallbackProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
|
||||
gEfiHiiProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
|
||||
<MsaHeader>
|
||||
<ModuleName>HiiDatabase</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>FCD337AB-B1D3-4EF8-957C-8048606FF670</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for HiiDatabase module.</Abstract>
|
||||
<Description>This module inits HII database and installs HII protocol.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. 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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>HiiDatabase</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
<HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkIfrSupportLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>HiiDatabase.c</Filename>
|
||||
<Filename>HiiDatabase.h</Filename>
|
||||
<Filename>Forms.c</Filename>
|
||||
<Filename>Strings.c</Filename>
|
||||
<Filename>Package.c</Filename>
|
||||
<Filename>Fonts.c</Filename>
|
||||
<Filename>Keyboard.c</Filename>
|
||||
<Filename>HiiDatabase.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="SOMETIMES_CONSUMED">
|
||||
<ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Variables>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x004C 0x0061 0x006E 0x0067</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"Lang" global variable is used as system default language.</HelpText>
|
||||
</Variable>
|
||||
</Variables>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>InitializeHiiDatabase</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,48 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Keyboard.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the keyboard processing code to the HII database.
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "HiiDatabase.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiGetKeyboardLayout (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
OUT UINT16 *DescriptorCount,
|
||||
OUT EFI_KEY_DESCRIPTOR *Descriptor
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,678 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Package.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the package processing code to the HII database.
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "HiiDatabase.h"
|
||||
|
||||
EFI_STATUS
|
||||
GetPackSize (
|
||||
IN VOID *Pack,
|
||||
OUT UINTN *PackSize,
|
||||
OUT UINT32 *NumberOfTokens
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determines the passed in Pack's size and returns the value.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_STRING_PACK *StringPack;
|
||||
UINT16 Type;
|
||||
UINT32 Length;
|
||||
|
||||
*PackSize = 0;
|
||||
|
||||
Type = EFI_HII_IFR;
|
||||
if (!CompareMem (&((EFI_HII_PACK_HEADER *) Pack)->Type, &Type, sizeof (UINT16))) {
|
||||
//
|
||||
// The header contains the full IFR length
|
||||
//
|
||||
CopyMem (&Length, &((EFI_HII_PACK_HEADER *) Pack)->Length, sizeof (Length));
|
||||
*PackSize = (UINTN) Length;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Type = EFI_HII_STRING;
|
||||
if (!CompareMem (&((EFI_HII_PACK_HEADER *) Pack)->Type, &Type, sizeof (UINT16))) {
|
||||
//
|
||||
// The header contains the STRING package length
|
||||
// The assumption is that the strings for all languages
|
||||
// are a contiguous block of data and there is a series of
|
||||
// these package instances which will terminate with a NULL package
|
||||
// instance.
|
||||
//
|
||||
StringPack = (EFI_HII_STRING_PACK *) Pack;
|
||||
|
||||
//
|
||||
// There may be multiple instances packed together of strings
|
||||
// so we must walk the self describing structures until we encounter
|
||||
// the NULL structure to determine the full size.
|
||||
//
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (Length));
|
||||
if (NumberOfTokens != NULL) {
|
||||
CopyMem (NumberOfTokens, &StringPack->NumStringPointers, sizeof (UINT32));
|
||||
}
|
||||
|
||||
while (Length != 0) {
|
||||
*PackSize = *PackSize + Length;
|
||||
StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) StringPack + Length);
|
||||
CopyMem (&Length, &StringPack->Header.Length, sizeof (Length));
|
||||
}
|
||||
//
|
||||
// Encountered a length of 0, so let's add the space for the NULL terminator
|
||||
// pack's length and call it done.
|
||||
//
|
||||
*PackSize = *PackSize + sizeof (EFI_HII_STRING_PACK);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// We only determine the size of the non-global Package types.
|
||||
// If neither IFR or STRING data were found, return an error
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ValidatePack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_PACKAGE_INSTANCE *PackageInstance,
|
||||
OUT EFI_HII_PACKAGE_INSTANCE **StringPackageInstance,
|
||||
OUT UINT32 *TotalStringCount
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Verifies that the package instance is using the correct handle for string operations.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_HANDLE_DATABASE *HandleDatabase;
|
||||
EFI_HII_PACKAGE_INSTANCE *HandlePackageInstance;
|
||||
UINT8 *RawData;
|
||||
EFI_GUID Guid;
|
||||
EFI_HII_IFR_PACK *FormPack;
|
||||
UINTN Index;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
HandleDatabase = HiiData->DatabaseHead;
|
||||
ZeroMem (&Guid, sizeof (EFI_GUID));
|
||||
|
||||
*StringPackageInstance = PackageInstance;
|
||||
|
||||
//
|
||||
// Based on if there is IFR data in this package instance, determine
|
||||
// what the location is of the beginning of the string data.
|
||||
//
|
||||
if (PackageInstance->IfrSize > 0) {
|
||||
FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
|
||||
} else {
|
||||
//
|
||||
// If there is no IFR data assume the caller knows what they are doing.
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
RawData = (UINT8 *) FormPack;
|
||||
|
||||
for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
|
||||
if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
|
||||
//
|
||||
// Cache the guid for this formset
|
||||
//
|
||||
CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
|
||||
break;
|
||||
}
|
||||
|
||||
Index = RawData[Index + 1] + Index;
|
||||
}
|
||||
//
|
||||
// If there is no string package, and the PackageInstance->IfrPack.Guid and PackageInstance->Guid are
|
||||
// different, we should return the correct handle for the caller to use for strings.
|
||||
//
|
||||
if ((PackageInstance->StringSize == 0) && (!CompareGuid (&Guid, &PackageInstance->Guid))) {
|
||||
//
|
||||
// Search the database for a handle that matches the PackageInstance->Guid
|
||||
//
|
||||
for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
|
||||
//
|
||||
// Get Ifrdata and extract the Guid for it
|
||||
//
|
||||
HandlePackageInstance = HandleDatabase->Buffer;
|
||||
|
||||
ASSERT (HandlePackageInstance->IfrSize != 0);
|
||||
|
||||
FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&HandlePackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
|
||||
RawData = (UINT8 *) FormPack;
|
||||
|
||||
for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
|
||||
if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
|
||||
//
|
||||
// Cache the guid for this formset
|
||||
//
|
||||
CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
|
||||
break;
|
||||
}
|
||||
|
||||
Index = RawData[Index + 1] + Index;
|
||||
}
|
||||
//
|
||||
// If the Guid from the new handle matches the original Guid referenced in the original package data
|
||||
// return the appropriate package instance data to use.
|
||||
//
|
||||
if (CompareGuid (&Guid, &PackageInstance->Guid)) {
|
||||
if (TotalStringCount != NULL) {
|
||||
*TotalStringCount = HandleDatabase->NumberOfTokens;
|
||||
}
|
||||
|
||||
*StringPackageInstance = HandlePackageInstance;
|
||||
}
|
||||
}
|
||||
//
|
||||
// end for
|
||||
//
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiNewPack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_PACKAGES *Packages,
|
||||
OUT EFI_HII_HANDLE *Handle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Extracts the various packs from a package list.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer of HII protocol.
|
||||
Packages - Pointer of HII packages.
|
||||
Handle - Handle value to be returned.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Pacakges has added to HII database successfully.
|
||||
EFI_INVALID_PARAMETER - Invalid parameter.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_PACKAGE_INSTANCE *PackageInstance;
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_HANDLE_DATABASE *HandleDatabase;
|
||||
EFI_HII_HANDLE_DATABASE *Database;
|
||||
EFI_HII_PACK_HEADER *PackageHeader;
|
||||
EFI_HII_GLOBAL_DATA *GlobalData;
|
||||
EFI_HII_IFR_PACK *IfrPack;
|
||||
EFI_HII_STRING_PACK *StringPack;
|
||||
EFI_HII_FONT_PACK *FontPack;
|
||||
EFI_HII_KEYBOARD_PACK *KeyboardPack;
|
||||
EFI_STATUS Status;
|
||||
UINTN IfrSize;
|
||||
UINTN StringSize;
|
||||
UINTN TotalStringSize;
|
||||
UINTN InstanceSize;
|
||||
UINTN Count;
|
||||
UINTN Index;
|
||||
UINT16 Member;
|
||||
EFI_GUID Guid;
|
||||
EFI_FORM_SET_STUB FormSetStub;
|
||||
UINT8 *Location;
|
||||
UINT16 Unicode;
|
||||
UINT16 NumWideGlyphs;
|
||||
UINT16 NumNarrowGlyphs;
|
||||
UINT32 NumberOfTokens;
|
||||
UINT32 TotalTokenNumber;
|
||||
UINT8 *Local;
|
||||
EFI_NARROW_GLYPH *NarrowGlyph;
|
||||
|
||||
if (Packages->NumberOfPackages == 0 || This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
GlobalData = HiiData->GlobalData;
|
||||
|
||||
Database = HiiData->DatabaseHead;
|
||||
|
||||
PackageInstance = NULL;
|
||||
IfrPack = NULL;
|
||||
StringPack = NULL;
|
||||
InstanceSize = 0;
|
||||
IfrSize = 0;
|
||||
StringSize = 0;
|
||||
TotalStringSize = 0;
|
||||
NumberOfTokens = 0;
|
||||
TotalTokenNumber = 0;
|
||||
|
||||
//
|
||||
// Search through the passed in Packages for the IfrPack and any StringPack.
|
||||
//
|
||||
for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
|
||||
|
||||
PackageHeader = *(EFI_HII_PACK_HEADER **) (((UINT8 *) Packages) + sizeof (EFI_HII_PACKAGES) + Index * sizeof (VOID *));
|
||||
|
||||
switch (PackageHeader->Type) {
|
||||
case EFI_HII_IFR:
|
||||
//
|
||||
// There shoule be only one Ifr package.
|
||||
//
|
||||
ASSERT (IfrPack == NULL);
|
||||
IfrPack = (EFI_HII_IFR_PACK *) PackageHeader;
|
||||
break;
|
||||
|
||||
case EFI_HII_STRING:
|
||||
StringPack = (EFI_HII_STRING_PACK *) PackageHeader;
|
||||
//
|
||||
// Sending me a String Package. Get its size.
|
||||
//
|
||||
Status = GetPackSize ((VOID *) StringPack, &StringSize, &NumberOfTokens);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
|
||||
//
|
||||
// The size which GetPackSize() returns include the null terminator. So if multiple
|
||||
// string packages are passed in, merge all these packages, and only pad one null terminator.
|
||||
//
|
||||
if (TotalStringSize > 0) {
|
||||
TotalStringSize -= sizeof (EFI_HII_STRING_PACK);
|
||||
}
|
||||
|
||||
TotalStringSize += StringSize;
|
||||
TotalTokenNumber += NumberOfTokens;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// If sending a StringPack without an IfrPack, you must include a GuidId
|
||||
//
|
||||
if ((StringPack != NULL) && (IfrPack == NULL)) {
|
||||
if (Packages->GuidId == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
//
|
||||
// If passing in an IfrPack and a GuidId is provided, ensure they are the same value.
|
||||
//
|
||||
if ((IfrPack != NULL) && (Packages->GuidId != NULL)) {
|
||||
Location = ((UINT8 *) IfrPack);
|
||||
Location = (UINT8 *) (((UINTN) Location) + sizeof (EFI_HII_PACK_HEADER));
|
||||
|
||||
//
|
||||
// Advance to the Form Set Op-code
|
||||
//
|
||||
for (Count = 0; ((EFI_IFR_OP_HEADER *) &Location[Count])->OpCode != EFI_IFR_FORM_SET_OP;) {
|
||||
Count = Count + ((EFI_IFR_OP_HEADER *) &Location[Count])->Length;
|
||||
}
|
||||
//
|
||||
// Copy to local variable
|
||||
//
|
||||
CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &Location[Count])->Guid, sizeof (EFI_GUID));
|
||||
|
||||
//
|
||||
// Check to see if IfrPack->Guid != GuidId
|
||||
//
|
||||
if (!CompareGuid (&Guid, Packages->GuidId)) {
|
||||
//
|
||||
// If a string package is present, the GUIDs should have agreed. Return an error
|
||||
//
|
||||
if (StringPack != NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If someone is passing in a string only, create a dummy IfrPack with a Guid
|
||||
// to enable future searching of this data.
|
||||
//
|
||||
if ((IfrPack == NULL) && (StringPack != NULL)) {
|
||||
ZeroMem (&FormSetStub, sizeof (FormSetStub));
|
||||
|
||||
FormSetStub.Header.Type = EFI_HII_IFR;
|
||||
FormSetStub.Header.Length = sizeof (EFI_FORM_SET_STUB);
|
||||
|
||||
FormSetStub.FormSet.Header.OpCode = EFI_IFR_FORM_SET_OP;
|
||||
FormSetStub.FormSet.Header.Length = (UINT8) sizeof (EFI_IFR_FORM_SET);
|
||||
//
|
||||
// Dummy string
|
||||
//
|
||||
FormSetStub.FormSet.FormSetTitle = 0x02;
|
||||
CopyMem (&FormSetStub.FormSet.Guid, Packages->GuidId, sizeof (EFI_GUID));
|
||||
|
||||
FormSetStub.EndFormSet.Header.OpCode = EFI_IFR_END_FORM_SET_OP;
|
||||
FormSetStub.EndFormSet.Header.Length = (UINT8) sizeof (EFI_IFR_END_FORM_SET);
|
||||
IfrPack = (EFI_HII_IFR_PACK *) &FormSetStub;
|
||||
}
|
||||
|
||||
if (IfrPack != NULL) {
|
||||
//
|
||||
// Sending me an IFR Package. Get its size.
|
||||
//
|
||||
Status = GetPackSize ((VOID *) IfrPack, &IfrSize, NULL);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
}
|
||||
//
|
||||
// Prepare the internal package instace buffer to store package data.
|
||||
//
|
||||
InstanceSize = IfrSize + TotalStringSize;
|
||||
|
||||
if (InstanceSize != 0) {
|
||||
PackageInstance = AllocateZeroPool (InstanceSize + sizeof (EFI_HII_PACKAGE_INSTANCE));
|
||||
|
||||
ASSERT (PackageInstance);
|
||||
|
||||
//
|
||||
// If there is no DatabaseHead allocated - allocate one
|
||||
//
|
||||
if (HiiData->DatabaseHead == NULL) {
|
||||
HiiData->DatabaseHead = AllocateZeroPool (sizeof (EFI_HII_HANDLE_DATABASE));
|
||||
ASSERT (HiiData->DatabaseHead);
|
||||
}
|
||||
//
|
||||
// If the head is being used (Handle is non-zero), allocate next Database and
|
||||
// add it to the linked-list
|
||||
//
|
||||
if (HiiData->DatabaseHead->Handle != 0) {
|
||||
HandleDatabase = AllocateZeroPool (sizeof (EFI_HII_HANDLE_DATABASE));
|
||||
|
||||
ASSERT (HandleDatabase);
|
||||
|
||||
for (; Database->NextHandleDatabase != NULL; Database = Database->NextHandleDatabase)
|
||||
;
|
||||
|
||||
//
|
||||
// We are sitting on the Database entry which contains the null Next pointer. Fix it.
|
||||
//
|
||||
Database->NextHandleDatabase = HandleDatabase;
|
||||
|
||||
}
|
||||
|
||||
Database = HiiData->DatabaseHead;
|
||||
|
||||
//
|
||||
// Initialize this instance data
|
||||
//
|
||||
for (*Handle = 1; Database->NextHandleDatabase != NULL; Database = Database->NextHandleDatabase) {
|
||||
//
|
||||
// Since the first Database instance will have a passed back handle of 1, we will continue
|
||||
// down the linked list of entries until we encounter the end of the linked list. Each time
|
||||
// we go down one level deeper, increment the handle value that will be passed back.
|
||||
//
|
||||
if (Database->Handle >= *Handle) {
|
||||
*Handle = (EFI_HII_HANDLE) (Database->Handle + 1);
|
||||
}
|
||||
}
|
||||
|
||||
PackageInstance->Handle = *Handle;
|
||||
PackageInstance->IfrSize = IfrSize;
|
||||
PackageInstance->StringSize = TotalStringSize;
|
||||
if (Packages->GuidId != NULL) {
|
||||
CopyMem (&PackageInstance->Guid, Packages->GuidId, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
Database->Buffer = PackageInstance;
|
||||
Database->Handle = PackageInstance->Handle;
|
||||
Database->NumberOfTokens = TotalTokenNumber;
|
||||
Database->NextHandleDatabase = NULL;
|
||||
}
|
||||
//
|
||||
// Copy the Ifr package data into package instance.
|
||||
//
|
||||
if (IfrSize > 0) {
|
||||
CopyMem (&PackageInstance->IfrData, IfrPack, IfrSize);
|
||||
}
|
||||
//
|
||||
// Main loop to store package data into HII database.
|
||||
//
|
||||
StringSize = 0;
|
||||
TotalStringSize = 0;
|
||||
|
||||
for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
|
||||
|
||||
PackageHeader = *(EFI_HII_PACK_HEADER **) (((UINT8 *) Packages) + sizeof (EFI_HII_PACKAGES) + Index * sizeof (VOID *));
|
||||
|
||||
switch (PackageHeader->Type) {
|
||||
case EFI_HII_STRING:
|
||||
StringPack = (EFI_HII_STRING_PACK *) PackageHeader;
|
||||
//
|
||||
// The size which GetPackSize() returns include the null terminator. So if multiple
|
||||
// string packages are passed in, merge all these packages, and only pad one null terminator.
|
||||
//
|
||||
if (TotalStringSize > 0) {
|
||||
TotalStringSize -= sizeof (EFI_HII_STRING_PACK);
|
||||
}
|
||||
|
||||
GetPackSize ((VOID *) StringPack, &StringSize, &NumberOfTokens);
|
||||
CopyMem ((CHAR8 *) (&PackageInstance->IfrData) + IfrSize + TotalStringSize, StringPack, StringSize);
|
||||
|
||||
TotalStringSize += StringSize;
|
||||
break;
|
||||
|
||||
case EFI_HII_HANDLES:
|
||||
CopyMem (&PackageInstance->HandlePack, PackageHeader, sizeof (EFI_HII_HANDLE_PACK));
|
||||
break;
|
||||
|
||||
case EFI_HII_FONT:
|
||||
FontPack = (EFI_HII_FONT_PACK *) PackageHeader;
|
||||
//
|
||||
// Add whatever narrow glyphs were passed to us if undefined
|
||||
//
|
||||
CopyMem (&NumNarrowGlyphs, &FontPack->NumberOfNarrowGlyphs, sizeof (UINT16));
|
||||
for (Count = 0; Count <= NumNarrowGlyphs; Count++) {
|
||||
Local = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8)) + (sizeof (EFI_NARROW_GLYPH)) * Count;
|
||||
NarrowGlyph = (EFI_NARROW_GLYPH *) Local;
|
||||
CopyMem (&Member, &NarrowGlyph->UnicodeWeight, sizeof (UINT16));
|
||||
//
|
||||
// If the glyph is already defined, do not overwrite it. It is what it is.
|
||||
//
|
||||
CopyMem (&Unicode, &GlobalData->NarrowGlyphs[Member].UnicodeWeight, sizeof (UINT16));
|
||||
if (Unicode == 0) {
|
||||
CopyMem (&GlobalData->NarrowGlyphs[Member], Local, sizeof (EFI_NARROW_GLYPH));
|
||||
}
|
||||
}
|
||||
//
|
||||
// Add whatever wide glyphs were passed to us if undefined
|
||||
//
|
||||
CopyMem (&NumWideGlyphs, &FontPack->NumberOfWideGlyphs, sizeof (UINT16));
|
||||
for (Count = 0; Count <= NumWideGlyphs; Count++) {
|
||||
Local = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8)) +
|
||||
(sizeof (EFI_NARROW_GLYPH)) *
|
||||
NumNarrowGlyphs;
|
||||
CopyMem (
|
||||
&Member,
|
||||
(UINTN *) (Local + sizeof (EFI_WIDE_GLYPH) * Count),
|
||||
sizeof (UINT16)
|
||||
);
|
||||
//
|
||||
// If the glyph is already defined, do not overwrite it. It is what it is.
|
||||
//
|
||||
CopyMem (&Unicode, &GlobalData->WideGlyphs[Member].UnicodeWeight, sizeof (UINT16));
|
||||
if (Unicode == 0) {
|
||||
Local = (UINT8*)(&FontPack->NumberOfWideGlyphs + sizeof(UINT8)) + (sizeof(EFI_NARROW_GLYPH)) * NumNarrowGlyphs;
|
||||
CopyMem (
|
||||
&GlobalData->WideGlyphs[Member],
|
||||
(UINTN *) (Local + sizeof (EFI_WIDE_GLYPH) * Count),
|
||||
sizeof (EFI_WIDE_GLYPH)
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_HII_KEYBOARD:
|
||||
KeyboardPack = (EFI_HII_KEYBOARD_PACK *) PackageHeader;
|
||||
//
|
||||
// Sending me a Keyboard Package
|
||||
//
|
||||
if (KeyboardPack->DescriptorCount > 105) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// If someone updates the Descriptors with a count of 0, blow aware the overrides.
|
||||
//
|
||||
if (KeyboardPack->DescriptorCount == 0) {
|
||||
ZeroMem (GlobalData->OverrideKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
|
||||
}
|
||||
|
||||
if (KeyboardPack->DescriptorCount < 106 && KeyboardPack->DescriptorCount > 0) {
|
||||
//
|
||||
// If SystemKeyboard was updated already, then steer changes to the override database
|
||||
//
|
||||
if (GlobalData->SystemKeyboardUpdate) {
|
||||
ZeroMem (GlobalData->OverrideKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
|
||||
for (Count = 0; Count < KeyboardPack->DescriptorCount; Count++) {
|
||||
CopyMem (&Member, &KeyboardPack->Descriptor[Count].Key, sizeof (UINT16));
|
||||
CopyMem (
|
||||
&GlobalData->OverrideKeyboardLayout[Member],
|
||||
&KeyboardPack->Descriptor[Count],
|
||||
sizeof (EFI_KEY_DESCRIPTOR)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// SystemKeyboard was never updated, so this is likely the keyboard driver setting the System database.
|
||||
//
|
||||
ZeroMem (GlobalData->SystemKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
|
||||
for (Count = 0; Count < KeyboardPack->DescriptorCount; Count++) {
|
||||
CopyMem (&Member, &KeyboardPack->Descriptor->Key, sizeof (UINT16));
|
||||
CopyMem (
|
||||
&GlobalData->SystemKeyboardLayout[Member],
|
||||
&KeyboardPack->Descriptor[Count],
|
||||
sizeof (EFI_KEY_DESCRIPTOR)
|
||||
);
|
||||
}
|
||||
//
|
||||
// Just updated the system keyboard database, reflect that in the global flag.
|
||||
//
|
||||
GlobalData->SystemKeyboardUpdate = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiiRemovePack (
|
||||
IN EFI_HII_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Removes the various packs from a Handle
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_PACKAGE_INSTANCE *PackageInstance;
|
||||
EFI_HII_DATA *HiiData;
|
||||
EFI_HII_HANDLE_DATABASE *HandleDatabase;
|
||||
EFI_HII_HANDLE_DATABASE *PreviousHandleDatabase;
|
||||
|
||||
if (This == NULL || Handle == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
HiiData = EFI_HII_DATA_FROM_THIS (This);
|
||||
|
||||
HandleDatabase = HiiData->DatabaseHead;
|
||||
PackageInstance = NULL;
|
||||
|
||||
//
|
||||
// Initialize the Previous with the Head of the Database
|
||||
//
|
||||
PreviousHandleDatabase = HandleDatabase;
|
||||
|
||||
for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
|
||||
//
|
||||
// Match the numeric value with the database entry - if matched,
|
||||
// free the package instance and apply fix-up to database linked list
|
||||
//
|
||||
if (Handle == HandleDatabase->Handle) {
|
||||
PackageInstance = HandleDatabase->Buffer;
|
||||
|
||||
//
|
||||
// Free the Package Instance
|
||||
//
|
||||
FreePool (PackageInstance);
|
||||
|
||||
//
|
||||
// If this was the only Handle in the database
|
||||
//
|
||||
if (HiiData->DatabaseHead == HandleDatabase) {
|
||||
HiiData->DatabaseHead = NULL;
|
||||
}
|
||||
//
|
||||
// Make the parent->Next point to the current->Next
|
||||
//
|
||||
PreviousHandleDatabase->NextHandleDatabase = HandleDatabase->NextHandleDatabase;
|
||||
FreePool (HandleDatabase);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// If this was not the HandleDatabase entry we were looking for, cache it just in case the next one is
|
||||
//
|
||||
PreviousHandleDatabase = HandleDatabase;
|
||||
}
|
||||
//
|
||||
// No handle was found - error condition
|
||||
//
|
||||
if (PackageInstance == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Colors.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _COLORS_H
|
||||
#define _COLORS_H
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// Screen Color Settings
|
||||
//
|
||||
#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE
|
||||
#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN
|
||||
#define TITLE_TEXT EFI_WHITE
|
||||
#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define KEYHELP_TEXT EFI_LIGHTGRAY
|
||||
#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define SUBTITLE_TEXT EFI_BLUE
|
||||
#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define BANNER_TEXT EFI_BLUE
|
||||
#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define FIELD_TEXT EFI_BLACK
|
||||
#define FIELD_TEXT_GRAYED EFI_DARKGRAY
|
||||
#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define FIELD_TEXT_HIGHLIGHT EFI_LIGHTGRAY
|
||||
#define FIELD_BACKGROUND_HIGHLIGHT EFI_BACKGROUND_BLACK
|
||||
#define POPUP_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define HELP_TEXT EFI_BLUE
|
||||
#define ERROR_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT
|
||||
#define ARROW_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
|
||||
#endif
|
|
@ -0,0 +1,44 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. 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 __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/FormCallback.h>
|
||||
#include <Protocol/FormBrowser.h>
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
#include <Protocol/Print.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/HiiLibFramework.h>
|
||||
#include <Library/GraphicsLib.h>
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,298 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Print.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
|
||||
simple implemenation of SPrint() and Print() to support debug.
|
||||
|
||||
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
|
||||
time. This makes the implementation very simple.
|
||||
|
||||
VSPrint, Print, SPrint format specification has the follwoing form
|
||||
|
||||
%type
|
||||
|
||||
type:
|
||||
'S','s' - argument is an Unicode string
|
||||
'c' - argument is an ascii character
|
||||
'%' - Print a %
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
STATIC
|
||||
UINTN
|
||||
_IPrint (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Out,
|
||||
IN CHAR16 *fmt,
|
||||
IN VA_LIST args
|
||||
)
|
||||
//
|
||||
// Display string worker for: Print, PrintAt, IPrint, IPrintAt
|
||||
//
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *BackupBuffer;
|
||||
UINTN Index;
|
||||
UINTN PreviousIndex;
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
BackupBuffer = AllocateZeroPool (0x10000);
|
||||
ASSERT (Buffer);
|
||||
ASSERT (BackupBuffer);
|
||||
|
||||
if (Column != (UINTN) -1) {
|
||||
Out->SetCursorPosition (Out, Column, Row);
|
||||
}
|
||||
|
||||
UnicodeVSPrint (Buffer, 0x10000, fmt, args);
|
||||
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
|
||||
Index = 0;
|
||||
PreviousIndex = 0;
|
||||
|
||||
do {
|
||||
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
|
||||
BackupBuffer[Index] = Buffer[Index];
|
||||
}
|
||||
|
||||
if (Buffer[Index] == 0) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Null-terminate the temporary string
|
||||
//
|
||||
BackupBuffer[Index] = 0;
|
||||
|
||||
//
|
||||
// Print this out, we are about to switch widths
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
|
||||
//
|
||||
// Preserve the current index + 1, since this is where we will start printing from next
|
||||
//
|
||||
PreviousIndex = Index + 1;
|
||||
|
||||
//
|
||||
// We are at a narrow or wide character directive. Set attributes and strip it and print it
|
||||
//
|
||||
if (Buffer[Index] == NARROW_CHAR) {
|
||||
//
|
||||
// Preserve bits 0 - 6 and zero out the rest
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
} else {
|
||||
//
|
||||
// Must be wide, set bit 7 ON
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
}
|
||||
|
||||
Index++;
|
||||
|
||||
} while (Buffer[Index] != 0);
|
||||
|
||||
//
|
||||
// We hit the end of the string - print it
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
|
||||
FreePool (Buffer);
|
||||
FreePool (BackupBuffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
UINTN
|
||||
Print (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a formatted unicode string to the default console
|
||||
|
||||
Arguments:
|
||||
|
||||
fmt - Format string
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console
|
||||
|
||||
--*/
|
||||
{
|
||||
VA_LIST args;
|
||||
|
||||
VA_START (args, fmt);
|
||||
return _IPrint ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintString (
|
||||
CHAR16 *String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a unicode string to the default console,
|
||||
using L"%s" format.
|
||||
|
||||
Arguments:
|
||||
|
||||
String - String pointer.
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console
|
||||
|
||||
--*/
|
||||
{
|
||||
return Print ((CHAR16 *) L"%s", String);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintChar (
|
||||
CHAR16 Character
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a chracter to the default console,
|
||||
using L"%c" format.
|
||||
|
||||
Arguments:
|
||||
|
||||
Character - Character to print.
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console.
|
||||
|
||||
--*/
|
||||
{
|
||||
return Print ((CHAR16 *) L"%c", Character);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a formatted unicode string to the default console, at
|
||||
the supplied cursor position
|
||||
|
||||
Arguments:
|
||||
|
||||
Column, Row - The cursor position to print the string at
|
||||
|
||||
fmt - Format string
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console
|
||||
|
||||
--*/
|
||||
{
|
||||
VA_LIST args;
|
||||
|
||||
VA_START (args, fmt);
|
||||
return _IPrint (Column, Row, gST->ConOut, fmt, args);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 *String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a unicode string to the default console, at
|
||||
the supplied cursor position, using L"%s" format.
|
||||
|
||||
Arguments:
|
||||
|
||||
Column, Row - The cursor position to print the string at
|
||||
|
||||
String - String pointer.
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console
|
||||
|
||||
--*/
|
||||
{
|
||||
return PrintAt (Column, Row, (CHAR16 *) L"%s", String);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Prints a chracter to the default console, at
|
||||
the supplied cursor position, using L"%c" format.
|
||||
|
||||
Arguments:
|
||||
|
||||
Column, Row - The cursor position to print the string at
|
||||
|
||||
Character - Character to print.
|
||||
|
||||
Returns:
|
||||
|
||||
Length of string printed to the console.
|
||||
|
||||
--*/
|
||||
{
|
||||
return PrintAt (Column, Row, (CHAR16 *) L"%c", Character);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Print.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Private data for Print.c
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _PRINT_H_
|
||||
#define _PRINT_H_
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "Setup.h"
|
||||
|
||||
#define LEFT_JUSTIFY 0x01
|
||||
#define PREFIX_SIGN 0x02
|
||||
#define PREFIX_BLANK 0x04
|
||||
#define COMMA_TYPE 0x08
|
||||
#define LONG_TYPE 0x10
|
||||
#define PREFIX_ZERO 0x20
|
||||
|
||||
//
|
||||
// Largest number of characters that can be printed out.
|
||||
//
|
||||
#define EFI_DRIVER_LIB_MAX_PRINT_BUFFER (80 * 4)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,508 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Setup.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _SETUP_H
|
||||
#define _SETUP_H
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// This is the generated header file which includes whatever needs to be exported (strings + IFR)
|
||||
//
|
||||
extern UINT8 SetupBrowserStrings[];
|
||||
|
||||
//
|
||||
// Screen definitions
|
||||
//
|
||||
#define BANNER_HEIGHT 4
|
||||
#define BANNER_COLUMNS 3
|
||||
|
||||
#define FRONT_PAGE_HEADER_HEIGHT 4
|
||||
#define NONE_FRONT_PAGE_HEADER_HEIGHT 3
|
||||
#define LEFT_SKIPPED_COLUMNS 4
|
||||
#define FOOTER_HEIGHT 4
|
||||
#define STATUS_BAR_HEIGHT 1
|
||||
#define SCROLL_ARROW_HEIGHT 1
|
||||
#define POPUP_PAD_SPACE_COUNT 5
|
||||
#define POPUP_FRAME_WIDTH 2
|
||||
|
||||
|
||||
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
|
||||
#define EFI_FRONT_PAGE_SUBCLASS 0x02
|
||||
#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
|
||||
//
|
||||
// Definition for function key setting
|
||||
//
|
||||
#define NONE_FUNCTION_KEY_SETTING 0
|
||||
#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_TWO | FUNCTION_NINE | FUNCTION_TEN)
|
||||
|
||||
#define FUNCTION_ONE (1 << 0)
|
||||
#define FUNCTION_TWO (1 << 1)
|
||||
#define FUNCTION_NINE (1 << 2)
|
||||
#define FUNCTION_TEN (1 << 3)
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID FormSetGuid;
|
||||
UINTN KeySetting;
|
||||
} FUNCTIION_KEY_SETTING;
|
||||
|
||||
//
|
||||
// Character definitions
|
||||
//
|
||||
#define CHAR_SPACE 0x0020
|
||||
#define UPPER_LOWER_CASE_OFFSET 0x20
|
||||
|
||||
//
|
||||
// Time definitions
|
||||
//
|
||||
#define ONE_SECOND 10000000
|
||||
|
||||
//
|
||||
// Display definitions
|
||||
//
|
||||
#define LEFT_HYPER_DELIMITER L'<'
|
||||
#define RIGHT_HYPER_DELIMITER L'>'
|
||||
|
||||
#define LEFT_ONEOF_DELIMITER L'<'
|
||||
#define RIGHT_ONEOF_DELIMITER L'>'
|
||||
|
||||
#define LEFT_NUMERIC_DELIMITER L'['
|
||||
#define RIGHT_NUMERIC_DELIMITER L']'
|
||||
|
||||
#define LEFT_CHECKBOX_DELIMITER L"["
|
||||
#define RIGHT_CHECKBOX_DELIMITER L"]"
|
||||
|
||||
#define CHECK_ON L"X"
|
||||
#define CHECK_OFF L" "
|
||||
|
||||
#define TIME_SEPARATOR L':'
|
||||
#define DATE_SEPARATOR L'/'
|
||||
|
||||
#define YES_ANSWER L'Y'
|
||||
#define NO_ANSWER L'N'
|
||||
|
||||
//
|
||||
// Up to how many lines does the ordered list display
|
||||
//
|
||||
#define ORDERED_LIST_SIZE 4
|
||||
|
||||
//
|
||||
// This is the Input Error Message
|
||||
//
|
||||
#define INPUT_ERROR 1
|
||||
|
||||
//
|
||||
// This is the NV RAM update required Message
|
||||
//
|
||||
#define NV_UPDATE_REQUIRED 2
|
||||
|
||||
//
|
||||
// Refresh the Status Bar with flags
|
||||
//
|
||||
#define REFRESH_STATUS_BAR 0xff
|
||||
|
||||
//
|
||||
// This width is basically the sum of the prompt and option widths
|
||||
//
|
||||
#define QUESTION_BLOCK_WIDTH 50
|
||||
|
||||
//
|
||||
// Width of the Language Description (Using ISO-639-2 3 ASCII letter standard)
|
||||
//
|
||||
#define LANG_DESC_WIDTH 3
|
||||
|
||||
//
|
||||
// Maximum Number of Binaries we can see
|
||||
//
|
||||
#define MAX_BINARIES 255
|
||||
|
||||
//
|
||||
// Invalid Handle
|
||||
//
|
||||
#define EFI_HII_INVALID_HANDLE 0xFFFF
|
||||
|
||||
//
|
||||
// Invalid Offset Value
|
||||
//
|
||||
#define INVALID_OFFSET_VALUE 0xFFFF
|
||||
|
||||
struct StringPart {
|
||||
struct StringPart *Next;
|
||||
CHAR8 String[QUESTION_BLOCK_WIDTH + 2];
|
||||
};
|
||||
|
||||
//
|
||||
// The tag definition defines the data associated with a tag (an operation
|
||||
// in the IFR lingo). The tag is thus a modified union of all the data
|
||||
// required for tags. The user should be careful to only rely upon information
|
||||
// relevant to that tag as the contents of other fields is undefined.
|
||||
//
|
||||
// The intent here is for this to be all of the data associated with a particular tag.
|
||||
// Some of this data is extracted from the IFR and left alone. Other data will be derived
|
||||
// when the page is selected (since that's the first time we really know what language the
|
||||
// page is to be displayed in) and still other data will vary based on the selection.
|
||||
// If you'd like to consider alternatives, let me know. This structure has grown somewhat organically.
|
||||
// It gets a new item stuffed in it when a new item is needed. When I finally decided I needed the
|
||||
// StringPart structure, items got added here, for example.
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Operand; // The operand (first byte) of the variable length tag.
|
||||
EFI_GUID GuidValue; // Primarily for FormSet data
|
||||
EFI_PHYSICAL_ADDRESS CallbackHandle;
|
||||
UINT16 Class;
|
||||
UINT16 SubClass;
|
||||
UINT16 NumberOfLines; // The number of lines the tag takes up on the page. Adjusted when we display the page as it can change from language to language.
|
||||
UINT16 PageLine;
|
||||
UINT16 PageColumn;
|
||||
UINT16 OptionWidth; // The option can be wider than the column usually associated with options. This is the width on the last option line
|
||||
STRING_REF Text; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
|
||||
STRING_REF TextTwo; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
|
||||
STRING_REF Help; // Null means no help Same as above but for languages.
|
||||
UINT16 Consistency; // Do we need to check this opcode against consistency? If > 0, yes.
|
||||
UINT16 Id;
|
||||
UINT16 Id2; // The questions (mainly) have identifiers associated with them. These are filled in from the IFR tags and used by e.g. the RPN calculations. (com1 is set to, versus com2 is set to)
|
||||
//
|
||||
// These are the three values that are created to determine where in the variable the data is stored. This should, in general,
|
||||
// be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
|
||||
//
|
||||
UINT16 StorageStart;
|
||||
//
|
||||
// These are the three values that are created to determine where in the variable the data is stored. This should, in general,
|
||||
// be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
|
||||
//
|
||||
UINT8 StorageWidth;
|
||||
//
|
||||
// These are the three values that are created to determine where in the variable the data is stored. This should, in general,
|
||||
// be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
|
||||
//
|
||||
UINT16 Value;
|
||||
//
|
||||
// (Default or current)
|
||||
//
|
||||
UINT8 Flags;
|
||||
UINT16 Key;
|
||||
//
|
||||
// Used to preserve a value during late consistency checking
|
||||
//
|
||||
UINT16 OldValue;
|
||||
UINT16 Minimum;
|
||||
UINT16 Maximum;
|
||||
UINT16 Step;
|
||||
UINT16 Default;
|
||||
UINT16 NvDataSize;
|
||||
UINT16 ConsistencyId;
|
||||
BOOLEAN GrayOut;
|
||||
BOOLEAN Suppress;
|
||||
UINT16 Encoding; // Data from the tags. The first three are used by the numeric input. Encoding is used by the password stuff (a placeholder today - may go away).
|
||||
UINT16 *IntList; // List of the values possible for a list question
|
||||
//
|
||||
// The string is obtained from the string list and formatted into lines and the lines are held in this linked list.
|
||||
// If we have more than a screen's worth of items, we will end up with cases where we have to display the last couple
|
||||
// lines of a tag's string above the currently selected one, or, display a few lines of a tag at the bottom of a screen.
|
||||
//
|
||||
struct StringPart *StringList;
|
||||
BOOLEAN ResetRequired; // Primarily used to determine if a reset is required by changing this op-code.
|
||||
UINT16 VariableNumber; // Used to define which variable the StorageStart will be pertinent for (0-based) For single variable VFR this will always be 0.
|
||||
//
|
||||
// Used to define which variable the StorageStart will be pertinent for (0-based) This is used for boolean check of ID versus ID
|
||||
// so that a user can compare the value of one variable.field content versus another variable.field content.
|
||||
//
|
||||
UINT16 VariableNumber2;
|
||||
} EFI_TAG;
|
||||
|
||||
#define EFI_FORM_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'o', 'r', 'm')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
EFI_FORM_BROWSER_PROTOCOL FormConfig;
|
||||
} EFI_FORM_CONFIGURATION_DATA;
|
||||
|
||||
#define EFI_FORM_DATA_FROM_THIS(a) CR (a, EFI_FORM_CONFIGURATION_DATA, FormConfig, EFI_FORM_DATA_SIGNATURE)
|
||||
|
||||
typedef struct _EFI_VARIABLE_DEFINITION {
|
||||
CHAR8 *NvRamMap;
|
||||
CHAR8 *FakeNvRamMap; // This is where the storage for NULL devices go (e.g. RTC)
|
||||
EFI_GUID Guid;
|
||||
UINT16 VariableId;
|
||||
UINT16 VariableSize;
|
||||
UINT16 VariableFakeSize; // For dynamically created and NULL device options, this is the latest size
|
||||
CHAR16 *VariableName;
|
||||
struct _EFI_VARIABLE_DEFINITION *Next;
|
||||
struct _EFI_VARIABLE_DEFINITION *Previous;
|
||||
} EFI_VARIABLE_DEFINITION;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Length; // Length in bytes between beginning of struc and end of Strings
|
||||
CHAR8 LanguageCode[4]; // ISO-639-2 language code with a null-terminator
|
||||
RELOFST PrintableLanguageName; // Translated name of the Language, "English"/"Espanol" etc
|
||||
UINT32 Attributes; // If on, the language is intended to be printed right to left. The default (off) is to print left to right.
|
||||
RELOFST StringsPointers[1]; // Pointing to string offset from beginning of String Binary
|
||||
EFI_STRING Strings[1]; // Array of String Entries. Note the number of entries for Strings and StringsPointers will be the same
|
||||
} EFI_LANGUAGE_SET;
|
||||
|
||||
//
|
||||
// This encapsulates all the pointers associated with found IFR binaries
|
||||
//
|
||||
typedef struct _EFI_IFR_BINARY {
|
||||
struct _EFI_IFR_BINARY *Next;
|
||||
VOID *IfrPackage; // Handy for use in freeing the data later since this is the header of the buffer
|
||||
VOID *FormBinary;
|
||||
EFI_HII_HANDLE Handle;
|
||||
STRING_REF TitleToken;
|
||||
BOOLEAN UnRegisterOnExit;
|
||||
} EFI_IFR_BINARY;
|
||||
|
||||
//
|
||||
// This encapsulates all the questions (tags) for a particular Form Set
|
||||
//
|
||||
typedef struct _EFI_FORM_TAGS {
|
||||
struct _EFI_FORM_TAGS *Next;
|
||||
EFI_TAG *Tags;
|
||||
} EFI_FORM_TAGS;
|
||||
|
||||
//
|
||||
// This is the database of all inconsistency data. Each op-code associated
|
||||
// with inconsistency will be tracked here. This optimizes the search requirement
|
||||
// since we will back mark the main tag structure with the op-codes that have reference
|
||||
// to inconsistency data. This way when parsing the main tag structure and encountering
|
||||
// the inconsistency mark - we can search this database to know what the inconsistency
|
||||
// parameters are for that entry.
|
||||
//
|
||||
typedef struct _EFI_INCONSISTENCY_DATA {
|
||||
struct _EFI_INCONSISTENCY_DATA *Next;
|
||||
struct _EFI_INCONSISTENCY_DATA *Previous;
|
||||
UINT8 Operand;
|
||||
STRING_REF Popup;
|
||||
UINT16 QuestionId1;
|
||||
UINT16 QuestionId2;
|
||||
UINT16 Value;
|
||||
UINT16 ListLength;
|
||||
UINT16 ConsistencyId;
|
||||
UINT16 *ValueList;
|
||||
UINT16 VariableNumber;
|
||||
UINT16 VariableNumber2;
|
||||
UINT8 Width;
|
||||
} EFI_INCONSISTENCY_DATA;
|
||||
|
||||
//
|
||||
// Encapsulating all found Tag information from all sources
|
||||
// Each encapsulation also contains the NvRamMap buffer and the Size of the NV store
|
||||
//
|
||||
typedef struct _EFI_FILE_FORM_TAGS {
|
||||
struct _EFI_FILE_FORM_TAGS *NextFile;
|
||||
EFI_INCONSISTENCY_DATA *InconsistentTags;
|
||||
EFI_VARIABLE_DEFINITION *VariableDefinitions;
|
||||
EFI_FORM_TAGS FormTags;
|
||||
} EFI_FILE_FORM_TAGS;
|
||||
|
||||
typedef struct {
|
||||
STRING_REF Banner[BANNER_HEIGHT][BANNER_COLUMNS];
|
||||
} BANNER_DATA;
|
||||
|
||||
//
|
||||
// Head of the Binary structures
|
||||
//
|
||||
EFI_IFR_BINARY *gBinaryDataHead;
|
||||
|
||||
//
|
||||
// The IFR binary that the user chose to run
|
||||
//
|
||||
UINTN gActiveIfr;
|
||||
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
|
||||
VOID *CachedNVEntry;
|
||||
BANNER_DATA *BannerData;
|
||||
EFI_HII_HANDLE FrontPageHandle;
|
||||
STRING_REF FrontPageTimeOutTitle;
|
||||
INT16 FrontPageTimeOutValue;
|
||||
UINTN gClassOfVfr;
|
||||
UINTN gFunctionKeySetting;
|
||||
BOOLEAN gResetRequired;
|
||||
BOOLEAN gExitRequired;
|
||||
BOOLEAN gSaveRequired;
|
||||
BOOLEAN gNvUpdateRequired;
|
||||
UINT16 gConsistencyId;
|
||||
UINTN gPriorMenuEntry;
|
||||
EFI_HII_HANDLE gHiiHandle;
|
||||
BOOLEAN gFirstIn;
|
||||
VOID *gPreviousValue;
|
||||
UINT16 gDirection;
|
||||
EFI_SCREEN_DESCRIPTOR gScreenDimensions;
|
||||
BOOLEAN gUpArrow;
|
||||
BOOLEAN gDownArrow;
|
||||
BOOLEAN gTimeOnScreen;
|
||||
BOOLEAN gDateOnScreen;
|
||||
|
||||
//
|
||||
// Browser Global Strings
|
||||
//
|
||||
CHAR16 *gFunctionOneString;
|
||||
CHAR16 *gFunctionTwoString;
|
||||
CHAR16 *gFunctionNineString;
|
||||
CHAR16 *gFunctionTenString;
|
||||
CHAR16 *gEnterString;
|
||||
CHAR16 *gEnterCommitString;
|
||||
CHAR16 *gEscapeString;
|
||||
CHAR16 *gMoveHighlight;
|
||||
CHAR16 *gMakeSelection;
|
||||
CHAR16 *gNumericInput;
|
||||
CHAR16 *gToggleCheckBox;
|
||||
CHAR16 *gPromptForPassword;
|
||||
CHAR16 *gPromptForNewPassword;
|
||||
CHAR16 *gConfirmPassword;
|
||||
CHAR16 *gConfirmError;
|
||||
CHAR16 *gPressEnter;
|
||||
CHAR16 *gEmptyString;
|
||||
CHAR16 *gAreYouSure;
|
||||
CHAR16 *gYesResponse;
|
||||
CHAR16 *gNoResponse;
|
||||
CHAR16 *gMiniString;
|
||||
CHAR16 *gPlusString;
|
||||
CHAR16 *gMinusString;
|
||||
CHAR16 *gAdjustNumber;
|
||||
|
||||
CHAR16 gPromptBlockWidth;
|
||||
CHAR16 gOptionBlockWidth;
|
||||
CHAR16 gHelpBlockWidth;
|
||||
|
||||
//
|
||||
// Global Procedure Defines
|
||||
//
|
||||
VOID
|
||||
InitializeBrowserStrings (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
Print (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintString (
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintChar (
|
||||
CHAR16 Character
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
DisplayPageFrame (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
CHAR16 *
|
||||
GetToken (
|
||||
IN STRING_REF IfrBinaryTitle,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
GetTagCount (
|
||||
IN UINT8 *RawFormSet,
|
||||
IN OUT UINT16 *NumberOfTags
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
GetNumericHeader (
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINT8 *RawFormSet,
|
||||
IN UINT16 Index,
|
||||
IN UINT16 NumberOfLines,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
IN UINT16 CurrentVariable
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
GetQuestionHeader (
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINT8 *RawFormSet,
|
||||
IN UINT16 Index,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
IN UINT16 CurrentVariable
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
CreateSharedPopUp (
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN CHAR16 **ArrayOfStrings
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateDialog (
|
||||
IN UINTN NumberOfLines,
|
||||
IN BOOLEAN HotKey,
|
||||
IN UINTN MaximumStringSize,
|
||||
OUT CHAR16 *StringBuffer,
|
||||
OUT EFI_INPUT_KEY *KeyValue,
|
||||
IN CHAR16 *String,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
#/** @file
|
||||
# Component description file for SetupBrowser module.
|
||||
#
|
||||
# This driver initializes Setup for the brower and installs FormBrowser protocol.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
#
|
||||
# All rights reserved. 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 Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SetupBrowser
|
||||
FILE_GUID = EBf342FE-B1D3-4EF8-957C-8048606FF670
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeSetup
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# Create Event Guid C Name: EFI_EVENT_TIMER Event Type: EVENT_GROUP_GUID
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
Colors.h
|
||||
Ui.h
|
||||
Ui.c
|
||||
ProcessOptions.c
|
||||
Presentation.c
|
||||
Print.h
|
||||
Print.c
|
||||
InputHandler.c
|
||||
Boolean.c
|
||||
Setup.h
|
||||
Setup.c
|
||||
SetupBrowserStr.uni
|
||||
CommonHeader.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
EdkGraphicsLib
|
||||
FrameworkHiiLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
PrintLib
|
||||
UefiDriverEntryPoint
|
||||
MemoryAllocationLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
BaseLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiPrintProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiFormBrowserProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiFormCallbackProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>SetupBrowser</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>EBf342FE-B1D3-4EF8-957C-8048606FF670</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for SetupBrowser module.</Abstract>
|
||||
<Description>This driver initializes Setup for the brower and installs FormBrowser protocol.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. 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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>SetupBrowser</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HiiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>EdkGraphicsLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>SetupBrowserStr.uni</Filename>
|
||||
<Filename>Setup.c</Filename>
|
||||
<Filename>Setup.h</Filename>
|
||||
<Filename>Boolean.c</Filename>
|
||||
<Filename>InputHandler.c</Filename>
|
||||
<Filename>Print.c</Filename>
|
||||
<Filename>Print.h</Filename>
|
||||
<Filename>Presentation.c</Filename>
|
||||
<Filename>ProcessOptions.c</Filename>
|
||||
<Filename>Ui.c</Filename>
|
||||
<Filename>Ui.h</Filename>
|
||||
<Filename>Colors.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiPrintProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Events>
|
||||
<CreateEvents>
|
||||
<EventTypes EventGuidCName="EFI_EVENT_TIMER" Usage="ALWAYS_CONSUMED">
|
||||
<EventType>EVENT_GROUP_GUID</EventType>
|
||||
</EventTypes>
|
||||
</CreateEvents>
|
||||
</Events>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>InitializeSetup</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,440 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. 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:
|
||||
|
||||
Ui.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file UI
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _UI_H
|
||||
#define _UI_H
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
#define REGULAR_NUMERIC 0
|
||||
#define TIME_NUMERIC 1
|
||||
#define DATE_NUMERIC 2
|
||||
|
||||
typedef enum {
|
||||
UiNoOperation,
|
||||
UiDefault,
|
||||
UiSelect,
|
||||
UiUp,
|
||||
UiDown,
|
||||
UiLeft,
|
||||
UiRight,
|
||||
UiReset,
|
||||
UiSave,
|
||||
UiPrevious,
|
||||
UiPageUp,
|
||||
UiPageDown,
|
||||
UiMaxOperation
|
||||
} UI_SCREEN_OPERATION;
|
||||
|
||||
typedef enum {
|
||||
CfInitialization,
|
||||
CfCheckSelection,
|
||||
CfRepaint,
|
||||
CfRefreshHighLight,
|
||||
CfUpdateHelpString,
|
||||
CfPrepareToReadKey,
|
||||
CfReadKey,
|
||||
CfScreenOperation,
|
||||
CfUiPrevious,
|
||||
CfUiSelect,
|
||||
CfUiReset,
|
||||
CfUiLeft,
|
||||
CfUiRight,
|
||||
CfUiUp,
|
||||
CfUiPageUp,
|
||||
CfUiPageDown,
|
||||
CfUiDown,
|
||||
CfUiSave,
|
||||
CfUiDefault,
|
||||
CfUiNoOperation,
|
||||
CfExit,
|
||||
CfMaxControlFlag
|
||||
} UI_CONTROL_FLAG;
|
||||
|
||||
#define UI_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
|
||||
#define UI_MENU_LIST_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINTN Row;
|
||||
UINTN Col;
|
||||
UINTN OptCol;
|
||||
CHAR16 *Description;
|
||||
UINTN Skip;
|
||||
|
||||
UINTN IfrNumber;
|
||||
VOID *FormBinary;
|
||||
EFI_HII_HANDLE Handle;
|
||||
EFI_TAG *Tags;
|
||||
UINTN TagIndex;
|
||||
EFI_TAG *ThisTag;
|
||||
UINT16 FormId;
|
||||
BOOLEAN Previous;
|
||||
UINT16 EntryNumber;
|
||||
UINT16 Consistency;
|
||||
BOOLEAN GrayOut;
|
||||
} UI_MENU_OPTION;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY MenuLink;
|
||||
|
||||
UI_MENU_OPTION Selection;
|
||||
UINTN FormerEntryNumber;
|
||||
} UI_MENU_LIST;
|
||||
|
||||
typedef struct _MENU_REFRESH_ENTRY {
|
||||
struct _MENU_REFRESH_ENTRY *Next;
|
||||
EFI_FILE_FORM_TAGS *FileFormTagsHead;
|
||||
UINTN CurrentColumn;
|
||||
UINTN CurrentRow;
|
||||
UINTN CurrentAttribute;
|
||||
UI_MENU_OPTION *MenuOption; // Describes the entry needing an update
|
||||
} MENU_REFRESH_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
} SCAN_CODE_TO_SCREEN_OPERATION;
|
||||
|
||||
typedef struct {
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
UI_CONTROL_FLAG ControlFlag;
|
||||
} SCREEN_OPERATION_T0_CONTROL_FLAG;
|
||||
|
||||
LIST_ENTRY Menu;
|
||||
LIST_ENTRY gMenuList;
|
||||
MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
||||
|
||||
INTN gEntryNumber;
|
||||
BOOLEAN gLastOpr;
|
||||
//
|
||||
// Global Functions
|
||||
//
|
||||
VOID
|
||||
UiInitMenu (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiInitMenuList (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiRemoveMenuListEntry (
|
||||
IN UI_MENU_OPTION *Selection,
|
||||
OUT UI_MENU_OPTION **PreviousSelection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiFreeMenuList (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiAddMenuListEntry (
|
||||
IN UI_MENU_OPTION *Selection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiFreeMenu (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiAddMenuOption (
|
||||
IN CHAR16 *String,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN EFI_TAG *Tag,
|
||||
IN VOID *FormBinary,
|
||||
IN UINTN IfrNumber
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiAddSubMenuOption (
|
||||
IN CHAR16 *String,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINTN TagIndex,
|
||||
IN UINT16 FormId,
|
||||
IN UINT16 MenuItemCount
|
||||
)
|
||||
;
|
||||
|
||||
UI_MENU_OPTION *
|
||||
UiDisplayMenu (
|
||||
IN BOOLEAN SubMenu,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
|
||||
OUT EFI_IFR_DATA_ARRAY *PageData
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
InitPage (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
UI_MENU_OPTION *
|
||||
SetupBrowser (
|
||||
IN UI_MENU_OPTION *Selection,
|
||||
IN BOOLEAN Callback,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
|
||||
IN UINT8 *CallbackData
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
SetUnicodeMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR16 Value
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UiWaitForSingleEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN UINT64 Timeout OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
CreatePopUp (
|
||||
IN UINTN ScreenWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN CHAR16 *ArrayOfStrings,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ReadString (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
OUT CHAR16 *StringPtr
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ReadPassword (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN PromptForPassword,
|
||||
IN EFI_TAG *Tag,
|
||||
IN EFI_IFR_DATA_ARRAY *PageData,
|
||||
IN BOOLEAN SecondEntry,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
OUT CHAR16 *StringPtr
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
EncodePassword (
|
||||
IN CHAR16 *Password,
|
||||
IN UINT8 MaxSize
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetSelectionInputPopUp (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINTN ValueCount,
|
||||
OUT UINT16 *Value,
|
||||
OUT UINT16 *KeyValue
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetSelectionInputLeftRight (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINTN ValueCount,
|
||||
OUT UINT16 *Value
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetNumericInput (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
|
||||
IN BOOLEAN ManualInput,
|
||||
IN EFI_TAG *Tag,
|
||||
IN UINTN NumericType,
|
||||
OUT UINT16 *Value
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UpdateStatusBar (
|
||||
IN UINTN MessageType,
|
||||
IN UINT8 Flags,
|
||||
IN BOOLEAN State
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOptions (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
|
||||
IN EFI_IFR_DATA_ARRAY *PageData,
|
||||
OUT CHAR16 **OptionString
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ProcessHelpString (
|
||||
IN CHAR16 *StringPtr,
|
||||
OUT CHAR16 **FormattedString,
|
||||
IN UINTN RowCount
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UpdateKeyHelp (
|
||||
IN UI_MENU_OPTION *Selection,
|
||||
IN BOOLEAN Selected
|
||||
)
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
ValueIsNotValid (
|
||||
IN BOOLEAN Complex,
|
||||
IN UINT16 Value,
|
||||
IN EFI_TAG *Tag,
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
IN STRING_REF *PopUp
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
FreeData (
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
|
||||
IN CHAR16 *FormattedString,
|
||||
IN CHAR16 *OptionString
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ClearLines (
|
||||
UINTN LeftColumn,
|
||||
UINTN RightColumn,
|
||||
UINTN TopRow,
|
||||
UINTN BottomRow,
|
||||
UINTN TextAttribute
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
GetStringWidth (
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINT16
|
||||
GetLineByWidth (
|
||||
IN CHAR16 *InputString,
|
||||
IN UINT16 LineWidth,
|
||||
IN OUT UINTN *Index,
|
||||
OUT CHAR16 **OutputString
|
||||
)
|
||||
;
|
||||
|
||||
UINT16
|
||||
GetWidth (
|
||||
IN EFI_TAG *Tag,
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
NewStrCat (
|
||||
CHAR16 *Destination,
|
||||
CHAR16 *Source
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
IfrToFormTag (
|
||||
IN UINT8 OpCode,
|
||||
IN EFI_TAG *TargetTag,
|
||||
IN VOID *FormData,
|
||||
EFI_VARIABLE_DEFINITION *VariableDefinitionsHead
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ExtractNvValue (
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
IN UINT16 VariableId,
|
||||
IN UINT16 VariableSize,
|
||||
IN UINT16 OffsetValue,
|
||||
OUT VOID **Buffer
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ExtractRequestedNvMap (
|
||||
IN EFI_FILE_FORM_TAGS *FileFormTags,
|
||||
IN UINT16 VariableId,
|
||||
OUT EFI_VARIABLE_DEFINITION **VariableDefinition
|
||||
)
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
ValueIsScroll (
|
||||
IN BOOLEAN Direction,
|
||||
IN LIST_ENTRY *CurrentPos
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
AdjustDateAndTimePosition (
|
||||
IN BOOLEAN DirectionUp,
|
||||
IN LIST_ENTRY **CurrentPosition
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
WaitForKeyStroke (
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
)
|
||||
;
|
||||
#endif // _UI_H
|
Loading…
Reference in New Issue