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 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
54 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
58 #define MPT_MISCDEV_BASENAME "mptctl"
59 #define MPT_MISCDEV_PATHNAME "/dev/" MPT_MISCDEV_BASENAME
61 #define MPT_PRODUCT_LENGTH 12
64 * Generic MPT Control IOCTLs and structures
66 #define MPT_MAGIC_NUMBER 'm'
68 #define MPTRWPERF _IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
70 #define MPTFWDOWNLOAD _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
71 #define MPTCOMMAND _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
73 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
74 #define MPTFWDOWNLOAD32 _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
75 #define MPTCOMMAND32 _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
78 #define MPTIOCINFO _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
79 #define MPTIOCINFO1 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
80 #define MPTIOCINFO2 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
81 #define MPTTARGETINFO _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
82 #define MPTTEST _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
83 #define MPTEVENTQUERY _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
84 #define MPTEVENTENABLE _IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
85 #define MPTEVENTREPORT _IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
86 #define MPTHARDRESET _IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
87 #define MPTFWREPLACE _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
90 * SPARC PLATFORM REMARKS:
91 * IOCTL data structures that contain pointers
92 * will have different sizes in the driver and applications
93 * (as the app. will not use 8-byte pointers).
94 * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
95 * The driver will convert data from
96 * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
99 * If data structures change size, must handle as in IOCGETINFO.
102 unsigned int iocnum
; /* IOC unit number */
104 void __user
*bufp
; /* Pointer to firmware buffer */
107 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
108 struct mpt_fw_xfer32
{
116 * IOCTL header structure.
117 * iocnum - must be defined.
118 * port - must be defined for all IOCTL commands other than MPTIOCINFO
119 * maxDataSize - ignored on MPTCOMMAND commands
120 * - ignored on MPTFWREPLACE commands
121 * - on query commands, reports the maximum number of bytes to be returned
122 * to the host driver (count includes the header).
123 * That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
124 * Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
125 * sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
127 typedef struct _mpt_ioctl_header
{
128 unsigned int iocnum
; /* IOC unit number */
129 unsigned int port
; /* IOC port number */
130 int maxDataSize
; /* Maximum Num. bytes to transfer on read */
134 * Issue a diagnostic reset
136 struct mpt_ioctl_diag_reset
{
137 mpt_ioctl_header hdr
;
142 * PCI bus/device/function information structure.
144 struct mpt_ioctl_pci_info
{
147 unsigned int deviceNumber
: 5;
148 unsigned int functionNumber
: 3;
149 unsigned int busNumber
: 24;
151 unsigned int asUlong
;
155 struct mpt_ioctl_pci_info2
{
158 unsigned int deviceNumber
: 5;
159 unsigned int functionNumber
: 3;
160 unsigned int busNumber
: 24;
162 unsigned int asUlong
;
168 * Adapter Information Page
170 * Data starts at offset 0xC
172 #define MPT_IOCTL_INTERFACE_FC (0x01)
173 #define MPT_IOCTL_INTERFACE_SCSI (0x00)
174 #define MPT_IOCTL_VERSION_LENGTH (32)
176 struct mpt_ioctl_iocinfo
{
177 mpt_ioctl_header hdr
;
178 int adapterType
; /* SCSI or FCP */
179 int port
; /* port number */
180 int pciId
; /* PCI Id. */
181 int hwRev
; /* hardware revision */
182 int subSystemDevice
; /* PCI subsystem Device ID */
183 int subSystemVendor
; /* PCI subsystem Vendor ID */
184 int numDevices
; /* number of devices */
185 int FWVersion
; /* FW Version (integer) */
186 int BIOSVersion
; /* BIOS Version (integer) */
187 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
191 struct mpt_ioctl_pci_info2 pciInfo
; /* Added Rev 2 */
194 struct mpt_ioctl_iocinfo_rev1
{
195 mpt_ioctl_header hdr
;
196 int adapterType
; /* SCSI or FCP */
197 int port
; /* port number */
198 int pciId
; /* PCI Id. */
199 int hwRev
; /* hardware revision */
200 int subSystemDevice
; /* PCI subsystem Device ID */
201 int subSystemVendor
; /* PCI subsystem Vendor ID */
202 int numDevices
; /* number of devices */
203 int FWVersion
; /* FW Version (integer) */
204 int BIOSVersion
; /* BIOS Version (integer) */
205 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
209 struct mpt_ioctl_pci_info pciInfo
; /* Added Rev 1 */
212 /* Original structure, must always accept these
213 * IOCTLs. 4 byte pads can occur based on arch with
214 * above structure. Wish to re-align, but cannot.
216 struct mpt_ioctl_iocinfo_rev0
{
217 mpt_ioctl_header hdr
;
218 int adapterType
; /* SCSI or FCP */
219 int port
; /* port number */
220 int pciId
; /* PCI Id. */
221 int hwRev
; /* hardware revision */
222 int subSystemDevice
; /* PCI subsystem Device ID */
223 int subSystemVendor
; /* PCI subsystem Vendor ID */
224 int numDevices
; /* number of devices */
225 int FWVersion
; /* FW Version (integer) */
226 int BIOSVersion
; /* BIOS Version (integer) */
227 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
234 * Device Information Page
235 * Report the number of, and ids of, all targets
236 * on this IOC. The ids array is a packed structure
237 * of the known targetInfo.
238 * bits 31-24: reserved
243 struct mpt_ioctl_targetinfo
{
244 mpt_ioctl_header hdr
;
245 int numDevices
; /* Num targets on this ioc */
251 * Event reporting IOCTL's. These IOCTL's will
252 * use the following defines:
254 struct mpt_ioctl_eventquery
{
255 mpt_ioctl_header hdr
;
256 unsigned short eventEntries
;
257 unsigned short reserved
;
258 unsigned int eventTypes
;
261 struct mpt_ioctl_eventenable
{
262 mpt_ioctl_header hdr
;
263 unsigned int eventTypes
;
274 struct mpt_ioctl_eventreport
{
275 mpt_ioctl_header hdr
;
276 MPT_IOCTL_EVENTS eventData
[1];
279 #define MPT_MAX_NAME 32
280 struct mpt_ioctl_test
{
281 mpt_ioctl_header hdr
;
282 u8 name
[MPT_MAX_NAME
];
284 u8 product
[MPT_PRODUCT_LENGTH
];
287 /* Replace the FW image cached in host driver memory
288 * newImageSize - image size in bytes
289 * newImage - first byte of the new image
291 typedef struct mpt_ioctl_replace_fw
{
292 mpt_ioctl_header hdr
;
295 } mpt_ioctl_replace_fw_t
;
297 /* General MPT Pass through data strucutre
300 * timeout - in seconds, command timeout. If 0, set by driver to
302 * replyFrameBufPtr - reply location
303 * dataInBufPtr - destination for read
304 * dataOutBufPtr - data source for write
305 * senseDataPtr - sense data location
306 * maxReplyBytes - maximum number of reply bytes to be sent to app.
307 * dataInSize - num bytes for data transfer in (read)
308 * dataOutSize - num bytes for data transfer out (write)
309 * dataSgeOffset - offset in words from the start of the request message
313 * Remark: Some config pages have bi-directional transfer,
314 * both a read and a write. The basic structure allows for
315 * a bidirectional set up. Normal messages will have one or
316 * both of these buffers NULL.
318 struct mpt_ioctl_command
{
319 mpt_ioctl_header hdr
;
320 int timeout
; /* optional (seconds) */
321 char __user
*replyFrameBufPtr
;
322 char __user
*dataInBufPtr
;
323 char __user
*dataOutBufPtr
;
324 char __user
*senseDataPtr
;
334 * SPARC PLATFORM: See earlier remark.
336 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
337 struct mpt_ioctl_command32
{
338 mpt_ioctl_header hdr
;
340 u32 replyFrameBufPtr
;
354 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
356 * HP Specific IOCTL Defines and Structures
359 #define CPQFCTS_IOC_MAGIC 'Z'
360 #define HP_IOC_MAGIC 'Z'
361 #define HP_GETHOSTINFO _IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
362 #define HP_GETHOSTINFO1 _IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
363 #define HP_GETTARGETINFO _IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
365 /* All HP IOCTLs must include this header
367 typedef struct _hp_header
{
370 unsigned int channel
;
377 * iocnum required (input)
383 typedef struct _hp_host_info
{
387 u16 subsystem_vendor
;
391 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
392 u8 fw_version
[16]; /* string */
393 u8 serial_number
[24]; /* string */
398 unsigned int hard_resets
; /* driver initiated resets */
399 unsigned int soft_resets
; /* ioc, external resets */
400 unsigned int timeouts
; /* num timeouts */
403 /* replace ulongs with uints, need to preserve backwards
406 typedef struct _hp_host_info_rev0
{
410 u16 subsystem_vendor
;
414 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
415 u8 fw_version
[16]; /* string */
416 u8 serial_number
[24]; /* string */
421 unsigned long hard_resets
; /* driver initiated resets */
422 unsigned long soft_resets
; /* ioc, external resets */
423 unsigned long timeouts
; /* num timeouts */
424 } hp_host_info_rev0_t
;
428 * iocnum required (input)
430 * channel required (bus number)
434 * All error values between 0 and 0xFFFF in size.
436 typedef struct _hp_target_info
{
442 u32 negotiated_speed
;
444 u8 rsvd
[7]; /* 8 byte alignment */
447 #define HP_STATUS_OTHER 1
448 #define HP_STATUS_OK 2
449 #define HP_STATUS_FAILED 3
451 #define HP_BUS_WIDTH_UNK 1
452 #define HP_BUS_WIDTH_8 2
453 #define HP_BUS_WIDTH_16 3
454 #define HP_BUS_WIDTH_32 4
456 #define HP_DEV_SPEED_ASYNC 2
457 #define HP_DEV_SPEED_FAST 3
458 #define HP_DEV_SPEED_ULTRA 4
459 #define HP_DEV_SPEED_ULTRA2 5
460 #define HP_DEV_SPEED_ULTRA160 6
461 #define HP_DEV_SPEED_SCSI1 7
462 #define HP_DEV_SPEED_ULTRA320 8
464 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
467 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/