xref: /netbsd-src/sys/dev/isapnp/isapnpreg.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: isapnpreg.h,v 1.10 2008/04/28 20:23:53 martin Exp $	*/
2cf455412Schristos 
3c7a42821Schristos /*-
4c7a42821Schristos  * Copyright (c) 1996 The NetBSD Foundation, Inc.
5c7a42821Schristos  * All rights reserved.
6c7a42821Schristos  *
7c7a42821Schristos  * This code is derived from software contributed to The NetBSD Foundation
8c7a42821Schristos  * by Christos Zoulas.
9cf455412Schristos  *
10cf455412Schristos  * Redistribution and use in source and binary forms, with or without
11cf455412Schristos  * modification, are permitted provided that the following conditions
12cf455412Schristos  * are met:
13cf455412Schristos  * 1. Redistributions of source code must retain the above copyright
14cf455412Schristos  *    notice, this list of conditions and the following disclaimer.
15cf455412Schristos  * 2. Redistributions in binary form must reproduce the above copyright
16cf455412Schristos  *    notice, this list of conditions and the following disclaimer in the
17cf455412Schristos  *    documentation and/or other materials provided with the distribution.
18cf455412Schristos  *
19c7a42821Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20c7a42821Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21c7a42821Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22c7a42821Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23c7a42821Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24c7a42821Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25c7a42821Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26c7a42821Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27c7a42821Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28c7a42821Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29c7a42821Schristos  * POSSIBILITY OF SUCH DAMAGE.
30cf455412Schristos  */
31cf455412Schristos 
32dd49f248Schristos #ifndef _DEV_ISAPNP_ISAPNPREG_H_
33dd49f248Schristos #define _DEV_ISAPNP_ISAPNPREG_H_
34cf455412Schristos /*
35cf455412Schristos  * ISA Plug and Play register definitions;
36cf455412Schristos  * From Plug and Play ISA Specification V1.0a, May 5 1994
37cf455412Schristos  */
38cf455412Schristos 
39cf455412Schristos #define ISAPNP_MAX_CARDS		8
40cf455412Schristos #define ISAPNP_MAX_IDENT		32
412fe3b972Schristos #define ISAPNP_MAX_DEVCLASS		16
42cf455412Schristos #define ISAPNP_SERIAL_SIZE		9
43cf455412Schristos #define ISAPNP_MAX_TAGSIZE		256
44cf455412Schristos 
45cf455412Schristos #define ISAPNP_ADDR	0x279	/* Write only */
46cf455412Schristos #define ISAPNP_WRDATA	0xa79	/* Write only */
47cf455412Schristos 
48cf455412Schristos /* The read port is in range 0x203 to 0x3ff */
49cf455412Schristos #define ISAPNP_RDDATA_MIN	0x203	/* Read only */
50cf455412Schristos #define ISAPNP_RDDATA_MAX	0x3ff
51cf455412Schristos 
52cf455412Schristos #define ISAPNP_LFSR_INIT	0x6A	/* Initial value of LFSR sequence */
5329b21e4eSmikel #define ISAPNP_LFSR_LENGTH	32	/* Number of values in LFSR sequence */
54cf455412Schristos 				/* Formula to compute the next value */
55cf455412Schristos #define ISAPNP_LFSR_NEXT(v) (((v) >> 1) | (((v) & 1) ^ (((v) & 2) >> 1)) << 7)
56cf455412Schristos 
57cf455412Schristos #define ISAPNP_SET_RD_PORT				0x00
58cf455412Schristos #define ISAPNP_SERIAL_ISOLATION				0x01
59cf455412Schristos #define ISAPNP_CONFIG_CONTROL				0x02
60cf455412Schristos #define		ISAPNP_CC_RESET				0x01
6112331eb6Schristos #define		ISAPNP_CC_WAIT_FOR_KEY			0x02
62cf455412Schristos #define		ISAPNP_CC_RESET_CSN			0x04
63cf455412Schristos #define		ISAPNP_CC_RESET_DRV			0x07
64cf455412Schristos #define ISAPNP_WAKE					0x03
65cf455412Schristos #define ISAPNP_RESOURCE_DATA				0x04
66cf455412Schristos #define ISAPNP_STATUS					0x05
67cf455412Schristos #define ISAPNP_CARD_SELECT_NUM				0x06
68cf455412Schristos #define ISAPNP_LOGICAL_DEV_NUM				0x07
69cf455412Schristos 
70cf455412Schristos #define ISAPNP_ACTIVATE					0x30
71cf455412Schristos #define ISAPNP_IO_RANGE_CHECK				0x31
72cf455412Schristos 
73cf455412Schristos #define ISAPNP_NUM_MEM					4
74cf455412Schristos #define ISAPNP_MEM_DESC { 0x40, 0x48, 0x50, 0x58 }
75cf455412Schristos #define		ISAPNP_MEM_BASE_23_16			0x0
76cf455412Schristos #define		ISAPNP_MEM_BASE_15_8			0x1
77cf455412Schristos #define		ISAPNP_MEM_CONTROL			0x2
78cf455412Schristos #define			ISAPNP_MEM_CONTROL_LIMIT	1
79cf455412Schristos #define			ISAPNP_MEM_CONTROL_16		2
80cf455412Schristos #define		ISAPNP_MEM_LRANGE_23_16			0x3
81cf455412Schristos #define		ISAPNP_MEM_LRANGE_15_8			0x4
82cf455412Schristos 
83cf455412Schristos #define ISAPNP_NUM_IO					8
84fcc61fbaSchristos #define ISAPNP_IO_DESC { 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e }
85cf455412Schristos #define		ISAPNP_IO_BASE_15_8			0x0
86cf455412Schristos #define		ISAPNP_IO_BASE_7_0			0x1
87cf455412Schristos 
88cf455412Schristos #define ISAPNP_NUM_IRQ					16
89cf455412Schristos #define ISAPNP_IRQ_DESC { 0x70, 0x72 }
90cf455412Schristos #define		ISAPNP_IRQ_NUMBER			0x0
91cf455412Schristos #define		ISAPNP_IRQ_CONTROL			0x1
92cf455412Schristos #define			ISAPNP_IRQ_LEVEL		1
93cf455412Schristos #define			ISAPNP_IRQ_HIGH			2
94cf455412Schristos 
95cf455412Schristos #define ISAPNP_NUM_DRQ					8
96ab863342Smycroft #define ISAPNP_DRQ_DESC { 0x74, 0x75 }
97cf455412Schristos 
98cf455412Schristos #define ISAPNP_NUM_MEM32				4
99cf455412Schristos #define ISAPNP_MEM32_DESC { 0x76, 0x80, 0x90, 0xa0 }
100cf455412Schristos #define		ISAPNP_MEM32_BASE_31_24			0x0
101cf455412Schristos #define		ISAPNP_MEM32_BASE_23_16			0x1
102cf455412Schristos #define		ISAPNP_MEM32_BASE_15_8			0x2
103cf455412Schristos #define		ISAPNP_MEM32_BASE_7_0			0x3
104cf455412Schristos #define		ISAPNP_MEM32_CONTROL			0x4
105cf455412Schristos #define			ISAPNP_MEM32_CONTROL_LIMIT	1
106cf455412Schristos #define			ISAPNP_MEM32_CONTROL_16		2
107cf455412Schristos #define			ISAPNP_MEM32_CONTROL_32		6
108cf455412Schristos #define		ISAPNP_MEM32_LRANGE_31_24		0x5
109cf455412Schristos #define		ISAPNP_MEM32_LRANGE_23_16		0x6
110cf455412Schristos #define		ISAPNP_MEM32_LRANGE_15_8		0x7
111cf455412Schristos #define		ISAPNP_MEM32_LRANGE_7_0			0x8
112cf455412Schristos 
113cf455412Schristos /* Small Tags */
114cf455412Schristos #define ISAPNP_TAG_VERSION_NUM				0x1
115cf455412Schristos #define ISAPNP_TAG_LOGICAL_DEV_ID			0x2
116cf455412Schristos #define ISAPNP_TAG_COMPAT_DEV_ID			0x3
117cf455412Schristos #define ISAPNP_TAG_IRQ_FORMAT				0x4
118cf455412Schristos #define		ISAPNP_IRQTYPE_EDGE_PLUS		1
119cf455412Schristos #define		ISAPNP_IRQTYPE_EDGE_MINUS		2
120cf455412Schristos #define		ISAPNP_IRQTYPE_LEVEL_PLUS		4
121cf455412Schristos #define		ISAPNP_IRQTYPE_LEVEL_MINUS		8
122cf455412Schristos #define ISAPNP_TAG_DMA_FORMAT				0x5
123cf455412Schristos #define		ISAPNP_DMAWIDTH_8			0x00
124cf455412Schristos #define		ISAPNP_DMAWIDTH_8_16			0x01
125cf455412Schristos #define		ISAPNP_DMAWIDTH_16			0x02
126cf455412Schristos #define		ISAPNP_DMAWIDTH_RESERVED		0x03
127cf455412Schristos #define		ISAPNP_DMAWIDTH_MASK			0x03
128cf455412Schristos #define		ISAPNP_DMAATTR_BUS_MASTER		0x04
129cf455412Schristos #define		ISAPNP_DMAATTR_INCR_8			0x08
130cf455412Schristos #define		ISAPNP_DMAATTR_INCR_16			0x10
131cf455412Schristos #define		ISAPNP_DMAATTR_MASK			0x1c
132cf455412Schristos #define		ISAPNP_DMASPEED_COMPAT			0x00
133cf455412Schristos #define		ISAPNP_DMASPEED_A			0x20
134cf455412Schristos #define		ISAPNP_DMASPEED_B			0x40
135cf455412Schristos #define		ISAPNP_DMASPEED_F			0x60
136cf455412Schristos #define		ISAPNP_DMASPEED_MASK			0x60
137cf455412Schristos #define ISAPNP_TAG_DEP_START				0x6
138cf455412Schristos #define		ISAPNP_DEP_PREFERRED			0x0
139cf455412Schristos #define		ISAPNP_DEP_ACCEPTABLE			0x1
140cf455412Schristos #define		ISAPNP_DEP_FUNCTIONAL			0x2
141cf455412Schristos #define		ISAPNP_DEP_RESERVED			0x3
142cf455412Schristos #define		ISAPNP_DEP_MASK				0x3
143cf455412Schristos #define		ISAPNP_DEP_UNSET			0x80	/* Internal */
144cf455412Schristos #define		ISAPNP_DEP_CONFLICTING			0x81	/* Internal */
145cf455412Schristos #define ISAPNP_TAG_DEP_END				0x7
146cf455412Schristos #define ISAPNP_TAG_IO_PORT_DESC				0x8
147cf455412Schristos #define		ISAPNP_IOFLAGS_16			0x1
148cf455412Schristos #define ISAPNP_TAG_FIXED_IO_PORT_DESC			0x9
149cf455412Schristos #define ISAPNP_TAG_RESERVED1				0xa
150cf455412Schristos #define ISAPNP_TAG_RESERVED2				0xb
151cf455412Schristos #define ISAPNP_TAG_RESERVED3				0xc
152cf455412Schristos #define ISAPNP_TAG_RESERVED4				0xd
153cf455412Schristos #define ISAPNP_TAG_VENDOR_DEF				0xe
154cf455412Schristos #define ISAPNP_TAG_END					0xf
155cf455412Schristos 
156cf455412Schristos /* Large Tags */
157cf455412Schristos #define ISAPNP_LARGE_TAG				0x80
158cf455412Schristos #define ISAPNP_TAG_MEM_RANGE_DESC			0x81
1591035faffSwiz #define		ISAPNP_MEMATTR_WRITABLE			0x01
160cf455412Schristos #define		ISAPNP_MEMATTR_CACHEABLE		0x02
161cf455412Schristos #define		ISAPNP_MEMATTR_HIGH_ADDR		0x04
162cf455412Schristos #define		ISAPNP_MEMATTR_SHADOWABLE		0x20
163cf455412Schristos #define		ISAPNP_MEMATTR_ROM			0x40
164cf455412Schristos #define		ISAPNP_MEMATTR_MASK			0x67
165cf455412Schristos #define		ISAPNP_MEMWIDTH_8			0x00
166cf455412Schristos #define		ISAPNP_MEMWIDTH_16			0x08
167cf455412Schristos #define		ISAPNP_MEMWIDTH_8_16			0x10
168cf455412Schristos #define		ISAPNP_MEMWIDTH_32			0x18
169cf455412Schristos #define		ISAPNP_MEMWIDTH_MASK			0x18
170cf455412Schristos #define ISAPNP_TAG_ANSI_IDENT_STRING			0x82
171cf455412Schristos #define ISAPNP_TAG_UNICODE_IDENT_STRING			0x83
172cf455412Schristos #define ISAPNP_TAG_VENDOR_DEFINED			0x84
173cf455412Schristos #define ISAPNP_TAG_MEM32_RANGE_DESC			0x85
174cf455412Schristos #define ISAPNP_TAG_FIXED_MEM32_RANGE_DESC		0x86
175dd49f248Schristos 
176dd49f248Schristos #endif /* ! _DEV_ISAPNP_ISAPNPREG_H_ */
177