blob: c65afc964121930d327a81d5bec21eedf80b4b75 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/****************************************************************************
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
26#ifndef PSI_EIDE_SCSIOP
27#define PSI_EIDE_SCSIOP 1
28
29#ifndef LINUX_VERSION_CODE
30#include <linux/version.h>
31#endif
32#define LINUXVERSION(v,p,s) (((v)<<16) + ((p)<<8) + (s))
33
34/************************************************/
35/* definition of standard data types */
36/************************************************/
37#define CHAR char
38#define UCHAR unsigned char
39#define SHORT short
40#define USHORT unsigned short
41#define BOOL long
42#define LONG long
43#define ULONG unsigned long
44#define VOID void
45
46typedef CHAR *PCHAR;
47typedef UCHAR *PUCHAR;
48typedef SHORT *PSHORT;
49typedef USHORT *PUSHORT;
50typedef BOOL *PBOOL;
51typedef LONG *PLONG;
52typedef ULONG *PULONG;
53typedef VOID *PVOID;
54
55
56/************************************************/
57/* Misc. macros */
58/************************************************/
59#define ANY2SCSI(up, p) \
60((UCHAR *)up)[0] = (((ULONG)(p)) >> 8); \
61((UCHAR *)up)[1] = ((ULONG)(p));
62
63#define SCSI2LONG(up) \
64( (((long)*(((UCHAR *)up))) << 16) \
65+ (((long)(((UCHAR *)up)[1])) << 8) \
66+ ((long)(((UCHAR *)up)[2])) )
67
68#define XANY2SCSI(up, p) \
69((UCHAR *)up)[0] = ((long)(p)) >> 24; \
70((UCHAR *)up)[1] = ((long)(p)) >> 16; \
71((UCHAR *)up)[2] = ((long)(p)) >> 8; \
72((UCHAR *)up)[3] = ((long)(p));
73
74#define XSCSI2LONG(up) \
75( (((long)(((UCHAR *)up)[0])) << 24) \
76+ (((long)(((UCHAR *)up)[1])) << 16) \
77+ (((long)(((UCHAR *)up)[2])) << 8) \
78+ ((long)(((UCHAR *)up)[3])) )
79
80/************************************************/
81/* SCSI CDB operation codes */
82/************************************************/
83#define SCSIOP_TEST_UNIT_READY 0x00
84#define SCSIOP_REZERO_UNIT 0x01
85#define SCSIOP_REWIND 0x01
86#define SCSIOP_REQUEST_BLOCK_ADDR 0x02
87#define SCSIOP_REQUEST_SENSE 0x03
88#define SCSIOP_FORMAT_UNIT 0x04
89#define SCSIOP_READ_BLOCK_LIMITS 0x05
90#define SCSIOP_REASSIGN_BLOCKS 0x07
91#define SCSIOP_READ6 0x08
92#define SCSIOP_RECEIVE 0x08
93#define SCSIOP_WRITE6 0x0A
94#define SCSIOP_PRINT 0x0A
95#define SCSIOP_SEND 0x0A
96#define SCSIOP_SEEK6 0x0B
97#define SCSIOP_TRACK_SELECT 0x0B
98#define SCSIOP_SLEW_PRINT 0x0B
99#define SCSIOP_SEEK_BLOCK 0x0C
100#define SCSIOP_PARTITION 0x0D
101#define SCSIOP_READ_REVERSE 0x0F
102#define SCSIOP_WRITE_FILEMARKS 0x10
103#define SCSIOP_FLUSH_BUFFER 0x10
104#define SCSIOP_SPACE 0x11
105#define SCSIOP_INQUIRY 0x12
106#define SCSIOP_VERIFY6 0x13
107#define SCSIOP_RECOVER_BUF_DATA 0x14
108#define SCSIOP_MODE_SELECT 0x15
109#define SCSIOP_RESERVE_UNIT 0x16
110#define SCSIOP_RELEASE_UNIT 0x17
111#define SCSIOP_COPY 0x18
112#define SCSIOP_ERASE 0x19
113#define SCSIOP_MODE_SENSE 0x1A
114#define SCSIOP_START_STOP_UNIT 0x1B
115#define SCSIOP_STOP_PRINT 0x1B
116#define SCSIOP_LOAD_UNLOAD 0x1B
117#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
118#define SCSIOP_SEND_DIAGNOSTIC 0x1D
119#define SCSIOP_MEDIUM_REMOVAL 0x1E
120#define SCSIOP_READ_CAPACITY 0x25
121#define SCSIOP_READ 0x28
122#define SCSIOP_WRITE 0x2A
123#define SCSIOP_SEEK 0x2B
124#define SCSIOP_LOCATE 0x2B
125#define SCSIOP_WRITE_VERIFY 0x2E
126#define SCSIOP_VERIFY 0x2F
127#define SCSIOP_SEARCH_DATA_HIGH 0x30
128#define SCSIOP_SEARCH_DATA_EQUAL 0x31
129#define SCSIOP_SEARCH_DATA_LOW 0x32
130#define SCSIOP_SET_LIMITS 0x33
131#define SCSIOP_READ_POSITION 0x34
132#define SCSIOP_SYNCHRONIZE_CACHE 0x35
133#define SCSIOP_COMPARE 0x39
134#define SCSIOP_COPY_COMPARE 0x3A
135#define SCSIOP_WRITE_DATA_BUFF 0x3B
136#define SCSIOP_READ_DATA_BUFF 0x3C
137#define SCSIOP_CHANGE_DEFINITION 0x40
138#define SCSIOP_READ_SUB_CHANNEL 0x42
139#define SCSIOP_READ_TOC 0x43
140#define SCSIOP_READ_HEADER 0x44
141#define SCSIOP_PLAY_AUDIO 0x45
142#define SCSIOP_PLAY_AUDIO_MSF 0x47
143#define SCSIOP_PLAY_TRACK_INDEX 0x48
144#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
145#define SCSIOP_PAUSE_RESUME 0x4B
146#define SCSIOP_LOG_SELECT 0x4C
147#define SCSIOP_LOG_SENSE 0x4D
148#define SCSIOP_MODE_SELECT10 0x55
149#define SCSIOP_MODE_SENSE10 0x5A
150#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
151#define SCSIOP_MECHANISM_STATUS 0xBD
152#define SCSIOP_READ_CD 0xBE
153
154// SCSI read capacity structure
155typedef struct _READ_CAPACITY_DATA
156 {
157 ULONG blks; /* total blocks (converted to little endian) */
158 ULONG blksiz; /* size of each (converted to little endian) */
159 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
160
161// SCSI inquiry data
162typedef struct _INQUIRYDATA
163 {
164 UCHAR DeviceType :5;
165 UCHAR DeviceTypeQualifier :3;
166 UCHAR DeviceTypeModifier :7;
167 UCHAR RemovableMedia :1;
168 UCHAR Versions;
169 UCHAR ResponseDataFormat;
170 UCHAR AdditionalLength;
171 UCHAR Reserved[2];
172 UCHAR SoftReset :1;
173 UCHAR CommandQueue :1;
174 UCHAR Reserved2 :1;
175 UCHAR LinkedCommands :1;
176 UCHAR Synchronous :1;
177 UCHAR Wide16Bit :1;
178 UCHAR Wide32Bit :1;
179 UCHAR RelativeAddressing :1;
180 UCHAR VendorId[8];
181 UCHAR ProductId[16];
182 UCHAR ProductRevisionLevel[4];
183 UCHAR VendorSpecific[20];
184 UCHAR Reserved3[40];
185 } INQUIRYDATA, *PINQUIRYDATA;
186
187#endif
188
189// function prototypes
190int Pci2000_Detect (Scsi_Host_Template *tpnt);
191int Pci2000_Command (Scsi_Cmnd *SCpnt);
192int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
193int Pci2000_Abort (Scsi_Cmnd *SCpnt);
194int Pci2000_Reset (Scsi_Cmnd *SCpnt, unsigned int flags);
195int Pci2000_Release (struct Scsi_Host *pshost);
196int Pci2000_BiosParam (struct scsi_device *sdev,
197 struct block_device *bdev,
198 sector_t capacity, int geom[]);
199
200#endif