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