Annotation of XNU/iokit/Drivers/ata/drvAppleATA/AppleATA.h, revision 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:  *     AppleATA.h
        !            25:  *
        !            26:  */
        !            27: #include <IOKit/ata/IOATA.h>
        !            28: #include <IOKit/ata/IOATAController.h>
        !            29: 
        !            30: class AppleATA : public IOATAController
        !            31: {
        !            32:     OSDeclareAbstractStructors( AppleATA )
        !            33: 
        !            34: /*
        !            35:  *     Subclasses of AppleATA must implement these methods.
        !            36:  */
        !            37: public:
        !            38: 
        !            39:     virtual void               writeATAReg( UInt32 regIndex, UInt32 regValue )                 = 0;
        !            40:     virtual UInt32             readATAReg(  UInt32 regIndex )                                  = 0;
        !            41: 
        !            42: /*
        !            43:  *     Subclasses of AppleATA must implement these methods if they support dma transfers. 
        !            44:  */
        !            45:     virtual bool               programDma( IOATACommand *cmd );
        !            46:     virtual bool               startDma( IOATACommand *cmd );
        !            47:     virtual bool               stopDma( IOATACommand *cmd, UInt32 *transferCount );
        !            48: 
        !            49: /*
        !            50:  *     These methods are provided to the IOATAController superclass. The remaining methods
        !            51:  *     required by the IOATAController superclass must be implemented by subclasses of 
        !            52:  *      AppleATA.
        !            53:  */
        !            54: public:
        !            55:    
        !            56:     virtual bool                       resetBus();
        !            57:     virtual bool                       executeCommand( IOATACommand *cmd );
        !            58:     virtual bool                       abortCommand( IOATACommand *cmd );
        !            59:     virtual IOCommandQueueAction        provideQueueHandler( IOATADevice * );
        !            60: 
        !            61: 
        !            62: /*
        !            63:  *     These methods provide a default ATA protocol implemenation to subclasses of AppleATA.
        !            64:  *
        !            65:  *     Subclasses of AppleATA may modify or replace these methods to suit their requirements.
        !            66:  */
        !            67: protected:
        !            68: 
        !            69:     virtual void                       commandOccurred( void *p0, void *p1, void *p2, void *p3 );
        !            70: 
        !            71:     virtual void                       newDeviceSelected( IOATADevice *newDevice );
        !            72: 
        !            73:     virtual void                       interruptOccurred();
        !            74:     virtual void                       processATAPioInt();
        !            75:     virtual void                       processATADmaInt();
        !            76:     virtual void                       processATAPIPioInt();
        !            77:     virtual void                       processATAPIDmaInt();
        !            78: 
        !            79:     virtual ATAReturnCode              readATAPIDevice( UInt32 n );
        !            80:     virtual ATAReturnCode              writeATAPIDevice( UInt32 n );
        !            81:     virtual ATAReturnCode              sendATAPIPacket();              
        !            82: 
        !            83:     virtual void                       doProtocolSetRegs( IOATACommand *cmd );
        !            84:     virtual void                       doATAProtocolPio( IOATACommand *cmd );
        !            85:     virtual void                       doATAProtocolDma( IOATACommand *cmd );
        !            86:     virtual void                       doATAPIProtocolPio( IOATACommand *cmd );
        !            87:     virtual void                       doATAPIProtocolDma( IOATACommand *cmd );
        !            88:     virtual void                       doProtocolNotSupported( IOATACommand *cmd );
        !            89:     virtual bool                       doRequestSense( IOATACommand *cmd );
        !            90:     virtual void                       didRequestSense( IOService *, IOATACommand *reqSenseCmd, IOATACommand *origCmd );
        !            91: 
        !            92:     virtual bool                       selectDrive( UInt32 driveHeadReg );  
        !            93: 
        !            94:     virtual void                       completeCmd( IOATACommand *cmd, ATAReturnCode returnCode, UInt32 bytesTransferred = 0 );
        !            95:     virtual void                       completeCmd( IOATACommand *cmd );
        !            96: 
        !            97:     virtual void                       updateCmdStatus( IOATACommand *cmd, ATAReturnCode returnCode, UInt32 bytesTransferred );
        !            98: 
        !            99:     virtual bool                       waitForStatus( UInt32 statusBitsOn, UInt32 statusBitsOff, UInt32 timeoutmS );
        !           100: 
        !           101: 
        !           102: protected:
        !           103: 
        !           104:     IOATACommand               *xferCmd;
        !           105:     IOATACommand               *xferCmdSave;
        !           106:     UInt32                     xferCmdTimer;
        !           107:     IOMemoryDescriptor         *xferDesc;
        !           108:     bool                       xferIsWrite;
        !           109:     UInt32                     xferCount;
        !           110:     UInt32                     xferInts;
        !           111:     UInt32                     xferRemaining;
        !           112: 
        !           113:     IOATADevice                        *currentDevice;
        !           114: 
        !           115: };  
        !           116: 
        !           117: #define ATATimerIntervalmS     250
        !           118: 
        !           119: enum
        !           120: {
        !           121:     ataBusyTimeoutmS = 10,
        !           122: };

unix.superglobalmegacorp.com

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