mac-rom/OS/SCSIMgr4pt3/IttInit.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
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.
2017-12-26 09:52:23 +08:00

175 lines
4.8 KiB
Plaintext

;
; File: IttInit.a
;
; Contains: Cousin Itt test INIT
;
; Written by: Paul Wolf
;
; Copyright: © 1990-1993 by Apple Computer, Inc., All rights reserved.
;
; This file is used in these builds:
;
; Change History (most recent first):
;
; <SM19> 11/23/93 DCB Don't call IttBoot if we don't install. Otherwise we are toast.
; <SM18> 11/22/93 pdw Rolling in from <MCxx>.
; <MC4> 11/9/93 pdw Removed call to InitSCSIBoot.
; <SM17> 11/17/93 DCB Adding conditional around debugger so we can turn it on and off.
; <SM16> 10/29/93 DCB Removing DebugStr for Grog release
; <SM15> 10/14/93 pdw <MC> roll-in.
; <MC3> 10/12/93 pdw Added support for Synchronous data transfers, rewrote State
; Machine, message handling etc.
; <MC2> 9/26/93 pdw Added call to InitSCSIBoot instead of fooling with PRAM.
; <SM12> 9/9/93 pdw Lots of little changes. Name changes, temporary cache_bug
; stuff.
; <SM11> 7/20/93 pdw Fixed a stack alignment bug that was causing massive crashes if
; SCSISelect was failing (down in that scanning routine at the
; bottom).
; <SM10> 6/29/93 pdw Massive checkins: Added code to scan devices that were loaded at
; boot time so that they get entered into the VirtualID table.
; <SM9> 5/26/93 PW Rolling in Ludwig changes.
; <LW5> 5/21/93 PW Changing a _DebugStr to a DebugStr.
; <SM6> 3/20/93 PW Rolled in Ludwig changes.
; <LW3> 2/17/93 PW Removed SCSIDrvrs stuff - put it in InitBoot instead.
; <LW2> 2/10/93 PW Cleaned up and added BootItt test after InitItt.
; <SM5> 2/4/93 PW Got rid of useless stuff and calling BootItt after InitItt to
; try to load drivers (and test BootItt).
; <SM4> 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM
; (will update Ludwig with these as needed myself).
; <SM3> 11/9/92 fau Added support for Tempest (CycloneLC).
; <SM2> 8/31/92 PW Moved debugger trap up so that if you skip over it, it won't do
; the DetachResource.
;
;==========================================================================
BLANKS ON ; assembler accepts spaces & tabs in operand field
PRINT OFF ; do not send subsequent lines to the listing file
; don't print includes
MACHINE MC68020 ; '020-level
LOAD 'StandardEqu.d' ; from StandardEqu.a and for building ROMs
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'UniversalEqu.a' ; for TestFor
INCLUDE 'SCSI.a' ;
INCLUDE 'Debug.a' ; for NAME macro
INCLUDE 'ACAM.a'
INCLUDE 'XPTEqu.a' ; for globals
PRINT ON ; do send subsequent lines to the listing files
CASE OBJECT ; use case as specified in source text, C
IttInit MAIN EXPORT
IMPORT InitItt
IMPORT ITTBOOT
IF useINITDebugger THEN
DebugStr 'Cmd-G to install, "g pc+2" to skip (SM)'
ENDIF
bsr.s @1
nop
rts
@1
link A6, #-4
move.l a0, -(sp) ; load our resource handle for _DetachResource
_DetachResource ; don't release resource space
bsr InitItt
tst.l d0 ; did it install?
bne.b @exit ; nope get out of town.
pea -4(A6)
pea 1 ; only look for the startup device
bsr.l ITTBOOT ; get the startup device's refnum in D0
lea 8(sp),SP
pea -4(A6)
clr.l -(sp) ; load all drivers
bsr.l ITTBOOT
lea 8(sp),SP
moveq.l #7, D3 ; D3 = scanning SCSI ID (saved from C)
@lpTop
btst D3, SCSIDrvrs ; was this guy touched in IttBoot?
beq.s @lpBtm ; yes -> don't bother with it now
bsr.s ReadBlock0
@lpBtm
dbra D3, @lpTop
@exit
unlk A6
rts
NAME 'IttInit'
; ENDWITH
ReadBlock0
lea -512(sp), sp
move.l sp, A1 ; A1 = buffer for read
lea -scSize*2(sp), sp
move.l sp, A2 ; A0 = TIB
move.w #scInc, scOpcode+ 0*scSize(A2)
move.l A1, scParam1+ 0*scSize(A2)
move.l #512, scParam2+ 0*scSize(A2)
move.w #scStop,scOpcode+ 1*scSize(A2)
move.l #0, scParam1+ 1*scSize(A2)
move.l #0, scParam2+ 1*scSize(A2)
subq.l #2, sp
_SCSIGet
move.w (sp)+, D0
bne.s @exit
subq.l #2, sp
move.w D3, -(sp)
_SCSISelect
move.w (sp)+, D0
bne.s @exit
subq.l #2, sp
pea rdBlock0CDB
move.w #6, -(sp)
_SCSICmd
move.w (sp)+, D0
bne.s @complete
subq.l #2, sp
move.l A2, -(sp)
_SCSIRead
move.w (sp)+, D0
@complete
clr.l -(sp) ; room for status and message
subq.l #2, sp ; room for result
pea 2(sp) ; status word
pea 4+2(sp) ; message word
move.l #$60*20, -(sp) ; timeout (20 seconds)
_SCSIComplete
lea 6(sp), sp ; toss result/status/message
@exit
lea 512+scSize*2(sp), sp ; remove buffer/TIB but leave stat/msg
rts
rdBlock0CDB
dc.b $08, $00, $00, $00, $01, $00
ENDMAIN
END