xref: /freebsd/sys/dev/pccard/pccard_cis.h (revision 9336e0699bda8a301cd2bfa37106b6ec5e32012e)
1 /* $FreeBSD$ */
2 
3 /*-
4  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *	This product includes software developed by Marc Horowitz.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * CIS Tuples */
34 
35 /* Layer 1 Basic Compatibility Tuples */
36 #define	CISTPL_NULL			0x00
37 #define	CISTPL_DEVICE			0x01
38 #define	PCCARD_DTYPE_MASK			0xF0
39 #define	PCCARD_DTYPE_NULL				0x00
40 #define	PCCARD_DTYPE_ROM				0x10
41 #define	PCCARD_DTYPE_OTPROM				0x20
42 #define	PCCARD_DTYPE_EPROM				0x30
43 #define	PCCARD_DTYPE_EEPROM				0x40
44 #define	PCCARD_DTYPE_FLASH				0x50
45 #define	PCCARD_DTYPE_SRAM				0x60
46 #define	PCCARD_DTYPE_DRAM				0x70
47 #define	PCCARD_DTYPE_FUNCSPEC				0xD0
48 #define	PCCARD_DTYPE_EXTEND				0xE0
49 #define	PCCARD_DSPEED_MASK			0x07
50 #define	PCCARD_DSPEED_NULL				0x00
51 #define	PCCARD_DSPEED_250NS				0x01
52 #define	PCCARD_DSPEED_200NS				0x02
53 #define	PCCARD_DSPEED_150NS				0x03
54 #define	PCCARD_DSPEED_100NS				0x04
55 #define	PCCARD_DSPEED_EXT				0x07
56 
57 /*
58  * the 2.1 docs have 0x02-0x07 as reserved, but the linux drivers list the
59  * follwing tuple code values.  I have at least one card (3com 3c562
60  * lan+modem) which has a code 0x06 tuple, so I'm going to assume that these
61  * are for real
62  */
63 
64 #define	CISTPL_LONGLINK_CB		0x02
65 #define	CISTPL_INDIRECT			0x03
66 #define	CISTPL_CONFIG_CB		0x04
67 #define	CISTPL_CFTABLE_ENTRY_CB		0x05
68 #define	CISTPL_LONGLINK_MFC		0x06
69 #define	PCCARD_MFC_MEM_ATTR				0x00
70 #define	PCCARD_MFC_MEM_COMMON				0x01
71 #define	CISTPL_BAR			0x07
72 #define	CISTPL_PWR_MGMNT		0x08
73 #define CISTPL_EXTDEVICE		0x09
74 
75 #define	CISTPL_CHECKSUM			0x10
76 #define	CISTPL_LONGLINK_A		0x11
77 #define	CISTPL_LONGLINK_C		0x12
78 #define	CISTPL_LINKTARGET		0x13
79 #define	CISTPL_NO_LINK			0x14
80 #define	CISTPL_VERS_1			0x15
81 #define	CISTPL_ALTSTR			0x16
82 #define	CISTPL_DEVICE_A			0x17
83 #define	CISTPL_JEDEC_C			0x18
84 #define	CISTPL_JEDEC_A			0x19
85 #define	CISTPL_CONFIG			0x1A
86 #define	PCCARD_TPCC_RASZ_MASK				0x03
87 #define	PCCARD_TPCC_RASZ_SHIFT				0
88 #define	PCCARD_TPCC_RMSZ_MASK				0x3C
89 #define	PCCARD_TPCC_RMSZ_SHIFT				2
90 #define	PCCARD_TPCC_RFSZ_MASK				0xC0
91 #define	PCCARD_TPCC_RFSZ_SHIFT				6
92 #define	CISTPL_CFTABLE_ENTRY		0x1B
93 #define	PCCARD_TPCE_INDX_INTFACE			0x80
94 #define	PCCARD_TPCE_INDX_DEFAULT			0x40
95 #define	PCCARD_TPCE_INDX_NUM_MASK			0x3F
96 #define	PCCARD_TPCE_IF_MWAIT				0x80
97 #define	PCCARD_TPCE_IF_RDYBSY				0x40
98 #define	PCCARD_TPCE_IF_WP				0x20
99 #define	PCCARD_TPCE_IF_BVD				0x10
100 #define	PCCARD_TPCE_IF_IFTYPE				0x0F
101 #define	PCCARD_IFTYPE_MEMORY					0
102 #define	PCCARD_IFTYPE_IO					1
103 #define	PCCARD_TPCE_FS_MISC				0x80
104 #define	PCCARD_TPCE_FS_MEMSPACE_MASK			0x60
105 #define	PCCARD_TPCE_FS_MEMSPACE_NONE				0x00
106 #define	PCCARD_TPCE_FS_MEMSPACE_LENGTH				0x20
107 #define	PCCARD_TPCE_FS_MEMSPACE_LENGTHADDR			0x40
108 #define	PCCARD_TPCE_FS_MEMSPACE_TABLE				0x60
109 #define	PCCARD_TPCE_FS_IRQ				0x10
110 #define	PCCARD_TPCE_FS_IOSPACE				0x08
111 #define	PCCARD_TPCE_FS_TIMING				0x04
112 #define	PCCARD_TPCE_FS_POWER_MASK			0x03
113 #define	PCCARD_TPCE_FS_POWER_NONE				0x00
114 #define	PCCARD_TPCE_FS_POWER_VCC				0x01
115 #define	PCCARD_TPCE_FS_POWER_VCCVPP1				0x02
116 #define	PCCARD_TPCE_FS_POWER_VCCVPP1VPP2			0x03
117 #define	PCCARD_TPCE_TD_RESERVED_MASK			0xE0
118 #define	PCCARD_TPCE_TD_RDYBSY_MASK			0x1C
119 #define	PCCARD_TPCE_TD_WAIT_MASK			0x03
120 #define	PCCARD_TPCE_IO_HASRANGE				0x80
121 #define	PCCARD_TPCE_IO_BUSWIDTH_16BIT			0x40
122 #define	PCCARD_TPCE_IO_BUSWIDTH_8BIT			0x20
123 #define	PCCARD_TPCE_IO_IOADDRLINES_MASK			0x1F
124 #define	PCCARD_TPCE_IO_RANGE_LENGTHSIZE_MASK		0xC0
125 #define	PCCARD_TPCE_IO_RANGE_LENGTHSIZE_NONE			0x00
126 #define	PCCARD_TPCE_IO_RANGE_LENGTHSIZE_ONE			0x40
127 #define	PCCARD_TPCE_IO_RANGE_LENGTHSIZE_TWO			0x80
128 #define	PCCARD_TPCE_IO_RANGE_LENGTHSIZE_FOUR			0xC0
129 #define	PCCARD_TPCE_IO_RANGE_ADDRSIZE_MASK		0x30
130 #define	PCCARD_TPCE_IO_RANGE_ADDRSIZE_NONE			0x00
131 #define	PCCARD_TPCE_IO_RANGE_ADDRSIZE_ONE			0x10
132 #define	PCCARD_TPCE_IO_RANGE_ADDRSIZE_TWO			0x20
133 #define	PCCARD_TPCE_IO_RANGE_ADDRSIZE_FOUR			0x30
134 #define	PCCARD_TPCE_IO_RANGE_COUNT			0x0F
135 #define	PCCARD_TPCE_IR_SHARE				0x80
136 #define	PCCARD_TPCE_IR_PULSE				0x40
137 #define	PCCARD_TPCE_IR_LEVEL				0x20
138 #define	PCCARD_TPCE_IR_HASMASK				0x10
139 #define	PCCARD_TPCE_IR_IRQ				0x0F
140 #define	PCCARD_TPCE_MS_HOSTADDR				0x80
141 #define	PCCARD_TPCE_MS_CARDADDR_SIZE_MASK		0x60
142 #define	PCCARD_TPCE_MS_CARDADDR_SIZE_SHIFT		5
143 #define	PCCARD_TPCE_MS_LENGTH_SIZE_MASK			0x18
144 #define	PCCARD_TPCE_MS_LENGTH_SIZE_SHIFT		3
145 #define	PCCARD_TPCE_MS_COUNT				0x07
146 #define	PCCARD_TPCE_MI_EXT				0x80
147 #define	PCCARD_TPCE_MI_RESERVED				0x40
148 #define	PCCARD_TPCE_MI_PWRDOWN				0x20
149 #define	PCCARD_TPCE_MI_READONLY				0x10
150 #define	PCCARD_TPCE_MI_AUDIO				0x08
151 #define	PCCARD_TPCE_MI_MAXTWINS				0x07
152 #define	CISTPL_DEVICE_OC			0x1C
153 #define	CISTPL_DEVICE_OA			0x1D
154 #define	CISTPL_DEVICE_GEO			0x1E
155 #define	CISTPL_DEVICE_GEO_A			0x1F
156 #define	CISTPL_MANFID				0x20
157 #define	CISTPL_FUNCID				0x21
158 #define	PCCARD_FUNCTION_UNSPEC		-1
159 #define	PCCARD_FUNCTION_MULTIFUNCTION	0
160 #define	PCCARD_FUNCTION_MEMORY		1
161 #define	PCCARD_FUNCTION_SERIAL		2
162 #define	PCCARD_FUNCTION_PARALLEL	3
163 #define	PCCARD_FUNCTION_DISK		4
164 #define	PCCARD_FUNCTION_VIDEO		5
165 #define	PCCARD_FUNCTION_NETWORK		6
166 #define	PCCARD_FUNCTION_AIMS		7
167 #define	PCCARD_FUNCTION_SCSI		8
168 #define	PCCARD_FUNCTION_SECURITY	9
169 #define	PCCARD_FUNCTION_INSTRUMENT	10
170 #define CISTPL_FUNCE				0x22
171 #define	PCCARD_TPLFE_TYPE_LAN_TECH			0x01
172 #define	PCCARD_TPLFE_TYPE_LAN_SPEED			0x02
173 #define	PCCARD_TPLFE_TYPE_LAN_MEDIA			0x03
174 #define	PCCARD_TPLFE_TYPE_LAN_NID			0x04
175 #define	PCCARD_TPLFE_TYPE_LAN_CONN			0x05
176 #define	PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE		0x01
177 #define	PCCARD_TPLFE_DDI_PCCARD_ATA				0x01
178 #define	CISTPL_END				0xFF
179 
180 /* Layer 2 Data Recording Format Tuples */
181 
182 #define	CISTPL_SWIL				0x23
183 /* #define	CISTPL_RESERVED		0x24-0x3F */
184 #define	CISTPL_VERS_2				0x40
185 #define	CISTPL_FORMAT				0x41
186 #define	CISTPL_GEOMETRY				0x42
187 #define	CISTPL_BYTEORDER			0x43
188 #define	CISTPL_DATE				0x44
189 #define	CISTPL_BATTERY				0x45
190 #define	CISTPL_FORAMT_A				0x47
191 
192 /* Layer 3 Data Organization Tuples */
193 
194 #define	CISTPL_ORG				0x46
195 /* #define	CISTPL_RESERVED		0x47-0x7F */
196 
197 /* Layer 4 System-Specific Standard Tuples */
198 
199 /* #define	CISTPL_RESERVED		0x80-0x8F */
200 #define	CISTPL_SPCL				0x90
201 /* #define	CISTPL_RESERVED		0x90-0xFE */
202 
203 #define CISTPL_GENERIC		-1
204