162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  linux/drivers/acorn/scsi/fas216.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 1997-2000 Russell King
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  FAS216 generic driver
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef FAS216_H
1062306a36Sopenharmony_ci#define FAS216_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <scsi/scsi_eh.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include "queue.h"
1562306a36Sopenharmony_ci#include "msgqueue.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* FAS register definitions */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* transfer count low */
2062306a36Sopenharmony_ci#define REG_CTCL		(0)
2162306a36Sopenharmony_ci#define REG_STCL		(0)
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* transfer count medium */
2462306a36Sopenharmony_ci#define REG_CTCM		(1)
2562306a36Sopenharmony_ci#define REG_STCM		(1)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* fifo data */
2862306a36Sopenharmony_ci#define REG_FF			(2)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/* command */
3162306a36Sopenharmony_ci#define REG_CMD			(3)
3262306a36Sopenharmony_ci#define CMD_NOP			0x00
3362306a36Sopenharmony_ci#define CMD_FLUSHFIFO		0x01
3462306a36Sopenharmony_ci#define CMD_RESETCHIP		0x02
3562306a36Sopenharmony_ci#define CMD_RESETSCSI		0x03
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define CMD_TRANSFERINFO	0x10
3862306a36Sopenharmony_ci#define CMD_INITCMDCOMPLETE	0x11
3962306a36Sopenharmony_ci#define CMD_MSGACCEPTED		0x12
4062306a36Sopenharmony_ci#define CMD_PADBYTES		0x18
4162306a36Sopenharmony_ci#define CMD_SETATN		0x1a
4262306a36Sopenharmony_ci#define CMD_RSETATN		0x1b
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define CMD_SELECTWOATN		0x41
4562306a36Sopenharmony_ci#define CMD_SELECTATN		0x42
4662306a36Sopenharmony_ci#define CMD_SELECTATNSTOP	0x43
4762306a36Sopenharmony_ci#define CMD_ENABLESEL		0x44
4862306a36Sopenharmony_ci#define CMD_DISABLESEL		0x45
4962306a36Sopenharmony_ci#define CMD_SELECTATN3		0x46
5062306a36Sopenharmony_ci#define CMD_RESEL3		0x47
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define CMD_WITHDMA		0x80
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* status register (read) */
5562306a36Sopenharmony_ci#define REG_STAT		(4)
5662306a36Sopenharmony_ci#define STAT_IO			(1 << 0)			/* IO phase		*/
5762306a36Sopenharmony_ci#define STAT_CD			(1 << 1)			/* CD phase		*/
5862306a36Sopenharmony_ci#define STAT_MSG		(1 << 2)			/* MSG phase		*/
5962306a36Sopenharmony_ci#define STAT_TRANSFERDONE	(1 << 3)			/* Transfer completed	*/
6062306a36Sopenharmony_ci#define STAT_TRANSFERCNTZ	(1 << 4)			/* Transfer counter is zero */
6162306a36Sopenharmony_ci#define STAT_PARITYERROR	(1 << 5)			/* Parity error		*/
6262306a36Sopenharmony_ci#define STAT_REALBAD		(1 << 6)			/* Something bad	*/
6362306a36Sopenharmony_ci#define STAT_INT		(1 << 7)			/* Interrupt		*/
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define STAT_BUSMASK		(STAT_MSG|STAT_CD|STAT_IO)
6662306a36Sopenharmony_ci#define STAT_DATAOUT		(0)				/* Data out		*/
6762306a36Sopenharmony_ci#define STAT_DATAIN		(STAT_IO)			/* Data in		*/
6862306a36Sopenharmony_ci#define STAT_COMMAND		(STAT_CD)			/* Command out		*/
6962306a36Sopenharmony_ci#define STAT_STATUS		(STAT_CD|STAT_IO)		/* Status In		*/
7062306a36Sopenharmony_ci#define STAT_MESGOUT		(STAT_MSG|STAT_CD)		/* Message out		*/
7162306a36Sopenharmony_ci#define STAT_MESGIN		(STAT_MSG|STAT_CD|STAT_IO)	/* Message In		*/
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* bus ID for select / reselect */
7462306a36Sopenharmony_ci#define REG_SDID		(4)
7562306a36Sopenharmony_ci#define BUSID(target)		((target) & 7)
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/* Interrupt status register (read) */
7862306a36Sopenharmony_ci#define REG_INST		(5)
7962306a36Sopenharmony_ci#define INST_SELWOATN		(1 << 0)			/* Select w/o ATN	*/
8062306a36Sopenharmony_ci#define INST_SELATN		(1 << 1)			/* Select w/ATN		*/
8162306a36Sopenharmony_ci#define INST_RESELECTED		(1 << 2)			/* Reselected		*/
8262306a36Sopenharmony_ci#define INST_FUNCDONE		(1 << 3)			/* Function done	*/
8362306a36Sopenharmony_ci#define INST_BUSSERVICE		(1 << 4)			/* Bus service		*/
8462306a36Sopenharmony_ci#define INST_DISCONNECT		(1 << 5)			/* Disconnect		*/
8562306a36Sopenharmony_ci#define INST_ILLEGALCMD		(1 << 6)			/* Illegal command	*/
8662306a36Sopenharmony_ci#define INST_BUSRESET		(1 << 7)			/* SCSI Bus reset	*/
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci/* Timeout register (write) */
8962306a36Sopenharmony_ci#define REG_STIM		(5)
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* Sequence step register (read) */
9262306a36Sopenharmony_ci#define REG_IS			(6)
9362306a36Sopenharmony_ci#define IS_BITS			0x07
9462306a36Sopenharmony_ci#define IS_SELARB		0x00				/* Select & Arb ok	*/
9562306a36Sopenharmony_ci#define IS_MSGBYTESENT		0x01				/* One byte message sent*/
9662306a36Sopenharmony_ci#define IS_NOTCOMMAND		0x02				/* Not in command state	*/
9762306a36Sopenharmony_ci#define IS_EARLYPHASE		0x03				/* Early phase change	*/
9862306a36Sopenharmony_ci#define IS_COMPLETE		0x04				/* Command ok		*/
9962306a36Sopenharmony_ci#define IS_SOF			0x08				/* Sync off flag	*/
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/* Transfer period step (write) */
10262306a36Sopenharmony_ci#define REG_STP			(6)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* Synchronous Offset (write) */
10562306a36Sopenharmony_ci#define REG_SOF			(7)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci/* Fifo state register (read) */
10862306a36Sopenharmony_ci#define REG_CFIS		(7)
10962306a36Sopenharmony_ci#define CFIS_CF			0x1f				/* Num bytes in FIFO	*/
11062306a36Sopenharmony_ci#define CFIS_IS			0xe0				/* Step			*/
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* config register 1 */
11362306a36Sopenharmony_ci#define REG_CNTL1		(8)
11462306a36Sopenharmony_ci#define CNTL1_CID		(7 << 0)			/* Chip ID			*/
11562306a36Sopenharmony_ci#define CNTL1_STE		(1 << 3)			/* Self test enable		*/
11662306a36Sopenharmony_ci#define CNTL1_PERE		(1 << 4)			/* Parity enable reporting en.	*/
11762306a36Sopenharmony_ci#define CNTL1_PTE		(1 << 5)			/* Parity test enable		*/
11862306a36Sopenharmony_ci#define CNTL1_DISR		(1 << 6)			/* Disable Irq on SCSI reset	*/
11962306a36Sopenharmony_ci#define CNTL1_ETM		(1 << 7)			/* Extended Timing Mode		*/
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci/* Clock conversion factor (read) */
12262306a36Sopenharmony_ci#define REG_CLKF		(9)
12362306a36Sopenharmony_ci#define CLKF_F37MHZ		0x00				/* 35.01 - 40 MHz		*/
12462306a36Sopenharmony_ci#define CLKF_F10MHZ		0x02				/* 10 MHz			*/
12562306a36Sopenharmony_ci#define CLKF_F12MHZ		0x03				/* 10.01 - 15 MHz		*/
12662306a36Sopenharmony_ci#define CLKF_F17MHZ		0x04				/* 15.01 - 20 MHz		*/
12762306a36Sopenharmony_ci#define CLKF_F22MHZ		0x05				/* 20.01 - 25 MHz		*/
12862306a36Sopenharmony_ci#define CLKF_F27MHZ		0x06				/* 25.01 - 30 MHz		*/
12962306a36Sopenharmony_ci#define CLKF_F32MHZ		0x07				/* 30.01 - 35 MHz		*/
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/* Chip test register (write) */
13262306a36Sopenharmony_ci#define REG_FTM			(10)
13362306a36Sopenharmony_ci#define TEST_FTM		0x01				/* Force target mode		*/
13462306a36Sopenharmony_ci#define TEST_FIM		0x02				/* Force initiator mode		*/
13562306a36Sopenharmony_ci#define TEST_FHI		0x04				/* Force high impedance mode	*/
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/* Configuration register 2 (read/write) */
13862306a36Sopenharmony_ci#define REG_CNTL2		(11)
13962306a36Sopenharmony_ci#define CNTL2_PGDP		(1 << 0)			/* Pass Th/Generate Data Parity	*/
14062306a36Sopenharmony_ci#define CNTL2_PGRP		(1 << 1)			/* Pass Th/Generate Reg Parity	*/
14162306a36Sopenharmony_ci#define CNTL2_ACDPE		(1 << 2)			/* Abort on Cmd/Data Parity Err	*/
14262306a36Sopenharmony_ci#define CNTL2_S2FE		(1 << 3)			/* SCSI2 Features Enable	*/
14362306a36Sopenharmony_ci#define CNTL2_TSDR		(1 << 4)			/* Tristate DREQ		*/
14462306a36Sopenharmony_ci#define CNTL2_SBO		(1 << 5)			/* Select Byte Order		*/
14562306a36Sopenharmony_ci#define CNTL2_ENF		(1 << 6)			/* Enable features		*/
14662306a36Sopenharmony_ci#define CNTL2_DAE		(1 << 7)			/* Data Alignment Enable	*/
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/* Configuration register 3 (read/write) */
14962306a36Sopenharmony_ci#define REG_CNTL3		(12)
15062306a36Sopenharmony_ci#define CNTL3_BS8		(1 << 0)			/* Burst size 8			*/
15162306a36Sopenharmony_ci#define CNTL3_MDM		(1 << 1)			/* Modify DMA mode		*/
15262306a36Sopenharmony_ci#define CNTL3_LBTM		(1 << 2)			/* Last Byte Transfer mode	*/
15362306a36Sopenharmony_ci#define CNTL3_FASTCLK		(1 << 3)			/* Fast SCSI clocking		*/
15462306a36Sopenharmony_ci#define CNTL3_FASTSCSI		(1 << 4)			/* Fast SCSI			*/
15562306a36Sopenharmony_ci#define CNTL3_G2CB		(1 << 5)			/* Group2 SCSI support		*/
15662306a36Sopenharmony_ci#define CNTL3_QTAG		(1 << 6)			/* Enable 3 byte msgs		*/
15762306a36Sopenharmony_ci#define CNTL3_ADIDCHK		(1 << 7)			/* Additional ID check		*/
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci/* High transfer count (read/write) */
16062306a36Sopenharmony_ci#define REG_CTCH		(14)
16162306a36Sopenharmony_ci#define REG_STCH		(14)
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/* ID register (read only) */
16462306a36Sopenharmony_ci#define REG_ID			(14)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci/* Data alignment */
16762306a36Sopenharmony_ci#define REG_DAL			(15)
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_citypedef enum {
17062306a36Sopenharmony_ci	PHASE_IDLE,					/* we're not planning on doing anything	*/
17162306a36Sopenharmony_ci	PHASE_SELECTION,				/* selecting a device			*/
17262306a36Sopenharmony_ci	PHASE_SELSTEPS,					/* selection with command steps		*/
17362306a36Sopenharmony_ci	PHASE_COMMAND,					/* command sent				*/
17462306a36Sopenharmony_ci	PHASE_MESSAGESENT,				/* selected, and we're sending cmd	*/
17562306a36Sopenharmony_ci	PHASE_DATAOUT,					/* data out to device			*/
17662306a36Sopenharmony_ci	PHASE_DATAIN,					/* data in from device			*/
17762306a36Sopenharmony_ci	PHASE_MSGIN,					/* message in from device		*/
17862306a36Sopenharmony_ci	PHASE_MSGIN_DISCONNECT,				/* disconnecting from bus		*/
17962306a36Sopenharmony_ci	PHASE_MSGOUT,					/* after message out phase		*/
18062306a36Sopenharmony_ci	PHASE_MSGOUT_EXPECT,				/* expecting message out		*/
18162306a36Sopenharmony_ci	PHASE_STATUS,					/* status from device			*/
18262306a36Sopenharmony_ci	PHASE_DONE					/* Command complete			*/
18362306a36Sopenharmony_ci} phase_t;
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_citypedef enum {
18662306a36Sopenharmony_ci	DMA_OUT,					/* DMA from memory to chip		*/
18762306a36Sopenharmony_ci	DMA_IN						/* DMA from chip to memory		*/
18862306a36Sopenharmony_ci} fasdmadir_t;
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_citypedef enum {
19162306a36Sopenharmony_ci	fasdma_none,					/* No dma				*/
19262306a36Sopenharmony_ci	fasdma_pio,					/* PIO mode				*/
19362306a36Sopenharmony_ci	fasdma_pseudo,					/* Pseudo DMA				*/
19462306a36Sopenharmony_ci	fasdma_real_block,				/* Real DMA, on block by block basis	*/
19562306a36Sopenharmony_ci	fasdma_real_all					/* Real DMA, on request by request	*/
19662306a36Sopenharmony_ci} fasdmatype_t;
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_citypedef enum {
19962306a36Sopenharmony_ci	neg_wait,					/* Negotiate with device		*/
20062306a36Sopenharmony_ci	neg_inprogress,					/* Negotiation sent			*/
20162306a36Sopenharmony_ci	neg_complete,					/* Negotiation complete			*/
20262306a36Sopenharmony_ci	neg_targcomplete,				/* Target completed negotiation		*/
20362306a36Sopenharmony_ci	neg_invalid					/* Negotiation not supported		*/
20462306a36Sopenharmony_ci} neg_t;
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci#define MAGIC	0x441296bdUL
20762306a36Sopenharmony_ci#define NR_MSGS	8
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci#define FASCAP_DMA		(1 << 0)
21062306a36Sopenharmony_ci#define FASCAP_PSEUDODMA	(1 << 1)
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_citypedef struct {
21362306a36Sopenharmony_ci	unsigned long		magic_start;
21462306a36Sopenharmony_ci	spinlock_t		host_lock;
21562306a36Sopenharmony_ci	struct Scsi_Host	*host;			/* host					*/
21662306a36Sopenharmony_ci	struct scsi_cmnd	*SCpnt;			/* currently processing command		*/
21762306a36Sopenharmony_ci	struct scsi_cmnd	*origSCpnt;		/* original connecting command		*/
21862306a36Sopenharmony_ci	struct scsi_cmnd	*reqSCpnt;		/* request sense command		*/
21962306a36Sopenharmony_ci	struct scsi_cmnd	*rstSCpnt;		/* reset command			*/
22062306a36Sopenharmony_ci	struct scsi_cmnd	*pending_SCpnt[8];	/* per-device pending commands		*/
22162306a36Sopenharmony_ci	int			next_pending;		/* next pending device			*/
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci	/*
22462306a36Sopenharmony_ci	 * Error recovery
22562306a36Sopenharmony_ci	 */
22662306a36Sopenharmony_ci	wait_queue_head_t	eh_wait;
22762306a36Sopenharmony_ci	struct timer_list	eh_timer;
22862306a36Sopenharmony_ci	unsigned int		rst_dev_status;
22962306a36Sopenharmony_ci	unsigned int		rst_bus_status;
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci	/* driver information */
23262306a36Sopenharmony_ci	struct {
23362306a36Sopenharmony_ci		phase_t		phase;			/* current phase			*/
23462306a36Sopenharmony_ci		void __iomem	*io_base;		/* iomem base of FAS216			*/
23562306a36Sopenharmony_ci		unsigned int	io_shift;		/* shift to adjust reg offsets by	*/
23662306a36Sopenharmony_ci		unsigned char	cfg[4];			/* configuration registers		*/
23762306a36Sopenharmony_ci		const char	*type;			/* chip type				*/
23862306a36Sopenharmony_ci		unsigned int	irq;			/* interrupt				*/
23962306a36Sopenharmony_ci		int		dma;			/* dma channel				*/
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci		struct scsi_pointer	SCp;			/* current commands data pointer	*/
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci		MsgQueue_t	msgs;			/* message queue for connected device	*/
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci		unsigned int	async_stp;		/* Async transfer STP value		*/
24662306a36Sopenharmony_ci		unsigned char	msgin_fifo;		/* bytes in fifo at time of message in	*/
24762306a36Sopenharmony_ci		unsigned char	message[256];		/* last message received from device	*/
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci		unsigned char	disconnectable:1;	/* this command can be disconnected	*/
25062306a36Sopenharmony_ci		unsigned char	aborting:1;		/* aborting command			*/
25162306a36Sopenharmony_ci	} scsi;
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	/* statistics information */
25462306a36Sopenharmony_ci	struct {
25562306a36Sopenharmony_ci		unsigned int	queues;
25662306a36Sopenharmony_ci		unsigned int	removes;
25762306a36Sopenharmony_ci		unsigned int	fins;
25862306a36Sopenharmony_ci		unsigned int	reads;
25962306a36Sopenharmony_ci		unsigned int	writes;
26062306a36Sopenharmony_ci		unsigned int	miscs;
26162306a36Sopenharmony_ci		unsigned int	disconnects;
26262306a36Sopenharmony_ci		unsigned int	aborts;
26362306a36Sopenharmony_ci		unsigned int	bus_resets;
26462306a36Sopenharmony_ci		unsigned int	host_resets;
26562306a36Sopenharmony_ci	} stats;
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	/* configuration information */
26862306a36Sopenharmony_ci	struct {
26962306a36Sopenharmony_ci		unsigned char	clockrate;		/* clock rate of FAS device (MHz)	*/
27062306a36Sopenharmony_ci		unsigned char	select_timeout;		/* timeout (R5)				*/
27162306a36Sopenharmony_ci		unsigned char	sync_max_depth;		/* Synchronous xfer max fifo depth	*/
27262306a36Sopenharmony_ci		unsigned char	wide_max_size;		/* Maximum wide transfer size		*/
27362306a36Sopenharmony_ci		unsigned char	cntl3;			/* Control Reg 3			*/
27462306a36Sopenharmony_ci		unsigned int	asyncperiod;		/* Async transfer period (ns)		*/
27562306a36Sopenharmony_ci		unsigned int	capabilities;		/* driver capabilities			*/
27662306a36Sopenharmony_ci		unsigned int	disconnect_ok:1;	/* Disconnects allowed?			*/
27762306a36Sopenharmony_ci	} ifcfg;
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci	/* queue handling */
28062306a36Sopenharmony_ci	struct {
28162306a36Sopenharmony_ci	    	Queue_t		issue;			/* issue queue				*/
28262306a36Sopenharmony_ci    		Queue_t		disconnected;		/* disconnected command queue		*/
28362306a36Sopenharmony_ci	} queues;
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci	/* per-device info */
28662306a36Sopenharmony_ci	struct fas216_device {
28762306a36Sopenharmony_ci		unsigned char	disconnect_ok:1;	/* device can disconnect		*/
28862306a36Sopenharmony_ci		unsigned char	parity_enabled:1;	/* parity checking enabled		*/
28962306a36Sopenharmony_ci		unsigned char	parity_check:1;		/* need to check parity checking	*/
29062306a36Sopenharmony_ci		unsigned char	period;			/* sync xfer period in (*4ns)		*/
29162306a36Sopenharmony_ci		unsigned char	stp;			/* synchronous transfer period		*/
29262306a36Sopenharmony_ci		unsigned char	sof;			/* synchronous offset register		*/
29362306a36Sopenharmony_ci		unsigned char	wide_xfer;		/* currently negociated wide transfer	*/
29462306a36Sopenharmony_ci		neg_t		sync_state;		/* synchronous transfer mode		*/
29562306a36Sopenharmony_ci		neg_t		wide_state;		/* wide transfer mode			*/
29662306a36Sopenharmony_ci	} device[8];
29762306a36Sopenharmony_ci	unsigned long	busyluns[64/sizeof(unsigned long)];/* array of bits indicating LUNs busy	*/
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci	/* dma */
30062306a36Sopenharmony_ci	struct {
30162306a36Sopenharmony_ci		fasdmatype_t	transfer_type;		/* current type of DMA transfer		*/
30262306a36Sopenharmony_ci		fasdmatype_t	(*setup) (struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, fasdmatype_t min_dma);
30362306a36Sopenharmony_ci		void		(*pseudo)(struct Scsi_Host *host, struct scsi_pointer *SCp, fasdmadir_t direction, int transfer);
30462306a36Sopenharmony_ci		void		(*stop)  (struct Scsi_Host *host, struct scsi_pointer *SCp);
30562306a36Sopenharmony_ci	} dma;
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci	/* miscellaneous */
30862306a36Sopenharmony_ci	int			internal_done;		/* flag to indicate request done */
30962306a36Sopenharmony_ci	struct scsi_eh_save	ses;		/* holds request sense restore info */
31062306a36Sopenharmony_ci	unsigned long		magic_end;
31162306a36Sopenharmony_ci} FAS216_Info;
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci/* driver-private data per SCSI command. */
31462306a36Sopenharmony_cistruct fas216_cmd_priv {
31562306a36Sopenharmony_ci	/*
31662306a36Sopenharmony_ci	 * @scsi_pointer must be the first member. See also arm_scsi_pointer().
31762306a36Sopenharmony_ci	 */
31862306a36Sopenharmony_ci	struct scsi_pointer scsi_pointer;
31962306a36Sopenharmony_ci	void (*scsi_done)(struct scsi_cmnd *cmd);
32062306a36Sopenharmony_ci};
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_cistatic inline struct fas216_cmd_priv *fas216_cmd_priv(struct scsi_cmnd *cmd)
32362306a36Sopenharmony_ci{
32462306a36Sopenharmony_ci	return scsi_cmd_priv(cmd);
32562306a36Sopenharmony_ci}
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci/* Function: int fas216_init (struct Scsi_Host *instance)
32862306a36Sopenharmony_ci * Purpose : initialise FAS/NCR/AMD SCSI structures.
32962306a36Sopenharmony_ci * Params  : instance - a driver-specific filled-out structure
33062306a36Sopenharmony_ci * Returns : 0 on success
33162306a36Sopenharmony_ci */
33262306a36Sopenharmony_ciextern int fas216_init (struct Scsi_Host *instance);
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/* Function: int fas216_add (struct Scsi_Host *instance, struct device *dev)
33562306a36Sopenharmony_ci * Purpose : initialise FAS/NCR/AMD SCSI ic.
33662306a36Sopenharmony_ci * Params  : instance - a driver-specific filled-out structure
33762306a36Sopenharmony_ci * Returns : 0 on success
33862306a36Sopenharmony_ci */
33962306a36Sopenharmony_ciextern int fas216_add (struct Scsi_Host *instance, struct device *dev);
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci/* Function: int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt)
34262306a36Sopenharmony_ci * Purpose : queue a command for adapter to process.
34362306a36Sopenharmony_ci * Params  : h - host adapter
34462306a36Sopenharmony_ci *	   : SCpnt - Command to queue
34562306a36Sopenharmony_ci * Returns : 0 - success, else error
34662306a36Sopenharmony_ci */
34762306a36Sopenharmony_ciextern int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/* Function: int fas216_noqueue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt)
35062306a36Sopenharmony_ci * Purpose : queue a command for adapter to process, and process it to completion.
35162306a36Sopenharmony_ci * Params  : h - host adapter
35262306a36Sopenharmony_ci *	   : SCpnt - Command to queue
35362306a36Sopenharmony_ci * Returns : 0 - success, else error
35462306a36Sopenharmony_ci */
35562306a36Sopenharmony_ciextern int fas216_noqueue_command(struct Scsi_Host *, struct scsi_cmnd *);
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci/* Function: irqreturn_t fas216_intr (FAS216_Info *info)
35862306a36Sopenharmony_ci * Purpose : handle interrupts from the interface to progress a command
35962306a36Sopenharmony_ci * Params  : info - interface to service
36062306a36Sopenharmony_ci */
36162306a36Sopenharmony_ciextern irqreturn_t fas216_intr (FAS216_Info *info);
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ciextern void fas216_remove (struct Scsi_Host *instance);
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci/* Function: void fas216_release (struct Scsi_Host *instance)
36662306a36Sopenharmony_ci * Purpose : release all resources and put everything to bed for FAS/NCR/AMD SCSI ic.
36762306a36Sopenharmony_ci * Params  : instance - a driver-specific filled-out structure
36862306a36Sopenharmony_ci * Returns : 0 on success
36962306a36Sopenharmony_ci */
37062306a36Sopenharmony_ciextern void fas216_release (struct Scsi_Host *instance);
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ciextern void fas216_print_host(FAS216_Info *info, struct seq_file *m);
37362306a36Sopenharmony_ciextern void fas216_print_stats(FAS216_Info *info, struct seq_file *m);
37462306a36Sopenharmony_ciextern void fas216_print_devices(FAS216_Info *info, struct seq_file *m);
37562306a36Sopenharmony_ci
37662306a36Sopenharmony_ci/* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt)
37762306a36Sopenharmony_ci * Purpose : abort this command
37862306a36Sopenharmony_ci * Params  : SCpnt - command to abort
37962306a36Sopenharmony_ci * Returns : FAILED if unable to abort
38062306a36Sopenharmony_ci */
38162306a36Sopenharmony_ciextern int fas216_eh_abort(struct scsi_cmnd *SCpnt);
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/* Function: int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)
38462306a36Sopenharmony_ci * Purpose : Reset the device associated with this command
38562306a36Sopenharmony_ci * Params  : SCpnt - command specifing device to reset
38662306a36Sopenharmony_ci * Returns : FAILED if unable to reset
38762306a36Sopenharmony_ci */
38862306a36Sopenharmony_ciextern int fas216_eh_device_reset(struct scsi_cmnd *SCpnt);
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci/* Function: int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt)
39162306a36Sopenharmony_ci * Purpose : Reset the complete bus associated with this command
39262306a36Sopenharmony_ci * Params  : SCpnt - command specifing bus to reset
39362306a36Sopenharmony_ci * Returns : FAILED if unable to reset
39462306a36Sopenharmony_ci */
39562306a36Sopenharmony_ciextern int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt);
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci/* Function: int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
39862306a36Sopenharmony_ci * Purpose : Reset the host associated with this command
39962306a36Sopenharmony_ci * Params  : SCpnt - command specifing host to reset
40062306a36Sopenharmony_ci * Returns : FAILED if unable to reset
40162306a36Sopenharmony_ci */
40262306a36Sopenharmony_ciextern int fas216_eh_host_reset(struct scsi_cmnd *SCpnt);
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci#endif /* FAS216_H */
405