|
|
1.1 root 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: * AppleATAUltra646.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 "AppleATA.h"
34: #include "AppleATAUltra646Regs.h"
35:
36: class AppleATAUltra646 : public AppleATA
37: {
38: OSDeclareDefaultStructors( AppleATAUltra646 )
39:
40: public:
41: virtual bool getPath( char * path, int * length, const IORegistryPlane * plane ) const;
42: virtual IOService * matchLocation( IOService * client );
43: void free();
44:
45: protected:
46: bool configure( IOService *provider, UInt32 *controllerDataSize );
47:
48: bool createWorkLoop( IOWorkLoop **workLoop );
49:
50: void interruptOccurred();
51:
52: void enableControllerInterrupts();
53: void disableControllerInterrupts();
54:
55: bool provideProtocols( ATAProtocol *protocolsSupported );
56: bool provideTimings( UInt32 *numTimings, ATATiming *timingsSupported );
57: bool calculateTiming( UInt32 deviceNum, ATATiming *timing );
58:
59: bool selectTiming( UInt32 deviceNum, ATATimingProtocol timingProtocol );
60:
61: void newDeviceSelected( IOATADevice *newDevice );
62:
63: void writeATAReg( UInt32 regIndex, UInt32 regValue );
64: UInt32 readATAReg( UInt32 regIndex );
65:
66: bool programDma( IOATACommand *cmd );
67: bool startDma( IOATACommand *cmd );
68: bool stopDma( IOATACommand *cmd, UInt32 *transferCount );
69:
70: void ataTimer( IOTimerEventSource *time );
71:
72: private:
73: bool calculatePIOTiming( UInt32 deviceNum, ATATiming *timing );
74: bool calculateDMATiming( UInt32 deviceNum, ATATiming *timing );
75: bool calculateUltraDMATiming( UInt32 deviceNum, ATATiming *timing );
76:
77: UInt32 pciReadByte( UInt32 reg );
78: void pciWriteByte( UInt32 reg, UInt32 value );
79: UInt32 pciReadLong( UInt32 reg );
80: void pciWriteLong( UInt32 reg, UInt32 value );
81:
82: private:
83: IOPCIDevice *provider;
84: IOService *pathProvider;
85:
86: UInt32 busNum;
87:
88: IOMemoryMap *ioMapATA[2];
89: volatile UInt32 *ioBaseATA[2];
90:
91: IOTimerEventSource *timerEventSource;
92: IOInterruptEventSource *interruptEventSource;
93:
94: Ultra646Regs ideTimingRegs[2];
95:
96: IOBigMemoryCursor *dmaMemoryCursor;
97: Ultra646Descriptor *dmaDescriptors;
98: UInt32 dmaDescriptorsPhys;
99: UInt32 numDescriptors;
100:
101: void *bitBucketAddr;
102: UInt32 bitBucketAddrPhys;
103:
104: UInt32 dmaReqLength;
105: bool dmaIsWrite;
106: };
107:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.