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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [scsi/] [psi240i.h] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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