162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/************************************************************************/
362306a36Sopenharmony_ci/*									*/
462306a36Sopenharmony_ci/*	dc395x.h							*/
562306a36Sopenharmony_ci/*									*/
662306a36Sopenharmony_ci/*	Device Driver for Tekram DC395(U/UW/F), DC315(U)		*/
762306a36Sopenharmony_ci/*	PCI SCSI Bus Master Host Adapter				*/
862306a36Sopenharmony_ci/*	(SCSI chip set used Tekram ASIC TRM-S1040)			*/
962306a36Sopenharmony_ci/*									*/
1062306a36Sopenharmony_ci/************************************************************************/
1162306a36Sopenharmony_ci#ifndef DC395x_H
1262306a36Sopenharmony_ci#define DC395x_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/************************************************************************/
1562306a36Sopenharmony_ci/*									*/
1662306a36Sopenharmony_ci/*	Initial values							*/
1762306a36Sopenharmony_ci/*									*/
1862306a36Sopenharmony_ci/************************************************************************/
1962306a36Sopenharmony_ci#define DC395x_MAX_CMD_QUEUE		32
2062306a36Sopenharmony_ci/* #define DC395x_MAX_QTAGS		32 */
2162306a36Sopenharmony_ci#define DC395x_MAX_QTAGS		16
2262306a36Sopenharmony_ci#define DC395x_MAX_SCSI_ID		16
2362306a36Sopenharmony_ci#define DC395x_MAX_CMD_PER_LUN		DC395x_MAX_QTAGS
2462306a36Sopenharmony_ci#define DC395x_MAX_SG_TABLESIZE		64	/* HW limitation			*/
2562306a36Sopenharmony_ci#define DC395x_MAX_SG_LISTENTRY		64	/* Must be equal or lower to previous	*/
2662306a36Sopenharmony_ci						/* item					*/
2762306a36Sopenharmony_ci#define DC395x_MAX_SRB_CNT		63
2862306a36Sopenharmony_ci/* #define DC395x_MAX_CAN_QUEUE		7 * DC395x_MAX_QTAGS */
2962306a36Sopenharmony_ci#define DC395x_MAX_CAN_QUEUE		DC395x_MAX_SRB_CNT
3062306a36Sopenharmony_ci#define DC395x_END_SCAN			2
3162306a36Sopenharmony_ci#define DC395x_SEL_TIMEOUT		153	/* 250 ms selection timeout (@ 40 MHz)	*/
3262306a36Sopenharmony_ci#define DC395x_MAX_RETRIES		3
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#if 0
3562306a36Sopenharmony_ci#define SYNC_FIRST
3662306a36Sopenharmony_ci#endif
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define NORM_REC_LVL			0
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/************************************************************************/
4162306a36Sopenharmony_ci/*									*/
4262306a36Sopenharmony_ci/*	Various definitions						*/
4362306a36Sopenharmony_ci/*									*/
4462306a36Sopenharmony_ci/************************************************************************/
4562306a36Sopenharmony_ci#define BIT31				0x80000000
4662306a36Sopenharmony_ci#define BIT30				0x40000000
4762306a36Sopenharmony_ci#define BIT29				0x20000000
4862306a36Sopenharmony_ci#define BIT28				0x10000000
4962306a36Sopenharmony_ci#define BIT27				0x08000000
5062306a36Sopenharmony_ci#define BIT26				0x04000000
5162306a36Sopenharmony_ci#define BIT25				0x02000000
5262306a36Sopenharmony_ci#define BIT24				0x01000000
5362306a36Sopenharmony_ci#define BIT23				0x00800000
5462306a36Sopenharmony_ci#define BIT22				0x00400000
5562306a36Sopenharmony_ci#define BIT21				0x00200000
5662306a36Sopenharmony_ci#define BIT20				0x00100000
5762306a36Sopenharmony_ci#define BIT19				0x00080000
5862306a36Sopenharmony_ci#define BIT18				0x00040000
5962306a36Sopenharmony_ci#define BIT17				0x00020000
6062306a36Sopenharmony_ci#define BIT16				0x00010000
6162306a36Sopenharmony_ci#define BIT15				0x00008000
6262306a36Sopenharmony_ci#define BIT14				0x00004000
6362306a36Sopenharmony_ci#define BIT13				0x00002000
6462306a36Sopenharmony_ci#define BIT12				0x00001000
6562306a36Sopenharmony_ci#define BIT11				0x00000800
6662306a36Sopenharmony_ci#define BIT10				0x00000400
6762306a36Sopenharmony_ci#define BIT9				0x00000200
6862306a36Sopenharmony_ci#define BIT8				0x00000100
6962306a36Sopenharmony_ci#define BIT7				0x00000080
7062306a36Sopenharmony_ci#define BIT6				0x00000040
7162306a36Sopenharmony_ci#define BIT5				0x00000020
7262306a36Sopenharmony_ci#define BIT4				0x00000010
7362306a36Sopenharmony_ci#define BIT3				0x00000008
7462306a36Sopenharmony_ci#define BIT2				0x00000004
7562306a36Sopenharmony_ci#define BIT1				0x00000002
7662306a36Sopenharmony_ci#define BIT0				0x00000001
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* UnitCtrlFlag */
7962306a36Sopenharmony_ci#define UNIT_ALLOCATED			BIT0
8062306a36Sopenharmony_ci#define UNIT_INFO_CHANGED		BIT1
8162306a36Sopenharmony_ci#define FORMATING_MEDIA			BIT2
8262306a36Sopenharmony_ci#define UNIT_RETRY			BIT3
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci/* UnitFlags */
8562306a36Sopenharmony_ci#define DASD_SUPPORT			BIT0
8662306a36Sopenharmony_ci#define SCSI_SUPPORT			BIT1
8762306a36Sopenharmony_ci#define ASPI_SUPPORT			BIT2
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* SRBState machine definition */
9062306a36Sopenharmony_ci#define SRB_FREE			0x0000
9162306a36Sopenharmony_ci#define SRB_WAIT			0x0001
9262306a36Sopenharmony_ci#define SRB_READY			0x0002
9362306a36Sopenharmony_ci#define SRB_MSGOUT			0x0004	/* arbitration+msg_out 1st byte		*/
9462306a36Sopenharmony_ci#define SRB_MSGIN			0x0008
9562306a36Sopenharmony_ci#define SRB_EXTEND_MSGIN		0x0010
9662306a36Sopenharmony_ci#define SRB_COMMAND			0x0020
9762306a36Sopenharmony_ci#define SRB_START_			0x0040	/* arbitration+msg_out+command_out	*/
9862306a36Sopenharmony_ci#define SRB_DISCONNECT			0x0080
9962306a36Sopenharmony_ci#define SRB_DATA_XFER			0x0100
10062306a36Sopenharmony_ci#define SRB_XFERPAD			0x0200
10162306a36Sopenharmony_ci#define SRB_STATUS			0x0400
10262306a36Sopenharmony_ci#define SRB_COMPLETED			0x0800
10362306a36Sopenharmony_ci#define SRB_ABORT_SENT			0x1000
10462306a36Sopenharmony_ci#define SRB_DO_SYNC_NEGO		0x2000
10562306a36Sopenharmony_ci#define SRB_DO_WIDE_NEGO		0x4000
10662306a36Sopenharmony_ci#define SRB_UNEXPECT_RESEL		0x8000
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/************************************************************************/
10962306a36Sopenharmony_ci/*									*/
11062306a36Sopenharmony_ci/*	ACB Config							*/
11162306a36Sopenharmony_ci/*									*/
11262306a36Sopenharmony_ci/************************************************************************/
11362306a36Sopenharmony_ci#define HCC_WIDE_CARD			0x20
11462306a36Sopenharmony_ci#define HCC_SCSI_RESET			0x10
11562306a36Sopenharmony_ci#define HCC_PARITY			0x08
11662306a36Sopenharmony_ci#define HCC_AUTOTERM			0x04
11762306a36Sopenharmony_ci#define HCC_LOW8TERM			0x02
11862306a36Sopenharmony_ci#define HCC_UP8TERM			0x01
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* ACBFlag */
12162306a36Sopenharmony_ci#define RESET_DEV			BIT0
12262306a36Sopenharmony_ci#define RESET_DETECT			BIT1
12362306a36Sopenharmony_ci#define RESET_DONE			BIT2
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/* DCBFlag */
12662306a36Sopenharmony_ci#define ABORT_DEV_			BIT0
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci/* SRBstatus */
12962306a36Sopenharmony_ci#define SRB_OK				BIT0
13062306a36Sopenharmony_ci#define ABORTION			BIT1
13162306a36Sopenharmony_ci#define OVER_RUN			BIT2
13262306a36Sopenharmony_ci#define UNDER_RUN			BIT3
13362306a36Sopenharmony_ci#define PARITY_ERROR			BIT4
13462306a36Sopenharmony_ci#define SRB_ERROR			BIT5
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* SRBFlag */
13762306a36Sopenharmony_ci#define DATAOUT				BIT7
13862306a36Sopenharmony_ci#define DATAIN				BIT6
13962306a36Sopenharmony_ci#define RESIDUAL_VALID			BIT5
14062306a36Sopenharmony_ci#define ENABLE_TIMER			BIT4
14162306a36Sopenharmony_ci#define RESET_DEV0			BIT2
14262306a36Sopenharmony_ci#define ABORT_DEV			BIT1
14362306a36Sopenharmony_ci#define AUTO_REQSENSE			BIT0
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/* Adapter status */
14662306a36Sopenharmony_ci#define H_STATUS_GOOD			0
14762306a36Sopenharmony_ci#define H_SEL_TIMEOUT			0x11
14862306a36Sopenharmony_ci#define H_OVER_UNDER_RUN		0x12
14962306a36Sopenharmony_ci#define H_UNEXP_BUS_FREE		0x13
15062306a36Sopenharmony_ci#define H_TARGET_PHASE_F		0x14
15162306a36Sopenharmony_ci#define H_INVALID_CCB_OP		0x16
15262306a36Sopenharmony_ci#define H_LINK_CCB_BAD			0x17
15362306a36Sopenharmony_ci#define H_BAD_TARGET_DIR		0x18
15462306a36Sopenharmony_ci#define H_DUPLICATE_CCB			0x19
15562306a36Sopenharmony_ci#define H_BAD_CCB_OR_SG			0x1A
15662306a36Sopenharmony_ci#define H_ABORT				0x0FF
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/* SCSI BUS Status byte codes */
15962306a36Sopenharmony_ci#define SCSI_STAT_UNEXP_BUS_F		0xFD	/* Unexpect Bus Free			*/
16062306a36Sopenharmony_ci#define SCSI_STAT_BUS_RST_DETECT	0xFE	/* Scsi Bus Reset detected		*/
16162306a36Sopenharmony_ci#define SCSI_STAT_SEL_TIMEOUT		0xFF	/* Selection Time out			*/
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/* Sync_Mode */
16462306a36Sopenharmony_ci#define SYNC_WIDE_TAG_ATNT_DISABLE	0
16562306a36Sopenharmony_ci#define SYNC_NEGO_ENABLE		BIT0
16662306a36Sopenharmony_ci#define SYNC_NEGO_DONE			BIT1
16762306a36Sopenharmony_ci#define WIDE_NEGO_ENABLE		BIT2
16862306a36Sopenharmony_ci#define WIDE_NEGO_DONE			BIT3
16962306a36Sopenharmony_ci#define WIDE_NEGO_STATE			BIT4
17062306a36Sopenharmony_ci#define EN_TAG_QUEUEING			BIT5
17162306a36Sopenharmony_ci#define EN_ATN_STOP			BIT6
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci#define SYNC_NEGO_OFFSET		15
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/* cmd->result */
17662306a36Sopenharmony_ci#define STATUS_MASK_			0xFF
17762306a36Sopenharmony_ci#define MSG_MASK			0xFF00
17862306a36Sopenharmony_ci#define RETURN_MASK			0xFF0000
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/************************************************************************/
18162306a36Sopenharmony_ci/*									*/
18262306a36Sopenharmony_ci/*	Inquiry Data format						*/
18362306a36Sopenharmony_ci/*									*/
18462306a36Sopenharmony_ci/************************************************************************/
18562306a36Sopenharmony_cistruct ScsiInqData
18662306a36Sopenharmony_ci{						/* INQ					*/
18762306a36Sopenharmony_ci	u8 DevType;				/* Periph Qualifier & Periph Dev Type	*/
18862306a36Sopenharmony_ci	u8 RMB_TypeMod;				/* rem media bit & Dev Type Modifier	*/
18962306a36Sopenharmony_ci	u8 Vers;				/* ISO, ECMA, & ANSI versions		*/
19062306a36Sopenharmony_ci	u8 RDF;					/* AEN, TRMIOP, & response data format	*/
19162306a36Sopenharmony_ci	u8 AddLen;				/* length of additional data		*/
19262306a36Sopenharmony_ci	u8 Res1;				/* reserved				*/
19362306a36Sopenharmony_ci	u8 Res2;				/* reserved				*/
19462306a36Sopenharmony_ci	u8 Flags;				/* RelADr, Wbus32, Wbus16, Sync, etc.	*/
19562306a36Sopenharmony_ci	u8 VendorID[8];				/* Vendor Identification		*/
19662306a36Sopenharmony_ci	u8 ProductID[16];			/* Product Identification		*/
19762306a36Sopenharmony_ci	u8 ProductRev[4];			/* Product Revision			*/
19862306a36Sopenharmony_ci};
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci						/* Inquiry byte 0 masks			*/
20162306a36Sopenharmony_ci#define SCSI_DEVTYPE			0x1F	/* Peripheral Device Type		*/
20262306a36Sopenharmony_ci#define SCSI_PERIPHQUAL			0xE0	/* Peripheral Qualifier			*/
20362306a36Sopenharmony_ci						/* Inquiry byte 1 mask			*/
20462306a36Sopenharmony_ci#define SCSI_REMOVABLE_MEDIA		0x80	/* Removable Media bit (1=removable)	*/
20562306a36Sopenharmony_ci						/* Peripheral Device Type definitions	*/
20662306a36Sopenharmony_ci						/* See include/scsi/scsi.h		*/
20762306a36Sopenharmony_ci#define TYPE_NODEV		SCSI_DEVTYPE	/* Unknown or no device type		*/
20862306a36Sopenharmony_ci#ifndef TYPE_PRINTER				/*					*/
20962306a36Sopenharmony_ci# define TYPE_PRINTER			0x02	/* Printer device			*/
21062306a36Sopenharmony_ci#endif						/*					*/
21162306a36Sopenharmony_ci#ifndef TYPE_COMM				/*					*/
21262306a36Sopenharmony_ci# define TYPE_COMM			0x09	/* Communications device		*/
21362306a36Sopenharmony_ci#endif
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci/************************************************************************/
21662306a36Sopenharmony_ci/*									*/
21762306a36Sopenharmony_ci/*	Inquiry flag definitions (Inq data byte 7)			*/
21862306a36Sopenharmony_ci/*									*/
21962306a36Sopenharmony_ci/************************************************************************/
22062306a36Sopenharmony_ci#define SCSI_INQ_RELADR			0x80	/* device supports relative addressing	*/
22162306a36Sopenharmony_ci#define SCSI_INQ_WBUS32			0x40	/* device supports 32 bit data xfers	*/
22262306a36Sopenharmony_ci#define SCSI_INQ_WBUS16			0x20	/* device supports 16 bit data xfers	*/
22362306a36Sopenharmony_ci#define SCSI_INQ_SYNC			0x10	/* device supports synchronous xfer	*/
22462306a36Sopenharmony_ci#define SCSI_INQ_LINKED			0x08	/* device supports linked commands	*/
22562306a36Sopenharmony_ci#define SCSI_INQ_CMDQUEUE		0x02	/* device supports command queueing	*/
22662306a36Sopenharmony_ci#define SCSI_INQ_SFTRE			0x01	/* device supports soft resets		*/
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#define ENABLE_CE			1
22962306a36Sopenharmony_ci#define DISABLE_CE			0
23062306a36Sopenharmony_ci#define EEPROM_READ			0x80
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci/************************************************************************/
23362306a36Sopenharmony_ci/*									*/
23462306a36Sopenharmony_ci/*	The PCI configuration register offset for TRM_S1040		*/
23562306a36Sopenharmony_ci/*									*/
23662306a36Sopenharmony_ci/************************************************************************/
23762306a36Sopenharmony_ci#define TRM_S1040_ID			0x00	/* Vendor and Device ID			*/
23862306a36Sopenharmony_ci#define TRM_S1040_COMMAND		0x04	/* PCI command register			*/
23962306a36Sopenharmony_ci#define TRM_S1040_IOBASE		0x10	/* I/O Space base address		*/
24062306a36Sopenharmony_ci#define TRM_S1040_ROMBASE		0x30	/* Expansion ROM Base Address		*/
24162306a36Sopenharmony_ci#define TRM_S1040_INTLINE		0x3C	/* Interrupt line			*/
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci/************************************************************************/
24462306a36Sopenharmony_ci/*									*/
24562306a36Sopenharmony_ci/*	The SCSI register offset for TRM_S1040				*/
24662306a36Sopenharmony_ci/*									*/
24762306a36Sopenharmony_ci/************************************************************************/
24862306a36Sopenharmony_ci#define TRM_S1040_SCSI_STATUS		0x80	/* SCSI Status (R)			*/
24962306a36Sopenharmony_ci#define COMMANDPHASEDONE		0x2000	/* SCSI command phase done		*/
25062306a36Sopenharmony_ci#define SCSIXFERDONE			0x0800	/* SCSI SCSI transfer done		*/
25162306a36Sopenharmony_ci#define SCSIXFERCNT_2_ZERO		0x0100	/* SCSI SCSI transfer count to zero	*/
25262306a36Sopenharmony_ci#define SCSIINTERRUPT			0x0080	/* SCSI interrupt pending		*/
25362306a36Sopenharmony_ci#define COMMANDABORT			0x0040	/* SCSI command abort			*/
25462306a36Sopenharmony_ci#define SEQUENCERACTIVE			0x0020	/* SCSI sequencer active		*/
25562306a36Sopenharmony_ci#define PHASEMISMATCH			0x0010	/* SCSI phase mismatch			*/
25662306a36Sopenharmony_ci#define PARITYERROR			0x0008	/* SCSI parity error			*/
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#define PHASEMASK			0x0007	/* Phase MSG/CD/IO			*/
25962306a36Sopenharmony_ci#define PH_DATA_OUT			0x00	/* Data out phase			*/
26062306a36Sopenharmony_ci#define PH_DATA_IN			0x01	/* Data in phase			*/
26162306a36Sopenharmony_ci#define PH_COMMAND			0x02	/* Command phase			*/
26262306a36Sopenharmony_ci#define PH_STATUS			0x03	/* Status phase				*/
26362306a36Sopenharmony_ci#define PH_BUS_FREE			0x05	/* Invalid phase used as bus free	*/
26462306a36Sopenharmony_ci#define PH_MSG_OUT			0x06	/* Message out phase			*/
26562306a36Sopenharmony_ci#define PH_MSG_IN			0x07	/* Message in phase			*/
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define TRM_S1040_SCSI_CONTROL		0x80	/* SCSI Control (W)			*/
26862306a36Sopenharmony_ci#define DO_CLRATN			0x0400	/* Clear ATN				*/
26962306a36Sopenharmony_ci#define DO_SETATN			0x0200	/* Set ATN				*/
27062306a36Sopenharmony_ci#define DO_CMDABORT			0x0100	/* Abort SCSI command			*/
27162306a36Sopenharmony_ci#define DO_RSTMODULE			0x0010	/* Reset SCSI chip			*/
27262306a36Sopenharmony_ci#define DO_RSTSCSI			0x0008	/* Reset SCSI bus			*/
27362306a36Sopenharmony_ci#define DO_CLRFIFO			0x0004	/* Clear SCSI transfer FIFO		*/
27462306a36Sopenharmony_ci#define DO_DATALATCH			0x0002	/* Enable SCSI bus data input (latched)	*/
27562306a36Sopenharmony_ci/* #define DO_DATALATCH			0x0000 */	/* KG: DISable SCSI bus data latch	*/
27662306a36Sopenharmony_ci#define DO_HWRESELECT			0x0001	/* Enable hardware reselection		*/
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci#define TRM_S1040_SCSI_FIFOCNT		0x82	/* SCSI FIFO Counter 5bits(R)		*/
27962306a36Sopenharmony_ci#define TRM_S1040_SCSI_SIGNAL		0x83	/* SCSI low level signal (R/W)		*/
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define TRM_S1040_SCSI_INTSTATUS	0x84	/* SCSI Interrupt Status (R)		*/
28262306a36Sopenharmony_ci#define INT_SCAM			0x80	/* SCAM selection interrupt		*/
28362306a36Sopenharmony_ci#define INT_SELECT			0x40	/* Selection interrupt			*/
28462306a36Sopenharmony_ci#define INT_SELTIMEOUT			0x20	/* Selection timeout interrupt		*/
28562306a36Sopenharmony_ci#define INT_DISCONNECT			0x10	/* Bus disconnected interrupt		*/
28662306a36Sopenharmony_ci#define INT_RESELECTED			0x08	/* Reselected interrupt			*/
28762306a36Sopenharmony_ci#define INT_SCSIRESET			0x04	/* SCSI reset detected interrupt	*/
28862306a36Sopenharmony_ci#define INT_BUSSERVICE			0x02	/* Bus service interrupt		*/
28962306a36Sopenharmony_ci#define INT_CMDDONE			0x01	/* SCSI command done interrupt		*/
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci#define TRM_S1040_SCSI_OFFSET		0x84	/* SCSI Offset Count (W)		*/
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci/************************************************************************/
29462306a36Sopenharmony_ci/*									*/
29562306a36Sopenharmony_ci/*	Bit		Name		Definition			*/
29662306a36Sopenharmony_ci/*	---------	-------------	----------------------------	*/
29762306a36Sopenharmony_ci/*	07-05	0	RSVD		Reversed. Always 0.		*/
29862306a36Sopenharmony_ci/*	04	0	OFFSET4		Reversed for LVDS. Always 0.	*/
29962306a36Sopenharmony_ci/*	03-00	0	OFFSET[03:00]	Offset number from 0 to 15	*/
30062306a36Sopenharmony_ci/*									*/
30162306a36Sopenharmony_ci/************************************************************************/
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci#define TRM_S1040_SCSI_SYNC		0x85	/* SCSI Synchronous Control (R/W)	*/
30462306a36Sopenharmony_ci#define LVDS_SYNC			0x20	/* Enable LVDS synchronous		*/
30562306a36Sopenharmony_ci#define WIDE_SYNC			0x10	/* Enable WIDE synchronous		*/
30662306a36Sopenharmony_ci#define ALT_SYNC			0x08	/* Enable Fast-20 alternate synchronous	*/
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci/************************************************************************/
30962306a36Sopenharmony_ci/*									*/
31062306a36Sopenharmony_ci/*	SYNCM	7    6    5    4    3       2       1       0		*/
31162306a36Sopenharmony_ci/*	Name	RSVD RSVD LVDS WIDE ALTPERD PERIOD2 PERIOD1 PERIOD0	*/
31262306a36Sopenharmony_ci/*	Default	0    0    0    0    0       0       0       0		*/
31362306a36Sopenharmony_ci/*									*/
31462306a36Sopenharmony_ci/*	Bit		Name		Definition			*/
31562306a36Sopenharmony_ci/*	---------	-------------	---------------------------	*/
31662306a36Sopenharmony_ci/*	07-06	0	RSVD		Reversed. Always read 0		*/
31762306a36Sopenharmony_ci/*	05	0	LVDS		Reversed. Always read 0		*/
31862306a36Sopenharmony_ci/*	04	0	WIDE/WSCSI	Enable wide (16-bits) SCSI	*/
31962306a36Sopenharmony_ci/*					transfer.			*/
32062306a36Sopenharmony_ci/*	03	0	ALTPERD/ALTPD	Alternate (Sync./Period) mode.	*/
32162306a36Sopenharmony_ci/*									*/
32262306a36Sopenharmony_ci/*			@@ When this bit is set,			*/
32362306a36Sopenharmony_ci/*			   the synchronous period bits 2:0		*/
32462306a36Sopenharmony_ci/*			   in the Synchronous Mode register		*/
32562306a36Sopenharmony_ci/*			   are used to transfer data			*/
32662306a36Sopenharmony_ci/*			   at the Fast-20 rate.				*/
32762306a36Sopenharmony_ci/*			@@ When this bit is unset,			*/
32862306a36Sopenharmony_ci/*			   the synchronous period bits 2:0		*/
32962306a36Sopenharmony_ci/*			   in the Synchronous Mode Register		*/
33062306a36Sopenharmony_ci/*			   are used to transfer data			*/
33162306a36Sopenharmony_ci/*			   at the Fast-10 rate (or Fast-40 w/ LVDS).	*/
33262306a36Sopenharmony_ci/*									*/
33362306a36Sopenharmony_ci/*	02-00	0	PERIOD[2:0]/	Synchronous SCSI Transfer Rate.	*/
33462306a36Sopenharmony_ci/*			SXPD[02:00]	These 3 bits specify		*/
33562306a36Sopenharmony_ci/*					the Synchronous SCSI Transfer	*/
33662306a36Sopenharmony_ci/*					Rate for Fast-20 and Fast-10.	*/
33762306a36Sopenharmony_ci/*					These bits are also reset	*/
33862306a36Sopenharmony_ci/*					by a SCSI Bus reset.		*/
33962306a36Sopenharmony_ci/*									*/
34062306a36Sopenharmony_ci/*	For Fast-10 bit ALTPD = 0 and LVDS = 0				*/
34162306a36Sopenharmony_ci/*	and bit2,bit1,bit0 is defined as follows :			*/
34262306a36Sopenharmony_ci/*									*/
34362306a36Sopenharmony_ci/*	000	100ns, 10.0 MHz						*/
34462306a36Sopenharmony_ci/*	001	150ns,  6.6 MHz						*/
34562306a36Sopenharmony_ci/*	010	200ns,  5.0 MHz						*/
34662306a36Sopenharmony_ci/*	011	250ns,  4.0 MHz						*/
34762306a36Sopenharmony_ci/*	100	300ns,  3.3 MHz						*/
34862306a36Sopenharmony_ci/*	101	350ns,  2.8 MHz						*/
34962306a36Sopenharmony_ci/*	110	400ns,  2.5 MHz						*/
35062306a36Sopenharmony_ci/*	111	450ns,  2.2 MHz						*/
35162306a36Sopenharmony_ci/*									*/
35262306a36Sopenharmony_ci/*	For Fast-20 bit ALTPD = 1 and LVDS = 0				*/
35362306a36Sopenharmony_ci/*	and bit2,bit1,bit0 is defined as follows :			*/
35462306a36Sopenharmony_ci/*									*/
35562306a36Sopenharmony_ci/*	000	 50ns, 20.0 MHz						*/
35662306a36Sopenharmony_ci/*	001	 75ns, 13.3 MHz						*/
35762306a36Sopenharmony_ci/*	010	100ns, 10.0 MHz						*/
35862306a36Sopenharmony_ci/*	011	125ns,  8.0 MHz						*/
35962306a36Sopenharmony_ci/*	100	150ns,  6.6 MHz						*/
36062306a36Sopenharmony_ci/*	101	175ns,  5.7 MHz						*/
36162306a36Sopenharmony_ci/*	110	200ns,  5.0 MHz						*/
36262306a36Sopenharmony_ci/*	111	250ns,  4.0 MHz   KG: Maybe 225ns, 4.4 MHz		*/
36362306a36Sopenharmony_ci/*									*/
36462306a36Sopenharmony_ci/*	For Fast-40 bit ALTPD = 0 and LVDS = 1				*/
36562306a36Sopenharmony_ci/*	and bit2,bit1,bit0 is defined as follows :			*/
36662306a36Sopenharmony_ci/*									*/
36762306a36Sopenharmony_ci/*	000	 25ns, 40.0 MHz						*/
36862306a36Sopenharmony_ci/*	001	 50ns, 20.0 MHz						*/
36962306a36Sopenharmony_ci/*	010	 75ns, 13.3 MHz						*/
37062306a36Sopenharmony_ci/*	011	100ns, 10.0 MHz						*/
37162306a36Sopenharmony_ci/*	100	125ns,  8.0 MHz						*/
37262306a36Sopenharmony_ci/*	101	150ns,  6.6 MHz						*/
37362306a36Sopenharmony_ci/*	110	175ns,  5.7 MHz						*/
37462306a36Sopenharmony_ci/*	111	200ns,  5.0 MHz						*/
37562306a36Sopenharmony_ci/*									*/
37662306a36Sopenharmony_ci/************************************************************************/
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ci#define TRM_S1040_SCSI_TARGETID		0x86	/* SCSI Target ID (R/W)			*/
37962306a36Sopenharmony_ci#define TRM_S1040_SCSI_IDMSG		0x87	/* SCSI Identify Message (R)		*/
38062306a36Sopenharmony_ci#define TRM_S1040_SCSI_HOSTID		0x87	/* SCSI Host ID (W)			*/
38162306a36Sopenharmony_ci#define TRM_S1040_SCSI_COUNTER		0x88	/* SCSI Transfer Counter 24bits(R/W)	*/
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci#define TRM_S1040_SCSI_INTEN		0x8C	/* SCSI Interrupt Enable (R/W)		*/
38462306a36Sopenharmony_ci#define EN_SCAM				0x80	/* Enable SCAM selection interrupt	*/
38562306a36Sopenharmony_ci#define EN_SELECT			0x40	/* Enable selection interrupt		*/
38662306a36Sopenharmony_ci#define EN_SELTIMEOUT			0x20	/* Enable selection timeout interrupt	*/
38762306a36Sopenharmony_ci#define EN_DISCONNECT			0x10	/* Enable bus disconnected interrupt	*/
38862306a36Sopenharmony_ci#define EN_RESELECTED			0x08	/* Enable reselected interrupt		*/
38962306a36Sopenharmony_ci#define EN_SCSIRESET			0x04	/* Enable SCSI reset detected interrupt	*/
39062306a36Sopenharmony_ci#define EN_BUSSERVICE			0x02	/* Enable bus service interrupt		*/
39162306a36Sopenharmony_ci#define EN_CMDDONE			0x01	/* Enable SCSI command done interrupt	*/
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci#define TRM_S1040_SCSI_CONFIG0		0x8D	/* SCSI Configuration 0 (R/W)		*/
39462306a36Sopenharmony_ci#define PHASELATCH			0x40	/* Enable phase latch			*/
39562306a36Sopenharmony_ci#define INITIATOR			0x20	/* Enable initiator mode		*/
39662306a36Sopenharmony_ci#define PARITYCHECK			0x10	/* Enable parity check			*/
39762306a36Sopenharmony_ci#define BLOCKRST			0x01	/* Disable SCSI reset1			*/
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci#define TRM_S1040_SCSI_CONFIG1		0x8E	/* SCSI Configuration 1 (R/W)		*/
40062306a36Sopenharmony_ci#define ACTIVE_NEGPLUS			0x10	/* Enhance active negation		*/
40162306a36Sopenharmony_ci#define FILTER_DISABLE			0x08	/* Disable SCSI data filter		*/
40262306a36Sopenharmony_ci#define FAST_FILTER			0x04	/* ?					*/
40362306a36Sopenharmony_ci#define ACTIVE_NEG			0x02	/* Enable active negation		*/
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ci#define TRM_S1040_SCSI_CONFIG2		0x8F	/* SCSI Configuration 2 (R/W)		*/
40662306a36Sopenharmony_ci#define CFG2_WIDEFIFO			0x02	/*					*/
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci#define TRM_S1040_SCSI_COMMAND		0x90	/* SCSI Command (R/W)			*/
40962306a36Sopenharmony_ci#define SCMD_COMP			0x12	/* Command complete			*/
41062306a36Sopenharmony_ci#define SCMD_SEL_ATN			0x60	/* Selection with ATN			*/
41162306a36Sopenharmony_ci#define SCMD_SEL_ATN3			0x64	/* Selection with ATN3			*/
41262306a36Sopenharmony_ci#define SCMD_SEL_ATNSTOP		0xB8	/* Selection with ATN and Stop		*/
41362306a36Sopenharmony_ci#define SCMD_FIFO_OUT			0xC0	/* SCSI FIFO transfer out		*/
41462306a36Sopenharmony_ci#define SCMD_DMA_OUT			0xC1	/* SCSI DMA transfer out		*/
41562306a36Sopenharmony_ci#define SCMD_FIFO_IN			0xC2	/* SCSI FIFO transfer in		*/
41662306a36Sopenharmony_ci#define SCMD_DMA_IN			0xC3	/* SCSI DMA transfer in			*/
41762306a36Sopenharmony_ci#define SCMD_MSGACCEPT			0xD8	/* Message accept			*/
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci/************************************************************************/
42062306a36Sopenharmony_ci/*									*/
42162306a36Sopenharmony_ci/*	Code	Command Description					*/
42262306a36Sopenharmony_ci/*	----	----------------------------------------		*/
42362306a36Sopenharmony_ci/*	02	Enable reselection with FIFO				*/
42462306a36Sopenharmony_ci/*	40	Select without ATN with FIFO				*/
42562306a36Sopenharmony_ci/*	60	Select with ATN with FIFO				*/
42662306a36Sopenharmony_ci/*	64	Select with ATN3 with FIFO				*/
42762306a36Sopenharmony_ci/*	A0	Select with ATN and stop with FIFO			*/
42862306a36Sopenharmony_ci/*	C0	Transfer information out with FIFO			*/
42962306a36Sopenharmony_ci/*	C1	Transfer information out with DMA			*/
43062306a36Sopenharmony_ci/*	C2	Transfer information in with FIFO			*/
43162306a36Sopenharmony_ci/*	C3	Transfer information in with DMA			*/
43262306a36Sopenharmony_ci/*	12	Initiator command complete with FIFO			*/
43362306a36Sopenharmony_ci/*	50	Initiator transfer information out sequence without ATN	*/
43462306a36Sopenharmony_ci/*		with FIFO						*/
43562306a36Sopenharmony_ci/*	70	Initiator transfer information out sequence with ATN	*/
43662306a36Sopenharmony_ci/*		with FIFO						*/
43762306a36Sopenharmony_ci/*	74	Initiator transfer information out sequence with ATN3	*/
43862306a36Sopenharmony_ci/*		with FIFO						*/
43962306a36Sopenharmony_ci/*	52	Initiator transfer information in sequence without ATN	*/
44062306a36Sopenharmony_ci/*		with FIFO						*/
44162306a36Sopenharmony_ci/*	72	Initiator transfer information in sequence with ATN	*/
44262306a36Sopenharmony_ci/*		with FIFO						*/
44362306a36Sopenharmony_ci/*	76	Initiator transfer information in sequence with ATN3	*/
44462306a36Sopenharmony_ci/*		with FIFO						*/
44562306a36Sopenharmony_ci/*	90	Initiator transfer information out command complete	*/
44662306a36Sopenharmony_ci/*		with FIFO						*/
44762306a36Sopenharmony_ci/*	92	Initiator transfer information in command complete	*/
44862306a36Sopenharmony_ci/*		with FIFO						*/
44962306a36Sopenharmony_ci/*	D2	Enable selection					*/
45062306a36Sopenharmony_ci/*	08	Reselection						*/
45162306a36Sopenharmony_ci/*	48	Disconnect command with FIFO				*/
45262306a36Sopenharmony_ci/*	88	Terminate command with FIFO				*/
45362306a36Sopenharmony_ci/*	C8	Target command complete with FIFO			*/
45462306a36Sopenharmony_ci/*	18	SCAM Arbitration/ Selection				*/
45562306a36Sopenharmony_ci/*	5A	Enable reselection					*/
45662306a36Sopenharmony_ci/*	98	Select without ATN with FIFO				*/
45762306a36Sopenharmony_ci/*	B8	Select with ATN with FIFO				*/
45862306a36Sopenharmony_ci/*	D8	Message Accepted					*/
45962306a36Sopenharmony_ci/*	58	NOP							*/
46062306a36Sopenharmony_ci/*									*/
46162306a36Sopenharmony_ci/************************************************************************/
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci#define TRM_S1040_SCSI_TIMEOUT		0x91	/* SCSI Time Out Value (R/W)		*/
46462306a36Sopenharmony_ci#define TRM_S1040_SCSI_FIFO		0x98	/* SCSI FIFO (R/W)			*/
46562306a36Sopenharmony_ci
46662306a36Sopenharmony_ci#define TRM_S1040_SCSI_TCR0		0x9C	/* SCSI Target Control 0 (R/W)		*/
46762306a36Sopenharmony_ci#define TCR0_WIDE_NEGO_DONE		0x8000	/* Wide nego done			*/
46862306a36Sopenharmony_ci#define TCR0_SYNC_NEGO_DONE		0x4000	/* Synchronous nego done		*/
46962306a36Sopenharmony_ci#define TCR0_ENABLE_LVDS		0x2000	/* Enable LVDS synchronous		*/
47062306a36Sopenharmony_ci#define TCR0_ENABLE_WIDE		0x1000	/* Enable WIDE synchronous		*/
47162306a36Sopenharmony_ci#define TCR0_ENABLE_ALT			0x0800	/* Enable alternate synchronous		*/
47262306a36Sopenharmony_ci#define TCR0_PERIOD_MASK		0x0700	/* Transfer rate			*/
47362306a36Sopenharmony_ci
47462306a36Sopenharmony_ci#define TCR0_DO_WIDE_NEGO		0x0080	/* Do wide NEGO				*/
47562306a36Sopenharmony_ci#define TCR0_DO_SYNC_NEGO		0x0040	/* Do sync NEGO				*/
47662306a36Sopenharmony_ci#define TCR0_DISCONNECT_EN		0x0020	/* Disconnection enable			*/
47762306a36Sopenharmony_ci#define TCR0_OFFSET_MASK		0x001F	/* Offset number			*/
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci#define TRM_S1040_SCSI_TCR1		0x9E	/* SCSI Target Control 1 (R/W)		*/
48062306a36Sopenharmony_ci#define MAXTAG_MASK			0x7F00	/* Maximum tags (127)			*/
48162306a36Sopenharmony_ci#define NON_TAG_BUSY			0x0080	/* Non tag command active		*/
48262306a36Sopenharmony_ci#define ACTTAG_MASK			0x007F	/* Active tags				*/
48362306a36Sopenharmony_ci
48462306a36Sopenharmony_ci/************************************************************************/
48562306a36Sopenharmony_ci/*									*/
48662306a36Sopenharmony_ci/*	The DMA register offset for TRM_S1040				*/
48762306a36Sopenharmony_ci/*									*/
48862306a36Sopenharmony_ci/************************************************************************/
48962306a36Sopenharmony_ci#define TRM_S1040_DMA_COMMAND		0xA0	/* DMA Command (R/W)			*/
49062306a36Sopenharmony_ci#define DMACMD_SG			0x02	/* Enable HW S/G support		*/
49162306a36Sopenharmony_ci#define DMACMD_DIR			0x01	/* 1 = read from SCSI write to Host	*/
49262306a36Sopenharmony_ci#define XFERDATAIN_SG			0x0103	/* Transfer data in  w/  SG		*/
49362306a36Sopenharmony_ci#define XFERDATAOUT_SG			0x0102	/* Transfer data out w/  SG		*/
49462306a36Sopenharmony_ci#define XFERDATAIN			0x0101	/* Transfer data in  w/o SG		*/
49562306a36Sopenharmony_ci#define XFERDATAOUT			0x0100	/* Transfer data out w/o SG		*/
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci#define TRM_S1040_DMA_FIFOCNT		0xA1	/* DMA FIFO Counter (R)			*/
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci#define TRM_S1040_DMA_CONTROL		0xA1	/* DMA Control (W)			*/
50062306a36Sopenharmony_ci#define DMARESETMODULE			0x10	/* Reset PCI/DMA module			*/
50162306a36Sopenharmony_ci#define STOPDMAXFER			0x08	/* Stop  DMA transfer			*/
50262306a36Sopenharmony_ci#define ABORTXFER			0x04	/* Abort DMA transfer			*/
50362306a36Sopenharmony_ci#define CLRXFIFO			0x02	/* Clear DMA transfer FIFO		*/
50462306a36Sopenharmony_ci#define STARTDMAXFER			0x01	/* Start DMA transfer			*/
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci#define TRM_S1040_DMA_FIFOSTAT		0xA2	/* DMA FIFO Status (R)			*/
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ci#define TRM_S1040_DMA_STATUS		0xA3	/* DMA Interrupt Status (R/W)		*/
50962306a36Sopenharmony_ci#define XFERPENDING			0x80	/* Transfer pending			*/
51062306a36Sopenharmony_ci#define SCSIBUSY			0x40	/* SCSI busy				*/
51162306a36Sopenharmony_ci#define GLOBALINT			0x20	/* DMA_INTEN bit 0-4 set		*/
51262306a36Sopenharmony_ci#define FORCEDMACOMP			0x10	/* Force DMA transfer complete		*/
51362306a36Sopenharmony_ci#define DMAXFERERROR			0x08	/* DMA transfer error			*/
51462306a36Sopenharmony_ci#define DMAXFERABORT			0x04	/* DMA transfer abort			*/
51562306a36Sopenharmony_ci#define DMAXFERCOMP			0x02	/* Bus Master XFER Complete status	*/
51662306a36Sopenharmony_ci#define SCSICOMP			0x01	/* SCSI complete interrupt		*/
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci#define TRM_S1040_DMA_INTEN		0xA4	/* DMA Interrupt Enable (R/W)		*/
51962306a36Sopenharmony_ci#define EN_FORCEDMACOMP			0x10	/* Force DMA transfer complete		*/
52062306a36Sopenharmony_ci#define EN_DMAXFERERROR			0x08	/* DMA transfer error			*/
52162306a36Sopenharmony_ci#define EN_DMAXFERABORT			0x04	/* DMA transfer abort			*/
52262306a36Sopenharmony_ci#define EN_DMAXFERCOMP			0x02	/* Bus Master XFER Complete status	*/
52362306a36Sopenharmony_ci#define EN_SCSIINTR			0x01	/* Enable SCSI complete interrupt	*/
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci#define TRM_S1040_DMA_CONFIG		0xA6	/* DMA Configuration (R/W)		*/
52662306a36Sopenharmony_ci#define DMA_ENHANCE			0x8000	/* Enable DMA enhance feature (SG?)	*/
52762306a36Sopenharmony_ci#define DMA_PCI_DUAL_ADDR		0x4000	/*					*/
52862306a36Sopenharmony_ci#define DMA_CFG_RES			0x2000	/* Always 1				*/
52962306a36Sopenharmony_ci#define DMA_AUTO_CLR_FIFO		0x1000	/* DISable DMA auto clear FIFO		*/
53062306a36Sopenharmony_ci#define DMA_MEM_MULTI_READ		0x0800	/*					*/
53162306a36Sopenharmony_ci#define DMA_MEM_WRITE_INVAL		0x0400	/* Memory write and invalidate		*/
53262306a36Sopenharmony_ci#define DMA_FIFO_CTRL			0x0300	/* Control FIFO operation with DMA	*/
53362306a36Sopenharmony_ci#define DMA_FIFO_HALF_HALF		0x0200	/* Keep half filled on both read/write	*/
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_ci#define TRM_S1040_DMA_XCNT		0xA8	/* DMA Transfer Counter (R/W), 24bits	*/
53662306a36Sopenharmony_ci#define TRM_S1040_DMA_CXCNT		0xAC	/* DMA Current Transfer Counter (R)	*/
53762306a36Sopenharmony_ci#define TRM_S1040_DMA_XLOWADDR		0xB0	/* DMA Transfer Physical Low Address	*/
53862306a36Sopenharmony_ci#define TRM_S1040_DMA_XHIGHADDR		0xB4	/* DMA Transfer Physical High Address	*/
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci/************************************************************************/
54162306a36Sopenharmony_ci/*									*/
54262306a36Sopenharmony_ci/*	The general register offset for TRM_S1040			*/
54362306a36Sopenharmony_ci/*									*/
54462306a36Sopenharmony_ci/************************************************************************/
54562306a36Sopenharmony_ci#define TRM_S1040_GEN_CONTROL		0xD4	/* Global Control			*/
54662306a36Sopenharmony_ci#define CTRL_LED			0x80	/* Control onboard LED			*/
54762306a36Sopenharmony_ci#define EN_EEPROM			0x10	/* Enable EEPROM programming		*/
54862306a36Sopenharmony_ci#define DIS_TERM			0x08	/* Disable onboard termination		*/
54962306a36Sopenharmony_ci#define AUTOTERM			0x04	/* Enable Auto SCSI terminator		*/
55062306a36Sopenharmony_ci#define LOW8TERM			0x02	/* Enable Lower 8 bit SCSI terminator	*/
55162306a36Sopenharmony_ci#define UP8TERM				0x01	/* Enable Upper 8 bit SCSI terminator	*/
55262306a36Sopenharmony_ci
55362306a36Sopenharmony_ci#define TRM_S1040_GEN_STATUS		0xD5	/* Global Status			*/
55462306a36Sopenharmony_ci#define GTIMEOUT			0x80	/* Global timer reach 0			*/
55562306a36Sopenharmony_ci#define EXT68HIGH			0x40	/* Higher 8 bit connected externally	*/
55662306a36Sopenharmony_ci#define INT68HIGH			0x20	/* Higher 8 bit connected internally	*/
55762306a36Sopenharmony_ci#define CON5068				0x10	/* External 50/68 pin connected (low)	*/
55862306a36Sopenharmony_ci#define CON68				0x08	/* Internal 68 pin connected (low)	*/
55962306a36Sopenharmony_ci#define CON50				0x04	/* Internal 50 pin connected (low!)	*/
56062306a36Sopenharmony_ci#define WIDESCSI			0x02	/* Wide SCSI card			*/
56162306a36Sopenharmony_ci#define STATUS_LOAD_DEFAULT		0x01	/*					*/
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci#define TRM_S1040_GEN_NVRAM		0xD6	/* Serial NON-VOLATILE RAM port		*/
56462306a36Sopenharmony_ci#define NVR_BITOUT			0x08	/* Serial data out			*/
56562306a36Sopenharmony_ci#define NVR_BITIN			0x04	/* Serial data in			*/
56662306a36Sopenharmony_ci#define NVR_CLOCK			0x02	/* Serial clock				*/
56762306a36Sopenharmony_ci#define NVR_SELECT			0x01	/* Serial select			*/
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ci#define TRM_S1040_GEN_EDATA		0xD7	/* Parallel EEPROM data port		*/
57062306a36Sopenharmony_ci#define TRM_S1040_GEN_EADDRESS		0xD8	/* Parallel EEPROM address		*/
57162306a36Sopenharmony_ci#define TRM_S1040_GEN_TIMER		0xDB	/* Global timer				*/
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ci/************************************************************************/
57462306a36Sopenharmony_ci/*									*/
57562306a36Sopenharmony_ci/*	NvmTarCfg0: Target configuration byte 0 :..pDCB->DevMode	*/
57662306a36Sopenharmony_ci/*									*/
57762306a36Sopenharmony_ci/************************************************************************/
57862306a36Sopenharmony_ci#define NTC_DO_WIDE_NEGO		0x20	/* Wide negotiate			*/
57962306a36Sopenharmony_ci#define NTC_DO_TAG_QUEUEING		0x10	/* Enable SCSI tag queuing		*/
58062306a36Sopenharmony_ci#define NTC_DO_SEND_START		0x08	/* Send start command SPINUP		*/
58162306a36Sopenharmony_ci#define NTC_DO_DISCONNECT		0x04	/* Enable SCSI disconnect		*/
58262306a36Sopenharmony_ci#define NTC_DO_SYNC_NEGO		0x02	/* Sync negotiation			*/
58362306a36Sopenharmony_ci#define NTC_DO_PARITY_CHK		0x01	/* (it should define at NAC)		*/
58462306a36Sopenharmony_ci						/* Parity check enable			*/
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_ci/************************************************************************/
58762306a36Sopenharmony_ci/*									*/
58862306a36Sopenharmony_ci/*	Nvram Initiater bits definition					*/
58962306a36Sopenharmony_ci/*									*/
59062306a36Sopenharmony_ci/************************************************************************/
59162306a36Sopenharmony_ci#if 0
59262306a36Sopenharmony_ci#define MORE2_DRV			BIT0
59362306a36Sopenharmony_ci#define GREATER_1G			BIT1
59462306a36Sopenharmony_ci#define RST_SCSI_BUS			BIT2
59562306a36Sopenharmony_ci#define ACTIVE_NEGATION			BIT3
59662306a36Sopenharmony_ci#define NO_SEEK				BIT4
59762306a36Sopenharmony_ci#define LUN_CHECK			BIT5
59862306a36Sopenharmony_ci#endif
59962306a36Sopenharmony_ci
60062306a36Sopenharmony_ci/************************************************************************/
60162306a36Sopenharmony_ci/*									*/
60262306a36Sopenharmony_ci/*	Nvram Adapter Cfg bits definition				*/
60362306a36Sopenharmony_ci/*									*/
60462306a36Sopenharmony_ci/************************************************************************/
60562306a36Sopenharmony_ci#define NAC_SCANLUN			0x20	/* Include LUN as BIOS device		*/
60662306a36Sopenharmony_ci#define NAC_POWERON_SCSI_RESET		0x04	/* Power on reset enable		*/
60762306a36Sopenharmony_ci#define NAC_GREATER_1G			0x02	/* > 1G support enable			*/
60862306a36Sopenharmony_ci#define NAC_GT2DRIVES			0x01	/* Support more than 2 drives		*/
60962306a36Sopenharmony_ci/* #define NAC_DO_PARITY_CHK		0x08 */	/* Parity check enable			*/
61062306a36Sopenharmony_ci
61162306a36Sopenharmony_ci#endif
612