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