sbusreg.h revision 90618
1327952Sdim/*
2284677Sdim * Copyright (c) 1996-1999 Eduardo Horvath
3353358Sdim *
4353358Sdim * Redistribution and use in source and binary forms, with or without
5353358Sdim * modification, are permitted provided that the following conditions
6284677Sdim * are met:
7284677Sdim * 1. Redistributions of source code must retain the above copyright
8284677Sdim *    notice, this list of conditions and the following disclaimer.
9284677Sdim *
10284677Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND
11284677Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12284677Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13309124Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR  BE LIABLE
14309124Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
15284677Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
16327952Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
17284677Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18353358Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
19341825Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
20284677Sdim * SUCH DAMAGE.
21327952Sdim *
22327952Sdim *	from: NetBSD: sbusreg.h,v 1.7 1999/06/07 05:28:03 eeh Exp
23327952Sdim *
24353358Sdim * $FreeBSD: head/sys/sparc64/sbus/sbusreg.h 90618 2002-02-13 16:11:36Z tmm $
25327952Sdim */
26353358Sdim
27353358Sdim#ifndef _SPARC64_SBUS_SBUSREG_H_
28321369Sdim#define _SPARC64_SBUS_SBUSREG_H_
29327952Sdim
30321369Sdim/*
31321369Sdim * Sbus device addresses are obtained from the FORTH PROMs.  They come
32309124Sdim * in `absolute' and `relative' address flavors, so we have to handle both.
33321369Sdim * Relative addresses do *not* include the slot number.
34321369Sdim */
35327952Sdim#define	SBUS_BASE		0xf8000000
36284677Sdim#define	SBUS_ADDR(slot, off)	(SBUS_BASE + ((slot) << 25) + (off))
37284677Sdim#define	SBUS_ABS(a)		((unsigned)(a) >= SBUS_BASE)
38284677Sdim#define	SBUS_ABS_TO_SLOT(a)	(((a) - SBUS_BASE) >> 25)
39327952Sdim#define	SBUS_ABS_TO_OFFSET(a)	(((a) - SBUS_BASE) & 0x1ffffff)
40327952Sdim
41327952Sdim/*
42327952Sdim * Sun4u S-bus definitions.  Here's where we deal w/the machine
43353358Sdim * dependencies of sysio.
44314564Sdim *
45353358Sdim * SYSIO implements or is the interface to several things:
46353358Sdim *
47353358Sdim * o The SBUS interface itself
48353358Sdim * o The IOMMU
49353358Sdim * o The DVMA units
50314564Sdim * o The interrupt controller
51353358Sdim * o The counter/timers
52353358Sdim *
53353358Sdim * Since it has registers to control lots of different things
54353358Sdim * as well as several on-board SBUS devices and external SBUS
55353358Sdim * slots scattered throughout its address space, it's a pain.
56314564Sdim *
57314564Sdim * One good point, however, is that all registers are 64-bit.
58314564Sdim */
59314564Sdim#define	SBR_UPA_PORTID		0x0000	/* UPA port ID register */
60314564Sdim#define	SBR_UPA_CONFIG		0x0008	/* UPA config register */
61314564Sdim#define	SBR_CS			0x0010	/* SYSIO control/status register */
62314564Sdim#define	SBR_ECCC		0x0020	/* ECC control register */
63341825Sdim#define	SBR_UE_AFS		0x0030	/* Uncorrectable Error AFSR */
64314564Sdim#define	SBR_UE_AFA		0x0038	/* Uncorrectable Error AFAR */
65314564Sdim#define	SBR_CE_AFS		0x0040	/* Correctable Error AFSR */
66327952Sdim#define	SBR_CE_AFA		0x0048	/* Correctable Error AFAR */
67341825Sdim#define	SBR_PM_CTL		0x0100	/* Performance monitor control reg */
68314564Sdim#define	SBR_PM_COUNT		0x0108	/* Performance monitor counter reg */
69314564Sdim#define	SBR_CTL			0x2000	/* SBUS Control Register */
70314564Sdim#define	SBR_AFS			0x2010	/* SBUS AFSR */
71353358Sdim#define	SBR_AFA			0x2018	/* SBUS AFAR */
72314564Sdim#define	SBR_CONFIG0		0x2020	/* SBUS Slot 0 config register */
73353358Sdim#define	SBR_CONFIG1		0x2028	/* SBUS Slot 1 config register */
74353358Sdim#define	SBR_CONFIG2		0x2030	/* SBUS Slot 2 config register */
75314564Sdim#define	SBR_CONFIG3		0x2038	/* SBUS Slot 3 config register */
76353358Sdim#define	SBR_CONFIG13		0x2040	/* Slot 13 config register <audio> */
77353358Sdim#define	SBR_CONFIG14		0x2048	/* Slot 14 config register <macio> */
78314564Sdim#define	SBR_CONFIG15		0x2050	/* Slot 15 config register <slavio> */
79353358Sdim#define	SBR_IOMMU		0x2400	/* IOMMU register block */
80314564Sdim#define	SBR_STRBUF		0x2800	/* stream buffer register block */
81353358Sdim#define	SBR_SLOT0_INT_MAP	0x2c00	/* SBUS slot 0 interrupt map reg */
82353358Sdim#define	SBR_SLOT1_INT_MAP	0x2c08	/* SBUS slot 1 interrupt map reg */
83353358Sdim#define	SBR_SLOT2_INT_MAP	0x2c10	/* SBUS slot 2 interrupt map reg */
84353358Sdim#define	SBR_SLOT3_INT_MAP	0x2c18	/* SBUS slot 3 interrupt map reg */
85353358Sdim#define	SBR_INTR_RETRY_TIM	0x2c20	/* interrupt retry timer reg */
86353358Sdim#define	SBR_SCSI_INT_MAP	0x3000	/* SCSI interrupt map reg */
87353358Sdim#define	SBR_ETHER_INT_MAP	0x3008	/* ethernet interrupt map reg */
88353358Sdim#define	SBR_BPP_INT_MAP		0x3010	/* parallel interrupt map reg */
89353358Sdim#define	SBR_AUDIO_INT_MAP	0x3018	/* audio interrupt map reg */
90353358Sdim#define	SBR_POWER_INT_MAP	0x3020	/* power fail interrupt map reg */
91353358Sdim#define	SBR_SKBDMS_INT_MAP	0x3028	/* serial/kbd/mouse interrupt map reg */
92353358Sdim#define	SBR_FD_INT_MAP		0x3030	/* floppy interrupt map reg */
93353358Sdim#define	SBR_THERM_INT_MAP	0x3038	/* thermal warn interrupt map reg */
94353358Sdim#define	SBR_KBD_INT_MAP		0x3040	/* kbd [unused] interrupt map reg */
95353358Sdim#define	SBR_MOUSE_INT_MAP	0x3048	/* mouse [unused] interrupt map reg */
96353358Sdim#define	SBR_SERIAL_INT_MAP	0x3050	/* second serial interrupt map reg */
97353358Sdim#define	SBR_TIMER0_INT_MAP	0x3060	/* timer 0 interrupt map reg */
98353358Sdim#define	SBR_TIMER1_INT_MAP	0x3068	/* timer 1 interrupt map reg */
99353358Sdim#define	SBR_UE_INT_MAP		0x3070	/* UE interrupt map reg */
100353358Sdim#define	SBR_CE_INT_MAP		0x3078	/* CE interrupt map reg */
101353358Sdim#define	SBR_ASYNC_INT_MAP	0x3080	/* SBUS error interrupt map reg */
102314564Sdim#define	SBR_PWRMGT_INT_MAP	0x3088	/* power mgmt wake interrupt map reg */
103353358Sdim#define	SBR_UPAGR_INT_MAP	0x3090	/* UPA graphics interrupt map reg */
104314564Sdim#define	SBR_RESERVED_INT_MAP	0x3098	/* reserved interrupt map reg */
105314564Sdim/*
106353358Sdim * Note: clear interrupt 0 registers are not really used
107327952Sdim */
108353358Sdim#define	SBR_SLOT0_INT_CLR	0x3400	/* SBUS slot 0 clear int regs 0..7 */
109314564Sdim#define	SBR_SLOT1_INT_CLR	0x3440	/* SBUS slot 1 clear int regs 0..7 */
110353358Sdim#define	SBR_SLOT2_INT_CLR	0x3480	/* SBUS slot 2 clear int regs 0..7 */
111353358Sdim#define	SBR_SLOT3_INT_CLR	0x34c0	/* SBUS slot 3 clear int regs 0..7 */
112353358Sdim#define	SBR_SCSI_INT_CLR	0x3800	/* SCSI clear int reg */
113353358Sdim#define	SBR_ETHER_INT_CLR	0x3808	/* ethernet clear int reg */
114314564Sdim#define	SBR_BPP_INT_CLR		0x3810	/* parallel clear int reg */
115314564Sdim#define	SBR_AUDIO_INT_CLR	0x3818	/* audio clear int reg */
116353358Sdim#define	SBR_POWER_INT_CLR	0x3820	/* power fail clear int reg */
117353358Sdim#define	SBR_SKBDMS_INT_CLR	0x3828	/* serial/kbd/mouse clear int reg */
118353358Sdim#define	SBR_FD_INT_CLR		0x3830	/* floppy clear int reg */
119353358Sdim#define	SBR_THERM_INT_CLR	0x3838	/* thermal warn clear int reg */
120353358Sdim#define	SBR_KBD_INT_CLR		0x3840	/* kbd [unused] clear int reg */
121353358Sdim#define	SBR_MOUSE_INT_CLR	0x3848	/* mouse [unused] clear int reg */
122353358Sdim#define	SBR_SERIAL_INT_CLR	0x3850	/* second serial clear int reg */
123353358Sdim#define	SBR_TIMER0_INT_CLR	0x3860	/* timer 0 clear int reg */
124353358Sdim#define	SBR_TIMER1_INT_CLR	0x3868	/* timer 1 clear int reg */
125353358Sdim#define	SBR_UE_INT_CLR		0x3870	/* UE clear int reg */
126353358Sdim#define	SBR_CE_INT_CLR		0x3878	/* CE clear int reg */
127353358Sdim#define	SBR_ASYNC_INT_CLR	0x3880	/* SBUS error clr interrupt reg */
128353358Sdim#define	SBR_PWRMGT_INT_CLR	0x3888	/* power mgmt wake clr interrupt reg */
129353358Sdim#define	SBR_TC0			0x3c00	/* timer/counter 0 */
130353358Sdim#define	SBR_TC1			0x3c10	/* timer/counter 1 */
131353358Sdim#define	SBR_IOMMU_SVADIAG	0x4400	/* SBUS virtual addr diag reg */
132353358Sdim#define	SBR_IOMMU_QUEUE_DIAG	0x4500	/* IOMMU LRU queue diag 0..15 */
133353358Sdim#define	SBR_IOMMU_TLB_TAG_DIAG	0x4580	/* TLB tag diag 0..15 */
134353358Sdim#define	SBR_IOMMU_TLB_DATA_DIAG	0x4600 	/* TLB data RAM diag 0..31 */
135353358Sdim#define	SBR_INT_DIAG		0x4800	/* SBUS int state diag reg */
136353358Sdim#define	SBR_OBIO_DIAG		0x4808	/* OBIO and misc int state diag reg */
137353358Sdim#define	SBR_STRBUF_DIAG		0x5000	/* Streaming buffer diag regs */
138353358Sdim
139353358Sdim#endif /* _SPARC64_SBUS_SBUSREG_H_ */
140353358Sdim
141353358Sdim