Don't assume HiiDatabase has been present at the entrypoint and don't assume HiiDatabase and HiiFont are on the same handle according to the UEFI spec.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14236 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lzeng14 2013-04-02 03:23:54 +00:00
parent 71619ac2b5
commit adfa1abc09
1 changed files with 6 additions and 32 deletions

View File

@ -57,7 +57,7 @@ GRAPHICS_CONSOLE_MODE_DATA mGraphicsConsoleModeData[] = {
EFI_HII_DATABASE_PROTOCOL *mHiiDatabase; EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
EFI_HII_FONT_PROTOCOL *mHiiFont; EFI_HII_FONT_PROTOCOL *mHiiFont;
EFI_HII_HANDLE mHiiHandle; EFI_HII_HANDLE mHiiHandle;
EFI_EVENT mHiiRegistration; VOID *mHiiRegistration;
EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, {0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad}}; EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, {0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad}};
@ -806,42 +806,14 @@ EfiLocateHiiProtocol (
VOID VOID
) )
{ {
EFI_HANDLE Handle;
UINTN Size;
EFI_STATUS Status; EFI_STATUS Status;
// Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabase);
// There should only be one - so buffer size is this
//
Size = sizeof (EFI_HANDLE);
Status = gBS->LocateHandle (
ByProtocol,
&gEfiHiiDatabaseProtocolGuid,
NULL,
&Size,
(VOID **) &Handle
);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
Status = gBS->HandleProtocol ( Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &mHiiFont);
Handle,
&gEfiHiiDatabaseProtocolGuid,
(VOID **) &mHiiDatabase
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->HandleProtocol (
Handle,
&gEfiHiiFontProtocolGuid,
(VOID **) &mHiiFont
);
return Status; return Status;
} }
@ -2057,7 +2029,9 @@ RegisterFontPackage (
NULL, NULL,
(VOID **) &HiiDatabase (VOID **) &HiiDatabase
); );
ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
return;
}
// //
// Add 4 bytes to the header for entire length for HiiAddPackages use only. // Add 4 bytes to the header for entire length for HiiAddPackages use only.