xref: /netbsd-src/sys/arch/sparc/sparc/vaddrs.h (revision 02529ca11e89f1befb462d9f534483174e8a3d74)
1*02529ca1Suwe /*	$NetBSD: vaddrs.h,v 1.11 2001/12/10 23:10:34 uwe Exp $ */
2274a9076Sderaadt 
34588caefSderaadt /*
4df2a68f2Spk  * Copyright (c) 1996
54bbf23d0Sabrown  *	The President and Fellows of Harvard College. All rights reserved.
64588caefSderaadt  * Copyright (c) 1992, 1993
74588caefSderaadt  *	The Regents of the University of California.  All rights reserved.
84588caefSderaadt  *
94588caefSderaadt  * This software was developed by the Computer Systems Engineering group
104588caefSderaadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
114588caefSderaadt  * contributed to Berkeley.
124588caefSderaadt  *
134588caefSderaadt  * All advertising materials mentioning features or use of this software
144588caefSderaadt  * must display the following acknowledgement:
154588caefSderaadt  *	This product includes software developed by the University of
164588caefSderaadt  *	California, Lawrence Berkeley Laboratory.
174588caefSderaadt  *
184588caefSderaadt  * Redistribution and use in source and binary forms, with or without
194588caefSderaadt  * modification, are permitted provided that the following conditions
204588caefSderaadt  * are met:
214588caefSderaadt  * 1. Redistributions of source code must retain the above copyright
224588caefSderaadt  *    notice, this list of conditions and the following disclaimer.
234588caefSderaadt  * 2. Redistributions in binary form must reproduce the above copyright
244588caefSderaadt  *    notice, this list of conditions and the following disclaimer in the
254588caefSderaadt  *    documentation and/or other materials provided with the distribution.
264588caefSderaadt  * 3. All advertising materials mentioning features or use of this software
274588caefSderaadt  *    must display the following acknowledgement:
284588caefSderaadt  *	This product includes software developed by the University of
294588caefSderaadt  *	California, Berkeley and its contributors.
30df2a68f2Spk  *	This product includes software developed by Harvard University.
314588caefSderaadt  * 4. Neither the name of the University nor the names of its contributors
324588caefSderaadt  *    may be used to endorse or promote products derived from this software
334588caefSderaadt  *    without specific prior written permission.
344588caefSderaadt  *
354588caefSderaadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
364588caefSderaadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
374588caefSderaadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
384588caefSderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
394588caefSderaadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
404588caefSderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
414588caefSderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
424588caefSderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
434588caefSderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
444588caefSderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
454588caefSderaadt  * SUCH DAMAGE.
464588caefSderaadt  *
474588caefSderaadt  *	@(#)vaddrs.h	8.1 (Berkeley) 6/11/93
484588caefSderaadt  */
494588caefSderaadt 
504588caefSderaadt /*
514588caefSderaadt  * Special (fixed) virtual addresses on the SPARC.
524588caefSderaadt  *
534588caefSderaadt  * IO virtual space begins at 0xfe000000 (a segment boundary) and
544588caefSderaadt  * continues up to the DMVA edge at 0xff000000.  (The upper all-1s
554588caefSderaadt  * byte is special since some of the hardware supplies this to pad
564588caefSderaadt  * a 24-bit address space out to 32 bits.  This is a legacy of the
574588caefSderaadt  * IBM PC AT bus, actually, just so you know who to blame.)
584588caefSderaadt  *
594588caefSderaadt  * We reserve several pages at the base of our IO virtual space
604588caefSderaadt  * for `oft-used' devices which must be present anyway in order to
614588caefSderaadt  * configure.  In particular, we want the counter-timer register and
624588caefSderaadt  * the Zilog ZSCC serial port chips to be mapped at fixed VAs to make
634588caefSderaadt  * microtime() and the zs hardware interrupt handlers faster.
644588caefSderaadt  *
65df2a68f2Spk  * [sun4/sun4c:]
664588caefSderaadt  * Ideally, we should map the interrupt enable register here as well,
674588caefSderaadt  * but that would require allocating pmegs in locore.s, so instead we
68df2a68f2Spk  * use one of the two `wasted' pages at KERNBASE+_MAXNBPG (see locore.s).
694588caefSderaadt  */
704588caefSderaadt 
714588caefSderaadt #ifndef IODEV_0
724588caefSderaadt #define	IODEV_0	0xfe000000	/* must match VM_MAX_KERNEL_ADDRESS */
734588caefSderaadt 
74df2a68f2Spk #define _MAXNBPG	8192	/* fixed VAs, independent of actual NBPG */
75df2a68f2Spk #define _MAXNCPU	4	/* fixed VA allocation allows 4 CPUs */
76df2a68f2Spk 
77df2a68f2Spk /* [4m:] interrupt and counter registers take (1 + NCPU) pages. */
78df2a68f2Spk 
79242e8b98Sderaadt #define	TIMERREG_VA	(IODEV_0)
80df2a68f2Spk #define	COUNTERREG_VA	(  TIMERREG_VA + _MAXNBPG*_MAXNCPU)	/* [4m] */
81df2a68f2Spk #define	ZS0_VA		(COUNTERREG_VA + _MAXNBPG)
82df2a68f2Spk #define	ZS1_VA		(       ZS0_VA + _MAXNBPG)
83df2a68f2Spk #define	AUXREG_VA	(       ZS1_VA + _MAXNBPG)
84df2a68f2Spk #define	TMPMAP_VA	(    AUXREG_VA + _MAXNBPG)
85df2a68f2Spk #define	MSGBUF_VA	(    TMPMAP_VA + _MAXNBPG)
86129d9d5cSpk #define INTRREG_VA	(    MSGBUF_VA + _MAXNBPG)		/* [4/4c] */
87*02529ca1Suwe #define MSIIEP_PCIC_VA	(    MSGBUF_VA + _MAXNBPG)		/* [IIep] */
88df2a68f2Spk #define PI_INTR_VA	(    MSGBUF_VA + _MAXNBPG)		/* [4m] */
89df2a68f2Spk #define SI_INTR_VA	(   PI_INTR_VA + _MAXNBPG*_MAXNCPU)	/* [4m] */
90df2a68f2Spk #define	IODEV_BASE	(   SI_INTR_VA + _MAXNBPG)
914588caefSderaadt #define	IODEV_END	0xff000000		/* 16 MB of iospace */
924588caefSderaadt 
939a2b941eSpk /*
949a2b941eSpk  * DVMA range for 24 bit devices.
959a2b941eSpk  */
969a2b941eSpk #define	D24_DVMA_BASE	0xff000000
979a2b941eSpk #define	D24_DVMA_END	VME4_DVMA_BASE
989a2b941eSpk 
999a2b941eSpk /*
1009a2b941eSpk  * DMA on sun4 VME devices use the last MB of virtual space, which
1019a2b941eSpk  * is mapped by hardware onto the first MB of VME space.
1029a2b941eSpk  * The DVMA area ends before the PROM mappings appear in the address space.
1039a2b941eSpk  */
1049a2b941eSpk #define	VME4_DVMA_BASE	0xfff00000
1059a2b941eSpk #define	VME4_DVMA_END	0xfffc0000
1064588caefSderaadt 
107df2a68f2Spk /*
108df2a68f2Spk  * The next constant defines the amount of reserved DVMA space on the
1098cbc7288Spk  * IOMMU in sun4m machines. The amount of space *must* be a multiple
1108cbc7288Spk  * of 16MB, and thus (((u_int)0) - IOMMU_DVMA_BASE) must be divisible
1118cbc7288Spk  * by 16*1024*1024!  Note that pagetables must be allocated at a cost
1128cbc7288Spk  * of 1k per MB of DVMA space, plus severe alignment restrictions. So
1138cbc7288Spk  * don't make IOMMU_DVMA_BASE too low (max space = 2G).
114df2a68f2Spk  *
1158cbc7288Spk  * Also note that the IOMMU DVMA range must include the D24 DVMA range
1168cbc7288Spk  * defined above to be able to map legacy (sbus) devices that have
1178cbc7288Spk  * their upper address bits hardwired to 0xff.
118df2a68f2Spk  */
1199a2b941eSpk #define IOMMU_DVMA_BASE	0xfc000000	/* can change subject to above rule */
1208cbc7288Spk /*
1218cbc7288Spk  * We could use all of DVMA space up to 0x100000000, but we cannot
1228cbc7288Spk  * represent that number in an `unsigned long' which is necessary
1238cbc7288Spk  * for extent(9). So we leave the very last page unused.
1248cbc7288Spk  */
1258cbc7288Spk #define IOMMU_DVMA_END	0xfffff000	/* one page short of the end of space */
126df2a68f2Spk 
127129d9d5cSpk /*
128129d9d5cSpk  * Virtual address of the per cpu `cpu_softc' structure.
129129d9d5cSpk  */
130129d9d5cSpk #define CPUINFO_VA	(KERNBASE+8192)
131129d9d5cSpk 
1324588caefSderaadt #endif /* IODEV_0 */
133