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