]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4Dxe/ComponentName.c
Add compiler hint of "GLOBAL_REMOVE_IF_UNREFERENCED" to prevent static unicode string...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / ComponentName.c
1 /** @file
2
3 Copyright (c) 2005 - 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
13 Module Name:
14
15 ComponentName.c
16
17 Abstract:
18
19
20 **/
21
22 #include "Ip4Impl.h"
23
24 //
25 // EFI Component Name Functions
26 //
27 /**
28 Retrieves a Unicode string that is the user readable name of the driver.
29
30 This function retrieves the user readable name of a driver in the form of a
31 Unicode string. If the driver specified by This has a user readable name in
32 the language specified by Language, then a pointer to the driver name is
33 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
34 by This does not support the language specified by Language,
35 then EFI_UNSUPPORTED is returned.
36
37 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
38 EFI_COMPONENT_NAME_PROTOCOL instance.
39
40 @param Language[in] A pointer to a Null-terminated ASCII string
41 array indicating the language. This is the
42 language of the driver name that the caller is
43 requesting, and it must match one of the
44 languages specified in SupportedLanguages. The
45 number of languages supported by a driver is up
46 to the driver writer. Language is specified
47 in RFC 3066 or ISO 639-2 language code format.
48
49 @param DriverName[out] A pointer to the Unicode string to return.
50 This Unicode string is the name of the
51 driver specified by This in the language
52 specified by Language.
53
54 @retval EFI_SUCCESS The Unicode string for the Driver specified by
55 This and the language specified by Language was
56 returned in DriverName.
57
58 @retval EFI_INVALID_PARAMETER Language is NULL.
59
60 @retval EFI_INVALID_PARAMETER DriverName is NULL.
61
62 @retval EFI_UNSUPPORTED The driver specified by This does not support
63 the language specified by Language.
64
65 **/
66 EFI_STATUS
67 EFIAPI
68 Ip4ComponentNameGetDriverName (
69 IN EFI_COMPONENT_NAME_PROTOCOL *This,
70 IN CHAR8 *Language,
71 OUT CHAR16 **DriverName
72 );
73
74
75 /**
76 Retrieves a Unicode string that is the user readable name of the controller
77 that is being managed by a driver.
78
79 This function retrieves the user readable name of the controller specified by
80 ControllerHandle and ChildHandle in the form of a Unicode string. If the
81 driver specified by This has a user readable name in the language specified by
82 Language, then a pointer to the controller name is returned in ControllerName,
83 and EFI_SUCCESS is returned. If the driver specified by This is not currently
84 managing the controller specified by ControllerHandle and ChildHandle,
85 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
86 support the language specified by Language, then EFI_UNSUPPORTED is returned.
87
88 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
89 EFI_COMPONENT_NAME_PROTOCOL instance.
90
91 @param ControllerHandle[in] The handle of a controller that the driver
92 specified by This is managing. This handle
93 specifies the controller whose name is to be
94 returned.
95
96 @param ChildHandle[in] The handle of the child controller to retrieve
97 the name of. This is an optional parameter that
98 may be NULL. It will be NULL for device
99 drivers. It will also be NULL for a bus drivers
100 that wish to retrieve the name of the bus
101 controller. It will not be NULL for a bus
102 driver that wishes to retrieve the name of a
103 child controller.
104
105 @param Language[in] A pointer to a Null-terminated ASCII string
106 array indicating the language. This is the
107 language of the driver name that the caller is
108 requesting, and it must match one of the
109 languages specified in SupportedLanguages. The
110 number of languages supported by a driver is up
111 to the driver writer. Language is specified in
112 RFC 3066 or ISO 639-2 language code format.
113
114 @param ControllerName[out] A pointer to the Unicode string to return.
115 This Unicode string is the name of the
116 controller specified by ControllerHandle and
117 ChildHandle in the language specified by
118 Language from the point of view of the driver
119 specified by This.
120
121 @retval EFI_SUCCESS The Unicode string for the user readable name in
122 the language specified by Language for the
123 driver specified by This was returned in
124 DriverName.
125
126 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
127
128 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
129 EFI_HANDLE.
130
131 @retval EFI_INVALID_PARAMETER Language is NULL.
132
133 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
134
135 @retval EFI_UNSUPPORTED The driver specified by This is not currently
136 managing the controller specified by
137 ControllerHandle and ChildHandle.
138
139 @retval EFI_UNSUPPORTED The driver specified by This does not support
140 the language specified by Language.
141
142 **/
143 EFI_STATUS
144 EFIAPI
145 Ip4ComponentNameGetControllerName (
146 IN EFI_COMPONENT_NAME_PROTOCOL *This,
147 IN EFI_HANDLE ControllerHandle,
148 IN EFI_HANDLE ChildHandle OPTIONAL,
149 IN CHAR8 *Language,
150 OUT CHAR16 **ControllerName
151 );
152
153
154 //
155 // EFI Component Name Protocol
156 //
157 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = {
158 Ip4ComponentNameGetDriverName,
159 Ip4ComponentNameGetControllerName,
160 "eng"
161 };
162
163 //
164 // EFI Component Name 2 Protocol
165 //
166 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2 = {
167 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ComponentNameGetDriverName,
168 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ComponentNameGetControllerName,
169 "en"
170 };
171
172
173 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
174 {
175 "eng;en",
176 L"IP4 Network Service Driver"
177 },
178 {
179 NULL,
180 NULL
181 }
182 };
183
184 /**
185 Retrieves a Unicode string that is the user readable name of the driver.
186
187 This function retrieves the user readable name of a driver in the form of a
188 Unicode string. If the driver specified by This has a user readable name in
189 the language specified by Language, then a pointer to the driver name is
190 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
191 by This does not support the language specified by Language,
192 then EFI_UNSUPPORTED is returned.
193
194 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
195 EFI_COMPONENT_NAME_PROTOCOL instance.
196
197 @param Language[in] A pointer to a Null-terminated ASCII string
198 array indicating the language. This is the
199 language of the driver name that the caller is
200 requesting, and it must match one of the
201 languages specified in SupportedLanguages. The
202 number of languages supported by a driver is up
203 to the driver writer. Language is specified
204 in RFC 3066 or ISO 639-2 language code format.
205
206 @param DriverName[out] A pointer to the Unicode string to return.
207 This Unicode string is the name of the
208 driver specified by This in the language
209 specified by Language.
210
211 @retval EFI_SUCCESS The Unicode string for the Driver specified by
212 This and the language specified by Language was
213 returned in DriverName.
214
215 @retval EFI_INVALID_PARAMETER Language is NULL.
216
217 @retval EFI_INVALID_PARAMETER DriverName is NULL.
218
219 @retval EFI_UNSUPPORTED The driver specified by This does not support
220 the language specified by Language.
221
222 **/
223 EFI_STATUS
224 EFIAPI
225 Ip4ComponentNameGetDriverName (
226 IN EFI_COMPONENT_NAME_PROTOCOL *This,
227 IN CHAR8 *Language,
228 OUT CHAR16 **DriverName
229 )
230 {
231 return LookupUnicodeString2 (
232 Language,
233 This->SupportedLanguages,
234 mIp4DriverNameTable,
235 DriverName,
236 (BOOLEAN)(This == &gIp4ComponentName)
237 );
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 Ip4ComponentNameGetControllerName (
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 }