Module Name: src
Committed By: thorpej
Date: Sat Aug 29 15:16:12 UTC 2020
Modified Files:
src/sys/arch/alpha/alpha: prom.c
Log Message:
Make sure init_prom_interface() only runs once, otherwise we initialize
a mutex twice, and that upsets LOCKDEBUG. But instead of seeing a
proper message about it, the output happens before the PROM console
interfcace is initialized, we would end up with a translation fault
back into SRM.
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/alpha/alpha/prom.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/alpha/alpha/prom.c
diff -u src/sys/arch/alpha/alpha/prom.c:1.51 src/sys/arch/alpha/alpha/prom.c:1.52
--- src/sys/arch/alpha/alpha/prom.c:1.51 Fri Feb 21 13:33:07 2020
+++ src/sys/arch/alpha/alpha/prom.c Sat Aug 29 15:16:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $ */
+/* $NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $ */
/*
* Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@@ -27,7 +27,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $");
#include "opt_multiprocessor.h"
@@ -83,6 +83,11 @@ prom_lev1map(void)
void
init_prom_interface(struct rpb *rpb)
{
+ static bool prom_interface_initialized;
+
+ if (prom_interface_initialized)
+ return;
+
struct crb *c;
c = (struct crb *)((char *)rpb + rpb->rpb_crb_off);
@@ -91,6 +96,7 @@ init_prom_interface(struct rpb *rpb)
prom_dispatch_v.routine = c->crb_v_dispatch->entry_va;
mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH);
+ prom_interface_initialized = true;
}
void