Annotation of XNU/iokit/IOKit/ata/IOATAController.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:  *     IOATAController.h
        !            25:  *
        !            26:  *     Methods in this header list the methods an ATA controller driver must implement. 
        !            27:  */
        !            28: #include <IOKit/IOWorkLoop.h>
        !            29: #include <IOKit/IOCommandQueue.h>
        !            30: #include <IOKit/IOInterruptEventSource.h>
        !            31: 
        !            32: 
        !            33: class IOATACommand;
        !            34: 
        !            35: class IOATAController : public IOService
        !            36: {
        !            37:     OSDeclareAbstractStructors(IOATAController)
        !            38: 
        !            39:     friend class IOATACommand;
        !            40:     friend class IOATADevice;
        !            41: 
        !            42: /*------------------Methods the controller subclass must implement-----------------------*/
        !            43: protected:
        !            44:     /*
        !            45:      *   Initialize controller hardware.
        !            46:      *
        !            47:      *   Note: The controller driver's configure() method will be called prior to any other
        !            48:      *         methods. If the controller driver returns successfully from this method it
        !            49:      *         should be ready to accept any other method call listed.
        !            50:      */
        !            51:     virtual bool       configure( IOService *provider, UInt32 *controllerDataSize ) = 0;
        !            52: 
        !            53:     /*
        !            54:      *   Setup device queues.
        !            55:      *
        !            56:      *   Note: The controller driver should subclass and respond to provideQueueHandler(). 
        !            57:      *         The super class implementation returns NULL. 
        !            58:      *         
        !            59:      *         If the controller driver implementation manages its own queues, it
        !            60:      *         should subclass createWorkLoop() and return true with *workLoop = NULL.
        !            61:      */
        !            62:     virtual IOCommandQueueAction       provideQueueHandler( IOATADevice *ataDev );
        !            63: 
        !            64:     virtual bool                       createWorkLoop( IOWorkLoop **workLoop );
        !            65:     virtual IOCommandQueue             *createDeviceQueue( IOATADevice *ataDev );
        !            66: 
        !            67:     virtual void                       enableDeviceQueue( IOATADevice *ataDev = NULL );
        !            68:     virtual void                       disableDeviceQueue( IOATADevice *ataDev = NULL );
        !            69: 
        !            70:     /*    
        !            71:      *  Methods information about driver/hardware capabilities
        !            72:      */
        !            73:     virtual bool       provideProtocols( ATAProtocol *protocolsSupported )                     = 0;
        !            74:     virtual bool       provideTimings( UInt32 *numTimings, ATATiming *timingsSupported )       = 0;
        !            75: 
        !            76:     /*
        !            77:      *  Methods to set timing for individual devices
        !            78:      */        
        !            79:     virtual bool       calculateTiming( UInt32 deviceNum,  ATATiming *timing )                 = 0;
        !            80:     virtual bool       selectTiming( UInt32 deviceNum, ATATimingProtocol timingProtocol )      = 0;
        !            81: 
        !            82:     /*
        !            83:      *  Method to perform an ATA Bus Reset
        !            84:      */
        !            85:     virtual bool       resetBus();
        !            86:     virtual void        resetBusRequest();
        !            87: 
        !            88:     /*
        !            89:      *  Methods to execute and abort an ATACommand
        !            90:      */
        !            91:     virtual bool       executeCommand( IOATACommand *cmd )     = 0;
        !            92:     virtual bool       abortCommand( IOATACommand *cmd )       = 0;
        !            93: 
        !            94:     /*
        !            95:      *  ATAPI specific
        !            96:      */
        !            97:     IOATACommand       *makeRequestSense( IOATACommand *origCmd );
        !            98:     bool               completeRequestSense( IOATACommand *origCmd, IOATACommand *reqSenseCmd );
        !            99: 
        !           100:     /*
        !           101:      *
        !           102:      */
        !           103:     virtual void       enableControllerInterrupts();
        !           104:     virtual void       disableControllerInterrupts();
        !           105:     
        !           106: 
        !           107: /*------------------Methods private to the IOATAController class----------------------*/
        !           108: public:
        !           109:     bool               matchNubWithPropertyTable( IOService *nub, OSDictionary *table );
        !           110:     virtual void       free();
        !           111: 
        !           112:     // Implement IOService::getWorkLoop()
        !           113:     virtual IOWorkLoop *getWorkLoop() const;
        !           114: 
        !           115: private:
        !           116:     bool               start( IOService *provider );
        !           117: 
        !           118:     bool               scanATABus();
        !           119: 
        !           120:     bool               probeController();
        !           121:     bool               createResetWorker();
        !           122:     bool                createDeviceNubs();
        !           123:     bool               probeDeviceNubs();
        !           124:     bool               registerDeviceNubs();
        !           125: 
        !           126:     void               purgeDeviceQueue( IOATADevice *device );
        !           127:     void                purgeCommand( void *p0, void *p1, void *p2, void *p3 );
        !           128: 
        !           129:     void               resetWorker( void *, void *, void *, void * );
        !           130: 
        !           131:     void               changeDeviceQueue( IOATADevice *ataDev, bool fEnable );
        !           132: 
        !           133:     IOATACommand        *allocCommand( UInt32 clientDataSize = 0 );
        !           134:     void               completeCommand( IOATACommand *cmd );
        !           135:     void               releaseCommand();
        !           136: 
        !           137: private:
        !           138:     UInt32             controllerDataSize;
        !           139: 
        !           140:     struct
        !           141:     {
        !           142:         IOATADevice    *device;
        !           143:         IOService      *client;
        !           144:     } deviceInfo[2];
        !           145: 
        !           146:     IOWorkLoop         *workLoop;
        !           147:     IOWorkLoop         *resetWorkLoop;
        !           148:     IOCommandQueue     *resetCommandQ;
        !           149: 
        !           150:     IOATACommand       *utilCmd;
        !           151: 
        !           152: };
        !           153: 

unix.superglobalmegacorp.com

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