UEFI HII: Merge UEFI HII support changes from branch.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4599 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2008-01-21 14:39:56 +00:00
parent f79314fa8f
commit 93e3992d1e
139 changed files with 59162 additions and 382 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>HiiDatabase</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>348C4D62-BFBD-4882-9ECE-C80BB1C4783B</GuidValue>
<Version>1.0</Version>
<Abstract>Component name for module HiiDatabase</Abstract>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</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>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiDriverEntryPoint</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>R8Lib.c</Filename>
<Filename>R8Lib.h</Filename>
<Filename>Font.c</Filename>
<Filename>Database.c</Filename>
<Filename>String.c</Filename>
<Filename>ConfigRouting.c</Filename>
<Filename>HiiDatabase.dxs</Filename>
<Filename>HiiDatabase.h</Filename>
<Filename>Image.c</Filename>
<Filename>HiiDatabaseEntry.c</Filename>
<Filename>CVS\TortoiseCVS.Status</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
</PackageDependencies>
<Protocols>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
<ModuleEntryPoint>InitializeHiiDatabase</ModuleEntryPoint>
</Extern>
</Externs>
</ModuleSurfaceArea>

View File

@@ -0,0 +1,75 @@
#/** @file
# Component name for module HiiDatabase
#
# FIX ME!
# Copyright (c) 2007, Intel Corporation. All rights reserved.
#
# 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]
INF_VERSION = 0x00010005
BASE_NAME = HiiDatabase
FILE_GUID = 348C4D62-BFBD-4882-9ECE-C80BB1C4783B
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
ENTRY_POINT = InitializeHiiDatabase
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
HiiDatabaseEntry.c
Image.c
HiiDatabase.h
ConfigRouting.c
String.c
Database.c
Font.c
R8Lib.h
R8Lib.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
DevicePathLib
BaseLib
UefiBootServicesTableLib
UefiDriverEntryPoint
BaseMemoryLib
DebugLib
[Protocols]
gEfiConsoleControlProtocolGuid
gEfiDevicePathProtocolGuid
gEfiHiiStringProtocolGuid
gEfiHiiImageProtocolGuid
gEfiHiiConfigRoutingProtocolGuid
gEfiHiiDatabaseProtocolGuid
gEfiHiiFontProtocolGuid
gEfiHiiConfigAccessProtocolGuid
[Depex]
TRUE

View File

@@ -0,0 +1,197 @@
/** @file
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:
HiiDatabaseEntry.c
Abstract:
This file contains the entry code to the HII database, which is defined by
UEFI 2.1 specification.
Revision History
**/
#include "HiiDatabase.h"
//
// Global variables
//
EFI_EVENT gHiiKeyboardLayoutChanged;
STATIC EFI_GUID gHiiSetKbdLayoutEventGuid = EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID;
STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
HII_DATABASE_PRIVATE_DATA_SIGNATURE,
{
(LIST_ENTRY *) NULL,
(LIST_ENTRY *) NULL
},
{
(LIST_ENTRY *) NULL,
(LIST_ENTRY *) NULL
},
{
HiiStringToImage,
HiiStringIdToImage,
HiiGetGlyph,
HiiGetFontInfo
},
#ifndef DISABLE_UNUSED_HII_PROTOCOLS
{
HiiNewImage,
HiiGetImage,
HiiSetImage,
HiiDrawImage,
HiiDrawImageId
},
#endif
{
HiiNewString,
HiiGetString,
HiiSetString,
HiiGetLanguages,
HiiGetSecondaryLanguages
},
{
HiiNewPackageList,
HiiRemovePackageList,
HiiUpdatePackageList,
HiiListPackageLists,
HiiExportPackageLists,
HiiRegisterPackageNotify,
HiiUnregisterPackageNotify,
HiiFindKeyboardLayouts,
HiiGetKeyboardLayout,
HiiSetKeyboardLayout,
HiiGetPackageListHandle
},
{
HiiConfigRoutingExtractConfig,
HiiConfigRoutingExportConfig,
HiiConfigRoutingRoutConfig,
HiiBlockToConfig,
HiiConfigToBlock,
HiiGetAltCfg
},
{
(LIST_ENTRY *) NULL,
(LIST_ENTRY *) NULL
},
0,
{
(LIST_ENTRY *) NULL,
(LIST_ENTRY *) NULL
},
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK),
{
0x00000000,
0x0000,
0x0000,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
NULL
};
//@MT: EFI_DRIVER_ENTRY_POINT (InitializeHiiDatabase)
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 -
other -
--*/
{
EFI_STATUS Status;
EFI_HANDLE Handle;
EFI_HANDLE *HandleBuffer;
UINTN HandleCount;
//@MT: EfiInitializeDriverLib (ImageHandle, SystemTable);
//
// 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,
&gEfiHiiDatabaseProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
//
// If there was no error, assume there is an installation and fail to load
//
if (!EFI_ERROR (Status)) {
if (HandleBuffer != NULL) {
gBS->FreePool (HandleBuffer);
}
return EFI_DEVICE_ERROR;
}
InitializeListHead (&mPrivate.DatabaseList);
InitializeListHead (&mPrivate.DatabaseNotifyList);
InitializeListHead (&mPrivate.HiiHandleList);
InitializeListHead (&mPrivate.FontInfoList);
//
// Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
//
Status = gBS->CreateEventEx (
0,
0,
NULL,
NULL,
&gHiiSetKbdLayoutEventGuid,
&gHiiKeyboardLayoutChanged
);
if (EFI_ERROR (Status)) {
return Status;
}
Handle = NULL;
return gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiHiiFontProtocolGuid,
&mPrivate.HiiFont,
#ifndef DISABLE_UNUSED_HII_PROTOCOLS
&gEfiHiiImageProtocolGuid,
&mPrivate.HiiImage,
#endif
&gEfiHiiStringProtocolGuid,
&mPrivate.HiiString,
&gEfiHiiDatabaseProtocolGuid,
&mPrivate.HiiDatabase,
&gEfiHiiConfigRoutingProtocolGuid,
&mPrivate.ConfigRouting,
NULL
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,284 @@
/**@file
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.
**/
#include "HiiDatabase.h"
CHAR16
NibbleToHexChar (
IN UINT8 Nibble
)
/*++
Routine Description:
Converts the low nibble of a byte to hex unicode character.
Arguments:
Nibble - lower nibble of a byte.
Returns:
Hex unicode character.
--*/
{
Nibble &= 0x0F;
if (Nibble <= 0x9) {
return (CHAR16)(Nibble + L'0');
}
return (CHAR16)(Nibble - 0xA + L'A');
}
/**
Compare whether two names of languages are identical.
@param Language1 Name of language 1
@param Language2 Name of language 2
@retval TRUE same
@retval FALSE not same
**/
BOOLEAN
R8_EfiLibCompareLanguage (
IN CHAR8 *Language1,
IN CHAR8 *Language2
)
{
//
// Porting Guide:
// This library interface is simply obsolete.
// Include the source code to user code.
//
UINTN Index;
for (Index = 0; (Language1[Index] != 0) && (Language2[Index] != 0); Index++) {
if (Language1[Index] != Language2[Index]) {
return FALSE;
}
}
if (((Language1[Index] == 0) && (Language2[Index] == 0)) ||
((Language1[Index] == 0) && (Language2[Index] != ';')) ||
((Language1[Index] == ';') && (Language2[Index] != 0)) ||
((Language1[Index] == ';') && (Language2[Index] != ';'))) {
return TRUE;
}
return FALSE;
}
/**
Converts binary buffer to Unicode string.
At a minimum, any blob of data could be represented as a hex string.
@param Str Pointer to the string.
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
Includes tailing '\0' character. If routine return
with EFI_SUCCESS, containing length of hex string
buffer. If routine return with
EFI_BUFFER_TOO_SMALL, containg length of hex
string buffer desired.
@param Buf Buffer to be converted from.
@param Len Length in bytes of the buffer to be converted.
@retval EFI_SUCCESS Routine success.
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
**/
EFI_STATUS
R8_BufToHexString (
IN OUT CHAR16 *Str,
IN OUT UINTN *HexStringBufferLength,
IN UINT8 *Buf,
IN UINTN Len
)
{
//
// Porting Guide:
// This library interface is simply obsolete.
// Include the source code to user code.
//
UINTN Idx;
UINT8 Byte;
UINTN StrLen;
//
// Make sure string is either passed or allocate enough.
// It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
// Plus the Unicode termination character.
//
StrLen = Len * 2;
if (StrLen > ((*HexStringBufferLength) - 1)) {
*HexStringBufferLength = StrLen + 1;
return EFI_BUFFER_TOO_SMALL;
}
*HexStringBufferLength = StrLen + 1;
//
// Ends the string.
//
Str[StrLen] = L'\0';
for (Idx = 0; Idx < Len; Idx++) {
Byte = Buf[Idx];
Str[StrLen - 1 - Idx * 2] = NibbleToHexChar (Byte);
Str[StrLen - 2 - Idx * 2] = NibbleToHexChar ((UINT8)(Byte >> 4));
}
return EFI_SUCCESS;
}
/**
Converts Unicode string to binary buffer.
The conversion may be partial.
The first character in the string that is not hex digit stops the conversion.
At a minimum, any blob of data could be represented as a hex string.
@param Buf Pointer to buffer that receives the data.
@param Len Length in bytes of the buffer to hold converted
data. If routine return with EFI_SUCCESS,
containing length of converted data. If routine
return with EFI_BUFFER_TOO_SMALL, containg length
of buffer desired.
@param Str String to be converted from.
@param ConvertedStrLen Length of the Hex String consumed.
@retval EFI_SUCCESS Routine Success.
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
**/
EFI_STATUS
R8_HexStringToBuf (
IN OUT UINT8 *Buf,
IN OUT UINTN *Len,
IN CHAR16 *Str,
OUT UINTN *ConvertedStrLen OPTIONAL
)
{
//
// Porting Guide:
// This library interface is simply obsolete.
// Include the source code to user code.
//
UINTN HexCnt;
UINTN Idx;
UINTN BufferLength;
UINT8 Digit;
UINT8 Byte;
//
// Find out how many hex characters the string has.
//
for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
if (HexCnt == 0) {
*Len = 0;
return EFI_SUCCESS;
}
//
// Two Unicode characters make up 1 buffer byte. Round up.
//
BufferLength = (HexCnt + 1) / 2;
//
// Test if buffer is passed enough.
//
if (BufferLength > (*Len)) {
*Len = BufferLength;
return EFI_BUFFER_TOO_SMALL;
}
*Len = BufferLength;
for (Idx = 0; Idx < HexCnt; Idx++) {
R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
//
// For odd charaters, write the lower nibble for each buffer byte,
// and for even characters, the upper nibble.
//
if ((Idx & 1) == 0) {
Byte = Digit;
} else {
Byte = Buf[Idx / 2];
Byte &= 0x0F;
Byte = (UINT8) (Byte | Digit << 4);
}
Buf[Idx / 2] = Byte;
}
if (ConvertedStrLen != NULL) {
*ConvertedStrLen = HexCnt;
}
return EFI_SUCCESS;
}
/**
Determines if a Unicode character is a hexadecimal digit.
The test is case insensitive.
@param Digit Pointer to byte that receives the value of the hex
character.
@param Char Unicode character to test.
@retval TRUE If the character is a hexadecimal digit.
@retval FALSE Otherwise.
**/
BOOLEAN
R8_IsHexDigit (
OUT UINT8 *Digit,
IN CHAR16 Char
)
{
//
// Porting Guide:
// This library interface is simply obsolete.
// Include the source code to user code.
//
if ((Char >= L'0') && (Char <= L'9')) {
*Digit = (UINT8) (Char - L'0');
return TRUE;
}
if ((Char >= L'A') && (Char <= L'F')) {
*Digit = (UINT8) (Char - L'A' + 0x0A);
return TRUE;
}
if ((Char >= L'a') && (Char <= L'f')) {
*Digit = (UINT8) (Char - L'a' + 0x0A);
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,121 @@
/**@file
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.
**/
#ifndef __R8_LIB_H__
#define __R8_LIB_H__
/**
Compare whether two names of languages are identical.
@param Language1 Name of language 1
@param Language2 Name of language 2
@retval TRUE same
@retval FALSE not same
**/
BOOLEAN
R8_EfiLibCompareLanguage (
IN CHAR8 *Language1,
IN CHAR8 *Language2
)
;
/**
Converts binary buffer to Unicode string.
At a minimum, any blob of data could be represented as a hex string.
@param Str Pointer to the string.
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
Includes tailing '\0' character. If routine return
with EFI_SUCCESS, containing length of hex string
buffer. If routine return with
EFI_BUFFER_TOO_SMALL, containg length of hex
string buffer desired.
@param Buf Buffer to be converted from.
@param Len Length in bytes of the buffer to be converted.
@retval EFI_SUCCESS Routine success.
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
**/
EFI_STATUS
R8_BufToHexString (
IN OUT CHAR16 *Str,
IN OUT UINTN *HexStringBufferLength,
IN UINT8 *Buf,
IN UINTN Len
)
;
/**
Converts Unicode string to binary buffer.
The conversion may be partial.
The first character in the string that is not hex digit stops the conversion.
At a minimum, any blob of data could be represented as a hex string.
@param Buf Pointer to buffer that receives the data.
@param Len Length in bytes of the buffer to hold converted
data. If routine return with EFI_SUCCESS,
containing length of converted data. If routine
return with EFI_BUFFER_TOO_SMALL, containg length
of buffer desired.
@param Str String to be converted from.
@param ConvertedStrLen Length of the Hex String consumed.
@retval EFI_SUCCESS Routine Success.
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
**/
EFI_STATUS
R8_HexStringToBuf (
IN OUT UINT8 *Buf,
IN OUT UINTN *Len,
IN CHAR16 *Str,
OUT UINTN *ConvertedStrLen OPTIONAL
)
;
/**
Determines if a Unicode character is a hexadecimal digit.
The test is case insensitive.
@param Digit Pointer to byte that receives the value of the hex
character.
@param Char Unicode character to test.
@retval TRUE If the character is a hexadecimal digit.
@retval FALSE Otherwise.
**/
BOOLEAN
R8_IsHexDigit (
OUT UINT8 *Digit,
IN CHAR16 Char
)
;
#endif

File diff suppressed because it is too large Load Diff