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