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