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.
8 * Copyright (c) 1999-2005 LSI Logic Corporation
9 * (mailto:mpt_linux_developer@lsil.com)
12 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; version 2 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
24 THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
25 CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
26 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
27 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
28 solely responsible for determining the appropriateness of using and
29 distributing the Program and assumes all risks associated with its
30 exercise of rights under this Agreement, including but not limited to
31 the risks and costs of program errors, damage to or loss of data,
32 programs or equipment, and unavailability or interruption of operations.
34 DISCLAIMER OF LIABILITY
35 NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
38 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
39 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
40 USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
41 HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
43 You should have received a copy of the GNU General Public License
44 along with this program; if not, write to the Free Software
45 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
48 #ifndef MPTCTL_H_INCLUDED
49 #define MPTCTL_H_INCLUDED
50 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
52 #include "linux/version.h"
55 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
59 #define MPT_MISCDEV_BASENAME "mptctl"
60 #define MPT_MISCDEV_PATHNAME "/dev/" MPT_MISCDEV_BASENAME
62 #define MPT_PRODUCT_LENGTH 12
65 * Generic MPT Control IOCTLs and structures
67 #define MPT_MAGIC_NUMBER 'm'
69 #define MPTRWPERF _IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
71 #define MPTFWDOWNLOAD _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
72 #define MPTCOMMAND _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
74 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
75 #define MPTFWDOWNLOAD32 _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
76 #define MPTCOMMAND32 _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
79 #define MPTIOCINFO _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
80 #define MPTIOCINFO1 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
81 #define MPTIOCINFO2 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
82 #define MPTTARGETINFO _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
83 #define MPTTEST _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
84 #define MPTEVENTQUERY _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
85 #define MPTEVENTENABLE _IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
86 #define MPTEVENTREPORT _IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
87 #define MPTHARDRESET _IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
88 #define MPTFWREPLACE _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
91 * SPARC PLATFORM REMARKS:
92 * IOCTL data structures that contain pointers
93 * will have different sizes in the driver and applications
94 * (as the app. will not use 8-byte pointers).
95 * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
96 * The driver will convert data from
97 * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
100 * If data structures change size, must handle as in IOCGETINFO.
103 unsigned int iocnum
; /* IOC unit number */
105 void __user
*bufp
; /* Pointer to firmware buffer */
108 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
109 struct mpt_fw_xfer32
{
117 * IOCTL header structure.
118 * iocnum - must be defined.
119 * port - must be defined for all IOCTL commands other than MPTIOCINFO
120 * maxDataSize - ignored on MPTCOMMAND commands
121 * - ignored on MPTFWREPLACE commands
122 * - on query commands, reports the maximum number of bytes to be returned
123 * to the host driver (count includes the header).
124 * That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
125 * Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
126 * sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
128 typedef struct _mpt_ioctl_header
{
129 unsigned int iocnum
; /* IOC unit number */
130 unsigned int port
; /* IOC port number */
131 int maxDataSize
; /* Maximum Num. bytes to transfer on read */
135 * Issue a diagnostic reset
137 struct mpt_ioctl_diag_reset
{
138 mpt_ioctl_header hdr
;
143 * PCI bus/device/function information structure.
145 struct mpt_ioctl_pci_info
{
148 unsigned int deviceNumber
: 5;
149 unsigned int functionNumber
: 3;
150 unsigned int busNumber
: 24;
152 unsigned int asUlong
;
156 struct mpt_ioctl_pci_info2
{
159 unsigned int deviceNumber
: 5;
160 unsigned int functionNumber
: 3;
161 unsigned int busNumber
: 24;
163 unsigned int asUlong
;
169 * Adapter Information Page
171 * Data starts at offset 0xC
173 #define MPT_IOCTL_INTERFACE_FC (0x01)
174 #define MPT_IOCTL_INTERFACE_SCSI (0x00)
175 #define MPT_IOCTL_VERSION_LENGTH (32)
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) */
192 struct mpt_ioctl_pci_info2 pciInfo
; /* Added Rev 2 */
195 struct mpt_ioctl_iocinfo_rev1
{
196 mpt_ioctl_header hdr
;
197 int adapterType
; /* SCSI or FCP */
198 int port
; /* port number */
199 int pciId
; /* PCI Id. */
200 int hwRev
; /* hardware revision */
201 int subSystemDevice
; /* PCI subsystem Device ID */
202 int subSystemVendor
; /* PCI subsystem Vendor ID */
203 int numDevices
; /* number of devices */
204 int FWVersion
; /* FW Version (integer) */
205 int BIOSVersion
; /* BIOS Version (integer) */
206 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
210 struct mpt_ioctl_pci_info pciInfo
; /* Added Rev 1 */
213 /* Original structure, must always accept these
214 * IOCTLs. 4 byte pads can occur based on arch with
215 * above structure. Wish to re-align, but cannot.
217 struct mpt_ioctl_iocinfo_rev0
{
218 mpt_ioctl_header hdr
;
219 int adapterType
; /* SCSI or FCP */
220 int port
; /* port number */
221 int pciId
; /* PCI Id. */
222 int hwRev
; /* hardware revision */
223 int subSystemDevice
; /* PCI subsystem Device ID */
224 int subSystemVendor
; /* PCI subsystem Vendor ID */
225 int numDevices
; /* number of devices */
226 int FWVersion
; /* FW Version (integer) */
227 int BIOSVersion
; /* BIOS Version (integer) */
228 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
235 * Device Information Page
236 * Report the number of, and ids of, all targets
237 * on this IOC. The ids array is a packed structure
238 * of the known targetInfo.
239 * bits 31-24: reserved
244 struct mpt_ioctl_targetinfo
{
245 mpt_ioctl_header hdr
;
246 int numDevices
; /* Num targets on this ioc */
252 * Event reporting IOCTL's. These IOCTL's will
253 * use the following defines:
255 struct mpt_ioctl_eventquery
{
256 mpt_ioctl_header hdr
;
257 unsigned short eventEntries
;
258 unsigned short reserved
;
259 unsigned int eventTypes
;
262 struct mpt_ioctl_eventenable
{
263 mpt_ioctl_header hdr
;
264 unsigned int eventTypes
;
275 struct mpt_ioctl_eventreport
{
276 mpt_ioctl_header hdr
;
277 MPT_IOCTL_EVENTS eventData
[1];
280 #define MPT_MAX_NAME 32
281 struct mpt_ioctl_test
{
282 mpt_ioctl_header hdr
;
283 u8 name
[MPT_MAX_NAME
];
285 u8 product
[MPT_PRODUCT_LENGTH
];
288 /* Replace the FW image cached in host driver memory
289 * newImageSize - image size in bytes
290 * newImage - first byte of the new image
292 typedef struct mpt_ioctl_replace_fw
{
293 mpt_ioctl_header hdr
;
296 } mpt_ioctl_replace_fw_t
;
298 /* General MPT Pass through data strucutre
301 * timeout - in seconds, command timeout. If 0, set by driver to
303 * replyFrameBufPtr - reply location
304 * dataInBufPtr - destination for read
305 * dataOutBufPtr - data source for write
306 * senseDataPtr - sense data location
307 * maxReplyBytes - maximum number of reply bytes to be sent to app.
308 * dataInSize - num bytes for data transfer in (read)
309 * dataOutSize - num bytes for data transfer out (write)
310 * dataSgeOffset - offset in words from the start of the request message
314 * Remark: Some config pages have bi-directional transfer,
315 * both a read and a write. The basic structure allows for
316 * a bidirectional set up. Normal messages will have one or
317 * both of these buffers NULL.
319 struct mpt_ioctl_command
{
320 mpt_ioctl_header hdr
;
321 int timeout
; /* optional (seconds) */
322 char __user
*replyFrameBufPtr
;
323 char __user
*dataInBufPtr
;
324 char __user
*dataOutBufPtr
;
325 char __user
*senseDataPtr
;
335 * SPARC PLATFORM: See earlier remark.
337 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
338 struct mpt_ioctl_command32
{
339 mpt_ioctl_header hdr
;
341 u32 replyFrameBufPtr
;
355 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
357 * HP Specific IOCTL Defines and Structures
360 #define CPQFCTS_IOC_MAGIC 'Z'
361 #define HP_IOC_MAGIC 'Z'
362 #define HP_GETHOSTINFO _IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
363 #define HP_GETHOSTINFO1 _IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
364 #define HP_GETTARGETINFO _IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
366 /* All HP IOCTLs must include this header
368 typedef struct _hp_header
{
371 unsigned int channel
;
378 * iocnum required (input)
384 typedef struct _hp_host_info
{
388 u16 subsystem_vendor
;
392 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
393 u8 fw_version
[16]; /* string */
394 u8 serial_number
[24]; /* string */
399 unsigned int hard_resets
; /* driver initiated resets */
400 unsigned int soft_resets
; /* ioc, external resets */
401 unsigned int timeouts
; /* num timeouts */
404 /* replace ulongs with uints, need to preserve backwards
407 typedef struct _hp_host_info_rev0
{
411 u16 subsystem_vendor
;
415 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
416 u8 fw_version
[16]; /* string */
417 u8 serial_number
[24]; /* string */
422 unsigned long hard_resets
; /* driver initiated resets */
423 unsigned long soft_resets
; /* ioc, external resets */
424 unsigned long timeouts
; /* num timeouts */
425 } hp_host_info_rev0_t
;
429 * iocnum required (input)
431 * channel required (bus number)
435 * All error values between 0 and 0xFFFF in size.
437 typedef struct _hp_target_info
{
443 u32 negotiated_speed
;
445 u8 rsvd
[7]; /* 8 byte alignment */
448 #define HP_STATUS_OTHER 1
449 #define HP_STATUS_OK 2
450 #define HP_STATUS_FAILED 3
452 #define HP_BUS_WIDTH_UNK 1
453 #define HP_BUS_WIDTH_8 2
454 #define HP_BUS_WIDTH_16 3
455 #define HP_BUS_WIDTH_32 4
457 #define HP_DEV_SPEED_ASYNC 2
458 #define HP_DEV_SPEED_FAST 3
459 #define HP_DEV_SPEED_ULTRA 4
460 #define HP_DEV_SPEED_ULTRA2 5
461 #define HP_DEV_SPEED_ULTRA160 6
462 #define HP_DEV_SPEED_SCSI1 7
463 #define HP_DEV_SPEED_ULTRA320 8
465 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
468 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/