]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Header file for IDE controller driver.\r | |
3 | \r | |
4 | Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _IDE_CONTROLLER_H_\r | |
16 | #define _IDE_CONTROLLER_H_\r | |
17 | \r | |
18 | #include <Uefi.h>\r | |
19 | #include <Protocol/ComponentName.h>\r | |
20 | #include <Protocol/DriverBinding.h>\r | |
21 | #include <Protocol/PciIo.h>\r | |
22 | #include <Protocol/IdeControllerInit.h>\r | |
23 | #include <Library/UefiDriverEntryPoint.h>\r | |
24 | #include <Library/DebugLib.h>\r | |
25 | #include <Library/UefiLib.h>\r | |
26 | #include <Library/BaseLib.h>\r | |
27 | #include <Library/BaseMemoryLib.h>\r | |
28 | #include <Library/MemoryAllocationLib.h>\r | |
29 | #include <Library/UefiBootServicesTableLib.h>\r | |
30 | #include <IndustryStandard/Pci.h>\r | |
31 | \r | |
32 | //\r | |
33 | // Global Variables definitions\r | |
34 | //\r | |
35 | extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;\r | |
36 | extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerComponentName;\r | |
37 | extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;\r | |
38 | \r | |
39 | ///\r | |
40 | /// Supports 2 channel max\r | |
41 | ///\r | |
42 | #define ICH_IDE_MAX_CHANNEL 0x02\r | |
43 | \r | |
44 | ///\r | |
45 | /// Supports 2 devices max\r | |
46 | ///\r | |
47 | #define ICH_IDE_MAX_DEVICES 0x02\r | |
48 | #define ICH_IDE_ENUMER_ALL FALSE\r | |
49 | \r | |
50 | //\r | |
51 | // Driver binding functions declaration\r | |
52 | //\r | |
53 | /**\r | |
54 | Register Driver Binding protocol for this driver.\r | |
55 | \r | |
56 | @param This A pointer points to the Binding Protocol instance\r | |
57 | @param Controller The handle of controller to be tested.\r | |
58 | @param RemainingDevicePath A pointer to the device path. Ignored by device\r | |
59 | driver but used by bus driver\r | |
60 | \r | |
61 | @retval EFI_SUCCESS Driver loaded.\r | |
62 | @retval !EFI_SUCESS Driver not loaded.\r | |
63 | **/\r | |
64 | EFI_STATUS\r | |
65 | EFIAPI\r | |
66 | IdeControllerSupported (\r | |
67 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
68 | IN EFI_HANDLE Controller,\r | |
69 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
70 | )\r | |
71 | ;\r | |
72 | \r | |
73 | /**\r | |
74 | This routine is called right after the .Supported() called and return\r | |
75 | EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols\r | |
76 | are closed.\r | |
77 | \r | |
78 | @param This A pointer points to the Binding Protocol instance\r | |
79 | @param Controller The handle of controller to be tested. Parameter\r | |
80 | passed by the caller\r | |
81 | @param RemainingDevicePath A pointer to the device path. Should be ignored by\r | |
82 | device driver\r | |
83 | \r | |
84 | @return EFI_STATUS Status of InstallMultipleProtocolInterfaces()\r | |
85 | **/\r | |
86 | EFI_STATUS\r | |
87 | EFIAPI\r | |
88 | IdeControllerStart (\r | |
89 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
90 | IN EFI_HANDLE Controller,\r | |
91 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
92 | )\r | |
93 | ;\r | |
94 | \r | |
95 | /**\r | |
96 | Stop this driver on Controller Handle.\r | |
97 | \r | |
98 | @param This Protocol instance pointer.\r | |
99 | @param Controller Handle of device to stop driver on\r | |
100 | @param NumberOfChildren Not used\r | |
101 | @param ChildHandleBuffer Not used\r | |
102 | \r | |
103 | @retval EFI_SUCESS This driver is removed DeviceHandle\r | |
104 | @retval !EFI_SUCCESS This driver was not removed from this device\r | |
105 | **/\r | |
106 | EFI_STATUS\r | |
107 | EFIAPI\r | |
108 | IdeControllerStop (\r | |
109 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
110 | IN EFI_HANDLE Controller,\r | |
111 | IN UINTN NumberOfChildren,\r | |
112 | IN EFI_HANDLE *ChildHandleBuffer\r | |
113 | )\r | |
114 | ;\r | |
115 | \r | |
116 | //\r | |
117 | // IDE controller init functions declaration\r | |
118 | //\r | |
119 | /**\r | |
120 | This function can be used to obtain information about a specified channel.\r | |
121 | It's usually used by IDE Bus driver during enumeration process.\r | |
122 | \r | |
123 | @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
124 | @param Channel Channel number (0 based, either 0 or 1)\r | |
125 | @param Enabled TRUE if the channel is enabled. If the channel is disabled,\r | |
126 | then it will no be enumerated.\r | |
127 | @param MaxDevices The Max number of IDE devices that the bus driver can expect\r | |
128 | on this channel. For ATA/ATAPI, this number is either 1 or 2.\r | |
129 | \r | |
130 | @retval EFI_SUCCESS Success to get channel information\r | |
131 | @retval EFI_INVALID_PARAMETER Invalid channel id.\r | |
132 | **/\r | |
133 | EFI_STATUS\r | |
134 | EFIAPI\r | |
135 | IdeInitGetChannelInfo (\r | |
136 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
137 | IN UINT8 Channel,\r | |
138 | OUT BOOLEAN *Enabled,\r | |
139 | OUT UINT8 *MaxDevices\r | |
140 | )\r | |
141 | ;\r | |
142 | \r | |
143 | /**\r | |
144 | This function is called by IdeBus driver before executing certain actions.\r | |
145 | This allows IDE Controller Init to prepare for each action.\r | |
146 | \r | |
147 | @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
148 | @param Phase phase indicator defined by IDE_CONTROLLER_INIT protocol\r | |
149 | @param Channel Channel number (0 based, either 0 or 1)\r | |
150 | \r | |
151 | @return EFI_SUCCESS Success operation.\r | |
152 | **/\r | |
153 | EFI_STATUS\r | |
154 | EFIAPI\r | |
155 | IdeInitNotifyPhase (\r | |
156 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
157 | IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,\r | |
158 | IN UINT8 Channel\r | |
159 | )\r | |
160 | ;\r | |
161 | \r | |
162 | /**\r | |
163 | This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure\r | |
164 | obtained from IDE deivce. This structure is used to set IDE timing\r | |
165 | \r | |
166 | @param This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
167 | @param Channel IDE channel number (0 based, either 0 or 1)\r | |
168 | @param Device IDE device number\r | |
169 | @param IdentifyData A pointer to EFI_IDENTIFY_DATA data structure\r | |
170 | \r | |
171 | @return EFI_SUCCESS Success operation.\r | |
172 | **/\r | |
173 | EFI_STATUS\r | |
174 | EFIAPI\r | |
175 | IdeInitSubmitData (\r | |
176 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
177 | IN UINT8 Channel,\r | |
178 | IN UINT8 Device,\r | |
179 | IN EFI_IDENTIFY_DATA *IdentifyData\r | |
180 | )\r | |
181 | ;\r | |
182 | \r | |
183 | /**\r | |
184 | This function is called by IdeBus driver to disqualify unsupported operation\r | |
185 | mode on specfic IDE device\r | |
186 | \r | |
187 | @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
188 | @param Channel IDE channel number (0 based, either 0 or 1)\r | |
189 | @param Device IDE device number\r | |
190 | @param BadModes Operation mode indicator\r | |
191 | \r | |
192 | @return EFI_SUCCESS Success operation.\r | |
193 | **/\r | |
194 | EFI_STATUS\r | |
195 | EFIAPI\r | |
196 | IdeInitDisqualifyMode (\r | |
197 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
198 | IN UINT8 Channel,\r | |
199 | IN UINT8 Device,\r | |
200 | IN EFI_ATA_COLLECTIVE_MODE *BadModes\r | |
201 | )\r | |
202 | ;\r | |
203 | \r | |
204 | /**\r | |
205 | This function is called by IdeBus driver to calculate the best operation mode\r | |
206 | supported by specific IDE device\r | |
207 | \r | |
208 | @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
209 | @param Channel IDE channel number (0 based, either 0 or 1)\r | |
210 | @param Device IDE device number\r | |
211 | @param SupportedModes Modes collection supported by IDE device\r | |
212 | \r | |
213 | @retval EFI_OUT_OF_RESOURCES Fail to allocate pool.\r | |
214 | @retval EFI_INVALID_PARAMETER Invalid channel id and device id.\r | |
215 | **/\r | |
216 | EFI_STATUS\r | |
217 | EFIAPI\r | |
218 | IdeInitCalculateMode (\r | |
219 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
220 | IN UINT8 Channel,\r | |
221 | IN UINT8 Device,\r | |
222 | OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes\r | |
223 | )\r | |
224 | ;\r | |
225 | \r | |
226 | /**\r | |
227 | This function is called by IdeBus driver to set appropriate timing on IDE\r | |
228 | controller according supported operation mode.\r | |
229 | \r | |
230 | @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
231 | @param Channel IDE channel number (0 based, either 0 or 1)\r | |
232 | @param Device IDE device number\r | |
233 | @param Modes IDE device modes\r | |
234 | \r | |
235 | @retval EFI_SUCCESS Sucess operation.\r | |
236 | **/\r | |
237 | EFI_STATUS\r | |
238 | EFIAPI\r | |
239 | IdeInitSetTiming (\r | |
240 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
241 | IN UINT8 Channel,\r | |
242 | IN UINT8 Device,\r | |
243 | IN EFI_ATA_COLLECTIVE_MODE *Modes\r | |
244 | )\r | |
245 | ;\r | |
246 | \r | |
247 | //\r | |
248 | // Forward reference declaration\r | |
249 | //\r | |
250 | /**\r | |
251 | Retrieves a Unicode string that is the user readable name of the EFI Driver.\r | |
252 | \r | |
253 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
254 | @param Language A pointer to a three character ISO 639-2 language identifier.\r | |
255 | This is the language of the driver name that that the caller\r | |
256 | is requesting, and it must match one of the languages specified\r | |
257 | in SupportedLanguages. The number of languages supported by a\r | |
258 | driver is up to the driver writer.\r | |
259 | @param DriverName A pointer to the Unicode string to return. This Unicode string\r | |
260 | is the name of the driver specified by This in the language\r | |
261 | specified by Language.\r | |
262 | \r | |
263 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This\r | |
264 | and the language specified by Language was returned\r | |
265 | in DriverName.\r | |
266 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
267 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
268 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
269 | language specified by Language.\r | |
270 | **/\r | |
271 | EFI_STATUS\r | |
272 | EFIAPI\r | |
273 | IdeControllerComponentNameGetDriverName (\r | |
274 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
275 | IN CHAR8 *Language,\r | |
276 | OUT CHAR16 **DriverName\r | |
277 | )\r | |
278 | ;\r | |
279 | \r | |
280 | /**\r | |
281 | Retrieves a Unicode string that is the user readable name of the controller\r | |
282 | that is being managed by an EFI Driver.\r | |
283 | \r | |
284 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
285 | @param ControllerHandle The handle of a controller that the driver specified by\r | |
286 | This is managing. This handle specifies the controller\r | |
287 | whose name is to be returned.\r | |
288 | @param OPTIONAL ChildHandle The handle of the child controller to retrieve the name\r | |
289 | of. This is an optional parameter that may be NULL. It\r | |
290 | will be NULL for device drivers. It will also be NULL\r | |
291 | for a bus drivers that wish to retrieve the name of the\r | |
292 | bus controller. It will not be NULL for a bus driver\r | |
293 | that wishes to retrieve the name of a child controller.\r | |
294 | @param Language A pointer to a three character ISO 639-2 language\r | |
295 | identifier. This is the language of the controller name\r | |
296 | that that the caller is requesting, and it must match one\r | |
297 | of the languages specified in SupportedLanguages. The\r | |
298 | number of languages supported by a driver is up to the\r | |
299 | driver writer.\r | |
300 | @param ControllerName A pointer to the Unicode string to return. This Unicode\r | |
301 | string is the name of the controller specified by\r | |
302 | ControllerHandle and ChildHandle in the language\r | |
303 | specified by Language from the point of view of the\r | |
304 | driver specified by This.\r | |
305 | \r | |
306 | @retval EFI_SUCCESS The Unicode string for the user readable name in the\r | |
307 | language specified by Language for the driver\r | |
308 | specified by This was returned in DriverName.\r | |
309 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
310 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
311 | EFI_HANDLE.\r | |
312 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
313 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
314 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
315 | managing the controller specified by\r | |
316 | ControllerHandle and ChildHandle.\r | |
317 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
318 | language specified by Language.\r | |
319 | **/\r | |
320 | EFI_STATUS\r | |
321 | EFIAPI\r | |
322 | IdeControllerComponentNameGetControllerName (\r | |
323 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
324 | IN EFI_HANDLE ControllerHandle,\r | |
325 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
326 | IN CHAR8 *Language,\r | |
327 | OUT CHAR16 **ControllerName\r | |
328 | )\r | |
329 | ;\r | |
330 | \r | |
331 | #endif\r |