;========================================================================== ; ; File: SIMMachine.a ; ; Contains: Misc. routines for SIM SCSI State Machine ; ; Written by: Paul Wolf ; ; Copyright: ╘ 1990-1993 by Apple Computer, Inc., all rights reserved. ; ; Change History (most recent first): ; ; 11/16/93 SAM Include HardwarePrivateEqu.a ; 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/8/93 pdw Changed recording data for stack switching events to help Kurt ; with StkLowPt problem. ; 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. ; 5/5/93 PW Converted names to meanies-friendly names. Updated with latest ; from Ludwig stuff. ; 5/1/93 PW Got rid of RECORD_ON and RECORD_rCMD definitions (should only be ; in Debug.a now. ; 2/9/93 PW Removed some PDM debug stuff that's not needed. ; 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM ; (will update Ludwig with these as needed myself). ; 11/20/92 DCB Removed VM Stuff and put it into SCSIGlue.a ; 10/30/92 DCB Stopped recording VM calls ; 10/8/92 PW Removed lots of unused code. ; ;========================================================================== 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 INCLUDE 'SysEqu.a' ; for StkLowPt INCLUDE 'HardwarePrivateEqu.a' INCLUDE 'Traps.a' ; for _DebugStr INCLUDE 'Debug.a' ; for NAME INCLUDE 'ACAM.a' INCLUDE 'HALc96equ.a' PRINT ON ; do send subsequent lines to the listing files CASE OBJECT IMPORT RecordEvent ;========================================================================== ;************************************************************************** ; ; CallMachine - ; ;========================================================================== CallMachine PROC EXPORT IMPORT TheMachine IMPORT FreeMachine WITH HALc96GlobalRecord ;иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии ; Switch to SCSI stack, suspending the main "thread". ; then call the selected routine ; then switch back to the previous "thread" which may be the main thread or ; it may be the interrupt thread (i.e. we're finally completing a request) ;иииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииииии move.l A5, -(sp) ; save caller's A5 move.l 8(sp), A0 ; get SIMg parameter move.l (A0), A5 ; get HALg DisableSCSIIRQ ; disable ints before we go down into Machine IF STACK_RECORD_ON THEN pea '>> ' move.l StkLowPt, -(sp) bsr RecordEvent addq.l #8, sp ENDIF movem.l D3-D7/A2-A6, -(sp) bsr.s PrivateCallMachine ; MAGIC stack change here!! movem.l (sp)+, D3-D7/A2-A6 IF STACK_RECORD_ON THEN pea '<< ' move.l StkLowPt, -(sp) bsr RecordEvent addq.l #8, sp ENDIF EnableSCSIIRQ ; enable ints after we come back out move.l (sp)+, A5 ; restore caller's A5 rts NAME 'CallMachine' ;ииииииииииииииииииииииииииииииииииииииииииииииииииииииии PrivateCallMachine ; Switch to SCSI stack ииииииииииииии IF STACK_RECORD_ON THEN pea ' >>' move.l StkLowPt, -(sp) bsr RecordEvent addq.l #8, sp ENDIF move.l StkLowPt, publicStkLowPt(A5) ; remember old StkLowPt clr.l StkLowPt ; and disable stack sniffer move.l sp, publicSP(A5) ; suspend main thread IF DEBUGGING THEN move.b #1, privStackState(A5) ENDIF move.l privStackTop(A5), sp ; create SCSI thread IF STACK_RECORD_ON THEN pea '>Mch' move.l StkLowPt, -(sp) bsr RecordEvent addq.l #8, sp ENDIF ; Call the State Machine ииииииииииииии ; TheMachine( OSErr * finalStatus, SIM_IO ** completedIO, SIMglobals * SIMg) subq.l #6, sp ; allocate room for completedIO & finalStatus move.l A0, -(sp) ; pass SIMg into Machine pea 4(sp) ; sp=SIMg,completedIO pea 12(sp) ; sp=*completedIO,SIMg,completedIO,finalStatus bsr TheMachine lea 8(sp), sp ; get rid of parameters except for... move.l (sp)+, A0 ; ...SIMg move.l (sp)+, A1 ; get completedIO moveq.l #0, D1 move.w (sp)+, D1 ; get finalStatus ; Return to previous stack ииииииииииииии IF STACK_RECORD_ON THEN pea ' rts (old API) move.l A0, -(sp) ; SIMg move.l A1, -(sp) ; ioPtr move.l D1, -(sp) ; finalStatus bsr FreeMachine lea 12(sp), sp ; get rid of parameters @exit rts NAME 'PrivateCallMachine' ENDWITH ;************************************************************************** ; ; BlockInterrupts, UnblockInterrupts - ; ;========================================================================== BlockInterrupts PROC EXPORT move.w SR, D0 ori.w #$0700,SR ; disable all ints rts NAME 'BlockInterrupts' ENDP ;ииииииииииииииииииииииииииииииииииииииииииииииииииииииии UnblockInterrupts PROC EXPORT move.w 6(sp), SR rts NAME 'UnblockInterrupts' ENDP END