Home | History | Annotate | Line # | Download | only in isa
wdsreg.h revision 1.5.54.1
      1       1.5    perry /*	$NetBSD: wdsreg.h,v 1.5.54.1 2005/04/02 21:58:56 he Exp $	*/
      2       1.5    perry 
      3       1.1  mycroft typedef u_char physaddr[3];
      4       1.1  mycroft typedef u_char physlen[3];
      5       1.1  mycroft #define	ltophys	_lto3b
      6       1.1  mycroft #define	phystol	_3btol
      7       1.1  mycroft 
      8       1.1  mycroft /* WD7000 registers */
      9       1.1  mycroft #define WDS_STAT		0	/* read */
     10       1.1  mycroft #define WDS_IRQSTAT		1	/* read */
     11       1.1  mycroft 
     12       1.1  mycroft #define WDS_CMD			0	/* write */
     13       1.1  mycroft #define WDS_IRQACK		1	/* write */
     14       1.1  mycroft #define WDS_HCR			2	/* write */
     15       1.1  mycroft 
     16       1.1  mycroft /* WDS_STAT (read) defs */
     17       1.1  mycroft #define WDSS_IRQ		0x80
     18       1.1  mycroft #define WDSS_RDY		0x40
     19       1.1  mycroft #define WDSS_REJ		0x20
     20       1.1  mycroft #define WDSS_INIT		0x10
     21       1.1  mycroft 
     22       1.1  mycroft /* WDS_IRQSTAT (read) defs */
     23       1.1  mycroft #define WDSI_MASK		0xc0
     24       1.1  mycroft #define WDSI_ERR		0x00
     25       1.1  mycroft #define WDSI_MFREE		0x80
     26       1.1  mycroft #define WDSI_MSVC		0xc0
     27       1.1  mycroft 
     28       1.1  mycroft /* WDS_CMD (write) defs */
     29       1.1  mycroft #define WDSC_NOOP		0x00
     30       1.1  mycroft #define WDSC_INIT		0x01
     31       1.1  mycroft #define WDSC_DISUNSOL		0x02
     32       1.1  mycroft #define WDSC_ENAUNSOL		0x03
     33       1.1  mycroft #define WDSC_IRQMFREE		0x04
     34       1.1  mycroft #define WDSC_SCSIRESETSOFT	0x05
     35       1.1  mycroft #define WDSC_SCSIRESETHARD	0x06
     36       1.1  mycroft #define WDSC_MSTART(m)		(0x80 + (m))
     37       1.1  mycroft #define WDSC_MMSTART(m)		(0xc0 + (m))
     38       1.1  mycroft 
     39       1.1  mycroft /* WDS_HCR (write) defs */
     40       1.1  mycroft #define WDSH_IRQEN		0x08
     41       1.1  mycroft #define WDSH_DRQEN		0x04
     42       1.1  mycroft #define WDSH_SCSIRESET		0x02
     43       1.1  mycroft #define WDSH_ASCRESET		0x01
     44       1.1  mycroft 
     45       1.1  mycroft #define WDS_NSEG	17
     46       1.1  mycroft 
     47       1.1  mycroft struct wds_scat_gath {
     48       1.1  mycroft 	physlen seg_len;
     49       1.1  mycroft 	physaddr seg_addr;
     50       1.1  mycroft };
     51       1.1  mycroft 
     52       1.1  mycroft struct wds_cmd {
     53       1.1  mycroft 	u_char opcode;
     54       1.1  mycroft 	u_char targ;
     55  1.5.54.1       he 	u_char scb[12];
     56       1.1  mycroft 	u_char stat;
     57       1.1  mycroft 	u_char venderr;
     58       1.1  mycroft 	physlen len;
     59       1.1  mycroft 	physaddr data;
     60       1.1  mycroft 	physaddr link;
     61       1.1  mycroft 	u_char write;
     62       1.1  mycroft 	u_char xx[6];
     63       1.1  mycroft };
     64       1.1  mycroft 
     65       1.1  mycroft struct wds_scb {
     66       1.1  mycroft 	struct wds_cmd cmd;
     67       1.1  mycroft 	struct wds_cmd sense;
     68       1.1  mycroft 
     69       1.1  mycroft 	struct wds_scat_gath scat_gath[WDS_NSEG];
     70       1.2   bouyer 	struct scsipi_sense_data sense_data;
     71       1.1  mycroft 
     72       1.1  mycroft 	TAILQ_ENTRY(wds_scb) chain;
     73       1.1  mycroft 	struct wds_scb *nexthash;
     74       1.4  mycroft 	u_long hashkey;
     75       1.2   bouyer 	struct scsipi_xfer *xs;
     76       1.1  mycroft 	int flags;
     77       1.1  mycroft #define	SCB_ALLOC	0x01
     78       1.1  mycroft #define	SCB_ABORT	0x02
     79       1.1  mycroft #ifdef WDSDIAG
     80       1.1  mycroft #define	SCB_SENDING	0x04
     81       1.1  mycroft #endif
     82       1.1  mycroft #define	SCB_POLLED	0x08
     83       1.1  mycroft #define	SCB_SENSE	0x10
     84       1.1  mycroft #define	SCB_DONE	0x20	/* for internal commands only */
     85       1.1  mycroft #define	SCB_BUFFER	0x40
     86       1.1  mycroft 	int timeout;
     87       1.1  mycroft 
     88       1.3  thorpej 	/*
     89       1.3  thorpej 	 * DMA maps used by the SCB.  These maps are created in
     90       1.3  thorpej 	 * wds_init_scb().
     91       1.3  thorpej 	 */
     92       1.3  thorpej 
     93       1.3  thorpej 	/*
     94       1.3  thorpej 	 * The DMA map maps an individual SCB.  This map is permanently
     95       1.3  thorpej 	 * loaded in wds_init_scb().
     96       1.3  thorpej 	 */
     97       1.3  thorpej 	bus_dmamap_t	dmamap_self;
     98       1.3  thorpej 
     99       1.3  thorpej 	/*
    100       1.3  thorpej 	 * This map maps the buffer involved in the transfer.
    101       1.3  thorpej 	 * Its contents are loaded into "scat_gath" above.
    102       1.3  thorpej 	 */
    103       1.3  thorpej 	bus_dmamap_t	dmamap_xfer;
    104       1.1  mycroft };
    105       1.1  mycroft 
    106       1.1  mycroft #define WDSX_SCSICMD		0x00
    107       1.1  mycroft #define WDSX_SCSISG		0x01
    108       1.1  mycroft #define WDSX_OPEN_RCVBUF	0x80
    109       1.1  mycroft #define WDSX_RCV_CMD		0x81
    110       1.1  mycroft #define WDSX_RCV_DATA		0x82
    111       1.1  mycroft #define WDSX_RCV_DATASTAT	0x83
    112       1.1  mycroft #define WDSX_SND_DATA		0x84
    113       1.1  mycroft #define WDSX_SND_DATASTAT	0x85
    114       1.1  mycroft #define WDSX_SND_CMDSTAT	0x86
    115       1.1  mycroft #define WDSX_READINIT		0x88
    116       1.1  mycroft #define WDSX_READSCSIID		0x89
    117       1.1  mycroft #define WDSX_SETUNSOLIRQMASK	0x8a
    118       1.1  mycroft #define WDSX_GETUNSOLIRQMASK	0x8b
    119       1.1  mycroft #define WDSX_GETFIRMREV		0x8c
    120       1.1  mycroft #define WDSX_EXECDIAG		0x8d
    121       1.1  mycroft #define WDSX_SETEXECPARM	0x8e
    122       1.1  mycroft #define WDSX_GETEXECPARM	0x8f
    123       1.1  mycroft 
    124       1.1  mycroft struct wds_mbx_out {
    125       1.1  mycroft 	u_char cmd;
    126       1.1  mycroft 	physaddr scb_addr;
    127       1.1  mycroft };
    128       1.1  mycroft 
    129       1.1  mycroft struct wds_mbx_in {
    130       1.1  mycroft 	u_char stat;
    131       1.1  mycroft 	physaddr scb_addr;
    132       1.1  mycroft };
    133       1.1  mycroft 
    134       1.1  mycroft /*
    135       1.1  mycroft  * mbo.cmd values
    136       1.1  mycroft  */
    137       1.1  mycroft #define	WDS_MBO_FREE		0x0	/* MBO entry is free */
    138       1.1  mycroft #define	WDS_MBO_START		0x1	/* MBO activate entry */
    139       1.1  mycroft 
    140       1.1  mycroft /*
    141       1.1  mycroft  * mbi.stat values
    142       1.1  mycroft  */
    143       1.1  mycroft #define	WDS_MBI_FREE		0x00	/* MBI entry is free */
    144       1.1  mycroft #define WDS_MBI_OK		0x01	/* completed without error */
    145       1.1  mycroft #define WDS_MBI_OKERR		0x02	/* completed with error */
    146       1.1  mycroft #define WDS_MBI_ETIME		0x04
    147       1.1  mycroft #define WDS_MBI_ERESET		0x05
    148       1.1  mycroft #define WDS_MBI_ETARCMD		0x06
    149       1.1  mycroft #define WDS_MBI_ERESEL		0x80
    150       1.1  mycroft #define WDS_MBI_ESEL		0x81
    151       1.1  mycroft #define WDS_MBI_EABORT		0x82
    152       1.1  mycroft #define WDS_MBI_ESRESET		0x83
    153       1.1  mycroft #define WDS_MBI_EHRESET		0x84
    154       1.1  mycroft 
    155       1.1  mycroft struct wds_setup {
    156       1.1  mycroft 	u_char opcode;
    157       1.1  mycroft 	u_char scsi_id;
    158       1.1  mycroft 	u_char buson_t;
    159       1.1  mycroft 	u_char busoff_t;
    160       1.1  mycroft 	u_char xx;
    161       1.1  mycroft 	physaddr mbaddr;
    162       1.1  mycroft 	u_char nomb;
    163       1.1  mycroft 	u_char nimb;
    164       1.1  mycroft };
    165