xref: /csrg-svn/sys/pmax/dev/siireg.h (revision 63207)
152130Smckusick /*
2*63207Sbostic  * Copyright (c) 1992, 1993
3*63207Sbostic  *	The Regents of the University of California.  All rights reserved.
452130Smckusick  *
552130Smckusick  * This code is derived from software contributed to Berkeley by
652130Smckusick  * Ralph Campbell.
752130Smckusick  *
852130Smckusick  * %sccs.include.redist.c%
952130Smckusick  *
10*63207Sbostic  *	@(#)siireg.h	8.1 (Berkeley) 06/10/93
1152130Smckusick  *
1252130Smckusick  * sii.h --
1352130Smckusick  *
1452130Smckusick  * 	SII registers.
1552130Smckusick  *
1652130Smckusick  *	Copyright (C) 1989 Digital Equipment Corporation.
1752130Smckusick  *	Permission to use, copy, modify, and distribute this software and
1852130Smckusick  *	its documentation for any purpose and without fee is hereby granted,
1952130Smckusick  *	provided that the above copyright notice appears in all copies.
2052130Smckusick  *	Digital Equipment Corporation makes no representations about the
2152130Smckusick  *	suitability of this software for any purpose.  It is provided "as is"
2252130Smckusick  *	without express or implied warranty.
2352130Smckusick  *
2452130Smckusick  * from: $Header: /sprite/src/kernel/dev/ds3100.md/RCS/sii.h,
2552130Smckusick  *	v 1.2 89/08/15 19:53:04 rab Exp $ SPRITE (DECWRL)
2652130Smckusick  */
2752130Smckusick 
2852130Smckusick #ifndef _SII
2952130Smckusick #define _SII
3052130Smckusick 
3152130Smckusick /*
3252130Smckusick  * SII hardware registers
3352130Smckusick  */
3452130Smckusick typedef volatile struct {
3552130Smckusick 	u_short	sdb;		/* SCSI Data Bus and Parity */
3652130Smckusick 	u_short	pad0;
3752130Smckusick 	u_short	sc1;		/* SCSI Control Signals One */
3852130Smckusick 	u_short	pad1;
3952130Smckusick 	u_short	sc2;		/* SCSI Control Signals Two */
4052130Smckusick 	u_short	pad2;
4152130Smckusick 	u_short	csr;		/* Control/Status register */
4252130Smckusick 	u_short	pad3;
4352130Smckusick 	u_short	id;		/* Bus ID register */
4452130Smckusick 	u_short	pad4;
4552130Smckusick 	u_short	slcsr;		/* Select Control and Status Register */
4652130Smckusick 	u_short	pad5;
4752130Smckusick 	u_short	destat;		/* Selection Detector Status Register */
4852130Smckusick 	u_short	pad6;
4952130Smckusick 	u_short	dstmo;		/* DSSI Timeout Register */
5052130Smckusick 	u_short	pad7;
5152130Smckusick 	u_short	data;		/* Data Register */
5252130Smckusick 	u_short	pad8;
5352130Smckusick 	u_short	dmctrl;		/* DMA Control Register */
5452130Smckusick 	u_short	pad9;
5552130Smckusick 	u_short	dmlotc;		/* DMA Length of Transfer Counter */
5652130Smckusick 	u_short	pad10;
5752130Smckusick 	u_short	dmaddrl;	/* DMA Address Register Low */
5852130Smckusick 	u_short	pad11;
5952130Smckusick 	u_short	dmaddrh;	/* DMA Address Register High */
6052130Smckusick 	u_short	pad12;
6152130Smckusick 	u_short	dmabyte;	/* DMA Initial Byte Register */
6252130Smckusick 	u_short	pad13;
6352130Smckusick 	u_short	stlp;		/* DSSI Short Target List Pointer */
6452130Smckusick 	u_short	pad14;
6552130Smckusick 	u_short	ltlp;		/* DSSI Long Target List Pointer */
6652130Smckusick 	u_short	pad15;
6752130Smckusick 	u_short	ilp;		/* DSSI Initiator List Pointer */
6852130Smckusick 	u_short	pad16;
6952130Smckusick 	u_short	dsctrl;		/* DSSI Control Register */
7052130Smckusick 	u_short	pad17;
7152130Smckusick 	u_short	cstat;		/* Connection Status Register */
7252130Smckusick 	u_short	pad18;
7352130Smckusick 	u_short	dstat;		/* Data Transfer Status Register */
7452130Smckusick 	u_short	pad19;
7552130Smckusick 	u_short	comm;		/* Command Register */
7652130Smckusick 	u_short	pad20;
7752130Smckusick 	u_short	dictrl;		/* Diagnostic Control Register */
7852130Smckusick 	u_short	pad21;
7952130Smckusick 	u_short	clock;		/* Diagnostic Clock Register */
8052130Smckusick 	u_short	pad22;
8152130Smckusick 	u_short	bhdiag;		/* Bus Handler Diagnostic Register */
8252130Smckusick 	u_short	pad23;
8352130Smckusick 	u_short	sidiag;		/* SCSI IO Diagnostic Register */
8452130Smckusick 	u_short	pad24;
8552130Smckusick 	u_short	dmdiag;		/* Data Mover Diagnostic Register */
8652130Smckusick 	u_short	pad25;
8752130Smckusick 	u_short	mcdiag;		/* Main Control Diagnostic Register */
8852130Smckusick 	u_short	pad26;
8952130Smckusick } SIIRegs;
9052130Smckusick 
9152130Smckusick /*
9252130Smckusick  * SC1 - SCSI Control Signals One
9352130Smckusick  */
9452130Smckusick #define SII_SC1_MSK	0x1ff		/* All possible signals on the bus */
9552130Smckusick #define SII_SC1_SEL	0x80		/* SCSI SEL signal active on bus */
9652130Smckusick #define SII_SC1_ATN	0x08		/* SCSI ATN signal active on bus */
9752130Smckusick 
9852130Smckusick /*
9952130Smckusick  * SC2 - SCSI Control Signals Two
10052130Smckusick  */
10152130Smckusick #define SII_SC2_IGS	0x8		/* SCSI drivers for initiator mode */
10252130Smckusick 
10352130Smckusick /*
10452130Smckusick  * CSR - Control/Status Register
10552130Smckusick  */
10652130Smckusick #define SII_HPM	0x10			/* SII in on an arbitrated SCSI bus */
10752130Smckusick #define	SII_RSE	0x08			/* 1 = respond to reselections */
10852130Smckusick #define SII_SLE	0x04			/* 1 = respond to selections */
10952130Smckusick #define SII_PCE	0x02			/* 1 = report parity errors */
11052130Smckusick #define SII_IE	0x01			/* 1 = enable interrupts */
11152130Smckusick 
11252130Smckusick /*
11352130Smckusick  * ID - Bus ID Register
11452130Smckusick  */
11552130Smckusick #define SII_ID_IO	0x8000		/* I/O */
11652130Smckusick 
11752130Smckusick /*
11852130Smckusick  * DESTAT - Selection Detector Status Register
11952130Smckusick  */
12052130Smckusick #define SII_IDMSK	0x7		/* ID of target reselected the SII */
12152130Smckusick 
12252130Smckusick /*
12352130Smckusick  * DMCTRL - DMA Control Register
12452130Smckusick  */
12552130Smckusick #define SII_ASYNC	0x00		/* REQ/ACK Offset for async mode */
12652130Smckusick #define SII_SYNC	0x03		/* REQ/ACK Offset for sync mode */
12752130Smckusick 
12852130Smckusick /*
12952130Smckusick  * DMLOTC - DMA Length Of Transfer Counter
13052130Smckusick  */
13152130Smckusick #define SII_TCMSK	0x1fff		/* transfer count mask */
13252130Smckusick 
13352130Smckusick /*
13452130Smckusick  * CSTAT - Connection Status Register
13552130Smckusick  */
13652130Smckusick #define	SII_CI		0x8000	/* composite interrupt bit for CSTAT */
13752130Smckusick #define SII_DI		0x4000	/* composite interrupt bit for DSTAT */
13852130Smckusick #define SII_RST		0x2000	/* 1 if reset is asserted on SCSI bus */
13952130Smckusick #define	SII_BER		0x1000	/* Bus error */
14052130Smckusick #define	SII_OBC		0x0800	/* Out_en Bit Cleared (DSSI mode) */
14152130Smckusick #define SII_TZ		0x0400	/* Target pointer Zero (STLP or LTLP is zero) */
14252130Smckusick #define	SII_BUF		0x0200	/* Buffer service - outbound pkt to non-DSSI */
14352130Smckusick #define SII_LDN		0x0100	/* List element Done */
14452130Smckusick #define SII_SCH		0x0080	/* State Change */
14552130Smckusick #define SII_CON		0x0040	/* SII is Connected to another device */
14652130Smckusick #define SII_DST		0x0020	/* SII was Destination of current transfer */
14752130Smckusick #define SII_TGT		0x0010	/* SII is operating as a Target */
14852130Smckusick #define SII_STATE_MSK	0x0070	/* State Mask */
14952130Smckusick #define SII_SWA		0x0008	/* Selected With Attention */
15052130Smckusick #define SII_SIP		0x0004	/* Selection In Progress */
15152130Smckusick #define SII_LST		0x0002	/* Lost arbitration */
15252130Smckusick 
15352130Smckusick /*
15452130Smckusick  * DSTAT - Data Transfer Status Register
15552130Smckusick  */
15652130Smckusick #define SII_DNE		0x2000	/* DMA transfer Done */
15752130Smckusick #define SII_TCZ		0x1000	/* Transfer Count register is Zero */
15852130Smckusick #define SII_TBE		0x0800	/* Transmit Buffer Empty */
15952130Smckusick #define SII_IBF		0x0400	/* Input Buffer Full */
16052130Smckusick #define SII_IPE		0x0200	/* Incoming Parity Error */
16152130Smckusick #define SII_OBB		0x0100	/* Odd Byte Boundry */
16252130Smckusick #define SII_MIS		0x0010	/* Phase Mismatch */
16352130Smckusick #define SII_ATN		0x0008	/* ATN set by initiator if in Target mode */
16452130Smckusick #define SII_MSG		0x0004	/* current bus state of MSG */
16552130Smckusick #define SII_CD		0x0002	/* current bus state of C/D */
16652130Smckusick #define SII_IO		0x0001	/* current bus state of I/O */
16752130Smckusick #define SII_PHASE_MSK	0x0007	/* Phase Mask */
16852130Smckusick 
16952130Smckusick /*
17052130Smckusick  * The different phases.
17152130Smckusick  */
17252130Smckusick #define SII_MSG_IN_PHASE	0x7
17352130Smckusick #define SII_MSG_OUT_PHASE	0x6
17452130Smckusick #define SII_STATUS_PHASE	0x3
17552130Smckusick #define SII_CMD_PHASE		0x2
17652130Smckusick #define SII_DATA_IN_PHASE	0x1
17752130Smckusick #define SII_DATA_OUT_PHASE	0x0
17852130Smckusick 
17952130Smckusick /*
18052130Smckusick  * COMM - Command Register
18152130Smckusick  */
18252130Smckusick #define	SII_DMA		0x8000	/* DMA mode */
18352130Smckusick #define SII_DO_RST	0x4000	/* Assert reset on SCSI bus for 25 usecs */
18452130Smckusick #define SII_RSL		0x1000	/* 0 = select, 1 = reselect desired device */
18552130Smckusick 
18652130Smckusick /* Commands: I - Initiator, T - Target, D - Disconnected */
18752130Smckusick #define SII_INXFER	0x0800	/* Information Transfer command	(I,T) */
18852130Smckusick #define SII_SELECT	0x0400	/* Select command		(D) */
18952130Smckusick #define SII_REQDATA	0x0200	/* Request Data command		(T) */
19052130Smckusick #define	SII_DISCON	0x0100	/* Disconnect command		(I,T,D) */
19152130Smckusick #define SII_CHRESET	0x0080	/* Chip Reset command		(I,T,D) */
19252130Smckusick 
19352130Smckusick /* Command state bits same as connection status register */
19452130Smckusick /* Command phase bits same as data transfer status register */
19552130Smckusick 
19652130Smckusick /*
19752130Smckusick  * DICTRL - Diagnostic Control Register
19852130Smckusick  */
19952130Smckusick #define SII_PRE		0x4	/* Enable the SII to drive the SCSI bus */
20052130Smckusick 
20152130Smckusick #define SII_WAIT_COUNT		10000	/* Delay count used for the SII chip */
20252130Smckusick /*
20352130Smckusick  * Max DMA transfer length for SII
20452130Smckusick  * The SII chip only has a 13 bit counter. If 8192 is used as the max count,
20552130Smckusick  * you can't tell the difference between a count of zero and 8192.
20652130Smckusick  * 8190 is used instead of 8191 so the count is even.
20752130Smckusick  */
20852130Smckusick #define SII_MAX_DMA_XFER_LENGTH	8192
20952130Smckusick 
21052130Smckusick #endif /* _SII */
211