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 When initializing the PROM interface, c...



details:   https://anonhg.NetBSD.org/src/rev/c3eba93afc9e
branches:  trunk
changeset: 938010:c3eba93afc9e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Aug 30 16:26:56 2020 +0000

description:
When initializing the PROM interface, check to see if we're running
inside Qemu by consulting the system serial number, and quickly abort
calls into the PROM if we are.

This is a temporary measure until I can figure out why calling into
the Qemu PROM interface blows up.

diffstat:

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

diffs (100 lines):

diff -r 404370949877 -r c3eba93afc9e sys/arch/alpha/alpha/prom.c
--- a/sys/arch/alpha/alpha/prom.c       Sun Aug 30 16:10:40 2020 +0000
+++ b/sys/arch/alpha/alpha/prom.c       Sun Aug 30 16:26:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $ */
+/* $NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 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.52 2020/08/29 15:16:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -59,6 +59,8 @@
 
 extern struct prom_vec prom_dispatch_v;
 
+static int     prom_is_qemu;           /* XXX */
+
 static kmutex_t        prom_lock;
 
 #ifdef _PMAP_MAY_USE_PROM_CONSOLE
@@ -80,6 +82,19 @@
 }
 #endif /* _PMAP_MAY_USE_PROM_CONSOLE */
 
+static void
+prom_check_qemu(const struct rpb * const rpb)
+{
+       if (!prom_is_qemu) {
+               if (rpb->rpb_ssn[0] == 'Q' &&
+                   rpb->rpb_ssn[1] == 'E' &&
+                   rpb->rpb_ssn[2] == 'M' &&
+                   rpb->rpb_ssn[3] == 'U') {
+                       prom_is_qemu = 1;
+               }
+       }
+}
+
 void
 init_prom_interface(struct rpb *rpb)
 {
@@ -90,6 +105,8 @@
 
        struct crb *c;
 
+       prom_check_qemu(rpb);
+
        c = (struct crb *)((char *)rpb + rpb->rpb_crb_off);
 
        prom_dispatch_v.routine_arg = c->crb_v_dispatch;
@@ -192,6 +209,10 @@
        prom_return_t ret;
        unsigned char *to = (unsigned char *)0x20000000;
 
+       /* XXX */
+       if (prom_is_qemu)
+               return;
+
        prom_enter();
        *to = c;
 
@@ -212,6 +233,10 @@
 {
        prom_return_t ret;
 
+       /* XXX */
+       if (prom_is_qemu)
+               return 0;
+
        for (;;) {
                prom_enter();
                ret.bits = prom_getc(alpha_console);
@@ -231,6 +256,10 @@
 {
        prom_return_t ret;
 
+       /* XXX */
+       if (prom_is_qemu)
+               return 0;
+
        prom_enter();
        ret.bits = prom_getc(alpha_console);
        prom_leave();
@@ -247,6 +276,10 @@
        unsigned char *to = (unsigned char *)0x20000000;
        prom_return_t ret;
 
+       /* XXX */
+       if (prom_is_qemu)
+               return 0;
+
        prom_enter();
        ret.bits = prom_getenv_disp(id, to, len);
        if (ret.u.status & 0x4)



Home | Main Index | Thread Index | Old Index