162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *  linux/drivers/message/fusion/mptioctl.h
362306a36Sopenharmony_ci *      Fusion MPT misc device (ioctl) driver.
462306a36Sopenharmony_ci *      For use with PCI chip/adapter(s):
562306a36Sopenharmony_ci *          LSIFC9xx/LSI409xx Fibre Channel
662306a36Sopenharmony_ci *      running LSI Fusion MPT (Message Passing Technology) firmware.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci *  Copyright (c) 1999-2008 LSI Corporation
962306a36Sopenharmony_ci *  (mailto:DL-MPTFusionLinux@lsi.com)
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1362306a36Sopenharmony_ci/*
1462306a36Sopenharmony_ci    This program is free software; you can redistribute it and/or modify
1562306a36Sopenharmony_ci    it under the terms of the GNU General Public License as published by
1662306a36Sopenharmony_ci    the Free Software Foundation; version 2 of the License.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci    This program is distributed in the hope that it will be useful,
1962306a36Sopenharmony_ci    but WITHOUT ANY WARRANTY; without even the implied warranty of
2062306a36Sopenharmony_ci    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2162306a36Sopenharmony_ci    GNU General Public License for more details.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci    NO WARRANTY
2462306a36Sopenharmony_ci    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
2562306a36Sopenharmony_ci    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
2662306a36Sopenharmony_ci    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
2762306a36Sopenharmony_ci    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
2862306a36Sopenharmony_ci    solely responsible for determining the appropriateness of using and
2962306a36Sopenharmony_ci    distributing the Program and assumes all risks associated with its
3062306a36Sopenharmony_ci    exercise of rights under this Agreement, including but not limited to
3162306a36Sopenharmony_ci    the risks and costs of program errors, damage to or loss of data,
3262306a36Sopenharmony_ci    programs or equipment, and unavailability or interruption of operations.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci    DISCLAIMER OF LIABILITY
3562306a36Sopenharmony_ci    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
3662306a36Sopenharmony_ci    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3762306a36Sopenharmony_ci    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
3862306a36Sopenharmony_ci    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
3962306a36Sopenharmony_ci    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
4062306a36Sopenharmony_ci    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
4162306a36Sopenharmony_ci    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci    You should have received a copy of the GNU General Public License
4462306a36Sopenharmony_ci    along with this program; if not, write to the Free Software
4562306a36Sopenharmony_ci    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4662306a36Sopenharmony_ci*/
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#ifndef MPTCTL_H_INCLUDED
4962306a36Sopenharmony_ci#define MPTCTL_H_INCLUDED
5062306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5562306a36Sopenharmony_ci/*
5662306a36Sopenharmony_ci *
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_ci#define MPT_MISCDEV_BASENAME            "mptctl"
5962306a36Sopenharmony_ci#define MPT_MISCDEV_PATHNAME            "/dev/" MPT_MISCDEV_BASENAME
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define MPT_PRODUCT_LENGTH              12
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/*
6462306a36Sopenharmony_ci *  Generic MPT Control IOCTLs and structures
6562306a36Sopenharmony_ci */
6662306a36Sopenharmony_ci#define MPT_MAGIC_NUMBER	'm'
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define MPTRWPERF		_IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define MPTFWDOWNLOAD		_IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
7162306a36Sopenharmony_ci#define MPTCOMMAND		_IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
7462306a36Sopenharmony_ci#define MPTFWDOWNLOAD32		_IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
7562306a36Sopenharmony_ci#define MPTCOMMAND32		_IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
7662306a36Sopenharmony_ci#endif
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define MPTIOCINFO		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
7962306a36Sopenharmony_ci#define MPTIOCINFO1		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
8062306a36Sopenharmony_ci#define MPTIOCINFO2		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
8162306a36Sopenharmony_ci#define MPTTARGETINFO		_IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
8262306a36Sopenharmony_ci#define MPTTEST			_IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
8362306a36Sopenharmony_ci#define MPTEVENTQUERY		_IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
8462306a36Sopenharmony_ci#define MPTEVENTENABLE		_IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
8562306a36Sopenharmony_ci#define MPTEVENTREPORT		_IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
8662306a36Sopenharmony_ci#define MPTHARDRESET		_IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
8762306a36Sopenharmony_ci#define MPTFWREPLACE		_IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/*
9062306a36Sopenharmony_ci * SPARC PLATFORM REMARKS:
9162306a36Sopenharmony_ci * IOCTL data structures that contain pointers
9262306a36Sopenharmony_ci * will have different sizes in the driver and applications
9362306a36Sopenharmony_ci * (as the app. will not use 8-byte pointers).
9462306a36Sopenharmony_ci * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
9562306a36Sopenharmony_ci * The driver will convert data from
9662306a36Sopenharmony_ci * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
9762306a36Sopenharmony_ci * internally.
9862306a36Sopenharmony_ci *
9962306a36Sopenharmony_ci * If data structures change size, must handle as in IOCGETINFO.
10062306a36Sopenharmony_ci */
10162306a36Sopenharmony_cistruct mpt_fw_xfer {
10262306a36Sopenharmony_ci	unsigned int	 iocnum;	/* IOC unit number */
10362306a36Sopenharmony_ci	unsigned int	 fwlen;
10462306a36Sopenharmony_ci	void		__user *bufp;	/* Pointer to firmware buffer */
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
10862306a36Sopenharmony_cistruct mpt_fw_xfer32 {
10962306a36Sopenharmony_ci	unsigned int iocnum;
11062306a36Sopenharmony_ci	unsigned int fwlen;
11162306a36Sopenharmony_ci	u32 bufp;
11262306a36Sopenharmony_ci};
11362306a36Sopenharmony_ci#endif	/*}*/
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/*
11662306a36Sopenharmony_ci *  IOCTL header structure.
11762306a36Sopenharmony_ci *  iocnum - must be defined.
11862306a36Sopenharmony_ci *  port - must be defined for all IOCTL commands other than MPTIOCINFO
11962306a36Sopenharmony_ci *  maxDataSize - ignored on MPTCOMMAND commands
12062306a36Sopenharmony_ci *		- ignored on MPTFWREPLACE commands
12162306a36Sopenharmony_ci *		- on query commands, reports the maximum number of bytes to be returned
12262306a36Sopenharmony_ci *		  to the host driver (count includes the header).
12362306a36Sopenharmony_ci *		  That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
12462306a36Sopenharmony_ci *		  Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
12562306a36Sopenharmony_ci *			sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
12662306a36Sopenharmony_ci */
12762306a36Sopenharmony_citypedef struct _mpt_ioctl_header {
12862306a36Sopenharmony_ci	unsigned int	 iocnum;	/* IOC unit number */
12962306a36Sopenharmony_ci	unsigned int	 port;		/* IOC port number */
13062306a36Sopenharmony_ci	int		 maxDataSize;	/* Maximum Num. bytes to transfer on read */
13162306a36Sopenharmony_ci} mpt_ioctl_header;
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/*
13462306a36Sopenharmony_ci * Issue a diagnostic reset
13562306a36Sopenharmony_ci */
13662306a36Sopenharmony_cistruct mpt_ioctl_diag_reset {
13762306a36Sopenharmony_ci	mpt_ioctl_header hdr;
13862306a36Sopenharmony_ci};
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci/*
14262306a36Sopenharmony_ci *  PCI bus/device/function information structure.
14362306a36Sopenharmony_ci */
14462306a36Sopenharmony_cistruct mpt_ioctl_pci_info {
14562306a36Sopenharmony_ci	union {
14662306a36Sopenharmony_ci		struct {
14762306a36Sopenharmony_ci			unsigned int  deviceNumber   :  5;
14862306a36Sopenharmony_ci			unsigned int  functionNumber :  3;
14962306a36Sopenharmony_ci			unsigned int  busNumber      : 24;
15062306a36Sopenharmony_ci		} bits;
15162306a36Sopenharmony_ci		unsigned int  asUlong;
15262306a36Sopenharmony_ci	} u;
15362306a36Sopenharmony_ci};
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_cistruct mpt_ioctl_pci_info2 {
15662306a36Sopenharmony_ci	union {
15762306a36Sopenharmony_ci		struct {
15862306a36Sopenharmony_ci			unsigned int  deviceNumber   :  5;
15962306a36Sopenharmony_ci			unsigned int  functionNumber :  3;
16062306a36Sopenharmony_ci			unsigned int  busNumber      : 24;
16162306a36Sopenharmony_ci		} bits;
16262306a36Sopenharmony_ci		unsigned int  asUlong;
16362306a36Sopenharmony_ci	} u;
16462306a36Sopenharmony_ci  int segmentID;
16562306a36Sopenharmony_ci};
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/*
16862306a36Sopenharmony_ci *  Adapter Information Page
16962306a36Sopenharmony_ci *  Read only.
17062306a36Sopenharmony_ci *  Data starts at offset 0xC
17162306a36Sopenharmony_ci */
17262306a36Sopenharmony_ci#define MPT_IOCTL_INTERFACE_SCSI	(0x00)
17362306a36Sopenharmony_ci#define MPT_IOCTL_INTERFACE_FC		(0x01)
17462306a36Sopenharmony_ci#define MPT_IOCTL_INTERFACE_FC_IP	(0x02)
17562306a36Sopenharmony_ci#define MPT_IOCTL_INTERFACE_SAS		(0x03)
17662306a36Sopenharmony_ci#define MPT_IOCTL_VERSION_LENGTH	(32)
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_cistruct mpt_ioctl_iocinfo {
17962306a36Sopenharmony_ci	mpt_ioctl_header hdr;
18062306a36Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
18162306a36Sopenharmony_ci	int		 port;		/* port number */
18262306a36Sopenharmony_ci	int		 pciId;		/* PCI Id. */
18362306a36Sopenharmony_ci	int		 hwRev;		/* hardware revision */
18462306a36Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
18562306a36Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
18662306a36Sopenharmony_ci	int		 numDevices;		/* number of devices */
18762306a36Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
18862306a36Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
18962306a36Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
19062306a36Sopenharmony_ci	char		 busChangeEvent;
19162306a36Sopenharmony_ci	char		 hostId;
19262306a36Sopenharmony_ci	char		 rsvd[2];
19362306a36Sopenharmony_ci	struct mpt_ioctl_pci_info2  pciInfo; /* Added Rev 2 */
19462306a36Sopenharmony_ci};
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_cistruct mpt_ioctl_iocinfo_rev1 {
19762306a36Sopenharmony_ci	mpt_ioctl_header hdr;
19862306a36Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
19962306a36Sopenharmony_ci	int		 port;		/* port number */
20062306a36Sopenharmony_ci	int		 pciId;		/* PCI Id. */
20162306a36Sopenharmony_ci	int		 hwRev;		/* hardware revision */
20262306a36Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
20362306a36Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
20462306a36Sopenharmony_ci	int		 numDevices;		/* number of devices */
20562306a36Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
20662306a36Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
20762306a36Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
20862306a36Sopenharmony_ci	char		 busChangeEvent;
20962306a36Sopenharmony_ci	char		 hostId;
21062306a36Sopenharmony_ci	char		 rsvd[2];
21162306a36Sopenharmony_ci	struct mpt_ioctl_pci_info  pciInfo; /* Added Rev 1 */
21262306a36Sopenharmony_ci};
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* Original structure, must always accept these
21562306a36Sopenharmony_ci * IOCTLs. 4 byte pads can occur based on arch with
21662306a36Sopenharmony_ci * above structure. Wish to re-align, but cannot.
21762306a36Sopenharmony_ci */
21862306a36Sopenharmony_cistruct mpt_ioctl_iocinfo_rev0 {
21962306a36Sopenharmony_ci	mpt_ioctl_header hdr;
22062306a36Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
22162306a36Sopenharmony_ci	int		 port;		/* port number */
22262306a36Sopenharmony_ci	int		 pciId;		/* PCI Id. */
22362306a36Sopenharmony_ci	int		 hwRev;		/* hardware revision */
22462306a36Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
22562306a36Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
22662306a36Sopenharmony_ci	int		 numDevices;		/* number of devices */
22762306a36Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
22862306a36Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
22962306a36Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
23062306a36Sopenharmony_ci	char		 busChangeEvent;
23162306a36Sopenharmony_ci	char		 hostId;
23262306a36Sopenharmony_ci	char		 rsvd[2];
23362306a36Sopenharmony_ci};
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci/*
23662306a36Sopenharmony_ci * Device Information Page
23762306a36Sopenharmony_ci * Report the number of, and ids of, all targets
23862306a36Sopenharmony_ci * on this IOC.  The ids array is a packed structure
23962306a36Sopenharmony_ci * of the known targetInfo.
24062306a36Sopenharmony_ci * bits 31-24: reserved
24162306a36Sopenharmony_ci *      23-16: LUN
24262306a36Sopenharmony_ci *      15- 8: Bus Number
24362306a36Sopenharmony_ci *       7- 0: Target ID
24462306a36Sopenharmony_ci */
24562306a36Sopenharmony_cistruct mpt_ioctl_targetinfo {
24662306a36Sopenharmony_ci	mpt_ioctl_header hdr;
24762306a36Sopenharmony_ci	int		 numDevices;	/* Num targets on this ioc */
24862306a36Sopenharmony_ci	int		 targetInfo[1];
24962306a36Sopenharmony_ci};
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci/*
25362306a36Sopenharmony_ci * Event reporting IOCTL's.  These IOCTL's will
25462306a36Sopenharmony_ci * use the following defines:
25562306a36Sopenharmony_ci */
25662306a36Sopenharmony_cistruct mpt_ioctl_eventquery {
25762306a36Sopenharmony_ci	mpt_ioctl_header hdr;
25862306a36Sopenharmony_ci	unsigned short	 eventEntries;
25962306a36Sopenharmony_ci	unsigned short	 reserved;
26062306a36Sopenharmony_ci	unsigned int	 eventTypes;
26162306a36Sopenharmony_ci};
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_cistruct mpt_ioctl_eventenable {
26462306a36Sopenharmony_ci	mpt_ioctl_header hdr;
26562306a36Sopenharmony_ci	unsigned int	 eventTypes;
26662306a36Sopenharmony_ci};
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci#ifndef __KERNEL__
26962306a36Sopenharmony_citypedef struct {
27062306a36Sopenharmony_ci	uint	event;
27162306a36Sopenharmony_ci	uint	eventContext;
27262306a36Sopenharmony_ci	uint	data[2];
27362306a36Sopenharmony_ci} MPT_IOCTL_EVENTS;
27462306a36Sopenharmony_ci#endif
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_cistruct mpt_ioctl_eventreport {
27762306a36Sopenharmony_ci	mpt_ioctl_header	hdr;
27862306a36Sopenharmony_ci	MPT_IOCTL_EVENTS	eventData[1];
27962306a36Sopenharmony_ci};
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define MPT_MAX_NAME	32
28262306a36Sopenharmony_cistruct mpt_ioctl_test {
28362306a36Sopenharmony_ci	mpt_ioctl_header hdr;
28462306a36Sopenharmony_ci	u8		 name[MPT_MAX_NAME];
28562306a36Sopenharmony_ci	int		 chip_type;
28662306a36Sopenharmony_ci	u8		 product [MPT_PRODUCT_LENGTH];
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/* Replace the FW image cached in host driver memory
29062306a36Sopenharmony_ci * newImageSize - image size in bytes
29162306a36Sopenharmony_ci * newImage - first byte of the new image
29262306a36Sopenharmony_ci */
29362306a36Sopenharmony_citypedef struct mpt_ioctl_replace_fw {
29462306a36Sopenharmony_ci	mpt_ioctl_header hdr;
29562306a36Sopenharmony_ci	int		 newImageSize;
29662306a36Sopenharmony_ci	u8		 newImage[1];
29762306a36Sopenharmony_ci} mpt_ioctl_replace_fw_t;
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci/* General MPT Pass through data strucutre
30062306a36Sopenharmony_ci *
30162306a36Sopenharmony_ci * iocnum
30262306a36Sopenharmony_ci * timeout - in seconds, command timeout. If 0, set by driver to
30362306a36Sopenharmony_ci *		default value.
30462306a36Sopenharmony_ci * replyFrameBufPtr - reply location
30562306a36Sopenharmony_ci * dataInBufPtr - destination for read
30662306a36Sopenharmony_ci * dataOutBufPtr - data source for write
30762306a36Sopenharmony_ci * senseDataPtr - sense data location
30862306a36Sopenharmony_ci * maxReplyBytes - maximum number of reply bytes to be sent to app.
30962306a36Sopenharmony_ci * dataInSize - num bytes for data transfer in (read)
31062306a36Sopenharmony_ci * dataOutSize - num bytes for data transfer out (write)
31162306a36Sopenharmony_ci * dataSgeOffset - offset in words from the start of the request message
31262306a36Sopenharmony_ci *		to the first SGL
31362306a36Sopenharmony_ci * MF[1];
31462306a36Sopenharmony_ci *
31562306a36Sopenharmony_ci * Remark:  Some config pages have bi-directional transfer,
31662306a36Sopenharmony_ci * both a read and a write. The basic structure allows for
31762306a36Sopenharmony_ci * a bidirectional set up. Normal messages will have one or
31862306a36Sopenharmony_ci * both of these buffers NULL.
31962306a36Sopenharmony_ci */
32062306a36Sopenharmony_cistruct mpt_ioctl_command {
32162306a36Sopenharmony_ci	mpt_ioctl_header hdr;
32262306a36Sopenharmony_ci	int		timeout;	/* optional (seconds) */
32362306a36Sopenharmony_ci	char		__user *replyFrameBufPtr;
32462306a36Sopenharmony_ci	char		__user *dataInBufPtr;
32562306a36Sopenharmony_ci	char		__user *dataOutBufPtr;
32662306a36Sopenharmony_ci	char		__user *senseDataPtr;
32762306a36Sopenharmony_ci	int		maxReplyBytes;
32862306a36Sopenharmony_ci	int		dataInSize;
32962306a36Sopenharmony_ci	int		dataOutSize;
33062306a36Sopenharmony_ci	int		maxSenseBytes;
33162306a36Sopenharmony_ci	int		dataSgeOffset;
33262306a36Sopenharmony_ci	char		MF[1];
33362306a36Sopenharmony_ci};
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci/*
33662306a36Sopenharmony_ci * SPARC PLATFORM: See earlier remark.
33762306a36Sopenharmony_ci */
33862306a36Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
33962306a36Sopenharmony_cistruct mpt_ioctl_command32 {
34062306a36Sopenharmony_ci	mpt_ioctl_header hdr;
34162306a36Sopenharmony_ci	int	timeout;
34262306a36Sopenharmony_ci	u32	replyFrameBufPtr;
34362306a36Sopenharmony_ci	u32	dataInBufPtr;
34462306a36Sopenharmony_ci	u32	dataOutBufPtr;
34562306a36Sopenharmony_ci	u32	senseDataPtr;
34662306a36Sopenharmony_ci	int	maxReplyBytes;
34762306a36Sopenharmony_ci	int	dataInSize;
34862306a36Sopenharmony_ci	int	dataOutSize;
34962306a36Sopenharmony_ci	int	maxSenseBytes;
35062306a36Sopenharmony_ci	int	dataSgeOffset;
35162306a36Sopenharmony_ci	char	MF[1];
35262306a36Sopenharmony_ci};
35362306a36Sopenharmony_ci#endif	/*}*/
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci#define CPQFCTS_IOC_MAGIC 'Z'
35962306a36Sopenharmony_ci#define HP_IOC_MAGIC 'Z'
36062306a36Sopenharmony_ci#define HP_GETHOSTINFO		_IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
36162306a36Sopenharmony_ci#define HP_GETHOSTINFO1		_IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
36262306a36Sopenharmony_ci#define HP_GETTARGETINFO	_IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_citypedef struct _hp_header {
36562306a36Sopenharmony_ci	unsigned int iocnum;
36662306a36Sopenharmony_ci	unsigned int host;
36762306a36Sopenharmony_ci	unsigned int channel;
36862306a36Sopenharmony_ci	unsigned int id;
36962306a36Sopenharmony_ci	unsigned int lun;
37062306a36Sopenharmony_ci} hp_header_t;
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci/*
37362306a36Sopenharmony_ci *  Header:
37462306a36Sopenharmony_ci *  iocnum 	required (input)
37562306a36Sopenharmony_ci *  host 	ignored
37662306a36Sopenharmony_ci *  channe	ignored
37762306a36Sopenharmony_ci *  id		ignored
37862306a36Sopenharmony_ci *  lun		ignored
37962306a36Sopenharmony_ci */
38062306a36Sopenharmony_citypedef struct _hp_host_info {
38162306a36Sopenharmony_ci	hp_header_t	 hdr;
38262306a36Sopenharmony_ci	u16		 vendor;
38362306a36Sopenharmony_ci	u16		 device;
38462306a36Sopenharmony_ci	u16		 subsystem_vendor;
38562306a36Sopenharmony_ci	u16		 subsystem_id;
38662306a36Sopenharmony_ci	u8		 devfn;
38762306a36Sopenharmony_ci	u8		 bus;
38862306a36Sopenharmony_ci	ushort		 host_no;		/* SCSI Host number, if scsi driver not loaded*/
38962306a36Sopenharmony_ci	u8		 fw_version[16];	/* string */
39062306a36Sopenharmony_ci	u8		 serial_number[24];	/* string */
39162306a36Sopenharmony_ci	u32		 ioc_status;
39262306a36Sopenharmony_ci	u32		 bus_phys_width;
39362306a36Sopenharmony_ci	u32		 base_io_addr;
39462306a36Sopenharmony_ci	u32		 rsvd;
39562306a36Sopenharmony_ci	unsigned int	 hard_resets;		/* driver initiated resets */
39662306a36Sopenharmony_ci	unsigned int	 soft_resets;		/* ioc, external resets */
39762306a36Sopenharmony_ci	unsigned int	 timeouts;		/* num timeouts */
39862306a36Sopenharmony_ci} hp_host_info_t;
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci/* replace ulongs with uints, need to preserve backwards
40162306a36Sopenharmony_ci * compatibility.
40262306a36Sopenharmony_ci */
40362306a36Sopenharmony_citypedef struct _hp_host_info_rev0 {
40462306a36Sopenharmony_ci	hp_header_t	 hdr;
40562306a36Sopenharmony_ci	u16		 vendor;
40662306a36Sopenharmony_ci	u16		 device;
40762306a36Sopenharmony_ci	u16		 subsystem_vendor;
40862306a36Sopenharmony_ci	u16		 subsystem_id;
40962306a36Sopenharmony_ci	u8		 devfn;
41062306a36Sopenharmony_ci	u8		 bus;
41162306a36Sopenharmony_ci	ushort		 host_no;		/* SCSI Host number, if scsi driver not loaded*/
41262306a36Sopenharmony_ci	u8		 fw_version[16];	/* string */
41362306a36Sopenharmony_ci	u8		 serial_number[24];	/* string */
41462306a36Sopenharmony_ci	u32		 ioc_status;
41562306a36Sopenharmony_ci	u32		 bus_phys_width;
41662306a36Sopenharmony_ci	u32		 base_io_addr;
41762306a36Sopenharmony_ci	u32		 rsvd;
41862306a36Sopenharmony_ci	unsigned long	 hard_resets;		/* driver initiated resets */
41962306a36Sopenharmony_ci	unsigned long	 soft_resets;		/* ioc, external resets */
42062306a36Sopenharmony_ci	unsigned long	 timeouts;		/* num timeouts */
42162306a36Sopenharmony_ci} hp_host_info_rev0_t;
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_ci/*
42462306a36Sopenharmony_ci *  Header:
42562306a36Sopenharmony_ci *  iocnum 	required (input)
42662306a36Sopenharmony_ci *  host 	required
42762306a36Sopenharmony_ci *  channel	required	(bus number)
42862306a36Sopenharmony_ci *  id		required
42962306a36Sopenharmony_ci *  lun		ignored
43062306a36Sopenharmony_ci *
43162306a36Sopenharmony_ci *  All error values between 0 and 0xFFFF in size.
43262306a36Sopenharmony_ci */
43362306a36Sopenharmony_citypedef struct _hp_target_info {
43462306a36Sopenharmony_ci	hp_header_t	 hdr;
43562306a36Sopenharmony_ci	u32 parity_errors;
43662306a36Sopenharmony_ci	u32 phase_errors;
43762306a36Sopenharmony_ci	u32 select_timeouts;
43862306a36Sopenharmony_ci	u32 message_rejects;
43962306a36Sopenharmony_ci	u32 negotiated_speed;
44062306a36Sopenharmony_ci	u8  negotiated_width;
44162306a36Sopenharmony_ci	u8  rsvd[7];				/* 8 byte alignment */
44262306a36Sopenharmony_ci} hp_target_info_t;
44362306a36Sopenharmony_ci
44462306a36Sopenharmony_ci#define HP_STATUS_OTHER		1
44562306a36Sopenharmony_ci#define HP_STATUS_OK		2
44662306a36Sopenharmony_ci#define HP_STATUS_FAILED	3
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci#define HP_BUS_WIDTH_UNK	1
44962306a36Sopenharmony_ci#define HP_BUS_WIDTH_8		2
45062306a36Sopenharmony_ci#define HP_BUS_WIDTH_16		3
45162306a36Sopenharmony_ci#define HP_BUS_WIDTH_32		4
45262306a36Sopenharmony_ci
45362306a36Sopenharmony_ci#define HP_DEV_SPEED_ASYNC	2
45462306a36Sopenharmony_ci#define HP_DEV_SPEED_FAST	3
45562306a36Sopenharmony_ci#define HP_DEV_SPEED_ULTRA	4
45662306a36Sopenharmony_ci#define HP_DEV_SPEED_ULTRA2	5
45762306a36Sopenharmony_ci#define HP_DEV_SPEED_ULTRA160	6
45862306a36Sopenharmony_ci#define HP_DEV_SPEED_SCSI1	7
45962306a36Sopenharmony_ci#define HP_DEV_SPEED_ULTRA320	8
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
46562306a36Sopenharmony_ci
46662306a36Sopenharmony_ci#endif
46762306a36Sopenharmony_ci
468