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