2 Logo DXE Driver, install Edkii Platform Logo protocol.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include <Protocol/HiiDatabase.h>
16 #include <Protocol/GraphicsOutput.h>
17 #include <Protocol/HiiImageEx.h>
18 #include <Protocol/PlatformLogo.h>
19 #include <Protocol/HiiPackageList.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <Library/DebugLib.h>
25 EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute
;
30 EFI_HII_IMAGE_EX_PROTOCOL
*mHiiImageEx
;
31 EFI_HII_HANDLE mHiiHandle
;
32 LOGO_ENTRY mLogos
[] = {
34 IMAGE_TOKEN (IMG_LOGO
),
35 EdkiiPlatformLogoDisplayAttributeCenter
,
42 Load a platform logo image and return its data and attributes.
44 @param This The pointer to this protocol instance.
45 @param Instance The visible image instance is found.
46 @param Image Points to the image.
47 @param Attribute The display attributes of the image returned.
48 @param OffsetX The X offset of the image regarding the Attribute.
49 @param OffsetY The Y offset of the image regarding the Attribute.
51 @retval EFI_SUCCESS The image was fetched successfully.
52 @retval EFI_NOT_FOUND The specified image could not be found.
57 IN EDKII_PLATFORM_LOGO_PROTOCOL
*This
,
58 IN OUT UINT32
*Instance
,
59 OUT EFI_IMAGE_INPUT
*Image
,
60 OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE
*Attribute
,
66 if (Instance
== NULL
|| Image
== NULL
||
67 Attribute
== NULL
|| OffsetX
== NULL
|| OffsetY
== NULL
) {
68 return EFI_INVALID_PARAMETER
;
72 if (Current
>= ARRAY_SIZE (mLogos
)) {
77 *Attribute
= mLogos
[Current
].Attribute
;
78 *OffsetX
= mLogos
[Current
].OffsetX
;
79 *OffsetY
= mLogos
[Current
].OffsetY
;
80 return mHiiImageEx
->GetImageEx (mHiiImageEx
, mHiiHandle
, mLogos
[Current
].ImageId
, Image
);
83 EDKII_PLATFORM_LOGO_PROTOCOL mPlatformLogo
= {
88 Entrypoint of this module.
90 This function is the entrypoint of this module. It installs the Edkii
91 Platform Logo protocol.
93 @param ImageHandle The firmware allocated handle for the EFI image.
94 @param SystemTable A pointer to the EFI System Table.
96 @retval EFI_SUCCESS The entry point is executed successfully.
102 IN EFI_HANDLE ImageHandle
,
103 IN EFI_SYSTEM_TABLE
*SystemTable
107 EFI_HII_PACKAGE_LIST_HEADER
*PackageList
;
108 EFI_HII_DATABASE_PROTOCOL
*HiiDatabase
;
111 Status
= gBS
->LocateProtocol (
112 &gEfiHiiDatabaseProtocolGuid
,
114 (VOID
**) &HiiDatabase
116 ASSERT_EFI_ERROR (Status
);
118 Status
= gBS
->LocateProtocol (
119 &gEfiHiiImageExProtocolGuid
,
121 (VOID
**) &mHiiImageEx
123 ASSERT_EFI_ERROR (Status
);
126 // Retrieve HII package list from ImageHandle
128 Status
= gBS
->OpenProtocol (
130 &gEfiHiiPackageListProtocolGuid
,
131 (VOID
**) &PackageList
,
134 EFI_OPEN_PROTOCOL_GET_PROTOCOL
136 if (EFI_ERROR (Status
)) {
137 DEBUG ((DEBUG_ERROR
, "HII Image Package with logo not found in PE/COFF resource section\n"));
142 // Publish HII package list to HII Database.
144 Status
= HiiDatabase
->NewPackageList (
150 if (!EFI_ERROR (Status
)) {
152 Status
= gBS
->InstallMultipleProtocolInterfaces (
154 &gEdkiiPlatformLogoProtocolGuid
, &mPlatformLogo
,