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