home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Examples / DriverKit / AMDPCSCSIDriver / AMDPCSCSIDriver_reloc.tproj / AMD_SCSI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-03  |  5.0 KB  |  181 lines

  1. /*     Copyright (c) 1994-1996 NeXT Software, Inc.  All rights reserved. 
  2.  *
  3.  * AMD_SCSI.h - top-level API for AMD 53C974/79C974 PCI SCSI driver. 
  4.  *
  5.  * HISTORY
  6.  * 21 Oct 94    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #import <driverkit/i386/directDevice.h>
  11. #import <kernserv/queue.h>
  12. #import <driverkit/IODirectDevice.h>
  13. #import <driverkit/i386/IOPCIDirectDevice.h>
  14. #import <driverkit/i386/driverTypes.h>
  15. #import <driverkit/IOSCSIController.h>
  16. #import <driverkit/IOPower.h>
  17. #import "AMD_Types.h"
  18.  
  19. /*
  20.  * WARNING: The AMDPCnet32NetworkDriver driver uses this class name to
  21.  * conditionally enable some workarounds if the AMD_SCSI class is present.
  22.  * If this class name is changed, the AMDPCnet32NetworkDriver driver must 
  23.  * also be updated to reflect the new class name.
  24.  */
  25. @interface AMD_SCSI : IOSCSIController <IOPower> 
  26. {
  27.     IOEISAPortAddress     ioBase;    // base IO port addr
  28.     port_t        interruptPortKern;
  29.  
  30.     /*
  31.      * Commands are passed from exported methods to the I/O thread
  32.      * via commandQ, which is protected by commandLock.
  33.      * 
  34.      * Commands which are disconnected but not complete are kept
  35.      * in disconnectQ.
  36.      *
  37.      * Commands which have been dequeued from commandQ by the 
  38.      * I/O thread but which have not been started because a 
  39.      * command is currently active on the bus are kept in pendingQ.
  40.      *
  41.      * The currently active command, if any, is kept in activeCmd.
  42.      * Only commandBufs with op == CO_Execute are ever placed in
  43.      * activeCmd.
  44.      */
  45.     queue_head_t    disconnectQ;    
  46.     queue_head_t    commandQ;        
  47.     id        commandLock;    // NXLock; protects commandQ 
  48.     queue_head_t    pendingQ;        
  49.     commandBuf     *activeCmd;    // connected command (if any). NULL 
  50.                     // implies we're disconnected. 
  51.                     
  52.     /*
  53.      * Option flags, accessible via instance table or setIntValues 
  54.      * (DEBUG only).
  55.      */
  56.     unsigned    autoSenseEnable:1,
  57.             cmdQueueEnable:1,
  58.             syncModeEnable:1,
  59.             fastModeEnable:1,
  60.             extendTiming:1,
  61.             ioThreadRunning:1,
  62.             pad:26;
  63.     unsigned    scsiClockRate;    // in MHz
  64.  
  65.     /*
  66.      * Array of active I/Os counters, one counter per lun per target.
  67.      * If command queueing is disabled, the max value of each counter
  68.      * is 1. ActiveCount is the sum of all elements in activeArray.
  69.      */
  70.     unsigned char     activeArray[SCSI_NTARGETS][SCSI_NLUNS];
  71.     unsigned    activeCount;
  72.         
  73.     /*
  74.      * Hardware related variables used (mostly) in AMD_Chip.m.
  75.      */
  76.     unsigned char    saveStatus;    // saved status on interrupt
  77.     unsigned char    saveSeqStep;    // saved seqstep
  78.     unsigned char    saveIntrStatus;    // saved interrupt status 
  79.     unsigned char    hostId;        // our SCSI ID 
  80.     scState_t     scState;    // SCS_DISCONNECTED, etc.
  81.     unsigned char    reselTarget;    // target attempting to reselect
  82.     unsigned char    reselLun;    // lun       ""         ""
  83.     
  84.     /*
  85.      * commandBuf->queueTag for next I/O. This is never zero; for
  86.      * method calls involving a T/L/Q nexus, a queue tag of zero
  87.      * indicates a nontagged command.
  88.      */
  89.     unsigned char    nextQueueTag;
  90.     
  91.     /*
  92.      * Per-target information.
  93.      */
  94.     perTargetData     perTarget[SCSI_NTARGETS];
  95.     
  96.     /*
  97.      * Message in/out state machine variables.
  98.      * Outbound messages are placed in currMsgOut[] after asserting ATN;
  99.      * when we see phase == PHASE_MSGOUT, these are sent to FIFO.
  100.      * Inbound messages are placed in currMsgIn[] and are processed
  101.      * when we leave phase == PHASE_MSGIN.
  102.      */
  103.     unsigned char    currMsgOut[AMD_MSG_SIZE];
  104.     unsigned    currMsgOutCnt;
  105.     unsigned char    currMsgIn[AMD_MSG_SIZE];
  106.     unsigned    currMsgInCnt;
  107.     msgOutState_t    msgOutState;        //  MOS_WAITING, etc.
  108.     
  109.     SDTR_State_t    SDTR_State;
  110.     
  111.     unsigned    reselPending:1,
  112.             pad2:31;
  113.     
  114. #ifdef    DEBUG
  115.     /*
  116.      * Shadows of write-only registers.
  117.      */
  118.     unsigned char    syncOffsetShadow;
  119.     unsigned char    syncPeriodShadow;
  120. #endif    DEBUG
  121.     /*
  122.      * Statistics support.
  123.      */
  124.     unsigned    maxQueueLen;
  125.     unsigned    queueLenTotal;
  126.     unsigned    totalCommands;
  127.     
  128.     /*
  129.      * DMA Memory Descriptor List.
  130.      */
  131.     vm_address_t    *mdl;        // well aligned working ptr
  132.     vm_address_t    *mdlFree;    // ptr we have to IOFree()
  133.     unsigned    mdlPhys;    // physical address of mdl
  134.     
  135.     /*
  136.      * host bus info.
  137.      */
  138.     BusType        busType;        // only BT_PCI for now
  139.     BOOL        levelIRQ;
  140.     unsigned char    busNumber;        // FIXME - do we need these?
  141.     unsigned char    deviceNumber;
  142.     unsigned char    functionNumber; 
  143.  
  144. }
  145.  
  146. + (BOOL)probe:deviceDescription;
  147. - free;
  148. - (sc_status_t) executeRequest     : (IOSCSIRequest *)scsiReq 
  149.                  buffer : (void *)buffer 
  150.                  client : (vm_task_t)client;
  151. - (sc_status_t)resetSCSIBus;
  152. - (void)resetStats;
  153. - (unsigned)numQueueSamples;
  154. - (unsigned)sumQueueLengths;
  155. - (unsigned) maxQueueLength;
  156. - (void)interruptOccurred;    
  157. - (void)timeoutOccurred;
  158.  
  159. #if    AMD_ENABLE_GET_SET
  160.  
  161. - (IOReturn)setIntValues        : (unsigned *)parameterArray
  162.                forParameter : (IOParameterName)parameterName
  163.                       count : (unsigned)count;
  164. - (IOReturn)getIntValues        : (unsigned *)parameterArray
  165.                forParameter : (IOParameterName)parameterName
  166.                       count : (unsigned *)count;    // in/out
  167. /*
  168.  * setIntValues parameters.
  169.  */
  170. #define AMD_AUTOSENSE        "AutoSense"
  171. #define AMD_CMD_QUEUE        "CmdQueue"
  172. #define AMD_SYNC        "Sync"
  173. #define AMD_FAST_SCSI        "FastSCSI"
  174. #define AMD_RESET_TARGETS    "ResetTargets"
  175.  
  176. #endif    AMD_ENABLE_GET_SET
  177.  
  178. @end
  179.  
  180.  
  181.