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/IOTimerEventSource.h>
29 #include <IOKit/IOMemoryCursor.h>
30 #include <IOKit/pci/IOPCIDevice.h>
31 #include <libkern/OSByteOrder.h>
33 #include <IOKit/ata/IOATAStandardInterface.h>
34 #include "AppleUltra33ATARegs.h"
36 class AppleUltra33ATA
: public IOATAStandardDriver
38 OSDeclareDefaultStructors( AppleUltra33ATA
)
41 virtual bool attach( IOService
* provider
);
42 virtual void detach( IOService
* provider
);
46 bool configure( IOService
*provider
, ATAControllerInfo
*controllerDataSize
);
48 void interruptOccurred();
50 void enableControllerInterrupts();
51 void disableControllerInterrupts();
53 bool calculateTiming( UInt32 deviceNum
, ATATiming
*timing
);
54 bool selectTiming( UInt32 deviceNum
, ATATimingProtocol timingProtocol
);
56 void newDeviceSelected( IOATADevice
*newDevice
);
58 void writeATAReg( UInt32 regIndex
, UInt32 regValue
);
59 UInt32
readATAReg( UInt32 regIndex
);
61 bool programDma( IOATAStandardCommand
*cmd
);
62 bool startDma( IOATAStandardCommand
*cmd
);
63 bool stopDma( IOATAStandardCommand
*cmd
, UInt32
*transferCount
);
64 bool checkDmaActive();
68 bool calculatePIOTiming( UInt32 deviceNum
, ATATiming
*timing
);
69 bool calculateDMATiming( UInt32 deviceNum
, ATATiming
*timing
);
70 bool calculateUltraDMATiming( UInt32 deviceNum
, ATATiming
*timing
);
72 UInt32
pciReadByte( UInt32 reg
);
73 void pciWriteByte( UInt32 reg
, UInt32 value
);
74 UInt32
pciReadLong( UInt32 reg
);
75 void pciWriteLong( UInt32 reg
, UInt32 value
);
78 IOPCIDevice
*provider
;
79 IOService
*pathProvider
;
83 IOMemoryMap
*ioMapATA
[2];
84 volatile UInt32
*ioBaseATA
[2];
86 IOInterruptEventSource
*interruptEventSource
;
88 Ultra646Regs ideTimingRegs
[2];
90 IOBigMemoryCursor
*dmaMemoryCursor
;
91 Ultra646Descriptor
*dmaDescriptors
;
92 UInt32 dmaDescriptorsPhys
;
93 UInt32 numDescriptors
;
96 UInt32 bitBucketAddrPhys
;