Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha Make sure init_prom_interface() only ru...



details:   https://anonhg.NetBSD.org/src/rev/bb616d892eae
branches:  trunk
changeset: 975482:bb616d892eae
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Aug 29 15:16:12 2020 +0000

description:
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.

diffstat:

 sys/arch/alpha/alpha/prom.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 7ebd1821041f -r bb616d892eae sys/arch/alpha/alpha/prom.c
--- a/sys/arch/alpha/alpha/prom.c       Sat Aug 29 15:06:33 2020 +0000
+++ b/sys/arch/alpha/alpha/prom.c       Sat Aug 29 15:16:12 2020 +0000
@@ -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 @@
 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 @@
        prom_dispatch_v.routine = c->crb_v_dispatch->entry_va;
 
        mutex_init(&prom_lock, MUTEX_DEFAULT, IPL_HIGH);
+       prom_interface_initialized = true;
 }
 
 void



Home | Main Index | Thread Index | Old Index