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