IOATABusCommand.h   [plain text]

 * Copyright (c) 1998-2001 Apple Computer, Inc. All rights reserved.
 * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Apple Public Source License
 * Version 2.0 (the 'License'). You may not use this file except in
 * compliance with the License. Please obtain a copy of the License at
 * and read it before using this
 * file.
 * The Original Code and all software distributed under the License are
 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 * Please see the License for the specific language governing rights and
 * limitations under the License.
 *	IOATABusCommand.h


#include <IOKit/IOTypes.h>
#include "IOATATypes.h"
#include "IOATACommand.h"
#include <IOKit/IOSyncer.h>


@class IOATABusCommand

@discussion ATA Device (disk) drivers should use the superclass, IOATACommand 
and may not derive or use any subclass of IOATACommand. 

IOATABusCommand is the subclass of IOATACommand used by 
IOATAControllers. Controller classes may override this class to 
provide additional fields as their needs dictate or may use this 
as a concrete class if it is sufficient.

IOATAControllers are always paired with specific IOATADevices 
and each specific subclass of IOATADevice is in turn the factory method 
for IOATACommands for use by disk drivers.

In this manner, mass-storage device drivers (disk drivers, clients of 
ATA bus controllers) see only the generalized interface of IOATADevice 
and the generalized interface of IOATACommand. This provides isolation 
from specific bus details for disk drivers and offers flexibility to 
controllers to add per-command fields and state variables for their own 
internal use.


class IOATABusCommand : public IOATACommand {

	OSDeclareDefaultStructors( IOATABusCommand )
	// data items for use by IOATAController
	/*! @var queueChain queue header for use by IOATAController. */
	queue_chain_t	queueChain; 

	/*! @var state state-semaphore for use by IOATAController */
	UInt32 state;
	/*! @var syncer IOSyncer for use by IOATAController */
	IOSyncer* syncer;

	/*!@function allocateCmd
	@abstract factory method to create an instance of this class used by subclasses of IOATADevice
	static IOATABusCommand* allocateCmd(void);

	/*!@function zeroCommand
	@abstract set to blank state, call prior to re-use of this object
	virtual void zeroCommand(void);  	  	  	
 	/*!@function getOpcode
	@abstract return the command opcode
	virtual ataOpcode getOpcode( void );  
	/*!@function getFlags
	@abstract return the flags for this command.
	*/	virtual ataFlags getFlags ( void ); 
	/*!@function getRegMask
	@abstract  get the register mask for desired regs
	virtual ataRegMask getRegMask( void );
	/*!@function getUnit
	@abstract return the unit id (0 master, 1 slave)
	virtual ataUnitID getUnit( void ); 
	/*!@function getTimeoutMS
	@abstract return the timeout value for this command
	virtual UInt32 getTimeoutMS (void ); 
	/*!@function setResult
	@abstract set the result code
	virtual void setResult( IOReturn );

	/*!@function getCallbackPtr
	@abstract return the callback pointer
	virtual IOATACompletionFunction* getCallbackPtr (void ); 
	/*!@function executeCallback
	@abstract call the completion callback function
	virtual void executeCallback(void);

	/*!@function getTaskFilePtr
	@abstract return the taskfile structure pointer.
	virtual ataTaskFile* getTaskFilePtr(void);
	/*!@function getPacketSize
	@abstract return the size of atapi packet if any.
	virtual UInt16 getPacketSize(void);
	/*!@function getPacketData
	@abstract return pointer to the array of packet data. 
	virtual UInt16*	getPacketData(void);
	/*!@function getTransferChunkSize
	@abstract number of bytes between interrupts.
	virtual IOByteCount getTransferChunkSize(void);

	/*!@function setActualTransfer
	@abstract set the byte count of bytes actually transferred.
	virtual void setActualTransfer ( IOByteCount bytesTransferred );
	/*!@function getBuffer
	@abstract get pointer to the memory descriptor for this transaction
	virtual IOMemoryDescriptor* getBuffer ( void);
	/*!@function getPosition
	@abstract the position within the memory buffer for the transaction.
	virtual IOByteCount getPosition (void);
	/*!@function getByteCount
	@abstract return the byte count for this transaction to transfer.
	virtual IOByteCount getByteCount (void);
	/*!@function setCommandInUse
	@abstract mark the command as being in progress.
	virtual void setCommandInUse( bool inUse = true);

	/*!@function init
	@abstract Zeroes all data, returns false if allocation fails. protected.
  	virtual bool init();  

/*! @struct ExpansionData
    @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
    struct ExpansionData { };

/*! @var reserved
    Reserved for future use.  (Internal use only)  */
    ExpansionData *reserved;

    OSMetaClassDeclareReservedUnused(IOATABusCommand, 0);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 1);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 2);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 3);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 4);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 5);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 6);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 7);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 8);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 9);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 10);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 11);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 12);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 13);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 14);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 15);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 16);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 17);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 18);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 19);
    OSMetaClassDeclareReservedUnused(IOATABusCommand, 20);