Home | History | Annotate | Line # | Download | only in ic
icp_ioctl.h revision 1.2
      1 /*	$NetBSD: icp_ioctl.h,v 1.2 2003/06/13 05:57:30 thorpej Exp $	*/
      2 
      3 /*
      4  *       Copyright (c) 2000-03 Intel Corporation
      5  *       All Rights Reserved
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions, and the following disclaimer,
     12  *    without modification, immediately at the beginning of the file.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. The name of the author may not be used to endorse or promote products
     17  *    derived from this software without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
     23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  */
     31 
     32 /*
     33  * ioctl interface to ICP-Vortex RAID controllers.  Facilitates use of
     34  * ICP's configuration tools.
     35  */
     36 
     37 #ifndef _DEV_IC_ICP_IOCTL_H_
     38 #define	_DEV_IC_ICP_IOCTL_H_
     39 
     40 #include <sys/ioccom.h>
     41 #include <dev/ic/icpreg.h>
     42 
     43 #define	GDT_SCRATCH_SZ	3072	/* 3KB scratch buffer */
     44 
     45 /* general ioctl */
     46 typedef struct gdt_ucmd {
     47 	u_int16_t	io_node;
     48 	u_int16_t	service;
     49 	u_int32_t	timeout;
     50 	u_int16_t	status;
     51 	u_int32_t	info;
     52 
     53 	struct {
     54 		u_int32_t	cmd_boardnode;
     55 		u_int32_t	cmd_cmdindex;
     56 		u_int16_t	cmd_opcode;
     57 
     58 		union {
     59 			struct icp_rawcmd rc;
     60 			struct icp_ioctlcmd ic;
     61 			struct icp_cachecmd cc;
     62 		} cmd_packet;
     63 	} __attribute__((__packed__)) command;
     64 
     65 	u_int8_t	data[GDT_SCRATCH_SZ];
     66 } __attribute__((__packed__)) gdt_ucmd_t;
     67 #define	GDT_IOCTL_GENERAL	_IOWR('J', 0, gdt_ucmd_t)
     68 
     69 /* get driver version */
     70 #define	GDT_IOCTL_DRVERS	_IOWR('J', 1, int)
     71 
     72 /* get controller type */
     73 typedef struct gdt_ctrt {
     74 	u_int16_t	io_node;
     75 	u_int16_t	oem_id;
     76 	u_int16_t	type;
     77 	u_int32_t	info;
     78 	u_int8_t	access;
     79 	u_int8_t	remote;
     80 	u_int16_t	ext_type;
     81 	u_int16_t	device_id;
     82 	u_int16_t	sub_device_id;
     83 } __attribute__((__packed__)) gdt_ctrt_t;
     84 #define	GDT_IOCTL_CTRTYPE	_IOR('J', 2, gdt_ctrt_t)
     85 
     86 /* get OS version */
     87 typedef struct gdt_osv {
     88 	u_int8_t	oscode;
     89 	u_int8_t	version;
     90 	u_int8_t	subversion;
     91 	u_int16_t	revision;
     92 	char		name[64];
     93 } __attribute__((__packed__)) gdt_osv_t;
     94 #define	GDT_IOCTL_OSVERS	_IOR('J', 3, gdt_osv_t)
     95 
     96 /* get controller count */
     97 #define	GDT_IOCTL_CTRCNT	_IOR('J', 5, int)
     98 
     99 /* 6 -- lock host drive? */
    100 /* 7 -- lock channel? */
    101 
    102 /* get event */
    103 #define	GDT_ES_ASYNC		1
    104 #define	GDT_ES_DRIVER		2
    105 #define	GDT_ES_TEST		3
    106 #define	GDT_ES_SYNC		4
    107 typedef struct {
    108 	u_int16_t	size;		/* size of structure */
    109 	union {
    110 		char		stream[16];
    111 		struct {
    112 			u_int16_t	ionode;
    113 			u_int16_t	service;
    114 			u_int32_t	index;
    115 		} __attribute__((__packed__)) driver;
    116 		struct {
    117 			u_int16_t	ionode;
    118 			u_int16_t	service;
    119 			u_int16_t	status;
    120 			u_int32_t	info;
    121 			u_int8_t	scsi_coord[3];
    122 		} __attribute__((__packed__)) async;
    123 		struct {
    124 			u_int16_t	ionode;
    125 			u_int16_t	service;
    126 			u_int16_t	status;
    127 			u_int32_t	info;
    128 			u_int16_t	hostdrive;
    129 			u_int8_t	scsi_coord[3];
    130 			u_int8_t	sense_key;
    131 		} __attribute__((__packed__)) sync;
    132 		struct {
    133 			u_int32_t	l1;
    134 			u_int32_t	l2;
    135 			u_int32_t	l3;
    136 			u_int32_t	l4;
    137 		} __attribute__((__packed__)) test;
    138 	} eu;
    139 	u_int32_t	severity;
    140 	u_int8_t	event_string[256];
    141 } __attribute__((__packed__)) gdt_evt_data;
    142 
    143 typedef struct {
    144 	u_int32_t	first_stamp;
    145 	u_int32_t	last_stamp;
    146 	u_int16_t	same_count;
    147 	u_int16_t	event_source;
    148 	u_int16_t	event_idx;
    149 	u_int8_t	application;
    150 	u_int8_t	reserved;
    151 	gdt_evt_data	event_data;
    152 } __attribute__((__packed__)) gdt_evt_str;
    153 
    154 typedef struct gdt_event {
    155 	int		erase;
    156 	int		handle;
    157 	gdt_evt_str	dvr;
    158 } __attribute__((__packed__)) gdt_event_t;
    159 #define	GDT_IOCTL_EVENT		_IOWR('J', 7, gdt_event_t)
    160 
    161 /* get statistics */
    162 typedef struct gdt_statist {
    163 	u_int16_t	io_count_act;
    164 	u_int16_t	io_count_max;
    165 	u_int16_t	req_queue_act;
    166 	u_int16_t	req_queue_max;
    167 	u_int16_t	cmd_index_act;
    168 	u_int16_t	cmd_index_max;
    169 	u_int16_t	sg_count_act;
    170 	u_int16_t	sg_count_max;
    171 } __attribute__((__packed__)) gdt_statist_t;
    172 #define	GDT_IOCTL_STATIST	_IOR('J', 9, gdt_statist_t)
    173 
    174 /* rescan host drives */
    175 typedef struct gdt_rescan {
    176 	u_int16_t	io_node;
    177 	u_int8_t	flag;
    178 	u_int16_t	hdr_no;
    179 	struct {
    180 		u_int8_t	bus;
    181 		u_int8_t	target;
    182 		u_int8_t	lun;
    183 		u_int8_t	cluster_type;
    184 	} __attribute__((__packed__)) hdr_list[ICP_MAX_HDRIVES];
    185 } __attribute__((__packed__)) gdt_rescan_t;
    186 #define	GDT_IOCTL_RESCAN	_IOWR('J', 11, gdt_rescan_t)
    187 
    188 #endif /* _DEV_IC_ICP_IOCTL_H_ */
    189