Annotation of sys/arch/mvme68k/mvme68k/pmap_bootstrap.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: pmap_bootstrap.c,v 1.22 2006/05/19 22:51:09 miod Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1995 Theo de Raadt
! 5: * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: *
! 16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
! 17: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 18: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 19: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
! 20: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 21: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 22: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 24: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 25: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 26: * SUCH DAMAGE.
! 27: *
! 28: * Copyright (c) 1991, 1993
! 29: * The Regents of the University of California. All rights reserved.
! 30: *
! 31: * This code is derived from software contributed to Berkeley by
! 32: * the Systems Programming Group of the University of Utah Computer
! 33: * Science Department.
! 34: *
! 35: * Redistribution and use in source and binary forms, with or without
! 36: * modification, are permitted provided that the following conditions
! 37: * are met:
! 38: * 1. Redistributions of source code must retain the above copyright
! 39: * notice, this list of conditions and the following disclaimer.
! 40: * 2. Redistributions in binary form must reproduce the above copyright
! 41: * notice, this list of conditions and the following disclaimer in the
! 42: * documentation and/or other materials provided with the distribution.
! 43: * 3. Neither the name of the University nor the names of its contributors
! 44: * may be used to endorse or promote products derived from this software
! 45: * without specific prior written permission.
! 46: *
! 47: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 48: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 49: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 50: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 51: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 52: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 53: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 54: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 55: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 56: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 57: * SUCH DAMAGE.
! 58: *
! 59: * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
! 60: */
! 61:
! 62: #include <sys/param.h>
! 63: #include <sys/msgbuf.h>
! 64:
! 65: #include <machine/cpu.h>
! 66: #include <machine/frame.h>
! 67: #include <machine/pte.h>
! 68: #include <machine/vmparam.h>
! 69:
! 70: #include <uvm/uvm_extern.h>
! 71:
! 72: vaddr_t iiomapbase;
! 73: int iiomapsize;
! 74: #define ETHERPAGES 16
! 75: void *etherbuf;
! 76: int etherlen;
! 77:
! 78: extern vaddr_t extiobase;
! 79: extern int physmem;
! 80:
! 81: #define RELOC(v, t) *((t*)((u_int)&(v) + firstpa))
! 82: #define PA2VA(v, t) *((t*)((u_int)&(v)))
! 83:
! 84: #define MACHINE_IIOMAPSIZE RELOC(iiomapsize, vaddr_t)
! 85: #define MACHINE_INTIOBASE RELOC(iiomapbase, vaddr_t)
! 86: #define MACHINE_EIOMAPSIZE EIOMAPSIZE
! 87:
! 88: #define PMAP_MD_LOCALS /* nothing */
! 89:
! 90: #define PMAP_MD_RELOC1() \
! 91: do { \
! 92: RELOC(etherbuf, void *) = (void *)nextpa; \
! 93: nextpa += ETHERPAGES * NBPG; \
! 94: } while (0)
! 95:
! 96: #define PMAP_MD_MAPIOSPACE() \
! 97: do { \
! 98: pte = &((u_int *)kptpa)[atop((vaddr_t)etherbuf)]; \
! 99: epte = pte + ETHERPAGES; \
! 100: while (pte < epte) { \
! 101: *pte = (*pte & ~PG_CMASK) | PG_CIS | PG_U; \
! 102: pte++; \
! 103: } \
! 104: RELOC(etherlen, int) = ETHERPAGES * NBPG; \
! 105: } while (0)
! 106:
! 107: /*
! 108: * intiobase, intiolimit: base and end of internal IO space.
! 109: * MACHINE_IIOMAPSIZE pages prior to external IO space at end of
! 110: * static kernel page table.
! 111: * extiobase: base of external IO space.
! 112: * MACHINE_EIOMAPSIZE pages at the end of the static kernel page table.
! 113: */
! 114: #define PMAP_MD_RELOC2() \
! 115: do { \
! 116: RELOC(intiobase, vaddr_t) = (vaddr_t)iiobase; \
! 117: RELOC(intiolimit, vaddr_t) = (vaddr_t)eiobase; \
! 118: RELOC(extiobase, vaddr_t) = (vaddr_t)eiobase; \
! 119: } while (0)
! 120:
! 121: #define PMAP_MD_MEMSIZE() \
! 122: do { \
! 123: RELOC(avail_end, paddr_t) = ptoa(RELOC(physmem, int)) - \
! 124: (round_page(MSGBUFSIZE) + ptoa(1)); \
! 125: } while (0)
! 126:
! 127: #define PMAP_MD_RELOC3() /* nothing */
! 128:
! 129: #include <m68k/m68k/pmap_bootstrap.c>
! 130:
! 131: void
! 132: pmap_init_md()
! 133: {
! 134: vaddr_t addr;
! 135:
! 136: /*
! 137: * mark as unavailable the regions which we have mapped in
! 138: * pmap_bootstrap().
! 139: */
! 140: addr = intiobase;
! 141: if (uvm_map(kernel_map, &addr, ptoa(iiomapsize + EIOMAPSIZE),
! 142: NULL, UVM_UNKNOWN_OFFSET, 0,
! 143: UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
! 144: UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)))
! 145: panic("pmap_init: bogons in the VM system!");
! 146: }
CVSweb