]> git.proxmox.com Git - mirror_edk2.git/blame - FatPkg/EnhancedFatDxe/ComponentName.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / ComponentName.c
CommitLineData
cae7420b 1/** @file\r
b9ec9330 2\r
f9756705 3Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
eb6cb4ce 4SPDX-License-Identifier: BSD-2-Clause-Patent\r
b9ec9330
QH
5\r
6\r
cae7420b 7**/\r
b9ec9330
QH
8\r
9#include "Fat.h"\r
10\r
11//\r
12// EFI Component Name Functions\r
13//\r
bcdcc416 14\r
b9ec9330
QH
15/**\r
16 Retrieves a Unicode string that is the user readable name of the driver.\r
17\r
18 This function retrieves the user readable name of a driver in the form of a\r
19 Unicode string. If the driver specified by This has a user readable name in\r
20 the language specified by Language, then a pointer to the driver name is\r
21 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
22 by This does not support the language specified by Language,\r
23 then EFI_UNSUPPORTED is returned.\r
24\r
25 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
26 EFI_COMPONENT_NAME_PROTOCOL instance.\r
27\r
28 @param Language[in] A pointer to a Null-terminated ASCII string\r
29 array indicating the language. This is the\r
30 language of the driver name that the caller is\r
31 requesting, and it must match one of the\r
32 languages specified in SupportedLanguages. The\r
33 number of languages supported by a driver is up\r
34 to the driver writer. Language is specified\r
a13db369 35 in RFC 4646 or ISO 639-2 language code format.\r
b9ec9330
QH
36\r
37 @param DriverName[out] A pointer to the Unicode string to return.\r
38 This Unicode string is the name of the\r
39 driver specified by This in the language\r
40 specified by Language.\r
41\r
42 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
43 This and the language specified by Language was\r
44 returned in DriverName.\r
45\r
46 @retval EFI_INVALID_PARAMETER Language is NULL.\r
47\r
48 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
49\r
50 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
51 the language specified by Language.\r
52\r
53**/\r
54EFI_STATUS\r
55EFIAPI\r
56FatComponentNameGetDriverName (\r
57 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
58 IN CHAR8 *Language,\r
59 OUT CHAR16 **DriverName\r
60 );\r
61\r
b9ec9330
QH
62/**\r
63 Retrieves a Unicode string that is the user readable name of the controller\r
64 that is being managed by a driver.\r
65\r
66 This function retrieves the user readable name of the controller specified by\r
67 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
68 driver specified by This has a user readable name in the language specified by\r
69 Language, then a pointer to the controller name is returned in ControllerName,\r
70 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
71 managing the controller specified by ControllerHandle and ChildHandle,\r
72 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
73 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
74\r
75 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
76 EFI_COMPONENT_NAME_PROTOCOL instance.\r
77\r
78 @param ControllerHandle[in] The handle of a controller that the driver\r
79 specified by This is managing. This handle\r
80 specifies the controller whose name is to be\r
81 returned.\r
82\r
83 @param ChildHandle[in] The handle of the child controller to retrieve\r
84 the name of. This is an optional parameter that\r
85 may be NULL. It will be NULL for device\r
86 drivers. It will also be NULL for a bus drivers\r
87 that wish to retrieve the name of the bus\r
88 controller. It will not be NULL for a bus\r
89 driver that wishes to retrieve the name of a\r
90 child controller.\r
91\r
92 @param Language[in] A pointer to a Null-terminated ASCII string\r
93 array indicating the language. This is the\r
94 language of the driver name that the caller is\r
95 requesting, and it must match one of the\r
96 languages specified in SupportedLanguages. The\r
97 number of languages supported by a driver is up\r
98 to the driver writer. Language is specified in\r
a13db369 99 RFC 4646 or ISO 639-2 language code format.\r
b9ec9330
QH
100\r
101 @param ControllerName[out] A pointer to the Unicode string to return.\r
102 This Unicode string is the name of the\r
103 controller specified by ControllerHandle and\r
104 ChildHandle in the language specified by\r
105 Language from the point of view of the driver\r
106 specified by This.\r
107\r
108 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
109 the language specified by Language for the\r
110 driver specified by This was returned in\r
111 DriverName.\r
112\r
f9756705 113 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
b9ec9330
QH
114\r
115 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
116 EFI_HANDLE.\r
117\r
118 @retval EFI_INVALID_PARAMETER Language is NULL.\r
119\r
120 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
121\r
122 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
123 managing the controller specified by\r
124 ControllerHandle and ChildHandle.\r
125\r
126 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
127 the language specified by Language.\r
128\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132FatComponentNameGetControllerName (\r
bcdcc416
MK
133 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
134 IN EFI_HANDLE ControllerHandle,\r
135 IN EFI_HANDLE ChildHandle OPTIONAL,\r
136 IN CHAR8 *Language,\r
137 OUT CHAR16 **ControllerName\r
b9ec9330
QH
138 );\r
139\r
140//\r
141// EFI Component Name Protocol\r
142//\r
143GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gFatComponentName = {\r
144 FatComponentNameGetDriverName,\r
145 FatComponentNameGetControllerName,\r
146 "eng"\r
147};\r
148\r
149//\r
150// EFI Component Name 2 Protocol\r
151//\r
bcdcc416
MK
152GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gFatComponentName2 = {\r
153 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)FatComponentNameGetDriverName,\r
154 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)FatComponentNameGetControllerName,\r
b9ec9330
QH
155 "en"\r
156};\r
157\r
bcdcc416 158GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatDriverNameTable[] = {\r
b9ec9330
QH
159 {\r
160 "eng;en",\r
161 L"FAT File System Driver"\r
162 },\r
163 {\r
164 NULL,\r
165 NULL\r
166 }\r
167};\r
168\r
bcdcc416 169GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mFatControllerNameTable[] = {\r
b9ec9330
QH
170 {\r
171 "eng;en",\r
172 L"FAT File System"\r
173 },\r
174 {\r
175 NULL,\r
176 NULL\r
177 }\r
178};\r
179\r
b9ec9330
QH
180/**\r
181 Retrieves a Unicode string that is the user readable name of the driver.\r
182\r
183 This function retrieves the user readable name of a driver in the form of a\r
184 Unicode string. If the driver specified by This has a user readable name in\r
185 the language specified by Language, then a pointer to the driver name is\r
186 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
187 by This does not support the language specified by Language,\r
188 then EFI_UNSUPPORTED is returned.\r
189\r
190 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
191 EFI_COMPONENT_NAME_PROTOCOL instance.\r
192\r
193 @param Language[in] A pointer to a Null-terminated ASCII string\r
194 array indicating the language. This is the\r
195 language of the driver name that the caller is\r
196 requesting, and it must match one of the\r
197 languages specified in SupportedLanguages. The\r
198 number of languages supported by a driver is up\r
199 to the driver writer. Language is specified\r
a13db369 200 in RFC 4646 or ISO 639-2 language code format.\r
b9ec9330
QH
201\r
202 @param DriverName[out] A pointer to the Unicode string to return.\r
203 This Unicode string is the name of the\r
204 driver specified by This in the language\r
205 specified by Language.\r
206\r
207 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
208 This and the language specified by Language was\r
209 returned in DriverName.\r
210\r
211 @retval EFI_INVALID_PARAMETER Language is NULL.\r
212\r
213 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
214\r
215 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
216 the language specified by Language.\r
217\r
218**/\r
219EFI_STATUS\r
220EFIAPI\r
221FatComponentNameGetDriverName (\r
222 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
223 IN CHAR8 *Language,\r
224 OUT CHAR16 **DriverName\r
225 )\r
226{\r
227 return LookupUnicodeString2 (\r
228 Language,\r
229 This->SupportedLanguages,\r
230 mFatDriverNameTable,\r
231 DriverName,\r
232 (BOOLEAN)(This == &gFatComponentName)\r
233 );\r
234}\r
235\r
236/**\r
237 Retrieves a Unicode string that is the user readable name of the controller\r
238 that is being managed by a driver.\r
239\r
240 This function retrieves the user readable name of the controller specified by\r
241 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
242 driver specified by This has a user readable name in the language specified by\r
243 Language, then a pointer to the controller name is returned in ControllerName,\r
244 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
245 managing the controller specified by ControllerHandle and ChildHandle,\r
246 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
247 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
248\r
249 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
250 EFI_COMPONENT_NAME_PROTOCOL instance.\r
251\r
252 @param ControllerHandle[in] The handle of a controller that the driver\r
253 specified by This is managing. This handle\r
254 specifies the controller whose name is to be\r
255 returned.\r
256\r
257 @param ChildHandle[in] The handle of the child controller to retrieve\r
258 the name of. This is an optional parameter that\r
259 may be NULL. It will be NULL for device\r
260 drivers. It will also be NULL for a bus drivers\r
261 that wish to retrieve the name of the bus\r
262 controller. It will not be NULL for a bus\r
263 driver that wishes to retrieve the name of a\r
264 child controller.\r
265\r
266 @param Language[in] A pointer to a Null-terminated ASCII string\r
267 array indicating the language. This is the\r
268 language of the driver name that the caller is\r
269 requesting, and it must match one of the\r
270 languages specified in SupportedLanguages. The\r
271 number of languages supported by a driver is up\r
272 to the driver writer. Language is specified in\r
a13db369 273 RFC 4646 or ISO 639-2 language code format.\r
b9ec9330
QH
274\r
275 @param ControllerName[out] A pointer to the Unicode string to return.\r
276 This Unicode string is the name of the\r
277 controller specified by ControllerHandle and\r
278 ChildHandle in the language specified by\r
279 Language from the point of view of the driver\r
280 specified by This.\r
281\r
282 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
283 the language specified by Language for the\r
284 driver specified by This was returned in\r
285 DriverName.\r
286\r
f9756705 287 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
b9ec9330
QH
288\r
289 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
290 EFI_HANDLE.\r
291\r
292 @retval EFI_INVALID_PARAMETER Language is NULL.\r
293\r
294 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
295\r
296 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
297 managing the controller specified by\r
298 ControllerHandle and ChildHandle.\r
299\r
300 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
301 the language specified by Language.\r
302\r
303**/\r
304EFI_STATUS\r
305EFIAPI\r
306FatComponentNameGetControllerName (\r
bcdcc416
MK
307 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
308 IN EFI_HANDLE ControllerHandle,\r
309 IN EFI_HANDLE ChildHandle OPTIONAL,\r
310 IN CHAR8 *Language,\r
311 OUT CHAR16 **ControllerName\r
b9ec9330
QH
312 )\r
313{\r
314 EFI_STATUS Status;\r
315\r
316 //\r
317 // This is a device driver, so ChildHandle must be NULL.\r
318 //\r
319 if (ChildHandle != NULL) {\r
320 return EFI_UNSUPPORTED;\r
321 }\r
322\r
323 //\r
324 // Make sure this driver is currently managing ControllHandle\r
325 //\r
326 Status = EfiTestManagedDevice (\r
327 ControllerHandle,\r
328 gFatDriverBinding.DriverBindingHandle,\r
329 &gEfiDiskIoProtocolGuid\r
330 );\r
331 if (EFI_ERROR (Status)) {\r
332 return Status;\r
333 }\r
334\r
335 return LookupUnicodeString2 (\r
336 Language,\r
337 This->SupportedLanguages,\r
338 mFatControllerNameTable,\r
339 ControllerName,\r
340 (BOOLEAN)(This == &gFatComponentName)\r
341 );\r
342}\r