1 /*-
2 * Copyright (c) 2003-04 3ware, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29 /*
30 * 3ware driver for 9000 series storage controllers.
31 *
32 * Author: Vinod Kashyap
33 */
34
35
36 #define TWA_AEN_NOT_RETRIEVED 0x1
37 #define TWA_AEN_RETRIEVED 0x2
38
39 #define TWA_ERROR_AEN_NO_EVENTS 0x1003 /* No more events */
40 #define TWA_ERROR_AEN_OVERFLOW 0x1004 /* AEN clobber occurred */
41
42 #define TWA_ERROR_IOCTL_LOCK_NOT_HELD 0x1001 /* Not locked */
43 #define TWA_ERROR_IOCTL_LOCK_ALREADY_HELD 0x1002 /* Already locked */
44
45
46 #pragma pack(1)
47 struct twa_scan_bus_packet {
48 u_int32_t unit;
49 } __attribute__ ((packed));
50
51
52 struct twa_event_packet {
53 u_int32_t sequence_id;
54 u_int32_t time_stamp_sec;
55 u_int16_t aen_code;
56 u_int8_t severity;
57 u_int8_t retrieved;
58 u_int8_t repeat_count;
59 u_int8_t parameter_len;
60 u_int8_t parameter_data[98];
61 } __attribute__ ((packed));
62
63
64 struct twa_lock_packet {
65 u_int32_t timeout_msec;
66 u_int32_t time_remaining_msec;
67 u_int32_t force_flag;
68 } __attribute__ ((packed));
69
70
71 struct twa_compatibility_packet {
72 uint8_t driver_version[32];/* driver version */
73 uint16_t working_srl; /* driver & firmware negotiated srl */
74 uint16_t working_branch; /* branch # of the firmware that the driver is compatible with */
75 uint16_t working_build; /* build # of the firmware that the driver is compatible with */
76 } __attribute__ ((packed));
77
78
79 struct twa_driver_packet {
80 u_int32_t control_code;
81 u_int32_t status;
82 u_int32_t unique_id;
83 u_int32_t sequence_id;
84 u_int32_t os_status;
85 u_int32_t buffer_length;
86 } __attribute__ ((packed));
87
88
89 struct twa_ioctl_9k {
90 struct twa_driver_packet twa_drvr_pkt;
91 void *pdata; /* points to data_buf */
92 int8_t padding[484];
93 struct twa_command_packet twa_cmd_pkt;
94 int8_t data_buf[1];
95 } __attribute__ ((packed));
96
97
98 /*
99 * We need the structure below to ensure that the first byte of
100 * data_buf is not overwritten by the kernel, after we return
101 * from the ioctl call. Note that twa_cmd_pkt has been reduced
102 * to an array of 1024 bytes even though it's actually 2048 bytes
103 * in size. This is because, we don't expect requests from user
104 * land requiring 2048 (273 sg elements) byte cmd pkts.
105 */
106 typedef struct twa_ioctl_no_data_buf {
107 struct twa_driver_packet twa_drvr_pkt;
108 void *pdata; /* points to data_buf */
109 int8_t padding[484];
110 struct twa_command_packet twa_cmd_pkt;
111 } __attribute__ ((packed)) TWA_IOCTL_NO_DATA_BUF;
112 #pragma pack()
113
114
115 #define TWA_IOCTL_SCAN_BUS _IOW ('T', 200, u_int32_t)
116 #define TWA_IOCTL_FIRMWARE_PASS_THROUGH _IOWR('T', 202, TWA_IOCTL_NO_DATA_BUF)
117 #define TWA_IOCTL_GET_FIRST_EVENT _IOWR('T', 203, TWA_IOCTL_NO_DATA_BUF)
118 #define TWA_IOCTL_GET_LAST_EVENT _IOWR('T', 204, TWA_IOCTL_NO_DATA_BUF)
119 #define TWA_IOCTL_GET_NEXT_EVENT _IOWR('T', 205, TWA_IOCTL_NO_DATA_BUF)
120 #define TWA_IOCTL_GET_PREVIOUS_EVENT _IOWR('T', 206, TWA_IOCTL_NO_DATA_BUF)
121 #define TWA_IOCTL_GET_LOCK _IOWR('T', 207, TWA_IOCTL_NO_DATA_BUF)
122 #define TWA_IOCTL_RELEASE_LOCK _IOWR('T', 208, TWA_IOCTL_NO_DATA_BUF)
123 #define TWA_IOCTL_GET_COMPATIBILITY_INFO _IOWR('T', 209, TWA_IOCTL_NO_DATA_BUF)
124
125
Cache object: 72149cd98f13b8ae9697db96f0d4c2cf
|