]>
Commit | Line | Data |
---|---|---|
87f8ccbe | 1 | /** @file\r |
b28b274d | 2 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r |
ac1ca104 | 3 | This program and the accompanying materials \r |
87f8ccbe | 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 Protocol\r | |
17 | //\r | |
18 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName = {\r | |
19 | CirrusLogic5430ComponentNameGetDriverName,\r | |
20 | CirrusLogic5430ComponentNameGetControllerName,\r | |
21 | "eng"\r | |
22 | };\r | |
23 | \r | |
24 | //\r | |
25 | // EFI Component Name 2 Protocol\r | |
26 | //\r | |
27 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gCirrusLogic5430ComponentName2 = {\r | |
28 | (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) CirrusLogic5430ComponentNameGetDriverName,\r | |
29 | (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) CirrusLogic5430ComponentNameGetControllerName,\r | |
30 | "en"\r | |
31 | };\r | |
32 | \r | |
33 | \r | |
34 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable[] = {\r | |
35 | { "eng;en", L"Cirrus Logic 5430 Driver" },\r | |
36 | { NULL , NULL }\r | |
37 | };\r | |
38 | \r | |
39 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable[] = {\r | |
40 | { "eng;en", L"Cirrus Logic 5430 PCI Adapter" },\r | |
41 | { NULL , NULL }\r | |
42 | };\r | |
43 | \r | |
44 | /**\r | |
45 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
46 | \r | |
47 | This function retrieves the user readable name of a driver in the form of a\r | |
48 | Unicode string. If the driver specified by This has a user readable name in\r | |
49 | the language specified by Language, then a pointer to the driver name is\r | |
50 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
51 | by This does not support the language specified by Language,\r | |
52 | then EFI_UNSUPPORTED is returned.\r | |
53 | \r | |
54 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
55 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
56 | \r | |
57 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
58 | array indicating the language. This is the\r | |
59 | language of the driver name that the caller is\r | |
60 | requesting, and it must match one of the\r | |
61 | languages specified in SupportedLanguages. The\r | |
62 | number of languages supported by a driver is up\r | |
63 | to the driver writer. Language is specified\r | |
8469b662 | 64 | in RFC 4646 or ISO 639-2 language code format.\r |
87f8ccbe | 65 | \r |
66 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
67 | This Unicode string is the name of the\r | |
68 | driver specified by This in the language\r | |
69 | specified by Language.\r | |
70 | \r | |
71 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
72 | This and the language specified by Language was\r | |
73 | returned in DriverName.\r | |
74 | \r | |
75 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
76 | \r | |
77 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
78 | \r | |
79 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
80 | the language specified by Language.\r | |
81 | \r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | CirrusLogic5430ComponentNameGetDriverName (\r | |
86 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
87 | IN CHAR8 *Language,\r | |
88 | OUT CHAR16 **DriverName\r | |
89 | )\r | |
90 | {\r | |
91 | return LookupUnicodeString2 (\r | |
92 | Language,\r | |
93 | This->SupportedLanguages,\r | |
94 | mCirrusLogic5430DriverNameTable,\r | |
95 | DriverName,\r | |
96 | (BOOLEAN)(This == &gCirrusLogic5430ComponentName)\r | |
97 | );\r | |
98 | }\r | |
99 | \r | |
100 | /**\r | |
101 | Retrieves a Unicode string that is the user readable name of the controller\r | |
102 | that is being managed by a driver.\r | |
103 | \r | |
104 | This function retrieves the user readable name of the controller specified by\r | |
105 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
106 | driver specified by This has a user readable name in the language specified by\r | |
107 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
108 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
109 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
110 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
111 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
112 | \r | |
113 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
114 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
115 | \r | |
116 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
117 | specified by This is managing. This handle\r | |
118 | specifies the controller whose name is to be\r | |
119 | returned.\r | |
120 | \r | |
121 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
122 | the name of. This is an optional parameter that\r | |
123 | may be NULL. It will be NULL for device\r | |
124 | drivers. It will also be NULL for a bus drivers\r | |
125 | that wish to retrieve the name of the bus\r | |
126 | controller. It will not be NULL for a bus\r | |
127 | driver that wishes to retrieve the name of a\r | |
128 | child controller.\r | |
129 | \r | |
130 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
131 | array indicating the language. This is the\r | |
132 | language of the driver name that the caller is\r | |
133 | requesting, and it must match one of the\r | |
134 | languages specified in SupportedLanguages. The\r | |
135 | number of languages supported by a driver is up\r | |
136 | to the driver writer. Language is specified in\r | |
8469b662 | 137 | RFC 4646 or ISO 639-2 language code format.\r |
87f8ccbe | 138 | \r |
139 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
140 | This Unicode string is the name of the\r | |
141 | controller specified by ControllerHandle and\r | |
142 | ChildHandle in the language specified by\r | |
143 | Language from the point of view of the driver\r | |
144 | specified by This.\r | |
145 | \r | |
146 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
147 | the language specified by Language for the\r | |
148 | driver specified by This was returned in\r | |
149 | DriverName.\r | |
150 | \r | |
b28b274d | 151 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
87f8ccbe | 152 | \r |
153 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
154 | EFI_HANDLE.\r | |
155 | \r | |
156 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
157 | \r | |
158 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
159 | \r | |
160 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
161 | managing the controller specified by\r | |
162 | ControllerHandle and ChildHandle.\r | |
163 | \r | |
164 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
165 | the language specified by Language.\r | |
166 | \r | |
167 | **/\r | |
168 | EFI_STATUS\r | |
169 | EFIAPI\r | |
170 | CirrusLogic5430ComponentNameGetControllerName (\r | |
171 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
172 | IN EFI_HANDLE ControllerHandle,\r | |
173 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
174 | IN CHAR8 *Language,\r | |
175 | OUT CHAR16 **ControllerName\r | |
176 | )\r | |
177 | {\r | |
87f8ccbe | 178 | EFI_STATUS Status;\r |
87f8ccbe | 179 | \r |
180 | //\r | |
181 | // This is a device driver, so ChildHandle must be NULL.\r | |
182 | //\r | |
183 | if (ChildHandle != NULL) {\r | |
184 | return EFI_UNSUPPORTED;\r | |
185 | }\r | |
186 | \r | |
187 | //\r | |
54857d5a | 188 | // Make sure this driver is currently managing ControllHandle\r |
87f8ccbe | 189 | //\r |
54857d5a | 190 | Status = EfiTestManagedDevice (\r |
191 | ControllerHandle,\r | |
192 | gCirrusLogic5430DriverBinding.DriverBindingHandle,\r | |
193 | &gEfiPciIoProtocolGuid\r | |
194 | );\r | |
87f8ccbe | 195 | if (EFI_ERROR (Status)) {\r |
196 | return Status;\r | |
197 | }\r | |
198 | \r | |
199 | //\r | |
200 | // Get the Cirrus Logic 5430's Device structure\r | |
201 | //\r | |
202 | return LookupUnicodeString2 (\r | |
203 | Language,\r | |
204 | This->SupportedLanguages,\r | |
205 | mCirrusLogic5430ControllerNameTable,\r | |
206 | ControllerName,\r | |
207 | (BOOLEAN)(This == &gCirrusLogic5430ComponentName)\r | |
208 | );\r | |
209 | }\r |