HII Library Class interface refine.
The "HiiLib" prefix for all HII Library API function names changed to "Hii". Remove: HiiLibPreparePackageList(), replaced by HiiAddPackages() HiiLibNewString(), replaced by HiiSetString() HiiLibGetStringFromHandle(), replaced by HiiGetString() HiiLibGetStringFromToken(), replaced by HiiGetPackageString() HiiLibExtractGuidFromHiiHandle() HiiLibDevicePathToHiiHandle() HiiLibGetSupportedSecondaryLanguages() HiiLibGetSupportedLanguageNumber() HiiLibExportPackageLists() HiiLibListPackageLists() Interface change: HiiAddPackages() HiiSetString() HiiGetString() HiiGetHiiHandles() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8083 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -104,9 +104,8 @@ InstallProcessorDataHub (
|
|||||||
ASSERT (UString != NULL);
|
ASSERT (UString != NULL);
|
||||||
AsciiStrToUnicodeStr (AString, UString);
|
AsciiStrToUnicodeStr (AString, UString);
|
||||||
|
|
||||||
Status = HiiLibNewString (gStringHandle, &Token, UString);
|
Token = HiiSetString (gStringHandle, 0, UString, NULL);
|
||||||
|
if (Token == 0) {
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
gBS->FreePool (UString);
|
gBS->FreePool (UString);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -232,9 +231,8 @@ InstallMiscDataHub (
|
|||||||
CopyMem (UString, FIRMWARE_BIOS_VERSIONE, sizeof(FIRMWARE_BIOS_VERSIONE));
|
CopyMem (UString, FIRMWARE_BIOS_VERSIONE, sizeof(FIRMWARE_BIOS_VERSIONE));
|
||||||
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_BIOS_VERSIONE) / sizeof(CHAR16) - 1);
|
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_BIOS_VERSIONE) / sizeof(CHAR16) - 1);
|
||||||
|
|
||||||
Status = HiiLibNewString (gStringHandle, &Token, UString);
|
Token = HiiSetString (gStringHandle, 0, UString, NULL);
|
||||||
|
if (Token == 0) {
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
gBS->FreePool (UString);
|
gBS->FreePool (UString);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -281,9 +279,8 @@ InstallMiscDataHub (
|
|||||||
CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof(FIRMWARE_PRODUCT_NAME));
|
CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof(FIRMWARE_PRODUCT_NAME));
|
||||||
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1);
|
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1);
|
||||||
|
|
||||||
Status = HiiLibNewString (gStringHandle, &Token, UString);
|
Token = HiiSetString (gStringHandle, 0, UString, NULL);
|
||||||
|
if (Token == 0) {
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
gBS->FreePool (UString);
|
gBS->FreePool (UString);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -345,7 +342,13 @@ DataHubGenEntrypoint (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
HiiLibAddPackages (1, &gEfiMiscProducerGuid, NULL, &gStringHandle, DataHubGenDxeStrings);
|
gStringHandle = HiiAddPackages (
|
||||||
|
&gEfiMiscProducerGuid,
|
||||||
|
NULL,
|
||||||
|
DataHubGenDxeStrings,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (gStringHandle != NULL);
|
||||||
|
|
||||||
InstallProcessorDataHub (Smbios);
|
InstallProcessorDataHub (Smbios);
|
||||||
InstallCacheDataHub (Smbios);
|
InstallCacheDataHub (Smbios);
|
||||||
|
@ -674,7 +674,6 @@ CreateIfrDataArray (
|
|||||||
FORMSET_STORAGE *BufferStorage;
|
FORMSET_STORAGE *BufferStorage;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
UINTN StringSize;
|
|
||||||
EFI_STRING String;
|
EFI_STRING String;
|
||||||
|
|
||||||
*NvMapAllocated = FALSE;
|
*NvMapAllocated = FALSE;
|
||||||
@ -691,17 +690,10 @@ CreateIfrDataArray (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_IFR_TYPE_STRING:
|
case EFI_IFR_TYPE_STRING:
|
||||||
StringSize = 0;
|
String = HiiGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, NULL);
|
||||||
Status = HiiLibGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, String, &StringSize);
|
|
||||||
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
|
||||||
|
|
||||||
String = AllocateZeroPool (StringSize);
|
|
||||||
ASSERT (String != NULL);
|
ASSERT (String != NULL);
|
||||||
|
|
||||||
Status = HiiLibGetString (ConfigAccess->ThunkContext->UefiHiiHandle, Value->string, String, &StringSize);
|
Size = StrSize (String);
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
Size = StringSize;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -156,7 +156,7 @@ InitializeHiiDatabase (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
|
Status = ListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
|
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
|
||||||
ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);
|
ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);
|
||||||
@ -403,7 +403,7 @@ HiiGetPrimaryLanguages (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
LangCodes3066 = HiiLibGetSupportedLanguages (UefiHiiHandle);
|
LangCodes3066 = HiiGetSupportedLanguages (UefiHiiHandle);
|
||||||
|
|
||||||
if (LangCodes3066 == NULL) {
|
if (LangCodes3066 == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -437,6 +437,61 @@ Done:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function returns the list of supported 2nd languages, in the format specified
|
||||||
|
in UEFI specification Appendix M.
|
||||||
|
|
||||||
|
If HiiHandle is not a valid Handle in the HII database, then ASSERT.
|
||||||
|
If not enough resource to complete the operation, then ASSERT.
|
||||||
|
|
||||||
|
@param HiiHandle The HII package list handle.
|
||||||
|
@param FirstLanguage Pointer to language name buffer.
|
||||||
|
|
||||||
|
@return The supported languages.
|
||||||
|
|
||||||
|
**/
|
||||||
|
CHAR8 *
|
||||||
|
EFIAPI
|
||||||
|
HiiGetSupportedSecondaryLanguages (
|
||||||
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
|
IN CONST CHAR8 *FirstLanguage
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN BufferSize;
|
||||||
|
CHAR8 *LanguageString;
|
||||||
|
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Collect current supported 2nd Languages for given HII handle
|
||||||
|
// First try allocate 4K buffer to store the current supported 2nd languages.
|
||||||
|
//
|
||||||
|
BufferSize = 0x1000;
|
||||||
|
LanguageString = AllocateZeroPool (BufferSize);
|
||||||
|
if (LanguageString == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
|
||||||
|
ASSERT (Status != EFI_NOT_FOUND);
|
||||||
|
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
FreePool (LanguageString);
|
||||||
|
LanguageString = AllocateZeroPool (BufferSize);
|
||||||
|
if (LanguageString == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = mHiiStringProtocol->GetSecondaryLanguages (mHiiStringProtocol, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
LanguageString = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LanguageString;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allows a program to determine which secondary languages are supported on a given handle for a given primary language
|
Allows a program to determine which secondary languages are supported on a given handle for a given primary language
|
||||||
@ -499,7 +554,7 @@ HiiGetSecondaryLanguages (
|
|||||||
PrimaryLang3066 = ConvertIso639LanguageToRfc3066Language (PrimaryLang639);
|
PrimaryLang3066 = ConvertIso639LanguageToRfc3066Language (PrimaryLang639);
|
||||||
ASSERT_EFI_ERROR (PrimaryLang3066 != NULL);
|
ASSERT_EFI_ERROR (PrimaryLang3066 != NULL);
|
||||||
|
|
||||||
SecLangCodes3066 = HiiLibGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang3066);
|
SecLangCodes3066 = HiiGetSupportedSecondaryLanguages (UefiHiiHandle, PrimaryLang3066);
|
||||||
|
|
||||||
if (SecLangCodes3066 == NULL) {
|
if (SecLangCodes3066 == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
@ -401,7 +401,7 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack (
|
|||||||
|
|
||||||
if (ThunkContext != IfrThunkContext) {
|
if (ThunkContext != IfrThunkContext) {
|
||||||
if (CompareGuid (&IfrThunkContext->TagGuid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount == 0)) {
|
if (CompareGuid (&IfrThunkContext->TagGuid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount == 0)) {
|
||||||
Status = HiiLibExportPackageLists (ThunkContext->UefiHiiHandle, &StringPackageListHeader, &Size);
|
Status = ExportPackageLists (ThunkContext->UefiHiiHandle, &StringPackageListHeader, &Size);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
IfrThunkContext->StringPackageCount = GetPackageCountByType (StringPackageListHeader, EFI_HII_PACKAGE_STRINGS);
|
IfrThunkContext->StringPackageCount = GetPackageCountByType (StringPackageListHeader, EFI_HII_PACKAGE_STRINGS);
|
||||||
@ -861,7 +861,7 @@ RemovePackNotify (
|
|||||||
//
|
//
|
||||||
if (ThunkContext != NULL) {
|
if (ThunkContext != NULL) {
|
||||||
if (!ThunkContext->ByFrameworkHiiNewPack) {
|
if (!ThunkContext->ByFrameworkHiiNewPack) {
|
||||||
Status = HiiLibExportPackageLists (Handle, &HiiPackageList, &BufferSize);
|
Status = ExportPackageLists (Handle, &HiiPackageList, &BufferSize);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
if (GetPackageCountByType (HiiPackageList, EFI_HII_PACKAGE_STRINGS) == 1) {
|
if (GetPackageCountByType (HiiPackageList, EFI_HII_PACKAGE_STRINGS) == 1) {
|
||||||
|
@ -40,13 +40,9 @@ GetStringById (
|
|||||||
IN EFI_STRING_ID Id
|
IN EFI_STRING_ID Id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *String;
|
return HiiGetString (gStringPackHandle, Id, NULL);
|
||||||
|
|
||||||
String = NULL;
|
|
||||||
HiiLibGetStringFromHandle (gStringPackHandle, Id, &String);
|
|
||||||
|
|
||||||
return String;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Show progress bar with title above it. It only works in Graphics mode.
|
Show progress bar with title above it. It only works in Graphics mode.
|
||||||
@ -544,12 +540,14 @@ InitSetBrowserStrings (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize strings to HII database
|
// Initialize strings to HII database
|
||||||
//
|
//
|
||||||
Status = HiiLibAddPackages (1, &gEfiHiiThunkProducerGuid, NULL, &gStringPackHandle, STRING_ARRAY_NAME);
|
gStringPackHandle = HiiAddPackages (
|
||||||
ASSERT_EFI_ERROR (Status);
|
&gEfiHiiThunkProducerGuid,
|
||||||
|
NULL,
|
||||||
|
STRING_ARRAY_NAME,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (gStringPackHandle != NULL);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ ConvertIso639ToRfc3066 (
|
|||||||
If all glyphs in the string are available, the index is the index of the terminator
|
If all glyphs in the string are available, the index is the index of the terminator
|
||||||
of the string.
|
of the string.
|
||||||
@param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS,
|
@param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS,
|
||||||
it contains the amount of memory that is required to store the string<EFBFBD><EFBFBD>s glyph equivalent.
|
it contains the amount of memory that is required to store the string? glyph equivalent.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
|
@retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
|
||||||
**/
|
**/
|
||||||
@ -148,73 +148,17 @@ UpdateString (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STRING_ID NewStringId;
|
EFI_STRING_ID NewStringId;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
|
NewStringId = HiiSetString (ThunkContext->UefiHiiHandle, *StringId, NewString, Rfc3066AsciiLanguage);
|
||||||
NewStringId = 0;
|
*StringId = NewStringId;
|
||||||
|
if (NewStringId == 0) {
|
||||||
if (*StringId == 0) {
|
|
||||||
//
|
|
||||||
// Create a new string token.
|
|
||||||
//
|
|
||||||
if (Rfc3066AsciiLanguage == NULL) {
|
|
||||||
//
|
|
||||||
// For all languages in the package list.
|
|
||||||
//
|
|
||||||
Status = HiiLibNewString (ThunkContext->UefiHiiHandle, &NewStringId, NewString);
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// For specified language.
|
|
||||||
//
|
|
||||||
Status = mHiiStringProtocol->NewString (
|
|
||||||
mHiiStringProtocol,
|
|
||||||
ThunkContext->UefiHiiHandle,
|
|
||||||
&NewStringId,
|
|
||||||
Rfc3066AsciiLanguage,
|
|
||||||
NULL,
|
|
||||||
NewString,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Update the existing string token.
|
|
||||||
//
|
|
||||||
if (Rfc3066AsciiLanguage == NULL) {
|
|
||||||
//
|
|
||||||
// For all languages in the package list.
|
|
||||||
//
|
|
||||||
Status = HiiLibSetString (ThunkContext->UefiHiiHandle, *StringId, NewString);
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// For specified language.
|
|
||||||
//
|
|
||||||
Status = mHiiStringProtocol->SetString (
|
|
||||||
mHiiStringProtocol,
|
|
||||||
ThunkContext->UefiHiiHandle,
|
|
||||||
*StringId,
|
|
||||||
Rfc3066AsciiLanguage,
|
|
||||||
NewString,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
if (*StringId == 0) {
|
|
||||||
//
|
|
||||||
// When creating new string, return the newly created String Token.
|
|
||||||
//
|
|
||||||
*StringId = NewStringId;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//
|
//
|
||||||
// Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
|
// Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
|
||||||
//
|
//
|
||||||
*StringId = 0;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
} else {
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -388,9 +332,12 @@ HiiThunkGetString (
|
|||||||
OUT EFI_STRING StringBuffer
|
OUT EFI_STRING StringBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *Iso639AsciiLanguage;
|
|
||||||
HII_THUNK_PRIVATE_DATA *Private;
|
HII_THUNK_PRIVATE_DATA *Private;
|
||||||
|
CHAR8 *Iso639AsciiLanguage;
|
||||||
CHAR8 *Rfc3066AsciiLanguage;
|
CHAR8 *Rfc3066AsciiLanguage;
|
||||||
|
CHAR8 *SupportedLanguages;
|
||||||
|
CHAR8 *PlatformLanguage;
|
||||||
|
CHAR8 *BestLanguage;
|
||||||
EFI_HII_HANDLE UefiHiiHandle;
|
EFI_HII_HANDLE UefiHiiHandle;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
@ -427,7 +374,51 @@ HiiThunkGetString (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Rfc3066AsciiLanguage == NULL) {
|
if (Rfc3066AsciiLanguage == NULL) {
|
||||||
Status = HiiLibGetString (UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);
|
//
|
||||||
|
// Get the languages that the package specified by HiiHandle supports
|
||||||
|
//
|
||||||
|
SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
|
||||||
|
if (SupportedLanguages == NULL) {
|
||||||
|
goto Error2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the current platform language setting
|
||||||
|
//
|
||||||
|
PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
|
||||||
|
if (PlatformLanguage == NULL) {
|
||||||
|
goto Error1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the best matching language from SupportedLanguages
|
||||||
|
//
|
||||||
|
BestLanguage = GetBestLanguage (
|
||||||
|
SupportedLanguages,
|
||||||
|
FALSE, // RFC 4646 mode
|
||||||
|
PlatformLanguage, // Next highest priority
|
||||||
|
SupportedLanguages, // Lowest priority
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (BestLanguage == NULL) {
|
||||||
|
FreePool (PlatformLanguage);
|
||||||
|
Error1:
|
||||||
|
FreePool (SupportedLanguages);
|
||||||
|
Error2:
|
||||||
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = mHiiStringProtocol->GetString (
|
||||||
|
mHiiStringProtocol,
|
||||||
|
BestLanguage,
|
||||||
|
UefiHiiHandle,
|
||||||
|
Token,
|
||||||
|
StringBuffer,
|
||||||
|
BufferLengthTemp,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
FreePool (BestLanguage);
|
||||||
} else {
|
} else {
|
||||||
Status = mHiiStringProtocol->GetString (
|
Status = mHiiStringProtocol->GetString (
|
||||||
mHiiStringProtocol,
|
mHiiStringProtocol,
|
||||||
|
@ -21,6 +21,220 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
CONST EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
CONST EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
||||||
CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
|
CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This function returns a list of the package handles of the
|
||||||
|
specified type that are currently active in the HII database. The
|
||||||
|
pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
|
||||||
|
handles to be listed.
|
||||||
|
|
||||||
|
If HandleBufferLength is NULL, then ASSERT.
|
||||||
|
If HandleBuffer is NULL, the ASSERT.
|
||||||
|
If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
|
||||||
|
NULL, then ASSERT.
|
||||||
|
If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
|
||||||
|
NULL, then ASSERT.
|
||||||
|
|
||||||
|
|
||||||
|
@param PackageType Specifies the package type of the packages
|
||||||
|
to list or EFI_HII_PACKAGE_TYPE_ALL for
|
||||||
|
all packages to be listed.
|
||||||
|
|
||||||
|
@param PackageGuid If PackageType is
|
||||||
|
EFI_HII_PACKAGE_TYPE_GUID, then this is
|
||||||
|
the pointer to the GUID which must match
|
||||||
|
the Guid field of
|
||||||
|
EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
|
||||||
|
must be NULL.
|
||||||
|
|
||||||
|
@param HandleBufferLength On output, the length of the handle buffer
|
||||||
|
that is required for the handles found.
|
||||||
|
|
||||||
|
@param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
|
||||||
|
The caller is responcible to free this pointer allocated.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The matching handles are outputed successfully.
|
||||||
|
HandleBufferLength is updated with the actual length.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
|
||||||
|
@retval EFI_NOT_FOUND No matching handle could not be found in database.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ListPackageLists (
|
||||||
|
IN UINT8 PackageType,
|
||||||
|
IN CONST EFI_GUID *PackageGuid,
|
||||||
|
IN OUT UINTN *HandleBufferLength,
|
||||||
|
OUT EFI_HII_HANDLE **HandleBuffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
ASSERT (HandleBufferLength != NULL);
|
||||||
|
ASSERT (HandleBuffer != NULL);
|
||||||
|
|
||||||
|
*HandleBufferLength = 0;
|
||||||
|
*HandleBuffer = NULL;
|
||||||
|
|
||||||
|
if (PackageType == EFI_HII_PACKAGE_TYPE_GUID) {
|
||||||
|
ASSERT (PackageGuid != NULL);
|
||||||
|
} else {
|
||||||
|
ASSERT (PackageGuid == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = mHiiDatabase->ListPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
PackageType,
|
||||||
|
PackageGuid,
|
||||||
|
HandleBufferLength,
|
||||||
|
*HandleBuffer
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
|
//
|
||||||
|
// No packages is registered to UEFI HII Database, just return.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
*HandleBuffer = AllocateZeroPool (*HandleBufferLength);
|
||||||
|
|
||||||
|
if (*HandleBuffer == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mHiiDatabase->ListPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
PackageType,
|
||||||
|
PackageGuid,
|
||||||
|
HandleBufferLength,
|
||||||
|
*HandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exports the contents of one or all package lists in the HII database into a buffer.
|
||||||
|
|
||||||
|
If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
|
||||||
|
then ASSERT.
|
||||||
|
If PackageListHeader is NULL, then ASSERT.
|
||||||
|
If PackageListSize is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param Handle The HII Handle.
|
||||||
|
@param PackageListHeader A pointer to a buffer that will contain the results of
|
||||||
|
the export function.
|
||||||
|
@param PackageListSize On output, the length of the buffer that is required for the exported data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Package exported.
|
||||||
|
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ExportPackageLists (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
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 = mHiiDatabase->ExportPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
Handle,
|
||||||
|
&Size,
|
||||||
|
PackageListHdr
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status != EFI_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
PackageListHdr = AllocateZeroPool (Size);
|
||||||
|
|
||||||
|
if (PackageListHeader == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
|
Status = mHiiDatabase->ExportPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
Handle,
|
||||||
|
&Size,
|
||||||
|
PackageListHdr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
*PackageListHeader = PackageListHdr;
|
||||||
|
*PackageListSize = Size;
|
||||||
|
} else {
|
||||||
|
FreePool (PackageListHdr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Extract Hii package list GUID for given HII handle.
|
||||||
|
|
||||||
|
If HiiHandle could not be found in the HII database, then ASSERT.
|
||||||
|
If Guid is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param Handle Hii handle
|
||||||
|
@param Guid Package list GUID
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully extract GUID from Hii database.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ExtractGuidFromHiiHandle (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT EFI_GUID *Guid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN BufferSize;
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
||||||
|
|
||||||
|
ASSERT (Guid != NULL);
|
||||||
|
ASSERT (Handle != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HII PackageList
|
||||||
|
//
|
||||||
|
BufferSize = 0;
|
||||||
|
HiiPackageList = NULL;
|
||||||
|
|
||||||
|
Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
ASSERT (Status != EFI_NOT_FOUND);
|
||||||
|
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
HiiPackageList = AllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiPackageList != NULL);
|
||||||
|
|
||||||
|
Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
}
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (HiiPackageList);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract GUID
|
||||||
|
//
|
||||||
|
CopyGuid (Guid, &HiiPackageList->PackageListGuid);
|
||||||
|
|
||||||
|
FreePool (HiiPackageList);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the corressponding UEFI HII Handle from a Framework HII Handle given.
|
Find the corressponding UEFI HII Handle from a Framework HII Handle given.
|
||||||
@ -202,7 +416,7 @@ CreateThunkContextForUefiHiiHandle (
|
|||||||
|
|
||||||
ThunkContext->UefiHiiHandle = UefiHiiHandle;
|
ThunkContext->UefiHiiHandle = UefiHiiHandle;
|
||||||
|
|
||||||
Status = HiiLibExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
|
Status = ExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
|
CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
|
||||||
|
@ -16,6 +16,100 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#ifndef _HII_THUNK_UTILITY_H
|
#ifndef _HII_THUNK_UTILITY_H
|
||||||
#define _HII_THUNK_UTILITY_H
|
#define _HII_THUNK_UTILITY_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This function returns a list of the package handles of the
|
||||||
|
specified type that are currently active in the HII database. The
|
||||||
|
pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
|
||||||
|
handles to be listed.
|
||||||
|
|
||||||
|
If HandleBufferLength is NULL, then ASSERT.
|
||||||
|
If HandleBuffer is NULL, the ASSERT.
|
||||||
|
If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
|
||||||
|
NULL, then ASSERT.
|
||||||
|
If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
|
||||||
|
NULL, then ASSERT.
|
||||||
|
|
||||||
|
|
||||||
|
@param PackageType Specifies the package type of the packages
|
||||||
|
to list or EFI_HII_PACKAGE_TYPE_ALL for
|
||||||
|
all packages to be listed.
|
||||||
|
|
||||||
|
@param PackageGuid If PackageType is
|
||||||
|
EFI_HII_PACKAGE_TYPE_GUID, then this is
|
||||||
|
the pointer to the GUID which must match
|
||||||
|
the Guid field of
|
||||||
|
EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
|
||||||
|
must be NULL.
|
||||||
|
|
||||||
|
@param HandleBufferLength On output, the length of the handle buffer
|
||||||
|
that is required for the handles found.
|
||||||
|
|
||||||
|
@param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
|
||||||
|
The caller is responcible to free this pointer allocated.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The matching handles are outputed successfully.
|
||||||
|
HandleBufferLength is updated with the actual length.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
|
||||||
|
@retval EFI_NOT_FOUND No matching handle could not be found in database.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ListPackageLists (
|
||||||
|
IN UINT8 PackageType,
|
||||||
|
IN CONST EFI_GUID *PackageGuid,
|
||||||
|
IN OUT UINTN *HandleBufferLength,
|
||||||
|
OUT EFI_HII_HANDLE **HandleBuffer
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exports the contents of one or all package lists in the HII database into a buffer.
|
||||||
|
|
||||||
|
If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
|
||||||
|
then ASSERT.
|
||||||
|
If PackageListHeader is NULL, then ASSERT.
|
||||||
|
If PackageListSize is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param Handle The HII Handle.
|
||||||
|
@param PackageListHeader A pointer to a buffer that will contain the results of
|
||||||
|
the export function.
|
||||||
|
@param PackageListSize On output, the length of the buffer that is required for the exported data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Package exported.
|
||||||
|
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ExportPackageLists (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
|
||||||
|
OUT UINTN *PackageListSize
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Extract Hii package list GUID for given HII handle.
|
||||||
|
|
||||||
|
If HiiHandle could not be found in the HII database, then ASSERT.
|
||||||
|
If Guid is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param Handle Hii handle
|
||||||
|
@param Guid Package list GUID
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully extract GUID from Hii database.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ExtractGuidFromHiiHandle (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT EFI_GUID *Guid
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the UefiHiiHandle based on a Framework HII Handle returned by
|
Find the UefiHiiHandle based on a Framework HII Handle returned by
|
||||||
the HII Thunk to Framework HII code.
|
the HII Thunk to Framework HII code.
|
||||||
|
@ -128,20 +128,22 @@ CreateMenuStringToken (
|
|||||||
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
|
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
|
||||||
NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
|
NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
|
||||||
|
|
||||||
HiiLibNewString (
|
NewMenuEntry->DisplayStringToken = HiiSetString (
|
||||||
HiiHandle,
|
HiiHandle,
|
||||||
&NewMenuEntry->DisplayStringToken,
|
0,
|
||||||
NewMenuEntry->DisplayString
|
NewMenuEntry->DisplayString,
|
||||||
);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
if (NULL == NewMenuEntry->HelpString) {
|
if (NULL == NewMenuEntry->HelpString) {
|
||||||
NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
|
NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
|
||||||
} else {
|
} else {
|
||||||
HiiLibNewString (
|
NewMenuEntry->HelpStringToken = HiiSetString (
|
||||||
HiiHandle,
|
HiiHandle,
|
||||||
&NewMenuEntry->HelpStringToken,
|
0,
|
||||||
NewMenuEntry->HelpString
|
NewMenuEntry->HelpString,
|
||||||
);
|
NULL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,7 +850,6 @@ InitializeBM (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
BMM_CALLBACK_DATA *BmmCallbackInfo;
|
BMM_CALLBACK_DATA *BmmCallbackInfo;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 *Ptr;
|
UINT8 *Ptr;
|
||||||
@ -931,30 +932,26 @@ InitializeBM (
|
|||||||
//
|
//
|
||||||
// Post our Boot Maint VFR binnary to the HII database.
|
// Post our Boot Maint VFR binnary to the HII database.
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mBootMaintGuid, BmBin, BdsDxeStrings);
|
BmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mBootMaintGuid,
|
||||||
|
BmmCallbackInfo->BmmDriverHandle,
|
||||||
Status = gHiiDatabase->NewPackageList (
|
BmBin,
|
||||||
gHiiDatabase,
|
BdsDxeStrings,
|
||||||
PackageList,
|
NULL
|
||||||
BmmCallbackInfo->BmmDriverHandle,
|
);
|
||||||
&BmmCallbackInfo->BmmHiiHandle
|
ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL);
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Post our File Explorer VFR binary to the HII database.
|
// Post our File Explorer VFR binary to the HII database.
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mFileExplorerGuid, FEBin, BdsDxeStrings);
|
BmmCallbackInfo->FeHiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mFileExplorerGuid,
|
||||||
|
BmmCallbackInfo->FeDriverHandle,
|
||||||
Status = gHiiDatabase->NewPackageList (
|
FEBin,
|
||||||
gHiiDatabase,
|
BdsDxeStrings,
|
||||||
PackageList,
|
NULL
|
||||||
BmmCallbackInfo->FeDriverHandle,
|
);
|
||||||
&BmmCallbackInfo->FeHiiHandle
|
ASSERT (BmmCallbackInfo->FeHiiHandle != NULL);
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate space for creation of Buffer
|
// Allocate space for creation of Buffer
|
||||||
@ -1057,8 +1054,8 @@ InitializeBM (
|
|||||||
//
|
//
|
||||||
// Remove our IFR data from HII database
|
// Remove our IFR data from HII database
|
||||||
//
|
//
|
||||||
gHiiDatabase->RemovePackageList (gHiiDatabase, BmmCallbackInfo->BmmHiiHandle);
|
HiiRemovePackages (BmmCallbackInfo->BmmHiiHandle);
|
||||||
gHiiDatabase->RemovePackageList (gHiiDatabase, BmmCallbackInfo->FeHiiHandle);
|
HiiRemovePackages (BmmCallbackInfo->FeHiiHandle);
|
||||||
|
|
||||||
CleanUpStringDepository ();
|
CleanUpStringDepository ();
|
||||||
|
|
||||||
@ -1192,7 +1189,7 @@ GetStringTokenFromDepository (
|
|||||||
//
|
//
|
||||||
NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
|
NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
|
||||||
ASSERT (NextListNode != NULL);
|
ASSERT (NextListNode != NULL);
|
||||||
HiiLibNewString (CallbackData->BmmHiiHandle, &(NextListNode->StringToken), L" ");
|
NextListNode->StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, L" ", NULL);
|
||||||
ASSERT (NextListNode->StringToken != 0);
|
ASSERT (NextListNode->StringToken != 0);
|
||||||
|
|
||||||
StringDepository->TotalNodeNumber++;
|
StringDepository->TotalNodeNumber++;
|
||||||
|
@ -752,7 +752,7 @@ UpdateConModePage (
|
|||||||
ASSERT ((StrLen (ModeString) + TempStringLen) < (sizeof (ModeString) / sizeof (ModeString[0])));
|
ASSERT ((StrLen (ModeString) + TempStringLen) < (sizeof (ModeString) / sizeof (ModeString[0])));
|
||||||
StrCat (ModeString, RowString);
|
StrCat (ModeString, RowString);
|
||||||
|
|
||||||
HiiLibNewString (CallbackData->BmmHiiHandle, &ModeToken[Index], ModeString);
|
ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);
|
||||||
|
|
||||||
IfrOptionList[Index].StringToken = ModeToken[Index];
|
IfrOptionList[Index].StringToken = ModeToken[Index];
|
||||||
IfrOptionList[Index].Value.u16 = (UINT16) Mode;
|
IfrOptionList[Index].Value.u16 = (UINT16) Mode;
|
||||||
@ -1246,12 +1246,10 @@ UpdateSetLegacyDeviceOrderPage (
|
|||||||
// Create the string for oneof tag
|
// Create the string for oneof tag
|
||||||
//
|
//
|
||||||
UnicodeSPrint (String, sizeof (String), TypeStr, Index);
|
UnicodeSPrint (String, sizeof (String), TypeStr, Index);
|
||||||
StrRef = 0;
|
StrRef = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
|
||||||
HiiLibNewString (CallbackData->BmmHiiHandle, &StrRef, String);
|
|
||||||
|
|
||||||
UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);
|
UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);
|
||||||
StrRefHelp = 0;
|
StrRefHelp = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
|
||||||
HiiLibNewString (CallbackData->BmmHiiHandle, &StrRefHelp, String);
|
|
||||||
|
|
||||||
CreateOneOfOpCode (
|
CreateOneOfOpCode (
|
||||||
(EFI_QUESTION_ID) (Key + Index),
|
(EFI_QUESTION_ID) (Key + Index),
|
||||||
|
@ -642,13 +642,13 @@ Var_UpdateDriverOption (
|
|||||||
CallbackData,
|
CallbackData,
|
||||||
DriverOptionStrDepository
|
DriverOptionStrDepository
|
||||||
);
|
);
|
||||||
HiiLibNewString (HiiHandle, &NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayString);
|
NewMenuEntry->DisplayStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->DisplayString, NULL);
|
||||||
|
|
||||||
NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
|
NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
|
||||||
CallbackData,
|
CallbackData,
|
||||||
DriverOptionHelpStrDepository
|
DriverOptionHelpStrDepository
|
||||||
);
|
);
|
||||||
HiiLibNewString (HiiHandle, &NewMenuEntry->HelpStringToken, NewMenuEntry->HelpString);
|
NewMenuEntry->HelpStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->HelpString, NULL);
|
||||||
|
|
||||||
if (OptionalDataExist) {
|
if (OptionalDataExist) {
|
||||||
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
|
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
|
||||||
@ -814,13 +814,13 @@ Var_UpdateBootOption (
|
|||||||
CallbackData,
|
CallbackData,
|
||||||
BootOptionStrDepository
|
BootOptionStrDepository
|
||||||
);
|
);
|
||||||
HiiLibNewString (CallbackData->FeHiiHandle, &NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayString);
|
NewMenuEntry->DisplayStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->DisplayString, NULL);
|
||||||
|
|
||||||
NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
|
NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
|
||||||
CallbackData,
|
CallbackData,
|
||||||
BootOptionHelpStrDepository
|
BootOptionHelpStrDepository
|
||||||
);
|
);
|
||||||
HiiLibNewString (CallbackData->FeHiiHandle, &NewMenuEntry->HelpStringToken, NewMenuEntry->HelpString);
|
NewMenuEntry->HelpStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->HelpString, NULL);
|
||||||
|
|
||||||
if (OptionalDataExist) {
|
if (OptionalDataExist) {
|
||||||
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
|
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
|
||||||
|
@ -129,7 +129,8 @@ BootManagerCallback (
|
|||||||
Registers HII packages for the Boot Manger to HII Database.
|
Registers HII packages for the Boot Manger to HII Database.
|
||||||
It also registers the browser call back function.
|
It also registers the browser call back function.
|
||||||
|
|
||||||
@return Status of gBS->InstallMultipleProtocolInterfaces() and gHiiDatabase->NewPackageList()
|
@retval EFI_SUCCESS HII packages for the Boot Manager were registered successfully.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES HII packages for the Boot Manager failed to be registered.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -138,7 +139,6 @@ InitializeBootManager (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install Device Path Protocol and Config Access protocol to driver handle
|
// Install Device Path Protocol and Config Access protocol to driver handle
|
||||||
@ -156,17 +156,18 @@ InitializeBootManager (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mBootManagerGuid, BootManagerVfrBin, BdsDxeStrings);
|
gBootManagerPrivate.HiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mBootManagerGuid,
|
||||||
|
gBootManagerPrivate.DriverHandle,
|
||||||
Status = gHiiDatabase->NewPackageList (
|
BootManagerVfrBin,
|
||||||
gHiiDatabase,
|
BdsDxeStrings,
|
||||||
PackageList,
|
NULL
|
||||||
gBootManagerPrivate.DriverHandle,
|
);
|
||||||
&gBootManagerPrivate.HiiHandle
|
if (gBootManagerPrivate.HiiHandle == NULL) {
|
||||||
);
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
FreePool (PackageList);
|
} else {
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +245,7 @@ CallBootManager (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HiiLibNewString (HiiHandle, &Token, Option->Description);
|
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);
|
||||||
|
|
||||||
TempStr = DevicePathToStr (Option->DevicePath);
|
TempStr = DevicePathToStr (Option->DevicePath);
|
||||||
TempSize = StrSize (TempStr);
|
TempSize = StrSize (TempStr);
|
||||||
@ -253,7 +254,7 @@ CallBootManager (
|
|||||||
StrCat (HelpString, L"Device Path : ");
|
StrCat (HelpString, L"Device Path : ");
|
||||||
StrCat (HelpString, TempStr);
|
StrCat (HelpString, TempStr);
|
||||||
|
|
||||||
HiiLibNewString (HiiHandle, &HelpToken, HelpString);
|
HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);
|
||||||
|
|
||||||
CreateActionOpCode (
|
CreateActionOpCode (
|
||||||
mKeyInput,
|
mKeyInput,
|
||||||
|
@ -86,7 +86,9 @@ BootManagerCallback (
|
|||||||
Registers HII packages for the Boot Manger to HII Database.
|
Registers HII packages for the Boot Manger to HII Database.
|
||||||
It also registers the browser call back function.
|
It also registers the browser call back function.
|
||||||
|
|
||||||
@return Status of gBS->InstallMultipleProtocolInterfaces() and gHiiDatabase->NewPackageList()
|
@retval EFI_SUCCESS HII packages for the Boot Manager were registered successfully.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES HII packages for the Boot Manager failed to be registered.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InitializeBootManager (
|
InitializeBootManager (
|
||||||
|
@ -112,8 +112,8 @@ DeviceManagerCallback (
|
|||||||
|
|
||||||
This function registers HII packages to HII database.
|
This function registers HII packages to HII database.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This function complete successfully.
|
@retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.
|
||||||
@return Other value if failed to register HII packages.
|
@retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -122,7 +122,6 @@ InitializeDeviceManager (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install Device Path Protocol and Config Access protocol to driver handle
|
// Install Device Path Protocol and Config Access protocol to driver handle
|
||||||
@ -140,17 +139,18 @@ InitializeDeviceManager (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mDeviceManagerGuid, DeviceManagerVfrBin, BdsDxeStrings);
|
gDeviceManagerPrivate.HiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mDeviceManagerGuid,
|
||||||
|
gDeviceManagerPrivate.DriverHandle,
|
||||||
Status = gHiiDatabase->NewPackageList (
|
DeviceManagerVfrBin,
|
||||||
gHiiDatabase,
|
BdsDxeStrings,
|
||||||
PackageList,
|
NULL
|
||||||
gDeviceManagerPrivate.DriverHandle,
|
);
|
||||||
&gDeviceManagerPrivate.HiiHandle
|
if (gDeviceManagerPrivate.HiiHandle == NULL) {
|
||||||
);
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
FreePool (PackageList);
|
} else {
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,23 +174,18 @@ CallDeviceManager (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Count;
|
UINTN Count;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
CHAR16 *String;
|
EFI_STRING String;
|
||||||
UINTN StringLength;
|
|
||||||
EFI_HII_UPDATE_DATA UpdateData[MENU_ITEM_NUM];
|
EFI_HII_UPDATE_DATA UpdateData[MENU_ITEM_NUM];
|
||||||
EFI_STRING_ID Token;
|
EFI_STRING_ID Token;
|
||||||
EFI_STRING_ID TokenHelp;
|
EFI_STRING_ID TokenHelp;
|
||||||
EFI_HII_HANDLE *HiiHandles;
|
EFI_HII_HANDLE *HiiHandles;
|
||||||
UINTN HandleBufferLength;
|
|
||||||
UINTN NumberOfHiiHandles;
|
|
||||||
EFI_HII_HANDLE HiiHandle;
|
EFI_HII_HANDLE HiiHandle;
|
||||||
UINT16 FormSetClass;
|
UINT16 FormSetClass;
|
||||||
EFI_STRING_ID FormSetTitle;
|
EFI_STRING_ID FormSetTitle;
|
||||||
EFI_STRING_ID FormSetHelp;
|
EFI_STRING_ID FormSetHelp;
|
||||||
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
HiiHandles = NULL;
|
HiiHandles = NULL;
|
||||||
HandleBufferLength = 0;
|
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
gCallbackKey = 0;
|
gCallbackKey = 0;
|
||||||
@ -221,37 +216,30 @@ CallDeviceManager (
|
|||||||
//
|
//
|
||||||
// Get all the Hii handles
|
// Get all the Hii handles
|
||||||
//
|
//
|
||||||
Status = HiiLibGetHiiHandles (&HandleBufferLength, &HiiHandles);
|
HiiHandles = HiiGetHiiHandles (NULL);
|
||||||
ASSERT_EFI_ERROR (Status && (HiiHandles != NULL));
|
ASSERT (HiiHandles != NULL);
|
||||||
|
|
||||||
HiiHandle = gDeviceManagerPrivate.HiiHandle;
|
HiiHandle = gDeviceManagerPrivate.HiiHandle;
|
||||||
|
|
||||||
StringLength = 0x1000;
|
|
||||||
String = AllocateZeroPool (StringLength);
|
|
||||||
ASSERT (String != NULL);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Search for formset of each class type
|
// Search for formset of each class type
|
||||||
//
|
//
|
||||||
NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
|
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
|
||||||
for (Index = 0; Index < NumberOfHiiHandles; Index++) {
|
|
||||||
IfrLibExtractClassFromHiiHandle (HiiHandles[Index], &FormSetClass, &FormSetTitle, &FormSetHelp);
|
IfrLibExtractClassFromHiiHandle (HiiHandles[Index], &FormSetClass, &FormSetTitle, &FormSetHelp);
|
||||||
|
|
||||||
if (FormSetClass == EFI_NON_DEVICE_CLASS) {
|
if (FormSetClass == EFI_NON_DEVICE_CLASS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Token = 0;
|
String = HiiGetString (HiiHandles[Index], FormSetTitle, NULL);
|
||||||
*String = 0;
|
ASSERT (String != NULL);
|
||||||
StringLength = 0x1000;
|
Token = HiiSetString (HiiHandle, 0, String, NULL);
|
||||||
HiiLibGetString (HiiHandles[Index], FormSetTitle, String, &StringLength);
|
FreePool (String);
|
||||||
HiiLibNewString (HiiHandle, &Token, String);
|
|
||||||
|
|
||||||
TokenHelp = 0;
|
String = HiiGetString (HiiHandles[Index], FormSetHelp, NULL);
|
||||||
*String = 0;
|
ASSERT (String != NULL);
|
||||||
StringLength = 0x1000;
|
TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
|
||||||
HiiLibGetString (HiiHandles[Index], FormSetHelp, String, &StringLength);
|
FreePool (String);
|
||||||
HiiLibNewString (HiiHandle, &TokenHelp, String);
|
|
||||||
|
|
||||||
for (Count = 0; Count < MENU_ITEM_NUM; Count++) {
|
for (Count = 0; Count < MENU_ITEM_NUM; Count++) {
|
||||||
if (FormSetClass & mDeviceManagerMenuItemTable[Count].Class) {
|
if (FormSetClass & mDeviceManagerMenuItemTable[Count].Class) {
|
||||||
@ -266,7 +254,6 @@ CallDeviceManager (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FreePool (String);
|
|
||||||
|
|
||||||
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
||||||
//
|
//
|
||||||
@ -327,16 +314,20 @@ CallDeviceManager (
|
|||||||
//
|
//
|
||||||
// Cleanup dynamic created strings in HII database by reinstall the packagelist
|
// Cleanup dynamic created strings in HII database by reinstall the packagelist
|
||||||
//
|
//
|
||||||
gHiiDatabase->RemovePackageList (gHiiDatabase, HiiHandle);
|
HiiRemovePackages (HiiHandle);
|
||||||
PackageList = HiiLibPreparePackageList (2, &mDeviceManagerGuid, DeviceManagerVfrBin, BdsDxeStrings);
|
|
||||||
ASSERT (PackageList != NULL);
|
gDeviceManagerPrivate.HiiHandle = HiiAddPackages (
|
||||||
Status = gHiiDatabase->NewPackageList (
|
&mDeviceManagerGuid,
|
||||||
gHiiDatabase,
|
gDeviceManagerPrivate.DriverHandle,
|
||||||
PackageList,
|
DeviceManagerVfrBin,
|
||||||
gDeviceManagerPrivate.DriverHandle,
|
BdsDxeStrings,
|
||||||
&gDeviceManagerPrivate.HiiHandle
|
NULL
|
||||||
);
|
);
|
||||||
FreePool (PackageList);
|
if (gDeviceManagerPrivate.HiiHandle == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
} else {
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
for (Index = 0; Index < MENU_ITEM_NUM; Index++) {
|
||||||
FreePool (UpdateData[Index].Data);
|
FreePool (UpdateData[Index].Data);
|
||||||
|
@ -104,8 +104,8 @@ DeviceManagerCallback (
|
|||||||
|
|
||||||
This function registers HII packages to HII database.
|
This function registers HII packages to HII database.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This function complete successfully.
|
@retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.
|
||||||
@return Other value if failed to register HII packages.
|
@retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -183,7 +183,7 @@ FrontPageCallback (
|
|||||||
//
|
//
|
||||||
// Collect the languages from what our current Language support is based on our VFR
|
// Collect the languages from what our current Language support is based on our VFR
|
||||||
//
|
//
|
||||||
LanguageString = HiiLibGetSupportedLanguages (gFrontPagePrivate.HiiHandle);
|
LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle);
|
||||||
ASSERT (LanguageString != NULL);
|
ASSERT (LanguageString != NULL);
|
||||||
//
|
//
|
||||||
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
||||||
@ -297,7 +297,6 @@ InitializeFrontPage (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
EFI_HII_UPDATE_DATA UpdateData;
|
EFI_HII_UPDATE_DATA UpdateData;
|
||||||
IFR_OPTION *OptionList;
|
IFR_OPTION *OptionList;
|
||||||
CHAR8 *LanguageString;
|
CHAR8 *LanguageString;
|
||||||
@ -364,18 +363,15 @@ InitializeFrontPage (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mFrontPageGuid, FrontPageVfrBin, BdsDxeStrings);
|
gFrontPagePrivate.HiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mFrontPageGuid,
|
||||||
|
gFrontPagePrivate.DriverHandle,
|
||||||
Status = gHiiDatabase->NewPackageList (
|
FrontPageVfrBin,
|
||||||
gHiiDatabase,
|
BdsDxeStrings,
|
||||||
PackageList,
|
NULL
|
||||||
gFrontPagePrivate.DriverHandle,
|
);
|
||||||
&gFrontPagePrivate.HiiHandle
|
if (gFrontPagePrivate.HiiHandle == NULL) {
|
||||||
);
|
return EFI_OUT_OF_RESOURCES;
|
||||||
FreePool (PackageList);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +390,7 @@ InitializeFrontPage (
|
|||||||
// Collect the languages from what our current Language support is based on our VFR
|
// Collect the languages from what our current Language support is based on our VFR
|
||||||
//
|
//
|
||||||
HiiHandle = gFrontPagePrivate.HiiHandle;
|
HiiHandle = gFrontPagePrivate.HiiHandle;
|
||||||
LanguageString = HiiLibGetSupportedLanguages (HiiHandle);
|
LanguageString = HiiGetSupportedLanguages (HiiHandle);
|
||||||
ASSERT (LanguageString != NULL);
|
ASSERT (LanguageString != NULL);
|
||||||
//
|
//
|
||||||
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
// Allocate working buffer for RFC 4646 language in supported LanguageString.
|
||||||
@ -455,8 +451,7 @@ InitializeFrontPage (
|
|||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Token = 0;
|
Token = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
|
||||||
Status = HiiLibNewString (HiiHandle, &Token, StringBuffer);
|
|
||||||
FreePool (StringBuffer);
|
FreePool (StringBuffer);
|
||||||
} else {
|
} else {
|
||||||
Token = gFrontPagePrivate.LanguageToken[OptionCount];
|
Token = gFrontPagePrivate.LanguageToken[OptionCount];
|
||||||
@ -578,11 +573,13 @@ GetProducerString (
|
|||||||
OUT CHAR16 **String
|
OUT CHAR16 **String
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STRING TmpString;
|
||||||
|
|
||||||
Status = HiiLibGetStringFromToken (ProducerGuid, Token, String);
|
TmpString = HiiGetPackageString (ProducerGuid, Token, NULL);
|
||||||
if (EFI_ERROR (Status)) {
|
if (TmpString == NULL) {
|
||||||
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
||||||
|
} else {
|
||||||
|
*String = TmpString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -698,7 +695,7 @@ UpdateFrontPageStrings (
|
|||||||
BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);
|
BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);
|
||||||
GetProducerString (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
|
GetProducerString (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
|
||||||
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
|
||||||
HiiLibSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString);
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
Find[0] = TRUE;
|
Find[0] = TRUE;
|
||||||
}
|
}
|
||||||
@ -709,7 +706,7 @@ UpdateFrontPageStrings (
|
|||||||
SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);
|
SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);
|
||||||
GetProducerString (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);
|
GetProducerString (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);
|
||||||
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
|
||||||
HiiLibSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString);
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
Find[1] = TRUE;
|
Find[1] = TRUE;
|
||||||
}
|
}
|
||||||
@ -720,7 +717,7 @@ UpdateFrontPageStrings (
|
|||||||
ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);
|
ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);
|
||||||
GetProducerString (&Record->ProducerName, *ProcessorVersion, &NewString);
|
GetProducerString (&Record->ProducerName, *ProcessorVersion, &NewString);
|
||||||
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL);
|
||||||
HiiLibSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString);
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
Find[2] = TRUE;
|
Find[2] = TRUE;
|
||||||
}
|
}
|
||||||
@ -731,7 +728,7 @@ UpdateFrontPageStrings (
|
|||||||
ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);
|
ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);
|
||||||
ConvertProcessorToString (ProcessorFrequency, &NewString);
|
ConvertProcessorToString (ProcessorFrequency, &NewString);
|
||||||
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED);
|
||||||
HiiLibSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString);
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
Find[3] = TRUE;
|
Find[3] = TRUE;
|
||||||
}
|
}
|
||||||
@ -745,7 +742,7 @@ UpdateFrontPageStrings (
|
|||||||
&NewString
|
&NewString
|
||||||
);
|
);
|
||||||
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE);
|
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE);
|
||||||
HiiLibSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString);
|
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
Find[4] = TRUE;
|
Find[4] = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ EFI_GUID mFontPackageGuid = {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
///
|
///
|
||||||
/// This 4-bytes total array length is required by HiiLibPreparePackageList()
|
/// This 4-bytes total array length is required by HiiAddPackages()
|
||||||
///
|
///
|
||||||
UINT32 Length;
|
UINT32 Length;
|
||||||
|
|
||||||
@ -260,13 +260,14 @@ ExportFonts (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_HII_HANDLE HiiHandle;
|
EFI_HII_HANDLE HiiHandle;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
PackageList = HiiLibPreparePackageList (1, &mFontPackageGuid, &mFontBin);
|
HiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mFontPackageGuid,
|
||||||
|
mBdsImageHandle,
|
||||||
gHiiDatabase->NewPackageList (gHiiDatabase, PackageList, mBdsImageHandle, &HiiHandle);
|
&mFontBin,
|
||||||
FreePool (PackageList);
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,34 +25,19 @@ EFI_GUID mBdsStringPackGuid = {
|
|||||||
/**
|
/**
|
||||||
Initialize HII global accessor for string support
|
Initialize HII global accessor for string support
|
||||||
|
|
||||||
@retval EFI_SUCCESS String support initialize success.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializeStringSupport (
|
InitializeStringSupport (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
gStringPackHandle = HiiAddPackages (
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
&mBdsStringPackGuid,
|
||||||
|
mBdsImageHandle,
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);
|
BdsDxeStrings,
|
||||||
if (EFI_ERROR (Status)) {
|
NULL
|
||||||
return Status;
|
);
|
||||||
}
|
ASSERT (gStringPackHandle != NULL);
|
||||||
|
|
||||||
PackageList = HiiLibPreparePackageList (1, &mBdsStringPackGuid, &BdsDxeStrings);
|
|
||||||
ASSERT (PackageList != NULL);
|
|
||||||
|
|
||||||
Status = gHiiDatabase->NewPackageList (
|
|
||||||
gHiiDatabase,
|
|
||||||
PackageList,
|
|
||||||
mBdsImageHandle,
|
|
||||||
&gStringPackHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
FreePool (PackageList);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,10 +55,5 @@ GetStringById (
|
|||||||
IN EFI_STRING_ID Id
|
IN EFI_STRING_ID Id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *String;
|
return HiiGetString (gStringPackHandle, Id, NULL);
|
||||||
|
|
||||||
String = NULL;
|
|
||||||
HiiLibGetStringFromHandle (gStringPackHandle, Id, &String);
|
|
||||||
|
|
||||||
return String;
|
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,8 @@ GetStringById (
|
|||||||
/**
|
/**
|
||||||
Initialize HII global accessor for string support
|
Initialize HII global accessor for string support
|
||||||
|
|
||||||
@retval EFI_SUCCESS String support initialize success.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
InitializeStringSupport (
|
InitializeStringSupport (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
@ -409,17 +409,19 @@ UpdateDeviceSelectPage (
|
|||||||
// then the 'first refresh' string will be replaced by the 'refresh' string, and the two strings content are same after the replacement
|
// then the 'first refresh' string will be replaced by the 'refresh' string, and the two strings content are same after the replacement
|
||||||
//
|
//
|
||||||
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH);
|
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH);
|
||||||
HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH), &NewString);
|
NewString = HiiGetString (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH), NULL);
|
||||||
ASSERT (NewString != NULL);
|
ASSERT (NewString != NULL);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
if (HiiSetString (Private->RegisteredHandle, NewStringToken, NewString, NULL) == 0) {
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
|
|
||||||
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);
|
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);
|
||||||
HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), &NewString);
|
NewString = HiiGetString (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), NULL);
|
||||||
ASSERT (NewString != NULL);
|
ASSERT (NewString != NULL);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
if (HiiSetString (Private->RegisteredHandle, NewStringToken, NewString, NULL) == 0) {
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -504,13 +506,8 @@ UpdateDeviceSelectPage (
|
|||||||
}
|
}
|
||||||
StrCat (NewString, ControllerName);
|
StrCat (NewString, ControllerName);
|
||||||
|
|
||||||
NewStringToken = mControllerToken[Index];
|
NewStringToken = HiiSetString (Private->RegisteredHandle, mControllerToken[Index], NewString, NULL);
|
||||||
if (NewStringToken == 0) {
|
ASSERT (NewStringToken != 0);
|
||||||
Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);
|
|
||||||
} else {
|
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
|
||||||
}
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
//
|
//
|
||||||
// Save the device path string toke for next access use
|
// Save the device path string toke for next access use
|
||||||
@ -799,7 +796,7 @@ UpdateBindingDriverSelectPage (
|
|||||||
//
|
//
|
||||||
// give a default name
|
// give a default name
|
||||||
//
|
//
|
||||||
HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_DRIVER_DEFAULT_NAME), &DriverName);
|
DriverName = HiiGetString (Private->RegisteredHandle, STRING_TOKEN (STR_DRIVER_DEFAULT_NAME), NULL);
|
||||||
ASSERT (DriverName != NULL);
|
ASSERT (DriverName != NULL);
|
||||||
FreeDriverName = TRUE; // the DriverName string need to free pool
|
FreeDriverName = TRUE; // the DriverName string need to free pool
|
||||||
}
|
}
|
||||||
@ -821,14 +818,9 @@ UpdateBindingDriverSelectPage (
|
|||||||
mLastSavedDriverImageNum++;
|
mLastSavedDriverImageNum++;
|
||||||
}
|
}
|
||||||
StrCat (NewString, DriverName);
|
StrCat (NewString, DriverName);
|
||||||
NewStringToken = mDriverImageToken[Index];
|
NewStringToken = HiiSetString (Private->RegisteredHandle, mDriverImageToken[Index], NewString, NULL);
|
||||||
if (NewStringToken == 0) {
|
ASSERT (NewStringToken != 0);
|
||||||
Status = HiiLibNewString (Private->RegisteredHandle, &NewStringToken, NewString);
|
|
||||||
} else {
|
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
|
||||||
}
|
|
||||||
mDriverImageToken[Index] = NewStringToken;
|
mDriverImageToken[Index] = NewStringToken;
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
if (FreeDriverName) {
|
if (FreeDriverName) {
|
||||||
FreePool (DriverName);
|
FreePool (DriverName);
|
||||||
@ -842,14 +834,9 @@ UpdateBindingDriverSelectPage (
|
|||||||
NewString = AllocateZeroPool (StrSize (DriverName));
|
NewString = AllocateZeroPool (StrSize (DriverName));
|
||||||
ASSERT (NewString != NULL);
|
ASSERT (NewString != NULL);
|
||||||
StrCat (NewString, DriverName);
|
StrCat (NewString, DriverName);
|
||||||
NewStringHelpToken = mDriverImageFilePathToken[Index];
|
NewStringHelpToken = HiiSetString (Private->RegisteredHandle, mDriverImageFilePathToken[Index], NewString, NULL);
|
||||||
if (NewStringHelpToken == 0) {
|
ASSERT (NewStringHelpToken != 0);
|
||||||
Status = HiiLibNewString (Private->RegisteredHandle, &NewStringHelpToken, NewString);
|
|
||||||
} else {
|
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringHelpToken, NewString);
|
|
||||||
}
|
|
||||||
mDriverImageFilePathToken[Index] = NewStringHelpToken;
|
mDriverImageFilePathToken[Index] = NewStringHelpToken;
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
FreePool (NewString);
|
FreePool (NewString);
|
||||||
FreePool (DriverName);
|
FreePool (DriverName);
|
||||||
|
|
||||||
@ -1304,8 +1291,9 @@ PlatOverMngrCallback (
|
|||||||
// Update page title string
|
// Update page title string
|
||||||
//
|
//
|
||||||
NewStringToken = STRING_TOKEN (STR_TITLE);
|
NewStringToken = STRING_TOKEN (STR_TITLE);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path");
|
if (HiiSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path", NULL) == 0) {
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((KeyValue >= KEY_VALUE_DEVICE_OFFSET) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {
|
if (((KeyValue >= KEY_VALUE_DEVICE_OFFSET) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {
|
||||||
@ -1317,8 +1305,9 @@ PlatOverMngrCallback (
|
|||||||
// Update page title string
|
// Update page title string
|
||||||
//
|
//
|
||||||
NewStringToken = STRING_TOKEN (STR_TITLE);
|
NewStringToken = STRING_TOKEN (STR_TITLE);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Second, Select drivers for the previous selected controller");
|
if (HiiSetString (Private->RegisteredHandle, NewStringToken, L"Second, Select drivers for the previous selected controller", NULL) == 0) {
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyValue == KEY_VALUE_DRIVER_GOTO_ORDER) {
|
if (KeyValue == KEY_VALUE_DRIVER_GOTO_ORDER) {
|
||||||
@ -1327,8 +1316,9 @@ PlatOverMngrCallback (
|
|||||||
// Update page title string
|
// Update page title string
|
||||||
//
|
//
|
||||||
NewStringToken = STRING_TOKEN (STR_TITLE);
|
NewStringToken = STRING_TOKEN (STR_TITLE);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, L"Finally, Set the priority order for the drivers and save them");
|
if (HiiSetString (Private->RegisteredHandle, NewStringToken, L"Finally, Set the priority order for the drivers and save them", NULL) == 0) {
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) {
|
if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) {
|
||||||
@ -1383,22 +1373,8 @@ PlatOverMngrInit (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
||||||
|
|
||||||
//
|
|
||||||
// There should only be one HII protocol
|
|
||||||
//
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gEfiHiiDatabaseProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &HiiDatabase
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// There should only be one Form Configuration protocol
|
// There should only be one Form Configuration protocol
|
||||||
//
|
//
|
||||||
@ -1439,23 +1415,15 @@ PlatOverMngrInit (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (
|
mCallbackInfo->RegisteredHandle = HiiAddPackages (
|
||||||
2,
|
&mPlatformOverridesManagerGuid,
|
||||||
&mPlatformOverridesManagerGuid,
|
mCallbackInfo->DriverHandle,
|
||||||
VfrBin,
|
VfrBin,
|
||||||
PlatOverMngrStrings
|
PlatOverMngrStrings,
|
||||||
);
|
NULL
|
||||||
ASSERT (PackageList != NULL);
|
);
|
||||||
|
if (mCallbackInfo->RegisteredHandle == NULL) {
|
||||||
Status = HiiDatabase->NewPackageList (
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
HiiDatabase,
|
|
||||||
PackageList,
|
|
||||||
mCallbackInfo->DriverHandle,
|
|
||||||
&mCallbackInfo->RegisteredHandle
|
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto Finish;
|
goto Finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,11 +1462,8 @@ PlatOverMngrInit (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
HiiDatabase->RemovePackageList (HiiDatabase, mCallbackInfo->RegisteredHandle);
|
HiiRemovePackages (mCallbackInfo->RegisteredHandle);
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto Finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
Finish:
|
Finish:
|
||||||
if (mCallbackInfo->DriverHandle != NULL) {
|
if (mCallbackInfo->DriverHandle != NULL) {
|
||||||
|
@ -318,7 +318,6 @@ InstallDefaultKeyboardLayout (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
EFI_HII_HANDLE HiiHandle;
|
EFI_HII_HANDLE HiiHandle;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate Hii database protocol
|
// Locate Hii database protocol
|
||||||
@ -335,13 +334,14 @@ InstallDefaultKeyboardLayout (
|
|||||||
//
|
//
|
||||||
// Install Keyboard Layout package to HII database
|
// Install Keyboard Layout package to HII database
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (1, &mUsbKeyboardLayoutPackageGuid, &mUsbKeyboardLayoutBin);
|
HiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mUsbKeyboardLayoutPackageGuid,
|
||||||
|
UsbKeyboardDevice->ControllerHandle,
|
||||||
Status = HiiDatabase->NewPackageList (HiiDatabase, PackageList, UsbKeyboardDevice->ControllerHandle, &HiiHandle);
|
&mUsbKeyboardLayoutBin,
|
||||||
FreePool (PackageList);
|
NULL
|
||||||
if (EFI_ERROR (Status)) {
|
);
|
||||||
return Status;
|
if (HiiHandle == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -17,281 +17,207 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
|
Registers a list of packages in the HII Database and returns the HII Handle
|
||||||
|
associated with that registration. If an HII Handle has already been registered
|
||||||
|
with the same PackageListGuid, then NULL is returned. If there are not enough
|
||||||
|
resources to perform the registration, then NULL is returned. If an empty list
|
||||||
|
of packages is passed in, then NULL is returned. If the size of the list of
|
||||||
|
package is 0, then NULL is returned.
|
||||||
|
|
||||||
If GuidId is NULL, then ASSERT.
|
The variable arguments are pointers which point to package header that defined
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
by UEFI VFR compiler and StringGather tool.
|
||||||
|
|
||||||
@param NumberOfPackages Number of packages.
|
#pragma pack (push, 1)
|
||||||
@param GuidId Package GUID.
|
typedef struct {
|
||||||
@param ... Variable argument list for packages to be assembled.
|
UINT32 BinaryLength;
|
||||||
|
EFI_HII_PACKAGE_HEADER PackageHeader;
|
||||||
|
} EDKII_AUTOGEN_PACKAGES_HEADER;
|
||||||
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
@param[in] PackageListGuid The GUID of the package list.
|
||||||
|
@param[in] DeviceHandle If not NULL, the Device Handle on which
|
||||||
|
an instance of DEVICE_PATH_PROTOCOL is installed.
|
||||||
|
This Device Handle uniquely defines the device that
|
||||||
|
the added packages are associated with.
|
||||||
|
@param[in] ... The variable argument list that contains pointers
|
||||||
|
to packages terminated by a NULL.
|
||||||
|
|
||||||
@return Pointer of EFI_HII_PACKAGE_LIST_HEADER.
|
@retval NULL A HII Handle has already been registered in the HII Database with
|
||||||
|
the same PackageListGuid.
|
||||||
|
@retval NULL The HII Handle could not be created.
|
||||||
|
@retval NULL An empty list of packages was passed in.
|
||||||
|
@retval NULL All packages are empty.
|
||||||
|
@retval Other The HII Handle associated with the newly registered package list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *
|
EFI_HII_HANDLE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibPreparePackageList (
|
HiiAddPackages (
|
||||||
IN UINTN NumberOfPackages,
|
IN CONST EFI_GUID *PackageListGuid,
|
||||||
IN CONST EFI_GUID *GuidId,
|
IN EFI_HANDLE DeviceHandle OPTIONAL,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function allocates pool for an EFI_HII_PACKAGE_LIST structure
|
Removes a package list from the HII database.
|
||||||
with additional space that is big enough to host all packages described by the variable
|
|
||||||
argument list of package pointers. The allocated structure is initialized using NumberOfPackages,
|
|
||||||
GuidId, and the variable length argument list of package pointers.
|
|
||||||
|
|
||||||
Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The
|
|
||||||
Handle to the newly registered Package List is returned throught HiiHandle.
|
|
||||||
|
|
||||||
If HiiHandle is NULL, then ASSERT.
|
If HiiHandle is NULL, then ASSERT.
|
||||||
|
If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT.
|
||||||
|
|
||||||
@param NumberOfPackages The number of HII packages to register.
|
@param[in] HiiHandle The handle that was previously registered in the HII database
|
||||||
@param GuidId Package List GUID ID.
|
|
||||||
@param DriverHandle Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.
|
|
||||||
This DriverHandle uniquely defines the device that the added packages are associated with.
|
|
||||||
@param HiiHandle On output, the HiiHandle is update with the handle which can be used to retrieve the Package
|
|
||||||
List later. If the functions failed to add the package to the default HII database, this value will
|
|
||||||
be set to NULL.
|
|
||||||
@param ... The variable argument list describing all HII Package.
|
|
||||||
|
|
||||||
@return EFI_SUCCESS If the packages are successfully added to the default HII database.
|
|
||||||
@return EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibAddPackages (
|
|
||||||
IN UINTN NumberOfPackages,
|
|
||||||
IN CONST EFI_GUID *GuidId,
|
|
||||||
IN EFI_HANDLE DriverHandle, OPTIONAL
|
|
||||||
OUT EFI_HII_HANDLE *HiiHandle,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Removes a package list from the default HII database.
|
|
||||||
|
|
||||||
If HiiHandle is NULL, then ASSERT.
|
|
||||||
If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The handle that was previously registered to the data base that is requested for removal.
|
|
||||||
List later.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibRemovePackages (
|
HiiRemovePackages (
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function adds the string into String Package of each language
|
This function create a new string in String Package or updates an existing
|
||||||
supported by the package list.
|
string in a String Package. If StringId is 0, then a new string is added to
|
||||||
|
a String Package. If StringId is not zero, then a string in String Package is
|
||||||
|
updated. If SupportedLanguages is NULL, then the string is added or updated
|
||||||
|
for all the languages that the String Package supports. If SupportedLanguages
|
||||||
|
is not NULL, then the string is added or updated for the set of languages
|
||||||
|
specified by SupportedLanguages.
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
If String is NULL, then ASSERT().
|
||||||
|
|
||||||
If String is NULL, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the
|
||||||
If StringId is NULL, the ASSERT.
|
HII Database.
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
@param[in] StringId If zero, then a new string is created in the
|
||||||
|
String Package associated with HiiHandle. If
|
||||||
|
non-zero, then the string specified by StringId
|
||||||
|
is updated in the String Package associated
|
||||||
|
with HiiHandle.
|
||||||
|
@param[in] String A pointer to the Null-terminated Unicode string
|
||||||
|
to add or update in the String Package associated
|
||||||
|
with HiiHandle.
|
||||||
|
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of
|
||||||
|
language codes. If this parameter is NULL, then
|
||||||
|
String is added or updated in the String Package
|
||||||
|
associated with HiiHandle for all the languages
|
||||||
|
that the String Package supports. If this
|
||||||
|
parameter is not NULL, then then String is added
|
||||||
|
or updated in the String Package associated with
|
||||||
|
HiiHandle for the set oflanguages specified by
|
||||||
|
SupportedLanguages. The format of
|
||||||
|
SupportedLanguages must follow the language
|
||||||
|
format assumed the HII Database.
|
||||||
|
|
||||||
@param PackageList Handle of the package list where this string will
|
@retval 0 The string could not be added or updated in the String Package.
|
||||||
be added.
|
@retval Other The EFI_STRING_ID of the newly added or updated string.
|
||||||
@param StringId On return, contains the new strings id, which is
|
|
||||||
unique within PackageList.
|
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The new string was added successfully.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING_ID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibNewString (
|
HiiSetString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
OUT EFI_STRING_ID *StringId,
|
IN EFI_STRING_ID StringId, OPTIONAL
|
||||||
IN CONST EFI_STRING String
|
IN CONST EFI_STRING String,
|
||||||
|
IN CONST CHAR8 *SupportedLanguages OPTIONAL
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function update the specified string in String Package of each language
|
Retrieves a string from a string package in a specific language. If the language
|
||||||
supported by the package list.
|
is not specified, then a string from a string package in the current platform
|
||||||
|
language is retrieved. If the string can not be retrieved using the specified
|
||||||
|
language or the current platform language, then the string is retrieved from
|
||||||
|
the string package in the first language the string package supports. The
|
||||||
|
returned string is allocated using AllocatePool(). The caller is responsible
|
||||||
|
for freeing the allocated buffer using FreePool().
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
If StringId is 0, then ASSET.
|
||||||
|
|
||||||
If String is NULL, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the HII Database.
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
@param[in] StringId The identifier of the string to retrieved from the string
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
package associated with HiiHandle.
|
||||||
|
@param[in] Language The language of the string to retrieve. If this parameter
|
||||||
|
is NULL, then the current platform language is used. The
|
||||||
|
format of Language must follow the language format assumed
|
||||||
|
the HII Database.
|
||||||
|
|
||||||
@param PackageList Handle of the package list where this string will
|
@retval NULL The string specified by StringId is not present in the string package.
|
||||||
be added.
|
@retval Other The string was returned.
|
||||||
@param StringId Ths String Id to be updated.
|
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The new string was added successfully.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibSetString (
|
HiiGetString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
IN EFI_STRING_ID StringId,
|
IN EFI_STRING_ID StringId,
|
||||||
IN CONST EFI_STRING String
|
IN CONST CHAR8 *Language OPTIONAL
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function try to retrieve string from String package of current language.
|
Retrieves a string from a string package names by GUID in a specific language.
|
||||||
If fails, it try to retrieve string from String package of first language it support.
|
If the language is not specified, then a string from a string package in the
|
||||||
|
current platform language is retrieved. If the string can not be retrieved
|
||||||
|
using the specified language or the current platform language, then the string
|
||||||
|
is retrieved from the string package in the first language the string package
|
||||||
|
supports. The returned string is allocated using AllocatePool(). The caller
|
||||||
|
is responsible for freeing the allocated buffer using FreePool().
|
||||||
|
|
||||||
|
If PackageListGuid is NULL, then ASSERT().
|
||||||
|
If StringId is 0, then ASSERT.
|
||||||
|
|
||||||
If StringSize is NULL, then ASSERT.
|
@param[in] PackageListGuid The GUID of a package list that was previously
|
||||||
If String is NULL and *StringSize is not 0, then ASSERT.
|
registered in the HII Database.
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
@param[in] StringId The identifier of the string to retrieved from the
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
string package associated with PackageListGuid.
|
||||||
|
@param[in] Language The language of the string to retrieve. If this
|
||||||
|
parameter is NULL, then the current platform
|
||||||
|
language is used. The format of Language must
|
||||||
|
follow the language format assumed the HII Database.
|
||||||
|
|
||||||
@param PackageList The package list in the HII database to search for
|
@retval NULL The package list specified by PackageListGuid is not present in the
|
||||||
the specified string.
|
HII Database.
|
||||||
@param StringId The string's id, which is unique within
|
@retval NULL The string specified by StringId is not present in the string package.
|
||||||
PackageList.
|
@retval Other The string was returned.
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
@param StringSize On entry, points to the size of the buffer pointed
|
|
||||||
to by String, in bytes. On return, points to the
|
|
||||||
length of the string, in bytes.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The string was returned successfully.
|
|
||||||
@retval EFI_NOT_FOUND The string specified by StringId is not available.
|
|
||||||
@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small
|
|
||||||
to hold the string.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetString (
|
HiiGetPackageString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN CONST EFI_GUID *PackageListGuid,
|
||||||
IN EFI_STRING_ID StringId,
|
IN EFI_STRING_ID StringId,
|
||||||
OUT EFI_STRING String,
|
IN CONST CHAR8 *Language OPTIONAL
|
||||||
IN OUT UINTN *StringSize
|
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get string specified by StringId form the HiiHandle. The caller
|
Retrieves the array of all the HII Handles or the HII handle of a specific
|
||||||
is responsible to free the *String.
|
package list in the HII Database.
|
||||||
|
This array is terminated with a NULL HII Handle.
|
||||||
|
This function allocates the returned array using AllocatePool().
|
||||||
|
The caller is responsible for freeing the array with FreePool().
|
||||||
|
|
||||||
If String is NULL, then ASSERT.
|
@param[in] PackageListGuid An optional parameter that is used to request
|
||||||
If HiiHandle could not be found in the default HII database, then ASSERT.
|
an HII Handle that is associatd with a specific
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
Package List GUID. If this parameter is NULL
|
||||||
|
then all the HII Handles in the HII Database
|
||||||
|
are returned. If this parameter is not NULL
|
||||||
|
then at most 1 HII Handle is returned.
|
||||||
|
|
||||||
@param HiiHandle The HII handle of package list.
|
@retval NULL No HII handles were found in the HII database
|
||||||
@param StringId The String ID.
|
@retval NULL The array of HII Handles could not be retrieved
|
||||||
@param String The output string.
|
@retval Other A pointer to the NULL terminated array of HII Handles
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND String is not found.
|
|
||||||
@retval EFI_SUCCESS Operation is successful.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_HII_HANDLE *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetStringFromHandle (
|
HiiGetHiiHandles (
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
IN CONST EFI_GUID *PackageListGuid OPTIONAL
|
||||||
IN EFI_STRING_ID StringId,
|
|
||||||
OUT EFI_STRING *String
|
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
|
||||||
Get the string given the StringId and String package Producer's Guid. The caller
|
|
||||||
is responsible to free the *String.
|
|
||||||
|
|
||||||
If PackageList with the matching ProducerGuid is not found, then ASSERT.
|
|
||||||
If PackageList with the matching ProducerGuid is found but no String is
|
|
||||||
specified by StringId is found, then ASSERT.
|
|
||||||
|
|
||||||
@param ProducerGuid The Guid of String package list.
|
|
||||||
@param StringId The String ID.
|
|
||||||
@param String The output string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operation is successful.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetStringFromToken (
|
|
||||||
IN EFI_GUID *ProducerGuid,
|
|
||||||
IN EFI_STRING_ID StringId,
|
|
||||||
OUT EFI_STRING *String
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Determines the handles that are currently active in the database.
|
|
||||||
It's the caller's responsibility to free handle buffer.
|
|
||||||
|
|
||||||
If HandleBufferLength is NULL, then ASSERT.
|
|
||||||
If HiiHandleBuffer is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param HandleBufferLength On input, a pointer to the length of the handle
|
|
||||||
buffer. On output, the length of the handle buffer
|
|
||||||
that is required for the handles found.
|
|
||||||
@param HiiHandleBuffer Pointer to an array of Hii Handles returned.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Get an array of Hii Handles successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetHiiHandles (
|
|
||||||
IN OUT UINTN *HandleBufferLength,
|
|
||||||
OUT EFI_HII_HANDLE **HiiHandleBuffer
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Extract Hii package list GUID for given HII handle.
|
|
||||||
|
|
||||||
If HiiHandle could not be found in the default HII database, then ASSERT.
|
|
||||||
If Guid is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param Handle Hii handle
|
|
||||||
@param Guid Package list GUID
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Successfully extract GUID from Hii database.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibExtractGuidFromHiiHandle (
|
|
||||||
IN EFI_HII_HANDLE Handle,
|
|
||||||
OUT EFI_GUID *Guid
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Find HII Handle in the default HII database associated with given Device Path.
|
|
||||||
|
|
||||||
If DevicePath is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param DevicePath Device Path associated with the HII package list
|
|
||||||
handle.
|
|
||||||
|
|
||||||
@retval Handle HII package list Handle associated with the Device
|
|
||||||
Path.
|
|
||||||
@retval NULL Hii Package list handle is not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_HII_HANDLE
|
|
||||||
EFIAPI
|
|
||||||
HiiLibDevicePathToHiiHandle (
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get next language from language code list (with separator ';').
|
Get next language from language code list (with separator ';').
|
||||||
|
|
||||||
@ -313,138 +239,30 @@ HiiLibGetNextLanguage (
|
|||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function returns the list of supported languages, in the format specified
|
Retrieves a pointer to the a Null-terminated ASCII string containing the list
|
||||||
in UEFI specification Appendix M.
|
of languages that an HII handle in the HII Database supports. The returned
|
||||||
|
string is allocated using AllocatePool(). The caller is responsible for freeing
|
||||||
|
the returned string using FreePool(). The format of the returned string follows
|
||||||
|
the language format assumed the HII Database.
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the HII Database.
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
@retval NULL HiiHandle is not registered in the HII database
|
||||||
|
@retval NULL There are not enough resources available to retrieve the suported
|
||||||
@retval !NULL The supported languages.
|
languages.
|
||||||
@retval NULL If Supported Languages can not be retrived.
|
@retval NULL The list of suported languages could not be retrieved.
|
||||||
|
@retval Other A pointer to the Null-terminated ASCII string of supported languages.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
CHAR8 *
|
CHAR8 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetSupportedLanguages (
|
HiiGetSupportedLanguages (
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
|
||||||
This function returns the list of supported 2nd languages, in the format specified
|
|
||||||
in UEFI specification Appendix M.
|
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
|
||||||
@param FirstLanguage Pointer to language name buffer.
|
|
||||||
|
|
||||||
@return The supported languages.
|
|
||||||
|
|
||||||
**/
|
|
||||||
CHAR8 *
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetSupportedSecondaryLanguages (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN CONST CHAR8 *FirstLanguage
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function returns the number of supported languages on HiiHandle.
|
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
|
||||||
|
|
||||||
@return The number of supported languages.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT16
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetSupportedLanguageNumber (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Exports the contents of one or all package lists in the HII database into a buffer.
|
|
||||||
|
|
||||||
If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
|
|
||||||
then ASSERT.
|
|
||||||
If PackageListHeader is NULL, then ASSERT.
|
|
||||||
If PackageListSize is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param Handle The HII Handle.
|
|
||||||
@param PackageListHeader A pointer to a buffer that will contain the results of
|
|
||||||
the export function.
|
|
||||||
@param PackageListSize On output, the length of the buffer that is required for the exported data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Package exported.
|
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibExportPackageLists (
|
|
||||||
IN EFI_HII_HANDLE Handle,
|
|
||||||
OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
|
|
||||||
OUT UINTN *PackageListSize
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
This function returns a list of the package handles of the
|
|
||||||
specified type that are currently active in the HII database. The
|
|
||||||
pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
|
|
||||||
handles to be listed.
|
|
||||||
|
|
||||||
If HandleBufferLength is NULL, then ASSERT.
|
|
||||||
If HandleBuffer is NULL, the ASSERT.
|
|
||||||
If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
|
|
||||||
NULL, then ASSERT.
|
|
||||||
If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
|
|
||||||
NULL, then ASSERT.
|
|
||||||
|
|
||||||
|
|
||||||
@param PackageType Specifies the package type of the packages
|
|
||||||
to list or EFI_HII_PACKAGE_TYPE_ALL for
|
|
||||||
all packages to be listed.
|
|
||||||
|
|
||||||
@param PackageGuid If PackageType is
|
|
||||||
EFI_HII_PACKAGE_TYPE_GUID, then this is
|
|
||||||
the pointer to the GUID which must match
|
|
||||||
the Guid field of
|
|
||||||
EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
|
|
||||||
must be NULL.
|
|
||||||
|
|
||||||
@param HandleBufferLength On output, the length of the handle buffer
|
|
||||||
that is required for the handles found.
|
|
||||||
|
|
||||||
@param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
|
|
||||||
The caller is responcible to free this pointer allocated.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The matching handles are outputed successfully.
|
|
||||||
HandleBufferLength is updated with the actual length.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
|
|
||||||
@retval EFI_NOT_FOUND No matching handle could not be found in database.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibListPackageLists (
|
|
||||||
IN UINT8 PackageType,
|
|
||||||
IN CONST EFI_GUID *PackageGuid,
|
|
||||||
IN OUT UINTN *HandleBufferLength,
|
|
||||||
OUT EFI_HII_HANDLE **Handle
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert language code from RFC3066 to ISO639-2.
|
Convert language code from RFC3066 to ISO639-2.
|
||||||
|
|
||||||
|
@ -58,155 +58,81 @@ HiiLibGetNextLanguage (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function returns the list of supported languages, in the format specified
|
Retrieves a pointer to the a Null-terminated ASCII string containing the list
|
||||||
in UEFI specification Appendix M.
|
of languages that an HII handle in the HII Database supports. The returned
|
||||||
|
string is allocated using AllocatePool(). The caller is responsible for freeing
|
||||||
|
the returned string using FreePool(). The format of the returned string follows
|
||||||
|
the language format assumed the HII Database.
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the HII Database.
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
@retval NULL HiiHandle is not registered in the HII database
|
||||||
|
@retval NULL There are not enough resources available to retrieve the suported
|
||||||
@retval !NULL The supported languages.
|
languages.
|
||||||
@retval NULL If Supported Languages can not be retrived.
|
@retval NULL The list of suported languages could not be retrieved.
|
||||||
|
@retval Other A pointer to the Null-terminated ASCII string of supported languages.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
CHAR8 *
|
CHAR8 *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetSupportedLanguages (
|
HiiGetSupportedLanguages (
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN BufferSize;
|
UINTN LanguageSize;
|
||||||
CHAR8 *LanguageString;
|
CHAR8 TempSupportedLanguages;
|
||||||
|
CHAR8 *SupportedLanguages;
|
||||||
ASSERT (IsHiiHandleRegistered (HiiHandle));
|
|
||||||
//
|
|
||||||
// Collect current supported Languages for given HII handle
|
|
||||||
// First try allocate 4K buffer to store the current supported languages.
|
|
||||||
//
|
|
||||||
BufferSize = 0x1000;
|
|
||||||
LanguageString = AllocateZeroPool (BufferSize);
|
|
||||||
if (LanguageString == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gHiiString->GetLanguages (gHiiString, HiiHandle, LanguageString, &BufferSize);
|
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
FreePool (LanguageString);
|
|
||||||
LanguageString = AllocateZeroPool (BufferSize);
|
|
||||||
if (LanguageString == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gHiiString->GetLanguages (gHiiString, HiiHandle, LanguageString, &BufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
LanguageString = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LanguageString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function returns the number of supported languages on HiiHandle.
|
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
|
||||||
|
|
||||||
@return The number of supported languages.
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT16
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetSupportedLanguageNumber (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
CHAR8 *Languages;
|
|
||||||
CHAR8 *LanguageString;
|
|
||||||
UINT16 LangNumber;
|
|
||||||
CHAR8 *Lang;
|
|
||||||
|
|
||||||
Languages = HiiLibGetSupportedLanguages (HiiHandle);
|
|
||||||
if (Languages == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LangNumber = 0;
|
|
||||||
Lang = AllocatePool (AsciiStrSize (Languages));
|
|
||||||
if (Lang != NULL) {
|
|
||||||
LanguageString = Languages;
|
|
||||||
while (*LanguageString != 0) {
|
|
||||||
HiiLibGetNextLanguage (&LanguageString, Lang);
|
|
||||||
LangNumber++;
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (Lang);
|
|
||||||
}
|
|
||||||
FreePool (Languages);
|
|
||||||
|
|
||||||
return LangNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function returns the list of supported 2nd languages, in the format specified
|
|
||||||
in UEFI specification Appendix M.
|
|
||||||
|
|
||||||
If HiiHandle is not a valid Handle in the default HII database, then ASSERT.
|
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The HII package list handle.
|
|
||||||
@param FirstLanguage Pointer to language name buffer.
|
|
||||||
|
|
||||||
@return The supported languages.
|
|
||||||
|
|
||||||
**/
|
|
||||||
CHAR8 *
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetSupportedSecondaryLanguages (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN CONST CHAR8 *FirstLanguage
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN BufferSize;
|
|
||||||
CHAR8 *LanguageString;
|
|
||||||
|
|
||||||
ASSERT (HiiHandle != NULL);
|
ASSERT (HiiHandle != NULL);
|
||||||
ASSERT (IsHiiHandleRegistered (HiiHandle));
|
|
||||||
//
|
//
|
||||||
// Collect current supported 2nd Languages for given HII handle
|
// Retrieve the size required for the supported languages buffer.
|
||||||
// First try allocate 4K buffer to store the current supported 2nd languages.
|
|
||||||
//
|
//
|
||||||
BufferSize = 0x1000;
|
LanguageSize = 0;
|
||||||
LanguageString = AllocateZeroPool (BufferSize);
|
Status = gHiiString->GetLanguages (gHiiString, HiiHandle, &TempSupportedLanguages, &LanguageSize);
|
||||||
if (LanguageString == NULL) {
|
|
||||||
|
//
|
||||||
|
// If GetLanguages() returns EFI_SUCCESS for a zero size,
|
||||||
|
// then there are no supported languages registered for HiiHandle. If GetLanguages()
|
||||||
|
// returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
|
||||||
|
// in the HII Database
|
||||||
|
//
|
||||||
|
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||||
|
//
|
||||||
|
// Return NULL if the size can not be retrieved, or if HiiHandle is not in the HII Database
|
||||||
|
//
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gHiiString->GetSecondaryLanguages (gHiiString, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
|
//
|
||||||
|
// Allocate the supported languages buffer.
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
//
|
||||||
FreePool (LanguageString);
|
SupportedLanguages = AllocateZeroPool (LanguageSize);
|
||||||
LanguageString = AllocateZeroPool (BufferSize);
|
if (SupportedLanguages == NULL) {
|
||||||
if (LanguageString == NULL) {
|
//
|
||||||
return NULL;
|
// Return NULL if allocation fails.
|
||||||
}
|
//
|
||||||
|
return NULL;
|
||||||
Status = gHiiString->GetSecondaryLanguages (gHiiString, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve the supported languages string
|
||||||
|
//
|
||||||
|
Status = gHiiString->GetLanguages (gHiiString, HiiHandle, SupportedLanguages, &LanguageSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
LanguageString = NULL;
|
//
|
||||||
|
// Free the buffer and return NULL if the supported languages can not be retrieved.
|
||||||
|
//
|
||||||
|
FreePool (SupportedLanguages);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LanguageString;
|
//
|
||||||
|
// Return the Null-terminated ASCII string of supported languages
|
||||||
|
//
|
||||||
|
return SupportedLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,16 +19,26 @@
|
|||||||
//
|
//
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16 mConfigHdrTemplate[] = L"GUID=00000000000000000000000000000000&NAME=0000&PATH=00";
|
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16 mConfigHdrTemplate[] = L"GUID=00000000000000000000000000000000&NAME=0000&PATH=00";
|
||||||
|
|
||||||
//
|
|
||||||
// Form Browser2 Protocol
|
|
||||||
//
|
|
||||||
EFI_FORM_BROWSER2_PROTOCOL *mUefiFormBrowser2 = NULL;
|
EFI_FORM_BROWSER2_PROTOCOL *mUefiFormBrowser2 = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Template used to mark the end of a list of packages
|
||||||
|
//
|
||||||
|
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_HII_PACKAGE_HEADER mEndOfPakageList = {
|
||||||
|
sizeof (EFI_HII_PACKAGE_HEADER),
|
||||||
|
EFI_HII_PACKAGE_END
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This funciton build the package list based on the package number,
|
Registers a list of packages in the HII Database and returns the HII Handle
|
||||||
the GUID of the package list and the list of pointer which point to
|
associated with that registration. If an HII Handle has already been registered
|
||||||
package header that defined by UEFI VFR compiler and StringGather
|
with the same PackageListGuid, then NULL is returned. If there are not enough
|
||||||
tool.
|
resources to perform the registration, then NULL is returned. If an empty list
|
||||||
|
of packages is passed in, then NULL is returned. If the size of the list of
|
||||||
|
package is 0, then NULL is returned.
|
||||||
|
|
||||||
|
The variable arguments are pointers which point to package header that defined
|
||||||
|
by UEFI VFR compiler and StringGather tool.
|
||||||
|
|
||||||
#pragma pack (push, 1)
|
#pragma pack (push, 1)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -36,267 +46,269 @@ EFI_FORM_BROWSER2_PROTOCOL *mUefiFormBrowser2 = NULL;
|
|||||||
EFI_HII_PACKAGE_HEADER PackageHeader;
|
EFI_HII_PACKAGE_HEADER PackageHeader;
|
||||||
} EDKII_AUTOGEN_PACKAGES_HEADER;
|
} EDKII_AUTOGEN_PACKAGES_HEADER;
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
||||||
If there is not enough resource for the new package list,
|
|
||||||
the function will ASSERT.
|
|
||||||
|
|
||||||
@param NumberOfPackages The number of packages be
|
|
||||||
@param GuidId The GUID for the package list to be generated.
|
|
||||||
@param Marker The variable argument list. Each entry represent a specific package header that is
|
|
||||||
generated by VFR compiler and StrGather tool. The first 4 bytes is a UINT32 value
|
|
||||||
that indicate the overall length of the package.
|
|
||||||
|
|
||||||
@return The pointer to the package list header.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *
|
|
||||||
InternalHiiLibPreparePackages (
|
|
||||||
IN UINTN NumberOfPackages,
|
|
||||||
IN CONST EFI_GUID *GuidId,
|
|
||||||
IN VA_LIST Marker
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
|
||||||
UINT8 *PackageListData;
|
|
||||||
UINT32 PackageListLength;
|
|
||||||
UINT32 PackageLength;
|
|
||||||
EFI_HII_PACKAGE_HEADER PackageHeader;
|
|
||||||
UINT8 *PackageArray;
|
|
||||||
UINTN Index;
|
|
||||||
VA_LIST MarkerBackup;
|
|
||||||
|
|
||||||
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
|
||||||
|
|
||||||
MarkerBackup = Marker;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Count the length of the final package list.
|
|
||||||
//
|
|
||||||
for (Index = 0; Index < NumberOfPackages; Index++) {
|
|
||||||
CopyMem (&PackageLength, VA_ARG (Marker, VOID *), sizeof (UINT32));
|
|
||||||
//
|
|
||||||
// Do not count the BinaryLength field.
|
|
||||||
//
|
|
||||||
PackageListLength += (PackageLength - sizeof (UINT32));
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Include the length of EFI_HII_PACKAGE_END
|
|
||||||
//
|
|
||||||
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
|
|
||||||
PackageListHeader = AllocateZeroPool (PackageListLength);
|
|
||||||
ASSERT (PackageListHeader != NULL);
|
|
||||||
|
|
||||||
CopyGuid (&PackageListHeader->PackageListGuid, GuidId);
|
@param[in] PackageListGuid The GUID of the package list.
|
||||||
PackageListHeader->PackageLength = PackageListLength;
|
@param[in] DeviceHandle If not NULL, the Device Handle on which
|
||||||
|
an instance of DEVICE_PATH_PROTOCOL is installed.
|
||||||
|
This Device Handle uniquely defines the device that
|
||||||
|
the added packages are associated with.
|
||||||
|
@param[in] ... The variable argument list that contains pointers
|
||||||
|
to packages terminated by a NULL.
|
||||||
|
|
||||||
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
@retval NULL A HII Handle has already been registered in the HII Database with
|
||||||
|
the same PackageListGuid.
|
||||||
Marker = MarkerBackup;
|
@retval NULL The HII Handle could not be created.
|
||||||
//
|
@retval NULL An empty list of packages was passed in.
|
||||||
// Prepare the final package list.
|
@retval NULL All packages are empty.
|
||||||
//
|
@retval Other The HII Handle associated with the newly registered package list.
|
||||||
for (Index = 0; Index < NumberOfPackages; Index++) {
|
|
||||||
PackageArray = (UINT8 *) VA_ARG (Marker, VOID *);
|
|
||||||
//
|
|
||||||
// CopyMem is used for UINT32 to cover the unaligned address access.
|
|
||||||
//
|
|
||||||
CopyMem (&PackageLength, PackageArray, sizeof (UINT32));
|
|
||||||
PackageLength -= sizeof (UINT32);
|
|
||||||
PackageArray += sizeof (UINT32);
|
|
||||||
CopyMem (PackageListData, PackageArray, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
|
|
||||||
|
|
||||||
If GuidId is NULL, then ASSERT.
|
|
||||||
If not enough resource to complete the operation, then ASSERT.
|
|
||||||
|
|
||||||
@param NumberOfPackages Number of packages.
|
|
||||||
@param GuidId Package GUID.
|
|
||||||
@param ... Variable argument list for packages to be assembled.
|
|
||||||
|
|
||||||
@return Pointer of EFI_HII_PACKAGE_LIST_HEADER.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *
|
EFI_HII_HANDLE
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibPreparePackageList (
|
HiiAddPackages (
|
||||||
IN UINTN NumberOfPackages,
|
IN CONST EFI_GUID *PackageListGuid,
|
||||||
IN CONST EFI_GUID *GuidId,
|
IN EFI_HANDLE DeviceHandle OPTIONAL,
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
EFI_STATUS Status;
|
||||||
VA_LIST Marker;
|
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||||
|
VA_LIST Args;
|
||||||
|
UINT32 *Package;
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
||||||
|
EFI_HII_HANDLE HiiHandle;
|
||||||
|
UINT32 Length;
|
||||||
|
UINT8 *Data;
|
||||||
|
|
||||||
ASSERT (GuidId != NULL);
|
ASSERT (PackageListGuid != NULL);
|
||||||
|
|
||||||
VA_START (Marker, GuidId);
|
//
|
||||||
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Marker);
|
// Check to see if an HII Handle has already been registered with the same
|
||||||
VA_END (Marker);
|
// PackageListGuid
|
||||||
|
//
|
||||||
return PackageListHeader;
|
HiiHandleBuffer = HiiGetHiiHandles (PackageListGuid);
|
||||||
}
|
if (HiiHandleBuffer != NULL) {
|
||||||
|
FreePool (HiiHandleBuffer);
|
||||||
|
return NULL;
|
||||||
/**
|
|
||||||
This function allocates pool for an EFI_HII_PACKAGE_LIST structure
|
|
||||||
with additional space that is big enough to host all packages described by the variable
|
|
||||||
argument list of package pointers. The allocated structure is initialized using NumberOfPackages,
|
|
||||||
GuidId, and the variable length argument list of package pointers.
|
|
||||||
|
|
||||||
Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The
|
|
||||||
Handle to the newly registered Package List is returned through HiiHandle.
|
|
||||||
|
|
||||||
If HiiHandle is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param NumberOfPackages The number of HII packages to register.
|
|
||||||
@param GuidId Package List GUID ID.
|
|
||||||
@param DriverHandle Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.
|
|
||||||
This DriverHandle uniquely defines the device that the added packages are associated with.
|
|
||||||
@param HiiHandle On output, the HiiHandle is update with the handle which can be used to retrieve the Package
|
|
||||||
List later. If the functions failed to add the package to the default HII database, this value will
|
|
||||||
be set to NULL.
|
|
||||||
@param ... The variable argument list describing all HII Package.
|
|
||||||
|
|
||||||
@return EFI_SUCCESS If the packages are successfully added to the default HII database.
|
|
||||||
@return EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibAddPackages (
|
|
||||||
IN UINTN NumberOfPackages,
|
|
||||||
IN CONST EFI_GUID *GuidId,
|
|
||||||
IN EFI_HANDLE DriverHandle, OPTIONAL
|
|
||||||
OUT EFI_HII_HANDLE *HiiHandle,
|
|
||||||
...
|
|
||||||
)
|
|
||||||
{
|
|
||||||
VA_LIST Args;
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
ASSERT (HiiHandle != NULL);
|
|
||||||
|
|
||||||
VA_START (Args, HiiHandle);
|
|
||||||
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);
|
|
||||||
|
|
||||||
Status = gHiiDatabase->NewPackageList (gHiiDatabase, PackageListHeader, DriverHandle, HiiHandle);
|
|
||||||
if (HiiHandle != NULL) {
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
*HiiHandle = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (PackageListHeader);
|
//
|
||||||
|
// Calculate the length of all the packages in the variable argument list
|
||||||
|
//
|
||||||
|
for (Length = 0, VA_START (Args, DeviceHandle); (Package = VA_ARG (Args, UINT32 *)) != NULL; ) {
|
||||||
|
Length += (ReadUnaligned32 (Package) - sizeof (UINT32));
|
||||||
|
}
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
|
|
||||||
return Status;
|
//
|
||||||
|
// If there are no packages in the variable argument list or all the packages
|
||||||
|
// are empty, then return a NULL HII Handle
|
||||||
|
//
|
||||||
|
if (Length == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add the length of the Package List Header and the terminating Package Header
|
||||||
|
//
|
||||||
|
Length += sizeof (EFI_HII_PACKAGE_LIST_HEADER) + sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate the storage for the entire Package List
|
||||||
|
//
|
||||||
|
PackageListHeader = AllocateZeroPool (Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// If the Packahge List can not be allocated, then return a NULL HII Handle
|
||||||
|
//
|
||||||
|
if (PackageListHeader == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fill in the GUID and Length of the Package List Header
|
||||||
|
//
|
||||||
|
CopyGuid (&PackageListHeader->PackageListGuid, PackageListGuid);
|
||||||
|
PackageListHeader->PackageLength = Length;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize a pointer to the beginning if the Package List data
|
||||||
|
//
|
||||||
|
Data = (UINT8 *)(PackageListHeader + 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy the data from each package in the variable argument list
|
||||||
|
//
|
||||||
|
for (VA_START (Args, DeviceHandle); (Package = VA_ARG (Args, UINT32 *)) != NULL; ) {
|
||||||
|
Length = ReadUnaligned32 (Package) - sizeof (UINT32);
|
||||||
|
CopyMem (Data, Package + 1, Length);
|
||||||
|
Data += Length;
|
||||||
|
}
|
||||||
|
VA_END (Args);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Append a package of type EFI_HII_PACKAGE_END to mark the end of the package list
|
||||||
|
//
|
||||||
|
CopyMem (Data, &mEndOfPakageList, sizeof (mEndOfPakageList));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register the package list with the HII Database
|
||||||
|
//
|
||||||
|
Status = gHiiDatabase->NewPackageList (
|
||||||
|
gHiiDatabase,
|
||||||
|
PackageListHeader,
|
||||||
|
DeviceHandle,
|
||||||
|
&HiiHandle
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
HiiHandle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free the allocated package list
|
||||||
|
//
|
||||||
|
FreePool (PackageListHeader);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the new HII Handle
|
||||||
|
//
|
||||||
|
return HiiHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Removes a package list from the default HII database.
|
Removes a package list from the HII database.
|
||||||
|
|
||||||
If HiiHandle is NULL, then ASSERT.
|
If HiiHandle is NULL, then ASSERT.
|
||||||
If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.
|
If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT.
|
||||||
|
|
||||||
@param HiiHandle The handle that was previously registered to the data base that is requested for removal.
|
@param[in] HiiHandle The handle that was previously registered in the HII database
|
||||||
List later.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibRemovePackages (
|
HiiRemovePackages (
|
||||||
IN EFI_HII_HANDLE HiiHandle
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
ASSERT (IsHiiHandleRegistered (HiiHandle));
|
|
||||||
|
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
Status = gHiiDatabase->RemovePackageList (gHiiDatabase, HiiHandle);
|
Status = gHiiDatabase->RemovePackageList (gHiiDatabase, HiiHandle);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Determines the handles that are currently active in the database.
|
Retrieves the array of all the HII Handles or the HII handle of a specific
|
||||||
It's the caller's responsibility to free handle buffer.
|
package list in the HII Database.
|
||||||
|
This array is terminated with a NULL HII Handle.
|
||||||
|
This function allocates the returned array using AllocatePool().
|
||||||
|
The caller is responsible for freeing the array with FreePool().
|
||||||
|
|
||||||
If HandleBufferLength is NULL, then ASSERT.
|
@param[in] PackageListGuid An optional parameter that is used to request
|
||||||
If HiiHandleBuffer is NULL, then ASSERT.
|
an HII Handle that is associatd with a specific
|
||||||
|
Package List GUID. If this parameter is NULL
|
||||||
|
then all the HII Handles in the HII Database
|
||||||
|
are returned. If this parameter is not NULL
|
||||||
|
then at most 1 HII Handle is returned.
|
||||||
|
|
||||||
@param HandleBufferLength On input, a pointer to the length of the handle
|
@retval NULL No HII handles were found in the HII database
|
||||||
buffer. On output, the length of the handle buffer
|
@retval NULL The array of HII Handles could not be retrieved
|
||||||
that is required for the handles found.
|
@retval Other A pointer to the NULL terminated array of HII Handles
|
||||||
@param HiiHandleBuffer Pointer to an array of Hii Handles returned.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Get an array of Hii Handles successfully.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_HII_HANDLE *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetHiiHandles (
|
HiiGetHiiHandles (
|
||||||
IN OUT UINTN *HandleBufferLength,
|
IN CONST EFI_GUID *PackageListGuid OPTIONAL
|
||||||
OUT EFI_HII_HANDLE **HiiHandleBuffer
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
UINTN HandleBufferLength;
|
||||||
ASSERT (HandleBufferLength != NULL);
|
EFI_HII_HANDLE TempHiiHandleBuffer;
|
||||||
ASSERT (HiiHandleBuffer != NULL);
|
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||||
|
EFI_GUID Guid;
|
||||||
*HandleBufferLength = 0;
|
UINTN Index;
|
||||||
*HiiHandleBuffer = NULL;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to find the actual buffer size for HiiHandle Buffer.
|
// Retrieve the size required for the buffer of all HII handles.
|
||||||
//
|
//
|
||||||
|
HandleBufferLength = 0;
|
||||||
Status = gHiiDatabase->ListPackageLists (
|
Status = gHiiDatabase->ListPackageLists (
|
||||||
gHiiDatabase,
|
gHiiDatabase,
|
||||||
EFI_HII_PACKAGE_TYPE_ALL,
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
NULL,
|
NULL,
|
||||||
HandleBufferLength,
|
&HandleBufferLength,
|
||||||
*HiiHandleBuffer
|
&TempHiiHandleBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
*HiiHandleBuffer = AllocateZeroPool (*HandleBufferLength);
|
|
||||||
ASSERT (*HiiHandleBuffer != NULL);
|
|
||||||
Status = gHiiDatabase->ListPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
EFI_HII_PACKAGE_TYPE_ALL,
|
|
||||||
NULL,
|
|
||||||
HandleBufferLength,
|
|
||||||
*HiiHandleBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
//
|
||||||
FreePool (*HiiHandleBuffer);
|
// If ListPackageLists() returns EFI_SUCCESS for a zero size,
|
||||||
*HiiHandleBuffer = NULL;
|
// then there are no HII handles in the HII database. If ListPackageLists()
|
||||||
}
|
// returns an error other than EFI_BUFFER_TOO_SMALL, then there are no HII
|
||||||
|
// handles in the HII database.
|
||||||
|
//
|
||||||
|
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||||
|
//
|
||||||
|
// Return NULL if the size can not be retrieved, or if there are no HII
|
||||||
|
// handles in the HII Database
|
||||||
|
//
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
//
|
||||||
|
// Allocate the array of HII handles to hold all the HII Handles and a NULL terminator
|
||||||
|
//
|
||||||
|
HiiHandleBuffer = AllocateZeroPool (HandleBufferLength + sizeof (EFI_HII_HANDLE));
|
||||||
|
if (HiiHandleBuffer == NULL) {
|
||||||
|
//
|
||||||
|
// Return NULL if allocation fails.
|
||||||
|
//
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve the array of HII Handles in the HII Database
|
||||||
|
//
|
||||||
|
Status = gHiiDatabase->ListPackageLists (
|
||||||
|
gHiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&HandleBufferLength,
|
||||||
|
HiiHandleBuffer
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Free the buffer and return NULL if the HII handles can not be retrieved.
|
||||||
|
//
|
||||||
|
FreePool (HiiHandleBuffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PackageListGuid == NULL) {
|
||||||
|
//
|
||||||
|
// Return the NULL terminated array of HII handles in the HII Database
|
||||||
|
//
|
||||||
|
return HiiHandleBuffer;
|
||||||
|
} else {
|
||||||
|
for (Index = 0; HiiHandleBuffer[Index] != NULL; Index++) {
|
||||||
|
Status = InternalHiiExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
if (CompareGuid (&Guid, PackageListGuid)) {
|
||||||
|
HiiHandleBuffer[0] = HiiHandleBuffer[Index];
|
||||||
|
HiiHandleBuffer[1] = NULL;
|
||||||
|
return HiiHandleBuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FreePool (HiiHandleBuffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract Hii package list GUID for given HII handle.
|
Extract Hii package list GUID for given HII handle.
|
||||||
|
|
||||||
If HiiHandle could not be found in the default HII database, then ASSERT.
|
If HiiHandle could not be found in the HII database, then ASSERT.
|
||||||
If Guid is NULL, then ASSERT.
|
If Guid is NULL, then ASSERT.
|
||||||
|
|
||||||
@param Handle Hii handle
|
@param Handle Hii handle
|
||||||
@ -307,7 +319,7 @@ HiiLibGetHiiHandles (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibExtractGuidFromHiiHandle (
|
InternalHiiExtractGuidFromHiiHandle (
|
||||||
IN EFI_HII_HANDLE Handle,
|
IN EFI_HII_HANDLE Handle,
|
||||||
OUT EFI_GUID *Guid
|
OUT EFI_GUID *Guid
|
||||||
)
|
)
|
||||||
@ -317,7 +329,7 @@ HiiLibExtractGuidFromHiiHandle (
|
|||||||
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
||||||
|
|
||||||
ASSERT (Guid != NULL);
|
ASSERT (Guid != NULL);
|
||||||
ASSERT (IsHiiHandleRegistered (Handle));
|
ASSERT (Handle != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get HII PackageList
|
// Get HII PackageList
|
||||||
@ -349,326 +361,6 @@ HiiLibExtractGuidFromHiiHandle (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Find HII Handle in the default HII database associated with given Device Path.
|
|
||||||
|
|
||||||
If DevicePath is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param DevicePath Device Path associated with the HII package list
|
|
||||||
handle.
|
|
||||||
|
|
||||||
@retval Handle HII package list Handle associated with the Device
|
|
||||||
Path.
|
|
||||||
@retval NULL Hii Package list handle is not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_HII_HANDLE
|
|
||||||
EFIAPI
|
|
||||||
HiiLibDevicePathToHiiHandle (
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
|
|
||||||
UINTN BufferSize;
|
|
||||||
UINTN HandleCount;
|
|
||||||
UINTN Index;
|
|
||||||
EFI_HANDLE *Handles;
|
|
||||||
EFI_HANDLE Handle;
|
|
||||||
UINTN Size;
|
|
||||||
EFI_HANDLE DriverHandle;
|
|
||||||
EFI_HII_HANDLE *HiiHandles;
|
|
||||||
EFI_HII_HANDLE HiiHandle;
|
|
||||||
|
|
||||||
ASSERT (DevicePath != NULL);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate Device Path Protocol handle buffer
|
|
||||||
//
|
|
||||||
Status = gBS->LocateHandleBuffer (
|
|
||||||
ByProtocol,
|
|
||||||
&gEfiDevicePathProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
&HandleCount,
|
|
||||||
&Handles
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Search Driver Handle by Device Path
|
|
||||||
//
|
|
||||||
DriverHandle = NULL;
|
|
||||||
BufferSize = GetDevicePathSize (DevicePath);
|
|
||||||
for(Index = 0; Index < HandleCount; Index++) {
|
|
||||||
Handle = Handles[Index];
|
|
||||||
gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **) &TmpDevicePath);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check whether DevicePath match
|
|
||||||
//
|
|
||||||
Size = GetDevicePathSize (TmpDevicePath);
|
|
||||||
if ((Size == BufferSize) && CompareMem (DevicePath, TmpDevicePath, Size) == 0) {
|
|
||||||
DriverHandle = Handle;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FreePool (Handles);
|
|
||||||
|
|
||||||
if (DriverHandle == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve all Hii Handles from HII database
|
|
||||||
//
|
|
||||||
BufferSize = 0x1000;
|
|
||||||
HiiHandles = AllocatePool (BufferSize);
|
|
||||||
ASSERT (HiiHandles != NULL);
|
|
||||||
Status = gHiiDatabase->ListPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
EFI_HII_PACKAGE_TYPE_ALL,
|
|
||||||
NULL,
|
|
||||||
&BufferSize,
|
|
||||||
HiiHandles
|
|
||||||
);
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
FreePool (HiiHandles);
|
|
||||||
HiiHandles = AllocatePool (BufferSize);
|
|
||||||
ASSERT (HiiHandles != NULL);
|
|
||||||
|
|
||||||
Status = gHiiDatabase->ListPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
EFI_HII_PACKAGE_TYPE_ALL,
|
|
||||||
NULL,
|
|
||||||
&BufferSize,
|
|
||||||
HiiHandles
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (HiiHandles);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Search Hii Handle by Driver Handle
|
|
||||||
//
|
|
||||||
HiiHandle = NULL;
|
|
||||||
HandleCount = BufferSize / sizeof (EFI_HII_HANDLE);
|
|
||||||
for (Index = 0; Index < HandleCount; Index++) {
|
|
||||||
Status = gHiiDatabase->GetPackageListHandle (
|
|
||||||
gHiiDatabase,
|
|
||||||
HiiHandles[Index],
|
|
||||||
&Handle
|
|
||||||
);
|
|
||||||
if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {
|
|
||||||
HiiHandle = HiiHandles[Index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (HiiHandles);
|
|
||||||
return HiiHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Exports the contents of one or all package lists in the HII database into a buffer.
|
|
||||||
|
|
||||||
If Handle is not NULL and not a valid EFI_HII_HANDLE registered in the database,
|
|
||||||
then ASSERT.
|
|
||||||
If PackageListHeader is NULL, then ASSERT.
|
|
||||||
If PackageListSize is NULL, then ASSERT.
|
|
||||||
|
|
||||||
@param Handle The HII Handle.
|
|
||||||
@param PackageListHeader A pointer to a buffer that will contain the results of
|
|
||||||
the export function.
|
|
||||||
@param PackageListSize On output, the length of the buffer that is required for the exported data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Package exported.
|
|
||||||
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enought memory to complete the operations.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibExportPackageLists (
|
|
||||||
IN EFI_HII_HANDLE Handle,
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (Handle != NULL) {
|
|
||||||
ASSERT (IsHiiHandleRegistered (Handle));
|
|
||||||
}
|
|
||||||
|
|
||||||
Size = 0;
|
|
||||||
PackageListHdr = NULL;
|
|
||||||
Status = gHiiDatabase->ExportPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
Handle,
|
|
||||||
&Size,
|
|
||||||
PackageListHdr
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status != EFI_BUFFER_TOO_SMALL);
|
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
PackageListHdr = AllocateZeroPool (Size);
|
|
||||||
|
|
||||||
if (PackageListHeader == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
} else {
|
|
||||||
Status = gHiiDatabase->ExportPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
Handle,
|
|
||||||
&Size,
|
|
||||||
PackageListHdr
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
*PackageListHeader = PackageListHdr;
|
|
||||||
*PackageListSize = Size;
|
|
||||||
} else {
|
|
||||||
FreePool (PackageListHdr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
This function returns a list of the package handles of the
|
|
||||||
specified type that are currently active in the HII database. The
|
|
||||||
pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
|
|
||||||
handles to be listed.
|
|
||||||
|
|
||||||
If HandleBufferLength is NULL, then ASSERT.
|
|
||||||
If HandleBuffer is NULL, the ASSERT.
|
|
||||||
If PackageType is EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is
|
|
||||||
NULL, then ASSERT.
|
|
||||||
If PackageType is not EFI_HII_PACKAGE_TYPE_GUID and PackageGuid is not
|
|
||||||
NULL, then ASSERT.
|
|
||||||
|
|
||||||
|
|
||||||
@param PackageType Specifies the package type of the packages
|
|
||||||
to list or EFI_HII_PACKAGE_TYPE_ALL for
|
|
||||||
all packages to be listed.
|
|
||||||
|
|
||||||
@param PackageGuid If PackageType is
|
|
||||||
EFI_HII_PACKAGE_TYPE_GUID, then this is
|
|
||||||
the pointer to the GUID which must match
|
|
||||||
the Guid field of
|
|
||||||
EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
|
|
||||||
must be NULL.
|
|
||||||
|
|
||||||
@param HandleBufferLength On output, the length of the handle buffer
|
|
||||||
that is required for the handles found.
|
|
||||||
|
|
||||||
@param HandleBuffer On output, an array of EFI_HII_HANDLE instances returned.
|
|
||||||
The caller is responcible to free this pointer allocated.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The matching handles are outputed successfully.
|
|
||||||
HandleBufferLength is updated with the actual length.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enough resource to complete the operation.
|
|
||||||
@retval EFI_NOT_FOUND No matching handle could not be found in database.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibListPackageLists (
|
|
||||||
IN UINT8 PackageType,
|
|
||||||
IN CONST EFI_GUID *PackageGuid,
|
|
||||||
IN OUT UINTN *HandleBufferLength,
|
|
||||||
OUT EFI_HII_HANDLE **HandleBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
ASSERT (HandleBufferLength != NULL);
|
|
||||||
ASSERT (HandleBuffer != NULL);
|
|
||||||
|
|
||||||
*HandleBufferLength = 0;
|
|
||||||
*HandleBuffer = NULL;
|
|
||||||
|
|
||||||
if (PackageType == EFI_HII_PACKAGE_TYPE_GUID) {
|
|
||||||
ASSERT (PackageGuid != NULL);
|
|
||||||
} else {
|
|
||||||
ASSERT (PackageGuid == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gHiiDatabase->ListPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
PackageType,
|
|
||||||
PackageGuid,
|
|
||||||
HandleBufferLength,
|
|
||||||
*HandleBuffer
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
|
||||||
//
|
|
||||||
// No packages is registered to UEFI HII Database, just return.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
*HandleBuffer = AllocateZeroPool (*HandleBufferLength);
|
|
||||||
|
|
||||||
if (*HandleBuffer == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gHiiDatabase->ListPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
PackageType,
|
|
||||||
PackageGuid,
|
|
||||||
HandleBufferLength,
|
|
||||||
*HandleBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
This function check if the Hii Handle is a valid handle registered
|
|
||||||
in the HII database.
|
|
||||||
|
|
||||||
@param HiiHandle The HII Handle.
|
|
||||||
|
|
||||||
@retval TRUE If it is a valid HII handle.
|
|
||||||
@retval FALSE If it is a invalid HII handle.
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
IsHiiHandleRegistered (
|
|
||||||
EFI_HII_HANDLE HiiHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN BufferSize;
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
|
||||||
|
|
||||||
ASSERT (HiiHandle != NULL);
|
|
||||||
|
|
||||||
HiiPackageList = NULL;
|
|
||||||
BufferSize = 0;
|
|
||||||
|
|
||||||
Status = gHiiDatabase->ExportPackageLists (
|
|
||||||
gHiiDatabase,
|
|
||||||
HiiHandle,
|
|
||||||
&BufferSize,
|
|
||||||
HiiPackageList
|
|
||||||
);
|
|
||||||
|
|
||||||
return (BOOLEAN) (Status == EFI_BUFFER_TOO_SMALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts all hex dtring characters in range ['A'..'F'] to ['a'..'f'] for
|
Converts all hex dtring characters in range ['A'..'F'] to ['a'..'f'] for
|
||||||
hex digits that appear between a '=' and a '&' in a config string.
|
hex digits that appear between a '=' and a '&' in a config string.
|
||||||
@ -2916,3 +2608,4 @@ HiiIfrLibExtractDefault(
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,339 +163,340 @@ zulzu\
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function adds the string into String Package of each language
|
This function create a new string in String Package or updates an existing
|
||||||
supported by the package list.
|
string in a String Package. If StringId is 0, then a new string is added to
|
||||||
|
a String Package. If StringId is not zero, then a string in String Package is
|
||||||
|
updated. If SupportedLanguages is NULL, then the string is added or updated
|
||||||
|
for all the languages that the String Package supports. If SupportedLanguages
|
||||||
|
is not NULL, then the string is added or updated for the set of languages
|
||||||
|
specified by SupportedLanguages.
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
If String is NULL, then ASSERT().
|
||||||
|
|
||||||
If String is NULL, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the
|
||||||
If StringId is NULL, the ASSERT.
|
HII Database.
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
@param[in] StringId If zero, then a new string is created in the
|
||||||
|
String Package associated with HiiHandle. If
|
||||||
|
non-zero, then the string specified by StringId
|
||||||
|
is updated in the String Package associated
|
||||||
|
with HiiHandle.
|
||||||
|
@param[in] String A pointer to the Null-terminated Unicode string
|
||||||
|
to add or update in the String Package associated
|
||||||
|
with HiiHandle.
|
||||||
|
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of
|
||||||
|
language codes. If this parameter is NULL, then
|
||||||
|
String is added or updated in the String Package
|
||||||
|
associated with HiiHandle for all the languages
|
||||||
|
that the String Package supports. If this
|
||||||
|
parameter is not NULL, then then String is added
|
||||||
|
or updated in the String Package associated with
|
||||||
|
HiiHandle for the set oflanguages specified by
|
||||||
|
SupportedLanguages. The format of
|
||||||
|
SupportedLanguages must follow the language
|
||||||
|
format assumed the HII Database.
|
||||||
|
|
||||||
@param PackageList Handle of the package list where this string will
|
@retval 0 The string could not be added or updated in the String Package.
|
||||||
be added.
|
@retval Other The EFI_STRING_ID of the newly added or updated string.
|
||||||
@param StringId On return, contains the new strings id, which is
|
|
||||||
unique within PackageList.
|
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The new string was added successfully.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING_ID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibNewString (
|
HiiSetString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
OUT EFI_STRING_ID *StringId,
|
IN EFI_STRING_ID StringId, OPTIONAL
|
||||||
IN CONST EFI_STRING String
|
IN CONST EFI_STRING String,
|
||||||
|
IN CONST CHAR8 *SupportedLanguages OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR8 *Languages;
|
CHAR8 *AllocatedLanguages;
|
||||||
CHAR8 *LangStrings;
|
CHAR8 *Supported;
|
||||||
CHAR8 *Lang;
|
CHAR8 *Language;
|
||||||
|
EFI_STRING_ID NewStringId;
|
||||||
|
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
ASSERT (String != NULL);
|
ASSERT (String != NULL);
|
||||||
ASSERT (StringId != NULL);
|
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
if (SupportedLanguages == NULL) {
|
||||||
|
//
|
||||||
|
// Retrieve the languages that the package specified by HiiHandle supports
|
||||||
|
//
|
||||||
|
AllocatedLanguages = HiiGetSupportedLanguages (HiiHandle);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Allocate a copy of the SupportLanguages string that passed in
|
||||||
|
//
|
||||||
|
AllocatedLanguages = AllocateCopyPool (AsciiStrLen (SupportedLanguages), SupportedLanguages);
|
||||||
|
}
|
||||||
|
|
||||||
Languages = HiiLibGetSupportedLanguages (PackageList);
|
|
||||||
ASSERT (Languages != NULL);
|
|
||||||
//
|
//
|
||||||
// Allocate working buffer to contain substring of Languages.
|
// If there are not enough resources for the supported languages string, then return a StringId of 0
|
||||||
//
|
//
|
||||||
Lang = AllocatePool (AsciiStrSize (Languages));
|
if (AllocatedLanguages == NULL) {
|
||||||
ASSERT (Lang != NULL);
|
return (EFI_STRING_ID)(0);
|
||||||
|
}
|
||||||
|
|
||||||
LangStrings = Languages;
|
NewStringId = 0;
|
||||||
while (*LangStrings != 0) {
|
Status = EFI_INVALID_PARAMETER;
|
||||||
HiiLibGetNextLanguage (&LangStrings, Lang);
|
//
|
||||||
|
// Loop through each language that the string supports
|
||||||
|
//
|
||||||
|
for (Supported = AllocatedLanguages; *Supported != '\0'; ) {
|
||||||
|
//
|
||||||
|
// Cache a pointer to the beginning of the current language in the list of languages
|
||||||
|
//
|
||||||
|
Language = Supported;
|
||||||
|
|
||||||
//
|
//
|
||||||
// For each language supported by the package,
|
// Search for the next language seperator and replace it with a Null-terminator
|
||||||
// a string token is created.
|
//
|
||||||
|
for (; *Supported != 0 && *Supported != ';'; Supported++);
|
||||||
|
if (*Supported != 0) {
|
||||||
|
*(Supported++) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If StringId is 0, then call NewString(). Otherwise, call SetString()
|
||||||
|
//
|
||||||
|
if (StringId == (EFI_STRING_ID)(0)) {
|
||||||
|
Status = gHiiString->NewString (gHiiString, HiiHandle, &NewStringId, Language, NULL, String, NULL);
|
||||||
|
} else {
|
||||||
|
Status = gHiiString->SetString (gHiiString, HiiHandle, StringId, Language, String, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If there was an error, then break out of the loop and return a StringId of 0
|
||||||
//
|
//
|
||||||
Status = gHiiString->NewString (
|
|
||||||
gHiiString,
|
|
||||||
PackageList,
|
|
||||||
StringId,
|
|
||||||
Lang,
|
|
||||||
NULL,
|
|
||||||
String,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Lang);
|
//
|
||||||
FreePool (Languages);
|
// Free the buffer of supported languages
|
||||||
|
//
|
||||||
|
FreePool (AllocatedLanguages);
|
||||||
|
|
||||||
return Status;
|
if (EFI_ERROR (Status)) {
|
||||||
|
return (EFI_STRING_ID)(0);
|
||||||
|
} else if (StringId == (EFI_STRING_ID)(0)) {
|
||||||
|
return NewStringId;
|
||||||
|
} else {
|
||||||
|
return StringId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a string from a string package names by GUID in a specific language.
|
||||||
|
If the language is not specified, then a string from a string package in the
|
||||||
|
current platform language is retrieved. If the string can not be retrieved
|
||||||
|
using the specified language or the current platform language, then the string
|
||||||
|
is retrieved from the string package in the first language the string package
|
||||||
|
supports. The returned string is allocated using AllocatePool(). The caller
|
||||||
|
is responsible for freeing the allocated buffer using FreePool().
|
||||||
|
|
||||||
}
|
If PackageListGuid is NULL, then ASSERT().
|
||||||
|
If StringId is 0, then ASSERT.
|
||||||
|
|
||||||
|
@param[in] PackageListGuid The GUID of a package list that was previously
|
||||||
|
registered in the HII Database.
|
||||||
|
@param[in] StringId The identifier of the string to retrieved from the
|
||||||
|
string package associated with PackageListGuid.
|
||||||
|
@param[in] Language The language of the string to retrieve. If this
|
||||||
|
parameter is NULL, then the current platform
|
||||||
|
language is used. The format of Language must
|
||||||
|
follow the language format assumed the HII Database.
|
||||||
|
|
||||||
/**
|
@retval NULL The package list specified by PackageListGuid is not present in the
|
||||||
This function update the specified string in String Package of each language
|
HII Database.
|
||||||
supported by the package list.
|
@retval NULL The string specified by StringId is not present in the string package.
|
||||||
|
@retval Other The string was returned.
|
||||||
If String is NULL, then ASSERT.
|
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
|
||||||
|
|
||||||
@param PackageList Handle of the package list where this string will
|
|
||||||
be added.
|
|
||||||
@param StringId Ths String Id to be updated.
|
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The new string was added successfully.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibSetString (
|
HiiGetPackageString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN CONST EFI_GUID *PackageListGuid,
|
||||||
IN EFI_STRING_ID StringId,
|
IN EFI_STRING_ID StringId,
|
||||||
IN CONST EFI_STRING String
|
IN CONST CHAR8 *Language OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_HANDLE *HiiHandleBuffer;
|
||||||
CHAR8 *Languages;
|
EFI_HANDLE HiiHandle;
|
||||||
CHAR8 *LangStrings;
|
|
||||||
CHAR8 *Lang;
|
|
||||||
|
|
||||||
ASSERT (IsHiiHandleRegistered (PackageList));
|
ASSERT (PackageListGuid != NULL);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
HiiHandleBuffer = HiiGetHiiHandles (PackageListGuid);
|
||||||
|
|
||||||
Languages = HiiLibGetSupportedLanguages (PackageList);
|
|
||||||
ASSERT (Languages != NULL);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate working buffer to contain substring of Languages.
|
|
||||||
//
|
|
||||||
Lang = AllocatePool (AsciiStrSize (Languages));
|
|
||||||
ASSERT (Lang != NULL);
|
|
||||||
|
|
||||||
LangStrings = Languages;
|
|
||||||
while (*LangStrings != 0) {
|
|
||||||
HiiLibGetNextLanguage (&LangStrings, Lang);
|
|
||||||
|
|
||||||
//
|
|
||||||
// For each language supported by the package,
|
|
||||||
// the string is updated.
|
|
||||||
//
|
|
||||||
Status = gHiiString->SetString (
|
|
||||||
gHiiString,
|
|
||||||
PackageList,
|
|
||||||
StringId,
|
|
||||||
Lang,
|
|
||||||
String,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (Lang);
|
|
||||||
FreePool (Languages);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the string given the StringId and String package Producer's Guid. The caller
|
|
||||||
is responsible to free the *String.
|
|
||||||
|
|
||||||
If PackageList with the matching ProducerGuid is not found, then ASSERT.
|
|
||||||
If PackageList with the matching ProducerGuid is found but no String is
|
|
||||||
specified by StringId is found, then ASSERT.
|
|
||||||
|
|
||||||
@param ProducerGuid The Guid of String package list.
|
|
||||||
@param StringId The String ID.
|
|
||||||
@param String The output string.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Operation is successful.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetStringFromToken (
|
|
||||||
IN EFI_GUID *ProducerGuid,
|
|
||||||
IN EFI_STRING_ID StringId,
|
|
||||||
OUT EFI_STRING *String
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN Index;
|
|
||||||
UINTN HandleBufferLen;
|
|
||||||
EFI_HII_HANDLE *HiiHandleBuffer;
|
|
||||||
EFI_GUID Guid;
|
|
||||||
|
|
||||||
Status = HiiLibGetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);
|
|
||||||
if (HiiHandleBuffer == NULL) {
|
if (HiiHandleBuffer == NULL) {
|
||||||
return EFI_NOT_FOUND;
|
return NULL;
|
||||||
}
|
|
||||||
for (Index = 0; Index < (HandleBufferLen / sizeof (EFI_HII_HANDLE)); Index++) {
|
|
||||||
Status = HiiLibExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
|
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
if (CompareGuid (&Guid, ProducerGuid)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index >= (HandleBufferLen / sizeof (EFI_HII_HANDLE))) {
|
HiiHandle = HiiHandleBuffer[0];
|
||||||
//
|
|
||||||
// If PackageList with the matching ProducerGuid is not found, then ASSERT.
|
|
||||||
//
|
|
||||||
ASSERT (FALSE);
|
|
||||||
Status = EFI_NOT_FOUND;
|
|
||||||
goto Out;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = HiiLibGetStringFromHandle (HiiHandleBuffer[Index], StringId, String);
|
|
||||||
|
|
||||||
Out:
|
|
||||||
FreePool (HiiHandleBuffer);
|
FreePool (HiiHandleBuffer);
|
||||||
|
|
||||||
return Status;
|
return HiiGetString (HiiHandle, StringId, Language);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function try to retrieve string from String package of current language.
|
Retrieves a string from a string package in a specific language. If the language
|
||||||
If fails, it try to retrieve string from String package of first language it support.
|
is not specified, then a string from a string package in the current platform
|
||||||
|
language is retrieved. If the string can not be retrieved using the specified
|
||||||
|
language or the current platform language, then the string is retrieved from
|
||||||
|
the string package in the first language the string package supports. The
|
||||||
|
returned string is allocated using AllocatePool(). The caller is responsible
|
||||||
|
for freeing the allocated buffer using FreePool().
|
||||||
|
|
||||||
|
If HiiHandle is NULL, then ASSERT().
|
||||||
|
If StringId is 0, then ASSET.
|
||||||
|
|
||||||
If StringSize is NULL, then ASSERT.
|
@param[in] HiiHandle A handle that was previously registered in the HII Database.
|
||||||
If String is NULL and *StringSize is not 0, then ASSERT.
|
@param[in] StringId The identifier of the string to retrieved from the string
|
||||||
If PackageList could not be found in the default HII database, then ASSERT.
|
package associated with HiiHandle.
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
@param[in] Language The language of the string to retrieve. If this parameter
|
||||||
|
is NULL, then the current platform language is used. The
|
||||||
|
format of Language must follow the language format assumed
|
||||||
|
the HII Database.
|
||||||
|
|
||||||
@param PackageList The package list in the HII database to search for
|
@retval NULL The string specified by StringId is not present in the string package.
|
||||||
the specified string.
|
@retval Other The string was returned.
|
||||||
@param StringId The string's id, which is unique within
|
|
||||||
PackageList.
|
|
||||||
@param String Points to the new null-terminated string.
|
|
||||||
@param StringSize On entry, points to the size of the buffer pointed
|
|
||||||
to by String, in bytes. On return, points to the
|
|
||||||
length of the string, in bytes.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The string was returned successfully.
|
|
||||||
@retval EFI_NOT_FOUND The string specified by StringId is not available.
|
|
||||||
@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringLength is too small
|
|
||||||
to hold the string.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STRING
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HiiLibGetString (
|
HiiGetString (
|
||||||
IN EFI_HII_HANDLE PackageList,
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
IN EFI_STRING_ID StringId,
|
IN EFI_STRING_ID StringId,
|
||||||
OUT EFI_STRING String,
|
IN CONST CHAR8 *Language OPTIONAL
|
||||||
IN OUT UINTN *StringSize
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR8 *Languages;
|
UINTN StringSize;
|
||||||
CHAR8 *CurrentLang;
|
CHAR16 TempString;
|
||||||
|
EFI_STRING String;
|
||||||
|
CHAR8 *SupportedLanguages;
|
||||||
|
CHAR8 *PlatformLanguage;
|
||||||
CHAR8 *BestLanguage;
|
CHAR8 *BestLanguage;
|
||||||
|
|
||||||
ASSERT (StringSize != NULL);
|
ASSERT (HiiHandle != NULL);
|
||||||
ASSERT (!(*StringSize != 0 && String == NULL));
|
ASSERT (StringId != 0);
|
||||||
ASSERT (IsHiiHandleRegistered (PackageList));
|
|
||||||
|
|
||||||
Languages = HiiLibGetSupportedLanguages (PackageList);
|
//
|
||||||
ASSERT (Languages != NULL);
|
// Initialize all allocated buffers to NULL
|
||||||
|
//
|
||||||
|
SupportedLanguages = NULL;
|
||||||
|
PlatformLanguage = NULL;
|
||||||
|
BestLanguage = NULL;
|
||||||
|
String = NULL;
|
||||||
|
|
||||||
CurrentLang = GetEfiGlobalVariable (L"PlatformLang");
|
//
|
||||||
|
// Get the languages that the package specified by HiiHandle supports
|
||||||
Status = EFI_NOT_FOUND;
|
//
|
||||||
|
SupportedLanguages = HiiGetSupportedLanguages (HiiHandle);
|
||||||
|
if (SupportedLanguages == NULL) {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the current platform language setting
|
||||||
|
//
|
||||||
|
PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
|
||||||
|
|
||||||
|
//
|
||||||
|
// If Languag is NULL, then set it to an empty string, so it will be
|
||||||
|
// skipped by GetBestLanguage()
|
||||||
|
//
|
||||||
|
if (Language == NULL) {
|
||||||
|
Language = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the best matching language from SupportedLanguages
|
||||||
|
//
|
||||||
BestLanguage = GetBestLanguage (
|
BestLanguage = GetBestLanguage (
|
||||||
Languages,
|
SupportedLanguages,
|
||||||
FALSE,
|
FALSE, // RFC 4646 mode
|
||||||
(CurrentLang != NULL) ? CurrentLang : "",
|
Language, // Highest priority
|
||||||
(CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang),
|
PlatformLanguage != NULL ? PlatformLanguage : "", // Next highest priority
|
||||||
Languages,
|
SupportedLanguages, // Lowest priority
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (BestLanguage != NULL ) {
|
if (BestLanguage == NULL) {
|
||||||
Status = gHiiString->GetString (
|
goto Error;
|
||||||
gHiiString,
|
|
||||||
BestLanguage,
|
|
||||||
PackageList,
|
|
||||||
StringId,
|
|
||||||
String,
|
|
||||||
StringSize,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
FreePool (BestLanguage);
|
|
||||||
}
|
}
|
||||||
if (CurrentLang != NULL) {
|
|
||||||
FreePool (CurrentLang);
|
|
||||||
}
|
|
||||||
FreePool (Languages);
|
|
||||||
|
|
||||||
return Status;
|
//
|
||||||
|
// Retrieve the size of the string in the string package for the BestLanguage
|
||||||
|
//
|
||||||
|
StringSize = 0;
|
||||||
|
Status = gHiiString->GetString (
|
||||||
|
gHiiString,
|
||||||
|
BestLanguage,
|
||||||
|
HiiHandle,
|
||||||
|
StringId,
|
||||||
|
&TempString,
|
||||||
|
&StringSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// If GetString() returns EFI_SUCCESS for a zero size,
|
||||||
|
// then there are no supported languages registered for HiiHandle. If GetString()
|
||||||
|
// returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present
|
||||||
|
// in the HII Database
|
||||||
|
//
|
||||||
|
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate a buffer for the return string
|
||||||
|
//
|
||||||
|
String = AllocateZeroPool (StringSize);
|
||||||
|
if (String == NULL) {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve the string from the string package
|
||||||
|
//
|
||||||
|
Status = gHiiString->GetString (
|
||||||
|
gHiiString,
|
||||||
|
BestLanguage,
|
||||||
|
HiiHandle,
|
||||||
|
StringId,
|
||||||
|
String,
|
||||||
|
&StringSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Free the buffer and return NULL if the supported languages can not be retrieved.
|
||||||
|
//
|
||||||
|
FreePool (String);
|
||||||
|
String = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Error:
|
||||||
|
//
|
||||||
|
// Free allocated buffers
|
||||||
|
//
|
||||||
|
if (SupportedLanguages != NULL) {
|
||||||
|
FreePool (SupportedLanguages);
|
||||||
|
}
|
||||||
|
if (PlatformLanguage != NULL) {
|
||||||
|
FreePool (PlatformLanguage);
|
||||||
|
}
|
||||||
|
if (BestLanguage != NULL) {
|
||||||
|
FreePool (BestLanguage);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the Null-terminated Unicode string
|
||||||
|
//
|
||||||
|
return String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get string specified by StringId form the HiiHandle. The caller
|
|
||||||
is responsible to free the *String.
|
|
||||||
|
|
||||||
If String is NULL, then ASSERT.
|
|
||||||
If HiiHandle could not be found in the default HII database, then ASSERT.
|
|
||||||
If StringId is not found in PackageList, then ASSERT.
|
|
||||||
|
|
||||||
@param HiiHandle The HII handle of package list.
|
|
||||||
@param StringId The String ID.
|
|
||||||
@param String The output string.
|
|
||||||
|
|
||||||
@retval EFI_NOT_FOUND String is not found.
|
|
||||||
@retval EFI_SUCCESS Operation is successful.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
HiiLibGetStringFromHandle (
|
|
||||||
IN EFI_HII_HANDLE HiiHandle,
|
|
||||||
IN EFI_STRING_ID StringId,
|
|
||||||
OUT EFI_STRING *String
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN StringSize;
|
|
||||||
|
|
||||||
ASSERT (String != NULL);
|
|
||||||
|
|
||||||
StringSize = HII_LIB_DEFAULT_STRING_SIZE;
|
|
||||||
*String = AllocateZeroPool (StringSize);
|
|
||||||
if (*String == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = HiiLibGetString (HiiHandle, StringId, *String, &StringSize);
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
FreePool (*String);
|
|
||||||
*String = AllocateZeroPool (StringSize);
|
|
||||||
if (*String == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
Status = HiiLibGetString (HiiHandle, StringId, *String, &StringSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert language code from RFC3066 to ISO639-2.
|
Convert language code from RFC3066 to ISO639-2.
|
||||||
|
|
||||||
|
@ -48,17 +48,23 @@ extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
|
|||||||
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
|
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function check if the Hii Handle is a valid handle registered
|
Extract Hii package list GUID for given HII handle.
|
||||||
in the HII database.
|
|
||||||
|
|
||||||
@param HiiHandle The HII Handle.
|
If HiiHandle could not be found in the HII database, then ASSERT.
|
||||||
|
If Guid is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param Handle Hii handle
|
||||||
|
@param Guid Package list GUID
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Successfully extract GUID from Hii database.
|
||||||
|
|
||||||
@retval TRUE If it is a valid HII handle.
|
|
||||||
@retval FALSE If it is a invalid HII handle.
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
EFI_STATUS
|
||||||
IsHiiHandleRegistered (
|
EFIAPI
|
||||||
EFI_HII_HANDLE HiiHandle
|
InternalHiiExtractGuidFromHiiHandle (
|
||||||
);
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT EFI_GUID *Guid
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1857,7 +1857,6 @@ RegisterFontPackage (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
|
EFI_HII_SIMPLE_FONT_PACKAGE_HDR *SimplifiedFont;
|
||||||
UINT32 PackageLength;
|
UINT32 PackageLength;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
UINT8 *Package;
|
UINT8 *Package;
|
||||||
UINT8 *Location;
|
UINT8 *Location;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
@ -1873,7 +1872,7 @@ RegisterFontPackage (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add 4 bytes to the header for entire length for HiiLibPreparePackageList use only.
|
// Add 4 bytes to the header for entire length for HiiAddPackages use only.
|
||||||
//
|
//
|
||||||
// +--------------------------------+ <-- Package
|
// +--------------------------------+ <-- Package
|
||||||
// | |
|
// | |
|
||||||
@ -1905,10 +1904,13 @@ RegisterFontPackage (
|
|||||||
//
|
//
|
||||||
// Add this simplified font package to a package list then install it.
|
// Add this simplified font package to a package list then install it.
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (1, &mFontPackageListGuid, Package);
|
mHiiHandle = HiiAddPackages (
|
||||||
Status = HiiDatabase->NewPackageList (HiiDatabase, PackageList, NULL, &mHiiHandle);
|
&mFontPackageListGuid,
|
||||||
ASSERT_EFI_ERROR (Status);
|
NULL,
|
||||||
FreePool (PackageList);
|
Package,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (mHiiHandle != NULL);
|
||||||
FreePool (Package);
|
FreePool (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,21 +170,21 @@ ValidatePassword (
|
|||||||
//
|
//
|
||||||
// Get user input password
|
// Get user input password
|
||||||
//
|
//
|
||||||
BufferSize = 21 * sizeof (CHAR16);
|
Password = HiiGetString (PrivateData->HiiHandle[0], StringId, NULL);
|
||||||
Password = AllocateZeroPool (BufferSize);
|
if (Password == NULL) {
|
||||||
ASSERT (Password != NULL);
|
return EFI_NOT_READY;
|
||||||
|
}
|
||||||
Status = HiiLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
|
if (StrLen (Password) > 20) {
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (Password);
|
FreePool (Password);
|
||||||
return Status;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate old password
|
// Validate old password
|
||||||
//
|
//
|
||||||
EncodedPassword = AllocateCopyPool (21 * sizeof (CHAR16), Password);
|
EncodedPassword = AllocateZeroPool (21 * sizeof (CHAR16));
|
||||||
ASSERT (EncodedPassword != NULL);
|
ASSERT (EncodedPassword != NULL);
|
||||||
|
StrnCpy (EncodedPassword, Password, 21);
|
||||||
EncodePassword (EncodedPassword, 20 * sizeof (CHAR16));
|
EncodePassword (EncodedPassword, 20 * sizeof (CHAR16));
|
||||||
if (CompareMem (EncodedPassword, PrivateData->Configuration.WhatIsThePassword2, 20 * sizeof (CHAR16)) != 0) {
|
if (CompareMem (EncodedPassword, PrivateData->Configuration.WhatIsThePassword2, 20 * sizeof (CHAR16)) != 0) {
|
||||||
//
|
//
|
||||||
@ -219,6 +219,7 @@ SetPassword (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR16 *Password;
|
CHAR16 *Password;
|
||||||
|
CHAR16 *TempPassword;
|
||||||
UINTN PasswordSize;
|
UINTN PasswordSize;
|
||||||
DRIVER_SAMPLE_CONFIGURATION *Configuration;
|
DRIVER_SAMPLE_CONFIGURATION *Configuration;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
@ -242,13 +243,19 @@ SetPassword (
|
|||||||
// Get user input password
|
// Get user input password
|
||||||
//
|
//
|
||||||
Password = &PrivateData->Configuration.WhatIsThePassword2[0];
|
Password = &PrivateData->Configuration.WhatIsThePassword2[0];
|
||||||
PasswordSize = sizeof (PrivateData->Configuration.WhatIsThePassword2);
|
PasswordSize = sizeof (PrivateData->Configuration.WhatIsThePassword2);
|
||||||
|
|
||||||
ZeroMem (Password, PasswordSize);
|
ZeroMem (Password, PasswordSize);
|
||||||
Status = HiiLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
|
|
||||||
if (EFI_ERROR (Status)) {
|
TempPassword = HiiGetString (PrivateData->HiiHandle[0], StringId, NULL);
|
||||||
return Status;
|
if (TempPassword == NULL) {
|
||||||
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
if (StrLen (TempPassword) > PasswordSize / sizeof (CHAR16)) {
|
||||||
|
FreePool (TempPassword);
|
||||||
|
return EFI_NOT_READY;
|
||||||
|
}
|
||||||
|
StrnCpy (Password, TempPassword, PasswordSize / sizeof (CHAR16));
|
||||||
|
FreePool (TempPassword);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrive uncommitted data from Browser
|
// Retrive uncommitted data from Browser
|
||||||
@ -786,7 +793,6 @@ DriverSampleInit (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STATUS SavedStatus;
|
EFI_STATUS SavedStatus;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
EFI_HII_HANDLE HiiHandle[2];
|
EFI_HII_HANDLE HiiHandle[2];
|
||||||
EFI_SCREEN_DESCRIPTOR Screen;
|
EFI_SCREEN_DESCRIPTOR Screen;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
@ -878,26 +884,17 @@ DriverSampleInit (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (
|
HiiHandle[0] = HiiAddPackages (
|
||||||
2,
|
&mFormSetGuid,
|
||||||
&mFormSetGuid,
|
DriverHandle[0],
|
||||||
DriverSampleStrings,
|
DriverSampleStrings,
|
||||||
VfrBin
|
VfrBin,
|
||||||
);
|
NULL
|
||||||
if (PackageList == NULL) {
|
);
|
||||||
|
if (HiiHandle[0] == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HiiDatabase->NewPackageList (
|
|
||||||
HiiDatabase,
|
|
||||||
PackageList,
|
|
||||||
DriverHandle[0],
|
|
||||||
&HiiHandle[0]
|
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
PrivateData->HiiHandle[0] = HiiHandle[0];
|
PrivateData->HiiHandle[0] = HiiHandle[0];
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -913,26 +910,17 @@ DriverSampleInit (
|
|||||||
|
|
||||||
PrivateData->DriverHandle[1] = DriverHandle[1];
|
PrivateData->DriverHandle[1] = DriverHandle[1];
|
||||||
|
|
||||||
PackageList = HiiLibPreparePackageList (
|
HiiHandle[1] = HiiAddPackages (
|
||||||
2,
|
&mInventoryGuid,
|
||||||
&mInventoryGuid,
|
DriverHandle[1],
|
||||||
DriverSampleStrings,
|
DriverSampleStrings,
|
||||||
InventoryBin
|
InventoryBin,
|
||||||
);
|
NULL
|
||||||
if (PackageList == NULL) {
|
);
|
||||||
|
if (HiiHandle[1] == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HiiDatabase->NewPackageList (
|
|
||||||
HiiDatabase,
|
|
||||||
PackageList,
|
|
||||||
DriverHandle[1],
|
|
||||||
&HiiHandle[1]
|
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
PrivateData->HiiHandle[1] = HiiHandle[1];
|
PrivateData->HiiHandle[1] = HiiHandle[1];
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -941,9 +929,8 @@ DriverSampleInit (
|
|||||||
//
|
//
|
||||||
NewString = L"700 Mhz";
|
NewString = L"700 Mhz";
|
||||||
|
|
||||||
Status = HiiLibSetString (HiiHandle[0], STRING_TOKEN (STR_CPU_STRING2), NewString);
|
if (HiiSetString (HiiHandle[0], STRING_TOKEN (STR_CPU_STRING2), NewString, NULL) == 0) {
|
||||||
if (EFI_ERROR (Status)) {
|
return EFI_OUT_OF_RESOURCES;
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,7 @@ Revision History
|
|||||||
|
|
||||||
#include <Guid/MdeModuleHii.h>
|
#include <Guid/MdeModuleHii.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
@ -53,7 +54,7 @@ extern UINT8 VfrMyIfrNVDataBlockName[];
|
|||||||
|
|
||||||
//
|
//
|
||||||
// This is the generated IFR binary data for each formset defined in VFR.
|
// This is the generated IFR binary data for each formset defined in VFR.
|
||||||
// This data array is ready to be used as input of HiiLibPreparePackageList() to
|
// This data array is ready to be used as input of HiiAddPackages() to
|
||||||
// create a packagelist (which contains Form packages, String packages, etc).
|
// create a packagelist (which contains Form packages, String packages, etc).
|
||||||
//
|
//
|
||||||
extern UINT8 VfrBin[];
|
extern UINT8 VfrBin[];
|
||||||
@ -61,7 +62,7 @@ extern UINT8 InventoryBin[];
|
|||||||
|
|
||||||
//
|
//
|
||||||
// This is the generated String package data for all .UNI files.
|
// This is the generated String package data for all .UNI files.
|
||||||
// This data array is ready to be used as input of HiiLibPreparePackageList() to
|
// This data array is ready to be used as input of HiiAddPackages() to
|
||||||
// create a packagelist (which contains Form packages, String packages, etc).
|
// create a packagelist (which contains Form packages, String packages, etc).
|
||||||
//
|
//
|
||||||
extern UINT8 DriverSampleStrings[];
|
extern UINT8 DriverSampleStrings[];
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
BaseLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
|
@ -715,7 +715,7 @@ IScsiFormCallback (
|
|||||||
|
|
||||||
UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
|
UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
|
||||||
DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;
|
DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;
|
||||||
HiiLibSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString);
|
HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);
|
||||||
|
|
||||||
IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);
|
IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);
|
||||||
|
|
||||||
@ -840,13 +840,13 @@ IScsiConfigUpdateForm (
|
|||||||
// Compose the Port string and create a new EFI_STRING_ID.
|
// Compose the Port string and create a new EFI_STRING_ID.
|
||||||
//
|
//
|
||||||
UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);
|
UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);
|
||||||
HiiLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleToken, PortString);
|
ConfigFormEntry->PortTitleToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compose the help string of this port and create a new EFI_STRING_ID.
|
// Compose the help string of this port and create a new EFI_STRING_ID.
|
||||||
//
|
//
|
||||||
UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);
|
UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);
|
||||||
HiiLibNewString (mCallbackInfo->RegisteredHandle, &ConfigFormEntry->PortTitleHelpToken, PortString);
|
ConfigFormEntry->PortTitleHelpToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
|
||||||
|
|
||||||
InsertTailList (&mIScsiConfigFormList, &ConfigFormEntry->Link);
|
InsertTailList (&mIScsiConfigFormList, &ConfigFormEntry->Link);
|
||||||
mNumberOfIScsiDevices++;
|
mNumberOfIScsiDevices++;
|
||||||
@ -931,7 +931,6 @@ IScsiConfigFormInit (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
ISCSI_FORM_CALLBACK_INFO *CallbackInfo;
|
ISCSI_FORM_CALLBACK_INFO *CallbackInfo;
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&HiiDatabase);
|
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&HiiDatabase);
|
||||||
@ -974,19 +973,16 @@ IScsiConfigFormInit (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (2, &mVendorGuid, IScsiDxeStrings, IScsiConfigDxeBin);
|
CallbackInfo->RegisteredHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&mVendorGuid,
|
||||||
|
CallbackInfo->DriverHandle,
|
||||||
Status = HiiDatabase->NewPackageList (
|
IScsiDxeStrings,
|
||||||
HiiDatabase,
|
IScsiConfigDxeBin,
|
||||||
PackageList,
|
NULL
|
||||||
CallbackInfo->DriverHandle,
|
);
|
||||||
&CallbackInfo->RegisteredHandle
|
if (CallbackInfo->RegisteredHandle == NULL) {
|
||||||
);
|
|
||||||
FreePool (PackageList);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool(CallbackInfo);
|
FreePool(CallbackInfo);
|
||||||
return Status;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallbackInfo = CallbackInfo;
|
mCallbackInfo = CallbackInfo;
|
||||||
|
@ -108,17 +108,15 @@ UpdateCheckBoxStringToken (
|
|||||||
{
|
{
|
||||||
CHAR16 Str[MAXIMUM_VALUE_CHARACTERS];
|
CHAR16 Str[MAXIMUM_VALUE_CHARACTERS];
|
||||||
EFI_STRING_ID Id;
|
EFI_STRING_ID Id;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
ASSERT (Statement != NULL);
|
ASSERT (Statement != NULL);
|
||||||
ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP);
|
ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP);
|
||||||
|
|
||||||
UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
|
UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
|
||||||
|
|
||||||
Status = HiiLibNewString (FormSet->HiiHandle, &Id, Str);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
Id = HiiSetString (FormSet->HiiHandle, 0, Str, NULL);
|
||||||
return Status;
|
if (Id == 0) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Statement->VarStoreInfo.VarName = Id;
|
Statement->VarStoreInfo.VarName = Id;
|
||||||
|
@ -525,7 +525,6 @@ InitializeSetup (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate required Hii relative protocols
|
// Locate required Hii relative protocols
|
||||||
@ -554,15 +553,13 @@ InitializeSetup (
|
|||||||
//
|
//
|
||||||
// Publish our HII data
|
// Publish our HII data
|
||||||
//
|
//
|
||||||
PackageList = HiiLibPreparePackageList (1, &gSetupBrowserGuid, SetupBrowserStrings);
|
gHiiHandle = HiiAddPackages (
|
||||||
ASSERT (PackageList != NULL);
|
&gSetupBrowserGuid,
|
||||||
Status = mHiiDatabase->NewPackageList (
|
ImageHandle,
|
||||||
mHiiDatabase,
|
SetupBrowserStrings,
|
||||||
PackageList,
|
NULL
|
||||||
ImageHandle,
|
);
|
||||||
&gHiiHandle
|
ASSERT (gHiiHandle != NULL);
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Driver private data
|
// Initialize Driver private data
|
||||||
@ -603,11 +600,9 @@ NewString (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STRING_ID StringId;
|
EFI_STRING_ID StringId;
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
StringId = 0;
|
StringId = HiiSetString (HiiHandle, 0, String, NULL);
|
||||||
Status = HiiLibNewString (HiiHandle, &StringId, String);
|
ASSERT (StringId != 0);
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return StringId;
|
return StringId;
|
||||||
}
|
}
|
||||||
@ -631,7 +626,8 @@ DeleteString (
|
|||||||
CHAR16 NullChar;
|
CHAR16 NullChar;
|
||||||
|
|
||||||
NullChar = CHAR_NULL;
|
NullChar = CHAR_NULL;
|
||||||
return HiiLibSetString (HiiHandle, StringId, &NullChar);
|
HiiSetString (HiiHandle, StringId, &NullChar, NULL);
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -651,29 +647,11 @@ GetToken (
|
|||||||
IN EFI_HII_HANDLE HiiHandle
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STRING String;
|
||||||
CHAR16 *String;
|
|
||||||
UINTN BufferLength;
|
|
||||||
|
|
||||||
//
|
String = HiiGetString (HiiHandle, Token, NULL);
|
||||||
// Set default string size assumption at no more than 256 bytes
|
|
||||||
//
|
|
||||||
BufferLength = 0x100;
|
|
||||||
String = AllocateZeroPool (BufferLength);
|
|
||||||
ASSERT (String != NULL);
|
ASSERT (String != NULL);
|
||||||
|
return (CHAR16 *) String;
|
||||||
Status = HiiLibGetString (HiiHandle, Token, String, &BufferLength);
|
|
||||||
|
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
|
||||||
FreePool (String);
|
|
||||||
String = AllocateZeroPool (BufferLength);
|
|
||||||
ASSERT (String != NULL);
|
|
||||||
|
|
||||||
Status = HiiLibGetString (HiiHandle, Token, String, &BufferLength);
|
|
||||||
}
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return String;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/HiiLib.h>
|
#include <Library/HiiLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/DevicePathLib.h>
|
||||||
|
|
||||||
#include "Colors.h"
|
#include "Colors.h"
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
PrintLib
|
PrintLib
|
||||||
HiiLib
|
HiiLib
|
||||||
|
DevicePathLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiIfrTianoGuid ## CONSUMES ## GUID
|
gEfiIfrTianoGuid ## CONSUMES ## GUID
|
||||||
gEfiIfrFrameworkGuid ## CONSUMES ## GUID
|
gEfiIfrFrameworkGuid ## CONSUMES ## GUID
|
||||||
|
@ -1448,6 +1448,102 @@ AdjustDateAndTimePosition (
|
|||||||
return PadLineNumber;
|
return PadLineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find HII Handle in the HII database associated with given Device Path.
|
||||||
|
|
||||||
|
If DevicePath is NULL, then ASSERT.
|
||||||
|
|
||||||
|
@param DevicePath Device Path associated with the HII package list
|
||||||
|
handle.
|
||||||
|
|
||||||
|
@retval Handle HII package list Handle associated with the Device
|
||||||
|
Path.
|
||||||
|
@retval NULL Hii Package list handle is not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_HII_HANDLE
|
||||||
|
EFIAPI
|
||||||
|
DevicePathToHiiHandle (
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
|
||||||
|
UINTN BufferSize;
|
||||||
|
UINTN HandleCount;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_HANDLE Handle;
|
||||||
|
EFI_HANDLE DriverHandle;
|
||||||
|
EFI_HII_HANDLE *HiiHandles;
|
||||||
|
EFI_HII_HANDLE HiiHandle;
|
||||||
|
|
||||||
|
ASSERT (DevicePath != NULL);
|
||||||
|
|
||||||
|
TmpDevicePath = DevicePath;
|
||||||
|
//
|
||||||
|
// Locate Device Path Protocol handle buffer
|
||||||
|
//
|
||||||
|
Status = gBS->LocateDevicePath (
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
&TmpDevicePath,
|
||||||
|
&DriverHandle
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || !IsDevicePathEnd (TmpDevicePath)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve all HII Handles from HII database
|
||||||
|
//
|
||||||
|
BufferSize = 0x1000;
|
||||||
|
HiiHandles = AllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiHandles != NULL);
|
||||||
|
Status = mHiiDatabase->ListPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferSize,
|
||||||
|
HiiHandles
|
||||||
|
);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
FreePool (HiiHandles);
|
||||||
|
HiiHandles = AllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiHandles != NULL);
|
||||||
|
|
||||||
|
Status = mHiiDatabase->ListPackageLists (
|
||||||
|
mHiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferSize,
|
||||||
|
HiiHandles
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (HiiHandles);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Search Hii Handle by Driver Handle
|
||||||
|
//
|
||||||
|
HiiHandle = NULL;
|
||||||
|
HandleCount = BufferSize / sizeof (EFI_HII_HANDLE);
|
||||||
|
for (Index = 0; Index < HandleCount; Index++) {
|
||||||
|
Status = mHiiDatabase->GetPackageListHandle (
|
||||||
|
mHiiDatabase,
|
||||||
|
HiiHandles[Index],
|
||||||
|
&Handle
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {
|
||||||
|
HiiHandle = HiiHandles[Index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (HiiHandles);
|
||||||
|
return HiiHandle;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Display menu and wait for user to select one menu option, then return it.
|
Display menu and wait for user to select one menu option, then return it.
|
||||||
@ -2382,7 +2478,7 @@ UiDisplayMenu (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection->Handle = HiiLibDevicePathToHiiHandle (DevicePath);
|
Selection->Handle = DevicePathToHiiHandle (DevicePath);
|
||||||
if (Selection->Handle == NULL) {
|
if (Selection->Handle == NULL) {
|
||||||
//
|
//
|
||||||
// If target Hii Handle not found, exit
|
// If target Hii Handle not found, exit
|
||||||
|
@ -437,8 +437,13 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Initialize strings to HII database
|
// Initialize strings to HII database
|
||||||
//
|
//
|
||||||
HiiLibAddPackages (1, &gEfiProcessorProducerGuid, NULL, &HiiHandle, CpuStrings);
|
HiiHandle = HiiAddPackages (
|
||||||
|
&gEfiProcessorProducerGuid,
|
||||||
|
NULL,
|
||||||
|
CpuStrings,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
|
|
||||||
CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
|
CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
|
||||||
|
|
||||||
|
@ -180,11 +180,15 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Add our default strings to the HII database. They will be modified later.
|
// Add our default strings to the HII database. They will be modified later.
|
||||||
//
|
//
|
||||||
HiiLibAddPackages (1, &gEfiMiscSubClassGuid, NULL, &HiiHandle, MiscSubclassStrings);
|
HiiHandle = HiiAddPackages (
|
||||||
|
&gEfiMiscSubClassGuid,
|
||||||
if (EFI_ERROR (Status)) {
|
NULL,
|
||||||
|
MiscSubclassStrings,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (HiiHandle == NULL) {
|
||||||
DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", Status));
|
DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", Status));
|
||||||
return Status;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -451,8 +451,13 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Initialize strings to HII database
|
// Initialize strings to HII database
|
||||||
//
|
//
|
||||||
HiiLibAddPackages (1, &gEfiProcessorProducerGuid, NULL, &HiiHandle, CpuStrings);
|
HiiHandle = HiiAddPackages (
|
||||||
|
&gEfiProcessorProducerGuid,
|
||||||
|
NULL,
|
||||||
|
CpuStrings,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (HiiHandle != NULL);
|
||||||
|
|
||||||
CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
|
CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
|
||||||
|
|
||||||
|
@ -181,12 +181,17 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Add our default strings to the HII database. They will be modified later.
|
// Add our default strings to the HII database. They will be modified later.
|
||||||
//
|
//
|
||||||
HiiLibAddPackages (1, &gEfiMiscSubClassGuid, NULL, &HiiHandle, MiscSubclassStrings);
|
HiiHandle = HiiAddPackages (
|
||||||
|
&gEfiMiscSubClassGuid,
|
||||||
if (EFI_ERROR (EfiStatus)) {
|
NULL,
|
||||||
|
MiscSubclassStrings,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (HiiHandle == NULL) {
|
||||||
DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", EfiStatus));
|
DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", EfiStatus));
|
||||||
return EfiStatus;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user