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