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_SCSI (0x00)
173 #define MPT_IOCTL_INTERFACE_FC (0x01)
174 #define MPT_IOCTL_INTERFACE_FC_IP (0x02)
175 #define MPT_IOCTL_INTERFACE_SAS (0x03)
176 #define MPT_IOCTL_VERSION_LENGTH (32)
178 struct mpt_ioctl_iocinfo
{
179 mpt_ioctl_header hdr
;
180 int adapterType
; /* SCSI or FCP */
181 int port
; /* port number */
182 int pciId
; /* PCI Id. */
183 int hwRev
; /* hardware revision */
184 int subSystemDevice
; /* PCI subsystem Device ID */
185 int subSystemVendor
; /* PCI subsystem Vendor ID */
186 int numDevices
; /* number of devices */
187 int FWVersion
; /* FW Version (integer) */
188 int BIOSVersion
; /* BIOS Version (integer) */
189 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
193 struct mpt_ioctl_pci_info2 pciInfo
; /* Added Rev 2 */
196 struct mpt_ioctl_iocinfo_rev1
{
197 mpt_ioctl_header hdr
;
198 int adapterType
; /* SCSI or FCP */
199 int port
; /* port number */
200 int pciId
; /* PCI Id. */
201 int hwRev
; /* hardware revision */
202 int subSystemDevice
; /* PCI subsystem Device ID */
203 int subSystemVendor
; /* PCI subsystem Vendor ID */
204 int numDevices
; /* number of devices */
205 int FWVersion
; /* FW Version (integer) */
206 int BIOSVersion
; /* BIOS Version (integer) */
207 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
211 struct mpt_ioctl_pci_info pciInfo
; /* Added Rev 1 */
214 /* Original structure, must always accept these
215 * IOCTLs. 4 byte pads can occur based on arch with
216 * above structure. Wish to re-align, but cannot.
218 struct mpt_ioctl_iocinfo_rev0
{
219 mpt_ioctl_header hdr
;
220 int adapterType
; /* SCSI or FCP */
221 int port
; /* port number */
222 int pciId
; /* PCI Id. */
223 int hwRev
; /* hardware revision */
224 int subSystemDevice
; /* PCI subsystem Device ID */
225 int subSystemVendor
; /* PCI subsystem Vendor ID */
226 int numDevices
; /* number of devices */
227 int FWVersion
; /* FW Version (integer) */
228 int BIOSVersion
; /* BIOS Version (integer) */
229 char driverVersion
[MPT_IOCTL_VERSION_LENGTH
]; /* Driver Version (string) */
236 * Device Information Page
237 * Report the number of, and ids of, all targets
238 * on this IOC. The ids array is a packed structure
239 * of the known targetInfo.
240 * bits 31-24: reserved
245 struct mpt_ioctl_targetinfo
{
246 mpt_ioctl_header hdr
;
247 int numDevices
; /* Num targets on this ioc */
253 * Event reporting IOCTL's. These IOCTL's will
254 * use the following defines:
256 struct mpt_ioctl_eventquery
{
257 mpt_ioctl_header hdr
;
258 unsigned short eventEntries
;
259 unsigned short reserved
;
260 unsigned int eventTypes
;
263 struct mpt_ioctl_eventenable
{
264 mpt_ioctl_header hdr
;
265 unsigned int eventTypes
;
276 struct mpt_ioctl_eventreport
{
277 mpt_ioctl_header hdr
;
278 MPT_IOCTL_EVENTS eventData
[1];
281 #define MPT_MAX_NAME 32
282 struct mpt_ioctl_test
{
283 mpt_ioctl_header hdr
;
284 u8 name
[MPT_MAX_NAME
];
286 u8 product
[MPT_PRODUCT_LENGTH
];
289 /* Replace the FW image cached in host driver memory
290 * newImageSize - image size in bytes
291 * newImage - first byte of the new image
293 typedef struct mpt_ioctl_replace_fw
{
294 mpt_ioctl_header hdr
;
297 } mpt_ioctl_replace_fw_t
;
299 /* General MPT Pass through data strucutre
302 * timeout - in seconds, command timeout. If 0, set by driver to
304 * replyFrameBufPtr - reply location
305 * dataInBufPtr - destination for read
306 * dataOutBufPtr - data source for write
307 * senseDataPtr - sense data location
308 * maxReplyBytes - maximum number of reply bytes to be sent to app.
309 * dataInSize - num bytes for data transfer in (read)
310 * dataOutSize - num bytes for data transfer out (write)
311 * dataSgeOffset - offset in words from the start of the request message
315 * Remark: Some config pages have bi-directional transfer,
316 * both a read and a write. The basic structure allows for
317 * a bidirectional set up. Normal messages will have one or
318 * both of these buffers NULL.
320 struct mpt_ioctl_command
{
321 mpt_ioctl_header hdr
;
322 int timeout
; /* optional (seconds) */
323 char __user
*replyFrameBufPtr
;
324 char __user
*dataInBufPtr
;
325 char __user
*dataOutBufPtr
;
326 char __user
*senseDataPtr
;
336 * SPARC PLATFORM: See earlier remark.
338 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
339 struct mpt_ioctl_command32
{
340 mpt_ioctl_header hdr
;
342 u32 replyFrameBufPtr
;
356 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
358 * HP Specific IOCTL Defines and Structures
361 #define CPQFCTS_IOC_MAGIC 'Z'
362 #define HP_IOC_MAGIC 'Z'
363 #define HP_GETHOSTINFO _IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
364 #define HP_GETHOSTINFO1 _IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
365 #define HP_GETTARGETINFO _IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
367 /* All HP IOCTLs must include this header
369 typedef struct _hp_header
{
372 unsigned int channel
;
379 * iocnum required (input)
385 typedef struct _hp_host_info
{
389 u16 subsystem_vendor
;
393 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
394 u8 fw_version
[16]; /* string */
395 u8 serial_number
[24]; /* string */
400 unsigned int hard_resets
; /* driver initiated resets */
401 unsigned int soft_resets
; /* ioc, external resets */
402 unsigned int timeouts
; /* num timeouts */
405 /* replace ulongs with uints, need to preserve backwards
408 typedef struct _hp_host_info_rev0
{
412 u16 subsystem_vendor
;
416 ushort host_no
; /* SCSI Host number, if scsi driver not loaded*/
417 u8 fw_version
[16]; /* string */
418 u8 serial_number
[24]; /* string */
423 unsigned long hard_resets
; /* driver initiated resets */
424 unsigned long soft_resets
; /* ioc, external resets */
425 unsigned long timeouts
; /* num timeouts */
426 } hp_host_info_rev0_t
;
430 * iocnum required (input)
432 * channel required (bus number)
436 * All error values between 0 and 0xFFFF in size.
438 typedef struct _hp_target_info
{
444 u32 negotiated_speed
;
446 u8 rsvd
[7]; /* 8 byte alignment */
449 #define HP_STATUS_OTHER 1
450 #define HP_STATUS_OK 2
451 #define HP_STATUS_FAILED 3
453 #define HP_BUS_WIDTH_UNK 1
454 #define HP_BUS_WIDTH_8 2
455 #define HP_BUS_WIDTH_16 3
456 #define HP_BUS_WIDTH_32 4
458 #define HP_DEV_SPEED_ASYNC 2
459 #define HP_DEV_SPEED_FAST 3
460 #define HP_DEV_SPEED_ULTRA 4
461 #define HP_DEV_SPEED_ULTRA2 5
462 #define HP_DEV_SPEED_ULTRA160 6
463 #define HP_DEV_SPEED_SCSI1 7
464 #define HP_DEV_SPEED_ULTRA320 8
466 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
469 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/