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