1 | /* $Id$ */
|
---|
2 | /** @file
|
---|
3 | * IdeController.h
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /** @file
|
---|
19 | Header file for IDE controller driver.
|
---|
20 |
|
---|
21 | Copyright (c) 2008 Intel Corporation. <BR>
|
---|
22 | All rights reserved. This program and the accompanying materials
|
---|
23 | are licensed and made available under the terms and conditions of the BSD License
|
---|
24 | which accompanies this distribution. The full text of the license may be found at
|
---|
25 | http://opensource.org/licenses/bsd-license.php
|
---|
26 |
|
---|
27 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
28 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
29 |
|
---|
30 | **/
|
---|
31 |
|
---|
32 | #ifndef _IDE_CONTROLLER_H
|
---|
33 | #define _IDE_CONTROLLER_H
|
---|
34 |
|
---|
35 | #include <Uefi.h>
|
---|
36 | #include <Protocol/ComponentName.h>
|
---|
37 | #include <Protocol/DriverBinding.h>
|
---|
38 | #include <Protocol/PciIo.h>
|
---|
39 | #include <Protocol/IdeControllerInit.h>
|
---|
40 | #include <Library/UefiDriverEntryPoint.h>
|
---|
41 | #include <Library/DebugLib.h>
|
---|
42 | #include <Library/UefiLib.h>
|
---|
43 | #include <Library/BaseLib.h>
|
---|
44 | #include <Library/BaseMemoryLib.h>
|
---|
45 | #include <Library/MemoryAllocationLib.h>
|
---|
46 | #include <Library/UefiBootServicesTableLib.h>
|
---|
47 | #include <IndustryStandard/Pci.h>
|
---|
48 |
|
---|
49 | //
|
---|
50 | // Global Variables definitions
|
---|
51 | //
|
---|
52 | extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;
|
---|
53 | extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerComponentName;
|
---|
54 | extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
|
---|
55 |
|
---|
56 | //
|
---|
57 | // Supports 2 channel max
|
---|
58 | //
|
---|
59 | #define ICH_IDE_MAX_CHANNEL 0x02
|
---|
60 | //
|
---|
61 | // Supports 2 devices max
|
---|
62 | //
|
---|
63 | #define ICH_IDE_MAX_DEVICES 0x02
|
---|
64 | #define ICH_IDE_ENUMER_ALL FALSE
|
---|
65 |
|
---|
66 | //
|
---|
67 | // Driver binding functions declaration
|
---|
68 | //
|
---|
69 | EFI_STATUS
|
---|
70 | EFIAPI
|
---|
71 | IdeControllerSupported (
|
---|
72 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
73 | IN EFI_HANDLE Controller,
|
---|
74 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
---|
75 | )
|
---|
76 | /*++
|
---|
77 |
|
---|
78 | Routine Description:
|
---|
79 |
|
---|
80 | Register Driver Binding protocol for this driver.
|
---|
81 |
|
---|
82 | Arguments:
|
---|
83 |
|
---|
84 | This -- a pointer points to the Binding Protocol instance
|
---|
85 | Controller -- The handle of controller to be tested.
|
---|
86 | *RemainingDevicePath -- A pointer to the device path. Ignored by device
|
---|
87 | driver but used by bus driver
|
---|
88 |
|
---|
89 | Returns:
|
---|
90 |
|
---|
91 | EFI_SUCCESS -- Driver loaded.
|
---|
92 | other -- Driver not loaded.
|
---|
93 | --*/
|
---|
94 | ;
|
---|
95 |
|
---|
96 | EFI_STATUS
|
---|
97 | EFIAPI
|
---|
98 | IdeControllerStart (
|
---|
99 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
100 | IN EFI_HANDLE Controller,
|
---|
101 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
---|
102 | )
|
---|
103 | /*++
|
---|
104 |
|
---|
105 | Routine Description:
|
---|
106 |
|
---|
107 | This routine is called right after the .Supported() called and return
|
---|
108 | EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
|
---|
109 | are closed.
|
---|
110 |
|
---|
111 | Arguments:
|
---|
112 |
|
---|
113 | This -- a pointer points to the Binding Protocol instance
|
---|
114 | Controller -- The handle of controller to be tested. Parameter
|
---|
115 | passed by the caller
|
---|
116 | *RemainingDevicePath -- A pointer to the device path. Should be ignored by
|
---|
117 | device driver
|
---|
118 | --*/
|
---|
119 | ;
|
---|
120 |
|
---|
121 | EFI_STATUS
|
---|
122 | EFIAPI
|
---|
123 | IdeControllerStop (
|
---|
124 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
125 | IN EFI_HANDLE Controller,
|
---|
126 | IN UINTN NumberOfChildren,
|
---|
127 | IN EFI_HANDLE *ChildHandleBuffer
|
---|
128 | )
|
---|
129 | /*++
|
---|
130 |
|
---|
131 | Routine Description:
|
---|
132 | Stop this driver on Controller Handle.
|
---|
133 |
|
---|
134 | Arguments:
|
---|
135 | This - Protocol instance pointer.
|
---|
136 | Controller - Handle of device to stop driver on
|
---|
137 | NumberOfChildren - Not used
|
---|
138 | ChildHandleBuffer - Not used
|
---|
139 |
|
---|
140 | Returns:
|
---|
141 | EFI_SUCCESS - This driver is removed DeviceHandle
|
---|
142 | other - This driver was not removed from this device
|
---|
143 |
|
---|
144 | --*/
|
---|
145 | ;
|
---|
146 |
|
---|
147 | //
|
---|
148 | // IDE controller init functions declaration
|
---|
149 | //
|
---|
150 | EFI_STATUS
|
---|
151 | EFIAPI
|
---|
152 | IdeInitGetChannelInfo (
|
---|
153 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
154 | IN UINT8 Channel,
|
---|
155 | OUT BOOLEAN *Enabled,
|
---|
156 | OUT UINT8 *MaxDevices
|
---|
157 | )
|
---|
158 | /*++
|
---|
159 |
|
---|
160 | Routine Description:
|
---|
161 |
|
---|
162 | TODO: Add function description
|
---|
163 |
|
---|
164 | Arguments:
|
---|
165 |
|
---|
166 | This - TODO: add argument description
|
---|
167 | Channel - TODO: add argument description
|
---|
168 | Enabled - TODO: add argument description
|
---|
169 | MaxDevices - TODO: add argument description
|
---|
170 |
|
---|
171 | Returns:
|
---|
172 |
|
---|
173 | TODO: add return values
|
---|
174 |
|
---|
175 | --*/
|
---|
176 | ;
|
---|
177 |
|
---|
178 | EFI_STATUS
|
---|
179 | EFIAPI
|
---|
180 | IdeInitNotifyPhase (
|
---|
181 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
182 | IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
|
---|
183 | OUT UINT8 Channel
|
---|
184 | )
|
---|
185 | /*++
|
---|
186 |
|
---|
187 | Routine Description:
|
---|
188 |
|
---|
189 | TODO: Add function description
|
---|
190 |
|
---|
191 | Arguments:
|
---|
192 |
|
---|
193 | This - TODO: add argument description
|
---|
194 | Phase - TODO: add argument description
|
---|
195 | Channel - TODO: add argument description
|
---|
196 |
|
---|
197 | Returns:
|
---|
198 |
|
---|
199 | TODO: add return values
|
---|
200 |
|
---|
201 | --*/
|
---|
202 | ;
|
---|
203 |
|
---|
204 | EFI_STATUS
|
---|
205 | EFIAPI
|
---|
206 | IdeInitSubmitData (
|
---|
207 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
208 | IN UINT8 Channel,
|
---|
209 | IN UINT8 Device,
|
---|
210 | IN EFI_IDENTIFY_DATA *IdentifyData
|
---|
211 | )
|
---|
212 | /*++
|
---|
213 |
|
---|
214 | Routine Description:
|
---|
215 |
|
---|
216 | TODO: Add function description
|
---|
217 |
|
---|
218 | Arguments:
|
---|
219 |
|
---|
220 | This - TODO: add argument description
|
---|
221 | Channel - TODO: add argument description
|
---|
222 | Device - TODO: add argument description
|
---|
223 | IdentifyData - TODO: add argument description
|
---|
224 |
|
---|
225 | Returns:
|
---|
226 |
|
---|
227 | TODO: add return values
|
---|
228 |
|
---|
229 | --*/
|
---|
230 | ;
|
---|
231 |
|
---|
232 | EFI_STATUS
|
---|
233 | EFIAPI
|
---|
234 | IdeInitSubmitFailingModes (
|
---|
235 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
236 | IN UINT8 Channel,
|
---|
237 | IN UINT8 Device
|
---|
238 | )
|
---|
239 | /*++
|
---|
240 |
|
---|
241 | Routine Description:
|
---|
242 |
|
---|
243 | TODO: Add function description
|
---|
244 |
|
---|
245 | Arguments:
|
---|
246 |
|
---|
247 | This - TODO: add argument description
|
---|
248 | Channel - TODO: add argument description
|
---|
249 | Device - TODO: add argument description
|
---|
250 |
|
---|
251 | Returns:
|
---|
252 |
|
---|
253 | TODO: add return values
|
---|
254 |
|
---|
255 | --*/
|
---|
256 | ;
|
---|
257 |
|
---|
258 | EFI_STATUS
|
---|
259 | EFIAPI
|
---|
260 | IdeInitDisqualifyMode (
|
---|
261 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
262 | IN UINT8 Channel,
|
---|
263 | IN UINT8 Device,
|
---|
264 | IN EFI_ATA_COLLECTIVE_MODE *BadModes
|
---|
265 | )
|
---|
266 | /*++
|
---|
267 |
|
---|
268 | Routine Description:
|
---|
269 |
|
---|
270 | TODO: Add function description
|
---|
271 |
|
---|
272 | Arguments:
|
---|
273 |
|
---|
274 | This - TODO: add argument description
|
---|
275 | Channel - TODO: add argument description
|
---|
276 | Device - TODO: add argument description
|
---|
277 | BadModes - TODO: add argument description
|
---|
278 |
|
---|
279 | Returns:
|
---|
280 |
|
---|
281 | TODO: add return values
|
---|
282 |
|
---|
283 | --*/
|
---|
284 | ;
|
---|
285 |
|
---|
286 | EFI_STATUS
|
---|
287 | EFIAPI
|
---|
288 | IdeInitCalculateMode (
|
---|
289 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
290 | IN UINT8 Channel,
|
---|
291 | IN UINT8 Device,
|
---|
292 | IN EFI_ATA_COLLECTIVE_MODE **SupportedModes
|
---|
293 | )
|
---|
294 | /*++
|
---|
295 |
|
---|
296 | Routine Description:
|
---|
297 |
|
---|
298 | TODO: Add function description
|
---|
299 |
|
---|
300 | Arguments:
|
---|
301 |
|
---|
302 | This - TODO: add argument description
|
---|
303 | Channel - TODO: add argument description
|
---|
304 | Device - TODO: add argument description
|
---|
305 | SupportedModes - TODO: add argument description
|
---|
306 |
|
---|
307 | Returns:
|
---|
308 |
|
---|
309 | TODO: add return values
|
---|
310 |
|
---|
311 | --*/
|
---|
312 | ;
|
---|
313 |
|
---|
314 | EFI_STATUS
|
---|
315 | EFIAPI
|
---|
316 | IdeInitSetTiming (
|
---|
317 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
---|
318 | IN UINT8 Channel,
|
---|
319 | IN UINT8 Device,
|
---|
320 | IN EFI_ATA_COLLECTIVE_MODE *Modes
|
---|
321 | )
|
---|
322 | /*++
|
---|
323 |
|
---|
324 | Routine Description:
|
---|
325 |
|
---|
326 | TODO: Add function description
|
---|
327 |
|
---|
328 | Arguments:
|
---|
329 |
|
---|
330 | This - TODO: add argument description
|
---|
331 | Channel - TODO: add argument description
|
---|
332 | Device - TODO: add argument description
|
---|
333 | Modes - TODO: add argument description
|
---|
334 |
|
---|
335 | Returns:
|
---|
336 |
|
---|
337 | TODO: add return values
|
---|
338 |
|
---|
339 | --*/
|
---|
340 | ;
|
---|
341 |
|
---|
342 | //
|
---|
343 | // Forward reference declaration
|
---|
344 | //
|
---|
345 | EFI_STATUS
|
---|
346 | EFIAPI
|
---|
347 | IdeControllerComponentNameGetDriverName (
|
---|
348 | IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
---|
349 | IN CHAR8 *Language,
|
---|
350 | OUT CHAR16 **DriverName
|
---|
351 | )
|
---|
352 | /*++
|
---|
353 |
|
---|
354 | Routine Description:
|
---|
355 | Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
---|
356 |
|
---|
357 | Arguments:
|
---|
358 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
---|
359 | Language - A pointer to a three character ISO 639-2 language identifier.
|
---|
360 | This is the language of the driver name that that the caller
|
---|
361 | is requesting, and it must match one of the languages specified
|
---|
362 | in SupportedLanguages. The number of languages supported by a
|
---|
363 | driver is up to the driver writer.
|
---|
364 | DriverName - A pointer to the Unicode string to return. This Unicode string
|
---|
365 | is the name of the driver specified by This in the language
|
---|
366 | specified by Language.
|
---|
367 |
|
---|
368 | Returns:
|
---|
369 | EFI_SUCCESS - The Unicode string for the Driver specified by This
|
---|
370 | and the language specified by Language was returned
|
---|
371 | in DriverName.
|
---|
372 | EFI_INVALID_PARAMETER - Language is NULL.
|
---|
373 | EFI_INVALID_PARAMETER - DriverName is NULL.
|
---|
374 | EFI_UNSUPPORTED - The driver specified by This does not support the
|
---|
375 | language specified by Language.
|
---|
376 |
|
---|
377 | --*/
|
---|
378 | ;
|
---|
379 |
|
---|
380 | EFI_STATUS
|
---|
381 | EFIAPI
|
---|
382 | IdeControllerComponentNameGetControllerName (
|
---|
383 | IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
---|
384 | IN EFI_HANDLE ControllerHandle,
|
---|
385 | IN EFI_HANDLE ChildHandle OPTIONAL,
|
---|
386 | IN CHAR8 *Language,
|
---|
387 | OUT CHAR16 **ControllerName
|
---|
388 | )
|
---|
389 | /*++
|
---|
390 |
|
---|
391 | Routine Description:
|
---|
392 | Retrieves a Unicode string that is the user readable name of the controller
|
---|
393 | that is being managed by an EFI Driver.
|
---|
394 |
|
---|
395 | Arguments:
|
---|
396 | This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
---|
397 | ControllerHandle - The handle of a controller that the driver specified by
|
---|
398 | This is managing. This handle specifies the controller
|
---|
399 | whose name is to be returned.
|
---|
400 | ChildHandle - The handle of the child controller to retrieve the name
|
---|
401 | of. This is an optional parameter that may be NULL. It
|
---|
402 | will be NULL for device drivers. It will also be NULL
|
---|
403 | for a bus drivers that wish to retrieve the name of the
|
---|
404 | bus controller. It will not be NULL for a bus driver
|
---|
405 | that wishes to retrieve the name of a child controller.
|
---|
406 | Language - A pointer to a three character ISO 639-2 language
|
---|
407 | identifier. This is the language of the controller name
|
---|
408 | that that the caller is requesting, and it must match one
|
---|
409 | of the languages specified in SupportedLanguages. The
|
---|
410 | number of languages supported by a driver is up to the
|
---|
411 | driver writer.
|
---|
412 | ControllerName - A pointer to the Unicode string to return. This Unicode
|
---|
413 | string is the name of the controller specified by
|
---|
414 | ControllerHandle and ChildHandle in the language
|
---|
415 | specified by Language from the point of view of the
|
---|
416 | driver specified by This.
|
---|
417 |
|
---|
418 | Returns:
|
---|
419 | EFI_SUCCESS - The Unicode string for the user readable name in the
|
---|
420 | language specified by Language for the driver
|
---|
421 | specified by This was returned in DriverName.
|
---|
422 | EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
---|
423 | EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
---|
424 | EFI_HANDLE.
|
---|
425 | EFI_INVALID_PARAMETER - Language is NULL.
|
---|
426 | EFI_INVALID_PARAMETER - ControllerName is NULL.
|
---|
427 | EFI_UNSUPPORTED - The driver specified by This is not currently
|
---|
428 | managing the controller specified by
|
---|
429 | ControllerHandle and ChildHandle.
|
---|
430 | EFI_UNSUPPORTED - The driver specified by This does not support the
|
---|
431 | language specified by Language.
|
---|
432 |
|
---|
433 | --*/
|
---|
434 | ;
|
---|
435 |
|
---|
436 | #endif
|
---|