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