Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places it's still needed.diff -r1.125 -r1.126 src/sys/arch/alpha/alpha/locore.s
(thorpej)
--- src/sys/arch/alpha/alpha/locore.s 2020/06/30 16:20:00 1.125
+++ src/sys/arch/alpha/alpha/locore.s 2020/09/03 02:09:09 1.126
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: locore.s,v 1.125 2020/06/30 16:20:00 maxv Exp $ */ | 1 | /* $NetBSD: locore.s,v 1.126 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center. | 9 | * NASA Ames Research Center. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -57,27 +57,27 @@ | @@ -57,27 +57,27 @@ | |||
57 | * rights to redistribute these changes. | 57 | * rights to redistribute these changes. | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | .stabs __FILE__,100,0,0,kernel_text | 60 | .stabs __FILE__,100,0,0,kernel_text | |
61 | 61 | |||
62 | #include "opt_ddb.h" | 62 | #include "opt_ddb.h" | |
63 | #include "opt_kgdb.h" | 63 | #include "opt_kgdb.h" | |
64 | #include "opt_multiprocessor.h" | 64 | #include "opt_multiprocessor.h" | |
65 | #include "opt_lockdebug.h" | 65 | #include "opt_lockdebug.h" | |
66 | #include "opt_compat_netbsd.h" | 66 | #include "opt_compat_netbsd.h" | |
67 | 67 | |||
68 | #include <machine/asm.h> | 68 | #include <machine/asm.h> | |
69 | 69 | |||
70 | __KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.125 2020/06/30 16:20:00 maxv Exp $"); | 70 | __KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.126 2020/09/03 02:09:09 thorpej Exp $"); | |
71 | 71 | |||
72 | #include "assym.h" | 72 | #include "assym.h" | |
73 | 73 | |||
74 | .stabs __FILE__,132,0,0,kernel_text | 74 | .stabs __FILE__,132,0,0,kernel_text | |
75 | 75 | |||
76 | /* | 76 | /* | |
77 | * Perform actions necessary to switch to a new context. The | 77 | * Perform actions necessary to switch to a new context. The | |
78 | * hwpcb should be in a0. Clobbers v0, t0, t8..t11, a0. | 78 | * hwpcb should be in a0. Clobbers v0, t0, t8..t11, a0. | |
79 | */ | 79 | */ | |
80 | #define SWITCH_CONTEXT \ | 80 | #define SWITCH_CONTEXT \ | |
81 | /* Make a note of the context we're running on. */ \ | 81 | /* Make a note of the context we're running on. */ \ | |
82 | GET_CURPCB ; \ | 82 | GET_CURPCB ; \ | |
83 | stq a0, 0(v0) ; \ | 83 | stq a0, 0(v0) ; \ | |
@@ -116,26 +116,27 @@ bootstack: | @@ -116,26 +116,27 @@ bootstack: | |||
116 | /* | 116 | /* | |
117 | * locorestart: Kernel start. This is no longer the actual entry | 117 | * locorestart: Kernel start. This is no longer the actual entry | |
118 | * point, although jumping to here (the first kernel address) will | 118 | * point, although jumping to here (the first kernel address) will | |
119 | * in fact work just fine. | 119 | * in fact work just fine. | |
120 | * | 120 | * | |
121 | * Arguments: | 121 | * Arguments: | |
122 | * a0 is the first free page frame number (PFN) | 122 | * a0 is the first free page frame number (PFN) | |
123 | * a1 is the page table base register (PTBR) | 123 | * a1 is the page table base register (PTBR) | |
124 | * a2 is the bootinfo magic number | 124 | * a2 is the bootinfo magic number | |
125 | * a3 is the pointer to the bootinfo structure | 125 | * a3 is the pointer to the bootinfo structure | |
126 | * | 126 | * | |
127 | * All arguments are passed to alpha_init(). | 127 | * All arguments are passed to alpha_init(). | |
128 | */ | 128 | */ | |
129 | IMPORT(prom_mapped, 4) | |||
129 | NESTED_NOPROFILE(locorestart,1,0,ra,0,0) | 130 | NESTED_NOPROFILE(locorestart,1,0,ra,0,0) | |
130 | br pv,1f | 131 | br pv,1f | |
131 | 1: LDGP(pv) | 132 | 1: LDGP(pv) | |
132 | 133 | |||
133 | /* Switch to the boot stack. */ | 134 | /* Switch to the boot stack. */ | |
134 | lda sp,bootstack | 135 | lda sp,bootstack | |
135 | 136 | |||
136 | /* Load KGP with current GP. */ | 137 | /* Load KGP with current GP. */ | |
137 | mov a0, s0 /* save pfn */ | 138 | mov a0, s0 /* save pfn */ | |
138 | mov gp, a0 | 139 | mov gp, a0 | |
139 | call_pal PAL_OSF1_wrkgp /* clobbers a0, t0, t8-t11 */ | 140 | call_pal PAL_OSF1_wrkgp /* clobbers a0, t0, t8-t11 */ | |
140 | mov s0, a0 /* restore pfn */ | 141 | mov s0, a0 /* restore pfn */ | |
141 | 142 | |||
@@ -147,26 +148,30 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0) | @@ -147,26 +148,30 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0) | |||
147 | CALL(alpha_init) | 148 | CALL(alpha_init) | |
148 | 149 | |||
149 | /* Set up the virtual page table pointer. */ | 150 | /* Set up the virtual page table pointer. */ | |
150 | ldiq a0, VPTBASE | 151 | ldiq a0, VPTBASE | |
151 | call_pal PAL_OSF1_wrvptptr /* clobbers a0, t0, t8-t11 */ | 152 | call_pal PAL_OSF1_wrvptptr /* clobbers a0, t0, t8-t11 */ | |
152 | 153 | |||
153 | /* | 154 | /* | |
154 | * Switch to lwp0's PCB. | 155 | * Switch to lwp0's PCB. | |
155 | */ | 156 | */ | |
156 | lda a0, lwp0 | 157 | lda a0, lwp0 | |
157 | ldq a0, L_MD_PCBPADDR(a0) /* phys addr of PCB */ | 158 | ldq a0, L_MD_PCBPADDR(a0) /* phys addr of PCB */ | |
158 | SWITCH_CONTEXT | 159 | SWITCH_CONTEXT | |
159 | 160 | |||
161 | /* PROM is no longer mapped. */ | |||
162 | lda t0, prom_mapped | |||
163 | stl zero, 0(t0) | |||
164 | ||||
160 | /* | 165 | /* | |
161 | * We've switched to a new page table base, so invalidate the TLB | 166 | * We've switched to a new page table base, so invalidate the TLB | |
162 | * and I-stream. This happens automatically everywhere but here. | 167 | * and I-stream. This happens automatically everywhere but here. | |
163 | */ | 168 | */ | |
164 | ldiq a0, -2 /* TBIA */ | 169 | ldiq a0, -2 /* TBIA */ | |
165 | call_pal PAL_OSF1_tbi | 170 | call_pal PAL_OSF1_tbi | |
166 | call_pal PAL_imb | 171 | call_pal PAL_imb | |
167 | 172 | |||
168 | /* | 173 | /* | |
169 | * All ready to go! Call main()! | 174 | * All ready to go! Call main()! | |
170 | */ | 175 | */ | |
171 | CALL(main) | 176 | CALL(main) | |
172 | 177 |
--- src/sys/arch/alpha/alpha/machdep.c 2020/09/02 17:40:23 1.362
+++ src/sys/arch/alpha/alpha/machdep.c 2020/09/03 02:09:09 1.363
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: machdep.c,v 1.362 2020/09/02 17:40:23 riastradh Exp $ */ | 1 | /* $NetBSD: machdep.c,v 1.363 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center and by Chris G. Demetriou. | 9 | * NASA Ames Research Center and by Chris G. Demetriou. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -57,27 +57,27 @@ | @@ -57,27 +57,27 @@ | |||
57 | * rights to redistribute these changes. | 57 | * rights to redistribute these changes. | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | #include "opt_ddb.h" | 60 | #include "opt_ddb.h" | |
61 | #include "opt_kgdb.h" | 61 | #include "opt_kgdb.h" | |
62 | #include "opt_modular.h" | 62 | #include "opt_modular.h" | |
63 | #include "opt_multiprocessor.h" | 63 | #include "opt_multiprocessor.h" | |
64 | #include "opt_dec_3000_300.h" | 64 | #include "opt_dec_3000_300.h" | |
65 | #include "opt_dec_3000_500.h" | 65 | #include "opt_dec_3000_500.h" | |
66 | #include "opt_execfmt.h" | 66 | #include "opt_execfmt.h" | |
67 | 67 | |||
68 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | 68 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | |
69 | 69 | |||
70 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.362 2020/09/02 17:40:23 riastradh Exp $"); | 70 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.363 2020/09/03 02:09:09 thorpej Exp $"); | |
71 | 71 | |||
72 | #include <sys/param.h> | 72 | #include <sys/param.h> | |
73 | #include <sys/systm.h> | 73 | #include <sys/systm.h> | |
74 | #include <sys/signalvar.h> | 74 | #include <sys/signalvar.h> | |
75 | #include <sys/kernel.h> | 75 | #include <sys/kernel.h> | |
76 | #include <sys/cpu.h> | 76 | #include <sys/cpu.h> | |
77 | #include <sys/proc.h> | 77 | #include <sys/proc.h> | |
78 | #include <sys/ras.h> | 78 | #include <sys/ras.h> | |
79 | #include <sys/sched.h> | 79 | #include <sys/sched.h> | |
80 | #include <sys/reboot.h> | 80 | #include <sys/reboot.h> | |
81 | #include <sys/device.h> | 81 | #include <sys/device.h> | |
82 | #include <sys/malloc.h> | 82 | #include <sys/malloc.h> | |
83 | #include <sys/module.h> | 83 | #include <sys/module.h> | |
@@ -289,44 +289,44 @@ alpha_init(u_long xxx_pfn __unused, u_lo | @@ -289,44 +289,44 @@ alpha_init(u_long xxx_pfn __unused, u_lo | |||
289 | } else { | 289 | } else { | |
290 | bootinfo.hwrpb_phys = | 290 | bootinfo.hwrpb_phys = | |
291 | ((struct rpb *)HWRPB_ADDR)->rpb_phys; | 291 | ((struct rpb *)HWRPB_ADDR)->rpb_phys; | |
292 | bootinfo.hwrpb_size = | 292 | bootinfo.hwrpb_size = | |
293 | ((struct rpb *)HWRPB_ADDR)->rpb_size; | 293 | ((struct rpb *)HWRPB_ADDR)->rpb_size; | |
294 | } | 294 | } | |
295 | memcpy(bootinfo.boot_flags, v1p->boot_flags, | 295 | memcpy(bootinfo.boot_flags, v1p->boot_flags, | |
296 | uimin(sizeof v1p->boot_flags, | 296 | uimin(sizeof v1p->boot_flags, | |
297 | sizeof bootinfo.boot_flags)); | 297 | sizeof bootinfo.boot_flags)); | |
298 | memcpy(bootinfo.booted_kernel, v1p->booted_kernel, | 298 | memcpy(bootinfo.booted_kernel, v1p->booted_kernel, | |
299 | uimin(sizeof v1p->booted_kernel, | 299 | uimin(sizeof v1p->booted_kernel, | |
300 | sizeof bootinfo.booted_kernel)); | 300 | sizeof bootinfo.booted_kernel)); | |
301 | /* booted dev not provided in bootinfo */ | 301 | /* booted dev not provided in bootinfo */ | |
302 | init_prom_interface((struct rpb *) | 302 | init_prom_interface(ptb, (struct rpb *) | |
303 | ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys)); | 303 | ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys)); | |
304 | prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, | 304 | prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, | |
305 | sizeof bootinfo.booted_dev); | 305 | sizeof bootinfo.booted_dev); | |
306 | break; | 306 | break; | |
307 | } | 307 | } | |
308 | default: | 308 | default: | |
309 | bootinfo_msg = "unknown bootinfo version"; | 309 | bootinfo_msg = "unknown bootinfo version"; | |
310 | goto nobootinfo; | 310 | goto nobootinfo; | |
311 | } | 311 | } | |
312 | } else { | 312 | } else { | |
313 | bootinfo_msg = "boot program did not pass bootinfo"; | 313 | bootinfo_msg = "boot program did not pass bootinfo"; | |
314 | nobootinfo: | 314 | nobootinfo: | |
315 | bootinfo.ssym = (u_long)_end; | 315 | bootinfo.ssym = (u_long)_end; | |
316 | bootinfo.esym = (u_long)_end; | 316 | bootinfo.esym = (u_long)_end; | |
317 | bootinfo.hwrpb_phys = ((struct rpb *)HWRPB_ADDR)->rpb_phys; | 317 | bootinfo.hwrpb_phys = ((struct rpb *)HWRPB_ADDR)->rpb_phys; | |
318 | bootinfo.hwrpb_size = ((struct rpb *)HWRPB_ADDR)->rpb_size; | 318 | bootinfo.hwrpb_size = ((struct rpb *)HWRPB_ADDR)->rpb_size; | |
319 | init_prom_interface((struct rpb *)HWRPB_ADDR); | 319 | init_prom_interface(ptb, (struct rpb *)HWRPB_ADDR); | |
320 | prom_getenv(PROM_E_BOOTED_OSFLAGS, bootinfo.boot_flags, | 320 | prom_getenv(PROM_E_BOOTED_OSFLAGS, bootinfo.boot_flags, | |
321 | sizeof bootinfo.boot_flags); | 321 | sizeof bootinfo.boot_flags); | |
322 | prom_getenv(PROM_E_BOOTED_FILE, bootinfo.booted_kernel, | 322 | prom_getenv(PROM_E_BOOTED_FILE, bootinfo.booted_kernel, | |
323 | sizeof bootinfo.booted_kernel); | 323 | sizeof bootinfo.booted_kernel); | |
324 | prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, | 324 | prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, | |
325 | sizeof bootinfo.booted_dev); | 325 | sizeof bootinfo.booted_dev); | |
326 | } | 326 | } | |
327 | 327 | |||
328 | /* | 328 | /* | |
329 | * Initialize the kernel's mapping of the RPB. It's needed for | 329 | * Initialize the kernel's mapping of the RPB. It's needed for | |
330 | * lots of things. | 330 | * lots of things. | |
331 | */ | 331 | */ | |
332 | hwrpb = (struct rpb *)ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys); | 332 | hwrpb = (struct rpb *)ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys); | |
@@ -365,37 +365,30 @@ nobootinfo: | @@ -365,37 +365,30 @@ nobootinfo: | |||
365 | trap_init(); | 365 | trap_init(); | |
366 | 366 | |||
367 | /* | 367 | /* | |
368 | * Find out this system's page size, and initialize | 368 | * Find out this system's page size, and initialize | |
369 | * PAGE_SIZE-dependent variables. | 369 | * PAGE_SIZE-dependent variables. | |
370 | */ | 370 | */ | |
371 | if (hwrpb->rpb_page_size != ALPHA_PGBYTES) | 371 | if (hwrpb->rpb_page_size != ALPHA_PGBYTES) | |
372 | panic("page size %lu != %d?!", hwrpb->rpb_page_size, | 372 | panic("page size %lu != %d?!", hwrpb->rpb_page_size, | |
373 | ALPHA_PGBYTES); | 373 | ALPHA_PGBYTES); | |
374 | uvmexp.pagesize = hwrpb->rpb_page_size; | 374 | uvmexp.pagesize = hwrpb->rpb_page_size; | |
375 | uvm_md_init(); | 375 | uvm_md_init(); | |
376 | 376 | |||
377 | /* | 377 | /* | |
378 | * Find out what hardware we're on, and do basic initialization. | 378 | * cputype has been initialized in init_prom_interface(). | |
379 | * Perform basic platform initialization using this info. | |||
379 | */ | 380 | */ | |
380 | cputype = hwrpb->rpb_type; | 381 | KASSERT(prom_interface_initialized); | |
381 | if (cputype < 0) { | |||
382 | /* | |||
383 | * At least some white-box systems have SRM which | |||
384 | * reports a systype that's the negative of their | |||
385 | * blue-box counterpart. | |||
386 | */ | |||
387 | cputype = -cputype; | |||
388 | } | |||
389 | c = platform_lookup(cputype); | 382 | c = platform_lookup(cputype); | |
390 | if (c == NULL) { | 383 | if (c == NULL) { | |
391 | platform_not_supported(); | 384 | platform_not_supported(); | |
392 | /* NOTREACHED */ | 385 | /* NOTREACHED */ | |
393 | } | 386 | } | |
394 | (*c->init)(); | 387 | (*c->init)(); | |
395 | cpu_setmodel("%s", platform.model); | 388 | cpu_setmodel("%s", platform.model); | |
396 | 389 | |||
397 | /* | 390 | /* | |
398 | * Initialize the real console, so that the bootstrap console is | 391 | * Initialize the real console, so that the bootstrap console is | |
399 | * no longer necessary. | 392 | * no longer necessary. | |
400 | */ | 393 | */ | |
401 | (*platform.cons_init)(); | 394 | (*platform.cons_init)(); | |
@@ -406,32 +399,27 @@ nobootinfo: | @@ -406,32 +399,27 @@ nobootinfo: | |||
406 | /* We should always be running on the primary. */ | 399 | /* We should always be running on the primary. */ | |
407 | assert(hwrpb->rpb_primary_cpu_id == cpu_id); | 400 | assert(hwrpb->rpb_primary_cpu_id == cpu_id); | |
408 | 401 | |||
409 | /* | 402 | /* | |
410 | * On single-CPU systypes, the primary should always be CPU 0, | 403 | * On single-CPU systypes, the primary should always be CPU 0, | |
411 | * except on Alpha 8200 systems where the CPU id is related | 404 | * except on Alpha 8200 systems where the CPU id is related | |
412 | * to the VID, which is related to the Turbo Laser node id. | 405 | * to the VID, which is related to the Turbo Laser node id. | |
413 | */ | 406 | */ | |
414 | if (cputype != ST_DEC_21000) | 407 | if (cputype != ST_DEC_21000) | |
415 | assert(hwrpb->rpb_primary_cpu_id == 0); | 408 | assert(hwrpb->rpb_primary_cpu_id == 0); | |
416 | #endif | 409 | #endif | |
417 | 410 | |||
418 | /* NO MORE FIRMWARE ACCESS ALLOWED */ | 411 | /* NO MORE FIRMWARE ACCESS ALLOWED */ | |
419 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 412 | /* XXX Unless prom_uses_prom_console() evaluates to non-zero.) */ | |
420 | /* | |||
421 | * XXX (unless _PMAP_MAY_USE_PROM_CONSOLE is defined and | |||
422 | * XXX pmap_uses_prom_console() evaluates to non-zero.) | |||
423 | */ | |||
424 | #endif | |||
425 | 413 | |||
426 | /* | 414 | /* | |
427 | * Find the beginning and end of the kernel (and leave a | 415 | * Find the beginning and end of the kernel (and leave a | |
428 | * bit of space before the beginning for the bootstrap | 416 | * bit of space before the beginning for the bootstrap | |
429 | * stack). | 417 | * stack). | |
430 | */ | 418 | */ | |
431 | kernstart = trunc_page((vaddr_t)kernel_text) - 2 * PAGE_SIZE; | 419 | kernstart = trunc_page((vaddr_t)kernel_text) - 2 * PAGE_SIZE; | |
432 | #if NKSYMS || defined(DDB) || defined(MODULAR) | 420 | #if NKSYMS || defined(DDB) || defined(MODULAR) | |
433 | ksym_start = (void *)bootinfo.ssym; | 421 | ksym_start = (void *)bootinfo.ssym; | |
434 | ksym_end = (void *)bootinfo.esym; | 422 | ksym_end = (void *)bootinfo.esym; | |
435 | kernend = (vaddr_t)round_page((vaddr_t)ksym_end); | 423 | kernend = (vaddr_t)round_page((vaddr_t)ksym_end); | |
436 | #else | 424 | #else | |
437 | kernend = (vaddr_t)round_page((vaddr_t)_end); | 425 | kernend = (vaddr_t)round_page((vaddr_t)_end); | |
@@ -497,87 +485,76 @@ nobootinfo: | @@ -497,87 +485,76 @@ nobootinfo: | |||
497 | unusedmem += memc->mddt_pg_cnt; | 485 | unusedmem += memc->mddt_pg_cnt; | |
498 | continue; | 486 | continue; | |
499 | } | 487 | } | |
500 | if (memc->mddt_usage & MDDT_PALCODE) { | 488 | if (memc->mddt_usage & MDDT_PALCODE) { | |
501 | resvmem += memc->mddt_pg_cnt; | 489 | resvmem += memc->mddt_pg_cnt; | |
502 | continue; | 490 | continue; | |
503 | } | 491 | } | |
504 | 492 | |||
505 | /* | 493 | /* | |
506 | * We have a memory cluster available for system | 494 | * We have a memory cluster available for system | |
507 | * software use. We must determine if this cluster | 495 | * software use. We must determine if this cluster | |
508 | * holds the kernel. | 496 | * holds the kernel. | |
509 | */ | 497 | */ | |
510 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 498 | ||
511 | /* | 499 | /* | |
512 | * XXX If the kernel uses the PROM console, we only use the | 500 | * XXX If the kernel uses the PROM console, we only use the | |
513 | * XXX memory after the kernel in the first system segment, | 501 | * XXX memory after the kernel in the first system segment, | |
514 | * XXX to avoid clobbering prom mapping, data, etc. | 502 | * XXX to avoid clobbering prom mapping, data, etc. | |
515 | */ | 503 | */ | |
516 | if (!pmap_uses_prom_console() || physmem == 0) { | |||
517 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | |||
518 | physmem += memc->mddt_pg_cnt; | 504 | physmem += memc->mddt_pg_cnt; | |
519 | pfn0 = memc->mddt_pfn; | 505 | pfn0 = memc->mddt_pfn; | |
520 | pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt; | 506 | pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt; | |
521 | if (pfn0 <= kernstartpfn && kernendpfn <= pfn1) { | 507 | if (pfn0 <= kernstartpfn && kernendpfn <= pfn1) { | |
522 | /* | 508 | /* | |
523 | * Must compute the location of the kernel | 509 | * Must compute the location of the kernel | |
524 | * within the segment. | 510 | * within the segment. | |
525 | */ | 511 | */ | |
526 | #if 0 | 512 | #if 0 | |
527 | printf("Cluster %d contains kernel\n", i); | 513 | printf("Cluster %d contains kernel\n", i); | |
528 | #endif | 514 | #endif | |
529 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 515 | if (pfn0 < kernstartpfn && !prom_uses_prom_console()) { | |
530 | if (!pmap_uses_prom_console()) { | |||
531 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | |||
532 | if (pfn0 < kernstartpfn) { | |||
533 | /* | 516 | /* | |
534 | * There is a chunk before the kernel. | 517 | * There is a chunk before the kernel. | |
535 | */ | 518 | */ | |
536 | #if 0 | 519 | #if 0 | |
537 | printf("Loading chunk before kernel: " | 520 | printf("Loading chunk before kernel: " | |
538 | "0x%lx / 0x%lx\n", pfn0, kernstartpfn); | 521 | "0x%lx / 0x%lx\n", pfn0, kernstartpfn); | |
539 | #endif | 522 | #endif | |
540 | uvm_page_physload(pfn0, kernstartpfn, | 523 | uvm_page_physload(pfn0, kernstartpfn, | |
541 | pfn0, kernstartpfn, VM_FREELIST_DEFAULT); | 524 | pfn0, kernstartpfn, VM_FREELIST_DEFAULT); | |
542 | } | 525 | } | |
543 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | |||
544 | } | |||
545 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | |||
546 | if (kernendpfn < pfn1) { | 526 | if (kernendpfn < pfn1) { | |
547 | /* | 527 | /* | |
548 | * There is a chunk after the kernel. | 528 | * There is a chunk after the kernel. | |
549 | */ | 529 | */ | |
550 | #if 0 | 530 | #if 0 | |
551 | printf("Loading chunk after kernel: " | 531 | printf("Loading chunk after kernel: " | |
552 | "0x%lx / 0x%lx\n", kernendpfn, pfn1); | 532 | "0x%lx / 0x%lx\n", kernendpfn, pfn1); | |
553 | #endif | 533 | #endif | |
554 | uvm_page_physload(kernendpfn, pfn1, | 534 | uvm_page_physload(kernendpfn, pfn1, | |
555 | kernendpfn, pfn1, VM_FREELIST_DEFAULT); | 535 | kernendpfn, pfn1, VM_FREELIST_DEFAULT); | |
556 | } | 536 | } | |
557 | } else { | 537 | } else { | |
558 | /* | 538 | /* | |
559 | * Just load this cluster as one chunk. | 539 | * Just load this cluster as one chunk. | |
560 | */ | 540 | */ | |
561 | #if 0 | 541 | #if 0 | |
562 | printf("Loading cluster %d: 0x%lx / 0x%lx\n", i, | 542 | printf("Loading cluster %d: 0x%lx / 0x%lx\n", i, | |
563 | pfn0, pfn1); | 543 | pfn0, pfn1); | |
564 | #endif | 544 | #endif | |
565 | uvm_page_physload(pfn0, pfn1, pfn0, pfn1, | 545 | uvm_page_physload(pfn0, pfn1, pfn0, pfn1, | |
566 | VM_FREELIST_DEFAULT); | 546 | VM_FREELIST_DEFAULT); | |
567 | } | 547 | } | |
568 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | |||
569 | } | |||
570 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | |||
571 | } | 548 | } | |
572 | 549 | |||
573 | /* | 550 | /* | |
574 | * Dump out the MDDT if it looks odd... | 551 | * Dump out the MDDT if it looks odd... | |
575 | */ | 552 | */ | |
576 | if (mddtweird) { | 553 | if (mddtweird) { | |
577 | printf("\n"); | 554 | printf("\n"); | |
578 | printf("complete memory cluster information:\n"); | 555 | printf("complete memory cluster information:\n"); | |
579 | for (i = 0; i < mddtp->mddt_cluster_cnt; i++) { | 556 | for (i = 0; i < mddtp->mddt_cluster_cnt; i++) { | |
580 | printf("mddt %d:\n", i); | 557 | printf("mddt %d:\n", i); | |
581 | printf("\tpfn %lx\n", | 558 | printf("\tpfn %lx\n", | |
582 | mddtp->mddt_clusters[i].mddt_pfn); | 559 | mddtp->mddt_clusters[i].mddt_pfn); | |
583 | printf("\tcnt %lx\n", | 560 | printf("\tcnt %lx\n", | |
@@ -803,29 +780,29 @@ module_init_md(void) | @@ -803,29 +780,29 @@ module_init_md(void) | |||
803 | { | 780 | { | |
804 | /* nada. */ | 781 | /* nada. */ | |
805 | } | 782 | } | |
806 | #endif /* MODULAR */ | 783 | #endif /* MODULAR */ | |
807 | 784 | |||
808 | void | 785 | void | |
809 | consinit(void) | 786 | consinit(void) | |
810 | { | 787 | { | |
811 | 788 | |||
812 | /* | 789 | /* | |
813 | * Everything related to console initialization is done | 790 | * Everything related to console initialization is done | |
814 | * in alpha_init(). | 791 | * in alpha_init(). | |
815 | */ | 792 | */ | |
816 | #if defined(DIAGNOSTIC) && defined(_PMAP_MAY_USE_PROM_CONSOLE) | 793 | #if defined(DIAGNOSTIC) && defined(_PROM_MAY_USE_PROM_CONSOLE) | |
817 | printf("consinit: %susing prom console\n", | 794 | printf("consinit: %susing prom console\n", | |
818 | pmap_uses_prom_console() ? "" : "not "); | 795 | prom_uses_prom_console() ? "" : "not "); | |
819 | #endif | 796 | #endif | |
820 | } | 797 | } | |
821 | 798 | |||
822 | void | 799 | void | |
823 | cpu_startup(void) | 800 | cpu_startup(void) | |
824 | { | 801 | { | |
825 | extern struct evcnt fpevent_use, fpevent_reuse; | 802 | extern struct evcnt fpevent_use, fpevent_reuse; | |
826 | vaddr_t minaddr, maxaddr; | 803 | vaddr_t minaddr, maxaddr; | |
827 | char pbuf[9]; | 804 | char pbuf[9]; | |
828 | #if defined(DEBUG) | 805 | #if defined(DEBUG) | |
829 | extern int pmapdebug; | 806 | extern int pmapdebug; | |
830 | int opmapdebug = pmapdebug; | 807 | int opmapdebug = pmapdebug; | |
831 | 808 | |||
@@ -955,35 +932,26 @@ identifycpu(void) | @@ -955,35 +932,26 @@ identifycpu(void) | |||
955 | */ | 932 | */ | |
956 | printf("%s", cpu_getmodel()); | 933 | printf("%s", cpu_getmodel()); | |
957 | for(s = cpu_getmodel(); *s; ++s) | 934 | for(s = cpu_getmodel(); *s; ++s) | |
958 | if(strncasecmp(s, "MHz", 3) == 0) | 935 | if(strncasecmp(s, "MHz", 3) == 0) | |
959 | goto skipMHz; | 936 | goto skipMHz; | |
960 | printf(", %ldMHz", hwrpb->rpb_cc_freq / 1000000); | 937 | printf(", %ldMHz", hwrpb->rpb_cc_freq / 1000000); | |
961 | skipMHz: | 938 | skipMHz: | |
962 | printf(", s/n "); | 939 | printf(", s/n "); | |
963 | for (i = 0; i < 10; i++) | 940 | for (i = 0; i < 10; i++) | |
964 | printf("%c", hwrpb->rpb_ssn[i]); | 941 | printf("%c", hwrpb->rpb_ssn[i]); | |
965 | printf("\n"); | 942 | printf("\n"); | |
966 | printf("%ld byte page size, %d processor%s.\n", | 943 | printf("%ld byte page size, %d processor%s.\n", | |
967 | hwrpb->rpb_page_size, ncpus, ncpus == 1 ? "" : "s"); | 944 | hwrpb->rpb_page_size, ncpus, ncpus == 1 ? "" : "s"); | |
968 | #if 0 | |||
969 | /* this isn't defined for any systems that we run on? */ | |||
970 | printf("serial number 0x%lx 0x%lx\n", | |||
971 | ((long *)hwrpb->rpb_ssn)[0], ((long *)hwrpb->rpb_ssn)[1]); | |||
972 | ||||
973 | /* and these aren't particularly useful! */ | |||
974 | printf("variation: 0x%lx, revision 0x%lx\n", | |||
975 | hwrpb->rpb_variation, *(long *)hwrpb->rpb_revision); | |||
976 | #endif | |||
977 | } | 945 | } | |
978 | 946 | |||
979 | int waittime = -1; | 947 | int waittime = -1; | |
980 | struct pcb dumppcb; | 948 | struct pcb dumppcb; | |
981 | 949 | |||
982 | void | 950 | void | |
983 | cpu_reboot(int howto, char *bootstr) | 951 | cpu_reboot(int howto, char *bootstr) | |
984 | { | 952 | { | |
985 | #if defined(MULTIPROCESSOR) | 953 | #if defined(MULTIPROCESSOR) | |
986 | u_long cpu_id = cpu_number(); | 954 | u_long cpu_id = cpu_number(); | |
987 | u_long wait_mask; | 955 | u_long wait_mask; | |
988 | int i; | 956 | int i; | |
989 | #endif | 957 | #endif |
--- src/sys/arch/alpha/alpha/pmap.c 2020/09/03 02:05:03 1.270
+++ src/sys/arch/alpha/alpha/pmap.c 2020/09/03 02:09:09 1.271
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $ */ | 1 | /* $NetBSD: pmap.c,v 1.271 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 | 4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 9 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
10 | * NASA Ames Research Center, by Andrew Doran and Mindaugas Rasiukevicius, | 10 | * NASA Ames Research Center, by Andrew Doran and Mindaugas Rasiukevicius, | |
11 | * and by Chris G. Demetriou. | 11 | * and by Chris G. Demetriou. | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -125,42 +125,42 @@ | @@ -125,42 +125,42 @@ | |||
125 | * this module may delay invalidate or reduced protection | 125 | * this module may delay invalidate or reduced protection | |
126 | * operations until such time as they are actually | 126 | * operations until such time as they are actually | |
127 | * necessary. This module is given full information as | 127 | * necessary. This module is given full information as | |
128 | * to which processors are currently using which maps, | 128 | * to which processors are currently using which maps, | |
129 | * and to when physical maps must be made correct. | 129 | * and to when physical maps must be made correct. | |
130 | */ | 130 | */ | |
131 | 131 | |||
132 | #include "opt_lockdebug.h" | 132 | #include "opt_lockdebug.h" | |
133 | #include "opt_sysv.h" | 133 | #include "opt_sysv.h" | |
134 | #include "opt_multiprocessor.h" | 134 | #include "opt_multiprocessor.h" | |
135 | 135 | |||
136 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | 136 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | |
137 | 137 | |||
138 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $"); | 138 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.271 2020/09/03 02:09:09 thorpej Exp $"); | |
139 | 139 | |||
140 | #include <sys/param.h> | 140 | #include <sys/param.h> | |
141 | #include <sys/systm.h> | 141 | #include <sys/systm.h> | |
142 | #include <sys/kernel.h> | 142 | #include <sys/kernel.h> | |
143 | #include <sys/proc.h> | 143 | #include <sys/proc.h> | |
144 | #include <sys/malloc.h> | 144 | #include <sys/malloc.h> | |
145 | #include <sys/pool.h> | 145 | #include <sys/pool.h> | |
146 | #include <sys/buf.h> | 146 | #include <sys/buf.h> | |
147 | #include <sys/evcnt.h> | 147 | #include <sys/evcnt.h> | |
148 | #include <sys/atomic.h> | 148 | #include <sys/atomic.h> | |
149 | #include <sys/cpu.h> | 149 | #include <sys/cpu.h> | |
150 | 150 | |||
151 | #include <uvm/uvm.h> | 151 | #include <uvm/uvm.h> | |
152 | 152 | |||
153 | #if defined(_PMAP_MAY_USE_PROM_CONSOLE) || defined(MULTIPROCESSOR) | 153 | #if defined(MULTIPROCESSOR) | |
154 | #include <machine/rpb.h> | 154 | #include <machine/rpb.h> | |
155 | #endif | 155 | #endif | |
156 | 156 | |||
157 | #ifdef DEBUG | 157 | #ifdef DEBUG | |
158 | #define PDB_FOLLOW 0x0001 | 158 | #define PDB_FOLLOW 0x0001 | |
159 | #define PDB_INIT 0x0002 | 159 | #define PDB_INIT 0x0002 | |
160 | #define PDB_ENTER 0x0004 | 160 | #define PDB_ENTER 0x0004 | |
161 | #define PDB_REMOVE 0x0008 | 161 | #define PDB_REMOVE 0x0008 | |
162 | #define PDB_CREATE 0x0010 | 162 | #define PDB_CREATE 0x0010 | |
163 | #define PDB_PTPAGE 0x0020 | 163 | #define PDB_PTPAGE 0x0020 | |
164 | #define PDB_ASN 0x0040 | 164 | #define PDB_ASN 0x0040 | |
165 | #define PDB_BITS 0x0080 | 165 | #define PDB_BITS 0x0080 | |
166 | #define PDB_COLLECT 0x0100 | 166 | #define PDB_COLLECT 0x0100 | |
@@ -1277,47 +1277,26 @@ pmap_bootstrap(paddr_t ptaddr, u_int max | @@ -1277,47 +1277,26 @@ pmap_bootstrap(paddr_t ptaddr, u_int max | |||
1277 | (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT; | 1277 | (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT; | |
1278 | pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED; | 1278 | pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED; | |
1279 | kernel_lev1map[l1pte_index(VM_MIN_KERNEL_ADDRESS + | 1279 | kernel_lev1map[l1pte_index(VM_MIN_KERNEL_ADDRESS + | |
1280 | (i*PAGE_SIZE*NPTEPG*NPTEPG))] = pte; | 1280 | (i*PAGE_SIZE*NPTEPG*NPTEPG))] = pte; | |
1281 | } | 1281 | } | |
1282 | 1282 | |||
1283 | /* Map the virtual page table */ | 1283 | /* Map the virtual page table */ | |
1284 | pte = (ALPHA_K0SEG_TO_PHYS((vaddr_t)kernel_lev1map) >> PGSHIFT) | 1284 | pte = (ALPHA_K0SEG_TO_PHYS((vaddr_t)kernel_lev1map) >> PGSHIFT) | |
1285 | << PG_SHIFT; | 1285 | << PG_SHIFT; | |
1286 | pte |= PG_V | PG_KRE | PG_KWE; /* NOTE NO ASM */ | 1286 | pte |= PG_V | PG_KRE | PG_KWE; /* NOTE NO ASM */ | |
1287 | kernel_lev1map[l1pte_index(VPTBASE)] = pte; | 1287 | kernel_lev1map[l1pte_index(VPTBASE)] = pte; | |
1288 | VPT = (pt_entry_t *)VPTBASE; | 1288 | VPT = (pt_entry_t *)VPTBASE; | |
1289 | 1289 | |||
1290 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | |||
1291 | { | |||
1292 | extern pt_entry_t prom_pte; /* XXX */ | |||
1293 | extern int prom_mapped; /* XXX */ | |||
1294 | ||||
1295 | if (pmap_uses_prom_console()) { | |||
1296 | /* | |||
1297 | * XXX Save old PTE so we can remap the PROM, if | |||
1298 | * XXX necessary. | |||
1299 | */ | |||
1300 | prom_pte = *(pt_entry_t *)ptaddr & ~PG_ASM; | |||
1301 | } | |||
1302 | prom_mapped = 0; | |||
1303 | ||||
1304 | /* | |||
1305 | * Actually, this code lies. The prom is still mapped, and will | |||
1306 | * remain so until the context switch after alpha_init() returns. | |||
1307 | */ | |||
1308 | } | |||
1309 | #endif | |||
1310 | ||||
1311 | /* | 1290 | /* | |
1312 | * Set up level 2 page table. | 1291 | * Set up level 2 page table. | |
1313 | */ | 1292 | */ | |
1314 | /* Map all of the level 3 pte pages */ | 1293 | /* Map all of the level 3 pte pages */ | |
1315 | for (i = 0; i < howmany(lev3mapsize, NPTEPG); i++) { | 1294 | for (i = 0; i < howmany(lev3mapsize, NPTEPG); i++) { | |
1316 | pte = (ALPHA_K0SEG_TO_PHYS(((vaddr_t)lev3map) + | 1295 | pte = (ALPHA_K0SEG_TO_PHYS(((vaddr_t)lev3map) + | |
1317 | (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT; | 1296 | (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT; | |
1318 | pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED; | 1297 | pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED; | |
1319 | lev2map[l2pte_index(VM_MIN_KERNEL_ADDRESS+ | 1298 | lev2map[l2pte_index(VM_MIN_KERNEL_ADDRESS+ | |
1320 | (i*PAGE_SIZE*NPTEPG))] = pte; | 1299 | (i*PAGE_SIZE*NPTEPG))] = pte; | |
1321 | } | 1300 | } | |
1322 | 1301 | |||
1323 | /* Initialize the pmap_growkernel_lock. */ | 1302 | /* Initialize the pmap_growkernel_lock. */ | |
@@ -1382,35 +1361,26 @@ pmap_bootstrap(paddr_t ptaddr, u_int max | @@ -1382,35 +1361,26 @@ pmap_bootstrap(paddr_t ptaddr, u_int max | |||
1382 | /* | 1361 | /* | |
1383 | * Set up lwp0's PCB such that the ptbr points to the right place | 1362 | * Set up lwp0's PCB such that the ptbr points to the right place | |
1384 | * and has the kernel pmap's (really unused) ASN. | 1363 | * and has the kernel pmap's (really unused) ASN. | |
1385 | */ | 1364 | */ | |
1386 | pcb = lwp_getpcb(&lwp0); | 1365 | pcb = lwp_getpcb(&lwp0); | |
1387 | pcb->pcb_hw.apcb_ptbr = | 1366 | pcb->pcb_hw.apcb_ptbr = | |
1388 | ALPHA_K0SEG_TO_PHYS((vaddr_t)kernel_lev1map) >> PGSHIFT; | 1367 | ALPHA_K0SEG_TO_PHYS((vaddr_t)kernel_lev1map) >> PGSHIFT; | |
1389 | pcb->pcb_hw.apcb_asn = PMAP_ASN_KERNEL; | 1368 | pcb->pcb_hw.apcb_asn = PMAP_ASN_KERNEL; | |
1390 | 1369 | |||
1391 | struct cpu_info * const ci = curcpu(); | 1370 | struct cpu_info * const ci = curcpu(); | |
1392 | pmap_init_cpu(ci); | 1371 | pmap_init_cpu(ci); | |
1393 | } | 1372 | } | |
1394 | 1373 | |||
1395 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | |||
1396 | int | |||
1397 | pmap_uses_prom_console(void) | |||
1398 | { | |||
1399 | ||||
1400 | return (cputype == ST_DEC_21000); | |||
1401 | } | |||
1402 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | |||
1403 | ||||
1404 | /* | 1374 | /* | |
1405 | * pmap_virtual_space: [ INTERFACE ] | 1375 | * pmap_virtual_space: [ INTERFACE ] | |
1406 | * | 1376 | * | |
1407 | * Define the initial bounds of the kernel virtual address space. | 1377 | * Define the initial bounds of the kernel virtual address space. | |
1408 | */ | 1378 | */ | |
1409 | void | 1379 | void | |
1410 | pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) | 1380 | pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) | |
1411 | { | 1381 | { | |
1412 | 1382 | |||
1413 | *vstartp = VM_MIN_KERNEL_ADDRESS; /* kernel is in K0SEG */ | 1383 | *vstartp = VM_MIN_KERNEL_ADDRESS; /* kernel is in K0SEG */ | |
1414 | *vendp = VM_MAX_KERNEL_ADDRESS; /* we use pmap_growkernel */ | 1384 | *vendp = VM_MAX_KERNEL_ADDRESS; /* we use pmap_growkernel */ | |
1415 | } | 1385 | } | |
1416 | 1386 |
--- src/sys/arch/alpha/alpha/prom.c 2020/08/30 16:26:56 1.53
+++ src/sys/arch/alpha/alpha/prom.c 2020/09/03 02:09:09 1.54
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 thorpej Exp $ */ | 1 | /* $NetBSD: prom.c,v 1.54 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University | 4 | * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University | |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify and distribute this software and its | 7 | * Permission to use, copy, modify and distribute this software and its | |
8 | * documentation is hereby granted, provided that both the copyright | 8 | * documentation is hereby granted, provided that both the copyright | |
9 | * notice and this permission notice appear in all copies of the | 9 | * notice and this permission notice appear in all copies of the | |
10 | * software, derivative works or modified versions, and any portions | 10 | * software, derivative works or modified versions, and any portions | |
11 | * thereof, and that both notices appear in supporting documentation. | 11 | * thereof, and that both notices appear in supporting documentation. | |
12 | * | 12 | * | |
13 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 13 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
14 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | 14 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
@@ -17,184 +17,224 @@ | @@ -17,184 +17,224 @@ | |||
17 | * Carnegie Mellon requests users of this software to return to | 17 | * Carnegie Mellon requests users of this software to return to | |
18 | * | 18 | * | |
19 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | 19 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
20 | * School of Computer Science | 20 | * School of Computer Science | |
21 | * Carnegie Mellon University | 21 | * Carnegie Mellon University | |
22 | * Pittsburgh PA 15213-3890 | 22 | * Pittsburgh PA 15213-3890 | |
23 | * | 23 | * | |
24 | * any improvements or extensions that they make and grant Carnegie Mellon | 24 | * any improvements or extensions that they make and grant Carnegie Mellon | |
25 | * the rights to redistribute these changes. | 25 | * the rights to redistribute these changes. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | 28 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | |
29 | 29 | |||
30 | __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 thorpej Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.54 2020/09/03 02:09:09 thorpej Exp $"); | |
31 | 31 | |||
32 | #include "opt_multiprocessor.h" | 32 | #include "opt_multiprocessor.h" | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/proc.h> | 36 | #include <sys/proc.h> | |
37 | #include <sys/cpu.h> | 37 | #include <sys/cpu.h> | |
38 | 38 | |||
39 | #include <uvm/uvm_extern.h> | 39 | #include <uvm/uvm_extern.h> | |
40 | 40 | |||
41 | #include <machine/rpb.h> | 41 | #include <machine/rpb.h> | |
42 | #include <machine/alpha.h> | 42 | #include <machine/alpha.h> | |
43 | #define ENABLEPROM | 43 | #define ENABLEPROM | |
44 | #include <machine/prom.h> | 44 | #include <machine/prom.h> | |
45 | 45 | |||
46 | #include <dev/cons.h> | 46 | #include <dev/cons.h> | |
47 | 47 | |||
48 | /* XXX this is to fake out the console routines, while booting. */ | 48 | /* XXX this is to fake out the console routines, while booting. */ | |
49 | struct consdev promcons = { | 49 | struct consdev promcons = { | |
50 | .cn_getc = promcngetc, | 50 | .cn_getc = promcngetc, | |
51 | .cn_putc = promcnputc, | 51 | .cn_putc = promcnputc, | |
52 | .cn_pollc = nullcnpollc, | 52 | .cn_pollc = nullcnpollc, | |
53 | .cn_dev = makedev(23,0), | 53 | .cn_dev = makedev(23,0), | |
54 | .cn_pri = 1 | 54 | .cn_pri = 1 | |
55 | }; | 55 | }; | |
56 | 56 | |||
57 | struct rpb *hwrpb; | 57 | struct rpb *hwrpb __read_mostly; | |
58 | int alpha_console; | 58 | int alpha_console; | |
59 | 59 | |||
60 | extern struct prom_vec prom_dispatch_v; | 60 | extern struct prom_vec prom_dispatch_v; | |
61 | 61 | |||
62 | static int prom_is_qemu; /* XXX */ | 62 | bool prom_interface_initialized; | |
63 | int prom_mapped = 1; /* Is PROM still mapped? */ | |||
64 | static bool prom_is_qemu; /* XXX */ | |||
63 | 65 | |||
64 | static kmutex_t prom_lock; | 66 | static kmutex_t prom_lock; | |
65 | 67 | |||
66 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 68 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
67 | int prom_mapped = 1; /* Is PROM still mapped? */ | |||
68 | 69 | |||
69 | pt_entry_t prom_pte, saved_pte[1]; /* XXX */ | 70 | pt_entry_t prom_pte, saved_pte[1]; /* XXX */ | |
70 | 71 | |||
71 | static pt_entry_t * | 72 | static pt_entry_t * | |
72 | prom_lev1map(void) | 73 | prom_lev1map(void) | |
73 | { | 74 | { | |
74 | struct alpha_pcb *apcb; | 75 | struct alpha_pcb *apcb; | |
75 | 76 | |||
76 | /* | 77 | /* | |
77 | * Find the level 1 map that we're currently running on. | 78 | * Find the level 1 map that we're currently running on. | |
78 | */ | 79 | */ | |
79 | apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb); | 80 | apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb); | |
80 | 81 | |||
81 | return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT)); | 82 | return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT)); | |
82 | } | 83 | } | |
83 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | 84 | #endif /* _PROM_MAY_USE_PROM_CONSOLE */ | |
85 | ||||
86 | bool | |||
87 | prom_uses_prom_console(void) | |||
88 | { | |||
89 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |||
90 | return (cputype == ST_DEC_21000); | |||
91 | #else | |||
92 | return false; | |||
93 | #endif | |||
94 | } | |||
95 | ||||
96 | static void | |||
97 | prom_init_cputype(const struct rpb * const rpb) | |||
98 | { | |||
99 | cputype = rpb->rpb_type; | |||
100 | if (cputype < 0) { | |||
101 | /* | |||
102 | * At least some white-box systems have SRM which | |||
103 | * reports a systype that's the negative of their | |||
104 | * blue-box counterpart. | |||
105 | */ | |||
106 | cputype = -cputype; | |||
107 | } | |||
108 | } | |||
84 | 109 | |||
85 | static void | 110 | static void | |
86 | prom_check_qemu(const struct rpb * const rpb) | 111 | prom_check_qemu(const struct rpb * const rpb) | |
87 | { | 112 | { | |
88 | if (!prom_is_qemu) { | 113 | if (!prom_is_qemu) { | |
89 | if (rpb->rpb_ssn[0] == 'Q' && | 114 | if (rpb->rpb_ssn[0] == 'Q' && | |
90 | rpb->rpb_ssn[1] == 'E' && | 115 | rpb->rpb_ssn[1] == 'E' && | |
91 | rpb->rpb_ssn[2] == 'M' && | 116 | rpb->rpb_ssn[2] == 'M' && | |
92 | rpb->rpb_ssn[3] == 'U') { | 117 | rpb->rpb_ssn[3] == 'U') { | |
93 | prom_is_qemu = 1; | 118 | prom_is_qemu = true; | |
94 | } | 119 | } | |
95 | } | 120 | } | |
96 | } | 121 | } | |
97 | 122 | |||
98 | void | 123 | void | |
99 | init_prom_interface(struct rpb *rpb) | 124 | init_prom_interface(u_long ptb_pfn, struct rpb *rpb) | |
100 | { | 125 | { | |
101 | static bool prom_interface_initialized; | |||
102 | 126 | |||
103 | if (prom_interface_initialized) | 127 | if (prom_interface_initialized) | |
104 | return; | 128 | return; | |
105 | 129 | |||
106 | struct crb *c; | 130 | struct crb *c; | |
107 | 131 | |||
132 | prom_init_cputype(rpb); | |||
108 | prom_check_qemu(rpb); | 133 | prom_check_qemu(rpb); | |
109 | 134 | |||
110 | c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); | 135 | c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); | |
111 | 136 | |||
112 | prom_dispatch_v.routine_arg = c->crb_v_dispatch; | 137 | prom_dispatch_v.routine_arg = c->crb_v_dispatch; | |
113 | prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; | 138 | prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; | |
114 | 139 | |||
140 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |||
141 | if (prom_uses_prom_console()) { | |||
142 | /* | |||
143 | * XXX Save old PTE so we can remap the PROM, if | |||
144 | * XXX necessary. | |||
145 | */ | |||
146 | pt_entry_t * const l1pt = | |||
147 | (pt_entry_t *)ALPHA_PHYS_TO_K0SEG(ptb_pfn << PGSHIFT); | |||
148 | prom_pte = l1pt[0] & ~PG_ASM; | |||
149 | } | |||
150 | #endif /* _PROM_MAY_USE_PROM_CONSOLE */ | |||
151 | ||||
115 | mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH); | 152 | mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH); | |
116 | prom_interface_initialized = true; | 153 | prom_interface_initialized = true; | |
117 | } | 154 | } | |
118 | 155 | |||
119 | void | 156 | void | |
120 | init_bootstrap_console(void) | 157 | init_bootstrap_console(void) | |
121 | { | 158 | { | |
122 | char buf[4]; | 159 | char buf[4]; | |
123 | 160 | |||
124 | init_prom_interface(hwrpb); | 161 | /* init_prom_interface() has already been called. */ | |
162 | if (! prom_interface_initialized) { | |||
163 | prom_halt(1); | |||
164 | } | |||
125 | 165 | |||
126 | prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf)); | 166 | prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf)); | |
127 | alpha_console = buf[0] - '0'; | 167 | alpha_console = buf[0] - '0'; | |
128 | 168 | |||
129 | /* XXX fake out the console routines, for now */ | 169 | /* XXX fake out the console routines, for now */ | |
130 | cn_tab = &promcons; | 170 | cn_tab = &promcons; | |
131 | } | 171 | } | |
132 | 172 | |||
133 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 173 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
134 | static void prom_cache_sync(void); | 174 | static void prom_cache_sync(void); | |
135 | #endif | 175 | #endif | |
136 | 176 | |||
137 | void | 177 | void | |
138 | prom_enter(void) | 178 | prom_enter(void) | |
139 | { | 179 | { | |
140 | 180 | |||
141 | mutex_enter(&prom_lock); | 181 | mutex_enter(&prom_lock); | |
142 | 182 | |||
143 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 183 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
144 | /* | 184 | /* | |
145 | * If we have not yet switched out of the PROM's context | 185 | * If we have not yet switched out of the PROM's context | |
146 | * (i.e. the first one after alpha_init()), then the PROM | 186 | * (i.e. the first one after alpha_init()), then the PROM | |
147 | * is still mapped, regardless of the `prom_mapped' setting. | 187 | * is still mapped, regardless of the `prom_mapped' setting. | |
148 | */ | 188 | */ | |
149 | if (prom_mapped == 0 && curpcb != 0) { | 189 | if (prom_mapped == 0 && curpcb != 0) { | |
150 | if (!pmap_uses_prom_console()) | 190 | if (!prom_uses_prom_console()) | |
151 | panic("prom_enter"); | 191 | panic("prom_enter"); | |
152 | { | 192 | { | |
153 | pt_entry_t *lev1map; | 193 | pt_entry_t *lev1map; | |
154 | 194 | |||
155 | lev1map = prom_lev1map(); /* XXX */ | 195 | lev1map = prom_lev1map(); /* XXX */ | |
156 | saved_pte[0] = lev1map[0]; /* XXX */ | 196 | saved_pte[0] = lev1map[0]; /* XXX */ | |
157 | lev1map[0] = prom_pte; /* XXX */ | 197 | lev1map[0] = prom_pte; /* XXX */ | |
158 | } | 198 | } | |
159 | prom_cache_sync(); /* XXX */ | 199 | prom_cache_sync(); /* XXX */ | |
160 | } | 200 | } | |
161 | #endif | 201 | #endif | |
162 | } | 202 | } | |
163 | 203 | |||
164 | void | 204 | void | |
165 | prom_leave(void) | 205 | prom_leave(void) | |
166 | { | 206 | { | |
167 | 207 | |||
168 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 208 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
169 | /* | 209 | /* | |
170 | * See comment above. | 210 | * See comment above. | |
171 | */ | 211 | */ | |
172 | if (prom_mapped == 0 && curpcb != 0) { | 212 | if (prom_mapped == 0 && curpcb != 0) { | |
173 | if (!pmap_uses_prom_console()) | 213 | if (!prom_uses_prom_console()) | |
174 | panic("prom_leave"); | 214 | panic("prom_leave"); | |
175 | { | 215 | { | |
176 | pt_entry_t *lev1map; | 216 | pt_entry_t *lev1map; | |
177 | 217 | |||
178 | lev1map = prom_lev1map(); /* XXX */ | 218 | lev1map = prom_lev1map(); /* XXX */ | |
179 | lev1map[0] = saved_pte[0]; /* XXX */ | 219 | lev1map[0] = saved_pte[0]; /* XXX */ | |
180 | } | 220 | } | |
181 | prom_cache_sync(); /* XXX */ | 221 | prom_cache_sync(); /* XXX */ | |
182 | } | 222 | } | |
183 | #endif | 223 | #endif | |
184 | mutex_exit(&prom_lock); | 224 | mutex_exit(&prom_lock); | |
185 | } | 225 | } | |
186 | 226 | |||
187 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 227 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
188 | static void | 228 | static void | |
189 | prom_cache_sync(void) | 229 | prom_cache_sync(void) | |
190 | { | 230 | { | |
191 | ALPHA_TBIA(); | 231 | ALPHA_TBIA(); | |
192 | alpha_pal_imb(); | 232 | alpha_pal_imb(); | |
193 | } | 233 | } | |
194 | #endif | 234 | #endif | |
195 | 235 | |||
196 | /* | 236 | /* | |
197 | * promcnputc: | 237 | * promcnputc: | |
198 | * | 238 | * | |
199 | * Remap char before passing off to prom. | 239 | * Remap char before passing off to prom. | |
200 | * | 240 | * |
--- src/sys/arch/alpha/alpha/promcons.c 2019/08/09 08:05:57 1.40
+++ src/sys/arch/alpha/alpha/promcons.c 2020/09/03 02:09:09 1.41
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: promcons.c,v 1.40 2019/08/09 08:05:57 rin Exp $ */ | 1 | /* $NetBSD: promcons.c,v 1.41 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | 4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Author: Chris G. Demetriou | 7 | * Author: Chris G. Demetriou | |
8 | * | 8 | * | |
9 | * Permission to use, copy, modify and distribute this software and | 9 | * Permission to use, copy, modify and distribute this software and | |
10 | * its documentation is hereby granted, provided that both the copyright | 10 | * its documentation is hereby granted, provided that both the copyright | |
11 | * notice and this permission notice appear in all copies of the | 11 | * notice and this permission notice appear in all copies of the | |
12 | * software, derivative works or modified versions, and any portions | 12 | * software, derivative works or modified versions, and any portions | |
13 | * thereof, and that both notices appear in supporting documentation. | 13 | * thereof, and that both notices appear in supporting documentation. | |
14 | * | 14 | * | |
@@ -19,53 +19,53 @@ | @@ -19,53 +19,53 @@ | |||
19 | * Carnegie Mellon requests users of this software to return to | 19 | * Carnegie Mellon requests users of this software to return to | |
20 | * | 20 | * | |
21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | 21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
22 | * School of Computer Science | 22 | * School of Computer Science | |
23 | * Carnegie Mellon University | 23 | * Carnegie Mellon University | |
24 | * Pittsburgh PA 15213-3890 | 24 | * Pittsburgh PA 15213-3890 | |
25 | * | 25 | * | |
26 | * any improvements or extensions that they make and grant Carnegie the | 26 | * any improvements or extensions that they make and grant Carnegie the | |
27 | * rights to redistribute these changes. | 27 | * rights to redistribute these changes. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | 30 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | |
31 | 31 | |||
32 | __KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.40 2019/08/09 08:05:57 rin Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: promcons.c,v 1.41 2020/09/03 02:09:09 thorpej Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/ioctl.h> | 36 | #include <sys/ioctl.h> | |
37 | #include <sys/select.h> | 37 | #include <sys/select.h> | |
38 | #include <sys/tty.h> | 38 | #include <sys/tty.h> | |
39 | #include <sys/proc.h> | 39 | #include <sys/proc.h> | |
40 | #include <sys/file.h> | 40 | #include <sys/file.h> | |
41 | #include <sys/uio.h> | 41 | #include <sys/uio.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/syslog.h> | 43 | #include <sys/syslog.h> | |
44 | #include <sys/types.h> | 44 | #include <sys/types.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
46 | #include <sys/conf.h> | 46 | #include <sys/conf.h> | |
47 | #include <sys/kauth.h> | 47 | #include <sys/kauth.h> | |
48 | 48 | |||
49 | #include <uvm/uvm_extern.h> | 49 | #include <uvm/uvm_extern.h> | |
50 | 50 | |||
51 | #include <machine/cpuconf.h> | 51 | #include <machine/cpuconf.h> | |
52 | #include <machine/prom.h> | 52 | #include <machine/prom.h> | |
53 | 53 | |||
54 | #ifndef CONSPEED | 54 | #ifndef CONSPEED | |
55 | #define CONSPEED 9600 | 55 | #define CONSPEED 9600 | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | 58 | #ifdef _PROM_MAY_USE_PROM_CONSOLE | |
59 | 59 | |||
60 | dev_type_open(promopen); | 60 | dev_type_open(promopen); | |
61 | dev_type_close(promclose); | 61 | dev_type_close(promclose); | |
62 | dev_type_read(promread); | 62 | dev_type_read(promread); | |
63 | dev_type_write(promwrite); | 63 | dev_type_write(promwrite); | |
64 | dev_type_ioctl(promioctl); | 64 | dev_type_ioctl(promioctl); | |
65 | dev_type_stop(promstop); | 65 | dev_type_stop(promstop); | |
66 | dev_type_tty(promtty); | 66 | dev_type_tty(promtty); | |
67 | dev_type_poll(prompoll); | 67 | dev_type_poll(prompoll); | |
68 | 68 | |||
69 | const struct cdevsw prom_cdevsw = { | 69 | const struct cdevsw prom_cdevsw = { | |
70 | .d_open = promopen, | 70 | .d_open = promopen, | |
71 | .d_close = promclose, | 71 | .d_close = promclose, | |
@@ -96,27 +96,27 @@ int | @@ -96,27 +96,27 @@ int | |||
96 | promopen(dev_t dev, int flag, int mode, struct lwp *l) | 96 | promopen(dev_t dev, int flag, int mode, struct lwp *l) | |
97 | { | 97 | { | |
98 | int unit = minor(dev); | 98 | int unit = minor(dev); | |
99 | struct tty *tp; | 99 | struct tty *tp; | |
100 | int s; | 100 | int s; | |
101 | int error = 0, setuptimeout = 0; | 101 | int error = 0, setuptimeout = 0; | |
102 | static bool callo; | 102 | static bool callo; | |
103 | 103 | |||
104 | if (!callo) { | 104 | if (!callo) { | |
105 | callout_init(&prom_ch, 0); | 105 | callout_init(&prom_ch, 0); | |
106 | callo = true; | 106 | callo = true; | |
107 | } | 107 | } | |
108 | 108 | |||
109 | if (!pmap_uses_prom_console() || unit >= 1) | 109 | if (!prom_uses_prom_console() || unit >= 1) | |
110 | return ENXIO; | 110 | return ENXIO; | |
111 | 111 | |||
112 | s = spltty(); | 112 | s = spltty(); | |
113 | 113 | |||
114 | if (!prom_tty[unit]) { | 114 | if (!prom_tty[unit]) { | |
115 | tp = prom_tty[unit] = tty_alloc(); | 115 | tp = prom_tty[unit] = tty_alloc(); | |
116 | tty_attach(tp); | 116 | tty_attach(tp); | |
117 | } else | 117 | } else | |
118 | tp = prom_tty[unit]; | 118 | tp = prom_tty[unit]; | |
119 | 119 | |||
120 | tp->t_oproc = promstart; | 120 | tp->t_oproc = promstart; | |
121 | tp->t_param = promparam; | 121 | tp->t_param = promparam; | |
122 | tp->t_dev = dev; | 122 | tp->t_dev = dev; | |
@@ -252,36 +252,36 @@ promtimeout(void *v) | @@ -252,36 +252,36 @@ promtimeout(void *v) | |||
252 | callout_reset(&prom_ch, polltime, promtimeout, tp); | 252 | callout_reset(&prom_ch, polltime, promtimeout, tp); | |
253 | } | 253 | } | |
254 | 254 | |||
255 | struct tty * | 255 | struct tty * | |
256 | promtty(dev_t dev) | 256 | promtty(dev_t dev) | |
257 | { | 257 | { | |
258 | 258 | |||
259 | if (minor(dev) != 0) | 259 | if (minor(dev) != 0) | |
260 | panic("promtty: bogus"); | 260 | panic("promtty: bogus"); | |
261 | 261 | |||
262 | return prom_tty[0]; | 262 | return prom_tty[0]; | |
263 | } | 263 | } | |
264 | 264 | |||
265 | #else /* _PMAP_MAY_USE_PROM_CONSOLE */ | 265 | #else /* _PROM_MAY_USE_PROM_CONSOLE */ | |
266 | 266 | |||
267 | /* | 267 | /* | |
268 | * If not defined _PMAP_MAY_USE_PROM_CONSOLE, | 268 | * If not defined _PROM_MAY_USE_PROM_CONSOLE, | |
269 | * this fake prom_cdevsw is attached to the kernel. | 269 | * this fake prom_cdevsw is attached to the kernel. | |
270 | * NEVER REMOVE! | 270 | * NEVER REMOVE! | |
271 | */ | 271 | */ | |
272 | const struct cdevsw prom_cdevsw = { | 272 | const struct cdevsw prom_cdevsw = { | |
273 | .d_open = noopen, | 273 | .d_open = noopen, | |
274 | .d_close = noclose, | 274 | .d_close = noclose, | |
275 | .d_read = noread, | 275 | .d_read = noread, | |
276 | .d_write = nowrite, | 276 | .d_write = nowrite, | |
277 | .d_ioctl = noioctl, | 277 | .d_ioctl = noioctl, | |
278 | .d_stop = nostop, | 278 | .d_stop = nostop, | |
279 | .d_tty = notty, | 279 | .d_tty = notty, | |
280 | .d_poll = nopoll, | 280 | .d_poll = nopoll, | |
281 | .d_mmap = nommap, | 281 | .d_mmap = nommap, | |
282 | .d_kqfilter = nokqfilter, | 282 | .d_kqfilter = nokqfilter, | |
283 | .d_discard = nodiscard, | 283 | .d_discard = nodiscard, | |
284 | .d_flag = 0 | 284 | .d_flag = 0 | |
285 | }; | 285 | }; | |
286 | 286 | |||
287 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | 287 | #endif /* _PROM_MAY_USE_PROM_CONSOLE */ |
--- src/sys/arch/alpha/include/alpha.h 2019/04/06 03:06:24 1.38
+++ src/sys/arch/alpha/include/alpha.h 2020/09/03 02:09:09 1.39
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: alpha.h,v 1.38 2019/04/06 03:06:24 thorpej Exp $ */ | 1 | /* $NetBSD: alpha.h,v 1.39 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988 University of Utah. | 4 | * Copyright (c) 1988 University of Utah. | |
5 | * Copyright (c) 1982, 1990, 1993 | 5 | * Copyright (c) 1982, 1990, 1993 | |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to Berkeley by | 8 | * This code is derived from software contributed to Berkeley by | |
9 | * the Systems Programming Group of the University of Utah Computer | 9 | * the Systems Programming Group of the University of Utah Computer | |
10 | * Science Department. | 10 | * Science Department. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -79,27 +79,27 @@ void XentInt(uint64_t, uint64_t, uint64_ | @@ -79,27 +79,27 @@ void XentInt(uint64_t, uint64_t, uint64_ | |||
79 | void XentMM(uint64_t, uint64_t, uint64_t); /* MAGIC */ | 79 | void XentMM(uint64_t, uint64_t, uint64_t); /* MAGIC */ | |
80 | void XentRestart(void); /* MAGIC */ | 80 | void XentRestart(void); /* MAGIC */ | |
81 | void XentSys(uint64_t, uint64_t, uint64_t); /* MAGIC */ | 81 | void XentSys(uint64_t, uint64_t, uint64_t); /* MAGIC */ | |
82 | void XentUna(uint64_t, uint64_t, uint64_t); /* MAGIC */ | 82 | void XentUna(uint64_t, uint64_t, uint64_t); /* MAGIC */ | |
83 | void alpha_init(u_long, u_long, u_long, u_long, u_long); | 83 | void alpha_init(u_long, u_long, u_long, u_long, u_long); | |
84 | void ast(struct trapframe *); | 84 | void ast(struct trapframe *); | |
85 | int badaddr(void *, size_t); | 85 | int badaddr(void *, size_t); | |
86 | int badaddr_read(void *, size_t, void *); | 86 | int badaddr_read(void *, size_t, void *); | |
87 | uint64_t console_restart(struct trapframe *); | 87 | uint64_t console_restart(struct trapframe *); | |
88 | void do_sir(void); | 88 | void do_sir(void); | |
89 | void exception_return(void); /* MAGIC */ | 89 | void exception_return(void); /* MAGIC */ | |
90 | void frametoreg(const struct trapframe *, struct reg *); | 90 | void frametoreg(const struct trapframe *, struct reg *); | |
91 | void init_bootstrap_console(void); | 91 | void init_bootstrap_console(void); | |
92 | void init_prom_interface(struct rpb *); | 92 | void init_prom_interface(unsigned long, struct rpb *); | |
93 | void interrupt(unsigned long, unsigned long, unsigned long, | 93 | void interrupt(unsigned long, unsigned long, unsigned long, | |
94 | struct trapframe *); | 94 | struct trapframe *); | |
95 | void machine_check(unsigned long, struct trapframe *, unsigned long, | 95 | void machine_check(unsigned long, struct trapframe *, unsigned long, | |
96 | unsigned long); | 96 | unsigned long); | |
97 | uint64_t hwrpb_checksum(void); | 97 | uint64_t hwrpb_checksum(void); | |
98 | void hwrpb_restart_setup(void); | 98 | void hwrpb_restart_setup(void); | |
99 | void regdump(struct trapframe *); | 99 | void regdump(struct trapframe *); | |
100 | void regtoframe(const struct reg *, struct trapframe *); | 100 | void regtoframe(const struct reg *, struct trapframe *); | |
101 | void savectx(struct pcb *); | 101 | void savectx(struct pcb *); | |
102 | void trap(unsigned long, unsigned long, unsigned long, unsigned long, | 102 | void trap(unsigned long, unsigned long, unsigned long, unsigned long, | |
103 | struct trapframe *); | 103 | struct trapframe *); | |
104 | void trap_init(void); | 104 | void trap_init(void); | |
105 | void enable_nsio_ide(bus_space_tag_t); | 105 | void enable_nsio_ide(bus_space_tag_t); |
--- src/sys/arch/alpha/include/pmap.h 2020/08/29 20:07:00 1.83
+++ src/sys/arch/alpha/include/pmap.h 2020/09/03 02:09:09 1.84
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.h,v 1.83 2020/08/29 20:07:00 thorpej Exp $ */ | 1 | /* $NetBSD: pmap.h,v 1.84 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center and by Chris G. Demetriou. | 9 | * NASA Ames Research Center and by Chris G. Demetriou. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -175,35 +175,26 @@ typedef struct pv_entry { | @@ -175,35 +175,26 @@ typedef struct pv_entry { | |||
175 | #define PGA_REFERENCED 0x02 /* referenced */ | 175 | #define PGA_REFERENCED 0x02 /* referenced */ | |
176 | 176 | |||
177 | /* pvh_usage */ | 177 | /* pvh_usage */ | |
178 | #define PGU_NORMAL 0 /* free or normal use */ | 178 | #define PGU_NORMAL 0 /* free or normal use */ | |
179 | #define PGU_PVENT 1 /* PV entries */ | 179 | #define PGU_PVENT 1 /* PV entries */ | |
180 | #define PGU_L1PT 2 /* level 1 page table */ | 180 | #define PGU_L1PT 2 /* level 1 page table */ | |
181 | #define PGU_L2PT 3 /* level 2 page table */ | 181 | #define PGU_L2PT 3 /* level 2 page table */ | |
182 | #define PGU_L3PT 4 /* level 3 page table */ | 182 | #define PGU_L3PT 4 /* level 3 page table */ | |
183 | 183 | |||
184 | #ifdef _KERNEL | 184 | #ifdef _KERNEL | |
185 | 185 | |||
186 | #include <sys/atomic.h> | 186 | #include <sys/atomic.h> | |
187 | 187 | |||
188 | #ifdef _KERNEL_OPT | |||
189 | #include "opt_dec_kn8ae.h" /* XXX */ | |||
190 | #if defined(DEC_KN8AE) | |||
191 | #define _PMAP_MAY_USE_PROM_CONSOLE | |||
192 | #endif | |||
193 | #else | |||
194 | #define _PMAP_MAY_USE_PROM_CONSOLE | |||
195 | #endif | |||
196 | ||||
197 | struct cpu_info; | 188 | struct cpu_info; | |
198 | struct trapframe; | 189 | struct trapframe; | |
199 | 190 | |||
200 | void pmap_init_cpu(struct cpu_info *); | 191 | void pmap_init_cpu(struct cpu_info *); | |
201 | #if defined(MULTIPROCESSOR) | 192 | #if defined(MULTIPROCESSOR) | |
202 | void pmap_tlb_shootdown_ipi(struct cpu_info *, struct trapframe *); | 193 | void pmap_tlb_shootdown_ipi(struct cpu_info *, struct trapframe *); | |
203 | #endif /* MULTIPROCESSOR */ | 194 | #endif /* MULTIPROCESSOR */ | |
204 | 195 | |||
205 | #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) | 196 | #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) | |
206 | #define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) | 197 | #define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) | |
207 | 198 | |||
208 | #define pmap_copy(dp, sp, da, l, sa) /* nothing */ | 199 | #define pmap_copy(dp, sp, da, l, sa) /* nothing */ | |
209 | #define pmap_update(pmap) /* nothing (yet) */ | 200 | #define pmap_update(pmap) /* nothing (yet) */ | |
@@ -245,29 +236,26 @@ pmap_direct_process(paddr_t pa, voff_t p | @@ -245,29 +236,26 @@ pmap_direct_process(paddr_t pa, voff_t p | |||
245 | /* | 236 | /* | |
246 | * Other hooks for the pool allocator. | 237 | * Other hooks for the pool allocator. | |
247 | */ | 238 | */ | |
248 | #define POOL_VTOPHYS(va) ALPHA_K0SEG_TO_PHYS((vaddr_t) (va)) | 239 | #define POOL_VTOPHYS(va) ALPHA_K0SEG_TO_PHYS((vaddr_t) (va)) | |
249 | 240 | |||
250 | bool pmap_pageidlezero(paddr_t); | 241 | bool pmap_pageidlezero(paddr_t); | |
251 | #define PMAP_PAGEIDLEZERO(pa) pmap_pageidlezero((pa)) | 242 | #define PMAP_PAGEIDLEZERO(pa) pmap_pageidlezero((pa)) | |
252 | 243 | |||
253 | paddr_t vtophys(vaddr_t); | 244 | paddr_t vtophys(vaddr_t); | |
254 | 245 | |||
255 | /* Machine-specific functions. */ | 246 | /* Machine-specific functions. */ | |
256 | void pmap_bootstrap(paddr_t, u_int, u_long); | 247 | void pmap_bootstrap(paddr_t, u_int, u_long); | |
257 | int pmap_emulate_reference(struct lwp *, vaddr_t, int, int); | 248 | int pmap_emulate_reference(struct lwp *, vaddr_t, int, int); | |
258 | #ifdef _PMAP_MAY_USE_PROM_CONSOLE | |||
259 | int pmap_uses_prom_console(void); | |||
260 | #endif | |||
261 | 249 | |||
262 | #define pmap_pte_pa(pte) (PG_PFNUM(*(pte)) << PGSHIFT) | 250 | #define pmap_pte_pa(pte) (PG_PFNUM(*(pte)) << PGSHIFT) | |
263 | #define pmap_pte_prot(pte) (*(pte) & PG_PROT) | 251 | #define pmap_pte_prot(pte) (*(pte) & PG_PROT) | |
264 | #define pmap_pte_w(pte) (*(pte) & PG_WIRED) | 252 | #define pmap_pte_w(pte) (*(pte) & PG_WIRED) | |
265 | #define pmap_pte_v(pte) (*(pte) & PG_V) | 253 | #define pmap_pte_v(pte) (*(pte) & PG_V) | |
266 | #define pmap_pte_pv(pte) (*(pte) & PG_PVLIST) | 254 | #define pmap_pte_pv(pte) (*(pte) & PG_PVLIST) | |
267 | #define pmap_pte_asm(pte) (*(pte) & PG_ASM) | 255 | #define pmap_pte_asm(pte) (*(pte) & PG_ASM) | |
268 | #define pmap_pte_exec(pte) (*(pte) & PG_EXEC) | 256 | #define pmap_pte_exec(pte) (*(pte) & PG_EXEC) | |
269 | 257 | |||
270 | #define pmap_pte_set_w(pte, v) \ | 258 | #define pmap_pte_set_w(pte, v) \ | |
271 | do { \ | 259 | do { \ | |
272 | if (v) \ | 260 | if (v) \ | |
273 | *(pte) |= PG_WIRED; \ | 261 | *(pte) |= PG_WIRED; \ |
--- src/sys/arch/alpha/include/prom.h 2012/02/06 02:14:13 1.14
+++ src/sys/arch/alpha/include/prom.h 2020/09/03 02:09:09 1.15
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: prom.h,v 1.14 2012/02/06 02:14:13 matt Exp $ */ | 1 | /* $NetBSD: prom.h,v 1.15 2020/09/03 02:09:09 thorpej Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | 4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Author: Keith Bostic, Chris G. Demetriou | 7 | * Author: Keith Bostic, Chris G. Demetriou | |
8 | * | 8 | * | |
9 | * Permission to use, copy, modify and distribute this software and | 9 | * Permission to use, copy, modify and distribute this software and | |
10 | * its documentation is hereby granted, provided that both the copyright | 10 | * its documentation is hereby granted, provided that both the copyright | |
11 | * notice and this permission notice appear in all copies of the | 11 | * notice and this permission notice appear in all copies of the | |
12 | * software, derivative works or modified versions, and any portions | 12 | * software, derivative works or modified versions, and any portions | |
13 | * thereof, and that both notices appear in supporting documentation. | 13 | * thereof, and that both notices appear in supporting documentation. | |
14 | * | 14 | * | |
@@ -101,24 +101,37 @@ void hwrpb_restart_setup(void); | @@ -101,24 +101,37 @@ void hwrpb_restart_setup(void); | |||
101 | prom_dispatch(PROM_R_WRITE, chan, len, (uint64_t)buf, blkno) | 101 | prom_dispatch(PROM_R_WRITE, chan, len, (uint64_t)buf, blkno) | |
102 | #define prom_ioctl(chan, op, count) \ | 102 | #define prom_ioctl(chan, op, count) \ | |
103 | prom_dispatch(PROM_R_IOCTL, chan, op, (int64_t)count, 0, 0) | 103 | prom_dispatch(PROM_R_IOCTL, chan, op, (int64_t)count, 0, 0) | |
104 | #define prom_putstr(chan, str, len) \ | 104 | #define prom_putstr(chan, str, len) \ | |
105 | prom_dispatch(PROM_R_PUTS, chan, (uint64_t)str, len, 0) | 105 | prom_dispatch(PROM_R_PUTS, chan, (uint64_t)str, len, 0) | |
106 | #define prom_getc(chan) \ | 106 | #define prom_getc(chan) \ | |
107 | prom_dispatch(PROM_R_GETC, chan, 0, 0, 0) | 107 | prom_dispatch(PROM_R_GETC, chan, 0, 0, 0) | |
108 | #define prom_getenv_disp(id, buf, len) \ | 108 | #define prom_getenv_disp(id, buf, len) \ | |
109 | prom_dispatch(PROM_R_GETENV, id, (uint64_t)buf, len, 0) | 109 | prom_dispatch(PROM_R_GETENV, id, (uint64_t)buf, len, 0) | |
110 | #endif | 110 | #endif | |
111 | 111 | |||
112 | #ifndef ASSEMBLER | 112 | #ifndef ASSEMBLER | |
113 | #ifdef _KERNEL | 113 | #ifdef _KERNEL | |
114 | ||||
115 | #ifdef _KERNEL_OPT | |||
116 | #include "opt_dec_kn8ae.h" | |||
117 | ||||
118 | #if defined(DEC_KN8AE) | |||
119 | #define _PROM_MAY_USE_PROM_CONSOLE | |||
120 | #endif /* DEC_KN8AE */ | |||
121 | #endif /* _KERNEL_OPT */ | |||
122 | ||||
123 | extern bool prom_interface_initialized; | |||
124 | ||||
125 | bool prom_uses_prom_console(void); | |||
126 | ||||
114 | void prom_enter(void); | 127 | void prom_enter(void); | |
115 | void prom_leave(void); | 128 | void prom_leave(void); | |
116 | 129 | |||
117 | void promcnputc(dev_t, int); | 130 | void promcnputc(dev_t, int); | |
118 | int promcngetc(dev_t); | 131 | int promcngetc(dev_t); | |
119 | int promcnlookc(dev_t, char *); | 132 | int promcnlookc(dev_t, char *); | |
120 | 133 | |||
121 | uint64_t prom_dispatch(uint64_t, uint64_t, uint64_t, uint64_t, | 134 | uint64_t prom_dispatch(uint64_t, uint64_t, uint64_t, uint64_t, | |
122 | uint64_t); | 135 | uint64_t); | |
123 | #endif /* _KERNEL */ | 136 | #endif /* _KERNEL */ | |
124 | #endif /* ASSEMBLER */ | 137 | #endif /* ASSEMBLER */ |