Merge branch 'vendor/OPENSSL'
[dragonfly.git] / sys / dev / raid / ida / idareg.h
1 /*-
2  * Copyright (c) 1999,2000 Jonathan Lemon
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: src/sys/dev/ida/idareg.h,v 1.3.2.2 2000/07/27 22:27:39 jlemon Exp $
27  * $DragonFly: src/sys/dev/raid/ida/idareg.h,v 1.2 2003/06/17 04:28:27 dillon Exp $
28  */
29
30 /*
31  * #defines and software structures for the Compaq RAID card
32  */
33
34 /*
35  * defines for older EISA controllers (IDA, IDA-2, IAES, SMART)
36  */
37 #define R_EISA_INT_MASK                 0x01
38 #define R_EISA_LOCAL_MASK               0x04
39 #define R_EISA_LOCAL_DOORBELL           0x05
40 #define R_EISA_SYSTEM_MASK              0x06
41 #define R_EISA_SYSTEM_DOORBELL          0x07
42 #define R_EISA_LIST_ADDR                0x08
43 #define R_EISA_LIST_LEN                 0x0c
44 #define R_EISA_TAG                      0x0f
45 #define R_EISA_COMPLETE_ADDR            0x10
46 #define R_EISA_LIST_STATUS              0x16
47
48 #define EISA_CHANNEL_BUSY               0x01
49 #define EISA_CHANNEL_CLEAR              0x02
50
51 /*
52  * board register offsets for SMART-2 controllers
53  */
54 #define R_CMD_FIFO      0x04
55 #define R_DONE_FIFO     0x08
56 #define R_INT_MASK      0x0C
57 #define R_STATUS        0x10
58 #define R_INT_PENDING   0x14
59
60 /*
61  * interrupt mask values for SMART series
62  */
63 #define INT_DISABLE     0x00
64 #define INT_ENABLE      0x01
65
66 /*
67  * board offsets for the 42xx series
68  */
69 #define R_42XX_STATUS   0x30
70 #define R_42XX_INT_MASK 0x34
71 #define R_42XX_REQUEST  0x40
72 #define R_42XX_REPLY    0x44
73
74 /*
75  * interrupt values for 42xx series
76  */
77 #define INT_ENABLE_42XX                 0x00
78 #define INT_DISABLE_42XX                0x08
79 #define STATUS_42XX_INT_PENDING         0x08
80
81 /*
82  * return status codes
83  */
84 #define SOFT_ERROR      0x02
85 #define HARD_ERROR      0x04
86 #define CMD_REJECTED    0x14
87
88 /*
89  * command types 
90  */
91 #define CMD_GET_LOG_DRV_INFO    0x10
92 #define CMD_GET_CTRL_INFO       0x11
93 #define CMD_SENSE_DRV_STATUS    0x12
94 #define CMD_START_RECOVERY      0x13
95 #define CMD_GET_PHYS_DRV_INFO   0x15
96 #define CMD_BLINK_DRV_LEDS      0x16
97 #define CMD_SENSE_DRV_LEDS      0x17
98 #define CMD_GET_LOG_DRV_EXT     0x18
99 #define CMD_GET_CTRL_INFO       0x11
100 #define CMD_READ                0x20
101 #define CMD_WRITE               0x30
102 #define CMD_WRITE_MEDIA         0x31
103 #define CMD_GET_CONFIG          0x50
104 #define CMD_SET_CONFIG          0x51
105 #define CMD_START_FIRMWARE      0x99            /* for integrated RAID */
106 #define CMD_FLUSH_CACHE         0xc2
107
108 /*
109  * command structures
110  */
111 struct ida_drive_info {
112         u_int16_t       secsize;
113         u_int32_t       secperunit;
114         u_int16_t       ncylinders;
115         u_int8_t        nheads;
116         u_int8_t        signature;
117         u_int8_t        psectors;
118         u_int16_t       wprecomp;
119         u_int8_t        max_acc;
120         u_int8_t        control;
121         u_int16_t       pcylinders;
122         u_int8_t        ptracks;
123         u_int16_t       landing_zone;
124         u_int8_t        nsectors;
125         u_int8_t        checksum;
126         u_int8_t        mirror;
127 } __attribute__ ((packed));
128
129 struct ida_controller_info {
130         u_int8_t        num_drvs;
131         u_int32_t       signature;
132         u_int8_t        firm_rev[4];
133 } __attribute__ ((packed));
134
135
136 struct ida_drive_status {
137         u_int8_t        status;
138         u_int32_t       failure_map;
139         u_int8_t        reserved[416];
140         u_int32_t       secrecover;
141         u_int8_t        rebuilding;
142         u_int16_t       remap_cnt[8];
143         u_int32_t       repl_map;
144         u_int32_t       spare_map;
145         u_int8_t        spare_status;
146         u_int8_t        spare_repl_map[32];
147         u_int32_t       repl_ok_map;
148         u_int8_t        media_exchange;
149         u_int8_t        cache_failure;
150         u_int8_t        expand_failure;
151         u_int8_t        unit_flags;
152         u_int16_t       big_failure_map[8];
153         u_int16_t       big_remap_cnt[128];
154         u_int16_t       big_repl_map[8];
155         u_int16_t       big_act_spare_map[8];
156         u_int8_t        big_spare_repl_map[128];
157         u_int16_t       big_repl_ok_map[8];
158         u_int8_t        big_rebuilding;
159 } __attribute__ ((packed));