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
,
60 if (Instance
== NULL
|| Image
== NULL
||
61 Attribute
== NULL
|| OffsetX
== NULL
|| OffsetY
== NULL
) {
62 return EFI_INVALID_PARAMETER
;
66 if (Current
>= ARRAY_SIZE (mLogos
)) {
71 *Attribute
= mLogos
[Current
].Attribute
;
72 *OffsetX
= mLogos
[Current
].OffsetX
;
73 *OffsetY
= mLogos
[Current
].OffsetY
;
74 return mHiiImageEx
->GetImageEx (mHiiImageEx
, mHiiHandle
, mLogos
[Current
].ImageId
, Image
);
77 EDKII_PLATFORM_LOGO_PROTOCOL mPlatformLogo
= {
82 Entrypoint of this module.
84 This function is the entrypoint of this module. It installs the Edkii
85 Platform Logo protocol.
87 @param ImageHandle The firmware allocated handle for the EFI image.
88 @param SystemTable A pointer to the EFI System Table.
90 @retval EFI_SUCCESS The entry point is executed successfully.
96 IN EFI_HANDLE ImageHandle
,
97 IN EFI_SYSTEM_TABLE
*SystemTable
101 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
102 EFI_HII_DATABASE_PROTOCOL
*HiiDatabase
;
105 Status
= gBS
->LocateProtocol (
106 &gEfiHiiDatabaseProtocolGuid
,
108 (VOID
**) &HiiDatabase
110 ASSERT_EFI_ERROR (Status
);
112 Status
= gBS
->LocateProtocol (
113 &gEfiHiiImageExProtocolGuid
,
115 (VOID
**) &mHiiImageEx
117 ASSERT_EFI_ERROR (Status
);
120 // Retrieve HII package list from ImageHandle
122 Status
= gBS
->OpenProtocol (
124 &gEfiHiiPackageListProtocolGuid
,
125 (VOID
**) &PackageList
,
128 EFI_OPEN_PROTOCOL_GET_PROTOCOL
130 if (EFI_ERROR (Status
)) {
131 DEBUG ((DEBUG_ERROR
, "HII Image Package with logo not found in PE/COFF resource section\n"));
136 // Publish HII package list to HII Database.
138 Status
= HiiDatabase
->NewPackageList (
144 if (!EFI_ERROR (Status
)) {
146 Status
= gBS
->InstallMultipleProtocolInterfaces (
148 &gEdkiiPlatformLogoProtocolGuid
, &mPlatformLogo
,