]>
Commit | Line | Data |
---|---|---|
ef7df998 | 1 | /** @file\r |
d1102dba LG |
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 | |
ef7df998 | 6 | \r |
d1102dba | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
ef7df998 LG |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #include <Uefi.h>\r | |
13 | \r | |
14 | #include <Library/UefiHiiServicesLib.h>\r | |
15 | #include <Library/UefiBootServicesTableLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | \r | |
18 | #include <Protocol/HiiFont.h>\r | |
19 | #include <Protocol/HiiString.h>\r | |
20 | #include <Protocol/HiiImage.h>\r | |
21 | #include <Protocol/HiiDatabase.h>\r | |
22 | #include <Protocol/HiiConfigRouting.h>\r | |
23 | \r | |
24 | ///\r | |
25 | /// Pointer to the UEFI HII Font Protocol\r | |
26 | ///\r | |
27 | EFI_HII_FONT_PROTOCOL *gHiiFont = NULL;\r | |
28 | \r | |
29 | ///\r | |
30 | /// Pointer to the UEFI HII String Protocol\r | |
31 | ///\r | |
32 | EFI_HII_STRING_PROTOCOL *gHiiString = NULL;\r | |
33 | \r | |
34 | ///\r | |
35 | /// Pointer to the UEFI HII Image Protocol\r | |
36 | ///\r | |
37 | EFI_HII_IMAGE_PROTOCOL *gHiiImage = NULL;\r | |
38 | \r | |
39 | ///\r | |
40 | /// Pointer to the UEFI HII Database Protocol\r | |
41 | ///\r | |
42 | EFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL;\r | |
43 | \r | |
44 | ///\r | |
45 | /// Pointer to the UEFI HII Config Rounting Protocol\r | |
46 | ///\r | |
47 | EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting = NULL;\r | |
48 | \r | |
49 | /**\r | |
50 | The constructor function retrieves pointers to the UEFI HII protocol instances\r | |
d1102dba LG |
51 | \r |
52 | The constructor function retrieves pointers to the four UEFI HII protocols from the\r | |
53 | handle database. These include the UEFI HII Font Protocol, the UEFI HII String\r | |
54 | Protocol, the UEFI HII Image Protocol, the UEFI HII Database Protocol, and the\r | |
ef7df998 LG |
55 | UEFI HII Config Routing Protocol. This function always return EFI_SUCCESS.\r |
56 | All of these protocols are optional if the platform does not support configuration\r | |
d1102dba | 57 | and the UEFI HII Image Protocol and the UEFI HII Font Protocol are optional if\r |
ef7df998 LG |
58 | the platform does not support a graphical console. As a result, the consumers\r |
59 | of this library much check the protocol pointers againt NULL before using them,\r | |
60 | or use dependency expressions to guarantee that some of them are present before\r | |
61 | assuming they are not NULL.\r | |
62 | \r | |
63 | @param ImageHandle The firmware allocated handle for the EFI image.\r | |
64 | @param SystemTable A pointer to the EFI System Table.\r | |
65 | \r | |
66 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
67 | \r | |
68 | **/\r | |
69 | EFI_STATUS\r | |
70 | EFIAPI\r | |
71 | UefiHiiServicesLibConstructor (\r | |
72 | IN EFI_HANDLE ImageHandle,\r | |
73 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
74 | )\r | |
75 | {\r | |
d6a6483c LG |
76 | EFI_STATUS Status;\r |
77 | \r | |
ef7df998 | 78 | //\r |
d1102dba | 79 | // Retrieve the pointer to the UEFI HII String Protocol\r |
ef7df998 | 80 | //\r |
d6a6483c LG |
81 | Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gHiiString);\r |
82 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
83 | \r |
84 | //\r | |
d1102dba | 85 | // Retrieve the pointer to the UEFI HII Database Protocol\r |
ef7df998 | 86 | //\r |
d6a6483c LG |
87 | Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);\r |
88 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
89 | \r |
90 | //\r | |
d1102dba | 91 | // Retrieve the pointer to the UEFI HII Config Routing Protocol\r |
ef7df998 | 92 | //\r |
d6a6483c LG |
93 | Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &gHiiConfigRouting);\r |
94 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
95 | \r |
96 | //\r | |
d1102dba | 97 | // Retrieve the pointer to the optional UEFI HII Font Protocol\r |
ef7df998 | 98 | //\r |
d6a6483c | 99 | gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &gHiiFont);\r |
ef7df998 LG |
100 | \r |
101 | //\r | |
d1102dba | 102 | // Retrieve the pointer to the optional UEFI HII Image Protocol\r |
ef7df998 | 103 | //\r |
d6a6483c | 104 | gBS->LocateProtocol (&gEfiHiiImageProtocolGuid, NULL, (VOID **) &gHiiImage);\r |
ef7df998 LG |
105 | \r |
106 | return EFI_SUCCESS;\r | |
107 | }\r |