mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-28 01:29:20 +00:00
4325cdcc78
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included. The Tools directory, containing mostly junk, is also excluded.
430 lines
12 KiB
Plaintext
430 lines
12 KiB
Plaintext
;==========================================================================
|
|
;
|
|
; File: SCSIGlue.a
|
|
;
|
|
; Contains: Entry glue for A089 trap and other misc.
|
|
;
|
|
; Written by: Paul Wolf
|
|
;
|
|
; Copyright: © 1991-1994 by Apple Computer, Inc., All rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <SM28> 1/31/94 DCB Added a semaphore around the call to jSCSIFreeHook so we don't
|
|
; do a trap to DeferUserFn every time sync safe becomes zero.
|
|
; <ML4> 1/5/94 pdw (DCB) Added calling of SCSIFreeHook from VMEnableUserCode when we go
|
|
; sync-safe and old API is not busy.
|
|
; <SM26> 12/19/93 DCB Call jSCSIFreeHook from VMEnableUserCode if syncUnsafe is zero
|
|
; and if our SCSIBusy patch was called when syncUnsafe was
|
|
; non-zero.
|
|
; <SM25> 11/22/93 pdw Rolling in from <MCxx>.
|
|
; <MC6> 11/8/93 pdw Changed recording criteria.
|
|
; <SM24> 11/21/93 pdw Removed IllegalInstruction and UnimplentedATrap procedures.
|
|
; <SM23> 11/19/93 chp Hacked some more on TestFor_GrandCentralExists. The TestFor
|
|
; macro looks in DecoderInfo, so I use DecoderInfoVers to validate
|
|
; 96-bit Universal info rather than ProductInfoVers.
|
|
; <SM22> 11/17/93 DCB Changing TestFor_GrandCentralExists so that it works on
|
|
; pre-SuperMario ROMs. This is necessary for the INIT version of
|
|
; the code.
|
|
; <SMG3> 9/22/93 chp Implement a TestFor for Grand Central.
|
|
; <SM20> 10/29/93 DCB <MC> roll-in.
|
|
; <MC4> 10/28/93 pdw Changed recording.
|
|
; <SM19> 10/15/93 pdw Added the tst.b -300(sp) to the SCSIAtomic call glue to avoid
|
|
; any stack paged out problems.
|
|
; <SM18> 10/14/93 pdw Added support for Synchronous data transfers, rewrote State
|
|
; Machine, message handling etc.
|
|
; <SM17> 9/9/93 pdw Lots of little changes. Name changes, temporary cache_bug
|
|
; stuff.
|
|
; <SM16> 8/23/93 DCB Fixing TestFor_djMEMCExists to so that uses UnivROMFlags.
|
|
; <SM15> 8/13/93 pdw Added -exists to TestFor_Orwell.
|
|
; <SM14> 7/17/93 pdw Added VMRunning routine.
|
|
; <SM13> 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.
|
|
; <SM12> 5/25/93 DCB Rollin from Ludwig. (The next item below)
|
|
; <LW11> 5/21/93 PW Changing VM-ON check to use $B78<0 instead of $CF0=-1.
|
|
; <SM11> 5/5/93 PW Adding IllegalInstr() function.
|
|
; <SM10> 5/5/93 PW Converted names to meanies-friendly names. Updated with latest
|
|
; from Ludwig stuff.
|
|
; <LW10> 5/1/93 PW Got rid of RECORD_ON and RECORD_rCMD definitions (should only be
|
|
; in Debug.a now.
|
|
; <LW9> 4/30/93 DCB Changing default RECORD_ON to 0 for final Candidate
|
|
; <LW7> 4/14/93 DCB Added the CallOldXPT function to facillitate switching from one
|
|
; XPT to another.
|
|
; <LW6> 3/8/93 PW Recording EnVM and DsVM again.
|
|
; <LW5> 2/17/93 PW Added TestFor_HMCDecoder for PDM support.
|
|
; <SM9> 4/8/93 DCB Added TestForDJMEMC and TestForOrwell to identify Wombats
|
|
; <SM8> 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM
|
|
; (will update Ludwig with these as needed myself).
|
|
; <LW4> 1/27/93 PW Changed values for 'EnVM' and 'DsVM' events to include VM's
|
|
; UserCodeDisabled value. Removed EnV0 check and event. Made EnVM
|
|
; return void again.
|
|
; <LW3> 1/12/93 DCB Changed ifdefs for RECORD_ON so that the makefile will turn them
|
|
; on and off correctly.
|
|
; <LW2> 12/18/92 PW Added general SyncRequestsEnabled counter support to fix
|
|
; SCSIGets at VBL time bug.
|
|
; <SM7> 12/5/92 PW Changed to default to recording A089 traps.
|
|
; <SM6> 12/5/92 PW Changed the record_event for A089.
|
|
; <SM5> 11/20/92 DCB Moved the VM stuff here where it belongs
|
|
; <SM4> 10/30/92 DCB Changed the record data for 'AO89' tape entry
|
|
; <SM3> 8/24/92 PN Take out CycloneboxEVT1 stuff
|
|
; <SM2> 7/28/92 PW Added onEVT1 check routine so that InitItt can choose not to
|
|
; install Itt if on an EVT1.
|
|
; <SM1> 7/25/92 PW New Today.
|
|
;
|
|
;==========================================================================
|
|
|
|
MACHINE MC68020 ; '020-level
|
|
BLANKS ON ; assembler accepts spaces & tabs in operand field
|
|
PRINT OFF ; do not send subsequent lines to the listing file
|
|
; don't print includes
|
|
CASE OBJECT ; preserve case in object file
|
|
|
|
|
|
|
|
LOAD 'StandardEqu.d' ; from StandardEqu.a and for building ROMs
|
|
INCLUDE 'HardwarePrivateEqu.a'
|
|
INCLUDE 'SysPrivateEqu.a'
|
|
INCLUDE 'UniversalEqu.a' ; for TestFor
|
|
INCLUDE 'Debug.a' ; for NAME macro
|
|
INCLUDE 'ACAM.a'
|
|
INCLUDE 'SCSI.a' ; for scsiBPhysical
|
|
|
|
INCLUDE 'XPTEqu.a'
|
|
|
|
IMPORT RecordEvent
|
|
|
|
VMGlobals EQU $B78 ;!!! until I update InternalOnlyEqu.a
|
|
VMVectors EQU $CF0 ; pointer to VM vector table
|
|
;--------------------------------------------------------------------------
|
|
|
|
******** Entry point from A089 Trap *************
|
|
|
|
SCSIAtomic PROC EXPORT
|
|
IMPORT SCSITrap: CODE
|
|
|
|
IF CALL_RECORD_ON THEN
|
|
pea 'A089'
|
|
move.l SCSI_IO.scsiDevice(A0), -(sp)
|
|
move.b SCSI_IO.scsiFunctionCode(A0), (sp) ;into diReserved
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
|
|
move.l A0, -(sp)
|
|
move.l sp, -(sp)
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
ENDIF
|
|
|
|
; let's make sure that there's enough stack space paged in for us to use.
|
|
; this is desired because of the enormous number of non-driver clients
|
|
; that don't hold the stack when making SCSI calls
|
|
|
|
tst.b -$300(sp)
|
|
|
|
; push parameters and call SCSITrap
|
|
|
|
move.l A0, -(sp) ; store SCSI_PB argument on the stack
|
|
move.l D0, -(sp) ; store scsiSelector argument on the stack
|
|
bsr.w SCSITrap ; call the SCSITrap in the SCSI manager
|
|
; result in D0.L
|
|
add.l #8, sp ; pop-off arguments
|
|
rts
|
|
|
|
NAME 'SCSIAtomic'
|
|
|
|
ENDPROC
|
|
|
|
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_SCSI96_1Exists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
moveq.l #0, D0
|
|
TestFor SCSI96_1Exists
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_SCSI96_1Exists'
|
|
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_SCSI96_2Exists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
moveq.l #0, D0
|
|
TestFor SCSI96_2Exists
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_SCSI96_2Exists'
|
|
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_PSCExists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
moveq.l #0, D0
|
|
TestFor PSCExists
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_PSCExists'
|
|
|
|
ENDP
|
|
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_HMCDecoder PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
moveq.l #0, D0
|
|
TestFor HMCDecoder ; are we PDM ?
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_HMCDecoder'
|
|
|
|
ENDP
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_OrwellExists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
moveq.l #0, D0
|
|
TestFor OrwellExists ; are we Quadra ?
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_OrwellExists'
|
|
|
|
ENDP
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_djMEMCExists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
move.l UnivROMFlags, D0
|
|
btst.l #ProductInfo.djMEMCChipBit, D0
|
|
sne D0
|
|
rts
|
|
|
|
NAME 'TestFor_djMEMCExists'
|
|
|
|
ENDP
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
TestFor_GrandCentralExists PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
|
|
; First make sure the ROM has 96-bit AddrMapFlags.
|
|
;
|
|
moveq #0,d0
|
|
movea.l UnivInfoPtr,a0
|
|
adda.l ProductInfo.DecoderInfoPtr(a0),a0
|
|
tst.b DecoderInfo.DecoderInfoVers(a0)
|
|
beq.b @exit
|
|
|
|
TestFor GrandCentralExists
|
|
sne d0
|
|
@exit rts
|
|
|
|
NAME 'TestFor_GrandCentralExists'
|
|
|
|
ENDP
|
|
|
|
|
|
;**************************************************************************
|
|
;
|
|
; VMEnableUserCode, VMDisableUserCode -
|
|
;
|
|
;==========================================================================
|
|
|
|
; Pointer to V_UserCode is stored at *VMVECTORS + 0x48;
|
|
; Pointer to userCodeDisabled is stored at *VMG + 0x48;
|
|
; Pointer to pageFaultFatal is stored at *VMG + 0x4a;
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
VMEnableUserCode PROC EXPORT
|
|
|
|
move.l ([SCSIGlobals],SCSIGlobalsRec.xptGlobals), A0
|
|
subq.w #1, XPTglobals.syncUnsafeCount(A0)
|
|
bhs.s @cool
|
|
|
|
moveq.l #0, D0
|
|
move.w D0, XPTglobals.syncUnsafeCount(A0)
|
|
IF 1 AND RECORD_ON THEN ; <SM3>
|
|
pea 'EnV0'
|
|
pea 0
|
|
move.w XPTglobals.syncUnsafeCount(A0), 2(sp)
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @10
|
|
move.l VMGlobals, A0
|
|
move.b $49(A0), (sp)
|
|
move.b $4b(A0), 1(sp)
|
|
@10
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
ENDIF
|
|
IfDebugStr 'syncUnsafeCount gone negative'
|
|
bra.s @exitVMEn
|
|
|
|
@cool
|
|
IF 0 AND RECORD_ON THEN ; <SM3>
|
|
pea 'EnVM'
|
|
pea 0
|
|
move.w XPTglobals.syncUnsafeCount(A0), 2(sp)
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @11
|
|
move.l VMGlobals, A0
|
|
move.b $49(A0), (sp)
|
|
move.b $4b(A0), 1(sp)
|
|
@11
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
ENDIF
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @1
|
|
|
|
move.l #1, -(sp)
|
|
move.l VMVECTORS, a0
|
|
move.l $48(a0), A0
|
|
jsr (a0)
|
|
addq.l #4, sp
|
|
@1
|
|
tst.l XPTglobals.syncUnsafeCount(A0) ; Safe?
|
|
bne.b @2
|
|
|
|
btst #kbOldAPIBusy, XPTglobals.flags(A0) ; old API clear?
|
|
bne.b @2
|
|
|
|
IF 0 AND RECORD_ON THEN
|
|
pea 'Free'
|
|
pea 0
|
|
move.w ([SCSIGlobals],XPTglobals.syncUnsafeCount), 2(sp)
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @12
|
|
move.l VMGlobals, A0
|
|
move.b $49(A0), (sp)
|
|
move.b $4b(A0), 1(sp)
|
|
@12
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
ENDIF
|
|
jsr callFreeHook ; Tell File Mgr what's up
|
|
@2
|
|
|
|
moveq.l #1, D0
|
|
@exitVMEn
|
|
rts
|
|
|
|
NAME 'VMEnableUserCode'
|
|
|
|
|
|
callFreeHook
|
|
move.l SCSIGlobals, a0 ; aquire our globals
|
|
|
|
bclr.b #0,SCSIGlobalsRec.ciWasBusy(a0); do we need to call the free hook?
|
|
beq.b @Done ; nope
|
|
|
|
bset.b #1,SCSIGlobalsRec.ciBusyPending(a0) ; test and set the freehook pending flag
|
|
bne.s @Done ; one already pending - done
|
|
|
|
lea PostFreeHook,a0 ; get addr of routine to execute
|
|
_DeferUserFn ; execute deferred
|
|
@Done
|
|
rts
|
|
|
|
NAME 'callFreeHook'
|
|
|
|
|
|
PostFreeHook
|
|
movea.l ExpandMem,a0 ; a0 = ptr to expand mem
|
|
move.l ExpandMemRec.jSCSIFreeHook(a0),d0 ; d0 = SCSI free vector
|
|
beq.s @Done ; no freehook to execute
|
|
movea.l d0,a0
|
|
jsr (a0) ; execute "jSCSIFreeHook"
|
|
@Done
|
|
move.l SCSIGlobals, a0 ; aquire our globals
|
|
clr.b SCSIGlobalsRec.ciBusyPending(a0) ; clear pending flag
|
|
rts
|
|
|
|
NAME 'PostFreeHook'
|
|
ENDP
|
|
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
VMDisableUserCode PROC EXPORT
|
|
|
|
IF 0 AND RECORD_ON THEN
|
|
pea 'DsVM'
|
|
pea 0
|
|
move.w XPTglobals.syncUnsafeCount(A0), 2(sp)
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @12
|
|
move.l VMGlobals, A0
|
|
move.b $49(A0), (sp)
|
|
move.b $4b(A0), 1(sp)
|
|
@12
|
|
bsr RecordEvent
|
|
addq.l #8, sp
|
|
ENDIF
|
|
|
|
tst.l VMGlobals
|
|
bmi.s @1
|
|
|
|
clr.l -(sp)
|
|
move.l VMVECTORS, a0
|
|
move.l $48(a0), A0
|
|
jsr (a0)
|
|
addq.l #4, sp
|
|
@1
|
|
move.l ([SCSIGlobals],SCSIGlobalsRec.xptGlobals), A0
|
|
addq.w #1, XPTglobals.syncUnsafeCount(A0)
|
|
bcc.s @cool
|
|
IfDebugStr 'syncUnsafeCount gone big!'
|
|
moveq #dsIOCoreErr, D0
|
|
_SysError
|
|
@cool
|
|
rts
|
|
|
|
NAME 'VMDisableUserCode'
|
|
|
|
ENDP
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
CallOldXPT PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
;
|
|
move.l 12(sp),a1 ; get the XPT
|
|
move.l 8(sp),d0 ; get the scsiSelector
|
|
move.l 4(sp),a0 ; get the parameter block
|
|
jmp (a1) ; jump to it
|
|
|
|
RTSNAME 'CallOldXPT'
|
|
|
|
ENDP
|
|
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
VMRunning PROC EXPORT
|
|
;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
|
|
|
tst.l VMGlobals
|
|
spl D0 ; if plus, D0 gets set (i.e. VM is on)
|
|
rts
|
|
|
|
NAME 'VMRunning'
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
END
|
|
|