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