xref: /netbsd-src/sys/arch/amiga/pci/empbreg.h (revision ca8ce3aeb13a6d3fb3deb6cd56d1d0e3d824199c)
1 /*	$NetBSD: empbreg.h,v 1.7 2020/07/07 03:38:45 thorpej Exp $ */
2 
3 /*-
4  * Copyright (c) 2012, 2013 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Radoslaw Kujawa.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Elbox Mediator registers. This information was obtained using reverse
34  * engineering methods by Frank Wille and Radoslaw Kujawa (without access to
35  * official documentation).
36  */
37 
38 #ifndef _AMIGA_EMPBREG_H_
39 
40 /* Zorro IDs */
41 #define ZORRO_MANID_ELBOX	2206
42 #define ZORRO_PRODID_MEDZIV	31
43 #define ZORRO_PRODID_MED1K2	32
44 #define ZORRO_PRODID_MED4K	33
45 #define ZORRO_PRODID_MED1K2SX	40
46 #define ZORRO_PRODID_MED1K2LT2	48
47 #define ZORRO_PRODID_MED1K2LT4	49
48 #define ZORRO_PRODID_MED1K2TX	60
49 #define ZORRO_PRODID_MED4KMKII	63
50 
51 #define ZORRO_PRODID_MEDZIV_MEM		ZORRO_PRODID_MEDZIV+0x80
52 #define ZORRO_PRODID_MED1K2_MEM		ZORRO_PRODID_MED1K2+0x80
53 #define ZORRO_PRODID_MED4K_MEM		ZORRO_PRODID_MED4K+0x80
54 #define ZORRO_PRODID_MED1K2SX_MEM	ZORRO_PRODID_MED1K2SX+0x80
55 #define ZORRO_PRODID_MED1K2LT2_MEM	ZORRO_PRODID_MED1K2LT2+0x80
56 #define ZORRO_PRODID_MED1K2LT4_MEM	ZORRO_PRODID_MED1K2LT4+0x80
57 #define ZORRO_PRODID_MED1K2TX_MEM	ZORRO_PRODID_MED1K2TX+0x80
58 #define ZORRO_PRODID_MED4KMKII_MEM	ZORRO_PRODID_MED4KMKII+0x80
59 
60 /*
61  * Mediator 1200 consists of two boards. First board lives in Z2 I/O
62  * space and is internally divided into two 64kB spaces. Second board, used
63  * as a window into PCI memory space is configured somewhere within 24-bit Fast
64  * RAM space (its size depends on a WINDOW jumper setting).
65  */
66 #define EMPB_SETUP_OFF		0x00000000
67 #define EMPB_SETUP_SIZE		0x30
68 
69 #define EMPB_SETUP_WINDOW_OFF	0x2	/* set memory window position */
70 #define EMPB_SETUP_BRIDGE_OFF	0x7	/* select between conf or I/O */
71 #define EMPB_SETUP_INTR_OFF	0xB	/* interrupt setup */
72 
73 #define BRIDGE_CONF		0xA0	/* switch into configuration space */
74 #define BRIDGE_IO		0x20	/* switch into I/O space */
75 
76 #define EMPB_BRIDGE_OFF		0x00010000
77 #define EMPB_BRIDGE_SIZE	0xFFFF
78 
79 #define	EMPB_CONF_DEV_STRIDE	0x800	/* offset between PCI devices */
80 #define EMPB_CONF_FUNC_STRIDE	0x100 	/* XXX: offset between PCI funcs */
81 
82 #define EMPB_INTR_ENABLE	0xFF	/* enable all interrupts */
83 
84 #define EMPB_WINDOW_SHIFT	0x10
85 #define EMPB_WINDOW_MASK_8M	0xFF80
86 #define EMPB_WINDOW_MASK_4M	0xFFC0
87 
88 #define EMPB_MEM_BASE		0x80000000U
89 #define EMPB_MEM_END		0x9FFFFFFFU
90 #define EMPB_MEM_SIZE		((EMPB_MEM_END - EMPB_MEM_BASE) + 1)
91 
92 #define EMPB_PM_OFF		0x40	/* power management register */
93 #define EMPB_PM_PSU_SHUTDOWN	0x0
94 
95 /* All PCI interrupt lines are wired to INT2. */
96 #define EMPB_INT		2
97 
98 /*
99  * Elbox Mediator 4000.
100  *
101  * Similar design to Mediator 1200, consists of two Zorro III boards.
102  * First (with lower ID, 16MB) is used to access bridge setup, configuration
103  * and I/O spaces. The second board (256MB or 512MB) is a window into PCI
104  * memory space.
105  */
106 #define EM4K_SETUP_OFF		0x0
107 #define EM4K_SETUP_SIZE		0x1F
108 
109 #define EM4K_CONF_OFF		0x00800000
110 #define EM4K_CONF_SIZE		0x003FFFFF
111 
112 #define EM4K_IO_OFF		0x00C00000
113 #define EM4K_IO_SIZE		0x000FFFFF
114 
115 #define EM4K_SETUP_WINDOW_OFF	0x0	/* window position register */
116 #define EM4K_SETUP_INTR_OFF	0x4	/* interrupt setup */
117 
118 #define EM4K_WINDOW_SHIFT	0x18
119 #define EM4K_WINDOW_MASK_512M	0xE0
120 #define EM4K_WINDOW_MASK_256M	0xF0
121 
122 #endif /* _AMIGA_EMPBREG_H_ */
123 
124