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