Annotation of XNU/iokit/Drivers/ata/drvAppleATA/AppleATAPPC.h, revision 1.1.1.1

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:  *     AppleATAPPC.h
                     25:  *
                     26:  */
                     27: 
                     28: #include "AppleATA.h"
                     29: 
                     30: #include <IOKit/IOTimerEventSource.h>
                     31: #include <IOKit/IOMemoryCursor.h>
                     32: #include <IOKit/ppc/IODBDMA.h>
                     33: 
                     34: class AppleATAPPC : public AppleATA
                     35: {
                     36:     OSDeclareDefaultStructors( AppleATAPPC )
                     37: 
                     38: public:
                     39:    void                                free();
                     40: 
                     41: protected:
                     42:     bool                       configure( IOService *provider, UInt32 *controllerDataSize );
                     43: 
                     44:     bool                       createWorkLoop( IOWorkLoop **workLoop );
                     45: 
                     46:     void                       enableControllerInterrupts();
                     47:     void                       disableControllerInterrupts();
                     48: 
                     49:     bool                       provideProtocols( ATAProtocol *protocolsSupported );
                     50:     bool                       provideTimings( UInt32 *numTimings, ATATiming *timingsSupported );
                     51:     bool                       calculateTiming( UInt32 deviceNum, ATATiming *timing );
                     52: 
                     53:     bool                       selectTiming( UInt32 deviceNum, ATATimingProtocol timingProtocol );
                     54: 
                     55:     void                       newDeviceSelected( IOATADevice *newDevice );
                     56: 
                     57:     void                       writeATAReg( UInt32 regIndex, UInt32 regValue );
                     58:     UInt32                     readATAReg(  UInt32 regIndex );
                     59: 
                     60:     bool                       programDma( IOATACommand *cmd );
                     61:     bool                       startDma( IOATACommand *cmd );
                     62:     bool                       stopDma( IOATACommand *cmd, UInt32 *transferCount );
                     63: 
                     64:     void                       ataTimer( IOTimerEventSource *time );
                     65: 
                     66: private:
                     67:     bool                       identifyController();
                     68: 
                     69:     bool                       calculatePIOTiming( UInt32 deviceNum, ATATiming *timing );
                     70:     bool                       calculateDMATiming( UInt32 deviceNum, ATATiming *timing );
                     71: 
                     72:     bool                       calculateUltra66PIOTiming( UInt32 deviceNum, ATATiming *timing );
                     73:     bool                       calculateUltra66DMATiming( UInt32 deviceNum, ATATiming *timing );
                     74:     bool                       calculateUltra66UDMATiming( UInt32 deviceNum, ATATiming *timing );
                     75: 
                     76: private:
                     77:     IOService                          *provider;
                     78: 
                     79:     IOMemoryMap                                *ioMapATA;
                     80:     volatile UInt32                    *ioBaseATA;
                     81: 
                     82:     IOMemoryMap                                *ioMapDMA;
                     83:     volatile IODBDMAChannelRegisters   *ioBaseDMA;
                     84: 
                     85:     UInt32                             controllerType;
                     86: 
                     87:     IOTimerEventSource                 *timerEventSource;
                     88:     IOInterruptEventSource             *interruptEventSource;
                     89: 
                     90:     UInt32                             ideTimingWord[2];
                     91: 
                     92:     IOBigMemoryCursor                  *dmaMemoryCursor;
                     93:     IODBDMADescriptor                  *dmaDescriptors;
                     94:     UInt32                             dmaDescriptorsPhys;
                     95:     UInt32                             numDescriptors;
                     96: 
                     97:     void                               *bitBucketAddr;
                     98:     UInt32                             bitBucketAddrPhys;
                     99: 
                    100:     UInt32                             dmaReqLength;
                    101: };
                    102: 
                    103: /*
                    104:  *
                    105:  *
                    106:  */
                    107: #define kCS3RegBase    (16)
                    108: 
                    109: enum   
                    110: {
                    111:     IDE_SYSCLK_NS              = 30,
                    112:     IDE_ULTRA66_CLOCK_PS       = (15 * 1000 / 2),              // PCI 66 period / 2 (pS)
                    113: 
                    114:     IDE_PIO_ACCESS_BASE                = 0,
                    115:     IDE_PIO_ACCESS_MIN                 = 4,
                    116:     IDE_PIO_RECOVERY_BASE      = 4,
                    117:     IDE_PIO_RECOVERY_MIN       = 1,
                    118: 
                    119:     IDE_DMA_ACCESS_BASE        = 0,
                    120:     IDE_DMA_ACCESS_MIN         = 1,
                    121:     IDE_DMA_RECOVERY_BASE      = 1,
                    122:     IDE_DMA_RECOVERY_MIN       = 1,
                    123: };
                    124: 
                    125: enum
                    126: {
                    127:     kControllerTypeDBDMAVersion1       = 1,
                    128:     kControllerTypeDBDMAVersion2       = 2,
                    129:     kControllerTypeUltra66DBDMA                = 3,
                    130: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.