1*34406Skarels /* 2*34406Skarels * Copyright (c) 1988 Regents of the University of California. 3*34406Skarels * All rights reserved. 4*34406Skarels * 5*34406Skarels * Redistribution and use in source and binary forms are permitted 6*34406Skarels * provided that this notice is preserved and that due credit is given 7*34406Skarels * to the University of California at Berkeley. The name of the University 8*34406Skarels * may not be used to endorse or promote products derived from this 9*34406Skarels * software without specific prior written permission. This software 10*34406Skarels * is provided ``as is'' without express or implied warranty. 11*34406Skarels * 12*34406Skarels * @(#)vbaparam.h 7.1 (Berkeley) 05/21/88 13*34406Skarels */ 1425930Ssam 1525930Ssam /* 1625930Ssam * Parameters related to the VERSAbus i/o configuration. 1725930Ssam */ 1825930Ssam 1925930Ssam /* 2025930Ssam * VERSAbus i/o devices use either memory mapped interfaces 2125930Ssam * or mapped i/o register banks, or some of both. Page tables 2225930Ssam * are allocated at boot time by each device driver, as needed. 2325930Ssam * VMEMmap is used to map a fixed size portion of the VERSAbus 2425930Ssam * i/o space, while VMEMmap1 maps dynamically defined portions 2525930Ssam * for devices which utilize shared i/o memory. VBmap is used 2625930Ssam * for mapping kernel intermediate buffers for DMA devices which 2725930Ssam * are incapable of utilizing user virtual addresses or which 2825930Ssam * require page aligned i/o buffers. The size of the VMEMmap1 2925930Ssam * VBmap tables must be large enough for the needs of all devices 3025930Ssam * in the system. 3125930Ssam */ 3225930Ssam extern struct pte VMEMmap[], VMEMmap1[]; 3325930Ssam extern caddr_t vmem1, vmemend; 3425930Ssam extern struct pte VBmap[]; 3525930Ssam extern caddr_t vbbase, vbend; 3625930Ssam 3730261Ssam /* 3830261Ssam * The following macros relate to the segmentation of the VERSAbus 3930261Ssam * i/o space. 4030261Ssam * 4130261Ssam * The VERSAbus adapter segments the i/o space (as seen by the cpu) 4230261Ssam * into three regions. Cpu accesses to the upper 64Kb of the i/o space 4330261Ssam * generate VERSAbus cycles with a 16-bit address and a non-privileged 4430261Ssam * short i/o space address modifier. Accesses to the next 1Mb - 64Kb 4530261Ssam * generate 24-bit addresses and a non-privileged standard address 4630261Ssam * modifier. Accesses to the remainder of the 1Gb i/o space generate 4730261Ssam * 32-bit addresses with a non-privileged extended address modifier. 4830261Ssam * Beware that 32-bit addresses generated from this region always have 4930261Ssam * zero in the upper 2 bits; e.g. a reference to physical address fe000000 5030261Ssam * results in a VERSAbus address of 3e000000. 5130261Ssam */ 5230294Ssam #define VBIO16BIT(a) ((unsigned)0xfffe0000 <= ((unsigned)(a))) 5330294Ssam #define VBIO24BIT(a) ((unsigned)0xff000000 <= ((unsigned)(a)) && \ 5430294Ssam ((unsigned)(a)) < (unsigned)0xfffe0000) 5530294Ssam #define VBIO32BIT(a) (((unsigned)(a)) < (unsigned)0xff000000) 5630261Ssam 5725930Ssam /* 5825930Ssam * The following constants define the fixed size map of the 5925930Ssam * VERSAbus i/o space. The values should reflect the range 6030261Ssam * of i/o addresses used by all the controllers unprepared 6130261Ssam * to allocate and initialize their own page maps. 6225930Ssam */ 6325930Ssam #define VBIOBASE 0xfff00000 /* base of VERSAbus address space */ 6425930Ssam #define VBIOEND 0xffffee45 /* last address in mapped space */ 6530261Ssam /* number of entries in the system page table for i/o space */ 6625930Ssam #define VBIOSIZE btoc(VBIOEND-VBIOBASE) 6730261Ssam /* is device in mapped region */ 6830294Ssam #define VBIOMAPPED(a) ((unsigned)VBIOBASE <= ((unsigned)(a)) && \ 6930294Ssam ((unsigned)(a)) <= (unsigned)VBIOEND) 7030261Ssam #define vboff(addr) ((int)(((caddr_t)(addr)) - VBIOBASE)) 71