3 Copyright (c) 2006 - 2007, Intel Corporation All rights
4 reserved. This program and the accompanying materials are
5 licensed and made available under the terms and conditions of
6 the BSD License which accompanies this distribution. The full
7 text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 // EFI Component Name Functions
29 EhciComponentNameGetDriverName (
30 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
32 OUT CHAR16
**DriverName
37 EhciComponentNameGetControllerName (
38 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
39 IN EFI_HANDLE ControllerHandle
,
40 IN EFI_HANDLE ChildHandle
, OPTIONAL
42 OUT CHAR16
**ControllerName
46 // EFI Component Name Protocol
48 EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName
= {
49 EhciComponentNameGetDriverName
,
50 EhciComponentNameGetControllerName
,
54 static EFI_UNICODE_STRING_TABLE mEhciDriverNameTable
[] = {
55 { "eng", L
"Usb Ehci Driver" },
61 EhciComponentNameGetDriverName (
62 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
64 OUT CHAR16
**DriverName
69 Retrieves a Unicode string that is the user readable name of the EFI Driver.
72 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
73 Language - A pointer to a three character ISO 639-2 language identifier.
74 This is the language of the driver name that that the caller
75 is requesting, and it must match one of the languages specified
76 in SupportedLanguages. The number of languages supported by a
77 driver is up to the driver writer.
78 DriverName - A pointer to the Unicode string to return. This Unicode string
79 is the name of the driver specified by This in the language
80 specified by Language.
83 EFI_SUCCESS - The Unicode string for the Driver specified by This
84 and the language specified by Language was returned
86 EFI_INVALID_PARAMETER - Language is NULL.
87 EFI_INVALID_PARAMETER - DriverName is NULL.
88 EFI_UNSUPPORTED - The driver specified by This does not support the
89 language specified by Language.
93 return LookupUnicodeString (
95 gEhciComponentName
.SupportedLanguages
,
103 EhciComponentNameGetControllerName (
104 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
105 IN EFI_HANDLE ControllerHandle
,
106 IN EFI_HANDLE ChildHandle
, OPTIONAL
108 OUT CHAR16
**ControllerName
113 Retrieves a Unicode string that is the user readable name of the controller
114 that is being managed by an EFI Driver.
117 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
118 ControllerHandle - The handle of a controller that the driver specified by
119 This is managing. This handle specifies the controller
120 whose name is to be returned.
121 ChildHandle - The handle of the child controller to retrieve the name
122 of. This is an optional parameter that may be NULL. It
123 will be NULL for device drivers. It will also be NULL
124 for a bus drivers that wish to retrieve the name of the
125 bus controller. It will not be NULL for a bus driver
126 that wishes to retrieve the name of a child controller.
127 Language - A pointer to a three character ISO 639-2 language
128 identifier. This is the language of the controller name
129 that that the caller is requesting, and it must match one
130 of the languages specified in SupportedLanguages. The
131 number of languages supported by a driver is up to the
133 ControllerName - A pointer to the Unicode string to return. This Unicode
134 string is the name of the controller specified by
135 ControllerHandle and ChildHandle in the language
136 specified by Language from the point of view of the
137 driver specified by This.
140 EFI_SUCCESS - The Unicode string for the user readable name in the
141 language specified by Language for the driver
142 specified by This was returned in DriverName.
143 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
144 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
146 EFI_INVALID_PARAMETER - Language is NULL.
147 EFI_INVALID_PARAMETER - ControllerName is NULL.
148 EFI_UNSUPPORTED - The driver specified by This is not currently
149 managing the controller specified by
150 ControllerHandle and ChildHandle.
151 EFI_UNSUPPORTED - The driver specified by This does not support the
152 language specified by Language.
157 USB2_HC_DEV
*EhciDev
;
158 EFI_USB2_HC_PROTOCOL
*Usb2Hc
;
161 // This is a device driver, so ChildHandle must be NULL.
163 if (ChildHandle
!= NULL
) {
164 return EFI_UNSUPPORTED
;
167 // Make sure this driver is currently managing ControllerHandle
169 Status
= EfiTestManagedDevice (
171 gEhciDriverBinding
.DriverBindingHandle
,
172 &gEfiPciIoProtocolGuid
174 if (EFI_ERROR (Status
)) {
178 // Get the device context
180 Status
= gBS
->OpenProtocol (
182 &gEfiUsb2HcProtocolGuid
,
184 gEhciDriverBinding
.DriverBindingHandle
,
186 EFI_OPEN_PROTOCOL_GET_PROTOCOL
188 if (EFI_ERROR (Status
)) {
192 EhciDev
= EHC_FROM_THIS (Usb2Hc
);
194 return LookupUnicodeString (
196 gEhciComponentName
.SupportedLanguages
,
197 EhciDev
->ControllerNameTable
,