134406Skarels /* 234406Skarels * Copyright (c) 1988 Regents of the University of California. 334406Skarels * All rights reserved. 434406Skarels * 5*44534Sbostic * %sccs.include.redist.c% 634406Skarels * 7*44534Sbostic * @(#)vbaparam.h 7.3 (Berkeley) 06/28/90 834406Skarels */ 925930Ssam 1025930Ssam /* 1125930Ssam * Parameters related to the VERSAbus i/o configuration. 1225930Ssam */ 1325930Ssam 1425930Ssam /* 1525930Ssam * VERSAbus i/o devices use either memory mapped interfaces 1625930Ssam * or mapped i/o register banks, or some of both. Page tables 1725930Ssam * are allocated at boot time by each device driver, as needed. 1825930Ssam * VMEMmap is used to map a fixed size portion of the VERSAbus 1925930Ssam * i/o space, while VMEMmap1 maps dynamically defined portions 2025930Ssam * for devices which utilize shared i/o memory. VBmap is used 2125930Ssam * for mapping kernel intermediate buffers for DMA devices which 2225930Ssam * are incapable of utilizing user virtual addresses or which 2325930Ssam * require page aligned i/o buffers. The size of the VMEMmap1 2425930Ssam * VBmap tables must be large enough for the needs of all devices 2525930Ssam * in the system. 2625930Ssam */ 2725930Ssam extern struct pte VMEMmap[], VMEMmap1[]; 2825930Ssam extern caddr_t vmem1, vmemend; 2925930Ssam extern struct pte VBmap[]; 3025930Ssam extern caddr_t vbbase, vbend; 3125930Ssam 3230261Ssam /* 3330261Ssam * The following macros relate to the segmentation of the VERSAbus 3430261Ssam * i/o space. 3530261Ssam * 3630261Ssam * The VERSAbus adapter segments the i/o space (as seen by the cpu) 3730261Ssam * into three regions. Cpu accesses to the upper 64Kb of the i/o space 3830261Ssam * generate VERSAbus cycles with a 16-bit address and a non-privileged 3930261Ssam * short i/o space address modifier. Accesses to the next 1Mb - 64Kb 4030261Ssam * generate 24-bit addresses and a non-privileged standard address 4130261Ssam * modifier. Accesses to the remainder of the 1Gb i/o space generate 4230261Ssam * 32-bit addresses with a non-privileged extended address modifier. 4330261Ssam * Beware that 32-bit addresses generated from this region always have 4430261Ssam * zero in the upper 2 bits; e.g. a reference to physical address fe000000 4530261Ssam * results in a VERSAbus address of 3e000000. 4630261Ssam */ 4730294Ssam #define VBIO16BIT(a) ((unsigned)0xfffe0000 <= ((unsigned)(a))) 4830294Ssam #define VBIO24BIT(a) ((unsigned)0xff000000 <= ((unsigned)(a)) && \ 4930294Ssam ((unsigned)(a)) < (unsigned)0xfffe0000) 5030294Ssam #define VBIO32BIT(a) (((unsigned)(a)) < (unsigned)0xff000000) 5130261Ssam 5225930Ssam /* 5325930Ssam * The following constants define the fixed size map of the 5425930Ssam * VERSAbus i/o space. The values should reflect the range 5530261Ssam * of i/o addresses used by all the controllers unprepared 5630261Ssam * to allocate and initialize their own page maps. 5725930Ssam */ 5825930Ssam #define VBIOBASE 0xfff00000 /* base of VERSAbus address space */ 5925930Ssam #define VBIOEND 0xffffee45 /* last address in mapped space */ 6030261Ssam /* number of entries in the system page table for i/o space */ 6125930Ssam #define VBIOSIZE btoc(VBIOEND-VBIOBASE) 6230261Ssam /* is device in mapped region */ 6330294Ssam #define VBIOMAPPED(a) ((unsigned)VBIOBASE <= ((unsigned)(a)) && \ 6430294Ssam ((unsigned)(a)) <= (unsigned)VBIOEND) 6530261Ssam #define vboff(addr) ((int)(((caddr_t)(addr)) - VBIOBASE)) 66