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