more changes on original files
[linux-2.4.git] / drivers / scsi / pci2000.h
1 /****************************************************************************
2  * Perceptive Solutions, Inc. PCI-2000 device driver for Linux.
3  *
4  * pci2000.h - Linux Host Driver for PCI-2000 IntelliCache SCSI Adapters
5  *
6  * Copyright (c) 1997-1999 Perceptive Solutions, Inc.
7  * All Rights Reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that redistributions of source
11  * code retain the above copyright notice and this comment without
12  * modification.
13  *
14  * Technical updates and product information at:
15  *  http://www.psidisk.com
16  *
17  * Please send questions, comments, bug reports to:
18  *  tech@psidisk.com Technical Support
19  *
20  ****************************************************************************/
21 #ifndef _PCI2000_H
22 #define _PCI2000_H
23
24 #include <linux/types.h>
25 #include <linux/kdev_t.h>
26
27 #ifndef PSI_EIDE_SCSIOP
28 #define PSI_EIDE_SCSIOP 1
29
30 #ifndef LINUX_VERSION_CODE
31 #include <linux/version.h>
32 #endif 
33 #define LINUXVERSION(v,p,s)    (((v)<<16) + ((p)<<8) + (s))
34
35 /************************************************/
36 /*              definition of standard data types               */
37 /************************************************/
38 #define CHAR    char
39 #define UCHAR   unsigned char
40 #define SHORT   short
41 #define USHORT  unsigned short
42 #define BOOL    long
43 #define LONG    long
44 #define ULONG   unsigned long
45 #define VOID    void
46
47 typedef CHAR    *PCHAR;
48 typedef UCHAR   *PUCHAR;
49 typedef SHORT   *PSHORT;
50 typedef USHORT  *PUSHORT;
51 typedef BOOL    *PBOOL;
52 typedef LONG    *PLONG;
53 typedef ULONG   *PULONG;
54 typedef VOID    *PVOID;
55
56
57 /************************************************/
58 /*              Misc. macros                                                    */
59 /************************************************/
60 #define ANY2SCSI(up, p)                                 \
61 ((UCHAR *)up)[0] = (((ULONG)(p)) >> 8); \
62 ((UCHAR *)up)[1] = ((ULONG)(p));
63
64 #define SCSI2LONG(up)                                   \
65 ( (((long)*(((UCHAR *)up))) << 16)              \
66 + (((long)(((UCHAR *)up)[1])) << 8)             \
67 + ((long)(((UCHAR *)up)[2])) )
68
69 #define XANY2SCSI(up, p)                                \
70 ((UCHAR *)up)[0] = ((long)(p)) >> 24;   \
71 ((UCHAR *)up)[1] = ((long)(p)) >> 16;   \
72 ((UCHAR *)up)[2] = ((long)(p)) >> 8;    \
73 ((UCHAR *)up)[3] = ((long)(p));
74
75 #define XSCSI2LONG(up)                                  \
76 ( (((long)(((UCHAR *)up)[0])) << 24)    \
77 + (((long)(((UCHAR *)up)[1])) << 16)    \
78 + (((long)(((UCHAR *)up)[2])) <<  8)    \
79 + ((long)(((UCHAR *)up)[3])) )
80
81 /************************************************/
82 /*              SCSI CDB operation codes                                */
83 /************************************************/
84 #define SCSIOP_TEST_UNIT_READY          0x00
85 #define SCSIOP_REZERO_UNIT                      0x01
86 #define SCSIOP_REWIND                           0x01
87 #define SCSIOP_REQUEST_BLOCK_ADDR       0x02
88 #define SCSIOP_REQUEST_SENSE            0x03
89 #define SCSIOP_FORMAT_UNIT                      0x04
90 #define SCSIOP_READ_BLOCK_LIMITS        0x05
91 #define SCSIOP_REASSIGN_BLOCKS          0x07
92 #define SCSIOP_READ6                            0x08
93 #define SCSIOP_RECEIVE                          0x08
94 #define SCSIOP_WRITE6                           0x0A
95 #define SCSIOP_PRINT                            0x0A
96 #define SCSIOP_SEND                                     0x0A
97 #define SCSIOP_SEEK6                            0x0B
98 #define SCSIOP_TRACK_SELECT                     0x0B
99 #define SCSIOP_SLEW_PRINT                       0x0B
100 #define SCSIOP_SEEK_BLOCK                       0x0C
101 #define SCSIOP_PARTITION                        0x0D
102 #define SCSIOP_READ_REVERSE                     0x0F
103 #define SCSIOP_WRITE_FILEMARKS          0x10
104 #define SCSIOP_FLUSH_BUFFER                     0x10
105 #define SCSIOP_SPACE                            0x11
106 #define SCSIOP_INQUIRY                          0x12
107 #define SCSIOP_VERIFY6                          0x13
108 #define SCSIOP_RECOVER_BUF_DATA         0x14
109 #define SCSIOP_MODE_SELECT                      0x15
110 #define SCSIOP_RESERVE_UNIT                     0x16
111 #define SCSIOP_RELEASE_UNIT                     0x17
112 #define SCSIOP_COPY                                     0x18
113 #define SCSIOP_ERASE                            0x19
114 #define SCSIOP_MODE_SENSE                       0x1A
115 #define SCSIOP_START_STOP_UNIT          0x1B
116 #define SCSIOP_STOP_PRINT                       0x1B
117 #define SCSIOP_LOAD_UNLOAD                      0x1B
118 #define SCSIOP_RECEIVE_DIAGNOSTIC       0x1C
119 #define SCSIOP_SEND_DIAGNOSTIC          0x1D
120 #define SCSIOP_MEDIUM_REMOVAL           0x1E
121 #define SCSIOP_READ_CAPACITY            0x25
122 #define SCSIOP_READ                                     0x28
123 #define SCSIOP_WRITE                            0x2A
124 #define SCSIOP_SEEK                                     0x2B
125 #define SCSIOP_LOCATE                           0x2B
126 #define SCSIOP_WRITE_VERIFY                     0x2E
127 #define SCSIOP_VERIFY                           0x2F
128 #define SCSIOP_SEARCH_DATA_HIGH         0x30
129 #define SCSIOP_SEARCH_DATA_EQUAL        0x31
130 #define SCSIOP_SEARCH_DATA_LOW          0x32
131 #define SCSIOP_SET_LIMITS                       0x33
132 #define SCSIOP_READ_POSITION            0x34
133 #define SCSIOP_SYNCHRONIZE_CACHE        0x35
134 #define SCSIOP_COMPARE                          0x39
135 #define SCSIOP_COPY_COMPARE                     0x3A
136 #define SCSIOP_WRITE_DATA_BUFF          0x3B
137 #define SCSIOP_READ_DATA_BUFF           0x3C
138 #define SCSIOP_CHANGE_DEFINITION        0x40
139 #define SCSIOP_READ_SUB_CHANNEL         0x42
140 #define SCSIOP_READ_TOC                         0x43
141 #define SCSIOP_READ_HEADER                      0x44
142 #define SCSIOP_PLAY_AUDIO                       0x45
143 #define SCSIOP_PLAY_AUDIO_MSF           0x47
144 #define SCSIOP_PLAY_TRACK_INDEX         0x48
145 #define SCSIOP_PLAY_TRACK_RELATIVE      0x49
146 #define SCSIOP_PAUSE_RESUME                     0x4B
147 #define SCSIOP_LOG_SELECT                       0x4C
148 #define SCSIOP_LOG_SENSE                        0x4D
149 #define SCSIOP_MODE_SELECT10            0x55
150 #define SCSIOP_MODE_SENSE10                     0x5A
151 #define SCSIOP_LOAD_UNLOAD_SLOT         0xA6
152 #define SCSIOP_MECHANISM_STATUS         0xBD
153 #define SCSIOP_READ_CD                          0xBE
154
155 // SCSI read capacity structure
156 typedef struct _READ_CAPACITY_DATA
157         {
158         ULONG blks;                             /* total blocks (converted to little endian) */
159         ULONG blksiz;                   /* size of each (converted to little endian) */
160         }       READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
161
162 // SCSI inquiry data
163 typedef struct _INQUIRYDATA
164         {
165         UCHAR DeviceType                        :5;
166         UCHAR DeviceTypeQualifier       :3;
167         UCHAR DeviceTypeModifier        :7;
168         UCHAR RemovableMedia            :1;
169     UCHAR Versions;
170     UCHAR ResponseDataFormat;
171     UCHAR AdditionalLength;
172     UCHAR Reserved[2];
173         UCHAR SoftReset                         :1;
174         UCHAR CommandQueue                      :1;
175         UCHAR Reserved2                         :1;
176         UCHAR LinkedCommands            :1;
177         UCHAR Synchronous                       :1;
178         UCHAR Wide16Bit                         :1;
179         UCHAR Wide32Bit                         :1;
180         UCHAR RelativeAddressing        :1;
181     UCHAR VendorId[8];
182     UCHAR ProductId[16];
183     UCHAR ProductRevisionLevel[4];
184     UCHAR VendorSpecific[20];
185     UCHAR Reserved3[40];
186         }       INQUIRYDATA, *PINQUIRYDATA;
187
188 #endif
189
190 // function prototypes
191 int Pci2000_Detect                      (Scsi_Host_Template *tpnt);
192 int Pci2000_Command                     (Scsi_Cmnd *SCpnt);
193 int Pci2000_QueueCommand        (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
194 int Pci2000_Abort                       (Scsi_Cmnd *SCpnt);
195 int Pci2000_Reset                       (Scsi_Cmnd *SCpnt, unsigned int flags);
196 int Pci2000_Release                     (struct Scsi_Host *pshost);
197 int Pci2000_BiosParam           (Disk *disk, kdev_t dev, int geom[]);
198
199 #ifndef NULL
200         #define NULL 0
201 #endif
202
203 /* screen is 80 columns wide, damnit! */
204 #define PCI2000 {                               \
205         proc_name:      "pci2000",                                      \
206         name:           "PCI-2000 SCSI Intelligent Disk Controller",    \
207         detect:         Pci2000_Detect,                                 \
208         release:        Pci2000_Release,                                \
209         command:        Pci2000_Command,                                \
210         queuecommand:   Pci2000_QueueCommand,                           \
211         abort:          Pci2000_Abort,                                  \
212         reset:          Pci2000_Reset,                                  \
213         bios_param:     Pci2000_BiosParam,                              \
214         can_queue:      16,                                             \
215         this_id:        -1,                                             \
216         sg_tablesize:   16,                                             \
217         cmd_per_lun:    1,                                              \
218         present:        0,                                              \
219         unchecked_isa_dma:0,                                            \
220         use_clustering: DISABLE_CLUSTERING,                             \
221         use_new_eh_code:0                                               \
222 }
223
224 #endif