2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
28 #include <IOKit/IOMemoryCursor.h>
29 #include <IOKit/ppc/IODBDMA.h>
31 #include <IOKit/ata/IOATAStandardInterface.h>
33 class AppleUltra66ATA
: public IOATAStandardDriver
35 OSDeclareDefaultStructors( AppleUltra66ATA
)
41 bool configure( IOService
*provider
, ATAControllerInfo
*controllerDataSize
);
43 void enableControllerInterrupts();
44 void disableControllerInterrupts();
46 bool calculateTiming( UInt32 deviceNum
, ATATiming
*timing
);
47 bool selectTiming( UInt32 deviceNum
, ATATimingProtocol timingProtocol
);
49 void newDeviceSelected( IOATAStandardDevice
*newDevice
);
51 void writeATAReg( UInt32 regIndex
, UInt32 regValue
);
52 UInt32
readATAReg( UInt32 regIndex
);
54 bool programDma( IOATAStandardCommand
*cmd
);
55 bool startDma( IOATAStandardCommand
*cmd
);
56 bool stopDma( IOATAStandardCommand
*cmd
, UInt32
*transferCount
);
58 bool checkDmaActive();
61 bool identifyController();
63 bool calculatePIOTiming( UInt32 deviceNum
, ATATiming
*timing
);
64 bool calculateDMATiming( UInt32 deviceNum
, ATATiming
*timing
);
66 bool calculateUltra66PIOTiming( UInt32 deviceNum
, ATATiming
*timing
);
67 bool calculateUltra66DMATiming( UInt32 deviceNum
, ATATiming
*timing
);
68 bool calculateUltra66UDMATiming( UInt32 deviceNum
, ATATiming
*timing
);
73 IOMemoryMap
*ioMapATA
;
74 volatile UInt32
*ioBaseATA
;
76 IOMemoryMap
*ioMapDMA
;
77 volatile IODBDMAChannelRegisters
*ioBaseDMA
;
79 UInt32 controllerType
;
81 IOInterruptEventSource
*interruptEventSource
;
83 UInt32 ideTimingWord
[2];
85 IOBigMemoryCursor
*dmaMemoryCursor
;
86 IODBDMADescriptor
*dmaDescriptors
;
87 UInt32 dmaDescriptorsPhys
;
88 UInt32 numDescriptors
;
91 UInt32 bitBucketAddrPhys
;
100 #define kATACS3RegBase (16)
105 kATAUltra66ClockPS
= (15 * 1000 / 2), // PCI 66 period / 2 (pS)
107 kATAPioAccessBase
= 0,
108 kATAPioAccessMin
= 4,
109 kATAPioRecoveryBase
= 4,
110 kATAPioRecoveryMin
= 1,
112 kATADmaAccessBase
= 0,
113 kATADmaAccessMin
= 1,
114 kATADmaRecoveryBase
= 1,
115 kATADmaRecoveryMin
= 1,
120 kControllerTypeDBDMAVersion1
= 1,
121 kControllerTypeDBDMAVersion2
= 2,
122 kControllerTypeUltra66DBDMA
= 3,