1 /* $NetBSD: iris_scsivar.h,v 1.1 2019/01/12 16:44:47 tsutsui Exp $ */ 2 3 /* 4 * Copyright (c) 2018 Naruaki Etomi 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 /* 29 * Silicon Graphics "IRIS" series MIPS processors machine bootloader. 30 * WD33C93 SCSI interface parameter description. 31 */ 32 33 #ifndef _SCSIVAR_H_ 34 #define _SCSIVAR_H_ 35 36 #define SBIC_MAX_MSGLEN 8 37 #define SBIC_ABORT_TIMEOUT 2000 /* time to wait for abort */ 38 39 /* 40 * SCSI delays 41 * In u-seconds, primarily for state changes on the SPC. 42 */ 43 #define SBIC_CMD_WAIT 50000 /* wait per step of 'immediate' cmds */ 44 #define SBIC_DATA_WAIT 50000 /* wait per data in/out step */ 45 #define SBIC_INIT_WAIT 50000 /* wait per step (both) during init */ 46 47 #define NSCSI 1 48 #define SCSI_LUN 0 49 #define SCSI_CLKFREQ 20 50 51 struct wd33c93_softc { 52 volatile uint8_t *sc_asr_regh; /* address register */ 53 volatile uint8_t *sc_data_regh; /* data register */ 54 uint8_t sc_target; /* Currently active target */ 55 uint8_t sc_syncperiods; /* Sync transfer periods (4ns units) */ 56 u_short sc_state; 57 u_short sc_status; 58 int sc_flags; 59 uint8_t sc_imsg[SBIC_MAX_MSGLEN]; 60 uint8_t sc_omsg[SBIC_MAX_MSGLEN]; 61 volatile int xs_status; /* status flags */ 62 }; 63 64 struct wd33c93_softc wd33c93_softc[NSCSI]; 65 66 extern uint8_t scsi_ctlr, scsi_id, scsi_part; 67 68 /* values for sc_flags */ 69 #define SBICF_SELECTED 0x01 /* bus is in selected state. */ 70 #define SBICF_NODMA 0x02 /* Polled transfer */ 71 #define SBICF_INDMA 0x04 /* DMA I/O in progress */ 72 #define SBICF_SYNCNEGO 0x08 /* Sync negotiation in progress */ 73 #define SBICF_ABORTING 0x10 /* Aborting */ 74 75 /* values for sc_state */ 76 #define SBIC_UNINITIALIZED 0 /* Driver not initialized */ 77 #define SBIC_IDLE 1 /* waiting for something to do */ 78 #define SBIC_SELECTING 2 /* SCSI command is arbiting */ 79 #define SBIC_RESELECTED 3 /* Has been reselected */ 80 #define SBIC_IDENTIFIED 4 /* Has gotten IFY but not TAG */ 81 #define SBIC_CONNECTED 5 /* Actively using the SCSI bus */ 82 #define SBIC_DISCONNECT 6 /* MSG_DISCONNECT received */ 83 #define SBIC_CMDCOMPLETE 7 /* MSG_CMDCOMPLETE received */ 84 #define SBIC_ERROR 8 /* Error has occurred */ 85 #define SBIC_SELTIMEOUT 9 /* Select Timeout */ 86 #define SBIC_CLEANING 10 /* Scrubbing ACB's */ 87 #define SBIC_BUSRESET 11 /* SCSI RST has been issued */ 88 89 /* values for sc_msgout */ 90 #define SEND_DEV_RESET 0x0001 91 #define SEND_PARITY_ERROR 0x0002 92 #define SEND_INIT_DET_ERR 0x0004 93 #define SEND_REJECT 0x0008 94 #define SEND_IDENTIFY 0x0010 95 #define SEND_ABORT 0x0020 96 #define SEND_WDTR 0x0040 97 #define SEND_SDTR 0x0080 98 #define SEND_TAG 0x0100 99 100 #define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */ 101 102 /* 103 * States returned by our state machine 104 */ 105 #define SBIC_STATE_ERROR -1 106 #define SBIC_STATE_DONE 0 107 #define SBIC_STATE_RUNNING 1 108 #define SBIC_STATE_DISCONNECT 2 109 110 #define DEBUG_ACBS 0x01 111 #define DEBUG_INTS 0x02 112 #define DEBUG_CMDS 0x04 113 #define DEBUG_MISC 0x08 114 #define DEBUG_TRAC 0x10 115 #define DEBUG_RSEL 0x20 116 #define DEBUG_PHASE 0x40 117 #define DEBUG_DMA 0x80 118 #define DEBUG_CCMDS 0x100 119 #define DEBUG_MSGS 0x200 120 #define DEBUG_TAGS 0x400 121 #define DEBUG_SYNC 0x800 122 123 #endif /* _SCSIVAR_H_ */ 124