xref: /csrg-svn/sys/tahoe/vba/vbaparam.h (revision 30294)
1*30294Ssam /*	vbaparam.h	1.3	86/12/15	*/
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 
2530261Ssam /*
2630261Ssam  * The following macros relate to the segmentation of the VERSAbus
2730261Ssam  * i/o space.
2830261Ssam  *
2930261Ssam  * The VERSAbus adapter segments the i/o space (as seen by the cpu)
3030261Ssam  * into three regions.  Cpu accesses to the upper 64Kb of the i/o space
3130261Ssam  * generate VERSAbus cycles with a 16-bit address and a non-privileged
3230261Ssam  * short i/o space address modifier.  Accesses to the next 1Mb - 64Kb
3330261Ssam  * generate 24-bit addresses and a non-privileged standard address
3430261Ssam  * modifier.  Accesses to the remainder of the 1Gb i/o space generate
3530261Ssam  * 32-bit addresses with a non-privileged extended address modifier.
3630261Ssam  * Beware that 32-bit addresses generated from this region always have
3730261Ssam  * zero in the upper 2 bits; e.g. a reference to physical address fe000000
3830261Ssam  * results in a VERSAbus address of 3e000000.
3930261Ssam  */
40*30294Ssam #define	VBIO16BIT(a)	((unsigned)0xfffe0000 <= ((unsigned)(a)))
41*30294Ssam #define	VBIO24BIT(a)	((unsigned)0xff000000 <= ((unsigned)(a)) && \
42*30294Ssam 			 ((unsigned)(a)) < (unsigned)0xfffe0000)
43*30294Ssam #define	VBIO32BIT(a)	(((unsigned)(a)) < (unsigned)0xff000000)
4430261Ssam 
4525930Ssam /*
4625930Ssam  * The following constants define the fixed size map of the
4725930Ssam  * VERSAbus i/o space.  The values should reflect the range
4830261Ssam  * of i/o addresses used by all the controllers unprepared
4930261Ssam  * 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 */
5330261Ssam /* number of entries in the system page table for i/o space */
5425930Ssam #define VBIOSIZE	btoc(VBIOEND-VBIOBASE)
5530261Ssam /* is device in mapped region */
56*30294Ssam #define	VBIOMAPPED(a)	((unsigned)VBIOBASE <= ((unsigned)(a)) && \
57*30294Ssam 			 ((unsigned)(a)) <= (unsigned)VBIOEND)
5830261Ssam #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