home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) 1991 NeXT Computer, Inc. All rights reserved.
- *
- * SCSIDisk.h - Exported Interface for SCSI Disk device class.
- *
- * HISTORY
- * 11-Feb-91 Doug Mitchell at NeXT
- * Created.
- */
-
- #import <driverkit/return.h>
- #import <driverkit/IODisk.h>
- #import <driverkit/scsiTypes.h>
- #import <driverkit/generalFuncs.h>
-
- /*
- * FIXME - there should only be one thread if target does not
- * implement command queueing, and more (at least two, max TBD)
- * if target does implement command queueing.
- */
- #define NUM_SD_THREADS_MIN 1
- #define NUM_SD_THREADS_MAX 6
-
- /*
- * This flag forces us to do read-after-write verification (H/W BugTracker
- * entry 1300).
- */
- #define RAW_VERIFY 0
- #define RAW_BUF_SIZE (8 * 1024)
-
- @interface SCSIDisk:IODisk<IODiskReadingAndWriting,IOPhysicalDiskMethods>
- {
- @private
- id _controller; // the SCSIController object which does
- // our SCSI transactions
- u_char _target; // target/lun of this device
- u_char _lun;
- unsigned _isReserved:1, // we hold a target/lun reservation
- _isRegistered:1; // registered w/IODisk
-
- /*
- * I/O thread info.
- */
- int _numThreads;
- IOThread _thread[NUM_SD_THREADS_MAX];
-
- /*
- * The queues on which all I/Os are enqueued by exported methods.
- */
- queue_head_t _ioQueueDisk; // for I/Os requiring disk
- queue_head_t _ioQueueNodisk; // for other I/O
- id _ioQLock; // NXConditionLock - protects the
- // ioQueues; I/O thread sleep
- // on this.
- unsigned char _inquiryDeviceType;
-
- /*
- * Eject command locking stuff. A thread about to execute an eject
- * command must wait until it is the only thread executing a "disk
- * needed" type of I/O before preceeding; other such I/Os will be
- * inhibited by either the ejectPending flag (set by us) or by the
- * lastReadyState instance (maintained by volCheck and set
- * asynchronously to RS_EJECTING after an I/O thread gets an eject
- * command and calls volCheckEjecting()).
- *
- * Implementation: ejectLock is an NXConditionLock;
- * its condition variable is the number of threads currently
- * executing commands from IOqueue.q_disk. An eject can only occur
- * when this is 1.
- */
- id _ejectLock;
- int _numDiskIos; // #of threads executing
- // commands from IOqueue.q_disk
- BOOL _ejectPending;
-
- #if RAW_VERIFY
- BOOL _raw_verify; // enables r-a-w check
- void *_rawBuffer; // read-after-write buffer
- unsigned _rawBufferSize; // in bytes
- #endif RAW_VERIFY
- }
-
- + (BOOL)probe : deviceDescription;
- + (IODeviceStyle)deviceStyle;
- + (Protocol **)requiredProtocols;
-
- - (IOReturn) sdCdbRead : (IOSCSIRequest *)scsiReq
- buffer:(void *)buffer /* data destination */
- client:(vm_task_t)client;
-
- - (IOReturn) sdCdbWrite : (IOSCSIRequest *)scsiReq
- buffer:(void *)buffer /* data destination */
- client:(vm_task_t)client;
-
- - (int)target;
- - (int)lun;
- - (unsigned char)inquiryDeviceType;
- - controller;
-
- @end
-
-
-
-