Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/newsmips Fix news5000 panic during boot on APbus at...



details:   https://anonhg.NetBSD.org/src/rev/1d85cc37cf20
branches:  trunk
changeset: 433732:1d85cc37cf20
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Sep 30 06:14:23 2018 +0000

description:
Fix news5000 panic during boot on APbus attach. PR port-newsmips/53626

Discussed with ryo@ (the original author of news5000 support).
Should be pulled up to netbsd-8.

diffstat:

 sys/arch/newsmips/apbus/apbus.c      |   5 +++--
 sys/arch/newsmips/apbus/apbus_subr.c |  36 ++++++++++++++++++++++++++++++++++--
 sys/arch/newsmips/apbus/apbusvar.h   |   3 ++-
 sys/arch/newsmips/conf/std.newsmips  |   4 +++-
 4 files changed, 42 insertions(+), 6 deletions(-)

diffs (118 lines):

diff -r 4f49b88803d2 -r 1d85cc37cf20 sys/arch/newsmips/apbus/apbus.c
--- a/sys/arch/newsmips/apbus/apbus.c   Sun Sep 30 01:57:41 2018 +0000
+++ b/sys/arch/newsmips/apbus/apbus.c   Sun Sep 30 06:14:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $  */
+/*     $NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $       */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.22 2011/02/20 07:56:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $");
 
 #define __INTR_PRIVATE
 
@@ -99,6 +99,7 @@
        struct newsmips_intr *ip;
        int i;
 
+       apbus_map_romwork();
        mips_set_wbflush(apbus_wbflush);
 
        *(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0xffffffff;
diff -r 4f49b88803d2 -r 1d85cc37cf20 sys/arch/newsmips/apbus/apbus_subr.c
--- a/sys/arch/newsmips/apbus/apbus_subr.c      Sun Sep 30 01:57:41 2018 +0000
+++ b/sys/arch/newsmips/apbus/apbus_subr.c      Sun Sep 30 06:14:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbus_subr.c,v 1.9 2014/03/24 20:05:20 christos Exp $  */
+/*     $NetBSD: apbus_subr.c,v 1.10 2018/09/30 06:14:23 tsutsui Exp $  */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,15 +27,47 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.9 2014/03/24 20:05:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.10 2018/09/30 06:14:23 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 
+#include <uvm/uvm_extern.h>
+
+#include <mips/locore.h>
+#include <mips/pte.h>
+
+#include <machine/wired_map.h>
+
 #include <newsmips/apbus/apbusvar.h>
 
 static void apctl_dump(struct apbus_ctl *);
 
+#define        APBUS_ROMWORK_VA        0xfff00000
+
+void
+apbus_map_romwork(void)
+{
+       static bool mapped = false;
+       vaddr_t apbd_work_va;
+       vsize_t apbd_work_sz;
+       paddr_t apbd_work_pa;
+
+       if (!mapped) {
+               /* map PROM work RAM into VA 0xFFF00000 - 0xFFFFFFFF */
+               apbd_work_va = APBUS_ROMWORK_VA;
+               apbd_work_sz = MIPS3_PG_SIZE_MASK_TO_SIZE(MIPS3_PG_SIZE_1M);
+               apbd_work_pa = ctob(physmem);
+
+               mapped = mips3_wired_enter_page(apbd_work_va, apbd_work_pa,
+                   apbd_work_sz);
+               if (!mapped) {
+                       printf("%s: cannot allocate APbus PROM work\n",
+                           __func__);
+               }
+       }
+}
+
 void *
 apbus_device_to_hwaddr(struct apbus_dev *apbus_dev)
 {
diff -r 4f49b88803d2 -r 1d85cc37cf20 sys/arch/newsmips/apbus/apbusvar.h
--- a/sys/arch/newsmips/apbus/apbusvar.h        Sun Sep 30 01:57:41 2018 +0000
+++ b/sys/arch/newsmips/apbus/apbusvar.h        Sun Sep 30 06:14:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbusvar.h,v 1.9 2007/10/17 19:55:54 garbled Exp $     */
+/*     $NetBSD: apbusvar.h,v 1.10 2018/09/30 06:14:23 tsutsui Exp $    */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -39,6 +39,7 @@
        u_long  apa_hwbase;     /* hardware I/O address */
 };
 
+void apbus_map_romwork(void);
 void *apbus_device_to_hwaddr(struct apbus_dev *);
 struct apbus_dev *apbus_lookupdev(char *);
 void apdevice_dump(struct apbus_dev *);
diff -r 4f49b88803d2 -r 1d85cc37cf20 sys/arch/newsmips/conf/std.newsmips
--- a/sys/arch/newsmips/conf/std.newsmips       Sun Sep 30 01:57:41 2018 +0000
+++ b/sys/arch/newsmips/conf/std.newsmips       Sun Sep 30 06:14:23 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.newsmips,v 1.17 2005/12/11 12:18:24 christos Exp $
+#      $NetBSD: std.newsmips,v 1.18 2018/09/30 06:14:23 tsutsui Exp $
 
 machine newsmips mips
 include                "conf/std"      # MI standard options
@@ -7,5 +7,7 @@
 options        EXEC_ELF32      # exec ELF32 binaries
 options        EXEC_SCRIPT     # exec #! scripts
 
+options        ENABLE_MIPS3_WIRED_MAP
+
 makeoptions    DEFTEXTADDR="0x80001000"
 makeoptions    LINKFORMAT="-N"



Home | Main Index | Thread Index | Old Index