diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-26 11:02:31 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-26 11:02:31 +0000 |
commit | 3321fa09f0a8e7007b0949abfa69a612cd74e7fe (patch) | |
tree | 28a4bc2effe84ed12fd0ddd412bf572688364784 /EdkCompatibilityPkg | |
parent | f560de730794561912e60bb5a4d5ddbe589465fc (diff) | |
download | edk2-3321fa09f0a8e7007b0949abfa69a612cd74e7fe.tar.gz edk2-3321fa09f0a8e7007b0949abfa69a612cd74e7fe.tar.bz2 edk2-3321fa09f0a8e7007b0949abfa69a612cd74e7fe.zip |
1) Add in SharingStringPack to make UpdateString only create/update string token in the String Packages that shares String Package with each other. For a String Token to be updated in a Package, TagGUID must be the same and SharingStringPack need to be true too.
If a package list has both String Package and Form Package registered, the Create/Update of String Token will only be done in this Package List.
2) Add in Doxygen Function headers.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6736 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg')
5 files changed, 370 insertions, 234 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c index d312af46dd..1994f893ec 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c @@ -71,29 +71,20 @@ CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol; CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;
+/**
+ This routine initializes the HII Database.
+
+ @param ImageHandle Image handle for PCD DXE driver.
+ @param SystemTable Pointer to SystemTable.
-
-
-
+ @retval EFI_SUCCESS The entry point alwasy return successfully.
+**/
EFI_STATUS
EFIAPI
InitializeHiiDatabase (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-/*++
-
-Routine Description:
- Initialize HII Database
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
- EFI_SUCCESS - Setup loaded.
- other - Setup Error
-
---*/
{
HII_THUNK_PRIVATE_DATA *Private;
EFI_HANDLE Handle;
@@ -239,6 +230,26 @@ Returns: return Status;
}
+/**
+ Determines the handles that are currently active in the database.
+
+ This function determines the handles that are currently active in the database.
+ For example, a program wishing to create a Setup-like configuration utility would use this call
+ to determine the handles that are available. It would then use calls defined in the forms section
+ below to extract forms and then interpret them.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @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 Handle An array of EFI_HII_HANDLE instances returned.
+ Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack() in the Packages section.
+
+ @retval EFI_SUCCESS Handle was updated successfully.
+
+ @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates that Handle is too small
+ to support the number of handles. HandleBufferLength is updated with a value that
+ will enable the data to fit.
+**/
EFI_STATUS
EFIAPI
HiiFindHandles (
@@ -246,16 +257,6 @@ HiiFindHandles ( IN OUT UINT16 *HandleBufferLength,
OUT FRAMEWORK_EFI_HII_HANDLE Handle[1]
)
-/*++
-
-Routine Description:
- Determines the handles that are currently active in the database.
-
-Arguments:
-
-Returns:
-
---*/
{
UINT16 Count;
LIST_ENTRY *Link;
@@ -348,24 +349,30 @@ LangCodes3066To639 ( return EFI_SUCCESS;
}
+/**
+ Allows a program to determine the primary languages that are supported on a given handle.
+
+ This routine is intended to be used by drivers to query the interface database for supported languages.
+ This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
+ in the Packages section.
+ @param LanguageString A string allocated by GetPrimaryLanguages() that contains a list of all primary languages
+ registered on the handle. The routine will not return the three-spaces language identifier used in
+ other functions to indicate non-language-specific strings.
+
+ @reval EFI_SUCCESS LanguageString was correctly returned.
+
+ @reval EFI_INVALID_PARAMETER The Handle was unknown.
+**/
EFI_STATUS
EFIAPI
HiiGetPrimaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- OUT EFI_STRING *LanguageString
+ IN EFI_HII_PROTOCOL *This,
+ IN FRAMEWORK_EFI_HII_HANDLE Handle,
+ OUT EFI_STRING *LanguageString
)
-/*++
-
-Routine Description:
-
- This function allows a program to determine what the primary languages that are supported on a given handle.
-
-Arguments:
-
-Returns:
-
---*/
{
HII_THUNK_PRIVATE_DATA *Private;
EFI_HII_HANDLE UefiHiiHandle;
@@ -416,7 +423,26 @@ Done: }
+/**
+ Allows a program to determine which secondary languages are supported on a given handle for a given primary language
+
+ This routine is intended to be used by drivers to query the interface database for supported languages.
+ This routine returns a string of concatenated 3-byte language identifiers, one per string package associated with the handle.
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The handle on which the strings reside. Type EFI_HII_HANDLE is defined in EFI_HII_PROTOCOL.NewPack()
+ in the Packages section.
+ @param PrimaryLanguage Pointer to a NULL-terminated string containing a single ISO 639-2 language identifier, indicating
+ the primary language.
+ @param LanguageString A string allocated by GetSecondaryLanguages() containing a list of all secondary languages registered
+ on the handle. The routine will not return the three-spaces language identifier used in other functions
+ to indicate non-language-specific strings, nor will it return the primary language. This function succeeds
+ but returns a NULL LanguageString if there are no secondary languages associated with the input Handle and
+ PrimaryLanguage pair. Type EFI_STRING is defined in String.
+
+ @reval EFI_SUCCESS LanguageString was correctly returned.
+ @reval EFI_INVALID_PARAMETER The Handle was unknown.
+**/
EFI_STATUS
EFIAPI
HiiGetSecondaryLanguages (
@@ -425,18 +451,6 @@ HiiGetSecondaryLanguages ( IN CHAR16 *PrimaryLanguage,
OUT EFI_STRING *LanguageString
)
-/*++
-
-Routine Description:
-
- This function allows a program to determine which secondary languages are supported
- on a given handle for a given primary language.
-
- Arguments:
-
-Returns:
-
---*/
{
HII_THUNK_PRIVATE_DATA *Private;
EFI_HII_HANDLE UefiHiiHandle;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h index 6c3741511c..d9b6577adf 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h @@ -129,7 +129,24 @@ typedef struct { BOOLEAN ByFrameworkHiiNewPack;
//
- // The field below is only valid if IsPackageListWithOnlyStringPack is TRUE.
+ // HII Thunk will use TagGuid to associate the String Package and Form Package togehter.
+ // See description for TagGuid. This field is to record if either one of the following condition
+ // is TRUE:
+ // 1) if ((SharingStringPack == TRUE) && (StringPackageCount != 0 && IfrPackageCount == 0)), then this Package List only
+ /// has String Packages and provides Strings to other IFR package.
+ // 2) if ((SharingStringPack == TRUE) && (StringPackageCount == 0 && IfrPackageCount != 1)), then this Form Package
+ // copied String Packages from other Package List.
+ // 3) if ((SharingStringPack == FALSE)), this Package does not provide String Package or copy String Packages from other
+ // Package List.
+ //
+ //
+ // When a Hii->NewString() is called for this FwHiiHandle and SharingStringPack is TRUE, then all Package List that sharing
+ // the same TagGuid will update or create String in there respective String Packages. If SharingStringPack is FALSE, then
+ // only the String from String Packages in this Package List will be updated or created.
+ //
+ BOOLEAN SharingStringPack;
+
+ //
// The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption
// in both HII Database implementation and all modules that registering packages:
// If a Package List has only IFR package and no String Package, the IFR package will reference
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c index 88f25ef83e..35db52932a 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c @@ -20,6 +20,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. //
UINT8 mHandle[1024 * 8] = {0};
+/**
+
+ Initialize the Framework Hii Handle database.
+
+**/
VOID
InitHiiHandleDatabase (
VOID
@@ -32,10 +37,18 @@ InitHiiHandleDatabase ( mHandle[0] |= 1 << 0;
}
+/**
+ Allocate a new Framework HII handle.
+
+ @param Handle Returns the new Framework HII Handle assigned.
+
+ @retval EFI_SUCCESS A new Framework HII Handle is assigned.
+ @retval EFI_OUT_OF_RESOURCE The Framework HII Handle database is depleted.
+**/
EFI_STATUS
AllocateHiiHandle (
- FRAMEWORK_EFI_HII_HANDLE *Handle
+ OUT FRAMEWORK_EFI_HII_HANDLE *Handle
)
{
UINTN Index;
@@ -52,9 +65,15 @@ AllocateHiiHandle ( return EFI_OUT_OF_RESOURCES;
}
+/**
+ Free Framework HII handle.
+
+ @param Handle The Framework HII Handle to be freed.
+
+**/
VOID
FreeHiiHandle (
- FRAMEWORK_EFI_HII_HANDLE Handle
+ IN FRAMEWORK_EFI_HII_HANDLE Handle
)
{
UINT16 Num;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c index 0aa4773abe..494a31dc53 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c @@ -112,7 +112,7 @@ UpdatePackListWithOnlyIfrPack ( {
EFI_STATUS Status;
LIST_ENTRY *Link;
- HII_THUNK_CONTEXT *ThunkContext;
+ HII_THUNK_CONTEXT *ThunkContext;
Link = GetFirstNode (&Private->ThunkContextListHead);
while (!IsNull (&Private->ThunkContextListHead, Link)) {
@@ -136,13 +136,16 @@ UpdatePackListWithOnlyIfrPack ( StringPackageListHeader
);
ASSERT_EFI_ERROR (Status);
-
+
+ ThunkContext->SharingStringPack = TRUE;
+ StringPackageThunkContext->SharingStringPack = TRUE;
+
}
}
Link = GetNextNode (&Private->ThunkContextListHead, Link);
}
-
+
}
/**
@@ -387,8 +390,7 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack ( LIST_ENTRY *Link;
EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader;
UINTN Size;
- HII_THUNK_CONTEXT *ThunkContext;
-
+ HII_THUNK_CONTEXT *ThunkContext;
Link = GetFirstNode (&Private->ThunkContextListHead);
@@ -413,6 +415,10 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack ( ASSERT_EFI_ERROR (Status);
FreePool (StringPackageListHeader);
+
+ IfrThunkContext->SharingStringPack = TRUE;
+ ThunkContext->SharingStringPack = TRUE;
+
return EFI_SUCCESS;
}
@@ -421,6 +427,11 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack ( Link = GetNextNode (&Private->ThunkContextListHead, Link);
}
+ //
+ // A Form Package must have a String Package to function.
+ // If ASSERT here, check the sequence of call to Hii->NewPack.
+ // String Pack must be registered before Ifr Package is registered.
+ //
ASSERT (FALSE);
return EFI_NOT_FOUND;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c index 792b57f252..6e966192ac 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c @@ -51,7 +51,24 @@ ConvertIso639ToRfc3066 ( return (CHAR8 *) NULL;
}
+/**
+ Test if all of the characters in a string have corresponding font characters.
+
+ This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
+ return EFI_UNSUPPORTED.
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param StringToTest A pointer to a Unicode string.
+ @param FirstMissing A pointer to an index into the string. On input, the index of
+ the first character in the StringToTest to examine. On exit, the index
+ of the first character encountered for which a glyph is unavailable.
+ If all glyphs in the string are available, the index is the index of the terminator
+ of the string.
+ @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¡¯s glyph equivalent.
+
+ @retval EFI_UNSUPPORTED The function performs nothing and return EFI_UNSUPPORTED.
+**/
EFI_STATUS
EFIAPI
HiiTestString (
@@ -60,23 +77,23 @@ HiiTestString ( IN OUT UINT32 *FirstMissing,
OUT UINT32 *GlyphBufferSize
)
-/*++
-
-Routine Description:
- Test if all of the characters in a string have corresponding font characters.
-
-Arguments:
-
-Returns:
-
---*/
{
ASSERT (FALSE);
- return EFI_SUCCESS;
+
+ return EFI_UNSUPPORTED;
}
+/**
+ Find the corressponding TAG GUID from a Framework HII Handle given.
+
+ @param Private The HII Thunk Module Private context.
+ @param FwHiiHandle The Framemwork HII Handle.
+ @param TagGuid The output of TAG GUID found.
+ @return NULL If Framework HII Handle is invalid.
+ @return The corresponding HII Thunk Context.
+**/
EFI_STATUS
GetTagGuidByFwHiiHandle (
IN CONST HII_THUNK_PRIVATE_DATA *Private,
@@ -105,7 +122,119 @@ GetTagGuidByFwHiiHandle ( return EFI_NOT_FOUND;
}
+/**
+ Create or update the String given a new string and String ID.
+
+ @param ThunkContext The Thunk Context.
+ @param Rfc3066AsciiLanguage The RFC 3066 Language code in ASCII string format.
+ @param NewString The new string.
+ @param StringId The String ID. If StringId is 0, a new String Token
+ is created. Otherwise, the String Token StringId is
+ updated.
+
+
+ @retval EFI_SUCCESS The new string is created or updated successfully.
+ The new String Token ID is returned in StringId if
+ *StringId is 0 on input.
+ @return Others The update of string failed.
+
+**/
+EFI_STATUS
+UpdateString (
+ IN CONST HII_THUNK_CONTEXT *ThunkContext,
+ IN CONST CHAR8 *Rfc3066AsciiLanguage,
+ IN CHAR16 *NewString,
+ IN OUT STRING_REF *StringId
+ )
+{
+ EFI_STRING_ID NewStringId;
+ EFI_STATUS Status;
+
+
+ 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.
+ //
+ *StringId = 0;
+ }
+
+ return Status;
+}
+
+/**
+ Create or update a String Token in a String Package.
+
+ If *Reference == 0, a new String Token is created.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Language Pointer to a NULL-terminated string containing a single ISO 639-2 language
+ identifier, indicating the language to print. A string consisting of
+ all spaces indicates that the string is applicable to all languages.
+ @param Handle The handle of the language pack to which the string is to be added.
+ @param Token The string token assigned to the string.
+ @param NewString The string to be added.
+
+ @retval EFI_SUCCESS The string was effectively registered.
+ @retval EFI_INVALID_PARAMETER The Handle was unknown. The string is not created or updated in the
+ the string package.
+**/
EFI_STATUS
EFIAPI
@@ -116,43 +245,23 @@ HiiNewString ( IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
-/*++
-
-Routine Description:
- This function allows a new String to be added to an already existing String Package.
- We will make a buffer the size of the package + StrSize of the new string. We will
- copy the string package that first gets changed and the following language packages until
- we encounter the NULL string package. All this time we will ensure that the offsets have
- been adjusted.
-
-Arguments:
-
-Returns:
-
---*/
{
EFI_STATUS Status;
HII_THUNK_PRIVATE_DATA *Private;
EFI_GUID TagGuid;
LIST_ENTRY *Link;
HII_THUNK_CONTEXT *ThunkContext;
+ HII_THUNK_CONTEXT *StringPackThunkContext;
EFI_STRING_ID StringId;
EFI_STRING_ID LastStringId;
CHAR8 AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];
CHAR16 LanguageCopy[ISO_639_2_ENTRY_SIZE + 1];
- BOOLEAN Found;
CHAR8 *Rfc3066AsciiLanguage;
LastStringId = (EFI_STRING_ID) 0;
StringId = (EFI_STRING_ID) 0;
- Found = FALSE;
Rfc3066AsciiLanguage = NULL;
- Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
-
- Status = GetTagGuidByFwHiiHandle (Private, Handle, &TagGuid);
- ASSERT_EFI_ERROR (Status);
-
if (Language != NULL) {
ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;
ZeroMem (LanguageCopy, sizeof (LanguageCopy));
@@ -162,130 +271,111 @@ Returns: ASSERT (Rfc3066AsciiLanguage != NULL);
}
- Link = GetFirstNode (&Private->ThunkContextListHead);
- while (!IsNull (&Private->ThunkContextListHead, Link)) {
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
+ Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
- if (CompareGuid (&TagGuid, &ThunkContext->TagGuid)) {
- Found = TRUE;
- if (*Reference == 0) {
- //
- // Create a new string token.
- //
- if (Rfc3066AsciiLanguage == NULL) {
- //
- // For all languages in the package list.
- //
- Status = HiiLibNewString (ThunkContext->UefiHiiHandle, &StringId, NewString);
- } else {
- //
- // For specified language.
- //
- Status = mHiiStringProtocol->NewString (
- mHiiStringProtocol,
- ThunkContext->UefiHiiHandle,
- &StringId,
- Rfc3066AsciiLanguage,
- NULL,
- NewString,
- NULL
- );
- }
- } else {
- //
- // Update the existing string token.
- //
- if (Rfc3066AsciiLanguage == NULL) {
- //
- // For all languages in the package list.
- //
- Status = HiiLibSetString (ThunkContext->UefiHiiHandle, *Reference, NewString);
- } else {
- //
- // For specified language.
- //
- Status = mHiiStringProtocol->SetString (
- mHiiStringProtocol,
- ThunkContext->UefiHiiHandle,
- *Reference,
- Rfc3066AsciiLanguage,
- NewString,
- NULL
- );
- }
- }
- if (EFI_ERROR (Status)) {
- //
- // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
- //
- return EFI_INVALID_PARAMETER;
- }
+ StringPackThunkContext = FwHiiHandleToThunkContext (Private, Handle);
+ if (StringPackThunkContext == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (StringPackThunkContext->SharingStringPack) {
+ Status = GetTagGuidByFwHiiHandle (Private, Handle, &TagGuid);
+ ASSERT_EFI_ERROR (Status);
+
+ Link = GetFirstNode (&Private->ThunkContextListHead);
+ while (!IsNull (&Private->ThunkContextListHead, Link)) {
+ ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
- if (*Reference == 0) {
- //
- // When creating new string token, make sure all created token is the same
- // for all string packages registered using FW HII interface.
- //
- if (LastStringId == (EFI_STRING_ID) 0) {
- LastStringId = StringId;
- } else {
- if (LastStringId != StringId) {
- ASSERT(FALSE);
- return EFI_INVALID_PARAMETER;
+ if (CompareGuid (&TagGuid, &ThunkContext->TagGuid)) {
+ if (ThunkContext->SharingStringPack) {
+ StringId = *Reference;
+ Status = UpdateString (ThunkContext, Rfc3066AsciiLanguage, NewString, &StringId);
+ if (EFI_ERROR (Status)) {
+ break;
}
+
+ DEBUG_CODE_BEGIN ();
+ if (*Reference == 0) {
+ //
+ // When creating new string token, make sure all created token is the same
+ // for all string packages registered using FW HII interface.
+ //
+ if (LastStringId == (EFI_STRING_ID) 0) {
+ LastStringId = StringId;
+ } else {
+ if (LastStringId != StringId) {
+ ASSERT(FALSE);
+ }
+ }
+ }
+ DEBUG_CODE_END ();
+
}
}
- }
- Link = GetNextNode (&Private->ThunkContextListHead, Link);
+ Link = GetNextNode (&Private->ThunkContextListHead, Link);
+ }
+ } else {
+ StringId = *Reference;
+ Status = UpdateString (StringPackThunkContext, Rfc3066AsciiLanguage, NewString, &StringId);
}
- if (Found) {
+ if (!EFI_ERROR (Status)) {
if (*Reference == 0) {
*Reference = StringId;
}
- Status = EFI_SUCCESS;
} else {
- DEBUG((EFI_D_ERROR, "Thunk HiiNewString fails to find the String Packages to update\n"));
//
- // BUGBUG: Remove ths ASSERT when development is done.
+ // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.
//
- ASSERT (FALSE);
- Status = EFI_NOT_FOUND;
+ Status = EFI_INVALID_PARAMETER;
}
- //
- // For UNI file, some String may not be defined for a language. This has been true for a lot of platform code.
- // For this case, EFI_NOT_FOUND will be returned. To allow the old code to be run without porting, we don't assert
- // on EFI_NOT_FOUND. The missing Strings will be shown if user select a differnt languages other than the default
- // English language for the platform.
- //
- ASSERT_EFI_ERROR (EFI_ERROR (Status) && Status != EFI_NOT_FOUND);
-
return Status;
}
+/**
+ This function removes any new strings that were added after the initial string export for this handle.
+ UEFI HII String Protocol does not have Reset String function. This function perform nothing.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The HII handle on which the string resides.
+
+ @retval EFI_SUCCESS This function is a NOP and always return EFI_SUCCESS.
+
+**/
EFI_STATUS
EFIAPI
HiiResetStrings (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
-/*++
-
-Routine Description:
-
- This function removes any new strings that were added after the initial string export for this handle.
-
-Arguments:
-
-Returns:
-
---*/
{
return EFI_SUCCESS;
}
+/**
+ This function extracts a string from a package already registered with the EFI HII database.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The HII handle on which the string resides.
+ @param Token The string token assigned to the string.
+ @param Raw If TRUE, the string is returned unedited in the internal storage format described
+ above. If false, the string returned is edited by replacing <cr> with <space>
+ and by removing special characters such as the <wide> prefix.
+ @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
+ identifier, indicating the language to print. If the LanguageString is empty (starts
+ with a NULL), the default system language will be used to determine the language.
+ @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
+ small, this parameter is filled with the length of the buffer needed.
+ @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
+ defined in String.
+
+ @retval EFI_INVALID_PARAMETER If input parameter is invalid.
+ @retval EFI_BUFFER_TOO_SMALL If the *BufferLength is too small.
+ @retval EFI_SUCCESS Operation is successful.
+
+**/
EFI_STATUS
EFIAPI
HiiGetString (
@@ -297,33 +387,6 @@ HiiGetString ( IN OUT UINTN *BufferLengthTemp,
OUT EFI_STRING StringBuffer
)
-/*++
-
-Routine Description:
-
- This function extracts a string from a package already registered with the EFI HII database.
-
-Arguments:
- This - A pointer to the EFI_HII_PROTOCOL instance.
- Handle - The HII handle on which the string resides.
- Token - The string token assigned to the string.
- Raw - If TRUE, the string is returned unedited in the internal storage format described
- above. If false, the string returned is edited by replacing <cr> with <space>
- and by removing special characters such as the <wide> prefix.
- LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
-Returns:
- EFI_INVALID_PARAMETER - If input parameter is invalid.
- EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small.
- EFI_SUCCESS - Operation is successful.
-
---*/
{
CHAR8 *Iso639AsciiLanguage;
HII_THUNK_PRIVATE_DATA *Private;
@@ -385,31 +448,43 @@ Done: return Status;
}
-EFI_STATUS
-EFIAPI
-HiiGetLine (
- IN EFI_HII_PROTOCOL *This,
- IN FRAMEWORK_EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN OUT UINT16 *Index,
- IN UINT16 LineWidth,
- IN CHAR16 *LanguageString,
- IN OUT UINT16 *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-/*++
-
-Routine Description:
+/**
This function allows a program to extract a part of a string of not more than a given width.
With repeated calls, this allows a calling program to extract "lines" of text that fit inside
columns. The effort of measuring the fit of strings inside columns is localized to this call.
-Arguments:
-
-Returns:
-
---*/
+ This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and
+ return EFI_UNSUPPORTED.
+
+ @param This A pointer to the EFI_HII_PROTOCOL instance.
+ @param Handle The HII handle on which the string resides.
+ @param Token The string token assigned to the string.
+ @param Raw If TRUE, the string is returned unedited in the internal storage format described
+ above. If false, the string returned is edited by replacing <cr> with <space>
+ and by removing special characters such as the <wide> prefix.
+ @param LanguageString Pointer to a NULL-terminated string containing a single ISO 639-2 language
+ identifier, indicating the language to print. If the LanguageString is empty (starts
+ with a NULL), the default system language will be used to determine the language.
+ @param BufferLength Length of the StringBuffer. If the status reports that the buffer width is too
+ small, this parameter is filled with the length of the buffer needed.
+ @param StringBuffer The buffer designed to receive the characters in the string. Type EFI_STRING is
+ defined in String.
+
+ @retval EFI_UNSUPPORTED.
+**/
+EFI_STATUS
+EFIAPI
+HiiGetLine (
+ IN EFI_HII_PROTOCOL *This,
+ IN FRAMEWORK_EFI_HII_HANDLE Handle,
+ IN STRING_REF Token,
+ IN OUT UINT16 *Index,
+ IN UINT16 LineWidth,
+ IN CHAR16 *LanguageString,
+ IN OUT UINT16 *BufferLength,
+ OUT EFI_STRING StringBuffer
+ )
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
|