OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [scsi/] [pci2220i.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*+M*************************************************************************
2
 * Perceptive Solutions, Inc. PCI-2000 device driver proc support for Linux.
3
 *
4
 * Copyright (c) 1997 Perceptive Solutions, Inc.
5
 *
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2, or (at your option)
9
 * any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; see the file COPYING.  If not, write to
18
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
 *
20
 *
21
 *      File Name:              pci2220i.h
22
 *
23
 *      Description:    Header file for the SCSI driver for the PCI2220I
24
 *                                      EIDE interface card.
25
 *
26
 *-M*************************************************************************/
27
 
28
#ifndef _PCI2220I_H
29
#define _PCI2220I_H
30
 
31
#include <linux/types.h>
32
#include <linux/kdev_t.h>
33
 
34
#ifndef PSI_EIDE_SCSIOP
35
#define PSI_EIDE_SCSIOP 1
36
 
37
/************************************************/
38
/*              Some defines that we like                               */
39
/************************************************/
40
#define CHAR            char
41
#define UCHAR           unsigned char
42
#define SHORT           short
43
#define USHORT          unsigned short
44
#define BOOL            unsigned short
45
#define LONG            long
46
#define ULONG           unsigned long
47
#define VOID            void
48
 
49
/************************************************/
50
/*              Timeout konstants                                               */
51
/************************************************/
52
#define TIMEOUT_READY                           10              // 100 mSec
53
#define TIMEOUT_DRQ                                     40              // 400 mSec
54
 
55
/************************************************/
56
/*              Misc. macros                                                    */
57
/************************************************/
58
#define ANY2SCSI(up, p)                                 \
59
((UCHAR *)up)[0] = (((ULONG)(p)) >> 8);  \
60
((UCHAR *)up)[1] = ((ULONG)(p));
61
 
62
#define SCSI2LONG(up)                                   \
63
( (((long)*(((UCHAR *)up))) << 16)              \
64
+ (((long)(((UCHAR *)up)[1])) << 8)             \
65
+ ((long)(((UCHAR *)up)[2])) )
66
 
67
#define XANY2SCSI(up, p)                                \
68
((UCHAR *)up)[0] = ((long)(p)) >> 24;    \
69
((UCHAR *)up)[1] = ((long)(p)) >> 16;   \
70
((UCHAR *)up)[2] = ((long)(p)) >> 8;    \
71
((UCHAR *)up)[3] = ((long)(p));
72
 
73
#define XSCSI2LONG(up)                                  \
74
( (((long)(((UCHAR *)up)[0])) << 24)     \
75
+ (((long)(((UCHAR *)up)[1])) << 16)    \
76
+ (((long)(((UCHAR *)up)[2])) <<  8)    \
77
+ ((long)(((UCHAR *)up)[3])) )
78
 
79
/************************************************/
80
/*              SCSI CDB operation codes                                */
81
/************************************************/
82
#define SCSIOP_TEST_UNIT_READY          0x00
83
#define SCSIOP_REZERO_UNIT                      0x01
84
#define SCSIOP_REWIND                           0x01
85
#define SCSIOP_REQUEST_BLOCK_ADDR       0x02
86
#define SCSIOP_REQUEST_SENSE            0x03
87
#define SCSIOP_FORMAT_UNIT                      0x04
88
#define SCSIOP_READ_BLOCK_LIMITS        0x05
89
#define SCSIOP_REASSIGN_BLOCKS          0x07
90
#define SCSIOP_READ6                            0x08
91
#define SCSIOP_RECEIVE                          0x08
92
#define SCSIOP_WRITE6                           0x0A
93
#define SCSIOP_PRINT                            0x0A
94
#define SCSIOP_SEND                                     0x0A
95
#define SCSIOP_SEEK6                            0x0B
96
#define SCSIOP_TRACK_SELECT                     0x0B
97
#define SCSIOP_SLEW_PRINT                       0x0B
98
#define SCSIOP_SEEK_BLOCK                       0x0C
99
#define SCSIOP_PARTITION                        0x0D
100
#define SCSIOP_READ_REVERSE                     0x0F
101
#define SCSIOP_WRITE_FILEMARKS          0x10
102
#define SCSIOP_FLUSH_BUFFER                     0x10
103
#define SCSIOP_SPACE                            0x11
104
#define SCSIOP_INQUIRY                          0x12
105
#define SCSIOP_VERIFY6                          0x13
106
#define SCSIOP_RECOVER_BUF_DATA         0x14
107
#define SCSIOP_MODE_SELECT                      0x15
108
#define SCSIOP_RESERVE_UNIT                     0x16
109
#define SCSIOP_RELEASE_UNIT                     0x17
110
#define SCSIOP_COPY                                     0x18
111
#define SCSIOP_ERASE                            0x19
112
#define SCSIOP_MODE_SENSE                       0x1A
113
#define SCSIOP_START_STOP_UNIT          0x1B
114
#define SCSIOP_STOP_PRINT                       0x1B
115
#define SCSIOP_LOAD_UNLOAD                      0x1B
116
#define SCSIOP_RECEIVE_DIAGNOSTIC       0x1C
117
#define SCSIOP_SEND_DIAGNOSTIC          0x1D
118
#define SCSIOP_MEDIUM_REMOVAL           0x1E
119
#define SCSIOP_READ_CAPACITY            0x25
120
#define SCSIOP_READ                                     0x28
121
#define SCSIOP_WRITE                            0x2A
122
#define SCSIOP_SEEK                                     0x2B
123
#define SCSIOP_LOCATE                           0x2B
124
#define SCSIOP_WRITE_VERIFY                     0x2E
125
#define SCSIOP_VERIFY                           0x2F
126
#define SCSIOP_SEARCH_DATA_HIGH         0x30
127
#define SCSIOP_SEARCH_DATA_EQUAL        0x31
128
#define SCSIOP_SEARCH_DATA_LOW          0x32
129
#define SCSIOP_SET_LIMITS                       0x33
130
#define SCSIOP_READ_POSITION            0x34
131
#define SCSIOP_SYNCHRONIZE_CACHE        0x35
132
#define SCSIOP_COMPARE                          0x39
133
#define SCSIOP_COPY_COMPARE                     0x3A
134
#define SCSIOP_WRITE_DATA_BUFF          0x3B
135
#define SCSIOP_READ_DATA_BUFF           0x3C
136
#define SCSIOP_CHANGE_DEFINITION        0x40
137
#define SCSIOP_READ_SUB_CHANNEL         0x42
138
#define SCSIOP_READ_TOC                         0x43
139
#define SCSIOP_READ_HEADER                      0x44
140
#define SCSIOP_PLAY_AUDIO                       0x45
141
#define SCSIOP_PLAY_AUDIO_MSF           0x47
142
#define SCSIOP_PLAY_TRACK_INDEX         0x48
143
#define SCSIOP_PLAY_TRACK_RELATIVE      0x49
144
#define SCSIOP_PAUSE_RESUME                     0x4B
145
#define SCSIOP_LOG_SELECT                       0x4C
146
#define SCSIOP_LOG_SENSE                        0x4D
147
#define SCSIOP_MODE_SELECT10            0x55
148
#define SCSIOP_MODE_SENSE10                     0x5A
149
#define SCSIOP_LOAD_UNLOAD_SLOT         0xA6
150
#define SCSIOP_MECHANISM_STATUS         0xBD
151
#define SCSIOP_READ_CD                          0xBE
152
 
153
// IDE command definitions
154
#define IDE_COMMAND_ATAPI_RESET         0x08
155
#define IDE_COMMAND_READ                        0x20
156
#define IDE_COMMAND_WRITE                       0x30
157
#define IDE_COMMAND_RECALIBRATE         0x10
158
#define IDE_COMMAND_SEEK                        0x70
159
#define IDE_COMMAND_SET_PARAMETERS      0x91
160
#define IDE_COMMAND_VERIFY                      0x40
161
#define IDE_COMMAND_ATAPI_PACKET        0xA0
162
#define IDE_COMMAND_ATAPI_IDENTIFY      0xA1
163
#define IDE_CMD_READ_MULTIPLE           0xC4
164
#define IDE_CMD_WRITE_MULTIPLE          0xC5
165
#define IDE_CMD_SET_MULTIPLE            0xC6
166
#define IDE_COMMAND_WRITE_DMA           0xCA
167
#define IDE_COMMAND_READ_DMA            0xC8
168
#define IDE_COMMAND_IDENTIFY            0xEC
169
 
170
// IDE status definitions
171
#define IDE_STATUS_ERROR                        0x01
172
#define IDE_STATUS_INDEX                        0x02
173
#define IDE_STATUS_CORRECTED_ERROR      0x04
174
#define IDE_STATUS_DRQ                          0x08
175
#define IDE_STATUS_DSC                          0x10
176
#define IDE_STATUS_WRITE_FAULT          0x20
177
#define IDE_STATUS_DRDY                         0x40
178
#define IDE_STATUS_BUSY                         0x80
179
 
180
// IDE error definitions
181
#define IDE_ERROR_AMNF                          0x01
182
#define IDE_ERROR_TKONF                         0x02
183
#define IDE_ERROR_ABRT                          0x04
184
#define IDE_ERROR_MCR                           0x08
185
#define IDE_ERROR_IDFN                          0x10
186
#define IDE_ERROR_MC                            0x20
187
#define IDE_ERROR_UNC                           0x40
188
#define IDE_ERROR_BBK                           0x80
189
 
190
//      IDE interface structure
191
typedef struct _IDE_STRUCT
192
        {
193
        union
194
                {
195
                UCHAR   ide[9];
196
                struct
197
                        {
198
                        USHORT  data;
199
                        UCHAR   sectors;
200
                        UCHAR   lba[4];
201
                        UCHAR   cmd;
202
                        UCHAR   spigot;
203
                        }       ides;
204
                } ide;
205
        }       IDE_STRUCT;
206
 
207
// SCSI read capacity structure
208
typedef struct _READ_CAPACITY_DATA
209
        {
210
        ULONG blks;                             /* total blocks (converted to little endian) */
211
        ULONG blksiz;                   /* size of each (converted to little endian) */
212
        }       READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
213
 
214
// SCSI inquiry data
215
typedef struct _INQUIRYDATA
216
        {
217
        UCHAR DeviceType                        :5;
218
        UCHAR DeviceTypeQualifier       :3;
219
        UCHAR DeviceTypeModifier        :7;
220
        UCHAR RemovableMedia            :1;
221
    UCHAR Versions;
222
    UCHAR ResponseDataFormat;
223
    UCHAR AdditionalLength;
224
    UCHAR Reserved[2];
225
        UCHAR SoftReset                         :1;
226
        UCHAR CommandQueue                      :1;
227
        UCHAR Reserved2                         :1;
228
        UCHAR LinkedCommands            :1;
229
        UCHAR Synchronous                       :1;
230
        UCHAR Wide16Bit                         :1;
231
        UCHAR Wide32Bit                         :1;
232
        UCHAR RelativeAddressing        :1;
233
    UCHAR VendorId[8];
234
    UCHAR ProductId[16];
235
    UCHAR ProductRevisionLevel[4];
236
    UCHAR VendorSpecific[20];
237
    UCHAR Reserved3[40];
238
        }       INQUIRYDATA, *PINQUIRYDATA;
239
 
240
// IDE IDENTIFY data
241
typedef struct _IDENTIFY_DATA
242
        {
243
    USHORT GeneralConfiguration;            // 00
244
    USHORT NumberOfCylinders;               // 02
245
    USHORT Reserved1;                       // 04
246
    USHORT NumberOfHeads;                   // 06
247
    USHORT UnformattedBytesPerTrack;        // 08
248
    USHORT UnformattedBytesPerSector;       // 0A
249
    USHORT SectorsPerTrack;                 // 0C
250
    USHORT VendorUnique1[3];                // 0E
251
    USHORT SerialNumber[10];                // 14
252
    USHORT BufferType;                      // 28
253
    USHORT BufferSectorSize;                // 2A
254
    USHORT NumberOfEccBytes;                // 2C
255
    USHORT FirmwareRevision[4];             // 2E
256
    USHORT ModelNumber[20];                 // 36
257
    UCHAR  MaximumBlockTransfer;            // 5E
258
    UCHAR  VendorUnique2;                   // 5F
259
    USHORT DoubleWordIo;                    // 60
260
    USHORT Capabilities;                    // 62
261
    USHORT Reserved2;                       // 64
262
    UCHAR  VendorUnique3;                   // 66
263
    UCHAR  PioCycleTimingMode;              // 67
264
    UCHAR  VendorUnique4;                   // 68
265
    UCHAR  DmaCycleTimingMode;              // 69
266
    USHORT TranslationFieldsValid:1;        // 6A
267
    USHORT Reserved3:15;
268
    USHORT NumberOfCurrentCylinders;        // 6C
269
    USHORT NumberOfCurrentHeads;            // 6E
270
    USHORT CurrentSectorsPerTrack;          // 70
271
    ULONG  CurrentSectorCapacity;           // 72
272
    USHORT Reserved4[197];                  // 76
273
        }       IDENTIFY_DATA, *PIDENTIFY_DATA;
274
 
275
// Identify data without the Reserved4.
276
typedef struct _IDENTIFY_DATA2 {
277
    USHORT GeneralConfiguration;            // 00
278
    USHORT NumberOfCylinders;               // 02
279
    USHORT Reserved1;                       // 04
280
    USHORT NumberOfHeads;                   // 06
281
    USHORT UnformattedBytesPerTrack;        // 08
282
    USHORT UnformattedBytesPerSector;       // 0A
283
    USHORT SectorsPerTrack;                 // 0C
284
    USHORT VendorUnique1[3];                // 0E
285
    USHORT SerialNumber[10];                // 14
286
    USHORT BufferType;                      // 28
287
    USHORT BufferSectorSize;                // 2A
288
    USHORT NumberOfEccBytes;                // 2C
289
    USHORT FirmwareRevision[4];             // 2E
290
    USHORT ModelNumber[20];                 // 36
291
    UCHAR  MaximumBlockTransfer;            // 5E
292
    UCHAR  VendorUnique2;                   // 5F
293
    USHORT DoubleWordIo;                    // 60
294
    USHORT Capabilities;                    // 62
295
    USHORT Reserved2;                       // 64
296
    UCHAR  VendorUnique3;                   // 66
297
    UCHAR  PioCycleTimingMode;              // 67
298
    UCHAR  VendorUnique4;                   // 68
299
    UCHAR  DmaCycleTimingMode;              // 69
300
        USHORT TranslationFieldsValid:1;        // 6A
301
    USHORT Reserved3:15;
302
    USHORT NumberOfCurrentCylinders;        // 6C
303
    USHORT NumberOfCurrentHeads;            // 6E
304
    USHORT CurrentSectorsPerTrack;          // 70
305
    ULONG  CurrentSectorCapacity;           // 72
306
        }       IDENTIFY_DATA2, *PIDENTIFY_DATA2;
307
 
308
#endif  // PSI_EIDE_SCSIOP
309
 
310
// function prototypes
311
int Pci2220i_Detect                     (Scsi_Host_Template *tpnt);
312
int Pci2220i_Command                    (Scsi_Cmnd *SCpnt);
313
int Pci2220i_QueueCommand       (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
314
int Pci2220i_Abort                      (Scsi_Cmnd *SCpnt);
315
int Pci2220i_Reset                      (Scsi_Cmnd *SCpnt, unsigned int flags);
316
int Pci2220i_BiosParam          (Disk *disk, kdev_t dev, int geom[]);
317
 
318
#ifndef NULL
319
        #define NULL 0
320
#endif
321
 
322
extern struct proc_dir_entry Proc_Scsi_Pci2220i;
323
 
324
#define PCI2220I { NULL, NULL,                                          \
325
                        &Proc_Scsi_Pci2220i,/* proc_dir_entry */        \
326
                        NULL,                                                   \
327
                        "PCI-2220I EIDE Disk Controller",               \
328
                        Pci2220i_Detect,                                                        \
329
                        NULL,                                                                   \
330
                        NULL,                                                                   \
331
                        Pci2220i_Command,                                               \
332
                        Pci2220i_QueueCommand,                                  \
333
                        Pci2220i_Abort,                                                 \
334
                        Pci2220i_Reset,                                                 \
335
                        NULL,                                                                   \
336
                        Pci2220i_BiosParam,                             \
337
                        1,                                                                              \
338
                        -1,                                                                     \
339
                        SG_NONE,                                                                \
340
                        1,                                                                              \
341
                        0,                                                                               \
342
                        0,                                                                               \
343
                        DISABLE_CLUSTERING }
344
 
345
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.