18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci *  linux/drivers/message/fusion/mptioctl.h
38c2ecf20Sopenharmony_ci *      Fusion MPT misc device (ioctl) driver.
48c2ecf20Sopenharmony_ci *      For use with PCI chip/adapter(s):
58c2ecf20Sopenharmony_ci *          LSIFC9xx/LSI409xx Fibre Channel
68c2ecf20Sopenharmony_ci *      running LSI Fusion MPT (Message Passing Technology) firmware.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *  Copyright (c) 1999-2008 LSI Corporation
98c2ecf20Sopenharmony_ci *  (mailto:DL-MPTFusionLinux@lsi.com)
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci    This program is free software; you can redistribute it and/or modify
158c2ecf20Sopenharmony_ci    it under the terms of the GNU General Public License as published by
168c2ecf20Sopenharmony_ci    the Free Software Foundation; version 2 of the License.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci    This program is distributed in the hope that it will be useful,
198c2ecf20Sopenharmony_ci    but WITHOUT ANY WARRANTY; without even the implied warranty of
208c2ecf20Sopenharmony_ci    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
218c2ecf20Sopenharmony_ci    GNU General Public License for more details.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci    NO WARRANTY
248c2ecf20Sopenharmony_ci    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
258c2ecf20Sopenharmony_ci    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
268c2ecf20Sopenharmony_ci    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
278c2ecf20Sopenharmony_ci    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
288c2ecf20Sopenharmony_ci    solely responsible for determining the appropriateness of using and
298c2ecf20Sopenharmony_ci    distributing the Program and assumes all risks associated with its
308c2ecf20Sopenharmony_ci    exercise of rights under this Agreement, including but not limited to
318c2ecf20Sopenharmony_ci    the risks and costs of program errors, damage to or loss of data,
328c2ecf20Sopenharmony_ci    programs or equipment, and unavailability or interruption of operations.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci    DISCLAIMER OF LIABILITY
358c2ecf20Sopenharmony_ci    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
368c2ecf20Sopenharmony_ci    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
378c2ecf20Sopenharmony_ci    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
388c2ecf20Sopenharmony_ci    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
398c2ecf20Sopenharmony_ci    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
408c2ecf20Sopenharmony_ci    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
418c2ecf20Sopenharmony_ci    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci    You should have received a copy of the GNU General Public License
448c2ecf20Sopenharmony_ci    along with this program; if not, write to the Free Software
458c2ecf20Sopenharmony_ci    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
468c2ecf20Sopenharmony_ci*/
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#ifndef MPTCTL_H_INCLUDED
498c2ecf20Sopenharmony_ci#define MPTCTL_H_INCLUDED
508c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci *
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci#define MPT_MISCDEV_BASENAME            "mptctl"
598c2ecf20Sopenharmony_ci#define MPT_MISCDEV_PATHNAME            "/dev/" MPT_MISCDEV_BASENAME
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define MPT_PRODUCT_LENGTH              12
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*
648c2ecf20Sopenharmony_ci *  Generic MPT Control IOCTLs and structures
658c2ecf20Sopenharmony_ci */
668c2ecf20Sopenharmony_ci#define MPT_MAGIC_NUMBER	'm'
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define MPTRWPERF		_IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define MPTFWDOWNLOAD		_IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
718c2ecf20Sopenharmony_ci#define MPTCOMMAND		_IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
748c2ecf20Sopenharmony_ci#define MPTFWDOWNLOAD32		_IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
758c2ecf20Sopenharmony_ci#define MPTCOMMAND32		_IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
768c2ecf20Sopenharmony_ci#endif
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define MPTIOCINFO		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
798c2ecf20Sopenharmony_ci#define MPTIOCINFO1		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
808c2ecf20Sopenharmony_ci#define MPTIOCINFO2		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
818c2ecf20Sopenharmony_ci#define MPTTARGETINFO		_IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
828c2ecf20Sopenharmony_ci#define MPTTEST			_IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
838c2ecf20Sopenharmony_ci#define MPTEVENTQUERY		_IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
848c2ecf20Sopenharmony_ci#define MPTEVENTENABLE		_IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
858c2ecf20Sopenharmony_ci#define MPTEVENTREPORT		_IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
868c2ecf20Sopenharmony_ci#define MPTHARDRESET		_IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
878c2ecf20Sopenharmony_ci#define MPTFWREPLACE		_IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/*
908c2ecf20Sopenharmony_ci * SPARC PLATFORM REMARKS:
918c2ecf20Sopenharmony_ci * IOCTL data structures that contain pointers
928c2ecf20Sopenharmony_ci * will have different sizes in the driver and applications
938c2ecf20Sopenharmony_ci * (as the app. will not use 8-byte pointers).
948c2ecf20Sopenharmony_ci * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
958c2ecf20Sopenharmony_ci * The driver will convert data from
968c2ecf20Sopenharmony_ci * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
978c2ecf20Sopenharmony_ci * internally.
988c2ecf20Sopenharmony_ci *
998c2ecf20Sopenharmony_ci * If data structures change size, must handle as in IOCGETINFO.
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_cistruct mpt_fw_xfer {
1028c2ecf20Sopenharmony_ci	unsigned int	 iocnum;	/* IOC unit number */
1038c2ecf20Sopenharmony_ci	unsigned int	 fwlen;
1048c2ecf20Sopenharmony_ci	void		__user *bufp;	/* Pointer to firmware buffer */
1058c2ecf20Sopenharmony_ci};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
1088c2ecf20Sopenharmony_cistruct mpt_fw_xfer32 {
1098c2ecf20Sopenharmony_ci	unsigned int iocnum;
1108c2ecf20Sopenharmony_ci	unsigned int fwlen;
1118c2ecf20Sopenharmony_ci	u32 bufp;
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci#endif	/*}*/
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/*
1168c2ecf20Sopenharmony_ci *  IOCTL header structure.
1178c2ecf20Sopenharmony_ci *  iocnum - must be defined.
1188c2ecf20Sopenharmony_ci *  port - must be defined for all IOCTL commands other than MPTIOCINFO
1198c2ecf20Sopenharmony_ci *  maxDataSize - ignored on MPTCOMMAND commands
1208c2ecf20Sopenharmony_ci *		- ignored on MPTFWREPLACE commands
1218c2ecf20Sopenharmony_ci *		- on query commands, reports the maximum number of bytes to be returned
1228c2ecf20Sopenharmony_ci *		  to the host driver (count includes the header).
1238c2ecf20Sopenharmony_ci *		  That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
1248c2ecf20Sopenharmony_ci *		  Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
1258c2ecf20Sopenharmony_ci *			sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
1268c2ecf20Sopenharmony_ci */
1278c2ecf20Sopenharmony_citypedef struct _mpt_ioctl_header {
1288c2ecf20Sopenharmony_ci	unsigned int	 iocnum;	/* IOC unit number */
1298c2ecf20Sopenharmony_ci	unsigned int	 port;		/* IOC port number */
1308c2ecf20Sopenharmony_ci	int		 maxDataSize;	/* Maximum Num. bytes to transfer on read */
1318c2ecf20Sopenharmony_ci} mpt_ioctl_header;
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci * Issue a diagnostic reset
1358c2ecf20Sopenharmony_ci */
1368c2ecf20Sopenharmony_cistruct mpt_ioctl_diag_reset {
1378c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/*
1428c2ecf20Sopenharmony_ci *  PCI bus/device/function information structure.
1438c2ecf20Sopenharmony_ci */
1448c2ecf20Sopenharmony_cistruct mpt_ioctl_pci_info {
1458c2ecf20Sopenharmony_ci	union {
1468c2ecf20Sopenharmony_ci		struct {
1478c2ecf20Sopenharmony_ci			unsigned int  deviceNumber   :  5;
1488c2ecf20Sopenharmony_ci			unsigned int  functionNumber :  3;
1498c2ecf20Sopenharmony_ci			unsigned int  busNumber      : 24;
1508c2ecf20Sopenharmony_ci		} bits;
1518c2ecf20Sopenharmony_ci		unsigned int  asUlong;
1528c2ecf20Sopenharmony_ci	} u;
1538c2ecf20Sopenharmony_ci};
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_cistruct mpt_ioctl_pci_info2 {
1568c2ecf20Sopenharmony_ci	union {
1578c2ecf20Sopenharmony_ci		struct {
1588c2ecf20Sopenharmony_ci			unsigned int  deviceNumber   :  5;
1598c2ecf20Sopenharmony_ci			unsigned int  functionNumber :  3;
1608c2ecf20Sopenharmony_ci			unsigned int  busNumber      : 24;
1618c2ecf20Sopenharmony_ci		} bits;
1628c2ecf20Sopenharmony_ci		unsigned int  asUlong;
1638c2ecf20Sopenharmony_ci	} u;
1648c2ecf20Sopenharmony_ci  int segmentID;
1658c2ecf20Sopenharmony_ci};
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/*
1688c2ecf20Sopenharmony_ci *  Adapter Information Page
1698c2ecf20Sopenharmony_ci *  Read only.
1708c2ecf20Sopenharmony_ci *  Data starts at offset 0xC
1718c2ecf20Sopenharmony_ci */
1728c2ecf20Sopenharmony_ci#define MPT_IOCTL_INTERFACE_SCSI	(0x00)
1738c2ecf20Sopenharmony_ci#define MPT_IOCTL_INTERFACE_FC		(0x01)
1748c2ecf20Sopenharmony_ci#define MPT_IOCTL_INTERFACE_FC_IP	(0x02)
1758c2ecf20Sopenharmony_ci#define MPT_IOCTL_INTERFACE_SAS		(0x03)
1768c2ecf20Sopenharmony_ci#define MPT_IOCTL_VERSION_LENGTH	(32)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_cistruct mpt_ioctl_iocinfo {
1798c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
1808c2ecf20Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
1818c2ecf20Sopenharmony_ci	int		 port;		/* port number */
1828c2ecf20Sopenharmony_ci	int		 pciId;		/* PCI Id. */
1838c2ecf20Sopenharmony_ci	int		 hwRev;		/* hardware revision */
1848c2ecf20Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
1858c2ecf20Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
1868c2ecf20Sopenharmony_ci	int		 numDevices;		/* number of devices */
1878c2ecf20Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
1888c2ecf20Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
1898c2ecf20Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
1908c2ecf20Sopenharmony_ci	char		 busChangeEvent;
1918c2ecf20Sopenharmony_ci	char		 hostId;
1928c2ecf20Sopenharmony_ci	char		 rsvd[2];
1938c2ecf20Sopenharmony_ci	struct mpt_ioctl_pci_info2  pciInfo; /* Added Rev 2 */
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistruct mpt_ioctl_iocinfo_rev1 {
1978c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
1988c2ecf20Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
1998c2ecf20Sopenharmony_ci	int		 port;		/* port number */
2008c2ecf20Sopenharmony_ci	int		 pciId;		/* PCI Id. */
2018c2ecf20Sopenharmony_ci	int		 hwRev;		/* hardware revision */
2028c2ecf20Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
2038c2ecf20Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
2048c2ecf20Sopenharmony_ci	int		 numDevices;		/* number of devices */
2058c2ecf20Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
2068c2ecf20Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
2078c2ecf20Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
2088c2ecf20Sopenharmony_ci	char		 busChangeEvent;
2098c2ecf20Sopenharmony_ci	char		 hostId;
2108c2ecf20Sopenharmony_ci	char		 rsvd[2];
2118c2ecf20Sopenharmony_ci	struct mpt_ioctl_pci_info  pciInfo; /* Added Rev 1 */
2128c2ecf20Sopenharmony_ci};
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci/* Original structure, must always accept these
2158c2ecf20Sopenharmony_ci * IOCTLs. 4 byte pads can occur based on arch with
2168c2ecf20Sopenharmony_ci * above structure. Wish to re-align, but cannot.
2178c2ecf20Sopenharmony_ci */
2188c2ecf20Sopenharmony_cistruct mpt_ioctl_iocinfo_rev0 {
2198c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2208c2ecf20Sopenharmony_ci	int		 adapterType;	/* SCSI or FCP */
2218c2ecf20Sopenharmony_ci	int		 port;		/* port number */
2228c2ecf20Sopenharmony_ci	int		 pciId;		/* PCI Id. */
2238c2ecf20Sopenharmony_ci	int		 hwRev;		/* hardware revision */
2248c2ecf20Sopenharmony_ci	int		 subSystemDevice;	/* PCI subsystem Device ID */
2258c2ecf20Sopenharmony_ci	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
2268c2ecf20Sopenharmony_ci	int		 numDevices;		/* number of devices */
2278c2ecf20Sopenharmony_ci	int		 FWVersion;		/* FW Version (integer) */
2288c2ecf20Sopenharmony_ci	int		 BIOSVersion;		/* BIOS Version (integer) */
2298c2ecf20Sopenharmony_ci	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
2308c2ecf20Sopenharmony_ci	char		 busChangeEvent;
2318c2ecf20Sopenharmony_ci	char		 hostId;
2328c2ecf20Sopenharmony_ci	char		 rsvd[2];
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/*
2368c2ecf20Sopenharmony_ci * Device Information Page
2378c2ecf20Sopenharmony_ci * Report the number of, and ids of, all targets
2388c2ecf20Sopenharmony_ci * on this IOC.  The ids array is a packed structure
2398c2ecf20Sopenharmony_ci * of the known targetInfo.
2408c2ecf20Sopenharmony_ci * bits 31-24: reserved
2418c2ecf20Sopenharmony_ci *      23-16: LUN
2428c2ecf20Sopenharmony_ci *      15- 8: Bus Number
2438c2ecf20Sopenharmony_ci *       7- 0: Target ID
2448c2ecf20Sopenharmony_ci */
2458c2ecf20Sopenharmony_cistruct mpt_ioctl_targetinfo {
2468c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2478c2ecf20Sopenharmony_ci	int		 numDevices;	/* Num targets on this ioc */
2488c2ecf20Sopenharmony_ci	int		 targetInfo[1];
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci/*
2538c2ecf20Sopenharmony_ci * Event reporting IOCTL's.  These IOCTL's will
2548c2ecf20Sopenharmony_ci * use the following defines:
2558c2ecf20Sopenharmony_ci */
2568c2ecf20Sopenharmony_cistruct mpt_ioctl_eventquery {
2578c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2588c2ecf20Sopenharmony_ci	unsigned short	 eventEntries;
2598c2ecf20Sopenharmony_ci	unsigned short	 reserved;
2608c2ecf20Sopenharmony_ci	unsigned int	 eventTypes;
2618c2ecf20Sopenharmony_ci};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct mpt_ioctl_eventenable {
2648c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2658c2ecf20Sopenharmony_ci	unsigned int	 eventTypes;
2668c2ecf20Sopenharmony_ci};
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci#ifndef __KERNEL__
2698c2ecf20Sopenharmony_citypedef struct {
2708c2ecf20Sopenharmony_ci	uint	event;
2718c2ecf20Sopenharmony_ci	uint	eventContext;
2728c2ecf20Sopenharmony_ci	uint	data[2];
2738c2ecf20Sopenharmony_ci} MPT_IOCTL_EVENTS;
2748c2ecf20Sopenharmony_ci#endif
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_cistruct mpt_ioctl_eventreport {
2778c2ecf20Sopenharmony_ci	mpt_ioctl_header	hdr;
2788c2ecf20Sopenharmony_ci	MPT_IOCTL_EVENTS	eventData[1];
2798c2ecf20Sopenharmony_ci};
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci#define MPT_MAX_NAME	32
2828c2ecf20Sopenharmony_cistruct mpt_ioctl_test {
2838c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2848c2ecf20Sopenharmony_ci	u8		 name[MPT_MAX_NAME];
2858c2ecf20Sopenharmony_ci	int		 chip_type;
2868c2ecf20Sopenharmony_ci	u8		 product [MPT_PRODUCT_LENGTH];
2878c2ecf20Sopenharmony_ci};
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* Replace the FW image cached in host driver memory
2908c2ecf20Sopenharmony_ci * newImageSize - image size in bytes
2918c2ecf20Sopenharmony_ci * newImage - first byte of the new image
2928c2ecf20Sopenharmony_ci */
2938c2ecf20Sopenharmony_citypedef struct mpt_ioctl_replace_fw {
2948c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
2958c2ecf20Sopenharmony_ci	int		 newImageSize;
2968c2ecf20Sopenharmony_ci	u8		 newImage[1];
2978c2ecf20Sopenharmony_ci} mpt_ioctl_replace_fw_t;
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/* General MPT Pass through data strucutre
3008c2ecf20Sopenharmony_ci *
3018c2ecf20Sopenharmony_ci * iocnum
3028c2ecf20Sopenharmony_ci * timeout - in seconds, command timeout. If 0, set by driver to
3038c2ecf20Sopenharmony_ci *		default value.
3048c2ecf20Sopenharmony_ci * replyFrameBufPtr - reply location
3058c2ecf20Sopenharmony_ci * dataInBufPtr - destination for read
3068c2ecf20Sopenharmony_ci * dataOutBufPtr - data source for write
3078c2ecf20Sopenharmony_ci * senseDataPtr - sense data location
3088c2ecf20Sopenharmony_ci * maxReplyBytes - maximum number of reply bytes to be sent to app.
3098c2ecf20Sopenharmony_ci * dataInSize - num bytes for data transfer in (read)
3108c2ecf20Sopenharmony_ci * dataOutSize - num bytes for data transfer out (write)
3118c2ecf20Sopenharmony_ci * dataSgeOffset - offset in words from the start of the request message
3128c2ecf20Sopenharmony_ci *		to the first SGL
3138c2ecf20Sopenharmony_ci * MF[1];
3148c2ecf20Sopenharmony_ci *
3158c2ecf20Sopenharmony_ci * Remark:  Some config pages have bi-directional transfer,
3168c2ecf20Sopenharmony_ci * both a read and a write. The basic structure allows for
3178c2ecf20Sopenharmony_ci * a bidirectional set up. Normal messages will have one or
3188c2ecf20Sopenharmony_ci * both of these buffers NULL.
3198c2ecf20Sopenharmony_ci */
3208c2ecf20Sopenharmony_cistruct mpt_ioctl_command {
3218c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
3228c2ecf20Sopenharmony_ci	int		timeout;	/* optional (seconds) */
3238c2ecf20Sopenharmony_ci	char		__user *replyFrameBufPtr;
3248c2ecf20Sopenharmony_ci	char		__user *dataInBufPtr;
3258c2ecf20Sopenharmony_ci	char		__user *dataOutBufPtr;
3268c2ecf20Sopenharmony_ci	char		__user *senseDataPtr;
3278c2ecf20Sopenharmony_ci	int		maxReplyBytes;
3288c2ecf20Sopenharmony_ci	int		dataInSize;
3298c2ecf20Sopenharmony_ci	int		dataOutSize;
3308c2ecf20Sopenharmony_ci	int		maxSenseBytes;
3318c2ecf20Sopenharmony_ci	int		dataSgeOffset;
3328c2ecf20Sopenharmony_ci	char		MF[1];
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/*
3368c2ecf20Sopenharmony_ci * SPARC PLATFORM: See earlier remark.
3378c2ecf20Sopenharmony_ci */
3388c2ecf20Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
3398c2ecf20Sopenharmony_cistruct mpt_ioctl_command32 {
3408c2ecf20Sopenharmony_ci	mpt_ioctl_header hdr;
3418c2ecf20Sopenharmony_ci	int	timeout;
3428c2ecf20Sopenharmony_ci	u32	replyFrameBufPtr;
3438c2ecf20Sopenharmony_ci	u32	dataInBufPtr;
3448c2ecf20Sopenharmony_ci	u32	dataOutBufPtr;
3458c2ecf20Sopenharmony_ci	u32	senseDataPtr;
3468c2ecf20Sopenharmony_ci	int	maxReplyBytes;
3478c2ecf20Sopenharmony_ci	int	dataInSize;
3488c2ecf20Sopenharmony_ci	int	dataOutSize;
3498c2ecf20Sopenharmony_ci	int	maxSenseBytes;
3508c2ecf20Sopenharmony_ci	int	dataSgeOffset;
3518c2ecf20Sopenharmony_ci	char	MF[1];
3528c2ecf20Sopenharmony_ci};
3538c2ecf20Sopenharmony_ci#endif	/*}*/
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci#define CPQFCTS_IOC_MAGIC 'Z'
3598c2ecf20Sopenharmony_ci#define HP_IOC_MAGIC 'Z'
3608c2ecf20Sopenharmony_ci#define HP_GETHOSTINFO		_IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
3618c2ecf20Sopenharmony_ci#define HP_GETHOSTINFO1		_IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
3628c2ecf20Sopenharmony_ci#define HP_GETTARGETINFO	_IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_citypedef struct _hp_header {
3658c2ecf20Sopenharmony_ci	unsigned int iocnum;
3668c2ecf20Sopenharmony_ci	unsigned int host;
3678c2ecf20Sopenharmony_ci	unsigned int channel;
3688c2ecf20Sopenharmony_ci	unsigned int id;
3698c2ecf20Sopenharmony_ci	unsigned int lun;
3708c2ecf20Sopenharmony_ci} hp_header_t;
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci/*
3738c2ecf20Sopenharmony_ci *  Header:
3748c2ecf20Sopenharmony_ci *  iocnum 	required (input)
3758c2ecf20Sopenharmony_ci *  host 	ignored
3768c2ecf20Sopenharmony_ci *  channe	ignored
3778c2ecf20Sopenharmony_ci *  id		ignored
3788c2ecf20Sopenharmony_ci *  lun		ignored
3798c2ecf20Sopenharmony_ci */
3808c2ecf20Sopenharmony_citypedef struct _hp_host_info {
3818c2ecf20Sopenharmony_ci	hp_header_t	 hdr;
3828c2ecf20Sopenharmony_ci	u16		 vendor;
3838c2ecf20Sopenharmony_ci	u16		 device;
3848c2ecf20Sopenharmony_ci	u16		 subsystem_vendor;
3858c2ecf20Sopenharmony_ci	u16		 subsystem_id;
3868c2ecf20Sopenharmony_ci	u8		 devfn;
3878c2ecf20Sopenharmony_ci	u8		 bus;
3888c2ecf20Sopenharmony_ci	ushort		 host_no;		/* SCSI Host number, if scsi driver not loaded*/
3898c2ecf20Sopenharmony_ci	u8		 fw_version[16];	/* string */
3908c2ecf20Sopenharmony_ci	u8		 serial_number[24];	/* string */
3918c2ecf20Sopenharmony_ci	u32		 ioc_status;
3928c2ecf20Sopenharmony_ci	u32		 bus_phys_width;
3938c2ecf20Sopenharmony_ci	u32		 base_io_addr;
3948c2ecf20Sopenharmony_ci	u32		 rsvd;
3958c2ecf20Sopenharmony_ci	unsigned int	 hard_resets;		/* driver initiated resets */
3968c2ecf20Sopenharmony_ci	unsigned int	 soft_resets;		/* ioc, external resets */
3978c2ecf20Sopenharmony_ci	unsigned int	 timeouts;		/* num timeouts */
3988c2ecf20Sopenharmony_ci} hp_host_info_t;
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci/* replace ulongs with uints, need to preserve backwards
4018c2ecf20Sopenharmony_ci * compatibility.
4028c2ecf20Sopenharmony_ci */
4038c2ecf20Sopenharmony_citypedef struct _hp_host_info_rev0 {
4048c2ecf20Sopenharmony_ci	hp_header_t	 hdr;
4058c2ecf20Sopenharmony_ci	u16		 vendor;
4068c2ecf20Sopenharmony_ci	u16		 device;
4078c2ecf20Sopenharmony_ci	u16		 subsystem_vendor;
4088c2ecf20Sopenharmony_ci	u16		 subsystem_id;
4098c2ecf20Sopenharmony_ci	u8		 devfn;
4108c2ecf20Sopenharmony_ci	u8		 bus;
4118c2ecf20Sopenharmony_ci	ushort		 host_no;		/* SCSI Host number, if scsi driver not loaded*/
4128c2ecf20Sopenharmony_ci	u8		 fw_version[16];	/* string */
4138c2ecf20Sopenharmony_ci	u8		 serial_number[24];	/* string */
4148c2ecf20Sopenharmony_ci	u32		 ioc_status;
4158c2ecf20Sopenharmony_ci	u32		 bus_phys_width;
4168c2ecf20Sopenharmony_ci	u32		 base_io_addr;
4178c2ecf20Sopenharmony_ci	u32		 rsvd;
4188c2ecf20Sopenharmony_ci	unsigned long	 hard_resets;		/* driver initiated resets */
4198c2ecf20Sopenharmony_ci	unsigned long	 soft_resets;		/* ioc, external resets */
4208c2ecf20Sopenharmony_ci	unsigned long	 timeouts;		/* num timeouts */
4218c2ecf20Sopenharmony_ci} hp_host_info_rev0_t;
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci/*
4248c2ecf20Sopenharmony_ci *  Header:
4258c2ecf20Sopenharmony_ci *  iocnum 	required (input)
4268c2ecf20Sopenharmony_ci *  host 	required
4278c2ecf20Sopenharmony_ci *  channel	required	(bus number)
4288c2ecf20Sopenharmony_ci *  id		required
4298c2ecf20Sopenharmony_ci *  lun		ignored
4308c2ecf20Sopenharmony_ci *
4318c2ecf20Sopenharmony_ci *  All error values between 0 and 0xFFFF in size.
4328c2ecf20Sopenharmony_ci */
4338c2ecf20Sopenharmony_citypedef struct _hp_target_info {
4348c2ecf20Sopenharmony_ci	hp_header_t	 hdr;
4358c2ecf20Sopenharmony_ci	u32 parity_errors;
4368c2ecf20Sopenharmony_ci	u32 phase_errors;
4378c2ecf20Sopenharmony_ci	u32 select_timeouts;
4388c2ecf20Sopenharmony_ci	u32 message_rejects;
4398c2ecf20Sopenharmony_ci	u32 negotiated_speed;
4408c2ecf20Sopenharmony_ci	u8  negotiated_width;
4418c2ecf20Sopenharmony_ci	u8  rsvd[7];				/* 8 byte alignment */
4428c2ecf20Sopenharmony_ci} hp_target_info_t;
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci#define HP_STATUS_OTHER		1
4458c2ecf20Sopenharmony_ci#define HP_STATUS_OK		2
4468c2ecf20Sopenharmony_ci#define HP_STATUS_FAILED	3
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci#define HP_BUS_WIDTH_UNK	1
4498c2ecf20Sopenharmony_ci#define HP_BUS_WIDTH_8		2
4508c2ecf20Sopenharmony_ci#define HP_BUS_WIDTH_16		3
4518c2ecf20Sopenharmony_ci#define HP_BUS_WIDTH_32		4
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_ASYNC	2
4548c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_FAST	3
4558c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_ULTRA	4
4568c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_ULTRA2	5
4578c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_ULTRA160	6
4588c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_SCSI1	7
4598c2ecf20Sopenharmony_ci#define HP_DEV_SPEED_ULTRA320	8
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci#endif
4678c2ecf20Sopenharmony_ci
468