**/\r
\r
#include "HiiDatabase.h"\r
+#include "HiiHandle.h"\r
\r
HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;\r
\r
HiiGetKeyboardLayout\r
},\r
\r
- //\r
- //StaticHiiHandle\r
- //The FRAMEWORK_EFI_HII_HANDLE starts from 1 \r
- // and increase upwords untill reach the value of StaticPureUefiHiiHandle. \r
- // The code will assert to prevent overflow.\r
- (FRAMEWORK_EFI_HII_HANDLE) 1,\r
-\r
- //\r
- //StaticPureUefiHiiHandle\r
- //The Static FRAMEWORK_EFI_HII_HANDLE starts from 0xFFFF \r
- // and decrease downwords untill reach the value of StaticHiiHandle. \r
- // The code will assert to prevent overflow.\r
- //\r
- (FRAMEWORK_EFI_HII_HANDLE) 0xFFFF,\r
{\r
- NULL, NULL //HiiHandleLinkList\r
+ ///\r
+ /// HiiHandleLinkList\r
+ ///\r
+ NULL, NULL \r
},\r
};\r
\r
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;\r
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;\r
+CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;\r
CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;\r
CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;\r
\r
\r
+/**\r
+ This routine initializes the HII Database.\r
+ \r
+ @param ImageHandle Image handle for PCD DXE driver.\r
+ @param SystemTable Pointer to SystemTable.\r
\r
-\r
-\r
-\r
+ @retval EFI_SUCCESS The entry point alwasy return successfully.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
InitializeHiiDatabase (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Initialize HII Database\r
-\r
-Arguments:\r
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
-\r
-Returns:\r
- EFI_SUCCESS - Setup loaded.\r
- other - Setup Error\r
-\r
---*/\r
{\r
HII_THUNK_PRIVATE_DATA *Private;\r
EFI_HANDLE Handle;\r
UINTN BufferLength;\r
EFI_HII_HANDLE *Buffer;\r
UINTN Index;\r
+ HII_THUNK_CONTEXT *ThunkContext;\r
\r
\r
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiCompatibilityProtocolGuid);\r
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiFormBrowserCompatibilityProtocolGuid);\r
\r
Private = AllocateCopyPool (sizeof (HII_THUNK_PRIVATE_DATA), &mHiiThunkPrivateDataTempate);\r
ASSERT (Private != NULL);\r
InitializeListHead (&Private->ThunkContextListHead);\r
\r
+ InitHiiHandleDatabase ();\r
+\r
mHiiThunkPrivateData = Private;\r
\r
Status = gBS->LocateProtocol (\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiHiiFontProtocolGuid,\r
+ NULL,\r
+ (VOID **) &mHiiFontProtocol\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
Status = gBS->LocateProtocol (\r
&gEfiHiiConfigRoutingProtocolGuid,\r
NULL,\r
//\r
Status = gBS->InstallProtocolInterface (\r
&Private->Handle,\r
- &gEfiHiiProtocolGuid,\r
+ &gEfiHiiCompatibilityProtocolGuid,\r
EFI_NATIVE_INTERFACE,\r
(VOID *) &Private->Hii\r
);\r
Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);\r
if (Status == EFI_SUCCESS) {\r
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {\r
- CreateThunkContextForUefiHiiHandle (Private, Buffer[Index]);\r
- ASSERT_EFI_ERROR (Status);\r
+ ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);\r
+ ASSERT (ThunkContext!= NULL);\r
+ \r
+ InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);\r
}\r
\r
FreePool (Buffer);\r
\r
Status = mHiiDatabase->RegisterPackageNotify (\r
mHiiDatabase,\r
- EFI_HII_PACKAGE_FORM,\r
+ EFI_HII_PACKAGE_FORMS,\r
NULL,\r
NewOrAddPackNotify,\r
EFI_HII_DATABASE_NOTIFY_NEW_PACK,\r
\r
Status = mHiiDatabase->RegisterPackageNotify (\r
mHiiDatabase,\r
- EFI_HII_PACKAGE_FORM,\r
+ EFI_HII_PACKAGE_FORMS,\r
NULL,\r
NewOrAddPackNotify,\r
EFI_HII_DATABASE_NOTIFY_ADD_PACK,\r
mBrowserThunkPrivateDataTemplate.ThunkPrivate = Private;\r
Status = gBS->InstallProtocolInterface (\r
&mBrowserThunkPrivateDataTemplate.Handle,\r
- &gEfiFormBrowserProtocolGuid,\r
+ &gEfiFormBrowserCompatibilityProtocolGuid,\r
EFI_NATIVE_INTERFACE,\r
(VOID *) &mBrowserThunkPrivateDataTemplate.FormBrowser\r
);\r
return Status;\r
}\r
\r
+/**\r
+ Determines the handles that are currently active in the database.\r
+\r
+ This function determines the handles that are currently active in the database. \r
+ For example, a program wishing to create a Setup-like configuration utility would use this call \r
+ to determine the handles that are available. It would then use calls defined in the forms section \r
+ below to extract forms and then interpret them.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param HandleBufferLength On input, a pointer to the length of the handle buffer. \r
+ On output, the length of the handle buffer that is required for the handles found.\r
+ @param Handle An array of EFI_HII_HANDLE instances returned. \r
+ Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section.\r
+\r
+ @retval EFI_SUCCESS Handle was updated successfully.\r
+ \r
+ @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small \r
+ to support the number of handles. HandleBufferLength is updated with a value that \r
+ will enable the data to fit.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
HiiFindHandles (\r
IN OUT UINT16 *HandleBufferLength,\r
OUT FRAMEWORK_EFI_HII_HANDLE Handle[1]\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Determines the handles that are currently active in the database.\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
{\r
UINT16 Count;\r
LIST_ENTRY *Link;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Allows a program to determine the primary languages that are supported on a given handle.\r
+\r
+ This routine is intended to be used by drivers to query the interface database for supported languages. \r
+ This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() \r
+ in the Packages section.\r
+ @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages \r
+ registered on the handle. The routine will not return the three-spaces language identifier used in \r
+ other functions to indicate non-language-specific strings.\r
+\r
+ @reval EFI_SUCCESS LanguageString was correctly returned.\r
+ \r
+ @reval EFI_INVALID_PARAMETER The Handle was unknown.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
HiiGetPrimaryLanguages (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
- OUT EFI_STRING *LanguageString\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
+ OUT EFI_STRING *LanguageString\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function allows a program to determine what the primary languages that are supported on a given handle.\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
{\r
HII_THUNK_PRIVATE_DATA *Private;\r
EFI_HII_HANDLE UefiHiiHandle;\r
\r
Done:\r
FreePool (LangCodes3066);\r
- SafeFreePool (LangCodes639);\r
+ if (LangCodes639 != NULL) {\r
+ FreePool (LangCodes639);\r
+ }\r
\r
return Status;\r
}\r
\r
\r
+/**\r
+ Allows a program to determine which secondary languages are supported on a given handle for a given primary language\r
\r
+ This routine is intended to be used by drivers to query the interface database for supported languages. \r
+ This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.\r
+\r
+ @param This A pointer to the EFI_HII_PROTOCOL instance.\r
+ @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() \r
+ in the Packages section.\r
+ @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating \r
+ the primary language.\r
+ @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered \r
+ on the handle. The routine will not return the three-spaces language identifier used in other functions \r
+ to indicate non-language-specific strings, nor will it return the primary language. This function succeeds \r
+ but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and \r
+ PrimaryLanguage pair. Type EFI_STRING is defined in String.\r
+ \r
+ @reval EFI_SUCCESS LanguageString was correctly returned.\r
+ @reval EFI_INVALID_PARAMETER The Handle was unknown.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
HiiGetSecondaryLanguages (\r
IN CHAR16 *PrimaryLanguage,\r
OUT EFI_STRING *LanguageString\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function allows a program to determine which secondary languages are supported\r
- on a given handle for a given primary language.\r
-\r
- Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
{\r
HII_THUNK_PRIVATE_DATA *Private;\r
EFI_HII_HANDLE UefiHiiHandle;\r
*LanguageString = AsciiStrToUnicodeStr (SecLangCodes639, UnicodeSecLangCodes639);\r
\r
Done:\r
- \r
- SafeFreePool (PrimaryLang639);\r
- SafeFreePool (SecLangCodes639);\r
- SafeFreePool (SecLangCodes3066);\r
- SafeFreePool (UnicodeSecLangCodes639);\r
+ if (PrimaryLang639 != NULL) {\r
+ FreePool (PrimaryLang639);\r
+ }\r
+ if (SecLangCodes639 != NULL) {\r
+ FreePool (SecLangCodes639);\r
+ }\r
+ if (SecLangCodes3066 != NULL) {\r
+ FreePool (SecLangCodes3066);\r
+ }\r
+ if (UnicodeSecLangCodes639 != NULL) {\r
+ FreePool (UnicodeSecLangCodes639);\r
+ }\r
\r
return Status;\r
}\r