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