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