;________________________________________________________________________ ; ; File: XPT.h ; ; Contains: header stuff for XPT ; ; Entry points: ; ; Written by: Paul Wolf ; ; Copyright: © 1992-1994 by Apple Computer, Inc., all rights reserved. ; ; Change History (most recent first): ; ; 1/31/94 DCB Added a second version number field for the SCSI Busy patch ; 1/25/94 DCB Added space in the C0C globals for our own private deferred task ; queue. ; 1/14/94 chp Remove SCSIGlobals equate again. It is defined in SysEqu.a. (See ; .) Fix Òinclude onceÓ SET variable naming conventions. ; 1/9/94 pdw Added busyPatchVers field. ; 1/5/94 pdw Added SCSIBusy selector and required fields in SCSIGlobals. ; 11/5/93 pdw Series of attempts and re-attempts to fix various VM/FileShare ; problems. ; 12/19/93 DCB Added SCSIBusy constant ; 11/22/93 pdw Rolling in from . ; 9/22/93 chp Remove SCSIGlobals equate. It is defined elsewhere. ; 10/29/93 DCB roll-in. ; 10/28/93 pdw Got rid of some unused fields. Changed the way Recorder works. ; 10/14/93 pdw roll-in. ; 10/12/93 pdw Added support for Synchronous data transfers, rewrote State ; Machine, message handling etc. ; 9/9/93 pdw Lots of little changes. Name changes, temporary cache_bug ; stuff. ; 7/17/93 pdw Moved jvSelected to HALg. ; 7/8/93 pdw Added locations for counting interrupts (not used) and other ; comment changes. ; 6/29/93 pdw Massive checkins: Change asynchronicity mechanism to CallMachine ; stack switching mechanism. Adding support for Cold Fusion. ; Rearranging HW/SW Init code. Some code optimizations. Changed ; Record_Event trigger to use a couple of values in SCSIGlobals. ; 5/29/93 PW Adding comment about globals stolen. ; 5/25/93 DCB Update from Ludwig (the three items below this one) ; 5/21/93 mal Changing GetXPTg to use simple indirection instead of [] stuff. ; 5/20/93 DCB Adding two fields to the XPT globals to support turning off ; deferred completion routines from inside debuggers. ; 5/20/93 PW Added SCSIGlobalsRec from SCSIPriv and into these, I added jump ; vector for target mode. ; 5/5/93 PW Converted names to meanies-friendly names. Updated with latest ; from Ludwig stuff. ; 4/8/93 DCB Added a copy of the C0C SCSI Globals which have been modified ; for use by the new SCSI Manager. ; 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM ; (will update Ludwig with these as needed myself). ; 1/27/93 PW Changed bogus to syncUnsafeCount. ; 12/18/92 PW Added syncReqEnabled counter (bogus field right now). ; 11/20/92 PW Removed Includes. Made MaxBuses 16. Removed XPTgs not used in ; asm files. ; 10/30/92 DCB Misc equates to support multiple ISR routines. ;======================================================================== STRING ASIS IF &TYPE('__INCLUDINGXPTEQU__') = 'UNDEFINED' THEN __INCLUDINGXPTEQU__ SET 1 IF &TYPE('__INCLUDINGACAM__') = 'UNDEFINED' THEN INCLUDE 'ACAM.a' ENDIF ;******** Old Call Enumerators ******** OldSCSICalls RECORD 0, INCREMENT kSCSIReset ds.b 1 ; 0 kSCSIGet ds.b 1 kSCSISelect ds.b 1 kSCSICmd ds.b 1 kSCSIComplete ds.b 1 ; 4 kSCSIRead ds.b 1 kSCSIWrite ds.b 1 kSCSIunused ds.b 1 kSCSIRBlind ds.b 1 ; 8 kSCSIWBlind ds.b 1 kSCSIStat ds.b 1 kSCSISelAtn ds.b 1 kSCSIMsgIn ds.b 1 ; C kSCSIMsgOut ds.b 1 kSCSIBusy ds.b 1 kNumOldSCSICalls ds.b 1 ; F (15) ENDR ;******** Old Call States ******** OldCallStates RECORD 0, INCREMENT kNotConnected ds.b 1 ; 0 kGotGet ds.b 1 kSelectInProgress ds.b 1 kConnected ds.b 1 kNumOldCallStates ds.b 1 ENDR ;***** Max number of buses supported ***** kMaxBuses EQU 16 ;******** QHdr ******** QHdr RECORD 0, INCREMENT qFlags ds.w 1 qHead ds.l 1 qTail ds.l 1 ENDR ;******** BusInfo ******** BusInfo RECORD 0, INCREMENT initInfo ds SIMinitInfo ENDR ;******** RefInfo ******** RefInfo RECORD 0, INCREMENT DrvrCnt ds.l 1 RefInfo ds.l 1 ;!!! ENDR ;******** DrvrList ******** DrvrList RECORD 0, INCREMENT DevID ds.l 1 DRefNum ds.w 1 unused ds.w 1 ENDR ;******** DevInfo ******** DevInfo RECORD 0, INCREMENT DevIdent ds DeviceIdent ; ioPB ds.l 1 ; ptr to ioPB IdentMsg ds.b 1 ; Boolean ENDR ;******** BootInfo ******** BootInfo RECORD 0, INCREMENT startPRAM ds.l 1 ; long word BusCount ds.w 1 ; defltDrvrRefNum ds.w 1 ; ref num of driver for default boot device IDmasks ds.l kMaxBuses ENDR ;****** XPT Globals ********* ; partial list only because only not all is needed from asm XPTglobals RECORD 0, INCREMENT BusInfoPtrs ds.l kMaxBuses ;// pointers to BusInfos (handles 99.9965% of cases) OldSyncWait ds.l 1 numBuses ds.w 1 syncUnsafeCount ds.w 1 ; flags ds.b 1 unusedC2 ds.b 1 unusedC0 ds.b 1 unusedC1 ds.b 1 debugPatch ds.l 1 ; address of our _DebugUtil Patch oldIDBusNumber ds.w 8 ; one for each SCSI ID oldAPIstate ds.w 1 ; OldCallStates latestOldCallPhase ds.w 1 ; SCSIphase unusedX ds.w 1 ; nextInterleave ds.w 1 ; xptIOptr ds.l 1 ; xptIOpbSize ds.w 1 ; size of currently allocated SCSI_IO (for old API) maxIOpbSize ds.w 1 ; size of largest required SCSI_IO (for all SIMs) Drivers ds.l 1 ; Ptr to DrvrList BootStorage ds.l 1 ; Ptr to BootInfo ENDR ;***** For XPTprivateFlags field ******* kbTIB equ 0 ;****** For XPTg.flags field ******** kbOldAPIBusy equ 0 kbInOldCall equ 1 ;******** SCSIStat word bit equates ******** kmStatATN equ $0200 kmStatACK equ $0100 kmStatRST equ $0080 kmStatBSY equ $0040 kmStatREQ equ $0020 kmStatMSG equ $0010 kmStatC_D equ $0008 kmStatI_O equ $0004 kmStatSEL equ $0002 kmStatDBP equ $0001 ;******** Old SCSI Manager globals ******** ; ; we're kind of living off some of the C0C^ globals here ; SCSIGlobalsRec RECORD 0, INCREMENT ;{ ; ; ÑÑÑÊOLD (& NEW emulation of old) ÑÑÑ jvReset DS.L 1 ; SCSIReset vector jvGet DS.L 1 ; SCSIGet vector jvSelect DS.L 1 ; SCSISelect vector jvCmd DS.L 1 ; SCSICmd vector jvComplete DS.L 1 ; SCSIComplete vector jvRead DS.L 1 ; SCSIRead vector jvWrite DS.L 1 ; SCSIWrite vector jvInstall DS.L 1 ; SCSI installation vector (for debugging purposes) jvRBlind DS.L 1 ; SCSIRBlind vector jvWBlind DS.L 1 ; SCSIWBlind vector jvStat DS.L 1 ; SCSIStat vector jvSelAtn DS.L 1 ; SCSISelAtn vector jvSMsgIn DS.L 1 ; SCSIMsgIn vector jvSMsgOut DS.L 1 ; SCSIMsgOut vector firstPrivate DS.L 1 ; ptr to SCSI Mgr private storage record circularly linked list nextPrivate DS.L 1 ; ptr to next available SCSI Mgr private storage record base5380 DS.L 1 ; SCSI read base address pdma5380 DS.L 1 ; SCSI pseudo-DMA read base addr hhsk5380 DS.L 1 ; SCSI hardware-handshaked read base addr wrOffset DS.W 1 ; write offset relative to "base5380" scsiQFlags DS.W 1 ; flags for SCSI request queue scsiQHead DS.L 1 ; ptr to head of SCSI request queue scsiQTail DS.L 1 ; ptr to tail of SCSI request queue activeReq DS.L 1 ; ptr to currently active SCSI request timeout DS.L 1 ; next timeout should occur at this time G_ID DS.B 1 ; initiator's SCSI ID mask G_State DS.B 1 ; SCSI Mgr state (free/busy) G_Async DS.W 1 ; unused - $62 G_Reserved0 DS.L 1 ; box number in high byte. HW flags in low bytes G_Reserved1 DS.L 1 ; used for storing timer value pdw G_Reserved2 DS.L 1 ; machine-specific storage ; ;** Cool stuff for the new SCSI Manager ; The following variables in SCSIGlobals were stolen by the Async SCSI Manager ; ; ÑÑÑÊNEW ÑÑÑ unused0 DS.L 1 ; 70: berr_halg0 DS.L 1 ; 74: Saved HAL globals for internal bus (used by the Bus Error Handler) berr_halg1 DS.L 1 ; 78: Ditto for external bus. (I know, its a hack but justifiable because ; we are the only ones with xfer routines that cause bus errors.) jvUnusedXL1 DS.L 1 ; 7c: jv called when we're selected as target numBEHs DS.B 1 ; 80: Number of Bus Error Handlers installed inDebugger DS.B 1 ; 81: count of debugger entries+/exits- unused1 DS.B 2 ; 82: tempXPTGGlobals DS.L 1 ; 84: Used for "transitioning" from one XPT to another tempXPTGInUse DS.L 1 ; 88: Set to 'xptg' if we have two XPTs active unused2 DS.L 1 ; 8c: recordBreak0 DS.L 1 ; 90: gets checked for match against all events recorded recordBreak4 DS.L 1 ; 94: busyPatch DS.L 1 ; 98: addr of SCSI busy patch ciBusyPending DS.B 1 ; 9c: Used by the ciSCSIBusy patch to keep track of deferred jvSCSIFreeHook Calls ciWasBusy DS.B 1 ; 9d: Set if we returned "Busy" to somebody. busyPatchVers DS.W 1 ; 9e: version of SCSI busy patch installed recCurrent DS.L 1 ; a0: debugging event recorder - current pointer recSize DS.L 1 ; a4: debugging event recorder - size of buffer recStartLog DS.L 1 ; a8: logical start of buffer recStartPhys DS.L 1 ; ac: physical start of buffer unusedW1 ds.w 1 ; b0: completionQHdr ds.w 1 ; b2: high byte = flag indicating deferred task is enqd completionQHead ds.l 1 ; b4: Q used to call completion routines from our completionQTail ds.l 1 ; b8: deferred task (XPT.a). unusedW2 ds.w 1 ; privDTQueue privDTQFlags ds.w 1 ; used for the private deferred task manager privDTQHead ds.l 1 ; ditto privDTQTail ds.l 1 ; ditto oldjDisptch ds.l 1 ; the old jDisptch vector we patched out ci_jDisptchVers ds.l 1 ; version tag for our patch ; ÑÑÑÊOLD ÑÑÑ jvVFWO DS.L 1 ; virtual fast writes (hhsk) jvCSO DS.L 1 ; virtual slow compare ("p" bit redefined to mean "compare") jvUnused3 DS.L 1 ; unused jvCFO DS.L 1 ; virtual fast compare ("p" bit redefined to mean "compare") jvUnused4 DS.L 1 ; unused jvInvalidIn DS.L 1 ; Invalid Message In jvIdentifyIn DS.L 1 ; Identify Message In jvCmdComplete DS.L 1 ; Command Complete jvExtendedMsg DS.L 1 ; Extended Message jvSaveDataPtr DS.L 1 ; Save Data Pointer jvRestorePtrs DS.L 1 ; Restore Pointers jvDisconnect DS.L 1 ; Disconnect jvMsgRejIn DS.L 1 ; Message Reject In jvLCCF DS.L 1 ; Linked Command Complete with (or without) flag sdmStack DS.L 1 ; SCSIDiskMode stack global for DB Lite base5380_1 DS.L 1 ; SCSI read base address (internal) pdma5380_1 DS.L 1 ; SCSI pseudo-DMA read base addr (internal) hhsk5380_1 DS.L 1 ; SCSI hardware-handshaked read base addr (internal) base5380_2 DS.L 1 ; SCSI read base address (external) pdma5380_2 DS.L 1 ; SCSI pseudo-DMA read base addr (external) hhsk5380_2 DS.L 1 ; SCSI hardware-handshaked read base addr (external) jvIdentifyOut DS.L 1 ; Identify Message Out jvMsgRejOut DS.L 1 ; Message Reject Out jvInvalidOut DS.L 1 ; Invalid Message Out jvKillIO DS.L 1 ; Kill I/O jvNoOp DS.L 1 ; No Operation jvBusDevRstOut DS.L 1 ; Bus Device Reset Out G_SCSIDREQ DS.L 1 ; SCSI DREQ base address G_TargetID DS.L 1 ; Target ID G_FakeStat DS.L 1 ; Fake state G_OldTrapAdrs DS.L 1 ; contains the old SCSIMgr address G_OldIntHnd DS.L 1 ; contains old intrp level 2 handler G_IntrpCount DS.L 1 ; counts total # of intrps G_IntrpStat DS.L 1 ; Status read by Intrp routine GxState96 DS.L 1 ; Bits to make c96 backwards compatible BootCfgFlags DS.L 1 ; copy of d2 passed to InitHW_SCSI96 at boot (used by jvInitHW) G_bitDREQ DS.B 1 ; Bit position at DREQ location jvUnused32 DS.B 1 ; Future expansion jvUnused33 DS.W 1 ; Future expansion jvIntHnd DS.L 1 ; 24-entry jump table -- interrupt handler jvMessage DS.L 1 ; Send a message to the deferred task jvClearIRQ DS.L 1 ; Clear the SCSI interrupt (and VIA, if necessary) jvDisEnable DS.L 1 ; Enable/disable interrupts routine jvLogError DS.L 1 ; Record error for the PB jvSCSIDT DS.L 1 ; Deferred Task for all other interrupts jvFind DS.L 1 ; Find a request to process jvSetup DS.L 1 ; Setup active request jvPreflight DS.L 1 ; Preflight the parameter block jvEnDequeue DS.L 1 ; Enqueue/dequeue a parameter block jvArb DS.L 1 ; Arbitrate for the SCSI bus jvSel DS.L 1 ; Select a SCSI device jvDelay22 DS.L 1 ; Delay 2.2 microseconds jvClearState DS.L 1 ; Remove the current request jvTransfer DS.L 1 ; Transfer data using the primitive routines jvSetTimer DS.L 1 ; Set the timer jvResetBus DS.L 1 ; Reset SCSI bus and kill all requests jvClearBus DS.L 1 ; Clear the SCSI bus jvBusErr DS.L 1 ; Bus error handler jvDataDMA DS.L 1 ; DMA-related data-chaining interpreter ; ÑÑÑÊNEW ÑÑÑ xptGlobals DS.L 1 ; 1b4- pointer to Cousin Itt's XPT globals ; ÑÑÑÊOLD ÑÑÑ blindBusTO DS.L 1 ; 1b8- number of ticks to wait for blind transfer bytes (after 1st byte) transferType DS.W 1 ; 1bc- Type of data transfer to perform (used in Transfer_96, BusError) lastINTread DS.B 1 ; 1be- Value of rINT at last valid interrupt read lastSTAread DS.B 1 ; 1bf- Value of rSTA at last valid interrupt read ; ÑÑÑÊNEW and OLD ÑÑÑ yeOldeBusErrVct DS.L 1 ; 1c0- temp storage while we insert our buserr handler pdw base539x0 DS.L 1 ; SCSI 539x base address, bus0 base539x1 DS.L 1 ; SCSI 539x base address, bus1 G_SCSIDevMap0 DS.B 1 ; SCSI Device Map for the Internal SCSI Bus fill1 DS.B 3 G_SCSIDevMap1 DS.B 1 ; SCSI Device Map for the External SCSI Bus fill2 DS.B 3 ENDR ;} maxOpcode EQU 8 ; highest numbered TIB opcode (from PatchIIROM.a) MACRO GetXPTg move.l SCSIGlobals, A5 move.l SCSIGlobalsRec.xptGlobals(A5), A5 ENDM ENDIF ; already included