xref: /csrg-svn/sys/tahoe/vba/vbaparam.h (revision 30261)
1*30261Ssam /*	vbaparam.h	1.2	86/12/08	*/
225930Ssam 
325930Ssam /*
425930Ssam  * Parameters related to the VERSAbus i/o configuration.
525930Ssam  */
625930Ssam 
725930Ssam /*
825930Ssam  * VERSAbus i/o devices use either memory mapped interfaces
925930Ssam  * or mapped i/o register banks, or some of both.  Page tables
1025930Ssam  * are allocated at boot time by each device driver, as needed.
1125930Ssam  * VMEMmap is used to map a fixed size portion of the VERSAbus
1225930Ssam  * i/o space, while VMEMmap1 maps dynamically defined portions
1325930Ssam  * for devices which utilize shared i/o memory.  VBmap is used
1425930Ssam  * for mapping kernel intermediate buffers for DMA devices which
1525930Ssam  * are incapable of utilizing user virtual addresses or which
1625930Ssam  * require page aligned i/o buffers.  The size of the VMEMmap1
1725930Ssam  * VBmap tables must be large enough for the needs of all devices
1825930Ssam  * in the system.
1925930Ssam  */
2025930Ssam extern	struct pte VMEMmap[], VMEMmap1[];
2125930Ssam extern	caddr_t	vmem1, vmemend;
2225930Ssam extern	struct pte VBmap[];
2325930Ssam extern	caddr_t vbbase, vbend;
2425930Ssam 
25*30261Ssam /*
26*30261Ssam  * The following macros relate to the segmentation of the VERSAbus
27*30261Ssam  * i/o space.
28*30261Ssam  *
29*30261Ssam  * The VERSAbus adapter segments the i/o space (as seen by the cpu)
30*30261Ssam  * into three regions.  Cpu accesses to the upper 64Kb of the i/o space
31*30261Ssam  * generate VERSAbus cycles with a 16-bit address and a non-privileged
32*30261Ssam  * short i/o space address modifier.  Accesses to the next 1Mb - 64Kb
33*30261Ssam  * generate 24-bit addresses and a non-privileged standard address
34*30261Ssam  * modifier.  Accesses to the remainder of the 1Gb i/o space generate
35*30261Ssam  * 32-bit addresses with a non-privileged extended address modifier.
36*30261Ssam  * Beware that 32-bit addresses generated from this region always have
37*30261Ssam  * zero in the upper 2 bits; e.g. a reference to physical address fe000000
38*30261Ssam  * results in a VERSAbus address of 3e000000.
39*30261Ssam  */
40*30261Ssam #define	VBIO16BIT(a)	(0xfffe0000 <= ((unsigned)(a)))
41*30261Ssam #define	VBIO24BIT(a) \
42*30261Ssam     (0xff000000 <= ((unsigned)(a)) && ((unsigned)(a)) < 0xfffe0000)
43*30261Ssam #define	VBIO32BIT(a)	(((unsigned)(a)) < 0xff000000)
44*30261Ssam 
4525930Ssam /*
4625930Ssam  * The following constants define the fixed size map of the
4725930Ssam  * VERSAbus i/o space.  The values should reflect the range
48*30261Ssam  * of i/o addresses used by all the controllers unprepared
49*30261Ssam  * to allocate and initialize their own page maps.
5025930Ssam  */
5125930Ssam #define VBIOBASE	0xfff00000	/* base of VERSAbus address space */
5225930Ssam #define VBIOEND		0xffffee45	/* last address in mapped space */
53*30261Ssam /* number of entries in the system page table for i/o space */
5425930Ssam #define VBIOSIZE	btoc(VBIOEND-VBIOBASE)
55*30261Ssam /* is device in mapped region */
56*30261Ssam #define	VBIOMAPPED(a) \
57*30261Ssam     (VBIOBASE <= ((unsigned)(a)) && ((unsigned)(a)) <= VBIOEND)
58*30261Ssam #define	vboff(addr)	((int)(((caddr_t)(addr)) - VBIOBASE))
5925930Ssam 
6025930Ssam /*
6125930Ssam  * Page table map sizes.
6225930Ssam  *
6325930Ssam  * Current VBmap allotments are:
6425930Ssam  *	4 vd controllers	32+1 pte's
6525930Ssam  *	2 cy controllers	32+1 pte's
6625930Ssam  * Current VBMEMmap allotments are:
6725930Ssam  *	2 ace controllers	32+1 pte's
6825930Ssam  */
6925930Ssam #define	VBPTSIZE	(((4*(32+1))+2*(32+1)+3) &~ 3)
7025930Ssam #define	VBMEMSIZE	((2*(32+1)+3) &~ 3)
71