|
|
1.1 root 1: #ifndef _AHA1542_H
2:
3: /* $Id: aha1542.h,v 1.1 1992/04/24 18:01:50 root Exp root $
4: *
5: * Header file for the adaptec 1542 driver for Linux
6: *
7: * $Log: aha1542.h,v $
8: * Revision 1.1 1992/04/24 18:01:50 root
9: * Initial revision
10: *
11: * Revision 1.1 1992/04/02 03:23:13 drew
12: * Initial revision
13: *
14: * Revision 1.3 1992/01/27 14:46:29 tthorn
15: * *** empty log message ***
16: *
17: */
18:
19: typedef unsigned char unchar;
20:
21: /* I/O Port interface 4.2 */
22: /* READ */
23: #define STATUS base
24: #define STST 0x80 /* Self Test in Progress */
25: #define DIAGF 0x40 /* Internal Diagonostic Failure */
26: #define INIT 0x20 /* Mailbox Initialization Required */
27: #define IDLE 0x10 /* SCSI Host Adapter Idle */
28: #define CDF 0x08 /* Command/Data Out Port Full */
29: #define DF 0x04 /* Data In Port Full */
30: #define INVDCMD 0x01 /* Invalid H A Command */
31: #define STATMASK 0xfd /* 0x02 is reserved */
32:
33: #define INTRFLAGS STATUS+2
34: #define ANYINTR 0x80 /* Any Interrupt */
35: #define SCRD 0x08 /* SCSI Reset Detected */
36: #define HACC 0x04 /* HA Command Complete */
37: #define MBOA 0x02 /* MBO Empty */
38: #define MBIF 0x01 /* MBI Full */
39: #define INTRMASK 0x8f
40:
41: /* WRITE */
42: #define CONTROL STATUS
43: #define HRST 0x80 /* Hard Reset */
44: #define SRST 0x40 /* Soft Reset */
45: #define IRST 0x20 /* Interrupt Reset */
46: #define SCRST 0x10 /* SCSI Bus Reset */
47:
48: /* READ/WRITE */
49: #define DATA STATUS+1
50: #define CMD_NOP 0x00 /* No Operation */
51: #define CMD_MBINIT 0x01 /* Mailbox Initialization */
52: #define CMD_START_SCSI 0x02 /* Start SCSI Command */
53: #define CMD_INQUIRY 0x04 /* Adapter Inquiry */
54: #define CMD_EMBOI 0x05 /* Enable MailBox Out Interrupt */
55: #define CMD_BUSON_TIME 0x07 /* Set Bus-On Time */
56: #define CMD_BUSOFF_TIME 0x08 /* Set Bus-Off Time */
57: #define CMD_RETDEVS 0x0a /* Return Installed Devices */
58: #define CMD_RETCONF 0x0b /* Return Configuration Data */
59: #define CMD_RETSETUP 0x0d /* Return Setup Data */
60: #define CMD_ECHO 0x1f /* ECHO Command Data */
61:
62: /* Mailbox Definition 5.2.1 and 5.2.2 */
63: struct mailbox {
64: unchar status; /* Command/Status */
65: unchar ccbptr[3]; /* msb, .., lsb */
66: };
67:
68: /* These belong in scsi.h also */
69: #define any2scsi(up, p) \
70: (up)[0] = (((long)(p)) >> 16) & 0xff; \
71: (up)[1] = ((long)(p)) >> 8; \
72: (up)[2] = ((long)(p));
73:
74: #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
75:
76: #define xany2scsi(up, p) \
77: (up)[0] = ((long)(p)) >> 24; \
78: (up)[1] = ((long)(p)) >> 16; \
79: (up)[2] = ((long)(p)) >> 8; \
80: (up)[3] = ((long)(p));
81:
82: #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
83: + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
84:
85: #define MAX_CDB 12
86: #define MAX_SENSE 14
87:
88: struct ccb { /* Command Control Block 5.3 */
89: unchar op; /* Command Control Block Operation Code */
90: unchar idlun; /* op=0,2:Target Id, op=1:Initiator Id */
91: /* Outbound data transfer, length is checked*/
92: /* Inbound data transfer, length is checked */
93: /* Logical Unit Number */
94: unchar cdblen; /* SCSI Command Length */
95: unchar rsalen; /* Request Sense Allocation Length/Disable */
96: unchar datalen[3]; /* Data Length (msb, .., lsb) */
97: unchar dataptr[3]; /* Data Pointer */
98: unchar linkptr[3]; /* Link Pointer */
99: unchar commlinkid; /* Command Linking Identifier */
100: unchar hastat; /* Host Adapter Status (HASTAT) */
101: unchar tarstat; /* Target Device Status */
102: unchar reserved[2];
103: unchar cdb[MAX_CDB+MAX_SENSE];/* SCSI Command Descriptor Block */
104: /* REQUEST SENSE */
105: };
106:
107: int aha1542_detect(int);
108: int aha1542_command(unsigned char target, const void *cmnd, void *buff, int bufflen);
109: /*int aha1542_queuecommand(unchar target, const void *cmnd, void *buff, int bufflen, void (*done)(int));*/
110: int aha1542_abort(int);
111: char *aha1542_info(void);
112: int aha1542_reset(void);
113:
114: #ifndef NULL
115: #define NULL 0
116: #endif
117:
118: #define AHA1542 {"Adaptec 1542", aha1542_detect, \
119: aha1542_info, aha1542_command, \
120: /*aha1542_queuecommand*/ NULL, \
121: aha1542_abort, \
122: aha1542_reset, \
123: 0, 7, 0}
124: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.