Annotation of XNU/iokit/IOKit/ata/IOATACommand.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:  *     IOATACommand.h
        !            25:  *
        !            26:  */
        !            27: 
        !            28: class IOSyncer;
        !            29: class IOATADevice;
        !            30: class IOATACommand;
        !            31: 
        !            32: typedef void (*ATACallback)(void *target, IOService *device, IOATACommand *ataCmd, void *refcon );
        !            33: 
        !            34: class IOATACommand : public OSObject
        !            35: {
        !            36:     OSDeclareDefaultStructors(IOATACommand)
        !            37: 
        !            38:     friend class IOATAController;
        !            39:     friend class IOATADevice;
        !            40: 
        !            41: public:  
        !            42:     /*  
        !            43:      *         Methods to initialize an ATACommand
        !            44:      *
        !            45:      *         Note:   These methods are usually invoked by the device client to setup and
        !            46:      *         submit an ATACommand.
        !            47:      */
        !            48:     void               clear();
        !            49:     void               setTaskfile( ATATaskfile *taskfile );                                           
        !            50:     void               setATAPICmd( ATAPICmd *atapiCmd, IOMemoryDescriptor *senseData = NULL, UInt32 senseLength = 0 );        
        !            51:     void               setPointers( IOMemoryDescriptor *desc, UInt32 transferCount, bool isWrite );    
        !            52:     void               setTimeout( UInt32  timeout );                                            
        !            53:     void               setCallback( void *target = 0, ATACallback ataDoneFn = 0, void *refcon = 0 );   
        !            54:     ATAReturnCode      getResults( ATAResults *results );
        !            55: 
        !            56:     /* 
        !            57:      * Methods to submit/cancel an ATACommand
        !            58:      */                                
        !            59:     bool               execute();
        !            60:     bool               abort();
        !            61: 
        !            62: 
        !            63:     /*
        !            64:      *         Methods to interrogate an ATACommand
        !            65:      *
        !            66:      *         Note:   These methods are usually invoked by the controller driver to find out about 
        !            67:      *         the ATA Command. They may be also invoked by the device client to find out
        !            68:      *         about completed command.
        !            69:      */
        !            70:     IOATADevice        *getDevice();
        !            71:     IOATAController    *getController();
        !            72:     IOCommandQueue      *getDeviceQueue();
        !            73:     void               getTaskfile( ATATaskfile *taskfile );                   
        !            74:     void               getATAPICmd( ATAPICmd *cdb, IOMemoryDescriptor **senseData = NULL, UInt32 *senseLength = NULL );        
        !            75:     void               getPointers( IOMemoryDescriptor **desc, UInt32 *transferCount, bool *isWrite ); 
        !            76:     UInt32             getTimeout();                                                   
        !            77:     ATAProtocol                getProtocol();
        !            78:     UInt32             getResultMask();
        !            79: 
        !            80: 
        !            81:     /*
        !            82:      *         Methods to complete an ATACommand
        !            83:      *
        !            84:      *         Note:   These methods are usually invoked by the controller driver. 
        !            85:      */
        !            86:     void               setResults( ATAResults *results );                                              
        !            87:     void               complete();
        !            88:  
        !            89:     /*
        !            90:      * Methods to address controller and client private per command data areas.
        !            91:      */
        !            92:     void               *getControllerData();
        !            93:     void               *getClientData();
        !            94: 
        !            95: /*------------------Methods private to the IOATACommand class-------------------------*/
        !            96: enum ATACommandFlags
        !            97: {
        !            98:     atacmdTaskfileValid                = 0x00000001,
        !            99:     atacmdPointersValid                = 0x00000002,
        !           100:     atacmdResultsValid         = 0x00000004,
        !           101:     atacmdCallbackValid                = 0x00000008,
        !           102:     atacmdATAPIInfoValid       = 0x00000010,
        !           103: };
        !           104: 
        !           105: public:
        !           106:     void               free();
        !           107: 
        !           108: private:
        !           109:     void               setController( IOATAController *ctrlr );
        !           110:     void               setDevice( IOATADevice *dev );
        !           111:  
        !           112: private:
        !           113:     UInt32             flags;
        !           114:     
        !           115:     IOATAController     *controller;
        !           116:     IOATADevice         *device;
        !           117:     IOCommandQueue     *deviceQueue;
        !           118:  
        !           119:     ATATaskfile                taskfile;
        !           120:     ATAResults         results;
        !           121:     UInt32             timeout;
        !           122: 
        !           123:     IOMemoryDescriptor *xferDesc;
        !           124:     UInt32             xferCount;
        !           125:     UInt32             xferDirection;
        !           126: 
        !           127:     ATAPICmd           atapiCmd;
        !           128:     UInt32             senseLength;
        !           129:     IOMemoryDescriptor *senseData;
        !           130:     
        !           131:     union
        !           132:     {
        !           133:         struct
        !           134:         {
        !           135:             IOSyncer *syncer;
        !           136:         } sync;
        !           137:         struct
        !           138:         {
        !           139:            ATACallback         ataDoneFn;
        !           140:            void                *target;
        !           141:            void                *refcon;
        !           142:         } async;
        !           143:      } completionInfo;
        !           144: 
        !           145:     UInt32             dataSize;
        !           146:     void                *dataArea;
        !           147:     void               *controllerData;
        !           148:     void               *clientData;              
        !           149: };

unix.superglobalmegacorp.com

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