]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * | |
24 | * AppleUltra33ATA.h | |
25 | * | |
26 | */ | |
27 | ||
28 | #include <IOKit/IOTimerEventSource.h> | |
29 | #include <IOKit/IOMemoryCursor.h> | |
30 | #include <IOKit/pci/IOPCIDevice.h> | |
31 | #include <libkern/OSByteOrder.h> | |
32 | ||
33 | #include <IOKit/ata/IOATAStandardInterface.h> | |
34 | #include "AppleUltra33ATARegs.h" | |
35 | ||
36 | class AppleUltra33ATA : public IOATAStandardDriver | |
37 | { | |
38 | OSDeclareDefaultStructors( AppleUltra33ATA ) | |
39 | ||
40 | public: | |
41 | virtual bool attach( IOService * provider ); | |
42 | virtual void detach( IOService * provider ); | |
43 | void free(); | |
44 | ||
45 | protected: | |
46 | bool configure( IOService *provider, ATAControllerInfo *controllerDataSize ); | |
47 | ||
48 | void interruptOccurred(); | |
49 | ||
50 | void enableControllerInterrupts(); | |
51 | void disableControllerInterrupts(); | |
52 | ||
53 | bool calculateTiming( UInt32 deviceNum, ATATiming *timing ); | |
54 | bool selectTiming( UInt32 deviceNum, ATATimingProtocol timingProtocol ); | |
55 | ||
56 | void newDeviceSelected( IOATADevice *newDevice ); | |
57 | ||
58 | void writeATAReg( UInt32 regIndex, UInt32 regValue ); | |
59 | UInt32 readATAReg( UInt32 regIndex ); | |
60 | ||
61 | bool programDma( IOATAStandardCommand *cmd ); | |
62 | bool startDma( IOATAStandardCommand *cmd ); | |
63 | bool stopDma( IOATAStandardCommand *cmd, UInt32 *transferCount ); | |
64 | bool checkDmaActive(); | |
65 | bool resetDma(); | |
66 | ||
67 | private: | |
68 | bool calculatePIOTiming( UInt32 deviceNum, ATATiming *timing ); | |
69 | bool calculateDMATiming( UInt32 deviceNum, ATATiming *timing ); | |
70 | bool calculateUltraDMATiming( UInt32 deviceNum, ATATiming *timing ); | |
71 | ||
72 | UInt32 pciReadByte( UInt32 reg ); | |
73 | void pciWriteByte( UInt32 reg, UInt32 value ); | |
74 | UInt32 pciReadLong( UInt32 reg ); | |
75 | void pciWriteLong( UInt32 reg, UInt32 value ); | |
76 | ||
77 | private: | |
78 | IOPCIDevice *provider; | |
79 | IOService *pathProvider; | |
80 | ||
81 | UInt32 busNum; | |
82 | ||
83 | IOMemoryMap *ioMapATA[2]; | |
84 | volatile UInt32 *ioBaseATA[2]; | |
85 | ||
86 | IOInterruptEventSource *interruptEventSource; | |
87 | ||
88 | Ultra646Regs ideTimingRegs[2]; | |
89 | ||
90 | IOBigMemoryCursor *dmaMemoryCursor; | |
91 | Ultra646Descriptor *dmaDescriptors; | |
92 | UInt32 dmaDescriptorsPhys; | |
93 | UInt32 numDescriptors; | |
94 | ||
95 | void *bitBucketAddr; | |
96 | UInt32 bitBucketAddrPhys; | |
97 | ||
98 | UInt32 dmaReqLength; | |
99 | bool dmaIsWrite; | |
100 | }; | |
101 |