|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * AppleATAPIIX.h - ATA controller driver for Intel PIIX/PIIX3/PIIX4. ! 5: * ! 6: * HISTORY ! 7: * ! 8: */ ! 9: ! 10: #ifndef _APPLEATAPIIX_H ! 11: #define _APPLEATAPIIX_H ! 12: ! 13: #include <IOKit/IOTimerEventSource.h> ! 14: #include <IOKit/IOMemoryCursor.h> ! 15: #include <IOKit/pci/IOPCIDevice.h> ! 16: #include <libkern/OSByteOrder.h> ! 17: ! 18: #include "AppleATA.h" ! 19: #include "AppleATAPIIXRegs.h" ! 20: #include "AppleATAPIIXTiming.h" ! 21: ! 22: class AppleATAPIIX : public AppleATA ! 23: { ! 24: OSDeclareDefaultStructors( AppleATAPIIX ) ! 25: ! 26: protected: ! 27: IOPCIDevice * provider; // our provider ! 28: UInt32 pciCFID; // our PCI vendor/device ID ! 29: UInt32 channel; // IDE channel ! 30: UInt16 ioCmdRange; // command block ! 31: UInt16 ioCtlRange; // control block ! 32: UInt16 ioBMRange; // bus-master register block ! 33: UInt32 dmaReqLength; // transaction state ! 34: bool dmaIsWrite; // transaction state ! 35: prdEntry_t * prdTable; // physical region descriptor table ! 36: IOPhysicalAddress prdTablePhys; // physical address of prdTable ! 37: PIIXSelectedTimings timings[2]; // drive0 and drive1 timings ! 38: IOLittleMemoryCursor * prdCursor; // request -> scatter-gather list ! 39: IOTimerEventSource * timerEventSource; ! 40: IOInterruptEventSource * interruptEventSource; ! 41: ! 42: /* ! 43: * Internal (private) functions. ! 44: */ ! 45: bool _getIDERanges(IOPCIDevice * provider); ! 46: bool _getBMRange(IOPCIDevice * provider); ! 47: bool _allocatePRDTable(); ! 48: void _deallocatePRDTable(); ! 49: bool _resetTimings(); ! 50: bool _readPCIConfigSpace(UInt8 * configSpace); ! 51: bool _writePCIConfigSpace(UInt8 * configSpace); ! 52: bool _selectTiming(UInt32 unit, ! 53: PIIXProtocol timingProtocol, ! 54: UInt8 * pciConfig); ! 55: ! 56: public: ! 57: /* ! 58: * Class initializer. ! 59: */ ! 60: static void initialize(); ! 61: ! 62: /* ! 63: * Returns the IDE channel for the current driver instance. ! 64: */ ! 65: static int PIIXGetChannel(IOPCIDevice * provider); ! 66: ! 67: /* ! 68: * Functions defined by our superclass that we must override. ! 69: */ ! 70: void writeATAReg(UInt32 regIndex, UInt32 regValue); ! 71: ! 72: UInt32 readATAReg(UInt32 regIndex); ! 73: ! 74: void free(); ! 75: ! 76: bool configure(IOService * forProvider, ! 77: UInt32 * controllerDataSize); ! 78: ! 79: bool createWorkLoop(IOWorkLoop ** workLoop); ! 80: ! 81: bool provideProtocols(enum ATAProtocol * protocolsSupported); ! 82: ! 83: bool provideTimings(UInt32 * numTimings, ! 84: ATATiming * timingsSupported); ! 85: ! 86: bool calculateTiming(UInt32 deviceNum, ATATiming * pTiming); ! 87: ! 88: bool selectTiming(UInt32 unitNum, ! 89: ATATimingProtocol timingProtocol); ! 90: ! 91: void disableControllerInterrupts(); ! 92: void enableControllerInterrupts(); ! 93: ! 94: void ataTimer(IOTimerEventSource * sender); ! 95: ! 96: /* ! 97: * Functions that must be implemented by a bus-master controller. ! 98: */ ! 99: bool programDma(IOATACommand * cmd); ! 100: bool startDma(IOATACommand * cmd); ! 101: bool stopDma(IOATACommand * cmd, UInt32 * transferCount); ! 102: ! 103: /* ! 104: * Miscellaneous functions. ! 105: */ ! 106: void interruptOccurred(); ! 107: }; ! 108: ! 109: #endif /* !_APPLEATAPIIX_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.