1 /** @file
2   Component Name Protocol implementation for the MMC DXE driver
3 
4   Copyright (c) 2011, ARM Limited. All rights reserved.
5 
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The 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 "Mmc.h"
17 
18 //
19 // EFI Component Name Protocol
20 //
21 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gMmcComponentName = {
22   MmcGetDriverName,
23   MmcGetControllerName,
24   "eng"
25 };
26 
27 //
28 // EFI Component Name 2 Protocol
29 //
30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gMmcComponentName2 = {
31   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) MmcGetDriverName,
32   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) MmcGetControllerName,
33   "en"
34 };
35 
36 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
37 mMmcDriverNameTable[] = {
38   {"eng;en", L"MMC/SD Card Interface Driver"},
39   {NULL,  NULL}
40 };
41 
42 /**
43   Retrieves a Unicode string that is the user readable name of the driver.
44 
45   This function retrieves the user readable name of a driver in the form of a
46   Unicode string. If the driver specified by This has a user readable name in
47   the language specified by Language, then a pointer to the driver name is
48   returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
49   by This does not support the language specified by Language,
50   then EFI_UNSUPPORTED is returned.
51 
52   @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
53                                 EFI_COMPONENT_NAME_PROTOCOL instance.
54   @param  Language              A pointer to a Null-terminated ASCII string
55                                 array indicating the language. This is the
56                                 language of the driver name that the caller is
57                                 requesting, and it must match one of the
58                                 languages specified in SupportedLanguages. The
59                                 number of languages supported by a driver is up
60                                 to the driver writer. Language is specified
61                                 in RFC 4646 or ISO 639-2 language code format.
62   @param  DriverName            A pointer to the Unicode string to return.
63                                 This Unicode string is the name of the
64                                 driver specified by This in the language
65                                 specified by Language.
66 
67   @retval EFI_SUCCESS           The Unicode string for the Driver specified by
68                                 This and the language specified by Language was
69                                 returned in DriverName.
70   @retval EFI_INVALID_PARAMETER Language is NULL.
71   @retval EFI_INVALID_PARAMETER DriverName is NULL.
72   @retval EFI_UNSUPPORTED       The driver specified by This does not support
73                                 the language specified by Language.
74 
75 **/
76 EFI_STATUS
77 EFIAPI
MmcGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN CHAR8 * Language,OUT CHAR16 ** DriverName)78 MmcGetDriverName (
79   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
80   IN  CHAR8                        *Language,
81   OUT CHAR16                       **DriverName
82   )
83 {
84   return LookupUnicodeString2 (
85            Language,
86            This->SupportedLanguages,
87            mMmcDriverNameTable,
88            DriverName,
89            (BOOLEAN)(This == &gMmcComponentName)
90            );
91 }
92 
93 /**
94   Retrieves a Unicode string that is the user readable name of the controller
95   that is being managed by a driver.
96 
97   This function retrieves the user readable name of the controller specified by
98   ControllerHandle and ChildHandle in the form of a Unicode string. If the
99   driver specified by This has a user readable name in the language specified by
100   Language, then a pointer to the controller name is returned in ControllerName,
101   and EFI_SUCCESS is returned.  If the driver specified by This is not currently
102   managing the controller specified by ControllerHandle and ChildHandle,
103   then EFI_UNSUPPORTED is returned.  If the driver specified by This does not
104   support the language specified by Language, then EFI_UNSUPPORTED is returned.
105 
106   @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
107                                 EFI_COMPONENT_NAME_PROTOCOL instance.
108   @param  ControllerHandle      The handle of a controller that the driver
109                                 specified by This is managing.  This handle
110                                 specifies the controller whose name is to be
111                                 returned.
112   @param  ChildHandle           The handle of the child controller to retrieve
113                                 the name of.  This is an optional parameter that
114                                 may be NULL.  It will be NULL for device
115                                 drivers.  It will also be NULL for a bus drivers
116                                 that wish to retrieve the name of the bus
117                                 controller.  It will not be NULL for a bus
118                                 driver that wishes to retrieve the name of a
119                                 child controller.
120   @param  Language              A pointer to a Null-terminated ASCII string
121                                 array indicating the language.  This is the
122                                 language of the driver name that the caller is
123                                 requesting, and it must match one of the
124                                 languages specified in SupportedLanguages. The
125                                 number of languages supported by a driver is up
126                                 to the driver writer. Language is specified in
127                                 RFC 4646 or ISO 639-2 language code format.
128   @param  ControllerName        A pointer to the Unicode string to return.
129                                 This Unicode string is the name of the
130                                 controller specified by ControllerHandle and
131                                 ChildHandle in the language specified by
132                                 Language from the point of view of the driver
133                                 specified by This.
134 
135   @retval EFI_SUCCESS           The Unicode string for the user readable name in
136                                 the language specified by Language for the
137                                 driver specified by This was returned in
138                                 DriverName.
139   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
140   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
141                                 EFI_HANDLE.
142   @retval EFI_INVALID_PARAMETER Language is NULL.
143   @retval EFI_INVALID_PARAMETER ControllerName is NULL.
144   @retval EFI_UNSUPPORTED       The driver specified by This is not currently
145                                 managing the controller specified by
146                                 ControllerHandle and ChildHandle.
147   @retval EFI_UNSUPPORTED       The driver specified by This does not support
148                                 the language specified by Language.
149 
150 **/
151 EFI_STATUS
152 EFIAPI
MmcGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)153 MmcGetControllerName (
154   IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
155   IN  EFI_HANDLE                                      ControllerHandle,
156   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
157   IN  CHAR8                                           *Language,
158   OUT CHAR16                                          **ControllerName
159   )
160 {
161   return EFI_UNSUPPORTED;
162 }
163