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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [message/] [fusion/] [mptctl.h] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  linux/drivers/message/fusion/mptioctl.h
3
 *      Fusion MPT misc device (ioctl) driver.
4
 *      For use with PCI chip/adapter(s):
5
 *          LSIFC9xx/LSI409xx Fibre Channel
6
 *      running LSI Logic Fusion MPT (Message Passing Technology) firmware.
7
 *
8
 *  Credits:
9
 *      This driver would not exist if not for Alan Cox's development
10
 *      of the linux i2o driver.
11
 *
12
 *      A huge debt of gratitude is owed to David S. Miller (DaveM)
13
 *      for fixing much of the stupid and broken stuff in the early
14
 *      driver while porting to sparc64 platform.  THANK YOU!
15
 *
16
 *      (see also mptbase.c)
17
 *
18
 *  Copyright (c) 1999-2002 LSI Logic Corporation
19
 *  Originally By: Steven J. Ralston
20
 *  (mailto:sjralston1@netscape.net)
21
 *  (mailto:mpt_linux_developer@lsil.com)
22
 *
23
 *  $Id: mptctl.h,v 1.1.1.1 2004-04-15 02:27:36 phoenix Exp $
24
 */
25
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
26
/*
27
    This program is free software; you can redistribute it and/or modify
28
    it under the terms of the GNU General Public License as published by
29
    the Free Software Foundation; version 2 of the License.
30
 
31
    This program is distributed in the hope that it will be useful,
32
    but WITHOUT ANY WARRANTY; without even the implied warranty of
33
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
    GNU General Public License for more details.
35
 
36
    NO WARRANTY
37
    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
38
    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
39
    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
40
    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
41
    solely responsible for determining the appropriateness of using and
42
    distributing the Program and assumes all risks associated with its
43
    exercise of rights under this Agreement, including but not limited to
44
    the risks and costs of program errors, damage to or loss of data,
45
    programs or equipment, and unavailability or interruption of operations.
46
 
47
    DISCLAIMER OF LIABILITY
48
    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
49
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
51
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
52
    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
53
    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
54
    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
55
 
56
    You should have received a copy of the GNU General Public License
57
    along with this program; if not, write to the Free Software
58
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
59
*/
60
 
61
#ifndef MPTCTL_H_INCLUDED
62
#define MPTCTL_H_INCLUDED
63
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
64
 
65
#include "linux/version.h"
66
 
67
 
68
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
69
/*
70
 *
71
 */
72
#define MPT_MISCDEV_BASENAME            "mptctl"
73
#define MPT_MISCDEV_PATHNAME            "/dev/" MPT_MISCDEV_BASENAME
74
 
75
#define MPT_PRODUCT_LENGTH              12
76
 
77
/*
78
 *  Generic MPT Control IOCTLs and structures
79
 */
80
#define MPT_MAGIC_NUMBER        'm'
81
 
82
#define MPTRWPERF               _IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
83
 
84
#define MPTFWDOWNLOAD           _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
85
#define MPTCOMMAND              _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
86
 
87
#if defined(__KERNEL__) && defined(MPT_CONFIG_COMPAT)
88
#define MPTFWDOWNLOAD32         _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
89
#define MPTCOMMAND32            _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
90
#endif
91
 
92
#define MPTIOCINFO              _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
93
#define MPTIOCINFO1             _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
94
#define MPTTARGETINFO           _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
95
#define MPTTEST                 _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
96
#define MPTEVENTQUERY           _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
97
#define MPTEVENTENABLE          _IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
98
#define MPTEVENTREPORT          _IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
99
#define MPTHARDRESET            _IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
100
#define MPTFWREPLACE            _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
101
 
102
/*
103
 * SPARC PLATFORM REMARKS:
104
 * IOCTL data structures that contain pointers
105
 * will have different sizes in the driver and applications
106
 * (as the app. will not use 8-byte pointers).
107
 * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
108
 * The driver will convert data from
109
 * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
110
 * internally.
111
 *
112
 * If data structures change size, must handle as in IOCGETINFO.
113
 */
114
struct mpt_fw_xfer {
115
        unsigned int     iocnum;        /* IOC unit number */
116
        unsigned int     fwlen;
117
        void            *bufp;          /* Pointer to firmware buffer */
118
};
119
 
120
#if defined(__KERNEL__) && defined(MPT_CONFIG_COMPAT)
121
struct mpt_fw_xfer32 {
122
        unsigned int iocnum;
123
        unsigned int fwlen;
124
        u32 bufp;
125
};
126
#endif
127
 
128
/*
129
 *  IOCTL header structure.
130
 *  iocnum - must be defined.
131
 *  port - must be defined for all IOCTL commands other than MPTIOCINFO
132
 *  maxDataSize - ignored on MPTCOMMAND commands
133
 *              - ignored on MPTFWREPLACE commands
134
 *              - on query commands, reports the maximum number of bytes to be returned
135
 *                to the host driver (count includes the header).
136
 *                That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
137
 *                Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
138
 *                      sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
139
 */
140
typedef struct _mpt_ioctl_header {
141
        unsigned int     iocnum;        /* IOC unit number */
142
        unsigned int     port;          /* IOC port number */
143
        int              maxDataSize;   /* Maximum Num. bytes to transfer on read */
144
} mpt_ioctl_header;
145
 
146
/*
147
 * Issue a diagnostic reset
148
 */
149
struct mpt_ioctl_diag_reset {
150
        mpt_ioctl_header hdr;
151
};
152
 
153
 
154
/*
155
 *  PCI bus/device/function information structure.
156
 */
157
struct mpt_ioctl_pci_info {
158
        union {
159
                struct {
160
                        unsigned int  deviceNumber   :  5;
161
                        unsigned int  functionNumber :  3;
162
                        unsigned int  busNumber      : 24;
163
                } bits;
164
                unsigned int  asUlong;
165
        } u;
166
};
167
 
168
/*
169
 *  Adapter Information Page
170
 *  Read only.
171
 *  Data starts at offset 0xC
172
 */
173
#define MPT_IOCTL_INTERFACE_FC          (0x01)
174
#define MPT_IOCTL_INTERFACE_SCSI        (0x00)
175
#define MPT_IOCTL_VERSION_LENGTH        (32)
176
 
177
struct mpt_ioctl_iocinfo {
178
        mpt_ioctl_header hdr;
179
        int              adapterType;   /* SCSI or FCP */
180
        int              port;          /* port number */
181
        int              pciId;         /* PCI Id. */
182
        int              hwRev;         /* hardware revision */
183
        int              subSystemDevice;       /* PCI subsystem Device ID */
184
        int              subSystemVendor;       /* PCI subsystem Vendor ID */
185
        int              numDevices;            /* number of devices */
186
        int              FWVersion;             /* FW Version (integer) */
187
        int              BIOSVersion;           /* BIOS Version (integer) */
188
        char             driverVersion[MPT_IOCTL_VERSION_LENGTH];       /* Driver Version (string) */
189
        char             busChangeEvent;
190
        char             hostId;
191
        char             rsvd[2];
192
        struct mpt_ioctl_pci_info  pciInfo; /* Added Rev 1 */
193
};
194
 
195
/* Original structure, must always accept these
196
 * IOCTLs. 4 byte pads can occur based on arch with
197
 * above structure. Wish to re-align, but cannot.
198
 */
199
struct mpt_ioctl_iocinfo_rev0 {
200
        mpt_ioctl_header hdr;
201
        int              adapterType;   /* SCSI or FCP */
202
        int              port;          /* port number */
203
        int              pciId;         /* PCI Id. */
204
        int              hwRev;         /* hardware revision */
205
        int              subSystemDevice;       /* PCI subsystem Device ID */
206
        int              subSystemVendor;       /* PCI subsystem Vendor ID */
207
        int              numDevices;            /* number of devices */
208
        int              FWVersion;             /* FW Version (integer) */
209
        int              BIOSVersion;           /* BIOS Version (integer) */
210
        char             driverVersion[MPT_IOCTL_VERSION_LENGTH];       /* Driver Version (string) */
211
        char             busChangeEvent;
212
        char             hostId;
213
        char             rsvd[2];
214
};
215
 
216
/*
217
 * Device Information Page
218
 * Report the number of, and ids of, all targets
219
 * on this IOC.  The ids array is a packed structure
220
 * of the known targetInfo.
221
 * bits 31-24: reserved
222
 *      23-16: LUN
223
 *      15- 8: Bus Number
224
 *       7- 0: Target ID
225
 */
226
struct mpt_ioctl_targetinfo {
227
        mpt_ioctl_header hdr;
228
        int              numDevices;    /* Num targets on this ioc */
229
        int              targetInfo[1];
230
};
231
 
232
 
233
/*
234
 * Event reporting IOCTL's.  These IOCTL's will
235
 * use the following defines:
236
 */
237
struct mpt_ioctl_eventquery {
238
        mpt_ioctl_header hdr;
239
        unsigned short   eventEntries;
240
        unsigned short   reserved;
241
        unsigned int     eventTypes;
242
};
243
 
244
struct mpt_ioctl_eventenable {
245
        mpt_ioctl_header hdr;
246
        unsigned int     eventTypes;
247
};
248
 
249
#ifndef __KERNEL__
250
typedef struct {
251
        uint    event;
252
        uint    eventContext;
253
        uint    data[2];
254
} MPT_IOCTL_EVENTS;
255
#endif
256
 
257
struct mpt_ioctl_eventreport {
258
        mpt_ioctl_header        hdr;
259
        MPT_IOCTL_EVENTS        eventData[1];
260
};
261
 
262
#define MPT_MAX_NAME    32
263
struct mpt_ioctl_test {
264
        mpt_ioctl_header hdr;
265
        u8               name[MPT_MAX_NAME];
266
        int              chip_type;
267
        u8               product [MPT_PRODUCT_LENGTH];
268
};
269
 
270
/* Replace the FW image cached in host driver memory
271
 * newImageSize - image size in bytes
272
 * newImage - first byte of the new image
273
 */
274
typedef struct mpt_ioctl_replace_fw {
275
        mpt_ioctl_header hdr;
276
        int              newImageSize;
277
        u8               newImage[1];
278
} mpt_ioctl_replace_fw_t;
279
 
280
/* General MPT Pass through data strucutre
281
 *
282
 * iocnum
283
 * timeout - in seconds, command timeout. If 0, set by driver to
284
 *              default value.
285
 * replyFrameBufPtr - reply location
286
 * dataInBufPtr - destination for read
287
 * dataOutBufPtr - data source for write
288
 * senseDataPtr - sense data location
289
 * maxReplyBytes - maximum number of reply bytes to be sent to app.
290
 * dataInSize - num bytes for data transfer in (read)
291
 * dataOutSize - num bytes for data transfer out (write)
292
 * dataSgeOffset - offset in words from the start of the request message
293
 *              to the first SGL
294
 * MF[1];
295
 *
296
 * Remark:  Some config pages have bi-directional transfer,
297
 * both a read and a write. The basic structure allows for
298
 * a bidirectional set up. Normal messages will have one or
299
 * both of these buffers NULL.
300
 */
301
struct mpt_ioctl_command {
302
        mpt_ioctl_header hdr;
303
        int             timeout;        /* optional (seconds) */
304
        char            *replyFrameBufPtr;
305
        char            *dataInBufPtr;
306
        char            *dataOutBufPtr;
307
        char            *senseDataPtr;
308
        int             maxReplyBytes;
309
        int             dataInSize;
310
        int             dataOutSize;
311
        int             maxSenseBytes;
312
        int             dataSgeOffset;
313
        char            MF[1];
314
};
315
 
316
/*
317
 * SPARC PLATFORM: See earlier remark.
318
 */
319
#if defined(__KERNEL__) && defined(MPT_CONFIG_COMPAT)
320
struct mpt_ioctl_command32 {
321
        mpt_ioctl_header hdr;
322
        int     timeout;
323
        u32     replyFrameBufPtr;
324
        u32     dataInBufPtr;
325
        u32     dataOutBufPtr;
326
        u32     senseDataPtr;
327
        int     maxReplyBytes;
328
        int     dataInSize;
329
        int     dataOutSize;
330
        int     maxSenseBytes;
331
        int     dataSgeOffset;
332
        char    MF[1];
333
};
334
#endif
335
 
336
 
337
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
338
/*
339
 *      HP Specific IOCTL Defines and Structures
340
 */
341
 
342
#define CPQFCTS_IOC_MAGIC 'Z'
343
#define HP_IOC_MAGIC 'Z'
344
#define HP_GETHOSTINFO          _IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
345
#define HP_GETHOSTINFO1         _IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
346
#define HP_GETTARGETINFO        _IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
347
 
348
/* All HP IOCTLs must include this header
349
 */
350
typedef struct _hp_header {
351
        unsigned int iocnum;
352
        unsigned int host;
353
        unsigned int channel;
354
        unsigned int id;
355
        unsigned int lun;
356
} hp_header_t;
357
 
358
/*
359
 *  Header:
360
 *  iocnum      required (input)
361
 *  host        ignored
362
 *  channe      ignored
363
 *  id          ignored
364
 *  lun         ignored
365
 */
366
typedef struct _hp_host_info {
367
        hp_header_t      hdr;
368
        u16              vendor;
369
        u16              device;
370
        u16              subsystem_vendor;
371
        u16              subsystem_id;
372
        u8               devfn;
373
        u8               bus;
374
        ushort           host_no;               /* SCSI Host number, if scsi driver not loaded*/
375
        u8               fw_version[16];        /* string */
376
        u8               serial_number[24];     /* string */
377
        u32              ioc_status;
378
        u32              bus_phys_width;
379
        u32              base_io_addr;
380
        u32              rsvd;
381
        unsigned int     hard_resets;           /* driver initiated resets */
382
        unsigned int     soft_resets;           /* ioc, external resets */
383
        unsigned int     timeouts;              /* num timeouts */
384
} hp_host_info_t;
385
 
386
/* replace ulongs with uints, need to preserve backwards
387
 * compatibility.
388
 */
389
typedef struct _hp_host_info_rev0 {
390
        hp_header_t      hdr;
391
        u16              vendor;
392
        u16              device;
393
        u16              subsystem_vendor;
394
        u16              subsystem_id;
395
        u8               devfn;
396
        u8               bus;
397
        ushort           host_no;               /* SCSI Host number, if scsi driver not loaded*/
398
        u8               fw_version[16];        /* string */
399
        u8               serial_number[24];     /* string */
400
        u32              ioc_status;
401
        u32              bus_phys_width;
402
        u32              base_io_addr;
403
        u32              rsvd;
404
        unsigned long    hard_resets;           /* driver initiated resets */
405
        unsigned long    soft_resets;           /* ioc, external resets */
406
        unsigned long    timeouts;              /* num timeouts */
407
} hp_host_info_rev0_t;
408
 
409
/*
410
 *  Header:
411
 *  iocnum      required (input)
412
 *  host        required
413
 *  channel     required        (bus number)
414
 *  id          required
415
 *  lun         ignored
416
 *
417
 *  All error values between 0 and 0xFFFF in size.
418
 */
419
typedef struct _hp_target_info {
420
        hp_header_t      hdr;
421
        u32 parity_errors;
422
        u32 phase_errors;
423
        u32 select_timeouts;
424
        u32 message_rejects;
425
        u32 negotiated_speed;
426
        u8  negotiated_width;
427
        u8  rsvd[7];                            /* 8 byte alignment */
428
} hp_target_info_t;
429
 
430
#define HP_STATUS_OTHER         1
431
#define HP_STATUS_OK            2
432
#define HP_STATUS_FAILED        3
433
 
434
#define HP_BUS_WIDTH_UNK        1
435
#define HP_BUS_WIDTH_8          2
436
#define HP_BUS_WIDTH_16         3
437
#define HP_BUS_WIDTH_32         4
438
 
439
#define HP_DEV_SPEED_ASYNC      2
440
#define HP_DEV_SPEED_FAST       3
441
#define HP_DEV_SPEED_ULTRA      4
442
#define HP_DEV_SPEED_ULTRA2     5
443
#define HP_DEV_SPEED_ULTRA160   6
444
#define HP_DEV_SPEED_SCSI1      7
445
#define HP_DEV_SPEED_ULTRA320   8
446
 
447
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
448
 
449
 
450
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
451
 
452
#endif
453
 

powered by: WebSVN 2.1.0

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