]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/ConPlatformDxe/ComponentName.c
Add compiler hint of "GLOBAL_REMOVE_IF_UNREFERENCED" to prevent static unicode string...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ComponentName.c
CommitLineData
95276127 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
20//\r
21// Include common header file for this module.\r
22//\r
23\r
24\r
859b72fa 25#include <ConPlatform.h>\r
95276127 26\r
27//\r
28// EFI Component Name Protocol\r
29//\r
1307dcd7 30GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName = {\r
95276127 31 ConPlatformComponentNameGetDriverName,\r
32 ConPlatformComponentNameGetControllerName,\r
33 "eng"\r
1307dcd7 34};\r
5bca971e 35\r
36//\r
37// EFI Component Name 2 Protocol\r
38//\r
1307dcd7 39GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2 = {\r
5bca971e 40 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConPlatformComponentNameGetDriverName,\r
41 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConPlatformComponentNameGetControllerName,\r
42 "en"\r
1307dcd7 43};\r
5bca971e 44\r
95276127 45\r
d1aeb0bd 46GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {\r
95276127 47 {\r
5bca971e 48 "eng;en",\r
95276127 49 L"Platform Console Management Driver"\r
50 },\r
51 {\r
52 NULL,\r
53 NULL\r
54 }\r
55};\r
56\r
5bca971e 57/**\r
58 Retrieves a Unicode string that is the user readable name of the driver.\r
59\r
60 This function retrieves the user readable name of a driver in the form of a\r
61 Unicode string. If the driver specified by This has a user readable name in\r
62 the language specified by Language, then a pointer to the driver name is\r
63 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
64 by This does not support the language specified by Language,\r
65 then EFI_UNSUPPORTED is returned.\r
66\r
67 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
68 EFI_COMPONENT_NAME_PROTOCOL instance.\r
69\r
70 @param Language[in] A pointer to a Null-terminated ASCII string\r
71 array indicating the language. This is the\r
72 language of the driver name that the caller is\r
73 requesting, and it must match one of the\r
74 languages specified in SupportedLanguages. The\r
75 number of languages supported by a driver is up\r
76 to the driver writer. Language is specified\r
77 in RFC 3066 or ISO 639-2 language code format.\r
78\r
79 @param DriverName[out] A pointer to the Unicode string to return.\r
80 This Unicode string is the name of the\r
81 driver specified by This in the language\r
82 specified by Language.\r
83\r
84 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
85 This and the language specified by Language was\r
86 returned in DriverName.\r
87\r
88 @retval EFI_INVALID_PARAMETER Language is NULL.\r
89\r
90 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
91\r
92 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
93 the language specified by Language.\r
94\r
95**/\r
95276127 96EFI_STATUS\r
97EFIAPI\r
98ConPlatformComponentNameGetDriverName (\r
99 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
100 IN CHAR8 *Language,\r
101 OUT CHAR16 **DriverName\r
102 )\r
95276127 103{\r
5bca971e 104 return LookupUnicodeString2 (\r
95276127 105 Language,\r
5bca971e 106 This->SupportedLanguages,\r
95276127 107 mConPlatformDriverNameTable,\r
5bca971e 108 DriverName,\r
109 (BOOLEAN)(This == &gConPlatformComponentName)\r
95276127 110 );\r
111}\r
112\r
5bca971e 113/**\r
114 Retrieves a Unicode string that is the user readable name of the controller\r
115 that is being managed by a driver.\r
116\r
117 This function retrieves the user readable name of the controller specified by\r
118 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
119 driver specified by This has a user readable name in the language specified by\r
120 Language, then a pointer to the controller name is returned in ControllerName,\r
121 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
122 managing the controller specified by ControllerHandle and ChildHandle,\r
123 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
124 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
125\r
126 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
127 EFI_COMPONENT_NAME_PROTOCOL instance.\r
128\r
129 @param ControllerHandle[in] The handle of a controller that the driver\r
130 specified by This is managing. This handle\r
131 specifies the controller whose name is to be\r
132 returned.\r
133\r
134 @param ChildHandle[in] The handle of the child controller to retrieve\r
135 the name of. This is an optional parameter that\r
136 may be NULL. It will be NULL for device\r
137 drivers. It will also be NULL for a bus drivers\r
138 that wish to retrieve the name of the bus\r
139 controller. It will not be NULL for a bus\r
140 driver that wishes to retrieve the name of a\r
141 child controller.\r
142\r
143 @param Language[in] A pointer to a Null-terminated ASCII string\r
144 array indicating the language. This is the\r
145 language of the driver name that the caller is\r
146 requesting, and it must match one of the\r
147 languages specified in SupportedLanguages. The\r
148 number of languages supported by a driver is up\r
149 to the driver writer. Language is specified in\r
150 RFC 3066 or ISO 639-2 language code format.\r
151\r
152 @param ControllerName[out] A pointer to the Unicode string to return.\r
153 This Unicode string is the name of the\r
154 controller specified by ControllerHandle and\r
155 ChildHandle in the language specified by\r
156 Language from the point of view of the driver\r
157 specified by This.\r
158\r
159 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
160 the language specified by Language for the\r
161 driver specified by This was returned in\r
162 DriverName.\r
163\r
164 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
165\r
166 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
167 EFI_HANDLE.\r
168\r
169 @retval EFI_INVALID_PARAMETER Language is NULL.\r
170\r
171 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
172\r
173 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
174 managing the controller specified by\r
175 ControllerHandle and ChildHandle.\r
176\r
177 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
178 the language specified by Language.\r
179\r
180**/\r
95276127 181EFI_STATUS\r
182EFIAPI\r
183ConPlatformComponentNameGetControllerName (\r
184 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
185 IN EFI_HANDLE ControllerHandle,\r
186 IN EFI_HANDLE ChildHandle OPTIONAL,\r
187 IN CHAR8 *Language,\r
188 OUT CHAR16 **ControllerName\r
189 )\r
95276127 190{\r
191 return EFI_UNSUPPORTED;\r
192}\r