3 Copyright (c) 2006 Intel Corporation. All rights reserved
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Header file for chipset ATA controller driver.
24 #ifndef _IDE_CONTROLLER_H
25 #define _IDE_CONTROLLER_H
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiLib.h>
35 #include <Protocol/PciIo.h>
36 #include <Protocol/IdeControllerInit.h>
39 // Driver Binding Externs
41 extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding
;
42 extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerName
;
43 extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerName2
;
45 #include <IndustryStandard/Pci22.h>
48 // Symbol definition, for PCI IDE configuration field
50 #define PCI_CLASS_MASS_STORAGE 0x01
51 #define PCI_SUB_CLASS_IDE 0x01
54 // Supports 2 channel max
56 #define ICH_IDE_MAX_CHANNEL 0x02
58 // Supports 2 devices max
60 #define ICH_IDE_MAX_DEVICES 0x02
61 #define ICH_IDE_ENUMER_ALL FALSE
63 #define IDE_CONTROLLER_SIGNATURE SIGNATURE_32 ('i', 'i', 'd', 'e')
66 // Ide controller driver private data structure
70 // Standard signature used to identify Ide controller private data
75 // Protocol instance of IDE_CONTROLLER_INIT produced by this driver
77 EFI_IDE_CONTROLLER_INIT_PROTOCOL IdeInit
;
80 // copy of protocol pointers used by this driver
82 EFI_PCI_IO_PROTOCOL
*PciIo
;
85 // The highest disqulified mode for each attached Ide device.
86 // Per ATA/ATAPI spec, if a mode is not supported, the modes higher than
87 // it should not be supported
89 EFI_ATA_COLLECTIVE_MODE DisqulifiedModes
[ICH_IDE_MAX_CHANNEL
][ICH_IDE_MAX_DEVICES
];
92 // A copy of EFI_IDENTIFY_DATA data for each attached Ide device and its flag
94 EFI_IDENTIFY_DATA IdentifyData
[ICH_IDE_MAX_CHANNEL
][ICH_IDE_MAX_DEVICES
];
95 BOOLEAN IdentifyValid
[ICH_IDE_MAX_CHANNEL
][ICH_IDE_MAX_DEVICES
];
97 } EFI_IDE_CONTROLLER_PRIVATE_DATA
;
99 #define IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS(a) \
101 EFI_IDE_CONTROLLER_PRIVATE_DATA, \
103 IDE_CONTROLLER_SIGNATURE \
107 // Driver binding functions declaration
111 IdeControllerSupported (
112 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
113 IN EFI_HANDLE Controller
,
114 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
120 Register Driver Binding protocol for this driver.
124 This -- a pointer points to the Binding Protocol instance
125 Controller -- The handle of controller to be tested.
126 *RemainingDevicePath -- A pointer to the device path. Ignored by device
127 driver but used by bus driver
131 EFI_SUCCESS -- Driver loaded.
132 other -- Driver not loaded.
139 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
140 IN EFI_HANDLE Controller
,
141 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
147 This routine is called right after the .Supported() called and return
148 EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
153 This -- a pointer points to the Binding Protocol instance
154 Controller -- The handle of controller to be tested. Parameter
156 *RemainingDevicePath -- A pointer to the device path. Should be ignored by
164 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
165 IN EFI_HANDLE Controller
,
166 IN UINTN NumberOfChildren
,
167 IN EFI_HANDLE
*ChildHandleBuffer
172 Stop this driver on Controller Handle.
175 This - Protocol instance pointer.
176 Controller - Handle of device to stop driver on
177 NumberOfChildren - Not used
178 ChildHandleBuffer - Not used
181 EFI_SUCCESS - This driver is removed DeviceHandle
182 other - This driver was not removed from this device
188 // IDE controller init functions declaration
192 IdeInitGetChannelInfo (
193 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
195 OUT BOOLEAN
*Enabled
,
196 OUT UINT8
*MaxDevices
202 TODO: Add function description
206 This - TODO: add argument description
207 Channel - TODO: add argument description
208 Enabled - TODO: add argument description
209 MaxDevices - TODO: add argument description
213 TODO: add return values
221 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
222 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase
,
229 TODO: Add function description
233 This - TODO: add argument description
234 Phase - TODO: add argument description
235 Channel - TODO: add argument description
239 TODO: add return values
247 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
250 IN EFI_IDENTIFY_DATA
*IdentifyData
256 TODO: Add function description
260 This - TODO: add argument description
261 Channel - TODO: add argument description
262 Device - TODO: add argument description
263 IdentifyData - TODO: add argument description
267 TODO: add return values
274 IdeInitSubmitFailingModes (
275 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
283 TODO: Add function description
287 This - TODO: add argument description
288 Channel - TODO: add argument description
289 Device - TODO: add argument description
293 TODO: add return values
300 IdeInitDisqualifyMode (
301 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
304 IN EFI_ATA_COLLECTIVE_MODE
*BadModes
310 TODO: Add function description
314 This - TODO: add argument description
315 Channel - TODO: add argument description
316 Device - TODO: add argument description
317 BadModes - TODO: add argument description
321 TODO: add return values
328 IdeInitCalculateMode (
329 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
332 IN EFI_ATA_COLLECTIVE_MODE
**SupportedModes
338 TODO: Add function description
342 This - TODO: add argument description
343 Channel - TODO: add argument description
344 Device - TODO: add argument description
345 SupportedModes - TODO: add argument description
349 TODO: add return values
357 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
360 IN EFI_ATA_COLLECTIVE_MODE
*Modes
366 TODO: Add function description
370 This - TODO: add argument description
371 Channel - TODO: add argument description
372 Device - TODO: add argument description
373 Modes - TODO: add argument description
377 TODO: add return values