11da177e4SLinus Torvalds /* to be used by qlogicfas and qlogic_cs */ 21da177e4SLinus Torvalds #ifndef __QLOGICFAS408_H 31da177e4SLinus Torvalds #define __QLOGICFAS408_H 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 61da177e4SLinus Torvalds /* Configuration */ 71da177e4SLinus Torvalds 81da177e4SLinus Torvalds /* Set the following to max out the speed of the PIO PseudoDMA transfers, 91da177e4SLinus Torvalds again, 0 tends to be slower, but more stable. */ 101da177e4SLinus Torvalds 111da177e4SLinus Torvalds #define QL_TURBO_PDMA 1 121da177e4SLinus Torvalds 131da177e4SLinus Torvalds /* This should be 1 to enable parity detection */ 141da177e4SLinus Torvalds 151da177e4SLinus Torvalds #define QL_ENABLE_PARITY 1 161da177e4SLinus Torvalds 171da177e4SLinus Torvalds /* This will reset all devices when the driver is initialized (during bootup). 181da177e4SLinus Torvalds The other linux drivers don't do this, but the DOS drivers do, and after 191da177e4SLinus Torvalds using DOS or some kind of crash or lockup this will bring things back 201da177e4SLinus Torvalds without requiring a cold boot. It does take some time to recover from a 211da177e4SLinus Torvalds reset, so it is slower, and I have seen timeouts so that devices weren't 221da177e4SLinus Torvalds recognized when this was set. */ 231da177e4SLinus Torvalds 241da177e4SLinus Torvalds #define QL_RESET_AT_START 0 251da177e4SLinus Torvalds 261da177e4SLinus Torvalds /* crystal frequency in megahertz (for offset 5 and 9) 271da177e4SLinus Torvalds Please set this for your card. Most Qlogic cards are 40 Mhz. The 281da177e4SLinus Torvalds Control Concepts ISA (not VLB) is 24 Mhz */ 291da177e4SLinus Torvalds 301da177e4SLinus Torvalds #define XTALFREQ 40 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds /**********/ 331da177e4SLinus Torvalds /* DANGER! modify these at your own risk */ 341da177e4SLinus Torvalds /* SLOWCABLE can usually be reset to zero if you have a clean setup and 351da177e4SLinus Torvalds proper termination. The rest are for synchronous transfers and other 361da177e4SLinus Torvalds advanced features if your device can transfer faster than 5Mb/sec. 371da177e4SLinus Torvalds If you are really curious, email me for a quick howto until I have 381da177e4SLinus Torvalds something official */ 391da177e4SLinus Torvalds /**********/ 401da177e4SLinus Torvalds 411da177e4SLinus Torvalds /*****/ 421da177e4SLinus Torvalds /* config register 1 (offset 8) options */ 431da177e4SLinus Torvalds /* This needs to be set to 1 if your cabling is long or noisy */ 441da177e4SLinus Torvalds #define SLOWCABLE 1 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds /*****/ 471da177e4SLinus Torvalds /* offset 0xc */ 481da177e4SLinus Torvalds /* This will set fast (10Mhz) synchronous timing when set to 1 491da177e4SLinus Torvalds For this to have an effect, FASTCLK must also be 1 */ 501da177e4SLinus Torvalds #define FASTSCSI 0 511da177e4SLinus Torvalds 521da177e4SLinus Torvalds /* This when set to 1 will set a faster sync transfer rate */ 531da177e4SLinus Torvalds #define FASTCLK 0 /*(XTALFREQ>25?1:0)*/ 541da177e4SLinus Torvalds 551da177e4SLinus Torvalds /*****/ 561da177e4SLinus Torvalds /* offset 6 */ 571da177e4SLinus Torvalds /* This is the sync transfer divisor, XTALFREQ/X will be the maximum 581da177e4SLinus Torvalds achievable data rate (assuming the rest of the system is capable 591da177e4SLinus Torvalds and set properly) */ 601da177e4SLinus Torvalds #define SYNCXFRPD 5 /*(XTALFREQ/5)*/ 611da177e4SLinus Torvalds 621da177e4SLinus Torvalds /*****/ 631da177e4SLinus Torvalds /* offset 7 */ 641da177e4SLinus Torvalds /* This is the count of how many synchronous transfers can take place 651da177e4SLinus Torvalds i.e. how many reqs can occur before an ack is given. 661da177e4SLinus Torvalds The maximum value for this is 15, the upper bits can modify 671da177e4SLinus Torvalds REQ/ACK assertion and deassertion during synchronous transfers 681da177e4SLinus Torvalds If this is 0, the bus will only transfer asynchronously */ 691da177e4SLinus Torvalds #define SYNCOFFST 0 701da177e4SLinus Torvalds /* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles 711da177e4SLinus Torvalds of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will 721da177e4SLinus Torvalds cause the deassertion to be early by 1/2 clock. Bits 5&4 control 731da177e4SLinus Torvalds the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */ 741da177e4SLinus Torvalds 751da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 761da177e4SLinus Torvalds 771da177e4SLinus Torvalds struct qlogicfas408_priv { 781da177e4SLinus Torvalds int qbase; /* Port */ 791da177e4SLinus Torvalds int qinitid; /* initiator ID */ 801da177e4SLinus Torvalds int qabort; /* Flag to cause an abort */ 811da177e4SLinus Torvalds int qlirq; /* IRQ being used */ 821da177e4SLinus Torvalds int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ 831da177e4SLinus Torvalds char qinfo[80]; /* description */ 841da177e4SLinus Torvalds Scsi_Cmnd *qlcmd; /* current command being processed */ 851da177e4SLinus Torvalds struct Scsi_Host *shost; /* pointer back to host */ 861da177e4SLinus Torvalds struct qlogicfas408_priv *next; /* next private struct */ 871da177e4SLinus Torvalds }; 881da177e4SLinus Torvalds 891da177e4SLinus Torvalds /* The qlogic card uses two register maps - These macros select which one */ 901da177e4SLinus Torvalds #define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd )) 911da177e4SLinus Torvalds #define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd )) 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds /* following is watchdog timeout in microseconds */ 941da177e4SLinus Torvalds #define WATCHDOG 5000000 951da177e4SLinus Torvalds 961da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 971da177e4SLinus Torvalds /* the following will set the monitor border color (useful to find 981da177e4SLinus Torvalds where something crashed or gets stuck at and as a simple profiler) */ 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds #define rtrc(i) {} 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds #define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0]) 1031da177e4SLinus Torvalds #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) 1041da177e4SLinus Torvalds 105*7d12e780SDavid Howells irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); 1061da177e4SLinus Torvalds int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); 1071da177e4SLinus Torvalds int qlogicfas408_biosparam(struct scsi_device * disk, 1081da177e4SLinus Torvalds struct block_device *dev, 1091da177e4SLinus Torvalds sector_t capacity, int ip[]); 1101da177e4SLinus Torvalds int qlogicfas408_abort(Scsi_Cmnd * cmd); 1111da177e4SLinus Torvalds int qlogicfas408_bus_reset(Scsi_Cmnd * cmd); 1121da177e4SLinus Torvalds const char *qlogicfas408_info(struct Scsi_Host *host); 1131da177e4SLinus Torvalds int qlogicfas408_get_chip_type(int qbase, int int_type); 1141da177e4SLinus Torvalds void qlogicfas408_setup(int qbase, int id, int int_type); 1151da177e4SLinus Torvalds int qlogicfas408_detect(int qbase, int int_type); 1161da177e4SLinus Torvalds void qlogicfas408_disable_ints(struct qlogicfas408_priv *priv); 1171da177e4SLinus Torvalds #endif /* __QLOGICFAS408_H */ 1181da177e4SLinus Torvalds 119