Add in FrameworkHiiToUefiHiiThunk module.

For now, it support these Framework HII protocol interfaces, more will be added:
1) NewPack
2) RemovePack
3) NewString
4) GetString

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4991 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-04-03 09:59:39 +00:00
parent 15762b535c
commit 14246993c8
10 changed files with 1761 additions and 0 deletions

View File

@ -0,0 +1,68 @@
/**@file
This file contains the Glyph related function.
Copyright (c) 2006 - 2008, 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"
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:
--*/
{
ASSERT (FALSE);
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
)
{
ASSERT (FALSE);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,154 @@
/**@file
This file contains the form processing code to the HII database.
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
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"
EFI_STATUS
EFIAPI
HiiExportDatabase (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
/*++
Routine Description:
This function allows a program to extract a form or form package that has
previously been registered with the EFI HII database.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetForms (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_ID FormId,
IN OUT UINTN *BufferLengthTemp,
OUT UINT8 *Buffer
)
/*++
Routine Description:
This function allows a program to extract a form or form package that has
previously been registered with the EFI HII database.
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in
EFI_HII_PROTOCOL.NewPack() in the Packages section.
FormId - The ID of the form to return. If the ID is zero, the entire form package is returned.
Type EFI_FORM_ID is defined in "Related Definitions" below.
BufferLength - On input, the length of the Buffer. On output, the length of the returned buffer, if
the length was sufficient and, if it was not, the length that is required to fit the
requested form(s).
Buffer - The buffer designed to receive the form(s).
Returns:
EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
was updated.
EFI_INVALID_PARAMETER - The handle is unknown.
EFI_NOT_FOUND - A form on the requested handle cannot be found with the
requested FormId.
EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetDefaultImage (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN UINTN DefaultMask,
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
)
/*++
Routine Description:
This function allows a program to extract the NV Image
that represents the default storage image
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - The HII handle from which will have default data retrieved.
UINTN - Mask used to retrieve the default image.
VariablePackList - Callee allocated, tightly-packed, link list data
structure that contain all default varaible packs
from the Hii Database.
Returns:
EFI_NOT_FOUND - If Hii database does not contain any default images.
EFI_INVALID_PARAMETER - Invalid input parameter.
EFI_SUCCESS - Operation successful.
--*/
{
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiUpdateForm (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_LABEL Label,
IN BOOLEAN AddData,
IN EFI_HII_UPDATE_DATA *Data
)
/*++
Routine Description:
This function allows the caller to update a form that has
previously been registered with the EFI HII database.
Arguments:
Handle - Hii Handle associated with the Formset to modify
Label - Update information starting immediately after this label in the IFR
AddData - If TRUE, add data. If FALSE, remove data
Data - If adding data, this is the pointer to the data to add
Returns:
EFI_SUCCESS - Update success.
Other - Update fail.
--*/
{
return EFI_SUCCESS;
}

View File

@ -0,0 +1,75 @@
#/** @file
# Component description file for HiiDatabase module which produce a Framework HII instance
# based on the avaliable UEFI HII protocol found in the platform.
#
# This module inits HII database and installs HII protocol based on the avaliable UEFI HII protocol found in the platform..
# Copyright (c) 2006 - 2008, 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]
INF_VERSION = 0x00010005
BASE_NAME = FrameworkHiiToUefiHiiThunk
FILE_GUID = AC3435BB-B1D3-4EF8-957C-8048606FF671
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.common]
Keyboard.c
Fonts.c
Package.c
Strings.c
Forms.c
HiiDatabase.h
HiiDatabase.c
Utility.c
Utility.h
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
BaseMemoryLib
MemoryAllocationLib
UefiDriverEntryPoint
DebugLib
BaseLib
HiiLib
[Protocols]
gEfiHiiProtocolGuid
gEfiHiiImageProtocolGuid
gEfiHiiDatabaseProtocolGuid
gEfiHiiStringProtocolGuid
gEfiHiiFontProtocolGuid
[Depex]
gEfiHiiImageProtocolGuid AND
gEfiHiiDatabaseProtocolGuid AND
gEfiHiiStringProtocolGuid AND
gEfiHiiFontProtocolGuid

View File

@ -0,0 +1,207 @@
/**@file
Framework to UEFI 2.1 HII Thunk
Copyright (c) 2003, 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"
EFI_HII_THUNK_PRIVATE_DATA HiiThunkPrivateDataTempate = {
{//Signature
EFI_HII_THUNK_DRIVER_DATA_SIGNATURE
},
{//Handle
(EFI_HANDLE) NULL
},
{ //Hii
HiiNewPack,
HiiRemovePack,
HiiFindHandles,
HiiExportDatabase,
HiiTestString,
HiiGetGlyph,
HiiGlyphToBlt,
HiiNewString,
HiiGetPrimaryLanguages,
HiiGetSecondaryLanguages,
HiiGetString,
HiiResetStrings,
HiiGetLine,
HiiGetForms,
HiiGetDefaultImage,
HiiUpdateForm,
HiiGetKeyboardLayout
},
{ //StaticHiiHandle
//The FRAMEWORK_EFI_HII_HANDLE starts from 1
// and increase upwords untill reach 2^(sizeof (FRAMEWORK_EFI_HII_HANDLE)) - 1.
// The code will assert to prevent overflow.
(FRAMEWORK_EFI_HII_HANDLE) 1
},
{
NULL, NULL //HiiHandleLinkList
},
};
EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
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_HII_THUNK_PRIVATE_DATA *HiiData;
EFI_HANDLE Handle;
EFI_STATUS Status;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid);
HiiData = AllocateCopyPool (sizeof (EFI_HII_THUNK_PRIVATE_DATA), &HiiThunkPrivateDataTempate);
ASSERT (HiiData != NULL);
InitializeListHead (&HiiData->HiiThunkHandleMappingDBListHead);
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **) &mUefiHiiDatabaseProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiFontProtocolGuid,
NULL,
(VOID **) &mUefiHiiFontProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiImageProtocolGuid,
NULL,
(VOID **) &mUefiHiiImageProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiStringProtocolGuid,
NULL,
(VOID **) &mUefiStringProtocol
);
ASSERT_EFI_ERROR (Status);
//
// Install protocol interface
//
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&HiiData->Handle,
&gEfiHiiProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *) &HiiData->Hii
);
ASSERT_EFI_ERROR (Status);
return Status;
}
EFI_STATUS
EFIAPI
HiiFindHandles (
IN EFI_HII_PROTOCOL *This,
IN OUT UINT16 *HandleBufferLength,
OUT FRAMEWORK_EFI_HII_HANDLE Handle[1]
)
/*++
Routine Description:
Determines the handles that are currently active in the database.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiGetPrimaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiGetSecondaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,322 @@
/**@file
This file contains global defines and prototype definitions
for the HII database.
Copyright (c) 2006 - 2008, 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 _HIIDATABASE_H
#define _HIIDATABASE_H
#include <FrameworkDxe.h>
#include <Guid/GlobalVariable.h>
#include <Protocol/FrameworkFormCallback.h>
#include <Protocol/FrameworkHii.h>
//
// UEFI HII Protocols
//
#include <Protocol/HiiFont.h>
#include <Protocol/HiiImage.h>
#include <Protocol/HiiString.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiConfigAccess.h>
#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/FrameworkIfrSupportLib.h>
#include <Library/HiiLib.h>
#include "Utility.h"
//
// Macros
//
//
// Typedef
//
typedef struct {
UINT32 BinaryLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
} TIANO_AUTOGEN_PACKAGES_HEADER;
#define EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_HII_THUNK_PRIVATE_DATA, Hii, EFI_HII_THUNK_DRIVER_DATA_SIGNATURE)
#define EFI_HII_THUNK_DRIVER_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'I', 'T')
typedef struct {
UINTN Signature;
EFI_HANDLE Handle;
EFI_HII_PROTOCOL Hii;
FRAMEWORK_EFI_HII_HANDLE StaticHiiHandle;
//
// This LIST_ENTRY is the list head which has HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY type
// as list entry.
//
LIST_ENTRY HiiThunkHandleMappingDBListHead;
} EFI_HII_THUNK_PRIVATE_DATA;
#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY(Record) CR(Record, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY, List, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE)
#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('H', 'T', 'H', 'M')
typedef struct {
LIST_ENTRY List;
UINT32 Signature;
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_HII_HANDLE UefiHiiHandle;
BOOLEAN IsPackageListWithOnlyStringPackages;
//
// The field below is only valid if IsPackageListWithOnlyStringPack is TRUE.
// The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption
// in both HII Database implementation and all modules that registering packages:
// If a Package List has only IFR package and no String Package, the String Package containing the strings
// referenced by this IFR package is in another Package List
// registered with the HII database with the same EFI_HII_PACKAGES.GuidId.
//
//
// Only valid if IsPackageListWithSingleStringPack is TRUE.
// UEFI Package List Head Pointer, pointing to a allocated buffer containing the package
//
EFI_HII_PACKAGE_LIST_HEADER *UefiStringPackageListHeader; //Only valid if IsStringPack is TRUE.
//This UEFI Package list only consists of a list of string packages.
EFI_GUID TagGuid;
//
// TRUE if the package list identified by UefiHiiHandle imports String Packages from
// other package list with IsPackageListWithOnlyStringPackages is TRUE.
//
BOOLEAN DoesPackageListImportStringPackages;
EFI_HII_PACKAGE_LIST_HEADER *ImportedUefiStringPackageListHeader; //Only valid if DoesPackageListImportStringPackages is true.
} HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY;
//
// Extern Variables
//
extern EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
extern EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
extern EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
extern EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
//
// Prototypes
//
//
// 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 FRAMEWORK_EFI_HII_HANDLE *Handle
)
;
EFI_STATUS
EFIAPI
HiiRemovePack (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
;
EFI_STATUS
EFIAPI
HiiFindHandles (
IN EFI_HII_PROTOCOL *This,
IN OUT UINT16 *HandleBufferLength,
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
)
;
EFI_STATUS
EFIAPI
HiiExportDatabase (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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 FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
;
EFI_STATUS
EFIAPI
HiiGetString (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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 FRAMEWORK_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 FRAMEWORK_EFI_HII_HANDLE Handle,
OUT EFI_STRING *LanguageString
)
;
EFI_STATUS
EFIAPI
HiiGetSecondaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN CHAR16 *PrimaryLanguage,
OUT EFI_STRING *LanguageString
)
;
EFI_STATUS
EFIAPI
HiiGetLine (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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 FRAMEWORK_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 FRAMEWORK_EFI_HII_HANDLE Handle,
IN UINTN DefaultMask,
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
)
;
EFI_STATUS
EFIAPI
HiiUpdateForm (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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 FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
)
;
EFI_STATUS
HiiCompareLanguage (
IN CHAR16 *LanguageStringLocation,
IN CHAR16 *Language
)
;
#endif

View File

@ -0,0 +1,37 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, 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"
EFI_STATUS
EFIAPI
HiiGetKeyboardLayout (
IN EFI_HII_PROTOCOL *This,
OUT UINT16 *DescriptorCount,
OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
)
/*++
Routine Description:
Arguments:
Returns:
--*/
{
return EFI_SUCCESS;
}

View File

@ -0,0 +1,518 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, 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"
EFI_STATUS
GetIfrAndStringPackNum (
IN CONST EFI_HII_PACKAGES *Packages,
UINTN *IfrPackNum,
UINTN *StringPackNum
)
{
UINTN Index;
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
ASSERT (Packages != NULL);
ASSERT (IfrPackNum != NULL);
ASSERT (StringPackNum != NULL);
*IfrPackNum = 0;
*StringPackNum = 0;
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
//
// BugBug: The current UEFI HII build tool generate a binary in the format defined in:
// TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
// this binary is with same package type. So the returned IfrPackNum and StringPackNum
// may not be the exact number of valid package number in the binary generated
// by HII Build tool.
//
switch (TianoAutogenPackageHdrArray[Index]->PackageHeader.Type) {
case EFI_HII_PACKAGE_FORM:
*IfrPackNum += 1;
break;
case EFI_HII_PACKAGE_STRINGS:
*StringPackNum += 1;
break;
case EFI_HII_PACKAGE_SIMPLE_FONTS:
break;
//
// The following fonts are invalid for a module that using Framework to UEFI thunk layer.
//
case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
case EFI_HII_PACKAGE_FONTS:
case EFI_HII_PACKAGE_IMAGES:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
break;
}
}
return EFI_SUCCESS;
}
EFI_STATUS
LibExportPackageLists (
IN EFI_HII_HANDLE UefiHiiHandle,
OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
OUT UINTN *PackageListSize
)
{
EFI_STATUS Status;
UINTN Size;
EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr;
ASSERT (PackageListSize != NULL);
ASSERT (PackageListHeader != NULL);
Size = 0;
PackageListHdr = NULL;
Status = mUefiHiiDatabaseProtocol->ExportPackageLists (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
&Size,
PackageListHdr
);
ASSERT_EFI_ERROR (Status == EFI_BUFFER_TOO_SMALL);
if (Status == EFI_BUFFER_TOO_SMALL) {
PackageListHdr = AllocateZeroPool (Size);
ASSERT (PackageListHdr != NULL);
if (PackageListHeader == NULL) {
return EFI_OUT_OF_RESOURCES;
} else {
Status = mUefiHiiDatabaseProtocol->ExportPackageLists (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
&Size,
PackageListHdr
);
ASSERT_EFI_ERROR (Status);
}
}
if (!EFI_ERROR (Status)) {
*PackageListHeader = PackageListHdr;
*PackageListSize = Size;
}
return Status;
}
BOOLEAN
IsOnlyStringPackagesInPackageList (
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader
)
{
EFI_HII_PACKAGE_HEADER *PackageHeader;
PackageHeader = (EFI_HII_PACKAGE_HEADER *) (StringPackageListHeader + 1);
while (PackageHeader->Type != EFI_HII_PACKAGE_END) {
PackageHeader = (EFI_HII_PACKAGE_HEADER *) (PackageHeader );
}
}
EFI_STATUS
InsertStringPackagesToIfrPackageList (
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader,
IN EFI_HII_HANDLE UefiHiiHandle
)
{
EFI_STATUS Status;
Status = mUefiHiiDatabaseProtocol->UpdatePackageList (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
StringPackageListHeader
);
return Status;
}
/**
Removes a node from a doubly linked list, and returns the node that follows
the removed node.
Removes the node Entry from a doubly linked list. It is up to the caller of
this function to release the memory used by this node if that is required. On
exit, the node following Entry in the doubly linked list is returned. If
Entry is the only node in the linked list, then the head node of the linked
list is returned.
If Entry is NULL, then ASSERT().
If Entry is the head node of an empty list, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list containing Entry, including the Entry node, is greater than
or equal to PcdMaximumLinkedListLength, then ASSERT().
@param Entry A pointer to a node in a linked list
@return Entry
**/
EFI_STATUS
AddStringPackagesToMatchingIfrPackageList (
IN EFI_HII_THUNK_PRIVATE_DATA *Private,
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (&StringPackageListHeader->PackageListGuid, &HandleMapEntry->TagGuid)) {
Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, HandleMapEntry->UefiHiiHandle);
}
}
return EFI_NOT_FOUND;
}
EFI_HII_PACKAGE_LIST_HEADER *
PrepareUefiPackageListFromFrameworkHiiPackages (
IN CONST EFI_HII_PACKAGES *Packages,
IN CONST EFI_GUID *GuidId OPTIONAL
)
{
UINTN NumberOfPackages;
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
UINT8 *PackageListData;
UINT32 PackageListLength;
UINT32 PackageLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINTN Index;
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) ((UINT8 *) &Packages->GuidId + sizeof (Packages->GuidId));
NumberOfPackages = Packages->NumberOfPackages;
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < NumberOfPackages; Index++) {
CopyMem (&PackageLength, &TianoAutogenPackageHdrArray[Index]->BinaryLength, sizeof (UINT32));
PackageListLength += PackageLength;
}
//
// Include the lenght of EFI_HII_PACKAGE_END
//
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
PackageListHeader = AllocateZeroPool (PackageListLength);
ASSERT (PackageListHeader != NULL);
if (GuidId == NULL) {
CopyMem (&PackageListHeader->PackageListGuid, Packages->GuidId, sizeof (EFI_GUID));
} else {
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
}
PackageListHeader->PackageLength = PackageListLength;
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < NumberOfPackages; Index++) {
CopyMem (&PackageLength, &(TianoAutogenPackageHdrArray[Index]->BinaryLength), sizeof (UINT32));
PackageLength -= sizeof (UINT32);
CopyMem (PackageListData, &(TianoAutogenPackageHdrArray[Index]->PackageHeader), PackageLength);
PackageListData += PackageLength;
}
//
// Append EFI_HII_PACKAGE_END
//
PackageHeader.Type = EFI_HII_PACKAGE_END;
PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
CopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
return PackageListHeader;
}
EFI_GUID *
UefiGeneratePackageListGuidId (
IN CONST EFI_HII_PACKAGES * Packages
)
{
EFI_GUID *Guid;
UINT64 MonotonicCount;
Guid = AllocateCopyPool (sizeof (EFI_GUID), Packages->GuidId);
gBS->GetNextMonotonicCount (&MonotonicCount);
//
// Use Monotonic Count as a psedo random number generator.
//
*((UINT64 *) Guid) = *((UINT64 *) Guid) + MonotonicCount;
return Guid;
}
EFI_STATUS
FindAndAddStringPackageToIfrPackageList(
EFI_HII_THUNK_PRIVATE_DATA *Private,
EFI_GUID *GuidId,
EFI_HII_HANDLE UefiIfrHiiHandle
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader;
UINTN Size;
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (GuidId, &HandleMapEntry->TagGuid) && (!HandleMapEntry->DoesPackageListImportStringPackages)) {
Status = LibExportPackageLists (HandleMapEntry->UefiHiiHandle, &StringPackageListHeader, &Size);
ASSERT_EFI_ERROR (Status);
//
// Add Function to only get only String Packages from the Package List
//
Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, UefiIfrHiiHandle);
ASSERT_EFI_ERROR (Status);
FreePool (StringPackageListHeader);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
InstallDefaultUefiConfigAccessProtocol (
IN EFI_HII_PACKAGES *Packages,
OUT EFI_HANDLE *Handle
)
{
return EFI_SUCCESS;
}
EFI_STATUS
UefiRegisterPackageList(
EFI_HII_THUNK_PRIVATE_DATA *Private,
EFI_HII_PACKAGES *Packages,
FRAMEWORK_EFI_HII_HANDLE *Handle
)
{
EFI_STATUS Status;
UINTN StringPackNum;
UINTN IfrPackNum;
EFI_HII_PACKAGE_LIST_HEADER *UefiPackageListHeader;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMappingEntry;
EFI_GUID *GuidId;
EFI_HANDLE UefiHiiDriverHandle;
GuidId = NULL;
UefiHiiDriverHandle = NULL;
Status = GetIfrAndStringPackNum (Packages, &IfrPackNum, &StringPackNum);
ASSERT_EFI_ERROR (Status);
HandleMappingEntry = AllocateZeroPool (sizeof (*HandleMappingEntry));
ASSERT (HandleMappingEntry != NULL);
HandleMappingEntry->Signature = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE;
HandleMappingEntry->FrameworkHiiHandle = Private->StaticHiiHandle++;
CopyGuid (&HandleMappingEntry->TagGuid, Packages->GuidId);
if ((StringPackNum == 0) && (IfrPackNum != 0)) {
//
// UEFI HII database does not allow two package list with the same GUID.
// In Framework HII implementation, Packages->GuidId is used as an identifier to associate
// a PackageList with only IFR to a Package list the with String package.
//
GuidId = UefiGeneratePackageListGuidId (Packages);
}
//
// UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
// that Setup Utility will load the Buffer Storage
//
if (IfrPackNum != 0) {
InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle);
}
UefiPackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, GuidId);
Status = mUefiHiiDatabaseProtocol->NewPackageList (
mUefiHiiDatabaseProtocol,
UefiPackageListHeader,
UefiHiiDriverHandle,
&HandleMappingEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
goto Done;
}
if (IfrPackNum == 0) {
if (StringPackNum != 0) {
//
// Look for a package list with IFR Pack which has already registed with HII Database
//
HandleMappingEntry->IsPackageListWithOnlyStringPackages = TRUE;
Status = AddStringPackagesToMatchingIfrPackageList (
Private,
UefiPackageListHeader
);
if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) {
if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
}
}
}
} else {
if (StringPackNum == 0) {
//
// Register the Package List to UEFI HII first.
//
Status = FindAndAddStringPackageToIfrPackageList (
Private,
Packages->GuidId,
HandleMappingEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
HandleMappingEntry->DoesPackageListImportStringPackages = TRUE;
}
}
}
if (!EFI_ERROR (Status)) {
InsertTailList (&Private->HiiThunkHandleMappingDBListHead, &HandleMappingEntry->List);
}
Done:
if (EFI_ERROR (Status)) {
FreePool (HandleMappingEntry);
} else {
*Handle = HandleMappingEntry->FrameworkHiiHandle;
}
FreePool (UefiPackageListHeader);
SafeFreePool (GuidId);
return Status;
}
EFI_STATUS
EFIAPI
HiiNewPack (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_PACKAGES *Packages,
OUT FRAMEWORK_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_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
if (Handle == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Packages == NULL) {
return EFI_INVALID_PARAMETER;
}
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Status = UefiRegisterPackageList (
Private,
Packages,
Handle
);
return Status;
}
EFI_STATUS
EFIAPI
HiiRemovePack (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
/*++
Routine Description:
Removes the various packs from a Handle
Arguments:
Returns:
--*/
{
EFI_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (Handle == HandleMapEntry->FrameworkHiiHandle) {
Status = mUefiHiiDatabaseProtocol->RemovePackageList (
mUefiHiiDatabaseProtocol,
HandleMapEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
RemoveEntryList (ListEntry);
return Status;
}
}
return EFI_NOT_FOUND;
}

View File

@ -0,0 +1,315 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, 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"
EFI_STATUS
EFIAPI
HiiTestString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *StringToTest,
IN OUT UINT32 *FirstMissing,
OUT UINT32 *GlyphBufferSize
)
/*++
Routine Description:
Test if all of the characters in a string have corresponding font characters.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
GetTagGuidByFrameworkHiiHandle (
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle,
OUT EFI_GUID *TagGuid
)
{
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
ASSERT (TagGuid != NULL);
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (FrameworkHiiHandle == HandleMapEntry->FrameworkHiiHandle) {
CopyGuid (TagGuid, &HandleMapEntry->TagGuid);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
HiiThunkNewStringForAllStringPackages (
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
OUT CONST EFI_GUID *TagGuid,
IN CHAR16 *Language,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
EFI_STRING_ID StringId1;
EFI_STRING_ID StringId2;
CHAR8 *UefiStringProtocolLanguage;
BOOLEAN Found;
ASSERT (TagGuid != NULL);
StringId1 = (EFI_STRING_ID) 0;
StringId2 = (EFI_STRING_ID) 0;
Found = FALSE;
//
// BugBug: We will handle the case that Language is not NULL later.
//
ASSERT (Language == NULL);
//if (Language == NULL) {
UefiStringProtocolLanguage = NULL;
//}
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (TagGuid, &HandleMapEntry->TagGuid)) {
Found = TRUE;
if (*Reference == 0) {
Status = HiiLibNewString (HandleMapEntry->UefiHiiHandle, &StringId2, NewString);
} else {
Status = HiiLibSetString (HandleMapEntry->UefiHiiHandle, *Reference, NewString);
}
if (EFI_ERROR (Status)) {
return Status;
}
if (*Reference == 0) {
if (StringId1 == (EFI_STRING_ID) 0) {
StringId1 = StringId2;
} else {
if (StringId1 != StringId2) {
ASSERT(FALSE);
return EFI_INVALID_PARAMETER;
}
}
}
}
}
if (Found) {
*Reference = StringId1;
Status = EFI_SUCCESS;
} else {
Status = EFI_NOT_FOUND;
}
return Status;
}
EFI_STATUS
EFIAPI
HiiNewString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Language,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
/*++
Routine Description:
This function allows a new String to be added to an already existing String Package.
We will make a buffer the size of the package + StrSize of the new string. We will
copy the string package that first gets changed and the following language packages until
we encounter the NULL string package. All this time we will ensure that the offsets have
been adjusted.
Arguments:
Returns:
--*/
{
EFI_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
EFI_GUID TagGuid;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Status = GetTagGuidByFrameworkHiiHandle (Private, Handle, &TagGuid);
ASSERT_EFI_ERROR (Status);
Status = HiiThunkNewStringForAllStringPackages (Private, &TagGuid, Language, Reference, NewString);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiResetStrings (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
/*++
Routine Description:
This function removes any new strings that were added after the initial string export for this handle.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetString (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN BOOLEAN Raw,
IN CHAR16 *LanguageString,
IN OUT UINTN *BufferLengthTemp,
OUT EFI_STRING StringBuffer
)
/*++
Routine Description:
This function extracts a string from a package already registered with the EFI HII database.
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - The HII handle on which the string resides.
Token - The string token assigned to the string.
Raw - If TRUE, the string is returned unedited in the internal storage format described
above. If false, the string returned is edited by replacing <cr> with <space>
and by removing special characters such as the <wide> prefix.
LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language
identifier, indicating the language to print. If the LanguageString is empty (starts
with a NULL), the default system language will be used to determine the language.
BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too
small, this parameter is filled with the length of the buffer needed.
StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is
defined in String.
Returns:
EFI_INVALID_PARAMETER - If input parameter is invalid.
EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small.
EFI_SUCCESS - Operation is successful.
--*/
{
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
CHAR8 *AsciiLanguage;
EFI_HII_THUNK_PRIVATE_DATA *Private;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
if (LanguageString == NULL) {
AsciiLanguage = NULL;
} else {
AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);
if (AsciiLanguage == NULL) {
return EFI_OUT_OF_RESOURCES;
}
UnicodeStrToAsciiStr (LanguageString, AsciiLanguage);
}
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (Handle == HandleMapEntry->FrameworkHiiHandle) {
if (AsciiLanguage == NULL) {
return HiiLibGetString (HandleMapEntry->UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);
} else {
return mUefiStringProtocol->GetString (
mUefiStringProtocol,
AsciiLanguage,
HandleMapEntry->UefiHiiHandle,
Token,
StringBuffer,
BufferLengthTemp,
NULL
);
}
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
EFIAPI
HiiGetLine (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_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
)
/*++
Routine Description:
This function allows a program to extract a part of a string of not more than a given width.
With repeated calls, this allows a calling program to extract "lines" of text that fit inside
columns. The effort of measuring the fit of strings inside columns is localized to this call.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}

View File

@ -0,0 +1,41 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, 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"
EFI_GUID *
GetGuidOfFirstFormset (
CONST EFI_HII_FORM_PACKAGE * FormPackage
)
{
UINT8 *StartOfNextPackage;
EFI_IFR_OP_HEADER *OpCodeData;
StartOfNextPackage = (UINT8 *) FormPackage + FormPackage->Header.Length;
OpCodeData = (EFI_IFR_OP_HEADER *) (FormPackage + 1);
while ((UINT8 *) OpCodeData < StartOfNextPackage) {
if (OpCodeData->OpCode == EFI_IFR_FORM_SET_OP) {
return &(((EFI_IFR_FORM_SET *) OpCodeData)->Guid);
}
OpCodeData = (EFI_IFR_OP_HEADER *) ((UINT8 *) OpCodeData + OpCodeData->Length);
}
ASSERT (FALSE);
return NULL;
}

View File

@ -0,0 +1,24 @@
/**@file
This file contains utility functions by HII Thunk Modules.
Copyright (c) 2006 - 2008, 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 _HII_THUNK_UTILITY_H
#define _HII_THUNK_UTILITY_H
EFI_GUID *
GetGuidOfFirstFormset (
CONST EFI_HII_FORM_PACKAGE * FormPackage
);
#endif