]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c
Add compiler hint of "GLOBAL_REMOVE_IF_UNREFERENCED" to prevent static unicode string...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / ComponentName.c
CommitLineData
8a67d61d 1/** @file\r
2\r
3Copyright (c) 2005 - 2007, 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\r
22#include "MnpDriver.h"\r
23\r
24//\r
25// EFI Component Name Functions\r
26//\r
83cbd279 27/**\r
28 Retrieves a Unicode string that is the user readable name of the driver.\r
29\r
30 This function retrieves the user readable name of a driver in the form of a\r
31 Unicode string. If the driver specified by This has a user readable name in\r
32 the language specified by Language, then a pointer to the driver name is\r
33 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
34 by This does not support the language specified by Language,\r
35 then EFI_UNSUPPORTED is returned.\r
36\r
37 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
38 EFI_COMPONENT_NAME_PROTOCOL instance.\r
39\r
40 @param Language[in] A pointer to a Null-terminated ASCII string\r
41 array indicating the language. This is the\r
42 language of the driver name that the caller is\r
43 requesting, and it must match one of the\r
44 languages specified in SupportedLanguages. The\r
45 number of languages supported by a driver is up\r
46 to the driver writer. Language is specified\r
47 in RFC 3066 or ISO 639-2 language code format.\r
48\r
49 @param DriverName[out] A pointer to the Unicode string to return.\r
50 This Unicode string is the name of the\r
51 driver specified by This in the language\r
52 specified by Language.\r
53\r
54 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
55 This and the language specified by Language was\r
56 returned in DriverName.\r
57\r
58 @retval EFI_INVALID_PARAMETER Language is NULL.\r
59\r
60 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
61\r
62 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
63 the language specified by Language.\r
64\r
65**/\r
8a67d61d 66EFI_STATUS\r
67EFIAPI\r
68MnpComponentNameGetDriverName (\r
69 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
70 IN CHAR8 *Language,\r
71 OUT CHAR16 **DriverName\r
72 );\r
73\r
83cbd279 74\r
75/**\r
76 Retrieves a Unicode string that is the user readable name of the controller\r
77 that is being managed by a driver.\r
78\r
79 This function retrieves the user readable name of the controller specified by\r
80 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
81 driver specified by This has a user readable name in the language specified by\r
82 Language, then a pointer to the controller name is returned in ControllerName,\r
83 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
84 managing the controller specified by ControllerHandle and ChildHandle,\r
85 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
86 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
87\r
88 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
89 EFI_COMPONENT_NAME_PROTOCOL instance.\r
90\r
91 @param ControllerHandle[in] The handle of a controller that the driver\r
92 specified by This is managing. This handle\r
93 specifies the controller whose name is to be\r
94 returned.\r
95\r
96 @param ChildHandle[in] The handle of the child controller to retrieve\r
97 the name of. This is an optional parameter that\r
98 may be NULL. It will be NULL for device\r
99 drivers. It will also be NULL for a bus drivers\r
100 that wish to retrieve the name of the bus\r
101 controller. It will not be NULL for a bus\r
102 driver that wishes to retrieve the name of a\r
103 child controller.\r
104\r
105 @param Language[in] A pointer to a Null-terminated ASCII string\r
106 array indicating the language. This is the\r
107 language of the driver name that the caller is\r
108 requesting, and it must match one of the\r
109 languages specified in SupportedLanguages. The\r
110 number of languages supported by a driver is up\r
111 to the driver writer. Language is specified in\r
112 RFC 3066 or ISO 639-2 language code format.\r
113\r
114 @param ControllerName[out] A pointer to the Unicode string to return.\r
115 This Unicode string is the name of the\r
116 controller specified by ControllerHandle and\r
117 ChildHandle in the language specified by\r
118 Language from the point of view of the driver\r
119 specified by This.\r
120\r
121 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
122 the language specified by Language for the\r
123 driver specified by This was returned in\r
124 DriverName.\r
125\r
126 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
127\r
128 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
129 EFI_HANDLE.\r
130\r
131 @retval EFI_INVALID_PARAMETER Language is NULL.\r
132\r
133 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
134\r
135 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
136 managing the controller specified by\r
137 ControllerHandle and ChildHandle.\r
138\r
139 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
140 the language specified by Language.\r
141\r
142**/\r
8a67d61d 143EFI_STATUS\r
144EFIAPI\r
145MnpComponentNameGetControllerName (\r
146 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
147 IN EFI_HANDLE ControllerHandle,\r
148 IN EFI_HANDLE ChildHandle OPTIONAL,\r
149 IN CHAR8 *Language,\r
150 OUT CHAR16 **ControllerName\r
151 );\r
152\r
83cbd279 153\r
8a67d61d 154//\r
155// EFI Component Name Protocol\r
156//\r
1307dcd7 157GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gMnpComponentName = {\r
8a67d61d 158 MnpComponentNameGetDriverName,\r
159 MnpComponentNameGetControllerName,\r
160 "eng"\r
1307dcd7 161};\r
83cbd279 162\r
163//\r
164// EFI Component Name 2 Protocol\r
165//\r
1307dcd7 166GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gMnpComponentName2 = {\r
83cbd279 167 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) MnpComponentNameGetDriverName,\r
168 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) MnpComponentNameGetControllerName,\r
169 "en"\r
1307dcd7 170};\r
83cbd279 171\r
8a67d61d 172\r
d1aeb0bd 173GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mMnpDriverNameTable[] = {\r
8a67d61d 174 {\r
83cbd279 175 "eng;en",\r
8a67d61d 176 L"MNP Network Service Driver"\r
177 },\r
178 {\r
179 NULL,\r
180 NULL\r
181 }\r
182};\r
183\r
83cbd279 184/**\r
185 Retrieves a Unicode string that is the user readable name of the driver.\r
186\r
187 This function retrieves the user readable name of a driver in the form of a\r
188 Unicode string. If the driver specified by This has a user readable name in\r
189 the language specified by Language, then a pointer to the driver name is\r
190 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
191 by This does not support the language specified by Language,\r
192 then EFI_UNSUPPORTED is returned.\r
193\r
194 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
195 EFI_COMPONENT_NAME_PROTOCOL instance.\r
196\r
197 @param Language[in] A pointer to a Null-terminated ASCII string\r
198 array indicating the language. This is the\r
199 language of the driver name that the caller is\r
200 requesting, and it must match one of the\r
201 languages specified in SupportedLanguages. The\r
202 number of languages supported by a driver is up\r
203 to the driver writer. Language is specified\r
204 in RFC 3066 or ISO 639-2 language code format.\r
205\r
206 @param DriverName[out] A pointer to the Unicode string to return.\r
207 This Unicode string is the name of the\r
208 driver specified by This in the language\r
209 specified by Language.\r
210\r
211 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
212 This and the language specified by Language was\r
213 returned in DriverName.\r
214\r
215 @retval EFI_INVALID_PARAMETER Language is NULL.\r
216\r
217 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
218\r
219 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
220 the language specified by Language.\r
221\r
222**/\r
8a67d61d 223EFI_STATUS\r
224EFIAPI\r
225MnpComponentNameGetDriverName (\r
226 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
227 IN CHAR8 *Language,\r
228 OUT CHAR16 **DriverName\r
229 )\r
8a67d61d 230{\r
83cbd279 231 return LookupUnicodeString2 (\r
232 Language,\r
233 This->SupportedLanguages,\r
234 mMnpDriverNameTable,\r
235 DriverName,\r
236 (BOOLEAN)(This == &gMnpComponentName)\r
237 );\r
8a67d61d 238}\r
239\r
83cbd279 240/**\r
241 Retrieves a Unicode string that is the user readable name of the controller\r
242 that is being managed by a driver.\r
243\r
244 This function retrieves the user readable name of the controller specified by\r
245 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
246 driver specified by This has a user readable name in the language specified by\r
247 Language, then a pointer to the controller name is returned in ControllerName,\r
248 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
249 managing the controller specified by ControllerHandle and ChildHandle,\r
250 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
251 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
252\r
253 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
254 EFI_COMPONENT_NAME_PROTOCOL instance.\r
255\r
256 @param ControllerHandle[in] The handle of a controller that the driver\r
257 specified by This is managing. This handle\r
258 specifies the controller whose name is to be\r
259 returned.\r
260\r
261 @param ChildHandle[in] The handle of the child controller to retrieve\r
262 the name of. This is an optional parameter that\r
263 may be NULL. It will be NULL for device\r
264 drivers. It will also be NULL for a bus drivers\r
265 that wish to retrieve the name of the bus\r
266 controller. It will not be NULL for a bus\r
267 driver that wishes to retrieve the name of a\r
268 child controller.\r
269\r
270 @param Language[in] A pointer to a Null-terminated ASCII string\r
271 array indicating the language. This is the\r
272 language of the driver name that the caller is\r
273 requesting, and it must match one of the\r
274 languages specified in SupportedLanguages. The\r
275 number of languages supported by a driver is up\r
276 to the driver writer. Language is specified in\r
277 RFC 3066 or ISO 639-2 language code format.\r
278\r
279 @param ControllerName[out] A pointer to the Unicode string to return.\r
280 This Unicode string is the name of the\r
281 controller specified by ControllerHandle and\r
282 ChildHandle in the language specified by\r
283 Language from the point of view of the driver\r
284 specified by This.\r
285\r
286 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
287 the language specified by Language for the\r
288 driver specified by This was returned in\r
289 DriverName.\r
290\r
291 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
292\r
293 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
294 EFI_HANDLE.\r
295\r
296 @retval EFI_INVALID_PARAMETER Language is NULL.\r
297\r
298 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
299\r
300 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
301 managing the controller specified by\r
302 ControllerHandle and ChildHandle.\r
303\r
304 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
305 the language specified by Language.\r
306\r
307**/\r
8a67d61d 308EFI_STATUS\r
309EFIAPI\r
310MnpComponentNameGetControllerName (\r
311 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
312 IN EFI_HANDLE ControllerHandle,\r
313 IN EFI_HANDLE ChildHandle OPTIONAL,\r
314 IN CHAR8 *Language,\r
315 OUT CHAR16 **ControllerName\r
316 )\r
8a67d61d 317{\r
318 return EFI_UNSUPPORTED;\r
319}\r