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

174 lines
6.8 KiB
Plaintext

;
; File: SCSIMgrInitFlags.a
;
; Copyright: © 1989-1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM3> 11/3/92 SWC Removed GestaltEqu.a and SCSIEqu.a cuz they aren't needed.
; <9> 5/1/92 JSM Get rid of not forROM conditional, this file is only for ROM
; builds. This file now has no conditionals.
; <8> 12/27/91 RB Rolled in Terror changes. Got rid of 'isUniversal' conditionals.
; <7> 9/16/91 JSM Cleanup header.
; <6> 6/12/91 LN Changed #include 'HardwareEqu.a' to 'HardwarePrivateEqu.a'
; <5> 8/3/90 BG Modified -machTable- to reflect the current real values of
; BoxFlag.
; <4> 5/16/90 MSH Added Waimea to machine table as well as adding hasPowerControls
; conditional.
; <3> 1/3/90 CCH Changed gestalt equate name back to GestaltEqu.a.
; <1.3> 9/11/89 jwk NEEDED FOR F19 - Support for universal builds
; <1.2> 7/15/89 jwk NEEDED FOR AURORA - Added code review changes, F19 routines
; <1.1> 6/30/89 jwk NEEDED FOR AURORA - Fixed bug calling Gestalt in forRom version
; <1.0> 6/29/89 jwk NEEDED FOR AURORA - Allows System patch builds based on ROM
; sources
;
;---------------------------------------------------------------------------------------
;
; This file contains a routines which set up the the hardware feature flags
; for the box we are running on.
; These flags are contained in the globals field State3, and are as follows:
; bit 0 hwCbPwrMgr ; do we have a Power Mgr
; bit 1 OSSExists ; do we have an OSS ?
; bit 2 RBVExists ; do we have an RBV ?
; bit 3 VIA2Exists ; do we have a second VIA ?
; bit 4 SCSIDMAExists ; do we have a SCSI DMA chip ?
; bit 5 onMacPlus ; are we on a Mac Plus ?
; bit 6 on68000 ; are we on a 68000 ?
; bit 7 DUF ; is _DeferUserFn defined ? <8> rb
; bit 8 SCSI96_1 ; do we have one SCSI96 chip <8> rb
; bit 9 SCSI96_2 ; do we have 2nd SCSI96 chip <8> rb
; bit 10-31 not used yet <8> rb
;
; The algorithm to determine the value of these flags is as follows:
;
; 1) First we determine if we are on a machine running with a universal ROM.
; We call Gestalt for the machine type, and if the type value is greater than
; that for an Esprit, we assume we have universal ROM support.
;
; 2) If we are on a universal ROM, we use the universal ROM macro 'TestFor'
; to determine the existence of these hardware features, and set our global
; bits accordingly. This ensures that for future machines, with possibly new
; combinations of existing features, we can still see what we have, and are
; not tied to knowing only about current combinations.
; NOTE THAT IF THE TESTFOR IMPLEMENTATION IS CHANGED WE ARE HOSED!!!!!!!!
;
; 3) If we are NOT on a universal machine (which means we must be running on
; an old CPU), we determine the type of machine we are running on by calling
; Gestalt, and set our globals flags according to what we KNOW them to be. This
; is ok because we don't expect these boxes to change anyway.
;
;
; Input: nothing special
; Output: d0.l contains HW config flags in 3 low bytes
; d0.l contains gestalt box number in high byte
; d0 contains -1 if we don't have a clue
; destroys: d0
;
blanks on
string asis
print off
LOAD 'StandardEqu.d'
include 'HardwarePrivateEqu.a'
include 'UniversalEqu.a'
print on
;
; NOTE that these are also defined in SCSIMgrInit.a, so if you change 'em here....
;
sHWCbPwrMgr equ 0 ; see if we have a Power Mgr <eee>
sOSSExists equ 1 ; do we have an OSS ?
sRBVExists equ 2 ; do we have an RBV ?
sVIA2Exists equ 3 ; do we have a second VIA ?
sSCSIDMAExists equ 4 ; do we have a SCSI DMA chip ?
isMacPlus equ 5 ; are we on a Mac Plus ?
is68000 equ 6 ; are we on a 68000?
sDeferUserFn equ 7 ; is _DeferUserFn defined ?
sSCSI96_1 equ 8 ; do we have 1st SCSI96 chip <8> rb
sSCSI96_2 equ 9 ; do we have 2nd SCSI96 chip? <8> rb
SCSISetFlags proc export
movem.l a0/d1,-(sp) ; save out a register
moveq.l #0,d0 ; set all flags to zero to start
; Plus, xx bits remains zero
; for ROM, we start here.
@NewMach ; removed call to Gestalt
TestFor VIA2Exists ; via2 chip?
beq.s @noVIA2 ; no
bset.l #sVIA2Exists,d0 ; we have a VIA2
@noVIA2
TestFor RBVExists ; RBV chip?
beq.s @noRBV ; no
bset.l #sRBVExists,d0 ; we have an RBV
@noRBV
TestFor SCSIDMAExists ; SCSI DMA chip
beq.s @noDMA ; no
bset.l #sSCSIDMAExists,d0 ; we have SCSI DMA
@noDMA
TestFor OSSExists ; OSS chip?
beq.s @noOSS ; no
bset.l #sOSSExists,d0 ; we have an OSS
@noOSS
TestFor hwCbPwrMgr ; Power Manager?
beq.s @noPMgr ; no
bset.l #sHWCbPwrMgr,d0 ; we have a Power Mgr
@noPMgr
TestFor SCSI96_1Exists ; check if we have a SCSI96_1 <8> rb
beq.s @noSCSI96 ; no SCSI96 at all <8> rb
bset.l #sSCSI96_1, d0 ; we have SCSI96_1 <8> rb
@noSCSI96
TestFor SCSI96_2Exists ; check if we have SCSI96_2 <8> rb
beq.s @chkCPU ; bra. if not <8> rb <t4> djw
bset.l #sSCSI96_2, d0 ; we have SCSI96_2 <8> rb
@chkCPU tst.b cpuFlag ; are we on a 68000?
bne.s @done ; no
bset.l #is68000,d0 ; yes, so set corresponding bit
@done
movem.l (sp)+,a0/d1 ; restore register
rts
; This table is based on the gestalt numbering scheme; it better not change!!!
; note this table must be extended for new machines
machTable ;DUF 000 Plus DMA Via2 RBV OSS PwrM
dc.b $60 ; 0 1 1 0 0 0 0 0 MacPlus EQU 4
dc.b $40 ; 0 1 0 0 0 0 0 0 MacSE EQU 5
dc.b $08 ; 0 0 0 0 1 0 0 0 MacII EQU 6
dc.b $08 ; 0 0 0 0 1 0 0 0 MacIIx EQU 7
dc.b $08 ; 0 0 0 0 1 0 0 0 MacIIcx EQU 8
dc.b $08 ; 0 0 0 0 1 0 0 0 MacSE30 EQU 9
dc.b $41 ; 0 1 0 0 0 0 0 1 Portable EQU 10
dc.b $04 ; 0 0 0 0 0 1 0 0 MacIIci EQU 11
dc.b $18 ; 0 0 0 1 1 0 0 0 4Square EQU 12
dc.b $12 ; 0 0 0 1 0 0 1 0 MacIIfx EQU 13
dc.b $00 ; AuroraCX16 (unused) EQU 14
dc.b $00 ; AuroraSE25 (unused) EQU 15
dc.b $00 ; AuroraSE16 (unused) EQU 16
dc.b $40 ; 0 1 0 0 0 0 0 0 MacClassic EQU 17
dc.b $00 ; 0 0 0 0 0 0 0 0 MacIIsi EQU 18
dc.b $00 ; 0 0 0 0 0 0 0 0 MacLC EQU 19
dc.b $81 ; 0 0 0 1 1 0 0 0 Eclipse EQU 20
dc.b $09 ; 0 0 0 0 1 0 0 1 Waimea EQU 21
dc.b $00 ; 0 0 0 0 0 0 0 0 ElsieV8 EQU 22
endproc
END.