TianoCore EDK2 master
Loading...
Searching...
No Matches
Logo.c
Go to the documentation of this file.
1
8#include <Uefi.h>
11#include <Protocol/HiiImageEx.h>
15#include <Library/DebugLib.h>
16
17typedef struct {
18 EFI_IMAGE_ID ImageId;
19 EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE Attribute;
20 INTN OffsetX;
21 INTN OffsetY;
23
24EFI_HII_IMAGE_EX_PROTOCOL *mHiiImageEx;
25EFI_HII_HANDLE mHiiHandle;
26LOGO_ENTRY mLogos[] = {
27 {
28 IMAGE_TOKEN (IMG_LOGO),
29 EdkiiPlatformLogoDisplayAttributeCenter,
30 0,
31 0
32 }
33};
34
49EFIAPI
52 IN OUT UINT32 *Instance,
53 OUT EFI_IMAGE_INPUT *Image,
54 OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute,
55 OUT INTN *OffsetX,
56 OUT INTN *OffsetY
57 )
58{
59 UINT32 Current;
60
61 if ((Instance == NULL) || (Image == NULL) ||
62 (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL))
63 {
64 return EFI_INVALID_PARAMETER;
65 }
66
67 Current = *Instance;
68 if (Current >= ARRAY_SIZE (mLogos)) {
69 return EFI_NOT_FOUND;
70 }
71
72 (*Instance)++;
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);
77}
78
79EDKII_PLATFORM_LOGO_PROTOCOL mPlatformLogo = {
81};
82
96EFIAPI
98 IN EFI_HANDLE ImageHandle,
99 IN EFI_SYSTEM_TABLE *SystemTable
100 )
101{
102 EFI_STATUS Status;
103 EFI_HII_PACKAGE_LIST_HEADER *PackageList;
104 EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
105 EFI_HANDLE Handle;
106
107 Status = gBS->LocateProtocol (
108 &gEfiHiiDatabaseProtocolGuid,
109 NULL,
110 (VOID **)&HiiDatabase
111 );
112 ASSERT_EFI_ERROR (Status);
113
114 Status = gBS->LocateProtocol (
115 &gEfiHiiImageExProtocolGuid,
116 NULL,
117 (VOID **)&mHiiImageEx
118 );
119 ASSERT_EFI_ERROR (Status);
120
121 //
122 // Retrieve HII package list from ImageHandle
123 //
124 Status = gBS->OpenProtocol (
125 ImageHandle,
126 &gEfiHiiPackageListProtocolGuid,
127 (VOID **)&PackageList,
128 ImageHandle,
129 NULL,
130 EFI_OPEN_PROTOCOL_GET_PROTOCOL
131 );
132 if (EFI_ERROR (Status)) {
133 DEBUG ((DEBUG_ERROR, "HII Image Package with logo not found in PE/COFF resource section\n"));
134 return Status;
135 }
136
137 //
138 // Publish HII package list to HII Database.
139 //
140 Status = HiiDatabase->NewPackageList (
141 HiiDatabase,
142 PackageList,
143 NULL,
144 &mHiiHandle
145 );
146 if (!EFI_ERROR (Status)) {
147 Handle = NULL;
148 Status = gBS->InstallMultipleProtocolInterfaces (
149 &Handle,
150 &gEdkiiPlatformLogoProtocolGuid,
151 &mPlatformLogo,
152 NULL
153 );
154 }
155
156 return Status;
157}
INT64 INTN
EFI_STATUS EFIAPI InitializeLogo(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: Logo.c:97
EFI_STATUS EFIAPI GetImage(IN EDKII_PLATFORM_LOGO_PROTOCOL *This, IN OUT UINT32 *Instance, OUT EFI_IMAGE_INPUT *Image, OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute, OUT INTN *OffsetX, OUT INTN *OffsetY)
Definition: Logo.c:50
#define NULL
Definition: Base.h:319
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS
#define IMAGE_TOKEN(t)
VOID * EFI_HII_HANDLE