WARNS6 cleanups
[dragonfly.git] / sys / bus / pccard / pccardreg.h
1 /*      $NetBSD: pcmciareg.h,v 1.7 1998/10/29 09:45:52 enami Exp $      */
2 /* $FreeBSD: src/sys/dev/pccard/pccardreg.h,v 1.1 1999/10/26 06:52:31 imp Exp $ */
3 /* $DragonFly: src/sys/bus/pccard/pccardreg.h,v 1.3 2004/02/10 07:55:45 joerg Exp $ */
4
5 /*
6  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by Marc Horowitz.
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 /* most of this is from the PCCARD PC Card Standard, Release 2.1 */
35
36 /* Note: the weird indenting here is to make the constants more
37    readable.  Please don't normalize it.  --marc */
38
39 /*
40  * CIS Tuples */
41
42 /* Layer 1 Basic Compatibility Tuples */
43 #define PCCARD_CISTPL_NULL                      0x00
44 #define PCCARD_CISTPL_DEVICE                    0x01
45 #define PCCARD_DTYPE_MASK                               0xF0
46 #define PCCARD_DTYPE_NULL                                       0x00
47 #define PCCARD_DTYPE_ROM                                        0x10
48 #define PCCARD_DTYPE_OTPROM                                     0x20
49 #define PCCARD_DTYPE_EPROM                                      0x30
50 #define PCCARD_DTYPE_EEPROM                                     0x40
51 #define PCCARD_DTYPE_FLASH                                      0x50
52 #define PCCARD_DTYPE_SRAM                                       0x60
53 #define PCCARD_DTYPE_DRAM                                       0x70
54 #define PCCARD_DTYPE_FUNCSPEC                                   0xD0
55 #define PCCARD_DTYPE_EXTEND                                     0xE0
56 #define PCCARD_DSPEED_MASK                              0x07
57 #define PCCARD_DSPEED_NULL                                      0x00
58 #define PCCARD_DSPEED_250NS                                     0x01
59 #define PCCARD_DSPEED_200NS                                     0x02
60 #define PCCARD_DSPEED_150NS                                     0x03
61 #define PCCARD_DSPEED_100NS                                     0x04
62 #define PCCARD_DSPEED_EXT                                       0x07
63
64 /*
65  * the 2.1 docs have 0x02-0x07 as reserved, but the linux drivers list the
66  * follwing tuple code values.  I have at least one card (3com 3c562
67  * lan+modem) which has a code 0x06 tuple, so I'm going to assume that these
68  * are for real
69  */
70
71 #define PCCARD_CISTPL_LONGLINK_CB               0x02
72 #define PCCARD_CISTPL_INDIRECT          0x03
73 #define PCCARD_CISTPL_CONFIG_CB                 0x04
74 #define PCCARD_CISTPL_CFTABLE_ENTRY_CB          0x05
75 #define PCCARD_CISTPL_LONGLINK_MFC              0x06
76 #define PCCARD_MFC_MEM_ATTR                             0x00
77 #define PCCARD_MFC_MEM_COMMON                           0x01
78 #define PCCARD_CISTPL_BAR                       0x07
79 #define PCCARD_CISTPL_PWR_MGMNT                 0x08
80
81 #define PCCARD_CISTPL_CHECKSUM                  0x10
82 #define PCCARD_CISTPL_LONGLINK_A                0x11
83 #define PCCARD_CISTPL_LONGLINK_C                0x12
84 #define PCCARD_CISTPL_LINKTARGET                0x13
85 #define PCCARD_CISTPL_NO_LINK                   0x14
86 #define PCCARD_CISTPL_VERS_1                    0x15
87 #define PCCARD_CISTPL_ALTSTR                    0x16
88 #define PCCARD_CISTPL_DEVICE_A                  0x17
89 #define PCCARD_CISTPL_JEDEC_C                   0x18
90 #define PCCARD_CISTPL_JEDEC_A                   0x19
91 #define PCCARD_CISTPL_CONFIG                    0x1A
92 #define PCCARD_TPCC_RASZ_MASK                           0x03
93 #define PCCARD_TPCC_RASZ_SHIFT                          0
94 #define PCCARD_TPCC_RMSZ_MASK                           0x3C
95 #define PCCARD_TPCC_RMSZ_SHIFT                          2
96 #define PCCARD_TPCC_RFSZ_MASK                           0xC0
97 #define PCCARD_TPCC_RFSZ_SHIFT                          6
98 #define PCCARD_CISTPL_CFTABLE_ENTRY             0x1B
99 #define PCCARD_TPCE_INDX_INTFACE                        0x80
100 #define PCCARD_TPCE_INDX_DEFAULT                        0x40
101 #define PCCARD_TPCE_INDX_NUM_MASK                       0x3F
102 #define PCCARD_TPCE_IF_MWAIT                            0x80
103 #define PCCARD_TPCE_IF_RDYBSY                           0x40
104 #define PCCARD_TPCE_IF_WP                               0x20
105 #define PCCARD_TPCE_IF_BVD                              0x10
106 #define PCCARD_TPCE_IF_IFTYPE                           0x0F
107 #define PCCARD_IFTYPE_MEMORY                                    0
108 #define PCCARD_IFTYPE_IO                                        1
109 #define PCCARD_TPCE_FS_MISC                             0x80
110 #define PCCARD_TPCE_FS_MEMSPACE_MASK                    0x60
111 #define PCCARD_TPCE_FS_MEMSPACE_NONE                            0x00
112 #define PCCARD_TPCE_FS_MEMSPACE_LENGTH                          0x20
113 #define PCCARD_TPCE_FS_MEMSPACE_LENGTHADDR                      0x40
114 #define PCCARD_TPCE_FS_MEMSPACE_TABLE                           0x60
115 #define PCCARD_TPCE_FS_IRQ                              0x10
116 #define PCCARD_TPCE_FS_IOSPACE                          0x08
117 #define PCCARD_TPCE_FS_TIMING                           0x04
118 #define PCCARD_TPCE_FS_POWER_MASK                       0x03
119 #define PCCARD_TPCE_FS_POWER_NONE                               0x00
120 #define PCCARD_TPCE_FS_POWER_VCC                                0x01
121 #define PCCARD_TPCE_FS_POWER_VCCVPP1                            0x02
122 #define PCCARD_TPCE_FS_POWER_VCCVPP1VPP2                        0x03
123 #define PCCARD_TPCE_TD_RESERVED_MASK                    0xE0
124 #define PCCARD_TPCE_TD_RDYBSY_MASK                      0x1C
125 #define PCCARD_TPCE_TD_WAIT_MASK                        0x03
126 #define PCCARD_TPCE_IO_HASRANGE                         0x80
127 #define PCCARD_TPCE_IO_BUSWIDTH_16BIT                   0x40
128 #define PCCARD_TPCE_IO_BUSWIDTH_8BIT                    0x20
129 #define PCCARD_TPCE_IO_IOADDRLINES_MASK                 0x1F
130 #define PCCARD_TPCE_IO_RANGE_LENGTHSIZE_MASK            0xC0
131 #define PCCARD_TPCE_IO_RANGE_LENGTHSIZE_NONE                    0x00
132 #define PCCARD_TPCE_IO_RANGE_LENGTHSIZE_ONE                     0x40
133 #define PCCARD_TPCE_IO_RANGE_LENGTHSIZE_TWO                     0x80
134 #define PCCARD_TPCE_IO_RANGE_LENGTHSIZE_FOUR                    0xC0
135 #define PCCARD_TPCE_IO_RANGE_ADDRSIZE_MASK              0x30
136 #define PCCARD_TPCE_IO_RANGE_ADDRSIZE_NONE                      0x00
137 #define PCCARD_TPCE_IO_RANGE_ADDRSIZE_ONE                       0x10
138 #define PCCARD_TPCE_IO_RANGE_ADDRSIZE_TWO                       0x20
139 #define PCCARD_TPCE_IO_RANGE_ADDRSIZE_FOUR                      0x30
140 #define PCCARD_TPCE_IO_RANGE_COUNT                      0x0F
141 #define PCCARD_TPCE_IR_SHARE                            0x80
142 #define PCCARD_TPCE_IR_PULSE                            0x40
143 #define PCCARD_TPCE_IR_LEVEL                            0x20
144 #define PCCARD_TPCE_IR_HASMASK                          0x10
145 #define PCCARD_TPCE_IR_IRQ                              0x0F
146 #define PCCARD_TPCE_MS_HOSTADDR                         0x80
147 #define PCCARD_TPCE_MS_CARDADDR_SIZE_MASK               0x60
148 #define PCCARD_TPCE_MS_CARDADDR_SIZE_SHIFT              5
149 #define PCCARD_TPCE_MS_LENGTH_SIZE_MASK                 0x18
150 #define PCCARD_TPCE_MS_LENGTH_SIZE_SHIFT                3
151 #define PCCARD_TPCE_MS_COUNT                            0x07
152 #define PCCARD_TPCE_MI_EXT                              0x80
153 #define PCCARD_TPCE_MI_RESERVED                         0x40
154 #define PCCARD_TPCE_MI_PWRDOWN                          0x20
155 #define PCCARD_TPCE_MI_READONLY                         0x10
156 #define PCCARD_TPCE_MI_AUDIO                            0x08
157 #define PCCARD_TPCE_MI_MAXTWINS                         0x07
158 #define PCCARD_CISTPL_DEVICE_OC                 0x1C
159 #define PCCARD_CISTPL_DEVICE_OA                 0x1D
160 #define PCCARD_CISTPL_DEVICE_GEO                0x1E
161 #define PCCARD_CISTPL_DEVICE_GEO_A              0x1F
162 #define PCCARD_CISTPL_MANFID                    0x20
163 #define PCCARD_CISTPL_FUNCID                    0x21
164 #define PCCARD_FUNCTION_UNSPEC          -1
165 #define PCCARD_FUNCTION_MULTIFUNCTION   0
166 #define PCCARD_FUNCTION_MEMORY          1
167 #define PCCARD_FUNCTION_SERIAL          2
168 #define PCCARD_FUNCTION_PARALLEL        3
169 #define PCCARD_FUNCTION_DISK            4
170 #define PCCARD_FUNCTION_VIDEO           5
171 #define PCCARD_FUNCTION_NETWORK         6
172 #define PCCARD_FUNCTION_AIMS            7
173 #define PCCARD_FUNCTION_SCSI            8
174 #define PCCARD_FUNCTION_SECURITY        9
175 #define PCCARD_FUNCTION_INSTRUMENT      10
176 #define PCCARD_CISTPL_FUNCE                     0x22
177 #define PCCARD_TPLFE_TYPE_LAN_TECH                      0x01
178 #define PCCARD_TPLFE_TYPE_LAN_SPEED                     0x02
179 #define PCCARD_TPLFE_TYPE_LAN_MEDIA                     0x03
180 #define PCCARD_TPLFE_TYPE_LAN_NID                       0x04
181 #define PCCARD_TPLFE_TYPE_LAN_CONN                      0x05
182 #define PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE         0x01
183 #define PCCARD_TPLFE_DDI_PCCARD_ATA                             0x01
184 #define PCCARD_CISTPL_END                       0xFF
185
186 /* Layer 2 Data Recording Format Tuples */
187
188 #define PCCARD_CISTPL_SWIL                      0x23
189 /* #define      PCCARD_CISTPL_RESERVED          0x24-0x3F */
190 #define PCCARD_CISTPL_VERS_2                    0x40
191 #define PCCARD_CISTPL_FORMAT                    0x41
192 #define PCCARD_CISTPL_GEOMETRY                  0x42
193 #define PCCARD_CISTPL_BYTEORDER                 0x43
194 #define PCCARD_CISTPL_DATE                      0x44
195 #define PCCARD_CISTPL_BATTERY                   0x45
196 #define PCCARD_CISTPL_FORAMT_A                  0x47
197
198 /* Layer 3 Data Organization Tuples */
199
200 #define PCCARD_CISTPL_ORG                       0x46
201 /* #define      PCCARD_CISTPL_RESERVED          0x47-0x7F */
202
203 /* Layer 4 System-Specific Standard Tuples */
204
205 /* #define      PCCARD_CISTPL_RESERVED          0x80-0x8F */
206 #define PCCARD_CISTPL_SPCL                      0x90
207 /* #define      PCCARD_CISTPL_RESERVED          0x90-0xFE */
208
209 /*
210  * Card Configuration Registers
211  */
212
213 #define PCCARD_CCR_OPTION                       0x00
214 #define PCCARD_CCR_OPTION_SRESET                        0x80
215 #define PCCARD_CCR_OPTION_LEVIREQ                       0x40
216 #define PCCARD_CCR_OPTION_CFINDEX                       0x3F
217 #define PCCARD_CCR_OPTION_IREQ_ENABLE                   0x04
218 #define PCCARD_CCR_OPTION_ADDR_DECODE                   0x02
219 #define PCCARD_CCR_OPTION_FUNC_ENABLE                   0x01
220 #define PCCARD_CCR_STATUS                       0x02
221 #define PCCARD_CCR_STATUS_PINCHANGED                    0x80
222 #define PCCARD_CCR_STATUS_SIGCHG                        0x40
223 #define PCCARD_CCR_STATUS_IOIS8                         0x20
224 #define PCCARD_CCR_STATUS_RESERVED1                     0x10
225 #define PCCARD_CCR_STATUS_AUDIO                         0x08
226 #define PCCARD_CCR_STATUS_PWRDWN                        0x04
227 #define PCCARD_CCR_STATUS_INTR                          0x02
228 #define PCCARD_CCR_STATUS_INTRACK                       0x01
229 #define PCCARD_CCR_PIN                          0x04
230 #define PCCARD_CCR_PIN_CBVD1                            0x80
231 #define PCCARD_CCR_PIN_CBVD2                            0x40
232 #define PCCARD_CCR_PIN_CRDYBSY                          0x20
233 #define PCCARD_CCR_PIN_CWPROT                           0x10
234 #define PCCARD_CCR_PIN_RBVD1                            0x08
235 #define PCCARD_CCR_PIN_RBVD2                            0x04
236 #define PCCARD_CCR_PIN_RRDYBSY                          0x02
237 #define PCCARD_CCR_PIN_RWPROT                           0x01
238 #define PCCARD_CCR_SOCKETCOPY                   0x06
239 #define PCCARD_CCR_SOCKETCOPY_RESERVED                  0x80
240 #define PCCARD_CCR_SOCKETCOPY_COPY_MASK                 0x70
241 #define PCCARD_CCR_SOCKETCOPY_COPY_SHIFT                4
242 #define PCCARD_CCR_SOCKETCOPY_SOCKET_MASK               0x0F
243 #define PCCARD_CCR_EXTSTATUS                    0x08
244 #define PCCARD_CCR_IOBASE0                      0x0A
245 #define PCCARD_CCR_IOBASE1                      0x0C
246 #define PCCARD_CCR_IOBASE2                      0x0E
247 #define PCCARD_CCR_IOBASE3                      0x10
248 #define PCCARD_CCR_IOSIZE                       0x12
249
250 #define PCCARD_CCR_SIZE                         0x14