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