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