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