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