arm32_machdep.c revision 1.2.2.8 1 1.2.2.8 jdolecek /* $NetBSD: arm32_machdep.c,v 1.2.2.8 2002/06/23 17:34:44 jdolecek Exp $ */
2 1.2.2.2 lukem
3 1.2.2.2 lukem /*
4 1.2.2.2 lukem * Copyright (c) 1994-1998 Mark Brinicombe.
5 1.2.2.2 lukem * Copyright (c) 1994 Brini.
6 1.2.2.2 lukem * All rights reserved.
7 1.2.2.2 lukem *
8 1.2.2.2 lukem * This code is derived from software written for Brini by Mark Brinicombe
9 1.2.2.2 lukem *
10 1.2.2.2 lukem * Redistribution and use in source and binary forms, with or without
11 1.2.2.2 lukem * modification, are permitted provided that the following conditions
12 1.2.2.2 lukem * are met:
13 1.2.2.2 lukem * 1. Redistributions of source code must retain the above copyright
14 1.2.2.2 lukem * notice, this list of conditions and the following disclaimer.
15 1.2.2.2 lukem * 2. Redistributions in binary form must reproduce the above copyright
16 1.2.2.2 lukem * notice, this list of conditions and the following disclaimer in the
17 1.2.2.2 lukem * documentation and/or other materials provided with the distribution.
18 1.2.2.2 lukem * 3. All advertising materials mentioning features or use of this software
19 1.2.2.2 lukem * must display the following acknowledgement:
20 1.2.2.2 lukem * This product includes software developed by Mark Brinicombe
21 1.2.2.2 lukem * for the NetBSD Project.
22 1.2.2.2 lukem * 4. The name of the company nor the name of the author may be used to
23 1.2.2.2 lukem * endorse or promote products derived from this software without specific
24 1.2.2.2 lukem * prior written permission.
25 1.2.2.2 lukem *
26 1.2.2.2 lukem * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
27 1.2.2.2 lukem * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 1.2.2.2 lukem * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 1.2.2.2 lukem * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30 1.2.2.2 lukem * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 1.2.2.2 lukem * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 1.2.2.2 lukem * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.2.2.2 lukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.2.2.2 lukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.2.2.2 lukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.2.2.2 lukem * SUCH DAMAGE.
37 1.2.2.2 lukem *
38 1.2.2.2 lukem * Machine dependant functions for kernel setup
39 1.2.2.2 lukem *
40 1.2.2.2 lukem * Created : 17/09/94
41 1.2.2.2 lukem * Updated : 18/04/01 updated for new wscons
42 1.2.2.2 lukem */
43 1.2.2.2 lukem
44 1.2.2.2 lukem #include "opt_md.h"
45 1.2.2.2 lukem #include "opt_pmap_debug.h"
46 1.2.2.2 lukem
47 1.2.2.2 lukem #include <sys/param.h>
48 1.2.2.2 lukem #include <sys/systm.h>
49 1.2.2.2 lukem #include <sys/reboot.h>
50 1.2.2.2 lukem #include <sys/proc.h>
51 1.2.2.2 lukem #include <sys/user.h>
52 1.2.2.2 lukem #include <sys/kernel.h>
53 1.2.2.2 lukem #include <sys/mbuf.h>
54 1.2.2.2 lukem #include <sys/mount.h>
55 1.2.2.2 lukem #include <sys/buf.h>
56 1.2.2.2 lukem #include <sys/msgbuf.h>
57 1.2.2.2 lukem #include <sys/device.h>
58 1.2.2.2 lukem #include <uvm/uvm_extern.h>
59 1.2.2.2 lukem #include <sys/sysctl.h>
60 1.2.2.2 lukem
61 1.2.2.2 lukem #include <dev/cons.h>
62 1.2.2.2 lukem
63 1.2.2.5 thorpej #include <arm/arm32/katelib.h>
64 1.2.2.5 thorpej #include <arm/arm32/machdep.h>
65 1.2.2.2 lukem #include <machine/bootconfig.h>
66 1.2.2.2 lukem
67 1.2.2.2 lukem #include "opt_ipkdb.h"
68 1.2.2.2 lukem #include "md.h"
69 1.2.2.2 lukem
70 1.2.2.2 lukem struct vm_map *exec_map = NULL;
71 1.2.2.2 lukem struct vm_map *mb_map = NULL;
72 1.2.2.2 lukem struct vm_map *phys_map = NULL;
73 1.2.2.2 lukem
74 1.2.2.2 lukem extern int physmem;
75 1.2.2.2 lukem
76 1.2.2.2 lukem #ifndef PMAP_STATIC_L1S
77 1.2.2.2 lukem extern int max_processes;
78 1.2.2.2 lukem #endif /* !PMAP_STATIC_L1S */
79 1.2.2.8 jdolecek #if NMD > 0 && defined(MEMORY_DISK_HOOKS) && !defined(MEMORY_DISK_ROOT_SIZE)
80 1.2.2.8 jdolecek extern size_t md_root_size; /* Memory disc size */
81 1.2.2.8 jdolecek #endif /* NMD && MEMORY_DISK_HOOKS && !MEMORY_DISK_ROOT_SIZE */
82 1.2.2.2 lukem
83 1.2.2.2 lukem pv_addr_t kernelstack;
84 1.2.2.2 lukem
85 1.2.2.2 lukem /* the following is used externally (sysctl_hw) */
86 1.2.2.2 lukem char machine[] = MACHINE; /* from <machine/param.h> */
87 1.2.2.2 lukem char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
88 1.2.2.2 lukem
89 1.2.2.2 lukem /* Our exported CPU info; we can have only one. */
90 1.2.2.2 lukem struct cpu_info cpu_info_store;
91 1.2.2.2 lukem
92 1.2.2.2 lukem caddr_t msgbufaddr;
93 1.2.2.2 lukem extern paddr_t msgbufphys;
94 1.2.2.2 lukem
95 1.2.2.2 lukem int kernel_debug = 0;
96 1.2.2.2 lukem
97 1.2.2.2 lukem struct user *proc0paddr;
98 1.2.2.2 lukem
99 1.2.2.7 jdolecek /* exported variable to be filled in by the bootloaders */
100 1.2.2.2 lukem char *booted_kernel;
101 1.2.2.2 lukem
102 1.2.2.2 lukem
103 1.2.2.2 lukem /* Prototypes */
104 1.2.2.2 lukem
105 1.2.2.2 lukem u_long strtoul __P((const char *s, char **ptr, int base));
106 1.2.2.2 lukem void data_abort_handler __P((trapframe_t *frame));
107 1.2.2.2 lukem void prefetch_abort_handler __P((trapframe_t *frame));
108 1.2.2.2 lukem extern void configure __P((void));
109 1.2.2.2 lukem
110 1.2.2.2 lukem /*
111 1.2.2.8 jdolecek * arm32_vector_init:
112 1.2.2.8 jdolecek *
113 1.2.2.8 jdolecek * Initialize the vector page, and select whether or not to
114 1.2.2.8 jdolecek * relocate the vectors.
115 1.2.2.8 jdolecek *
116 1.2.2.8 jdolecek * NOTE: We expect the vector page to be mapped at its expected
117 1.2.2.8 jdolecek * destination.
118 1.2.2.8 jdolecek */
119 1.2.2.8 jdolecek void
120 1.2.2.8 jdolecek arm32_vector_init(vaddr_t va, int which)
121 1.2.2.8 jdolecek {
122 1.2.2.8 jdolecek extern unsigned int page0[], page0_data[];
123 1.2.2.8 jdolecek unsigned int *vectors = (int *) va;
124 1.2.2.8 jdolecek unsigned int *vectors_data = vectors + (page0_data - page0);
125 1.2.2.8 jdolecek int vec;
126 1.2.2.8 jdolecek
127 1.2.2.8 jdolecek /*
128 1.2.2.8 jdolecek * Loop through the vectors we're taking over, and copy the
129 1.2.2.8 jdolecek * vector's insn and data word.
130 1.2.2.8 jdolecek */
131 1.2.2.8 jdolecek for (vec = 0; vec < ARM_NVEC; vec++) {
132 1.2.2.8 jdolecek if ((which & (1 << vec)) == 0) {
133 1.2.2.8 jdolecek /* Don't want to take over this vector. */
134 1.2.2.8 jdolecek continue;
135 1.2.2.8 jdolecek }
136 1.2.2.8 jdolecek vectors[vec] = page0[vec];
137 1.2.2.8 jdolecek vectors_data[vec] = page0_data[vec];
138 1.2.2.8 jdolecek }
139 1.2.2.8 jdolecek
140 1.2.2.8 jdolecek /* Now sync the vectors. */
141 1.2.2.8 jdolecek cpu_icache_sync_range(va, (ARM_NVEC * 2) * sizeof(u_int));
142 1.2.2.8 jdolecek
143 1.2.2.8 jdolecek vector_page = va;
144 1.2.2.8 jdolecek }
145 1.2.2.8 jdolecek
146 1.2.2.8 jdolecek /*
147 1.2.2.2 lukem * Debug function just to park the CPU
148 1.2.2.2 lukem */
149 1.2.2.2 lukem
150 1.2.2.2 lukem void
151 1.2.2.2 lukem halt()
152 1.2.2.2 lukem {
153 1.2.2.2 lukem while (1)
154 1.2.2.2 lukem cpu_sleep(0);
155 1.2.2.2 lukem }
156 1.2.2.2 lukem
157 1.2.2.2 lukem
158 1.2.2.2 lukem /* Sync the discs and unmount the filesystems */
159 1.2.2.2 lukem
160 1.2.2.2 lukem void
161 1.2.2.2 lukem bootsync(void)
162 1.2.2.2 lukem {
163 1.2.2.2 lukem static int bootsyncdone = 0;
164 1.2.2.2 lukem
165 1.2.2.2 lukem if (bootsyncdone) return;
166 1.2.2.2 lukem
167 1.2.2.2 lukem bootsyncdone = 1;
168 1.2.2.2 lukem
169 1.2.2.2 lukem /* Make sure we can still manage to do things */
170 1.2.2.2 lukem if (GetCPSR() & I32_bit) {
171 1.2.2.2 lukem /*
172 1.2.2.2 lukem * If we get here then boot has been called without RB_NOSYNC
173 1.2.2.2 lukem * and interrupts were disabled. This means the boot() call
174 1.2.2.2 lukem * did not come from a user process e.g. shutdown, but must
175 1.2.2.2 lukem * have come from somewhere in the kernel.
176 1.2.2.2 lukem */
177 1.2.2.2 lukem IRQenable;
178 1.2.2.2 lukem printf("Warning IRQ's disabled during boot()\n");
179 1.2.2.2 lukem }
180 1.2.2.2 lukem
181 1.2.2.2 lukem vfs_shutdown();
182 1.2.2.2 lukem }
183 1.2.2.2 lukem
184 1.2.2.2 lukem /*
185 1.2.2.2 lukem * void cpu_startup(void)
186 1.2.2.2 lukem *
187 1.2.2.2 lukem * Machine dependant startup code.
188 1.2.2.2 lukem *
189 1.2.2.2 lukem */
190 1.2.2.2 lukem void
191 1.2.2.2 lukem cpu_startup()
192 1.2.2.2 lukem {
193 1.2.2.2 lukem int loop;
194 1.2.2.2 lukem paddr_t minaddr;
195 1.2.2.2 lukem paddr_t maxaddr;
196 1.2.2.2 lukem caddr_t sysbase;
197 1.2.2.2 lukem caddr_t size;
198 1.2.2.2 lukem vsize_t bufsize;
199 1.2.2.2 lukem int base, residual;
200 1.2.2.2 lukem char pbuf[9];
201 1.2.2.2 lukem
202 1.2.2.2 lukem proc0paddr = (struct user *)kernelstack.pv_va;
203 1.2.2.2 lukem proc0.p_addr = proc0paddr;
204 1.2.2.2 lukem
205 1.2.2.2 lukem /* Set the cpu control register */
206 1.2.2.2 lukem cpu_setup(boot_args);
207 1.2.2.2 lukem
208 1.2.2.2 lukem /* All domains MUST be clients, permissions are VERY important */
209 1.2.2.2 lukem cpu_domains(DOMAIN_CLIENT);
210 1.2.2.2 lukem
211 1.2.2.2 lukem /* Lock down zero page */
212 1.2.2.8 jdolecek vector_page_setprot(VM_PROT_READ);
213 1.2.2.2 lukem
214 1.2.2.2 lukem /*
215 1.2.2.2 lukem * Give pmap a chance to set up a few more things now the vm
216 1.2.2.2 lukem * is initialised
217 1.2.2.2 lukem */
218 1.2.2.2 lukem pmap_postinit();
219 1.2.2.2 lukem
220 1.2.2.2 lukem /*
221 1.2.2.2 lukem * Initialize error message buffer (at end of core).
222 1.2.2.2 lukem */
223 1.2.2.2 lukem
224 1.2.2.2 lukem /* msgbufphys was setup during the secondary boot strap */
225 1.2.2.2 lukem for (loop = 0; loop < btoc(MSGBUFSIZE); ++loop)
226 1.2.2.3 thorpej pmap_kenter_pa((vaddr_t)msgbufaddr + loop * NBPG,
227 1.2.2.3 thorpej msgbufphys + loop * NBPG, VM_PROT_READ|VM_PROT_WRITE);
228 1.2.2.4 thorpej pmap_update(pmap_kernel());
229 1.2.2.2 lukem initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));
230 1.2.2.2 lukem
231 1.2.2.2 lukem /*
232 1.2.2.2 lukem * Identify ourselves for the msgbuf (everything printed earlier will
233 1.2.2.2 lukem * not be buffered).
234 1.2.2.2 lukem */
235 1.2.2.2 lukem printf(version);
236 1.2.2.2 lukem
237 1.2.2.8 jdolecek format_bytes(pbuf, sizeof(pbuf), arm_ptob(physmem));
238 1.2.2.2 lukem printf("total memory = %s\n", pbuf);
239 1.2.2.2 lukem
240 1.2.2.2 lukem /*
241 1.2.2.2 lukem * Find out how much space we need, allocate it,
242 1.2.2.2 lukem * and then give everything true virtual addresses.
243 1.2.2.2 lukem */
244 1.2.2.2 lukem size = allocsys(NULL, NULL);
245 1.2.2.2 lukem sysbase = (caddr_t)uvm_km_zalloc(kernel_map, round_page((vaddr_t)size));
246 1.2.2.2 lukem if (sysbase == 0)
247 1.2.2.2 lukem panic(
248 1.2.2.2 lukem "cpu_startup: no room for system tables; %d bytes required",
249 1.2.2.2 lukem (u_int)size);
250 1.2.2.2 lukem if ((caddr_t)((allocsys(sysbase, NULL) - sysbase)) != size)
251 1.2.2.2 lukem panic("cpu_startup: system table size inconsistency");
252 1.2.2.2 lukem
253 1.2.2.2 lukem /*
254 1.2.2.2 lukem * Now allocate buffers proper. They are different than the above
255 1.2.2.2 lukem * in that they usually occupy more virtual memory than physical.
256 1.2.2.2 lukem */
257 1.2.2.2 lukem bufsize = MAXBSIZE * nbuf;
258 1.2.2.2 lukem if (uvm_map(kernel_map, (vaddr_t *)&buffers, round_page(bufsize),
259 1.2.2.2 lukem NULL, UVM_UNKNOWN_OFFSET, 0,
260 1.2.2.2 lukem UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
261 1.2.2.2 lukem UVM_ADV_NORMAL, 0)) != 0)
262 1.2.2.2 lukem panic("cpu_startup: cannot allocate UVM space for buffers");
263 1.2.2.2 lukem minaddr = (vaddr_t)buffers;
264 1.2.2.2 lukem if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
265 1.2.2.2 lukem /* don't want to alloc more physical mem than needed */
266 1.2.2.2 lukem bufpages = btoc(MAXBSIZE) * nbuf;
267 1.2.2.2 lukem }
268 1.2.2.2 lukem
269 1.2.2.2 lukem base = bufpages / nbuf;
270 1.2.2.2 lukem residual = bufpages % nbuf;
271 1.2.2.2 lukem for (loop = 0; loop < nbuf; ++loop) {
272 1.2.2.2 lukem vsize_t curbufsize;
273 1.2.2.2 lukem vaddr_t curbuf;
274 1.2.2.2 lukem struct vm_page *pg;
275 1.2.2.2 lukem
276 1.2.2.3 thorpej /*
277 1.2.2.3 thorpej * Each buffer has MAXBSIZE bytes of VM space allocated. Of
278 1.2.2.3 thorpej * that MAXBSIZE space, we allocate and map (base+1) pages
279 1.2.2.3 thorpej * for the first "residual" buffers, and then we allocate
280 1.2.2.3 thorpej * "base" pages for the rest.
281 1.2.2.3 thorpej */
282 1.2.2.2 lukem curbuf = (vaddr_t) buffers + (loop * MAXBSIZE);
283 1.2.2.2 lukem curbufsize = NBPG * ((loop < residual) ? (base+1) : base);
284 1.2.2.2 lukem
285 1.2.2.2 lukem while (curbufsize) {
286 1.2.2.2 lukem pg = uvm_pagealloc(NULL, 0, NULL, 0);
287 1.2.2.2 lukem if (pg == NULL)
288 1.2.2.2 lukem panic("cpu_startup: not enough memory for buffer cache");
289 1.2.2.3 thorpej pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
290 1.2.2.3 thorpej VM_PROT_READ|VM_PROT_WRITE);
291 1.2.2.2 lukem curbuf += PAGE_SIZE;
292 1.2.2.2 lukem curbufsize -= PAGE_SIZE;
293 1.2.2.2 lukem }
294 1.2.2.2 lukem }
295 1.2.2.4 thorpej pmap_update(pmap_kernel());
296 1.2.2.2 lukem
297 1.2.2.2 lukem /*
298 1.2.2.2 lukem * Allocate a submap for exec arguments. This map effectively
299 1.2.2.2 lukem * limits the number of processes exec'ing at any time.
300 1.2.2.2 lukem */
301 1.2.2.2 lukem exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
302 1.2.2.2 lukem 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
303 1.2.2.2 lukem
304 1.2.2.2 lukem /*
305 1.2.2.2 lukem * Allocate a submap for physio
306 1.2.2.2 lukem */
307 1.2.2.2 lukem phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
308 1.2.2.2 lukem VM_PHYS_SIZE, 0, FALSE, NULL);
309 1.2.2.2 lukem
310 1.2.2.2 lukem /*
311 1.2.2.2 lukem * Finally, allocate mbuf cluster submap.
312 1.2.2.2 lukem */
313 1.2.2.2 lukem mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
314 1.2.2.2 lukem nmbclusters * mclbytes, VM_MAP_INTRSAFE,
315 1.2.2.2 lukem FALSE, NULL);
316 1.2.2.2 lukem
317 1.2.2.2 lukem format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
318 1.2.2.2 lukem printf("avail memory = %s\n", pbuf);
319 1.2.2.2 lukem format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
320 1.2.2.2 lukem printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
321 1.2.2.2 lukem
322 1.2.2.2 lukem /*
323 1.2.2.2 lukem * Set up buffers, so they can be used to read disk labels.
324 1.2.2.2 lukem */
325 1.2.2.2 lukem bufinit();
326 1.2.2.2 lukem
327 1.2.2.2 lukem curpcb = &proc0.p_addr->u_pcb;
328 1.2.2.2 lukem curpcb->pcb_flags = 0;
329 1.2.2.4 thorpej curpcb->pcb_un.un_32.pcb32_und_sp = (u_int)proc0.p_addr +
330 1.2.2.4 thorpej USPACE_UNDEF_STACK_TOP;
331 1.2.2.4 thorpej curpcb->pcb_un.un_32.pcb32_sp = (u_int)proc0.p_addr +
332 1.2.2.4 thorpej USPACE_SVC_STACK_TOP;
333 1.2.2.2 lukem (void) pmap_extract(pmap_kernel(), (vaddr_t)(pmap_kernel())->pm_pdir,
334 1.2.2.2 lukem (paddr_t *)&curpcb->pcb_pagedir);
335 1.2.2.2 lukem
336 1.2.2.4 thorpej curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_un.un_32.pcb32_sp - 1;
337 1.2.2.2 lukem }
338 1.2.2.2 lukem
339 1.2.2.2 lukem /*
340 1.2.2.2 lukem * machine dependent system variables.
341 1.2.2.2 lukem */
342 1.2.2.2 lukem
343 1.2.2.2 lukem int
344 1.2.2.2 lukem cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
345 1.2.2.2 lukem int *name;
346 1.2.2.2 lukem u_int namelen;
347 1.2.2.2 lukem void *oldp;
348 1.2.2.2 lukem size_t *oldlenp;
349 1.2.2.2 lukem void *newp;
350 1.2.2.2 lukem size_t newlen;
351 1.2.2.2 lukem struct proc *p;
352 1.2.2.2 lukem {
353 1.2.2.2 lukem /* all sysctl names at this level are terminal */
354 1.2.2.2 lukem if (namelen != 1)
355 1.2.2.2 lukem return (ENOTDIR); /* overloaded */
356 1.2.2.2 lukem
357 1.2.2.2 lukem switch (name[0]) {
358 1.2.2.2 lukem case CPU_DEBUG:
359 1.2.2.2 lukem return(sysctl_int(oldp, oldlenp, newp, newlen, &kernel_debug));
360 1.2.2.2 lukem
361 1.2.2.2 lukem case CPU_BOOTED_DEVICE:
362 1.2.2.2 lukem if (booted_device != NULL)
363 1.2.2.2 lukem return (sysctl_rdstring(oldp, oldlenp, newp,
364 1.2.2.2 lukem booted_device->dv_xname));
365 1.2.2.2 lukem return (EOPNOTSUPP);
366 1.2.2.2 lukem
367 1.2.2.2 lukem case CPU_CONSDEV: {
368 1.2.2.2 lukem dev_t consdev;
369 1.2.2.2 lukem if (cn_tab != NULL)
370 1.2.2.2 lukem consdev = cn_tab->cn_dev;
371 1.2.2.2 lukem else
372 1.2.2.2 lukem consdev = NODEV;
373 1.2.2.2 lukem return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
374 1.2.2.2 lukem sizeof consdev));
375 1.2.2.2 lukem }
376 1.2.2.2 lukem case CPU_BOOTED_KERNEL: {
377 1.2.2.2 lukem if (booted_kernel != NULL && booted_kernel[0] != '\0')
378 1.2.2.2 lukem return sysctl_rdstring(oldp, oldlenp, newp,
379 1.2.2.2 lukem booted_kernel);
380 1.2.2.2 lukem return (EOPNOTSUPP);
381 1.2.2.2 lukem }
382 1.2.2.2 lukem
383 1.2.2.2 lukem default:
384 1.2.2.2 lukem return (EOPNOTSUPP);
385 1.2.2.2 lukem }
386 1.2.2.2 lukem /* NOTREACHED */
387 1.2.2.2 lukem }
388 1.2.2.2 lukem
389 1.2.2.2 lukem void
390 1.2.2.2 lukem parse_mi_bootargs(args)
391 1.2.2.2 lukem char *args;
392 1.2.2.2 lukem {
393 1.2.2.2 lukem int integer;
394 1.2.2.2 lukem
395 1.2.2.2 lukem if (get_bootconf_option(args, "single", BOOTOPT_TYPE_BOOLEAN, &integer)
396 1.2.2.2 lukem || get_bootconf_option(args, "-s", BOOTOPT_TYPE_BOOLEAN, &integer))
397 1.2.2.2 lukem if (integer)
398 1.2.2.2 lukem boothowto |= RB_SINGLE;
399 1.2.2.2 lukem if (get_bootconf_option(args, "kdb", BOOTOPT_TYPE_BOOLEAN, &integer)
400 1.2.2.2 lukem || get_bootconf_option(args, "-k", BOOTOPT_TYPE_BOOLEAN, &integer))
401 1.2.2.2 lukem if (integer)
402 1.2.2.2 lukem boothowto |= RB_KDB;
403 1.2.2.2 lukem if (get_bootconf_option(args, "ask", BOOTOPT_TYPE_BOOLEAN, &integer)
404 1.2.2.2 lukem || get_bootconf_option(args, "-a", BOOTOPT_TYPE_BOOLEAN, &integer))
405 1.2.2.2 lukem if (integer)
406 1.2.2.2 lukem boothowto |= RB_ASKNAME;
407 1.2.2.2 lukem
408 1.2.2.2 lukem #ifdef PMAP_DEBUG
409 1.2.2.2 lukem if (get_bootconf_option(args, "pmapdebug", BOOTOPT_TYPE_INT, &integer)) {
410 1.2.2.2 lukem pmap_debug_level = integer;
411 1.2.2.2 lukem pmap_debug(pmap_debug_level);
412 1.2.2.2 lukem }
413 1.2.2.2 lukem #endif /* PMAP_DEBUG */
414 1.2.2.2 lukem
415 1.2.2.2 lukem /* if (get_bootconf_option(args, "nbuf", BOOTOPT_TYPE_INT, &integer))
416 1.2.2.2 lukem bufpages = integer;*/
417 1.2.2.2 lukem
418 1.2.2.2 lukem #ifndef PMAP_STATIC_L1S
419 1.2.2.2 lukem if (get_bootconf_option(args, "maxproc", BOOTOPT_TYPE_INT, &integer)) {
420 1.2.2.2 lukem max_processes = integer;
421 1.2.2.2 lukem if (max_processes < 16)
422 1.2.2.2 lukem max_processes = 16;
423 1.2.2.2 lukem /* Limit is PDSIZE * (max_processes + 1) <= 4MB */
424 1.2.2.2 lukem if (max_processes > 255)
425 1.2.2.2 lukem max_processes = 255;
426 1.2.2.2 lukem }
427 1.2.2.2 lukem #endif /* !PMAP_STATUC_L1S */
428 1.2.2.8 jdolecek #if NMD > 0 && defined(MEMORY_DISK_HOOKS) && !defined(MEMORY_DISK_ROOT_SIZE)
429 1.2.2.2 lukem if (get_bootconf_option(args, "memorydisc", BOOTOPT_TYPE_INT, &integer)
430 1.2.2.2 lukem || get_bootconf_option(args, "memorydisk", BOOTOPT_TYPE_INT, &integer)) {
431 1.2.2.8 jdolecek md_root_size = integer;
432 1.2.2.8 jdolecek md_root_size *= 1024;
433 1.2.2.8 jdolecek if (md_root_size < 32*1024)
434 1.2.2.8 jdolecek md_root_size = 32*1024;
435 1.2.2.8 jdolecek if (md_root_size > 2048*1024)
436 1.2.2.8 jdolecek md_root_size = 2048*1024;
437 1.2.2.2 lukem }
438 1.2.2.8 jdolecek #endif /* NMD && MEMORY_DISK_HOOKS && !MEMORY_DISK_ROOT_SIZE */
439 1.2.2.2 lukem
440 1.2.2.2 lukem if (get_bootconf_option(args, "quiet", BOOTOPT_TYPE_BOOLEAN, &integer)
441 1.2.2.2 lukem || get_bootconf_option(args, "-q", BOOTOPT_TYPE_BOOLEAN, &integer))
442 1.2.2.2 lukem if (integer)
443 1.2.2.2 lukem boothowto |= AB_QUIET;
444 1.2.2.2 lukem if (get_bootconf_option(args, "verbose", BOOTOPT_TYPE_BOOLEAN, &integer)
445 1.2.2.2 lukem || get_bootconf_option(args, "-v", BOOTOPT_TYPE_BOOLEAN, &integer))
446 1.2.2.2 lukem if (integer)
447 1.2.2.2 lukem boothowto |= AB_VERBOSE;
448 1.2.2.2 lukem }
449