mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
Add in thunk support for HiiGetSecondaryLanguages and HiiGetPrimaryLanguages
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5064 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c344685c0c
commit
ee3428bb58
@ -1,8 +1,8 @@
|
|||||||
/**@file
|
/**@file
|
||||||
|
Framework to UEFI 2.1 HII Thunk. The driver consume UEFI HII protocols
|
||||||
|
to produce a Framework HII protocol.
|
||||||
|
|
||||||
Framework to UEFI 2.1 HII Thunk
|
Copyright (c) 2008, Intel Corporation
|
||||||
|
|
||||||
Copyright (c) 2003, Intel Corporation
|
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -175,7 +175,36 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
EFI_HII_THUNK_PRIVATE_DATA *Private;
|
||||||
|
EFI_HII_HANDLE UefiHiiHandle;
|
||||||
|
CHAR8 *AsciiLanguageCodes;
|
||||||
|
CHAR16 *UnicodeLanguageCodes;
|
||||||
|
|
||||||
|
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UefiHiiHandle = FrameworkHiiHandleToUefiHiiHandle (Private, Handle);
|
||||||
|
if (UefiHiiHandle == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsciiLanguageCodes = HiiLibGetSupportedLanguages (UefiHiiHandle);
|
||||||
|
|
||||||
|
if (AsciiLanguageCodes == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnicodeLanguageCodes = AllocateZeroPool (AsciiStrSize (AsciiLanguageCodes) * sizeof (CHAR16));
|
||||||
|
if (UnicodeLanguageCodes == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// The language returned is in RFC 3066 format.
|
||||||
|
//
|
||||||
|
*LanguageString = AsciiStrToUnicodeStr (AsciiLanguageCodes, UnicodeLanguageCodes);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +229,41 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
EFI_HII_THUNK_PRIVATE_DATA *Private;
|
||||||
|
EFI_HII_HANDLE UefiHiiHandle;
|
||||||
|
CHAR8 *AsciiPrimaryLanguage;
|
||||||
|
CHAR8 *AsciiLanguageCodes;
|
||||||
|
CHAR16 *UnicodeLanguageCodes;
|
||||||
|
|
||||||
|
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UefiHiiHandle = FrameworkHiiHandleToUefiHiiHandle (Private, Handle);
|
||||||
|
if (UefiHiiHandle == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsciiPrimaryLanguage = AllocateZeroPool (StrLen (PrimaryLanguage) + 1);
|
||||||
|
|
||||||
|
UnicodeStrToAsciiStr (PrimaryLanguage, AsciiPrimaryLanguage);
|
||||||
|
|
||||||
|
AsciiLanguageCodes = HiiLibGetSupportedSecondaryLanguages (UefiHiiHandle, AsciiPrimaryLanguage);
|
||||||
|
|
||||||
|
if (AsciiLanguageCodes == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnicodeLanguageCodes = AllocateZeroPool (AsciiStrSize (AsciiLanguageCodes) * sizeof (CHAR16));
|
||||||
|
if (UnicodeLanguageCodes == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// The language returned is in RFC 3066 format.
|
||||||
|
//
|
||||||
|
*LanguageString = AsciiStrToUnicodeStr (AsciiLanguageCodes, UnicodeLanguageCodes);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/FrameworkIfrSupportLib.h>
|
#include <Library/FrameworkIfrSupportLib.h>
|
||||||
#include <Library/HiiLib.h>
|
#include <Library/HiiLib.h>
|
||||||
#include "Utility.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Macros
|
// Macros
|
||||||
@ -319,4 +318,6 @@ HiiCompareLanguage (
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
#include "Utility.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,5 +33,10 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
return EFI_SUCCESS;
|
ASSERT (FALSE);
|
||||||
|
//
|
||||||
|
// In previous Framewok HII implementation, GetKeyBoardLayout is defined in HII 0.92 specification,
|
||||||
|
// but it is not implemented. We ASSERT and return UNSUPPORTED here.
|
||||||
|
//
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -39,3 +39,30 @@ GetGuidOfFirstFormset (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_HII_HANDLE
|
||||||
|
FrameworkHiiHandleToUefiHiiHandle (
|
||||||
|
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
|
||||||
|
IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LIST_ENTRY *ListEntry;
|
||||||
|
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
|
||||||
|
|
||||||
|
ASSERT (FrameworkHiiHandle != (FRAMEWORK_EFI_HII_HANDLE) 0);
|
||||||
|
ASSERT (Private != NULL);
|
||||||
|
|
||||||
|
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
|
||||||
|
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
|
||||||
|
ListEntry = ListEntry->ForwardLink
|
||||||
|
) {
|
||||||
|
|
||||||
|
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
|
||||||
|
|
||||||
|
if (FrameworkHiiHandle == HandleMapEntry->FrameworkHiiHandle) {
|
||||||
|
return HandleMapEntry->UefiHiiHandle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (EFI_HII_HANDLE) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -21,4 +21,21 @@ GetGuidOfFirstFormset (
|
|||||||
CONST EFI_HII_FORM_PACKAGE * FormPackage
|
CONST EFI_HII_FORM_PACKAGE * FormPackage
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find the UefiHiiHandle based on a Framework HII Handle returned by
|
||||||
|
the HII Thunk to Framework HII code.
|
||||||
|
|
||||||
|
@param Private The pointer to the private data of Hii Thunk.
|
||||||
|
@param FrameworkHiiHandle Framework HII Handle returned by the HII Thunk to Framework HII code.
|
||||||
|
|
||||||
|
@retval NULL If Framework HII Handle passed in does not have matching UEFI HII handle.
|
||||||
|
@retval !NULL If the match is found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_HII_HANDLE
|
||||||
|
FrameworkHiiHandleToUefiHiiHandle (
|
||||||
|
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
|
||||||
|
IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
|
||||||
|
)
|
||||||
|
;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user