[lib][uefi] implement UEFI HII Database Protocol#478
Open
grandpaul wants to merge 1 commit intolittlekernel:masterfrom
Open
[lib][uefi] implement UEFI HII Database Protocol#478grandpaul wants to merge 1 commit intolittlekernel:masterfrom
grandpaul wants to merge 1 commit intolittlekernel:masterfrom
Conversation
338b7e5 to
da0571b
Compare
da0571b to
276fa18
Compare
Shell.efi from EDK2 requires this protocol to be existed. Otherwise it crashes. So we implemented a minimum set of UEFI HII Database Protocol to let the Shell.efi to run. Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
276fa18 to
b33f350
Compare
Member
|
I'm okay with this but @zhangxp1998 has generally been the maintainer of the UEFI stuff. What do you think Kelvin? |
zhangxp1998
reviewed
Jan 20, 2026
|
|
||
| stbl = reinterpret_cast<struct efi_string_table *>(list_remove_head(&(hii->string_tables))); | ||
| if (!stbl) { | ||
| break; |
Contributor
There was a problem hiding this comment.
Does this break cause a memory leak? Is it OK that we don't free stbl ?
zhangxp1998
reviewed
Jan 20, 2026
|
|
||
| static void remove_strings_package(struct efi_hii_packagelist *hii) { | ||
| while (true) { | ||
| struct efi_string_table *stbl; |
Contributor
There was a problem hiding this comment.
Define and initialize in 1 step.
zhangxp1998
reviewed
Jan 20, 2026
| while ((void *)package < end) { | ||
| switch (efi_hii_package_type(package)) { | ||
| case EFI_HII_PACKAGE_END: | ||
| goto out; |
Contributor
There was a problem hiding this comment.
NO goto statement in C++
zhangxp1998
reviewed
Jan 20, 2026
| bool found = false; | ||
| list_for_every_entry(&efi_package_lists, hii, struct efi_hii_packagelist, node) { | ||
| if (hii == package_list) { | ||
| found = true; |
Contributor
There was a problem hiding this comment.
Just return true here?
zhangxp1998
reviewed
Jan 28, 2026
| #include <uefi/protocols/hii_protocol.h> | ||
|
|
||
| namespace { | ||
| const int EFI_HII_PACKAGE_TYPE_SHIFT = 24; |
zhangxp1998
reviewed
Jan 28, 2026
|
|
||
| namespace { | ||
| const int EFI_HII_PACKAGE_TYPE_SHIFT = 24; | ||
| const uint32_t EFI_HII_PACKAGE_TYPE_MASK = 0xff; |
Contributor
There was a problem hiding this comment.
same for all constants
zhangxp1998
reviewed
Jan 28, 2026
| static uint32_t efi_hii_package_type(const EfiHiiPackageHeader *header) { | ||
| uint32_t fields; | ||
|
|
||
| fields = header->fields; |
Contributor
There was a problem hiding this comment.
declare variable and initialize in 1 step, same everywhere across the code
zhangxp1998
reviewed
Jan 28, 2026
| return (fields >> EFI_HII_PACKAGE_TYPE_SHIFT) & EFI_HII_PACKAGE_TYPE_MASK; | ||
| } | ||
|
|
||
| static uint32_t efi_hii_package_len(const EfiHiiPackageHeader *header) { |
Contributor
There was a problem hiding this comment.
this is already inside an anonymous namespace, remove static keyword for all functions
zhangxp1998
reviewed
Jan 28, 2026
| struct efi_hii_packagelist *hii; | ||
|
|
||
| hii = reinterpret_cast<struct efi_hii_packagelist *>(malloc(sizeof(struct efi_hii_packagelist))); | ||
| if (!hii) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shell.efi from EDK2 requires this protocol to be existed. Otherwise it crashes. So we implemented a minimum set of UEFI HII Database Protocol to let the Shell.efi to run.