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