xref: /original-bsd/sys/tahoe/vba/vbaparam.h (revision f69c3528)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)vbaparam.h	7.3 (Berkeley) 06/28/90
8  */
9 
10 /*
11  * Parameters related to the VERSAbus i/o configuration.
12  */
13 
14 /*
15  * VERSAbus i/o devices use either memory mapped interfaces
16  * or mapped i/o register banks, or some of both.  Page tables
17  * are allocated at boot time by each device driver, as needed.
18  * VMEMmap is used to map a fixed size portion of the VERSAbus
19  * i/o space, while VMEMmap1 maps dynamically defined portions
20  * for devices which utilize shared i/o memory.  VBmap is used
21  * for mapping kernel intermediate buffers for DMA devices which
22  * are incapable of utilizing user virtual addresses or which
23  * require page aligned i/o buffers.  The size of the VMEMmap1
24  * VBmap tables must be large enough for the needs of all devices
25  * in the system.
26  */
27 extern	struct pte VMEMmap[], VMEMmap1[];
28 extern	caddr_t	vmem1, vmemend;
29 extern	struct pte VBmap[];
30 extern	caddr_t vbbase, vbend;
31 
32 /*
33  * The following macros relate to the segmentation of the VERSAbus
34  * i/o space.
35  *
36  * The VERSAbus adapter segments the i/o space (as seen by the cpu)
37  * into three regions.  Cpu accesses to the upper 64Kb of the i/o space
38  * generate VERSAbus cycles with a 16-bit address and a non-privileged
39  * short i/o space address modifier.  Accesses to the next 1Mb - 64Kb
40  * generate 24-bit addresses and a non-privileged standard address
41  * modifier.  Accesses to the remainder of the 1Gb i/o space generate
42  * 32-bit addresses with a non-privileged extended address modifier.
43  * Beware that 32-bit addresses generated from this region always have
44  * zero in the upper 2 bits; e.g. a reference to physical address fe000000
45  * results in a VERSAbus address of 3e000000.
46  */
47 #define	VBIO16BIT(a)	((unsigned)0xfffe0000 <= ((unsigned)(a)))
48 #define	VBIO24BIT(a)	((unsigned)0xff000000 <= ((unsigned)(a)) && \
49 			 ((unsigned)(a)) < (unsigned)0xfffe0000)
50 #define	VBIO32BIT(a)	(((unsigned)(a)) < (unsigned)0xff000000)
51 
52 /*
53  * The following constants define the fixed size map of the
54  * VERSAbus i/o space.  The values should reflect the range
55  * of i/o addresses used by all the controllers unprepared
56  * to allocate and initialize their own page maps.
57  */
58 #define VBIOBASE	0xfff00000	/* base of VERSAbus address space */
59 #define VBIOEND		0xffffee45	/* last address in mapped space */
60 /* number of entries in the system page table for i/o space */
61 #define VBIOSIZE	btoc(VBIOEND-VBIOBASE)
62 /* is device in mapped region */
63 #define	VBIOMAPPED(a)	((unsigned)VBIOBASE <= ((unsigned)(a)) && \
64 			 ((unsigned)(a)) <= (unsigned)VBIOEND)
65 #define	vboff(addr)	((int)(((caddr_t)(addr)) - VBIOBASE))
66