]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/EhciDxe/ComponentName.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / ComponentName.c
CommitLineData
913cb9dc 1/** @file\r
78c2ffb5 2 UEFI Component Name(2) protocol implementation for EHCI driver.\r
913cb9dc 3\r
cd5ebaa0 4Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
824b03ce 5 \r
cd5ebaa0 6This program and the accompanying materials\r
824b03ce 7are licensed and made available under the terms and conditions\r
8of the BSD License which accompanies this distribution. The\r
9full text of the license may be found at\r
913cb9dc 10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
913cb9dc 15**/\r
16\r
17#include "Ehci.h"\r
18\r
f527bce3 19\r
913cb9dc 20//\r
21// EFI Component Name Protocol\r
22//\r
1307dcd7 23GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName = {\r
913cb9dc 24 EhciComponentNameGetDriverName,\r
25 EhciComponentNameGetControllerName,\r
26 "eng"\r
1307dcd7 27};\r
f527bce3 28\r
29//\r
30// EFI Component Name 2 Protocol\r
31//\r
1307dcd7 32GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEhciComponentName2 = {\r
f527bce3 33 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EhciComponentNameGetDriverName,\r
34 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EhciComponentNameGetControllerName,\r
35 "en"\r
1307dcd7 36};\r
f527bce3 37\r
913cb9dc 38\r
d1aeb0bd 39GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mEhciDriverNameTable[] = {\r
f527bce3 40 { "eng;en", L"Usb Ehci Driver" },\r
913cb9dc 41 { NULL , NULL }\r
42};\r
43\r
aa79b0b3 44\r
f527bce3 45/**\r
46 Retrieves a Unicode string that is the user readable name of the driver.\r
47\r
48 This function retrieves the user readable name of a driver in the form of a\r
49 Unicode string. If the driver specified by This has a user readable name in\r
50 the language specified by Language, then a pointer to the driver name is\r
51 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
52 by This does not support the language specified by Language,\r
53 then EFI_UNSUPPORTED is returned.\r
54\r
55 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
56 EFI_COMPONENT_NAME_PROTOCOL instance.\r
57\r
58 @param Language[in] A pointer to a Null-terminated ASCII string\r
59 array indicating the language. This is the\r
60 language of the driver name that the caller is\r
61 requesting, and it must match one of the\r
62 languages specified in SupportedLanguages. The\r
63 number of languages supported by a driver is up\r
64 to the driver writer. Language is specified\r
0254efc0 65 in RFC 4646 or ISO 639-2 language code format.\r
f527bce3 66\r
67 @param DriverName[out] A pointer to the Unicode string to return.\r
68 This Unicode string is the name of the\r
69 driver specified by This in the language\r
70 specified by Language.\r
71\r
72 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
73 This and the language specified by Language was\r
74 returned in DriverName.\r
75\r
76 @retval EFI_INVALID_PARAMETER Language is NULL.\r
77\r
78 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
79\r
80 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
81 the language specified by Language.\r
82\r
83**/\r
913cb9dc 84EFI_STATUS\r
85EFIAPI\r
86EhciComponentNameGetDriverName (\r
f527bce3 87 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
88 IN CHAR8 *Language,\r
89 OUT CHAR16 **DriverName\r
913cb9dc 90 )\r
913cb9dc 91{\r
f527bce3 92 return LookupUnicodeString2 (\r
93 Language,\r
94 This->SupportedLanguages,\r
95 mEhciDriverNameTable,\r
96 DriverName,\r
97 (BOOLEAN)(This == &gEhciComponentName)\r
98 );\r
913cb9dc 99}\r
100\r
f527bce3 101/**\r
102 Retrieves a Unicode string that is the user readable name of the controller\r
103 that is being managed by a driver.\r
104\r
105 This function retrieves the user readable name of the controller specified by\r
106 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
107 driver specified by This has a user readable name in the language specified by\r
108 Language, then a pointer to the controller name is returned in ControllerName,\r
109 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
110 managing the controller specified by ControllerHandle and ChildHandle,\r
111 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
112 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
113\r
114 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
115 EFI_COMPONENT_NAME_PROTOCOL instance.\r
116\r
117 @param ControllerHandle[in] The handle of a controller that the driver\r
118 specified by This is managing. This handle\r
119 specifies the controller whose name is to be\r
120 returned.\r
121\r
122 @param ChildHandle[in] The handle of the child controller to retrieve\r
123 the name of. This is an optional parameter that\r
124 may be NULL. It will be NULL for device\r
125 drivers. It will also be NULL for a bus drivers\r
126 that wish to retrieve the name of the bus\r
127 controller. It will not be NULL for a bus\r
128 driver that wishes to retrieve the name of a\r
129 child controller.\r
130\r
131 @param Language[in] A pointer to a Null-terminated ASCII string\r
132 array indicating the language. This is the\r
133 language of the driver name that the caller is\r
134 requesting, and it must match one of the\r
135 languages specified in SupportedLanguages. The\r
136 number of languages supported by a driver is up\r
137 to the driver writer. Language is specified in\r
0254efc0 138 RFC 4646 or ISO 639-2 language code format.\r
f527bce3 139\r
140 @param ControllerName[out] A pointer to the Unicode string to return.\r
141 This Unicode string is the name of the\r
142 controller specified by ControllerHandle and\r
143 ChildHandle in the language specified by\r
144 Language from the point of view of the driver\r
145 specified by This.\r
146\r
147 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
148 the language specified by Language for the\r
149 driver specified by This was returned in\r
150 DriverName.\r
151\r
152 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
153\r
154 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
155 EFI_HANDLE.\r
156\r
157 @retval EFI_INVALID_PARAMETER Language is NULL.\r
158\r
159 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
160\r
161 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
162 managing the controller specified by\r
163 ControllerHandle and ChildHandle.\r
164\r
165 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
166 the language specified by Language.\r
167\r
168**/\r
913cb9dc 169EFI_STATUS\r
170EFIAPI\r
171EhciComponentNameGetControllerName (\r
f527bce3 172 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
173 IN EFI_HANDLE ControllerHandle,\r
174 IN EFI_HANDLE ChildHandle OPTIONAL,\r
175 IN CHAR8 *Language,\r
176 OUT CHAR16 **ControllerName\r
913cb9dc 177 )\r
913cb9dc 178{\r
179 EFI_STATUS Status;\r
180 USB2_HC_DEV *EhciDev;\r
181 EFI_USB2_HC_PROTOCOL *Usb2Hc;\r
182\r
183 //\r
184 // This is a device driver, so ChildHandle must be NULL.\r
185 //\r
186 if (ChildHandle != NULL) {\r
187 return EFI_UNSUPPORTED;\r
188 }\r
189 //\r
190 // Make sure this driver is currently managing ControllerHandle\r
191 //\r
192 Status = EfiTestManagedDevice (\r
193 ControllerHandle,\r
194 gEhciDriverBinding.DriverBindingHandle,\r
195 &gEfiPciIoProtocolGuid\r
196 );\r
197 if (EFI_ERROR (Status)) {\r
198 return Status;\r
199 }\r
200 //\r
201 // Get the device context\r
202 //\r
203 Status = gBS->OpenProtocol (\r
204 ControllerHandle,\r
205 &gEfiUsb2HcProtocolGuid,\r
206 (VOID **) &Usb2Hc,\r
207 gEhciDriverBinding.DriverBindingHandle,\r
208 ControllerHandle,\r
209 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
210 );\r
211 if (EFI_ERROR (Status)) {\r
212 return Status;\r
213 }\r
214\r
215 EhciDev = EHC_FROM_THIS (Usb2Hc);\r
216\r
f527bce3 217 return LookupUnicodeString2 (\r
218 Language,\r
219 This->SupportedLanguages,\r
220 EhciDev->ControllerNameTable,\r
221 ControllerName,\r
222 (BOOLEAN)(This == &gEhciComponentName)\r
223 );\r
913cb9dc 224\r
225}\r