antoine-source/scsi2/SCSI.Drivers/SCSI Filter shutdown

1 line
9.5 KiB
Plaintext
Raw Normal View History

;******************************************************* ; ; SCSI Driver 'Shutdown' filter. ; ; Written by Matt Gulick. Started August 9,1988 ; ; Copyright Apple Computer, Inc. 1988,89 ; ;******************************************************* ;******************************************************* ; ; This file contains the 'Shutdown' filter as defined ; in the ERS. ; ;******************************************************* ;******************************************************* ; ; Revision History: ; ;******************************************************* ; ; Aug 9, 1988 File started. ; Mar 8, 1989 Modified to support Warm/Cold ; Shutdown. STRING PASCAL BLANKS OFF PAGESIZE 70 PRINT NOGEN PRINT NOMDIR MACHINE M65816 IMPORT direct_page IMPORT default_dib IMPORT tot_dib_cnt IMPORT active_starts IMPORT stop_unit PRINT OFF INCLUDE 'scsihd.equates' INCLUDE 'M16.MEMORY' INCLUDE 'M16.UTIL' PRINT ON EJECT ;******************************************************* ; ; Main Entry point to the 'Shutdown' filter. This ; "Filter" is called when a Device is no longer ; desired in the tables. The following code segment ; first checks to see if the DIB being shut down is ; the default dib (it will only be shutdown durring ; startup). If it is the default dib we will do ; nothing and exit with no error. If on the other ; hand it is a valid DIB, we will clear some key ; fields within the dib and then we will alter the ; links to skip this DIB, then we update a field in the ; first DIB of this memory segment. This count tells ; how many active dibs there are in that segment. If ; this reaches zero we will then dispose this handle ; because it is unused. If we later need space to ; bring new devices online and we don't have the space, ; we'll get it at that time. If on exit there are ; still any active dibs that use this code segment then ; a DRVR_BUSY error will be returned. If no DIBs are ; active then no error will be returned. ; ; Inputs: [dib_ptr] = Last DIB built (LONG) ; Acc = Unspecified ; Carry = Unspecified ; Y register = Unspecified ; X register = Unspecified ; P register = 0=M=X=e ; Direct Page = Ours ; Data Bank = Ours ; ; Outputs: Acc = DRVR_BUSY ; Carry = 1 ; unless we have no more dibs then ; Acc = 0 ; Carry = 0 ; ; Y register = Unspecified ; X register = Unspecified ; P register = 0=M=X=e ; Direct Page = GS/OS Direct Page ; Data Bank = Ours ; ; Errors: See Spec. ; ;******************************************************* EXPORT shutdown shutdown PROC ; ; Check to see if this is for the ; 'default_dib'. If it is, then we ; need to exit with a DRVR_BUSY Error. ; lda <dib_ptr cmp #default_dib bne @real_dib lda <dib_ptr+2 cmp #^default_dib bne @real_dib ; ; Return a DRVR BUSY error and take ; no action. ; lda #drvr_busy sec rts @real_dib ;------------------------------------------------------------------------------- IF warm_ss_suprt = true THEN ; ; It's a real DIB. Is it a COLD ; SHUTDOWN? ; lda >warm_cold_flag and #$0001 beq @do_cold ;It's Cold ; ; Yeah, so it's a warm shutdown. But ; does this device know what that ; means? We'll see! ; ldy #dib.dvcchar lda [dib_ptr],y and #restartable beq @do_cold ;Not restartable. ; ; Mark as OFFLINE and Relaxing ; ldy #dib.dvcflag lda [dib_ptr],y and #dvc_online--\ $ffff ora #relaxing sta [dib_ptr],y ; ; Is the device removable? ; ; ldy #dib.dvcchar ; lda [dib_ptr],y ; and #removable ; beq @continue ;Not removable. ; ; Reinitialise DIB Device Number to ; zero. ;