]>
Commit | Line | Data |
---|---|---|
ef7df998 LG |
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 | |
cd5ebaa0 HT |
7 | Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r |
8 | This program and the accompanying materials\r | |
ef7df998 LG |
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 | |
33 | EFI_HII_FONT_PROTOCOL *gHiiFont = NULL;\r | |
34 | \r | |
35 | ///\r | |
36 | /// Pointer to the UEFI HII String Protocol\r | |
37 | ///\r | |
38 | EFI_HII_STRING_PROTOCOL *gHiiString = NULL;\r | |
39 | \r | |
40 | ///\r | |
41 | /// Pointer to the UEFI HII Image Protocol\r | |
42 | ///\r | |
43 | EFI_HII_IMAGE_PROTOCOL *gHiiImage = NULL;\r | |
44 | \r | |
45 | ///\r | |
46 | /// Pointer to the UEFI HII Database Protocol\r | |
47 | ///\r | |
48 | EFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL;\r | |
49 | \r | |
50 | ///\r | |
51 | /// Pointer to the UEFI HII Config Rounting Protocol\r | |
52 | ///\r | |
53 | EFI_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 | |
75 | EFI_STATUS\r | |
76 | EFIAPI\r | |
77 | UefiHiiServicesLibConstructor (\r | |
78 | IN EFI_HANDLE ImageHandle,\r | |
79 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
80 | )\r | |
81 | {\r | |
d6a6483c LG |
82 | EFI_STATUS Status;\r |
83 | \r | |
ef7df998 | 84 | //\r |
d6a6483c | 85 | // Retrieve the pointer to the UEFI HII String Protocol \r |
ef7df998 | 86 | //\r |
d6a6483c LG |
87 | Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gHiiString);\r |
88 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
89 | \r |
90 | //\r | |
d6a6483c | 91 | // Retrieve the pointer to the UEFI HII Database Protocol \r |
ef7df998 | 92 | //\r |
d6a6483c LG |
93 | Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);\r |
94 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
95 | \r |
96 | //\r | |
d6a6483c | 97 | // Retrieve the pointer to the UEFI HII Config Routing Protocol \r |
ef7df998 | 98 | //\r |
d6a6483c LG |
99 | Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &gHiiConfigRouting);\r |
100 | ASSERT_EFI_ERROR (Status);\r | |
ef7df998 LG |
101 | \r |
102 | //\r | |
d6a6483c | 103 | // Retrieve the pointer to the optional UEFI HII Font Protocol \r |
ef7df998 | 104 | //\r |
d6a6483c | 105 | gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &gHiiFont);\r |
ef7df998 LG |
106 | \r |
107 | //\r | |
d6a6483c | 108 | // Retrieve the pointer to the optional UEFI HII Image Protocol \r |
ef7df998 | 109 | //\r |
d6a6483c | 110 | gBS->LocateProtocol (&gEfiHiiImageProtocolGuid, NULL, (VOID **) &gHiiImage);\r |
ef7df998 LG |
111 | \r |
112 | return EFI_SUCCESS;\r | |
113 | }\r |