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