2 Logo DXE Driver, install Edkii Platform Logo protocol.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Protocol/HiiDatabase.h>
10 #include <Protocol/GraphicsOutput.h>
11 #include <Protocol/HiiImageEx.h>
12 #include <Protocol/PlatformLogo.h>
13 #include <Protocol/HiiPackageList.h>
14 #include <Library/UefiBootServicesTableLib.h>
15 #include <Library/DebugLib.h>
19 EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute
;
24 EFI_HII_IMAGE_EX_PROTOCOL
*mHiiImageEx
;
25 EFI_HII_HANDLE mHiiHandle
;
26 LOGO_ENTRY mLogos
[] = {
28 IMAGE_TOKEN (IMG_LOGO
),
29 EdkiiPlatformLogoDisplayAttributeCenter
,
36 Load a platform logo image and return its data and attributes.
38 @param This The pointer to this protocol instance.
39 @param Instance The visible image instance is found.
40 @param Image Points to the image.
41 @param Attribute The display attributes of the image returned.
42 @param OffsetX The X offset of the image regarding the Attribute.
43 @param OffsetY The Y offset of the image regarding the Attribute.
45 @retval EFI_SUCCESS The image was fetched successfully.
46 @retval EFI_NOT_FOUND The specified image could not be found.
51 IN EDKII_PLATFORM_LOGO_PROTOCOL
*This
,
52 IN OUT UINT32
*Instance
,
53 OUT EFI_IMAGE_INPUT
*Image
,
54 OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE
*Attribute
,
61 if ((Instance
== NULL
) || (Image
== NULL
) ||
62 (Attribute
== NULL
) || (OffsetX
== NULL
) || (OffsetY
== NULL
))
64 return EFI_INVALID_PARAMETER
;
68 if (Current
>= ARRAY_SIZE (mLogos
)) {
73 *Attribute
= mLogos
[Current
].Attribute
;
74 *OffsetX
= mLogos
[Current
].OffsetX
;
75 *OffsetY
= mLogos
[Current
].OffsetY
;
76 return mHiiImageEx
->GetImageEx (mHiiImageEx
, mHiiHandle
, mLogos
[Current
].ImageId
, Image
);
79 EDKII_PLATFORM_LOGO_PROTOCOL mPlatformLogo
= {
84 Entrypoint of this module.
86 This function is the entrypoint of this module. It installs the Edkii
87 Platform Logo protocol.
89 @param ImageHandle The firmware allocated handle for the EFI image.
90 @param SystemTable A pointer to the EFI System Table.
92 @retval EFI_SUCCESS The entry point is executed successfully.
98 IN EFI_HANDLE ImageHandle
,
99 IN EFI_SYSTEM_TABLE
*SystemTable
103 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
104 EFI_HII_DATABASE_PROTOCOL
*HiiDatabase
;
107 Status
= gBS
->LocateProtocol (
108 &gEfiHiiDatabaseProtocolGuid
,
110 (VOID
**)&HiiDatabase
112 ASSERT_EFI_ERROR (Status
);
114 Status
= gBS
->LocateProtocol (
115 &gEfiHiiImageExProtocolGuid
,
117 (VOID
**)&mHiiImageEx
119 ASSERT_EFI_ERROR (Status
);
122 // Retrieve HII package list from ImageHandle
124 Status
= gBS
->OpenProtocol (
126 &gEfiHiiPackageListProtocolGuid
,
127 (VOID
**)&PackageList
,
130 EFI_OPEN_PROTOCOL_GET_PROTOCOL
132 if (EFI_ERROR (Status
)) {
133 DEBUG ((DEBUG_ERROR
, "HII Image Package with logo not found in PE/COFF resource section\n"));
138 // Publish HII package list to HII Database.
140 Status
= HiiDatabase
->NewPackageList (
146 if (!EFI_ERROR (Status
)) {
148 Status
= gBS
->InstallMultipleProtocolInterfaces (
150 &gEdkiiPlatformLogoProtocolGuid
,