;******************************************************* ; ; SCSI Driver 'Equates' file.. ; ; Written by Matt Gulick. Started August 13,1988 ; ; Copyright Apple Computer, Inc. 1988-90 ; ;******************************************************* ;******************************************************* ; ; This file contains all the global equates for the ; SCSI Driver. Only those items below that are marked ; as "**** Changable ****" can be altered safely ; without detailed intimate knowledge of how the ; generic driver functions. Any other values should ; only be modified by someone who understands how this ; generic driver functions. ; ;******************************************************* ; ; Bit Location equates ; null equ %0000000000000000 bit_0 equ %0000000000000001 bit_1 equ %0000000000000010 bit_2 equ %0000000000000100 bit_3 equ %0000000000001000 bit_4 equ %0000000000010000 bit_5 equ %0000000000100000 bit_6 equ %0000000001000000 bit_7 equ %0000000010000000 bit_8 equ %0000000100000000 bit_9 equ %0000001000000000 bit_10 equ %0000010000000000 bit_11 equ %0000100000000000 bit_12 equ %0001000000000000 bit_13 equ %0010000000000000 bit_14 equ %0100000000000000 bit_15 equ %1000000000000000 ; ; Partition Map Signature ; Part_sig equ $4d50 ; ; Booleans ; true equ bit_0 false equ null ; ; Time definitions. ; qtr_sec equ $0001 one_sec equ 4*qtr_sec one_min equ 60*one_sec ; ; SCSI Driver Version Number. ; and other driver dependent data ; drvr_vers equ $1100 ;Driver 1.1 for GS/OS 5.0 cmd_start equ $0000 ;Driver Startup Call cmd_open equ $0001 ;Driver Open Call cmd_read equ $0002 ;Driver Read Call cmd_write equ $0003 ;Driver Write Call cmd_close equ $0004 ;Driver Close Call cmd_status equ $0005 ;Driver Status Call cmd_control equ $0006 ;Driver Control Call cmd_flush equ $0007 ;Driver Flush Call cmd_shutdown equ $0008 ;Driver Shutdown Call max_d_cmd equ $0008 ;Max Driver Command **** Changable **** max_s_cmd equ $0005 ;Max Status Code **** Changable **** max_c_cmd equ $0009 ;Max Control Code **** Changable **** ; ; Suppervisory Dispatcher IDs and ; SCSI Manager Command Numbers ; super_d_id equ $0000 ;Supervisory Dispatcher's ID get_sdrvr_id equ $0000 ;Get S Driver's ID Number set_sib_ptr equ $0001 ;Set SIB Pointer cmd_get_dvc equ $0002 ;SCSI Manager Get Devices Call cmd_claim_dvc equ $0003 ;SCSI Manager Claim Devices Call scsi_io_call equ $0004 ;SCSI Manager I/O Call ; ; SCSI Device Types from INQUIRY Call ; direct_acc equ $0000 ; Direct-Access Device seq_acc equ $0001 ; Sequential-Access Device print_dvc equ $0002 ; Printer Device proc_dvc equ $0003 ; Processor Device worm_dvc equ $0004 ; Write-once Read-multiple Device read_dacc equ $0005 ; Read-only Direct-Access Device scanner equ $0006 ; Scanner Device optic_mem equ $0007 ; Optical Memory Devices changer equ $0008 ; Changer Devices comm_dvc equ $0009 ; Communication Devices mcd_40 equ $0010 ; Apple's tape. Direct Access Magnetic Tape Device apple_cd equ read_dacc ; Apple's CD-ROM apple_scan equ scanner ; Apple's Scanner appl_laser equ $00ff ; Apple's LaserWriter SC data_dat equ $00ff ; Data Dat Device mag_optical equ direct_acc ; Magneto-Optical Device ; ; Type of Device we support in this driver. ; ;------------------------------------------------------------------------------- IF Type = 0 Then scsi_dtype equ direct_acc block_dvc equ true character_dvc equ false part_suprt equ true ;Supports Partions TRUE/FALSE warm_ss_suprt equ true ;Supports Warm Shutdown/Startups block_size equ $200 cache_blks equ true dibs_2_make equ 4 ;Number of dibs to make if growing max_dvc_cnt equ 100 ;Yes: that's decimal 100 p_mask_adder equ bit_10 ;First Bit of Partition Count. *** Changable *** max_p_mask equ p_mask_adder\ ;6 bits of unit number +p_mask_adder*2\ +p_mask_adder*4\ +p_mask_adder*8\ +p_mask_adder*16\ +p_mask_adder*32 max_partitions equ max_p_mask\ /p_mask_adder+1 interleave equ 1 max_timeout equ 60*one_min ;**** Changable **** ; ; IMMED Bit is bit 0 of byte 1 in ; the standard SCSI Command for ; Direct-Access Devices. ; That means the high byte because ; of the 65xxx Low -> High structure. ; Kind of confusing! ; immed_loc equ bit_8 ; IMMED Bit Usage ENDIF ;------------------------------------------------------------------------------- IF Type = 1 Then scsi_dtype equ apple_cd block_dvc equ true character_dvc equ false part_suprt equ true ;Supports Partions TRUE/FALSE warm_ss_suprt equ true ;Supports Warm Shutdown/Startups block_size equ $200 cache_blks equ true dibs_2_make equ 4 ;Number of dibs to make if growing max_dvc_cnt equ 100 ;Yes: that's decimal 100 p_mask_adder equ bit_10 ;First Bit of Partition Count. *** Changable *** max_p_mask equ p_mask_adder\ ;6 bits of unit number +p_mask_adder*2\ +p_mask_adder*4\ +p_mask_adder*8\ +p_mask_adder*16\ +p_mask_adder*32 max_partitions equ max_p_mask\ /p_mask_adder+1 interleave equ 0 ;Format not allowed max_timeout equ 60*one_min ;**** Changable **** ; ; IMMED Bit is bit 0 of byte 1 in ; the standard SCSI Command for ; Direct-Access Devices. ; That means the high byte because ; of the 65xxx Low -> High structure. ; Kind of confusing! ; immed_loc equ null ;No IMMED Bit Usage ENDIF ;------------------------------------------------------------------------------- IF block_dvc = character_dvc THEN ; "These two can not be the same!" ENDIF ;------------------------------------------------------------------------------- ; ; Structure Sizes. ; one_page equ $00000100 dib_size equ one_page max_gdvc_buf equ $00000704 max_cmd_len equ 12 ;Yes: that's decimal 12 scsi_duid equ $3C00 ;**** Changable **** claim_dvc equ false ;**** Changable **** warm_cold_flag equ $e101d0 ;word: 0 = cold startup/shutdown ; 1 = warm startup/shutdown ; ; System Service Calls we need. ; ;******************************************************* ; ; ENTRY: move_info via 'jsl' ; ; LONGWORD - Source buffer pointer ; LONGWORD - Destination buffer pointer ; LONGWORD - Transfer length ; WORD - Source buffer pointer ; SP --> ; ; A Reg = Undefined ; X Reg = Undefined ; Y Reg = Undefined ; Bank Reg = Undefined ; Dir Reg = GS/OS Direct Page ; P Reg = N V M X D I Z C E ; x x 0 0 0 x x x 0 ; ; EXIT: move_info via 'rtl' ; ; A Reg = Error Code ; X Reg = Undefined ; Y Reg = Undefined ; Bank Reg = Undefined ; Dir Reg = GS/OS Direct Page ; P Reg = N V M X D I Z C E ; x x 0 0 0 x x 0 0 No Error ; x x 0 0 0 x x 1 0 Error ; ;******************************************************* move_info equ $01fc70 moveblkcmd equ $0800 ;Block Move Option move_sinc_dinc equ $0805 ;Source Inc, Dest Inc move_sinc_ddec equ $0809 ;Source Inc, Dest Dec move_sdec_dinc equ $0806 ;Source Dec, Dest Inc move_sdec_ddec equ $080a ;Source Dec, Dest Dec move_scon_dcon equ $0800 ;Source con, Dest con move_sinc_dcon equ $0801 ;Source Inc, Dest con move_sdec_dcon equ $0802 ;Source Dec, Dest con move_scon_dinc equ $0804 ;Source con, Dest Inc move_scon_ddec equ $0808 ;Source con, Dest Dec ;******************************************************* ; ; ENTRY: set_disksw via 'jsl' ; ; A Reg = Undefined ; X Reg = Undefined ; Y Reg = Undefined ; Bank Reg = Undefined ; Dir Reg = GS/OS Direct Page ; P Reg = N V M X D I Z C E ; x x 0 0 0 x x x 0 ; ; EXIT: set_disksw via 'rtl' ; ; A Reg = Undefined ; X Reg = Undefined ; Y Reg = Undefined ; Bank Reg = Undefined ; Dir Reg = GS/OS Direct Page ; P Reg = N V M X D I Z C E ; x x 0 0 0 x x 0 0 No Error ; ;******************************************************* cache_find_blk equ $01fc04 cache_add_blk equ $01fc08 cache_kil_blk equ $01fc14 cache_del_vol equ $01fc18 set_disksw equ $01fc90 s_dispatch equ $01fca4 install_driver equ $01fca8 ; ; Direct Page Addresses. ; dev_num equ $0000 ;Device Number call_num equ $0002 ;Call Number buff_ptr equ $0004 ;Buffer Pointer rqst_cnt equ $0008 ;Request Count trans_cnt equ $000C ;Transfer Count block_num equ $0010 ;Block Number (Read/Write only) blk_size equ $0014 ;Block Size fst_num equ $0016 ;FST Number (Read/Write only) stat_code equ $0016 ;Status Command Code cont_code equ $0016 ;Control Command Code volume_id equ $0018 ;Volume ID (Read/Write only) cache_prio equ $001A ;Cache Priority Value (Read/Write only) cache_ptr equ $001C ;Cache Pointer (Read/Write only) dib_ptr equ $0020 ;DIB Pointer start_our_zp equ $0030 scsi_mdrvr equ start_our_zp;Main Driver Command Data Ptr goes here. dvc_list equ scsi_mdrvr+4;Get Devices List (Startup Command Only) scsi_zp0 equ dvc_list+4 ;User Defined Direct page scratch pad scsi_zp1 equ scsi_zp0+2 ;User Defined Direct page scratch pad scsi_zp2 equ scsi_zp1+2 ;User Defined Direct page scratch pad scsi_zp3 equ scsi_zp2+2 ;User Defined Direct page scratch pad scsi_zp4 equ scsi_zp3+2 ;User Defined Direct page scratch pad scsi_zp5 equ scsi_zp4+2 ;User Defined Direct page scratch pad scsi_zp6 equ scsi_zp5+2 ;User Defined Direct page scratch pad scsi_zp7 equ scsi_zp6+2 ;User Defined Direct page scratch pad first_dib equ scsi_zp7+2 ;Start of DIB RAM (Startup Command Only) next_dib equ first_dib+4 ;Next DIB to be used (Startup Command Only) last_dib equ next_dib+4 ;Pointer to Default DIB Structure prev_dib equ last_dib+4 ;Pointer to previous DIB in linked list add_dib_here equ prev_dib+4 ;Pointer for DIB walking code rebuild_zp equ add_dib_here+4 ;Reserved for the use of rebuild dib code end_our_zp equ rebuild_zp+4 sib_pointer equ $0074 smgr_pl_ptr equ $0078 ; ; Memory attribute equates ; attrlock equ bit_15 ;Block is locked down. attrfixed equ bit_14 ;Block can't move in mem attrpurg1 equ bit_8 ;Purge level 1 attrpurg2 equ bit_9 ;Purge level 2 attrpurg3 equ bit_8+bit_9 ;Purge level 3 attrnocross equ bit_4 ;May not cross banks attrnospec equ bit_3 ;don't use special mem attrpage equ bit_2 ;Page alligned attraddr equ bit_1 ;Remain at fixed address attrbank equ bit_0 ;Remain in fixed bank ; ; SCSI Command Translation Table Flags ; scsit_tx equ bit_15 ;SCSI Send Data Command scsit_rx equ bit_14 ;SCSI Receive Data Command scsit_stat equ bit_13 ;SCSI Status Command scsit_cont equ bit_12 ;SCSI Control Command scsit_data equ bit_11 ;SCSI Data I/O Command scsit_dvc equ bit_10 ;SCSI Device I/O Command scsit_blk equ bit_9 ;Command has a Block Number scsic_1st equ bit_8 ;Must be first device if linked scsic_int equ bit_7 ;Internal Driver Command only scsic_dsw equ bit_6 ;Issue DISK_SW with this call scsic_off equ bit_5 ;Device is going offline. scsic_tout equ bit_4 ;Adjust time out by block count scsid_asis equ bit_3 ;CMD Data is in SCSI format scsid_blk equ bit_1 ;Convert Trans Count to Blocks scsid_byte equ bit_0 ;Leave Trans Count in Bytes scsid_none equ null ;Transfer count does not go in CMD scsi_endcmd equ null ;End of SCSI Translation Table ; ; Device Characteristics. ; ram_rom_disk equ bit_15 ;RAM or ROM Disk if Set gened_drvr equ bit_14 ;Generated Driver if Set linked_dvc equ bit_13 ;Linked Device if Set call_active equ bit_12 ;Device Busy if Set restartable equ bit_11 ;Restartable from ram if Set mhz_1 equ null ;1 Mhz Device mhz_2_6 equ bit_8 ;2.6 Mhz Device mhz_gt_2_6 equ bit_9 ;>2.6 Mhz Device speed_ind equ bit_8+bit_9 ;Device is speed independent blk_device equ bit_7 ;Block Device if Set write_allow equ bit_6 ;Write is Allowed if Set read_allow equ bit_5 ;Read is Allowed if Set format_allow equ bit_3 ;Format is Allowed if Set removable equ bit_2 ;Removable Media if Set ; ; Device Flags for 'dvcflag'. All ; are considered true if set. ; int_busy equ bit_15 ;Internal busy flag for async wait_mode equ bit_14 ;Driver Wait/No Wait state dvc_online equ bit_13 ;Device Online Flag dvc_switch equ bit_12 ;Device Switched Flag dvc_hardofl equ bit_11 ;Device Hard Offline Flag dvc_hard_sw equ bit_10 ;Device Hard Switch Flag relaxing equ bit_9 ;Device is relaxing (Warm Shutdown) cold_dib equ bit_8 ;Do cold startup regardless of warmstart play_mode equ bit_7 ;In Audio Play Mode if set pdos_part equ bit_6 ;ProDOS Partition if set. ; Bits 0 - 5 are reserved at this time. ; ; Error_Codes. ; no_error equ $0000 bad_dev_number equ $0011 drvr_bad_req equ $0020 drvr_bad_code equ $0021 drvr_bad_parm equ $0022 drvr_not_open equ $0023 drvr_prior_open equ $0024 drvr_io equ $0027 drvr_no_dev equ $0028 drvr_busy equ $0029 drvr_wrt_prot equ $002b drvr_bad_cnt equ $002c drvr_bad_blk equ $002d drvr_dsk_swch equ $002e drvr_off_line equ $002f ;******************************************************* ; ; The following statements are used to define the DIB ; structure. The structure contains the traditional ; DIB followed by an extension used for device ; maintainence. All together each DIB with the ; associated extensions will take one page of RAM. ; ;******************************************************* ; ; $00 ------------------------------------------------ ; | | ; | Device Information Block Data (DIB) | ; $3F | | ; ------------------------------------------------ ; $40 | Physical Block Number | ; | | ; $43 | that maps to logical block zero | ; ------------------------------------------------ ; $44 | | ; | Head Pointer | ; $47 | | ; ------------------------------------------------ ; $48 | | ; | Forward Pointer | ; $4B | | ; ------------------------------------------------ ; $4C | Memory DIB Count | ; ------------------------------------------------ ; $4E | Partition Map Block Number | ; ------------------------------------------------ ; $50 | | ; | Memory Manager Handle for this DIB | ; $53 | | ; ------------------------------------------------ ; $54 | | ; | Block Size (Bytes) | ; $57 | | ; ------------------------------------------------ ; $58 | Max SCSI Command for this Device | ; ------------------------------------------------ ; $5A | | ; | Command Bitmap (See ERS for description) | ; $79 | | ; ------------------------------------------------ ; $7A | SCSI Command Data | ; | and | ; $D9 | SCSI Manager Call Buffer Structures | ; ------------------------------------------------ ; $DA | 'Busy' and other Flags | ; ------------------------------------------------ ; $DC | | ; | Completion Vector with Code | ; $FF | | ; ------------------------------------------------ ; ;******************************************************* dib RECORD $0000 ; ; Definition of DIB Structure. ; linkptr ds.l 1 ; DIB Link Pointer (LONG) entry ds.l 1 ; Pointer to Drvrs Main Entry (LONG) dvcchar ds.w 1 ; Device Characteristics (WORD) blkcnt ds.l 1 ; Block Count for this device (LONG) namelen ds.b 1 ; Length of Descriptive Name (PSTR) disname ds.b 31 ; Field for this devices Name (STR) slotnum ds.w 1 ; Device Slot Number from MGR. (WORD) unitnum ds.w 1 ; Device Unit Number from MGR. (WORD) versnum ds.w 1 ; Version Number for our Driver (WORD) dvcid ds.w 1 ; ID of Device we talk to (WORD) headlnk ds.w 1 ; Head Device Link (WORD) fdvclnk ds.w 1 ; Forward Device Link (WORD) ext_ptr ds.l 1 ; Pointer to DIB Extension (LONG) devnum ds.w 1 ; DIB Device Number (WORD) ; ; The Starting Block Number for this device ; is maintained here. This is used to ; modify the requested block number from ; a logical to a physical number. ; start_blk ds.l 1 ; Starting Physical Block Num. (LONG) ; ; These two pointers are the compliment ; to the links in the standard DIB and ; will point to the actual DIB referenced ; in the Head and Forward Device Links. ; headptr ds.l 1 ; Head Dvc Pointer (LONG) fdvcptr ds.l 1 ; Forward Dvc Pointer (LONG) mem_dib_cnt ds.w 1 ; Number of active dibs in mem (WORD) part_blk ds.w 1 ; Block containing partition (WORD) ; ; Memory Manager Handle ; handle ds.l 1 ; (LONG) ; ; Block Size ; blksize ds.l 1 ; (LONG) ; ; Maximum SCSI Command supported by ; the device for this DIB. ; maxcmd ds.w 1 ; (WORD) ; ; SCSI Command Group Bitmaps ; group0 ds.l 1 ; Group 0 (LONG) group1 ds.l 1 ; Group 1 (LONG) group2 ds.l 1 ; Group 2 (LONG) group3 ds.l 1 ; Group 3 (LONG) group4 ds.l 1 ; Group 4 (LONG) group5 ds.l 1 ; Group 5 (LONG) group6 ds.l 1 ; Group 6 (LONG) group7 ds.l 1 ; Group 7 (LONG) ; ; SCSI Manager Call PList ; scsi_slot ds.w 1 ; Same as our Slot Number (WORD) scsiid ds.w 1 ; Same as our Unit Number (WORD) version ds.w 1 ; Version of call issued (WORD) scsic_flgs ds.w 1 ; Flags from Command Table (WORD) time_out ds.w 1 ; Time Out Factor * xxx ms (WORD) compvec ds.l 1 ; Completion Routine Pointer (LONG) cp_ptr ds.l 1 ; Pointer to Command Packet (LONG) trx_ptr ds.l 1 ; Ptr to Send/R'cv Structure (LONG) trx_len trx_rqst ds.l 1 ; Users Send/R'cv Length (LONG) rslt_ptr ds.l 1 ; Pointer to Status Structure (LONG) ds.l 1 ; Reserved space 0 (LONG) ds.l 1 ; Reserved space 1 (LONG) ; ; SCSI Command Packet ; scsicmd ds.b 12 ; Room for any SCSI Command (BYTES) ; ; SCSI Manager Device Send/R'cv Buffers List ; trx_buff ds.l 1 ; Users Send Buffer (LONG) trx_length ds.l 1 ; Request cnt for this buffer (LONG) trx_offset ds.l 1 ; Offset for next pass (LONG) trx_null ds.l 1 ; Null (LONG) trx_stop ds.l 1 ; Null (LONG) ds.l 1 ; Null (LONG) ds.l 1 ; Null (LONG) ds.l 1 ; Null (LONG) trx_rsrv ds.l 4 ; Reserved Space * 4 for future (LONG) ; ; Device Busy and other Flags and results ; dvcflag ds.w 1 ; Device Busy and other Flags (WORD) ; ; Completion Routine for this DIB. ; This takes the remaining space in ; the allocated RAM. Any routine can ; be placed here but must never go ; beyond offset $FF ; end equ * complet ds.b $100-end ENDR pm RECORD $0000 ; ; All Values given below are ; in Macintosh High >> Low ; format. ; Sig ds.w 1 ;Signature Always $504d ; Apple II = $4d50 SigPad ds.w 1 ;Reserved for future use MapBlkCnt ds.l 1 ;Number of blocks in Map PyPartStart ds.l 1 ;First Physical Block of Partition PartBlkCnt ds.l 1 ;Number of Blocks in Partition PartName ds.b 32 ;Partition Name PartType ds.b 32 ;Partition Type LgDataStart ds.l 1 ;1st Logical Data Block DataCnt ds.l 1 ;Number of data blocks PartStatus ds.l 1 ;Partition Status Info LgBootStart ds.l 1 ;1st Logical Boot Block BootSize ds.l 1 ;Size of Boot Code in Bytes BootLoad ds.l 1 ;Boot Code Load Address BootLoad2 ds.l 1 ;Additional Boot Load Info BootEntry ds.l 1 ;Boot Code Entry Point BootEntry2 ds.l 1 ;Additional Boot Entry Info BootCksum ds.l 1 ;Boot Code Checksum Processor ds.b 16 ;Processor Type Args ds.b 128 ;Boot Specific Arguments end equ * ds.b $200-end ;Pad to 1 Block ENDR ; ; Structure of data from Read Capacity Call ; block RECORD $0000 count ds.l 1 ;Block Count High >> Low size ds.l 1 ;Block Size High >> Low ENDR ; ; Structure of data from Mode Sense Call ; mode RECORD $0000 sense_len ds.b 1 ;Sense Data Length med_type ds.b 1 ;Medium Type w_protect ds.b 1 ;Write Protect bit 7 blk_disc ds.b 1 ;Block Descriptor Length ds.b 1 ;Unused data blocks ds.b 3 ;Block Count High >> Low ds.b 1 ;Unused data blk_size ds.b 3 ;Block Size High >> Low page_number ds.b 1 ;Page number of mode sense data length ds.b 1 ;Length of data that follows ENDR ; ; Structure of data from Request Sense Call ; rqst_sens RECORD $0000 error_code ds.b 1 ;Bit 7 = Valid Flag ;Bits 0-6 = Error Code segment ds.b 1 ; = Segment Number sense_key ds.b 1 ;Bit 7 = Filemark bit ;Bit 6 = EOM bit ;Bit 5 = ILI bit ;Bit 4 = Reserved ;Bits 0-3 = Sense Key info_bytes ds.b 4 ; = Information Bytes addnl_sens_len ds.b 1 ; = Additional Sense Length (n-7) command_spec ds.b 4 ; = Command Specific Information addnl_sens_code ds.b 1 ; = Additional Sense Code addnl_code_qual ds.b 1 ; = Additional Sense Code Qualifier ENDR ; ; Structure of data from Inquiry Call ; inq RECORD $0000 pd_type ds.b 1 ;Peripheral Device Type removable ds.b 1 ;Removable bit 7 ds.b $26-2 ;Unused data group ds.b 1 ;First Group Number ENDR ; ; Structure of data from GET DATA STATUS Call ; gds RECORD $0000 ds.b 2 ;reserved data_len ds.b 1 ;Amount of data returned by this call block ds.b 1 ;bit 0 winw_id ds.b 1 ;Window Identifier ds.b 1 ;reserved buf_avail ds.b 3 ;Amount of available Scanner Buffer Space data_avail ds.b 3 ;Amount of Available Scan Data ENDR ; ; Structure of data from Device Specific Calls ; ds RECORD $0000 version ds.w 1 ;Version Number of this structure ds.b 12 ;Command Bytes DCcode ds.l 1 ;1st DC Code DCcount ds.l 1 ;1st Count DCoffset ds.l 1 ;1st Offset DCreserved ds.l 1 ;1st Reserved ENDR EJECT