| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $ */ | | 1 | /* $NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 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,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
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.51 2020/02/21 13:33:07 skrll Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 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 |
| @@ -73,34 +73,40 @@ prom_lev1map(void) | | | @@ -73,34 +73,40 @@ prom_lev1map(void) |
73 | | | 73 | |
74 | /* | | 74 | /* |
75 | * Find the level 1 map that we're currently running on. | | 75 | * Find the level 1 map that we're currently running on. |
76 | */ | | 76 | */ |
77 | apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb); | | 77 | apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb); |
78 | | | 78 | |
79 | return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT)); | | 79 | return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT)); |
80 | } | | 80 | } |
81 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ | | 81 | #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ |
82 | | | 82 | |
83 | void | | 83 | void |
84 | init_prom_interface(struct rpb *rpb) | | 84 | init_prom_interface(struct rpb *rpb) |
85 | { | | 85 | { |
| | | 86 | static bool prom_interface_initialized; |
| | | 87 | |
| | | 88 | if (prom_interface_initialized) |
| | | 89 | return; |
| | | 90 | |
86 | struct crb *c; | | 91 | struct crb *c; |
87 | | | 92 | |
88 | c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); | | 93 | c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); |
89 | | | 94 | |
90 | prom_dispatch_v.routine_arg = c->crb_v_dispatch; | | 95 | prom_dispatch_v.routine_arg = c->crb_v_dispatch; |
91 | prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; | | 96 | prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; |
92 | | | 97 | |
93 | mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH); | | 98 | mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH); |
| | | 99 | prom_interface_initialized = true; |
94 | } | | 100 | } |
95 | | | 101 | |
96 | void | | 102 | void |
97 | init_bootstrap_console(void) | | 103 | init_bootstrap_console(void) |
98 | { | | 104 | { |
99 | char buf[4]; | | 105 | char buf[4]; |
100 | | | 106 | |
101 | init_prom_interface(hwrpb); | | 107 | init_prom_interface(hwrpb); |
102 | | | 108 | |
103 | prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf)); | | 109 | prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf)); |
104 | alpha_console = buf[0] - '0'; | | 110 | alpha_console = buf[0] - '0'; |
105 | | | 111 | |
106 | /* XXX fake out the console routines, for now */ | | 112 | /* XXX fake out the console routines, for now */ |