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