18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* to be used by qlogicfas and qlogic_cs */
38c2ecf20Sopenharmony_ci#ifndef __QLOGICFAS408_H
48c2ecf20Sopenharmony_ci#define __QLOGICFAS408_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci/*----------------------------------------------------------------*/
78c2ecf20Sopenharmony_ci/* Configuration */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* Set the following to max out the speed of the PIO PseudoDMA transfers,
108c2ecf20Sopenharmony_ci   again, 0 tends to be slower, but more stable.  */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define QL_TURBO_PDMA 1
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* This should be 1 to enable parity detection */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define QL_ENABLE_PARITY 1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* This will reset all devices when the driver is initialized (during bootup).
198c2ecf20Sopenharmony_ci   The other linux drivers don't do this, but the DOS drivers do, and after
208c2ecf20Sopenharmony_ci   using DOS or some kind of crash or lockup this will bring things back
218c2ecf20Sopenharmony_ci   without requiring a cold boot.  It does take some time to recover from a
228c2ecf20Sopenharmony_ci   reset, so it is slower, and I have seen timeouts so that devices weren't
238c2ecf20Sopenharmony_ci   recognized when this was set. */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define QL_RESET_AT_START 0
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* crystal frequency in megahertz (for offset 5 and 9)
288c2ecf20Sopenharmony_ci   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
298c2ecf20Sopenharmony_ci   Control Concepts ISA (not VLB) is 24 Mhz */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define XTALFREQ	40
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/**********/
348c2ecf20Sopenharmony_ci/* DANGER! modify these at your own risk */
358c2ecf20Sopenharmony_ci/* SLOWCABLE can usually be reset to zero if you have a clean setup and
368c2ecf20Sopenharmony_ci   proper termination.  The rest are for synchronous transfers and other
378c2ecf20Sopenharmony_ci   advanced features if your device can transfer faster than 5Mb/sec.
388c2ecf20Sopenharmony_ci   If you are really curious, email me for a quick howto until I have
398c2ecf20Sopenharmony_ci   something official */
408c2ecf20Sopenharmony_ci/**********/
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/*****/
438c2ecf20Sopenharmony_ci/* config register 1 (offset 8) options */
448c2ecf20Sopenharmony_ci/* This needs to be set to 1 if your cabling is long or noisy */
458c2ecf20Sopenharmony_ci#define SLOWCABLE 1
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*****/
488c2ecf20Sopenharmony_ci/* offset 0xc */
498c2ecf20Sopenharmony_ci/* This will set fast (10Mhz) synchronous timing when set to 1
508c2ecf20Sopenharmony_ci   For this to have an effect, FASTCLK must also be 1 */
518c2ecf20Sopenharmony_ci#define FASTSCSI 0
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* This when set to 1 will set a faster sync transfer rate */
548c2ecf20Sopenharmony_ci#define FASTCLK 0	/*(XTALFREQ>25?1:0)*/
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/*****/
578c2ecf20Sopenharmony_ci/* offset 6 */
588c2ecf20Sopenharmony_ci/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
598c2ecf20Sopenharmony_ci   achievable data rate (assuming the rest of the system is capable
608c2ecf20Sopenharmony_ci   and set properly) */
618c2ecf20Sopenharmony_ci#define SYNCXFRPD 5	/*(XTALFREQ/5)*/
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*****/
648c2ecf20Sopenharmony_ci/* offset 7 */
658c2ecf20Sopenharmony_ci/* This is the count of how many synchronous transfers can take place
668c2ecf20Sopenharmony_ci	i.e. how many reqs can occur before an ack is given.
678c2ecf20Sopenharmony_ci	The maximum value for this is 15, the upper bits can modify
688c2ecf20Sopenharmony_ci	REQ/ACK assertion and deassertion during synchronous transfers
698c2ecf20Sopenharmony_ci	If this is 0, the bus will only transfer asynchronously */
708c2ecf20Sopenharmony_ci#define SYNCOFFST 0
718c2ecf20Sopenharmony_ci/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
728c2ecf20Sopenharmony_ci	of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
738c2ecf20Sopenharmony_ci	cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
748c2ecf20Sopenharmony_ci	the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/*----------------------------------------------------------------*/
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct qlogicfas408_priv {
798c2ecf20Sopenharmony_ci	int qbase;		/* Port */
808c2ecf20Sopenharmony_ci	int qinitid;		/* initiator ID */
818c2ecf20Sopenharmony_ci	int qabort;		/* Flag to cause an abort */
828c2ecf20Sopenharmony_ci	int qlirq;		/* IRQ being used */
838c2ecf20Sopenharmony_ci	int int_type;		/* type of irq, 2 for ISA board, 0 for PCMCIA */
848c2ecf20Sopenharmony_ci	char qinfo[80];		/* description */
858c2ecf20Sopenharmony_ci	struct scsi_cmnd *qlcmd;	/* current command being processed */
868c2ecf20Sopenharmony_ci	struct Scsi_Host *shost;	/* pointer back to host */
878c2ecf20Sopenharmony_ci	struct qlogicfas408_priv *next; /* next private struct */
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci/* The qlogic card uses two register maps - These macros select which one */
918c2ecf20Sopenharmony_ci#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
928c2ecf20Sopenharmony_ci#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd ))
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* following is watchdog timeout in microseconds */
958c2ecf20Sopenharmony_ci#define WATCHDOG 5000000
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/*----------------------------------------------------------------*/
988c2ecf20Sopenharmony_ci/* the following will set the monitor border color (useful to find
998c2ecf20Sopenharmony_ci   where something crashed or gets stuck at and as a simple profiler) */
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define rtrc(i) {}
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0])
1048c2ecf20Sopenharmony_ci#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0])
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciirqreturn_t qlogicfas408_ihandl(int irq, void *dev_id);
1078c2ecf20Sopenharmony_ciint qlogicfas408_queuecommand(struct Scsi_Host *h, struct scsi_cmnd * cmd);
1088c2ecf20Sopenharmony_ciint qlogicfas408_biosparam(struct scsi_device * disk,
1098c2ecf20Sopenharmony_ci			   struct block_device *dev,
1108c2ecf20Sopenharmony_ci			   sector_t capacity, int ip[]);
1118c2ecf20Sopenharmony_ciint qlogicfas408_abort(struct scsi_cmnd * cmd);
1128c2ecf20Sopenharmony_ciextern int qlogicfas408_host_reset(struct scsi_cmnd *cmd);
1138c2ecf20Sopenharmony_ciconst char *qlogicfas408_info(struct Scsi_Host *host);
1148c2ecf20Sopenharmony_ciint qlogicfas408_get_chip_type(int qbase, int int_type);
1158c2ecf20Sopenharmony_civoid qlogicfas408_setup(int qbase, int id, int int_type);
1168c2ecf20Sopenharmony_ciint qlogicfas408_detect(int qbase, int int_type);
1178c2ecf20Sopenharmony_civoid qlogicfas408_disable_ints(struct qlogicfas408_priv *priv);
1188c2ecf20Sopenharmony_ci#endif	/* __QLOGICFAS408_H */
1198c2ecf20Sopenharmony_ci
120