xref: /openbsd-src/sys/dev/pcmcia/pcmciareg.h (revision ba79660922c77ab6ca97c0a9cdfc8a868d37f654)
1*ba796609Smiod /*	$OpenBSD: pcmciareg.h,v 1.7 2010/09/04 12:59:27 miod Exp $	*/
20720f62cSfgsch /*	$NetBSD: pcmciareg.h,v 1.6 1998/08/13 15:00:02 nathanw Exp $	*/
398c00878Shvozda 
498c00878Shvozda /*
50720f62cSfgsch  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
698c00878Shvozda  *
70720f62cSfgsch  * Redistribution and use in source and binary forms, with or without
80720f62cSfgsch  * modification, are permitted provided that the following conditions
90720f62cSfgsch  * are met:
100720f62cSfgsch  * 1. Redistributions of source code must retain the above copyright
110720f62cSfgsch  *    notice, this list of conditions and the following disclaimer.
120720f62cSfgsch  * 2. Redistributions in binary form must reproduce the above copyright
130720f62cSfgsch  *    notice, this list of conditions and the following disclaimer in the
140720f62cSfgsch  *    documentation and/or other materials provided with the distribution.
150720f62cSfgsch  * 3. All advertising materials mentioning features or use of this software
160720f62cSfgsch  *    must display the following acknowledgement:
170720f62cSfgsch  *	This product includes software developed by Marc Horowitz.
180720f62cSfgsch  * 4. The name of the author may not be used to endorse or promote products
190720f62cSfgsch  *    derived from this software without specific prior written permission.
200720f62cSfgsch  *
210720f62cSfgsch  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
220720f62cSfgsch  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
230720f62cSfgsch  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
240720f62cSfgsch  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
250720f62cSfgsch  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
260720f62cSfgsch  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
270720f62cSfgsch  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
280720f62cSfgsch  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
290720f62cSfgsch  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
300720f62cSfgsch  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3198c00878Shvozda  */
3298c00878Shvozda 
330720f62cSfgsch /* most of this is from the PCMCIA PC Card Standard, Release 2.1 */
3498c00878Shvozda 
350720f62cSfgsch /* Note: the weird indenting here is to make the constants more
360720f62cSfgsch    readable.  Please don't normalize it.  --marc */
3798c00878Shvozda 
3898c00878Shvozda /*
390720f62cSfgsch  * CIS Tuples */
400720f62cSfgsch 
410720f62cSfgsch /* Layer 1 Basic Compatibility Tuples */
420720f62cSfgsch #define	PCMCIA_CISTPL_NULL			0x00
430720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE			0x01
440720f62cSfgsch #define	PCMCIA_DTYPE_MASK				0xF0
450720f62cSfgsch #define	PCMCIA_DTYPE_NULL					0x00
460720f62cSfgsch #define	PCMCIA_DTYPE_ROM					0x10
470720f62cSfgsch #define	PCMCIA_DTYPE_OTPROM					0x20
480720f62cSfgsch #define	PCMCIA_DTYPE_EPROM					0x30
490720f62cSfgsch #define	PCMCIA_DTYPE_EEPROM					0x40
500720f62cSfgsch #define	PCMCIA_DTYPE_FLASH					0x50
510720f62cSfgsch #define	PCMCIA_DTYPE_SRAM					0x60
520720f62cSfgsch #define	PCMCIA_DTYPE_DRAM					0x70
530720f62cSfgsch #define	PCMCIA_DTYPE_FUNCSPEC					0xD0
540720f62cSfgsch #define	PCMCIA_DTYPE_EXTEND					0xE0
550720f62cSfgsch #define	PCMCIA_DSPEED_MASK				0x07
560720f62cSfgsch #define	PCMCIA_DSPEED_NULL					0x00
570720f62cSfgsch #define	PCMCIA_DSPEED_250NS					0x01
580720f62cSfgsch #define	PCMCIA_DSPEED_200NS					0x02
590720f62cSfgsch #define	PCMCIA_DSPEED_150NS					0x03
600720f62cSfgsch #define	PCMCIA_DSPEED_100NS					0x04
610720f62cSfgsch #define	PCMCIA_DSPEED_EXT					0x07
620720f62cSfgsch #define	PCMCIA_CISTPL_LONGLINK_CB		0x02
630720f62cSfgsch #define	PCMCIA_CISTPL_INDIRECT			0x03
640720f62cSfgsch #define	PCMCIA_CISTPL_CONFIG_CB			0x04
650720f62cSfgsch #define	PCMCIA_CISTPL_CFTABLE_ENTRY_CB		0x05
660720f62cSfgsch #define	PCMCIA_CISTPL_LONGLINK_MFC		0x06
670720f62cSfgsch #define	PCMCIA_MFC_MEM_ATTR				0x00
680720f62cSfgsch #define	PCMCIA_MFC_MEM_COMMON				0x01
690720f62cSfgsch #define	PCMCIA_CISTPL_BAR			0x07
700720f62cSfgsch #define	PCMCIA_CISTPL_PWR_MGMNT			0x08
71a931ef17Sfgsch #define	PCMCIA_CISTPL_EXTDEVICE			0x09
72a931ef17Sfgsch /* #define	PCMCIA_CISTPL_RESERVED		0x0A-0x0F */
730720f62cSfgsch #define	PCMCIA_CISTPL_CHECKSUM			0x10
740720f62cSfgsch #define	PCMCIA_CISTPL_LONGLINK_A		0x11
750720f62cSfgsch #define	PCMCIA_CISTPL_LONGLINK_C		0x12
760720f62cSfgsch #define	PCMCIA_CISTPL_LINKTARGET		0x13
770720f62cSfgsch #define	PCMCIA_CISTPL_NO_LINK			0x14
780720f62cSfgsch #define	PCMCIA_CISTPL_VERS_1			0x15
790720f62cSfgsch #define	PCMCIA_CISTPL_ALTSTR			0x16
800720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE_A			0x17
810720f62cSfgsch #define	PCMCIA_CISTPL_JEDEC_C			0x18
820720f62cSfgsch #define	PCMCIA_CISTPL_JEDEC_A			0x19
830720f62cSfgsch #define	PCMCIA_CISTPL_CONFIG			0x1A
840720f62cSfgsch #define	PCMCIA_TPCC_RASZ_MASK				0x03
850720f62cSfgsch #define	PCMCIA_TPCC_RASZ_SHIFT				0
860720f62cSfgsch #define	PCMCIA_TPCC_RMSZ_MASK				0x3C
870720f62cSfgsch #define	PCMCIA_TPCC_RMSZ_SHIFT				2
880720f62cSfgsch #define	PCMCIA_TPCC_RFSZ_MASK				0xC0
890720f62cSfgsch #define	PCMCIA_TPCC_RFSZ_SHIFT				6
900720f62cSfgsch #define	PCMCIA_CISTPL_CFTABLE_ENTRY		0x1B
910720f62cSfgsch #define	PCMCIA_TPCE_INDX_INTFACE			0x80
920720f62cSfgsch #define	PCMCIA_TPCE_INDX_DEFAULT			0x40
930720f62cSfgsch #define	PCMCIA_TPCE_INDX_NUM_MASK			0x3F
940720f62cSfgsch #define	PCMCIA_TPCE_IF_MWAIT				0x80
950720f62cSfgsch #define	PCMCIA_TPCE_IF_RDYBSY				0x40
960720f62cSfgsch #define	PCMCIA_TPCE_IF_WP				0x20
970720f62cSfgsch #define	PCMCIA_TPCE_IF_BVD				0x10
980720f62cSfgsch #define	PCMCIA_TPCE_IF_IFTYPE				0x0F
990720f62cSfgsch #define	PCMCIA_IFTYPE_MEMORY					0
1000720f62cSfgsch #define	PCMCIA_IFTYPE_IO					1
1010720f62cSfgsch #define	PCMCIA_TPCE_FS_MISC				0x80
1020720f62cSfgsch #define	PCMCIA_TPCE_FS_MEMSPACE_MASK			0x60
1030720f62cSfgsch #define	PCMCIA_TPCE_FS_MEMSPACE_NONE				0x00
1040720f62cSfgsch #define	PCMCIA_TPCE_FS_MEMSPACE_LENGTH				0x20
1050720f62cSfgsch #define	PCMCIA_TPCE_FS_MEMSPACE_LENGTHADDR			0x40
1060720f62cSfgsch #define	PCMCIA_TPCE_FS_MEMSPACE_TABLE				0x60
1070720f62cSfgsch #define	PCMCIA_TPCE_FS_IRQ				0x10
1080720f62cSfgsch #define	PCMCIA_TPCE_FS_IOSPACE				0x08
1090720f62cSfgsch #define	PCMCIA_TPCE_FS_TIMING				0x04
1100720f62cSfgsch #define	PCMCIA_TPCE_FS_POWER_MASK			0x03
1110720f62cSfgsch #define	PCMCIA_TPCE_FS_POWER_NONE				0x00
1120720f62cSfgsch #define	PCMCIA_TPCE_FS_POWER_VCC				0x01
1130720f62cSfgsch #define	PCMCIA_TPCE_FS_POWER_VCCVPP1				0x02
1140720f62cSfgsch #define	PCMCIA_TPCE_FS_POWER_VCCVPP1VPP2			0x03
1150720f62cSfgsch #define	PCMCIA_TPCE_TD_RESERVED_MASK			0xE0
1160720f62cSfgsch #define	PCMCIA_TPCE_TD_RDYBSY_MASK			0x1C
1170720f62cSfgsch #define	PCMCIA_TPCE_TD_WAIT_MASK			0x03
1180720f62cSfgsch #define	PCMCIA_TPCE_IO_HASRANGE				0x80
1190720f62cSfgsch #define	PCMCIA_TPCE_IO_BUSWIDTH_16BIT			0x40
1200720f62cSfgsch #define	PCMCIA_TPCE_IO_BUSWIDTH_8BIT			0x20
1210720f62cSfgsch #define	PCMCIA_TPCE_IO_IOADDRLINES_MASK			0x1F
1220720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_LENGTHSIZE_MASK		0xC0
1230720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_LENGTHSIZE_NONE			0x00
1240720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_LENGTHSIZE_ONE			0x40
1250720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_LENGTHSIZE_TWO			0x80
1260720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_LENGTHSIZE_FOUR			0xC0
1270720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_ADDRSIZE_MASK		0x30
1280720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_ADDRSIZE_NONE			0x00
1290720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_ADDRSIZE_ONE			0x10
1300720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_ADDRSIZE_TWO			0x20
1310720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_ADDRSIZE_FOUR			0x30
1320720f62cSfgsch #define	PCMCIA_TPCE_IO_RANGE_COUNT			0x0F
1330720f62cSfgsch #define	PCMCIA_TPCE_IR_SHARE				0x80
1340720f62cSfgsch #define	PCMCIA_TPCE_IR_PULSE				0x40
1350720f62cSfgsch #define	PCMCIA_TPCE_IR_LEVEL				0x20
1360720f62cSfgsch #define	PCMCIA_TPCE_IR_HASMASK				0x10
1370720f62cSfgsch #define	PCMCIA_TPCE_IR_IRQ				0x0F
1380720f62cSfgsch #define	PCMCIA_TPCE_MS_HOSTADDR				0x80
1390720f62cSfgsch #define	PCMCIA_TPCE_MS_CARDADDR_SIZE_MASK		0x60
1400720f62cSfgsch #define	PCMCIA_TPCE_MS_CARDADDR_SIZE_SHIFT		5
1410720f62cSfgsch #define	PCMCIA_TPCE_MS_LENGTH_SIZE_MASK			0x18
1420720f62cSfgsch #define	PCMCIA_TPCE_MS_LENGTH_SIZE_SHIFT		3
1430720f62cSfgsch #define	PCMCIA_TPCE_MS_COUNT				0x07
1440720f62cSfgsch #define	PCMCIA_TPCE_MI_EXT				0x80
1450720f62cSfgsch #define	PCMCIA_TPCE_MI_RESERVED				0x40
1460720f62cSfgsch #define	PCMCIA_TPCE_MI_PWRDOWN				0x20
1470720f62cSfgsch #define	PCMCIA_TPCE_MI_READONLY				0x10
1480720f62cSfgsch #define	PCMCIA_TPCE_MI_AUDIO				0x08
1490720f62cSfgsch #define	PCMCIA_TPCE_MI_MAXTWINS				0x07
1500720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE_OC			0x1C
1510720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE_OA			0x1D
1520720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE_GEO		0x1E
1530720f62cSfgsch #define	PCMCIA_CISTPL_DEVICE_GEO_A		0x1F
1540720f62cSfgsch #define	PCMCIA_CISTPL_MANFID			0x20
1550720f62cSfgsch #define	PCMCIA_CISTPL_FUNCID			0x21
1560720f62cSfgsch #define	PCMCIA_FUNCTION_UNSPEC		-1
1570720f62cSfgsch #define	PCMCIA_FUNCTION_MULTIFUNCTION	0
1580720f62cSfgsch #define	PCMCIA_FUNCTION_MEMORY		1
1590720f62cSfgsch #define	PCMCIA_FUNCTION_SERIAL		2
1600720f62cSfgsch #define	PCMCIA_FUNCTION_PARALLEL	3
1610720f62cSfgsch #define	PCMCIA_FUNCTION_DISK		4
1620720f62cSfgsch #define	PCMCIA_FUNCTION_VIDEO		5
1630720f62cSfgsch #define	PCMCIA_FUNCTION_NETWORK		6
1640720f62cSfgsch #define	PCMCIA_FUNCTION_AIMS		7
1650720f62cSfgsch #define	PCMCIA_FUNCTION_SCSI		8
1660720f62cSfgsch #define	PCMCIA_FUNCTION_SECURITY	9
1670720f62cSfgsch #define	PCMCIA_FUNCTION_INSTRUMENT	10
168a931ef17Sfgsch #define	PCMCIA_FUNCTION_IOBUS		11
1690720f62cSfgsch #define	PCMCIA_CISTPL_FUNCE			0x22
1700720f62cSfgsch #define	PCMCIA_TPLFE_TYPE_LAN_TECH			0x01
1710720f62cSfgsch #define	PCMCIA_TPLFE_TYPE_LAN_SPEED			0x02
1720720f62cSfgsch #define	PCMCIA_TPLFE_TYPE_LAN_MEDIA			0x03
1730720f62cSfgsch #define	PCMCIA_TPLFE_TYPE_LAN_NID			0x04
1740720f62cSfgsch #define	PCMCIA_TPLFE_TYPE_LAN_CONN			0x05
175709e0656Sfgsch #define	PCMCIA_TPLFE_TYPE_DISK_DEVICE_INTERFACE		0x01
176709e0656Sfgsch #define	PCMCIA_TPLFE_DDI_PCCARD_ATA				0x01
1770720f62cSfgsch #define	PCMCIA_CISTPL_END			0xFF
17898c00878Shvozda 
1790720f62cSfgsch /* Layer 2 Data Recording Format Tuples */
1800720f62cSfgsch 
1810720f62cSfgsch #define	PCMCIA_CISTPL_SWIL			0x23
1820720f62cSfgsch /* #define	PCMCIA_CISTPL_RESERVED		0x24-0x3F */
1830720f62cSfgsch #define	PCMCIA_CISTPL_VERS_2			0x40
1840720f62cSfgsch #define	PCMCIA_CISTPL_FORMAT			0x41
1850720f62cSfgsch #define	PCMCIA_CISTPL_GEOMETRY			0x42
1860720f62cSfgsch #define	PCMCIA_CISTPL_BYTEORDER			0x43
1870720f62cSfgsch #define	PCMCIA_CISTPL_DATE			0x44
1880720f62cSfgsch #define	PCMCIA_CISTPL_BATTERY			0x45
189a931ef17Sfgsch #define	PCMCIA_CISTPL_FORMAT_A			0x47
1900720f62cSfgsch 
1910720f62cSfgsch /* Layer 3 Data Organization Tuples */
1920720f62cSfgsch 
1930720f62cSfgsch #define	PCMCIA_CISTPL_ORG			0x46
1940720f62cSfgsch /* #define	PCMCIA_CISTPL_RESERVED		0x47-0x7F */
1950720f62cSfgsch 
1960720f62cSfgsch /* Layer 4 System-Specific Standard Tuples */
1970720f62cSfgsch 
1980720f62cSfgsch /* #define	PCMCIA_CISTPL_RESERVED		0x80-0x8F */
1990720f62cSfgsch #define	PCMCIA_CISTPL_SPCL			0x90
2000720f62cSfgsch /* #define	PCMCIA_CISTPL_RESERVED		0x90-0xFE */
2010720f62cSfgsch 
2020720f62cSfgsch /*
2030720f62cSfgsch  * Card Configuration Registers
2040720f62cSfgsch  */
2050720f62cSfgsch 
2060720f62cSfgsch #define	PCMCIA_CCR_OPTION			0x00
2070720f62cSfgsch #define	PCMCIA_CCR_OPTION_SRESET			0x80
2080720f62cSfgsch #define	PCMCIA_CCR_OPTION_LEVIREQ			0x40
2090720f62cSfgsch #define	PCMCIA_CCR_OPTION_CFINDEX			0x3F
2100720f62cSfgsch #define	PCMCIA_CCR_OPTION_IREQ_ENABLE			0x04
2110720f62cSfgsch #define	PCMCIA_CCR_OPTION_ADDR_DECODE			0x02
2120720f62cSfgsch #define	PCMCIA_CCR_OPTION_FUNC_ENABLE			0x01
2130720f62cSfgsch #define	PCMCIA_CCR_STATUS			0x02
2140720f62cSfgsch #define	PCMCIA_CCR_STATUS_PINCHANGED			0x80
2150720f62cSfgsch #define	PCMCIA_CCR_STATUS_SIGCHG			0x40
2160720f62cSfgsch #define	PCMCIA_CCR_STATUS_IOIS8				0x20
2170720f62cSfgsch #define	PCMCIA_CCR_STATUS_RESERVED1			0x10
2180720f62cSfgsch #define	PCMCIA_CCR_STATUS_AUDIO				0x08
2190720f62cSfgsch #define	PCMCIA_CCR_STATUS_PWRDWN			0x04
2200720f62cSfgsch #define	PCMCIA_CCR_STATUS_INTR				0x02
2210720f62cSfgsch #define	PCMCIA_CCR_STATUS_INTRACK			0x01
2220720f62cSfgsch #define	PCMCIA_CCR_PIN				0x04
2230720f62cSfgsch #define	PCMCIA_CCR_PIN_CBVD1				0x80
2240720f62cSfgsch #define	PCMCIA_CCR_PIN_CBVD2				0x40
2250720f62cSfgsch #define	PCMCIA_CCR_PIN_CRDYBSY				0x20
2260720f62cSfgsch #define	PCMCIA_CCR_PIN_CWPROT				0x10
2270720f62cSfgsch #define	PCMCIA_CCR_PIN_RBVD1				0x08
2280720f62cSfgsch #define	PCMCIA_CCR_PIN_RBVD2				0x04
2290720f62cSfgsch #define	PCMCIA_CCR_PIN_RRDYBSY				0x02
2300720f62cSfgsch #define	PCMCIA_CCR_PIN_RWPROT				0x01
2310720f62cSfgsch #define	PCMCIA_CCR_SOCKETCOPY			0x06
2320720f62cSfgsch #define	PCMCIA_CCR_SOCKETCOPY_RESERVED			0x80
2330720f62cSfgsch #define	PCMCIA_CCR_SOCKETCOPY_COPY_MASK			0x70
2340720f62cSfgsch #define	PCMCIA_CCR_SOCKETCOPY_COPY_SHIFT		4
2350720f62cSfgsch #define	PCMCIA_CCR_SOCKETCOPY_SOCKET_MASK		0x0F
2360720f62cSfgsch #define	PCMCIA_CCR_EXTSTATUS			0x08
2370720f62cSfgsch #define	PCMCIA_CCR_IOBASE0			0x0A
2380720f62cSfgsch #define	PCMCIA_CCR_IOBASE1			0x0C
2390720f62cSfgsch #define	PCMCIA_CCR_IOBASE2			0x0E
2400720f62cSfgsch #define	PCMCIA_CCR_IOBASE3			0x10
2410720f62cSfgsch #define	PCMCIA_CCR_IOSIZE			0x12
2420720f62cSfgsch 
2430720f62cSfgsch #define	PCMCIA_CCR_SIZE				0x14
244*ba796609Smiod 
245*ba796609Smiod /*
246*ba796609Smiod  * Indirect CIS registers (in common space)
247*ba796609Smiod  */
248*ba796609Smiod 
249*ba796609Smiod #define	PCMCIA_INDR_CONTROL			0x02
250*ba796609Smiod #define	PCMCIA_ICR_ATTR					0x00
251*ba796609Smiod #define	PCMCIA_ICR_COMMON				0x01
252*ba796609Smiod #define	PCMCIA_ICR_AUTOINCREMENT			0x02
253*ba796609Smiod #define	PCMCIA_ICR_BYTELANE				0x04
254*ba796609Smiod #define	PCMCIA_INDR_ADDRESS			0x04
255*ba796609Smiod #define	PCMCIA_INDR_DATA			0x08
256*ba796609Smiod 
257*ba796609Smiod #define	PCMCIA_INDR_SIZE			0x0a
258