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