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