Home | History | Annotate | Line # | Download | only in pci
twaio.h revision 1.1
      1 /*	$wasabi: twaio.h,v 1.8 2006/04/27 17:12:39 wrstuden Exp $ */
      2 /*
      3  * Copyright (c) 2005-2006 Wasabi Systems, Inc.
      4  * All rights reserved.
      5  *
      6  * Your Wasabi Systems License Agreement specifies the terms and
      7  * conditions for use and redistribution.
      8  */
      9 
     10 /*-
     11  * Copyright (c) 2003-04 3ware, Inc.
     12  * All rights reserved.
     13  *
     14  * Redistribution and use in source and binary forms, with or without
     15  * modification, are permitted provided that the following conditions
     16  * are met:
     17  * 1. Redistributions of source code must retain the above copyright
     18  *    notice, this list of conditions and the following disclaimer.
     19  * 2. Redistributions in binary form must reproduce the above copyright
     20  *    notice, this list of conditions and the following disclaimer in the
     21  *    documentation and/or other materials provided with the distribution.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  * SUCH DAMAGE.
     34  *
     35  *$FreeBSD: src/sys/dev/twa/twa_ioctl.h,v 1.1 2004/03/30 03:45:59 vkashyap Exp $
     36  */
     37 
     38 /*
     39  * 3ware driver for 9000 series storage controllers.
     40  *
     41  * Author: Vinod Kashyap
     42  */
     43 
     44 
     45 #ifndef _DEV_PCI_TWAIO_H_
     46 #define	_DEV_PCI_TWAIO_H_
     47 
     48 #define TWA_AEN_NOT_RETRIEVED	0x1
     49 #define TWA_AEN_RETRIEVED	0x2
     50 
     51 #define TWA_ERROR_AEN_NO_EVENTS	0x1003           /* No more events */
     52 #define TWA_ERROR_AEN_OVERFLOW	0x1004           /* AEN clobber occurred */
     53 
     54 #define TWA_ERROR_IOCTL_LOCK_NOT_HELD		0x1001   /* Not locked */
     55 #define TWA_ERROR_IOCTL_LOCK_ALREADY_HELD	0x1002   /* Already locked */
     56 
     57 
     58 struct twa_scan_bus_packet {
     59 	uint32_t	unit;
     60 } __attribute__ ((packed));
     61 
     62 struct tw_cl_event_packet {
     63 	uint32_t	sequence_id;
     64 	uint32_t	time_stamp_sec;
     65 	uint16_t	aen_code;
     66 	uint8_t		severity;
     67 	uint8_t		retrieved;
     68 	uint8_t		repeat_count;
     69 	uint8_t		parameter_len;
     70 	uint8_t		parameter_data[98];
     71 	uint32_t	event_src;
     72 	uint8_t		severity_str[20];
     73 } __attribute__ ((packed));
     74 
     75 struct tw_cl_lock_packet {
     76 	uint32_t	timeout_msec;
     77 	uint32_t	time_remaining_msec;
     78 	uint32_t	force_flag;
     79 } __attribute__ ((packed));
     80 
     81 
     82 struct tw_cl_compatibility_packet {
     83 	uint8_t		driver_version[32];/* driver version */
     84 	uint16_t	working_srl;	/* driver & firmware negotiated srl */
     85 	uint16_t	working_branch;	/* branch # of the firmware that the driver is compatible with */
     86 	uint16_t	working_build;	/* build # of the firmware that the driver is compatible with */
     87 } __attribute__ ((packed));
     88 
     89 
     90 struct twa_driver_packet {
     91 	uint32_t	control_code;
     92 	uint32_t	status;
     93 	uint32_t	unique_id;
     94 	uint32_t	sequence_id;
     95 	uint32_t	os_status;
     96 	uint32_t	buffer_length;
     97 } __attribute__ ((packed));
     98 
     99 /* Account for differences between 32/64 bit system. Offsets into memory
    100  * are anticipated for driver/firmware command packets and having a
    101  * variable sized pointer depending on architecture add 4 bytes to any offset
    102  * after the pdata declaration
    103  */
    104 #define TW_SIZEOF_VOIDPTR		(sizeof(void *))
    105 
    106 struct twa_ioctl_9k {
    107 	struct twa_driver_packet	twa_drvr_pkt;
    108 	void				*pdata; /* points to data_buf */
    109 	int8_t				padding[488 - TW_SIZEOF_VOIDPTR];
    110 	struct twa_command_packet	twa_cmd_pkt;
    111 	int8_t				data_buf[1];
    112 } __attribute__ ((packed));
    113 
    114 
    115 /*
    116  * We need the structure below to ensure that the first byte of
    117  * data_buf is not overwritten by the kernel, after we return
    118  * from the ioctl call.  Note that twa_cmd_pkt has been reduced
    119  * to an array of 1024 bytes even though it's actually 2048 bytes
    120  * in size.  This is because, we don't expect requests from user
    121  * land requiring 2048 (273 sg elements) byte cmd pkts.
    122  */
    123 typedef struct twa_ioctl_no_data_buf {
    124 	struct twa_driver_packet	twa_drvr_pkt;
    125 	void				*pdata; /* points to data_buf */
    126 	int8_t				padding[484];
    127 	struct twa_command_packet	twa_cmd_pkt;
    128 }  __attribute__ ((packed)) TWA_IOCTL_NO_DATA_BUF;
    129 
    130 /*
    131  * Get the device external name of the specified array unit.
    132  */
    133  /* WASABI */
    134 struct twa_unitname {
    135 	int		tn_unit;
    136 	char		tn_name[16];	/* XXX sizeof(dev->dv_xname) */
    137 };
    138 
    139 #define TW_OSL_IOCTL_SCAN_BUS		_IO ('T', 200)
    140 
    141 #define TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH 	\
    142 	_IOWR('T', 202, TWA_IOCTL_NO_DATA_BUF)
    143 
    144 #define TW_CL_IOCTL_GET_FIRST_EVENT	_IOWR('T', 203, TWA_IOCTL_NO_DATA_BUF)
    145 #define TW_CL_IOCTL_GET_LAST_EVENT	_IOWR('T', 204, TWA_IOCTL_NO_DATA_BUF)
    146 #define TW_CL_IOCTL_GET_NEXT_EVENT	_IOWR('T', 205, TWA_IOCTL_NO_DATA_BUF)
    147 #define TW_CL_IOCTL_GET_PREVIOUS_EVENT	_IOWR('T', 206, TWA_IOCTL_NO_DATA_BUF)
    148 #define TW_CL_IOCTL_GET_LOCK		_IOWR('T', 207, TWA_IOCTL_NO_DATA_BUF)
    149 #define TW_CL_IOCTL_RELEASE_LOCK	_IOWR('T', 208, TWA_IOCTL_NO_DATA_BUF)
    150 #define TW_CL_IOCTL_GET_COMPATIBILITY_INFO 	\
    151 	_IOWR('T', 209, TWA_IOCTL_NO_DATA_BUF)
    152 /* WASABI */
    153 #define	TWA_IOCTL_GET_UNITNAME		_IOWR('T', 220, struct twa_unitname)
    154 
    155 #endif /* _DEV_PCI_TWAIO_H_ */
    156