sys7.1-doc-wip/OS/SCSIMgr4pt3/SIMCoreEqu.a
2019-07-27 22:37:48 +08:00

246 lines
8.6 KiB
Plaintext

;==========================================================================
;
; File: SIMCoreEqu.a
;
; Contains: Asm equiv. of SIMCore.h
;
; Written by: Paul Wolf
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <ML2> 12/15/93 pdw Filled out HALinfo field.
; <SM15> 12/19/93 DCB Added hsdshkRemainder. This is to help solve the handshake
; across scatter gather boundries problem.
; <SM14> 11/22/93 pdw Rolling in from <MCxx>.
; <MC5> 11/8/93 pdw Added error condition for kHALselectedAsTargetFld.
; <SM13> 10/29/93 DCB <MC> roll-in.
; <MC3> 10/28/93 pdw States used in target mode.
; <SM12> 10/14/93 pdw <MC> roll-in.
; <MC2> 10/12/93 pdw Added support for Synchronous data transfers, rewrote State
; Machine, message handling etc.
; <SM11> 9/9/93 pdw Lots of little changes. Name changes, temporary cache_bug
; stuff.
; <SM10> 7/17/93 pdw Lots of little things.
; <SM9> 5/5/93 PW Converted names to meanies-friendly names. Updated with latest
; from Ludwig stuff.
; <LW8> 4/30/93 DCB Getting rid of the HalInfo HalAction vector. It is getting its
; own entry point into the HAL to prevent deadlocks.
; <LW7> 4/29/93 DCB Fixing Build - Sorry bout that.
; <LW6> 4/14/93 DCB Added SetParity action and the full set of ioEvents from
; SIMCore.h
; <LW5> 3/1/93 DCB Removed scConnTimer field since it isn't needed yet.
; <LW4> 2/17/93 PW Added savedResidLen field and kbBitBucketed flag needed to fix
; dataResidLen and bitbucketing bugs.
; <SM7> 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM
; (will update Ludwig with these as needed myself).
; <LW3> 1/27/93 PW Added dataRoutine and xferRoutine fields to SIM_IO.
; <LW2> 1/6/93 DCB Added kbUseDblBuffer bit to the SIMprivFlags field to fix SCSI
; into NuBus bug. Radar Bug #1059322
; <SM6> 11/20/92 DCB Fields for async operation of non-io parameter blocks
; <SM5> 10/30/92 DCB Adding HAL privates to the SIM_IO structure
; <SM4> 10/8/92 PW Added stuff needed for variable-sized SCSI_IO support.
; <SM3> 8/30/92 PW Added kAssertATN to HALactions record.
; <SM2> 8/20/92 DCB Fixed SCSI Bus Reset
;
;==========================================================================
IF &TYPE('__INCLUDING_SIMCoreEqu__') = 'UNDEFINED' THEN
__INCLUDING_SIMCoreEqu__ SET 1
;*************************************************
HALactionPB RECORD 0, INCREMENT
;-- The first two fields remain constant throughout the connection
HALstaticPtr ds.l 1 ; uchar * -> alloc. ptr to the HAL's static vars
ioPtr ds.l 1 ; SCSI_IO * -> primarily for Initiate
action ds.w 1 ; HALactions -> what to do
result ds.w 1 ; <- error
selectorID ds.w 1 ; <- ID of device selecting/reselecting us
unused ds.w 1 ;
sendCDB ds.b 1 ; -> flag = send CDB during initiate
phase ds.b 1 ; <- current phase
msgInLen ds.b 1 ; <> number of msg in bytes
msgOutLen ds.b 1 ; <> number of msg out bytes
msg ds.b 8 ; <> msg bytes
ENDR ;HALactionPB
;---- Bit equates for flags in HALactionPB flags field
kbMsgInValid equ 2
kmMsgInValid equ (1<<2) ; 0000,0100b
;******** HALactions **********
HALactions RECORD 0, INCREMENT
; must correspond to G_JmpTbl record in HALc96Equ.a (or other HAL's)
kInitiate ds.b 1 ; 0
kBitBucket ds.b 1
kDataIn ds.b 1
kDataOut ds.b 1
kAcceptMsg ds.b 1 ; 4
kUnusedHALaction ds.b 1
kunusedMI ds.b 1
kSendMsgOut ds.b 1
kStatus ds.b 1 ; 8
kComplete ds.b 1
kSaveDataPointer ds.b 1
kModifyDataPointer ds.b 1
kRestorePointers ds.b 1 ; c
kGetReconnectInfo ds.b 1
kGetSelectInfo ds.b 1
kSelect ds.b 1
kunused ds.b 1 ; 10
kCommand ds.b 1
kSetParity ds.b 1 ;
kHandleSelected ds.b 1
kNumHALaction ds.b 1 ; make sure you modify dispatch table above too
ENDR
; a list of unusual events which could affect the interpretation of errors in CompleteIO <LW5>
kAborted equ $0001 ; PB was aborted by an AbortCommand
kTerminated equ $0002 ; Hasta la Vista Baby!
kBDRSent equ $0004 ; Bus Device Reset was sent to the target
kTimedOut equ $0008 ; timed out
kMsgSent equ $0010 ; message was delivered to the target
kMsgRejected equ $0020 ; message rejected by target
kBadParity equ $0040 ; bad parity detected by initiator
kAutoSense equ $0080 ; Autosense has been executed
SIMprivFlagsRecord RECORD 0, INCREMENT
kbDataDone ds.b 1 ; 0: scatter/gather list has been exhausted
kbSetupComplete ds.b 1 ; 1: set to indicate we setup this iopb for DMA
kbUseDblBuffer ds.b 1 ; 2: Set to indicate that the buffer was not lockable/DMAable (NuBus Space)
kbBitBucketed ds.b 1 ; 3: we were forced to bit bucket
kbUseDirectDMA ds.b 1 ; 4: use direct DMA during data transfer
ENDR
HALresult RECORD 0, INCREMENT
kHALnoErr ds.b 1 ; all requests
kHALselectFld ds.b 1 ; initiate
kHALreselected ds.b 1 ; we were reselected (maybe during an initiate)
kHALselectedAsTarget ds.b 1 ; we were selected (maybe during an initiate)
kHALselectedAsTargetFld ds.b 1 ; curio bug - they tried to select us and we hung
kHALnoCommand ds.b 1 ; initiate
kHALpartialCommand ds.b 1 ; initiate
kHALpartialMsgIn ds.b 1 ; MsgIn
kHALmsgInDisconnected ds.b 1 ; MsgIn
kHALpartialDataIn ds.b 1 ; DataIn
kHALpartialDataOut ds.b 1 ; DataOut
kHALpartialMsgOut ds.b 1 ; MsgOut
kHALmsgOutDisconnected ds.b 1 ; MsgOut
kHALreselectBogus ds.b 1 ; GetReconnectInfo
kNumHALresult ds.b 1
ENDR
;// SIM layer privates
SIM_IO RECORD 0, INCREMENT
SCSI_IO_Macro
SIMglobals ds.l 1 ; ptr to SIM globals
scTimer ds.l 1 ; -> CAM Timeout value (in seconds)
hdshkRemainder ds.w 1 ; Leftover handshake from previous SG element
hdshkIndex ds.b 1 ; The handshake element that the above remainder refers to
rsrvd6 ds.b 1 ; reserved
ioStat ds.w 1 ; <- intermed. status of this guy
ioEvent ds.w 1 ; additional status to explain misc asynchronous events <SM??>
firstError ds.b 1 ; first error detected (saved for later use by CompleteIO)
SIMprivFlags ds.b 1 ; SIM private flags (for this PB)
rsrvd7 ds.w 1 ; reserved
pendingMsgPB ds.l 1 ; ParameterBlock for an Async operation to be undertaken ASAP <SM6>
currentSGptr ds.l 1 ; current ptr (to SG entry)
currentSGcount ds.l 1 ; current count (within SG entry)
savedSGptr ds.l 1 ; saved ptr (to SG entry)
savedSGcount ds.l 1 ; saved count (within SG entry)
ioQueue ds.l 1 ; the queue that this PB has been enqueued in
savedResult ds.w 1 ; final status of the PB (placed in scStatus only after autosense)
rsrvd8 ds.w 1
transLogStart ds.l 1 ; logical address (for DMA)
transLogCount ds.l 1 ; logical count
transPhyStart ds.l 1 ; physical address
transPhyCount ds.l 1 ; physical count
dataRoutine ds.l 1 ; ptr to data desc interp. routine to use for this I/O
xferRoutine ds.l 1 ; ptr to data transfer routine to use for this I/O
savedResidLen ds.l 1 ; saved (not current) residual length
SIMextras ds.b 4 ; for a total of 64 bytes
ENDR
HALinitInfo RECORD 0, INCREMENT
HALstaticPtr ds.l 1 ; <- alloc. ptr to the HAL's static vars
staticSize ds.l 1 ; -> num bytes HAL needs for static vars
HALinit ds.l 1 ; -> pointer to the HAL init routine
HALaction ds.l 1 ; -> pointer to the HAL action routine
HAL_ISR ds.l 1 ; -> pointer to the HAL ISR routine
HALIntPoll ds.l 1 ; -> pointer to the HAL interrupt poll routine
HALBusInquiry ds.l 1 ; -> pointer to the HAL Info routine
HALResetBus ds.l 1 ; -> pointer to the HAL ResetBus routine
HALAssertATN ds.l 1 ; -> pointer to the HAL AssertATN routine
HALTeardownIO ds.l 1 ; -> pointer to the HAL TeardownIO routine
HALSyncConfig ds.l 1 ; -> pointer to the HALSyncConfig routine
unusedV ds.l 1 ; -> pointer to the
syncRAoffset ds.b 1 ; -> REQ/ACK offset to use for sync negotiation
minPeriodFactor ds.b 1 ; -> min transfer period to request in SDTR
HBAisSync ds.b 1 ; ->
HBAisFast ds.b 1 ; ->
oldCallCapable ds.b 1 ; -> true if this HAL can handle old-API calls
usesThreshold8 ds.b 1 ; ->
busID ds.w 1 ; <- bus number for the registered bus
ReconnectISR ds.l 1 ; <- to make ReconnectISR call
XPT_ISR ds.l 1 ; <- ptr to the XPT ISR
SIMstaticPtr ds.l 1 ; <- so SSM callback has its globals
hwDescPtr ds.l 1 ; -- for use by HAL only
supported_scFlags ds.l 1 ;
supported_scIOFlags ds.w 1 ;
supported_scDataTypes ds.w 1 ;
ENDR
SIMglobals RECORD 0, INCREMENT
HALinfo ds HALinitInfo ; copy of HALinitInfo, made after registration
ENDR
ENDIF ; already included...