]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.c
MdeModulePkg/BootLogoLib: Remove invalid if judgments
[mirror_edk2.git] / MdeModulePkg / Library / UefiHiiServicesLib / UefiHiiServicesLib.c
... / ...
CommitLineData
1/** @file\r
2 This library retrieves pointers to the UEFI HII Protocol instances in the \r
3 library's constructor. All of the UEFI HII related protocols are optional, \r
4 so the consumers of this library class must verify that the global variable \r
5 pointers are not NULL before use. \r
6\r
7 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Library/UefiHiiServicesLib.h>\r
21#include <Library/UefiBootServicesTableLib.h>\r
22#include <Library/DebugLib.h>\r
23\r
24#include <Protocol/HiiFont.h>\r
25#include <Protocol/HiiString.h>\r
26#include <Protocol/HiiImage.h>\r
27#include <Protocol/HiiDatabase.h>\r
28#include <Protocol/HiiConfigRouting.h>\r
29\r
30///\r
31/// Pointer to the UEFI HII Font Protocol\r
32///\r
33EFI_HII_FONT_PROTOCOL *gHiiFont = NULL;\r
34\r
35///\r
36/// Pointer to the UEFI HII String Protocol\r
37///\r
38EFI_HII_STRING_PROTOCOL *gHiiString = NULL;\r
39\r
40///\r
41/// Pointer to the UEFI HII Image Protocol\r
42///\r
43EFI_HII_IMAGE_PROTOCOL *gHiiImage = NULL;\r
44\r
45///\r
46/// Pointer to the UEFI HII Database Protocol\r
47///\r
48EFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL;\r
49\r
50///\r
51/// Pointer to the UEFI HII Config Rounting Protocol\r
52///\r
53EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting = NULL;\r
54\r
55/**\r
56 The constructor function retrieves pointers to the UEFI HII protocol instances\r
57 \r
58 The constructor function retrieves pointers to the four UEFI HII protocols from the \r
59 handle database. These include the UEFI HII Font Protocol, the UEFI HII String \r
60 Protocol, the UEFI HII Image Protocol, the UEFI HII Database Protocol, and the \r
61 UEFI HII Config Routing Protocol. This function always return EFI_SUCCESS.\r
62 All of these protocols are optional if the platform does not support configuration\r
63 and the UEFI HII Image Protocol and the UEFI HII Font Protocol are optional if \r
64 the platform does not support a graphical console. As a result, the consumers\r
65 of this library much check the protocol pointers againt NULL before using them,\r
66 or use dependency expressions to guarantee that some of them are present before\r
67 assuming they are not NULL.\r
68\r
69 @param ImageHandle The firmware allocated handle for the EFI image.\r
70 @param SystemTable A pointer to the EFI System Table.\r
71\r
72 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
73\r
74**/\r
75EFI_STATUS\r
76EFIAPI\r
77UefiHiiServicesLibConstructor (\r
78 IN EFI_HANDLE ImageHandle,\r
79 IN EFI_SYSTEM_TABLE *SystemTable\r
80 )\r
81{\r
82 EFI_STATUS Status;\r
83\r
84 //\r
85 // Retrieve the pointer to the UEFI HII String Protocol \r
86 //\r
87 Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gHiiString);\r
88 ASSERT_EFI_ERROR (Status);\r
89\r
90 //\r
91 // Retrieve the pointer to the UEFI HII Database Protocol \r
92 //\r
93 Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);\r
94 ASSERT_EFI_ERROR (Status);\r
95\r
96 //\r
97 // Retrieve the pointer to the UEFI HII Config Routing Protocol \r
98 //\r
99 Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &gHiiConfigRouting);\r
100 ASSERT_EFI_ERROR (Status);\r
101\r
102 //\r
103 // Retrieve the pointer to the optional UEFI HII Font Protocol \r
104 //\r
105 gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &gHiiFont);\r
106\r
107 //\r
108 // Retrieve the pointer to the optional UEFI HII Image Protocol \r
109 //\r
110 gBS->LocateProtocol (&gEfiHiiImageProtocolGuid, NULL, (VOID **) &gHiiImage);\r
111\r
112 return EFI_SUCCESS;\r
113}\r