162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* to be used by qlogicfas and qlogic_cs */
362306a36Sopenharmony_ci#ifndef __QLOGICFAS408_H
462306a36Sopenharmony_ci#define __QLOGICFAS408_H
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci/*----------------------------------------------------------------*/
762306a36Sopenharmony_ci/* Configuration */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* Set the following to max out the speed of the PIO PseudoDMA transfers,
1062306a36Sopenharmony_ci   again, 0 tends to be slower, but more stable.  */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define QL_TURBO_PDMA 1
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* This should be 1 to enable parity detection */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define QL_ENABLE_PARITY 1
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* This will reset all devices when the driver is initialized (during bootup).
1962306a36Sopenharmony_ci   The other linux drivers don't do this, but the DOS drivers do, and after
2062306a36Sopenharmony_ci   using DOS or some kind of crash or lockup this will bring things back
2162306a36Sopenharmony_ci   without requiring a cold boot.  It does take some time to recover from a
2262306a36Sopenharmony_ci   reset, so it is slower, and I have seen timeouts so that devices weren't
2362306a36Sopenharmony_ci   recognized when this was set. */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define QL_RESET_AT_START 0
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* crystal frequency in megahertz (for offset 5 and 9)
2862306a36Sopenharmony_ci   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
2962306a36Sopenharmony_ci   Control Concepts ISA (not VLB) is 24 Mhz */
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define XTALFREQ	40
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/**********/
3462306a36Sopenharmony_ci/* DANGER! modify these at your own risk */
3562306a36Sopenharmony_ci/* SLOWCABLE can usually be reset to zero if you have a clean setup and
3662306a36Sopenharmony_ci   proper termination.  The rest are for synchronous transfers and other
3762306a36Sopenharmony_ci   advanced features if your device can transfer faster than 5Mb/sec.
3862306a36Sopenharmony_ci   If you are really curious, email me for a quick howto until I have
3962306a36Sopenharmony_ci   something official */
4062306a36Sopenharmony_ci/**********/
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/*****/
4362306a36Sopenharmony_ci/* config register 1 (offset 8) options */
4462306a36Sopenharmony_ci/* This needs to be set to 1 if your cabling is long or noisy */
4562306a36Sopenharmony_ci#define SLOWCABLE 1
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/*****/
4862306a36Sopenharmony_ci/* offset 0xc */
4962306a36Sopenharmony_ci/* This will set fast (10Mhz) synchronous timing when set to 1
5062306a36Sopenharmony_ci   For this to have an effect, FASTCLK must also be 1 */
5162306a36Sopenharmony_ci#define FASTSCSI 0
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/* This when set to 1 will set a faster sync transfer rate */
5462306a36Sopenharmony_ci#define FASTCLK 0	/*(XTALFREQ>25?1:0)*/
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/*****/
5762306a36Sopenharmony_ci/* offset 6 */
5862306a36Sopenharmony_ci/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
5962306a36Sopenharmony_ci   achievable data rate (assuming the rest of the system is capable
6062306a36Sopenharmony_ci   and set properly) */
6162306a36Sopenharmony_ci#define SYNCXFRPD 5	/*(XTALFREQ/5)*/
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/*****/
6462306a36Sopenharmony_ci/* offset 7 */
6562306a36Sopenharmony_ci/* This is the count of how many synchronous transfers can take place
6662306a36Sopenharmony_ci	i.e. how many reqs can occur before an ack is given.
6762306a36Sopenharmony_ci	The maximum value for this is 15, the upper bits can modify
6862306a36Sopenharmony_ci	REQ/ACK assertion and deassertion during synchronous transfers
6962306a36Sopenharmony_ci	If this is 0, the bus will only transfer asynchronously */
7062306a36Sopenharmony_ci#define SYNCOFFST 0
7162306a36Sopenharmony_ci/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
7262306a36Sopenharmony_ci	of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
7362306a36Sopenharmony_ci	cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
7462306a36Sopenharmony_ci	the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/*----------------------------------------------------------------*/
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cistruct qlogicfas408_priv {
7962306a36Sopenharmony_ci	int qbase;		/* Port */
8062306a36Sopenharmony_ci	int qinitid;		/* initiator ID */
8162306a36Sopenharmony_ci	int qabort;		/* Flag to cause an abort */
8262306a36Sopenharmony_ci	int qlirq;		/* IRQ being used */
8362306a36Sopenharmony_ci	int int_type;		/* type of irq, 2 for ISA board, 0 for PCMCIA */
8462306a36Sopenharmony_ci	char qinfo[80];		/* description */
8562306a36Sopenharmony_ci	struct scsi_cmnd *qlcmd;	/* current command being processed */
8662306a36Sopenharmony_ci	struct Scsi_Host *shost;	/* pointer back to host */
8762306a36Sopenharmony_ci	struct qlogicfas408_priv *next; /* next private struct */
8862306a36Sopenharmony_ci};
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci/* The qlogic card uses two register maps - These macros select which one */
9162306a36Sopenharmony_ci#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
9262306a36Sopenharmony_ci#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd ))
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/* following is watchdog timeout in microseconds */
9562306a36Sopenharmony_ci#define WATCHDOG 5000000
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/*----------------------------------------------------------------*/
9862306a36Sopenharmony_ci/* the following will set the monitor border color (useful to find
9962306a36Sopenharmony_ci   where something crashed or gets stuck at and as a simple profiler) */
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define rtrc(i) {}
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0])
10462306a36Sopenharmony_ci#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0])
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ciirqreturn_t qlogicfas408_ihandl(int irq, void *dev_id);
10762306a36Sopenharmony_ciint qlogicfas408_queuecommand(struct Scsi_Host *h, struct scsi_cmnd * cmd);
10862306a36Sopenharmony_ciint qlogicfas408_biosparam(struct scsi_device * disk,
10962306a36Sopenharmony_ci			   struct block_device *dev,
11062306a36Sopenharmony_ci			   sector_t capacity, int ip[]);
11162306a36Sopenharmony_ciint qlogicfas408_abort(struct scsi_cmnd * cmd);
11262306a36Sopenharmony_ciextern int qlogicfas408_host_reset(struct scsi_cmnd *cmd);
11362306a36Sopenharmony_ciconst char *qlogicfas408_info(struct Scsi_Host *host);
11462306a36Sopenharmony_ciint qlogicfas408_get_chip_type(int qbase, int int_type);
11562306a36Sopenharmony_civoid qlogicfas408_setup(int qbase, int id, int int_type);
11662306a36Sopenharmony_ciint qlogicfas408_detect(int qbase, int int_type);
11762306a36Sopenharmony_civoid qlogicfas408_disable_ints(struct qlogicfas408_priv *priv);
11862306a36Sopenharmony_ci#endif	/* __QLOGICFAS408_H */
11962306a36Sopenharmony_ci
120