11da177e4SLinus Torvalds #ifndef _AHA1542_H 21da177e4SLinus Torvalds 31da177e4SLinus Torvalds /* $Id: aha1542.h,v 1.1 1992/07/24 06:27:38 root Exp root $ 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Header file for the adaptec 1542 driver for Linux 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * $Log: aha1542.h,v $ 81da177e4SLinus Torvalds * Revision 1.1 1992/07/24 06:27:38 root 91da177e4SLinus Torvalds * Initial revision 101da177e4SLinus Torvalds * 111da177e4SLinus Torvalds * Revision 1.2 1992/07/04 18:41:49 root 121da177e4SLinus Torvalds * Replaced distribution with current drivers 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds * Revision 1.3 1992/06/23 23:58:20 root 151da177e4SLinus Torvalds * Fixes. 161da177e4SLinus Torvalds * 171da177e4SLinus Torvalds * Revision 1.2 1992/05/26 22:13:23 root 181da177e4SLinus Torvalds * Changed bug that prevented DMA above first 2 mbytes. 191da177e4SLinus Torvalds * 201da177e4SLinus Torvalds * Revision 1.1 1992/05/22 21:00:29 root 211da177e4SLinus Torvalds * Initial revision 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds * Revision 1.1 1992/04/24 18:01:50 root 241da177e4SLinus Torvalds * Initial revision 251da177e4SLinus Torvalds * 261da177e4SLinus Torvalds * Revision 1.1 1992/04/02 03:23:13 drew 271da177e4SLinus Torvalds * Initial revision 281da177e4SLinus Torvalds * 291da177e4SLinus Torvalds * Revision 1.3 1992/01/27 14:46:29 tthorn 301da177e4SLinus Torvalds * *** empty log message *** 311da177e4SLinus Torvalds * 321da177e4SLinus Torvalds */ 331da177e4SLinus Torvalds 341da177e4SLinus Torvalds #include <linux/types.h> 351da177e4SLinus Torvalds 361da177e4SLinus Torvalds /* I/O Port interface 4.2 */ 371da177e4SLinus Torvalds /* READ */ 381da177e4SLinus Torvalds #define STATUS(base) base 396d9ffe6aSOndrej Zary #define STST BIT(7) /* Self Test in Progress */ 406d9ffe6aSOndrej Zary #define DIAGF BIT(6) /* Internal Diagnostic Failure */ 416d9ffe6aSOndrej Zary #define INIT BIT(5) /* Mailbox Initialization Required */ 426d9ffe6aSOndrej Zary #define IDLE BIT(4) /* SCSI Host Adapter Idle */ 436d9ffe6aSOndrej Zary #define CDF BIT(3) /* Command/Data Out Port Full */ 446d9ffe6aSOndrej Zary #define DF BIT(2) /* Data In Port Full */ 456d9ffe6aSOndrej Zary /* BIT(1) is reserved */ 466d9ffe6aSOndrej Zary #define INVDCMD BIT(0) /* Invalid H A Command */ 476d9ffe6aSOndrej Zary #define STATMASK (STST | DIAGF | INIT | IDLE | CDF | DF | INVDCMD) 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds #define INTRFLAGS(base) (STATUS(base)+2) 506d9ffe6aSOndrej Zary #define ANYINTR BIT(7) /* Any Interrupt */ 516d9ffe6aSOndrej Zary #define SCRD BIT(3) /* SCSI Reset Detected */ 526d9ffe6aSOndrej Zary #define HACC BIT(2) /* HA Command Complete */ 536d9ffe6aSOndrej Zary #define MBOA BIT(1) /* MBO Empty */ 546d9ffe6aSOndrej Zary #define MBIF BIT(0) /* MBI Full */ 556d9ffe6aSOndrej Zary #define INTRMASK (ANYINTR | SCRD | HACC | MBOA | MBIF) 561da177e4SLinus Torvalds 571da177e4SLinus Torvalds /* WRITE */ 581da177e4SLinus Torvalds #define CONTROL(base) STATUS(base) 596d9ffe6aSOndrej Zary #define HRST BIT(7) /* Hard Reset */ 606d9ffe6aSOndrej Zary #define SRST BIT(6) /* Soft Reset */ 616d9ffe6aSOndrej Zary #define IRST BIT(5) /* Interrupt Reset */ 626d9ffe6aSOndrej Zary #define SCRST BIT(4) /* SCSI Bus Reset */ 631da177e4SLinus Torvalds 641da177e4SLinus Torvalds /* READ/WRITE */ 651da177e4SLinus Torvalds #define DATA(base) (STATUS(base)+1) 661da177e4SLinus Torvalds #define CMD_NOP 0x00 /* No Operation */ 671da177e4SLinus Torvalds #define CMD_MBINIT 0x01 /* Mailbox Initialization */ 681da177e4SLinus Torvalds #define CMD_START_SCSI 0x02 /* Start SCSI Command */ 691da177e4SLinus Torvalds #define CMD_INQUIRY 0x04 /* Adapter Inquiry */ 701da177e4SLinus Torvalds #define CMD_EMBOI 0x05 /* Enable MailBox Out Interrupt */ 711da177e4SLinus Torvalds #define CMD_BUSON_TIME 0x07 /* Set Bus-On Time */ 721da177e4SLinus Torvalds #define CMD_BUSOFF_TIME 0x08 /* Set Bus-Off Time */ 731da177e4SLinus Torvalds #define CMD_DMASPEED 0x09 /* Set AT Bus Transfer Speed */ 741da177e4SLinus Torvalds #define CMD_RETDEVS 0x0a /* Return Installed Devices */ 751da177e4SLinus Torvalds #define CMD_RETCONF 0x0b /* Return Configuration Data */ 761da177e4SLinus Torvalds #define CMD_RETSETUP 0x0d /* Return Setup Data */ 771da177e4SLinus Torvalds #define CMD_ECHO 0x1f /* ECHO Command Data */ 781da177e4SLinus Torvalds 791da177e4SLinus Torvalds #define CMD_EXTBIOS 0x28 /* Return extend bios information only 1542C */ 801da177e4SLinus Torvalds #define CMD_MBENABLE 0x29 /* Set Mailbox Interface enable only 1542C */ 811da177e4SLinus Torvalds 821da177e4SLinus Torvalds /* Mailbox Definition 5.2.1 and 5.2.2 */ 831da177e4SLinus Torvalds struct mailbox { 84cb5b570cSOndrej Zary u8 status; /* Command/Status */ 85cb5b570cSOndrej Zary u8 ccbptr[3]; /* msb, .., lsb */ 861da177e4SLinus Torvalds }; 871da177e4SLinus Torvalds 881da177e4SLinus Torvalds /* This is used with scatter-gather */ 891da177e4SLinus Torvalds struct chain { 90cb5b570cSOndrej Zary u8 datalen[3]; /* Size of this part of chain */ 91cb5b570cSOndrej Zary u8 dataptr[3]; /* Location of data */ 921da177e4SLinus Torvalds }; 931da177e4SLinus Torvalds 941da177e4SLinus Torvalds /* These belong in scsi.h also */ 951da177e4SLinus Torvalds static inline void any2scsi(u8 *p, u32 v) 961da177e4SLinus Torvalds { 971da177e4SLinus Torvalds p[0] = v >> 16; 981da177e4SLinus Torvalds p[1] = v >> 8; 991da177e4SLinus Torvalds p[2] = v; 1001da177e4SLinus Torvalds } 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) ) 1031da177e4SLinus Torvalds 1041da177e4SLinus Torvalds #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \ 1051da177e4SLinus Torvalds + (((long)(up)[2]) << 8) + ((long)(up)[3]) ) 1061da177e4SLinus Torvalds 1071da177e4SLinus Torvalds #define MAX_CDB 12 1081da177e4SLinus Torvalds #define MAX_SENSE 14 1091da177e4SLinus Torvalds 1101da177e4SLinus Torvalds struct ccb { /* Command Control Block 5.3 */ 111cb5b570cSOndrej Zary u8 op; /* Command Control Block Operation Code */ 112cb5b570cSOndrej Zary u8 idlun; /* op=0,2:Target Id, op=1:Initiator Id */ 1131da177e4SLinus Torvalds /* Outbound data transfer, length is checked*/ 1141da177e4SLinus Torvalds /* Inbound data transfer, length is checked */ 1151da177e4SLinus Torvalds /* Logical Unit Number */ 116cb5b570cSOndrej Zary u8 cdblen; /* SCSI Command Length */ 117cb5b570cSOndrej Zary u8 rsalen; /* Request Sense Allocation Length/Disable */ 118cb5b570cSOndrej Zary u8 datalen[3]; /* Data Length (msb, .., lsb) */ 119cb5b570cSOndrej Zary u8 dataptr[3]; /* Data Pointer */ 120cb5b570cSOndrej Zary u8 linkptr[3]; /* Link Pointer */ 121cb5b570cSOndrej Zary u8 commlinkid; /* Command Linking Identifier */ 122cb5b570cSOndrej Zary u8 hastat; /* Host Adapter Status (HASTAT) */ 123cb5b570cSOndrej Zary u8 tarstat; /* Target Device Status */ 124cb5b570cSOndrej Zary u8 reserved[2]; 125cb5b570cSOndrej Zary u8 cdb[MAX_CDB+MAX_SENSE]; /* SCSI Command Descriptor Block */ 1261da177e4SLinus Torvalds /* REQUEST SENSE */ 1271da177e4SLinus Torvalds }; 1281da177e4SLinus Torvalds 129*3a70c006SOndrej Zary #define AHA1542_REGION_SIZE 4 1301da177e4SLinus Torvalds #define AHA1542_MAILBOXES 8 1311da177e4SLinus Torvalds 1321da177e4SLinus Torvalds #endif 133