icp_ioctl.h revision 1.3 1 1.3 thorpej /* $NetBSD: icp_ioctl.h,v 1.3 2003/06/29 01:28:23 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 2000-03 Intel Corporation
5 1.1 thorpej * 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.1 thorpej * 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.1 thorpej #include <sys/ioccom.h>
41 1.1 thorpej #include <dev/ic/icpreg.h>
42 1.1 thorpej
43 1.1 thorpej #define GDT_SCRATCH_SZ 3072 /* 3KB scratch buffer */
44 1.1 thorpej
45 1.1 thorpej /* general ioctl */
46 1.1 thorpej typedef struct gdt_ucmd {
47 1.1 thorpej u_int16_t io_node;
48 1.1 thorpej u_int16_t service;
49 1.1 thorpej u_int32_t timeout;
50 1.1 thorpej u_int16_t status;
51 1.1 thorpej u_int32_t info;
52 1.1 thorpej
53 1.1 thorpej struct {
54 1.1 thorpej u_int32_t cmd_boardnode;
55 1.1 thorpej u_int32_t cmd_cmdindex;
56 1.1 thorpej u_int16_t cmd_opcode;
57 1.1 thorpej
58 1.1 thorpej union {
59 1.1 thorpej struct icp_rawcmd rc;
60 1.1 thorpej struct icp_ioctlcmd ic;
61 1.1 thorpej struct icp_cachecmd cc;
62 1.1 thorpej } cmd_packet;
63 1.1 thorpej } __attribute__((__packed__)) command;
64 1.1 thorpej
65 1.1 thorpej u_int8_t data[GDT_SCRATCH_SZ];
66 1.1 thorpej } __attribute__((__packed__)) gdt_ucmd_t;
67 1.1 thorpej #define GDT_IOCTL_GENERAL _IOWR('J', 0, gdt_ucmd_t)
68 1.1 thorpej
69 1.1 thorpej /* get driver version */
70 1.3 thorpej #define GDT_IOCTL_DRVERS _IOR('J', 1, int)
71 1.1 thorpej
72 1.1 thorpej /* get controller type */
73 1.1 thorpej typedef struct gdt_ctrt {
74 1.1 thorpej u_int16_t io_node;
75 1.1 thorpej u_int16_t oem_id;
76 1.1 thorpej u_int16_t type;
77 1.1 thorpej u_int32_t info;
78 1.1 thorpej u_int8_t access;
79 1.1 thorpej u_int8_t remote;
80 1.1 thorpej u_int16_t ext_type;
81 1.1 thorpej u_int16_t device_id;
82 1.1 thorpej u_int16_t sub_device_id;
83 1.1 thorpej } __attribute__((__packed__)) gdt_ctrt_t;
84 1.3 thorpej #define GDT_IOCTL_CTRTYPE _IOWR('J', 2, gdt_ctrt_t)
85 1.1 thorpej
86 1.1 thorpej /* get OS version */
87 1.1 thorpej typedef struct gdt_osv {
88 1.1 thorpej u_int8_t oscode;
89 1.1 thorpej u_int8_t version;
90 1.1 thorpej u_int8_t subversion;
91 1.1 thorpej u_int16_t revision;
92 1.1 thorpej char name[64];
93 1.1 thorpej } __attribute__((__packed__)) gdt_osv_t;
94 1.1 thorpej #define GDT_IOCTL_OSVERS _IOR('J', 3, gdt_osv_t)
95 1.1 thorpej
96 1.1 thorpej /* get controller count */
97 1.1 thorpej #define GDT_IOCTL_CTRCNT _IOR('J', 5, int)
98 1.1 thorpej
99 1.1 thorpej /* 6 -- lock host drive? */
100 1.1 thorpej /* 7 -- lock channel? */
101 1.1 thorpej
102 1.1 thorpej /* get event */
103 1.1 thorpej #define GDT_ES_ASYNC 1
104 1.1 thorpej #define GDT_ES_DRIVER 2
105 1.1 thorpej #define GDT_ES_TEST 3
106 1.1 thorpej #define GDT_ES_SYNC 4
107 1.1 thorpej typedef struct {
108 1.1 thorpej u_int16_t size; /* size of structure */
109 1.1 thorpej union {
110 1.1 thorpej char stream[16];
111 1.1 thorpej struct {
112 1.1 thorpej u_int16_t ionode;
113 1.1 thorpej u_int16_t service;
114 1.1 thorpej u_int32_t index;
115 1.1 thorpej } __attribute__((__packed__)) driver;
116 1.1 thorpej struct {
117 1.1 thorpej u_int16_t ionode;
118 1.1 thorpej u_int16_t service;
119 1.1 thorpej u_int16_t status;
120 1.1 thorpej u_int32_t info;
121 1.1 thorpej u_int8_t scsi_coord[3];
122 1.1 thorpej } __attribute__((__packed__)) async;
123 1.1 thorpej struct {
124 1.1 thorpej u_int16_t ionode;
125 1.1 thorpej u_int16_t service;
126 1.1 thorpej u_int16_t status;
127 1.1 thorpej u_int32_t info;
128 1.1 thorpej u_int16_t hostdrive;
129 1.1 thorpej u_int8_t scsi_coord[3];
130 1.1 thorpej u_int8_t sense_key;
131 1.1 thorpej } __attribute__((__packed__)) sync;
132 1.1 thorpej struct {
133 1.1 thorpej u_int32_t l1;
134 1.1 thorpej u_int32_t l2;
135 1.1 thorpej u_int32_t l3;
136 1.1 thorpej u_int32_t l4;
137 1.1 thorpej } __attribute__((__packed__)) test;
138 1.1 thorpej } eu;
139 1.1 thorpej u_int32_t severity;
140 1.1 thorpej u_int8_t event_string[256];
141 1.1 thorpej } __attribute__((__packed__)) gdt_evt_data;
142 1.1 thorpej
143 1.1 thorpej typedef struct {
144 1.1 thorpej u_int32_t first_stamp;
145 1.1 thorpej u_int32_t last_stamp;
146 1.1 thorpej u_int16_t same_count;
147 1.1 thorpej u_int16_t event_source;
148 1.1 thorpej u_int16_t event_idx;
149 1.1 thorpej u_int8_t application;
150 1.1 thorpej u_int8_t reserved;
151 1.1 thorpej gdt_evt_data event_data;
152 1.1 thorpej } __attribute__((__packed__)) gdt_evt_str;
153 1.1 thorpej
154 1.1 thorpej typedef struct gdt_event {
155 1.1 thorpej int erase;
156 1.1 thorpej int handle;
157 1.1 thorpej gdt_evt_str dvr;
158 1.1 thorpej } __attribute__((__packed__)) gdt_event_t;
159 1.1 thorpej #define GDT_IOCTL_EVENT _IOWR('J', 7, gdt_event_t)
160 1.1 thorpej
161 1.1 thorpej /* get statistics */
162 1.1 thorpej typedef struct gdt_statist {
163 1.1 thorpej u_int16_t io_count_act;
164 1.1 thorpej u_int16_t io_count_max;
165 1.1 thorpej u_int16_t req_queue_act;
166 1.1 thorpej u_int16_t req_queue_max;
167 1.1 thorpej u_int16_t cmd_index_act;
168 1.1 thorpej u_int16_t cmd_index_max;
169 1.1 thorpej u_int16_t sg_count_act;
170 1.1 thorpej u_int16_t sg_count_max;
171 1.1 thorpej } __attribute__((__packed__)) gdt_statist_t;
172 1.1 thorpej #define GDT_IOCTL_STATIST _IOR('J', 9, gdt_statist_t)
173 1.2 thorpej
174 1.2 thorpej /* rescan host drives */
175 1.2 thorpej typedef struct gdt_rescan {
176 1.2 thorpej u_int16_t io_node;
177 1.2 thorpej u_int8_t flag;
178 1.2 thorpej u_int16_t hdr_no;
179 1.2 thorpej struct {
180 1.2 thorpej u_int8_t bus;
181 1.2 thorpej u_int8_t target;
182 1.2 thorpej u_int8_t lun;
183 1.2 thorpej u_int8_t cluster_type;
184 1.2 thorpej } __attribute__((__packed__)) hdr_list[ICP_MAX_HDRIVES];
185 1.2 thorpej } __attribute__((__packed__)) gdt_rescan_t;
186 1.2 thorpej #define GDT_IOCTL_RESCAN _IOWR('J', 11, gdt_rescan_t)
187 1.1 thorpej
188 1.1 thorpej #endif /* _DEV_IC_ICP_IOCTL_H_ */
189