|
|
1.1 root 1: /* (-lgl
2: * COHERENT 386 Device Driver Kit release 2.0
3: * Copyright (c) 1982, 1992 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * Common SCSI portions of Adaptec AHA154x driver
8: */
9: #ifndef __SYS_SCSIWORK_H__
10: #define __SYS_SCSIWORK_H__
11:
12: #define MAX_SCSI_ID 8
13: #define MAX_LUN 4 /* limited by minor device number */
14:
15: /*
16: * drive_info contains the "per drive" flags
17: */
18: extern char drive_info[MAX_SCSI_ID * MAX_LUN];
19: #define D_DISK 0x01 /* disk-type device (random) */
20: #define D_TAPE 0x02 /* tape-type device (sequential) */
21: #define D_PRINTER 0x04 /* printer-type device */
22: #define D_PROCESSOR 0x08 /* processor-type device */
23: #define D_REMOVEABLE 0x10 /* media can be changed */
24: #define D_WORM 0x20 /* WORM-type characteristics */
25:
26: /*
27: * Per disk controller data.
28: * Only one host adapter; no more, no less.
29: */
30:
31: struct scsi_work {
32: struct scsi_work *sw_actf; /* Link to first */
33: struct scsi_work *sw_actl; /* Link to last */
34: BUF *sw_bp; /* block request */
35: long sw_bno;
36: char sw_drv; /* 000sssll s=SCSI_ID l=LUN */
37: char sw_type;
38: char sw_retry;
39: };
40:
41: typedef struct scsi_work scsi_work_t;
42:
43: #define ScmdTESTREADY 0x00
44: #define ScmdREZERO 0x01
45: #define ScmdREQUESTSENSE 0x03
46: #define ScmdINQUIRY 0x12
47: #define ScmdMODESENSE 0x1A
48: #define ScmdREADCAPACITY 0x25
49: #define ScmdREADEXTENDED 0x28
50: #define ScmdWRITEXTENDED 0x2A
51:
52: struct scsi_cmd {
53: long block, buffer;
54: short blklen, buflen;
55: char unit; /* 000sssll s=SCSI_ID l=LUN */
56: char cmd;
57: };
58:
59: typedef struct scsi_cmd scsi_cmd_t;
60:
61: #define G0CMDLEN 6 /* Group 0 commands are 6 bytes long */
62: #define G1CMDLEN 10 /* Group 1 commands are 10 bytes long */
63: #define SENSELEN 22 /* number of bytes returned w/ req sense */
64: #define INQUIRYLEN 54 /* number of bytes returned w/ inquiry */
65: #define MODESENSELEN 92 /* number of bytes returned w/ mode sense */
66: #define READCAPLEN 8 /* number of bytes returned w/read capacity */
67:
68: /* Message types */
69: #define MSG_CMD_CMPLT 0x00 /* Command Complete */
70: #define MSG_SAVE_DPTR 0x02 /* Save SCSI data pointer */
71: #define MSG_RSTOR_DPTR 0x03 /* Restore SCSI pointers */
72: #define MSG_DISCONNECT 0x04 /* Target is about to disconnect */
73: #define MSG_ABORT 0x06 /* End the current SCSI bus cycle */
74: #define MSG_NOP 0x08 /* no-op */
75: #define MSG_DEV_RESET 0x0C /* Bus Device Reset */
76: #define MSG_IDENTIFY 0x80 /* Identify, with no Disconnect */
77: #define MSG_IDENT_DC 0xC0 /* Identify, with Disconnect allowed */
78:
79: #define CS_GOOD 0x00 /* Command Status from the drive */
80: #define CS_CHECK 0x02
81: #define CS_BUSY 0x08
82: #define CS_RESERVED 0x18
83:
84: /*
85: * Information Transfer Phase masks -
86: * setting of RS_MESSAGE, RS_I_O, and RS_CTRL_DATA determines which of six
87: * possible info transfer phases is occurring.
88: */
89: #define XP_MSG_IN (RS_MESSAGE | RS_I_O | RS_CTRL_DATA)
90: #define XP_MSG_OUT (RS_MESSAGE | RS_CTRL_DATA)
91: #define XP_STAT_IN ( RS_I_O | RS_CTRL_DATA)
92: #define XP_CMD_OUT ( RS_CTRL_DATA)
93: #define XP_DATA_IN ( RS_I_O )
94: #define XP_DATA_OUT ( 0)
95:
96: #define VTOP2(a1, a2) vtop(a1,a2)
97:
98: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.