IOSCSIParallelController.h [plain text]
#ifndef _IOSCSIPARALLELCONTROLLER_H
#define _IOSCSIPARALLELCONTROLLER_H
#include <IOKit/IOService.h>
#include <IOKit/IOWorkLoop.h>
#include <IOKit/IOCommandGate.h>
#include <IOKit/IOInterruptEventSource.h>
#include <IOKit/IOTimerEventSource.h>
#include <libkern/OSByteOrder.h>
#include <IOKit/IOMemoryCursor.h>
#include "SCSIDevice.h"
#include "SCSIParallelController.h"
class SCSITarget;
class IOSCSIParallelCommand;
class IOSCSIParallelDevice;
class IOSCSIParallelController : public IOService
{
OSDeclareDefaultStructors(IOSCSIParallelController)
friend class IOSCSIParallelCommand;
friend class IOSCSIParallelDevice;
public:
bool probeTarget( SCSITargetLun targetLun );
void reset();
protected:
void resetOccurred();
void enableCommands();
void disableCommands();
void disableCommands( UInt32 disableTimeoutmS );
void rescheduleCommand( IOSCSIParallelCommand *forSCSICmd );
IOSCSIParallelDevice *findDeviceWithTargetLun( SCSITargetLun targetLun );
IOSCSIParallelCommand *findCommandWithNexus( SCSITargetLun targetLun, UInt32 tagValue = (UInt32)-1 );
void *getTargetData( SCSITargetLun targetLun );
void *getLunData( SCSITargetLun targetLun );
virtual IOWorkLoop *getWorkLoop() const;
void setCommandLimit( UInt32 commandLimit );
protected:
virtual bool configure( IOService *provider, SCSIControllerInfo *controllerInfo ) = 0;
virtual void executeCommand( IOSCSIParallelCommand *forSCSICmd ) = 0;
virtual void cancelCommand( IOSCSIParallelCommand *forSCSICmd ) = 0;
virtual void resetCommand( IOSCSIParallelCommand *forSCSICmd ) = 0;
protected:
virtual bool allocateTarget( SCSITargetLun targetLun );
virtual void deallocateTarget( SCSITargetLun targetLun );
virtual bool allocateLun( SCSITargetLun targetLun );
virtual void deallocateLun( SCSITargetLun targetLun );
virtual void disableTimeoutOccurred();
public:
bool start( IOService *provider );
void free();
private:
IOSCSIParallelDevice *createDevice();
void initQueues();
bool scanSCSIBus();
bool initTarget( SCSITargetLun targetLun );
bool initTargetGated( SCSITargetLun *targetLun );
void releaseTarget( SCSITargetLun targetLun );
void releaseTargetGated( SCSITargetLun *targetLun );
bool initDevice( IOSCSIParallelDevice *device );
bool initDeviceGated( IOSCSIParallelDevice *device );
void releaseDevice( IOSCSIParallelDevice *device );
void releaseDeviceGated( IOSCSIParallelDevice *device );
void addDevice( IOSCSIParallelDevice *forDevice );
void deleteDevice( IOSCSIParallelDevice *forDevice );
void timer( IOTimerEventSource *);
void dispatchRequest();
void dispatch();
bool checkBusReset();
void completeCommand( IOSCSIParallelCommand *forSCSICmd );
bool createWorkLoop();
bool configureController();
IOSCSIParallelCommand *allocCommand( UInt32 clientDataSize );
private:
UInt32 sequenceNumber;
UInt32 commandCount;
UInt32 commandLimit;
UInt32 commandLimitSave;
UInt32 disableTimer;
bool commandDisable;
UInt32 tagArraySize;
UInt32 *tagArray;
UInt32 busResetState;
IOSCSIParallelCommand *resetCmd;
UInt32 resetTimer;
IOSCSIParallelCommand *noDisconnectCmd;
SCSIControllerInfo controllerInfo;
SCSITarget *targets;
IOWorkLoop *workLoop;
IOTimerEventSource *timerEvent;
IOInterruptEventSource *dispatchEvent;
IOCommandGate *controllerGate;
IOService *provider;
static SInt32 sDomainCount;
};
#endif