xref: /csrg-svn/sys/tahoe/vba/vbaparam.h (revision 30261)
1 /*	vbaparam.h	1.2	86/12/08	*/
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)	(0xfffe0000 <= ((unsigned)(a)))
41 #define	VBIO24BIT(a) \
42     (0xff000000 <= ((unsigned)(a)) && ((unsigned)(a)) < 0xfffe0000)
43 #define	VBIO32BIT(a)	(((unsigned)(a)) < 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) \
57     (VBIOBASE <= ((unsigned)(a)) && ((unsigned)(a)) <= VBIOEND)
58 #define	vboff(addr)	((int)(((caddr_t)(addr)) - VBIOBASE))
59 
60 /*
61  * Page table map sizes.
62  *
63  * Current VBmap allotments are:
64  *	4 vd controllers	32+1 pte's
65  *	2 cy controllers	32+1 pte's
66  * Current VBMEMmap allotments are:
67  *	2 ace controllers	32+1 pte's
68  */
69 #define	VBPTSIZE	(((4*(32+1))+2*(32+1)+3) &~ 3)
70 #define	VBMEMSIZE	((2*(32+1)+3) &~ 3)
71