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