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.
This commit is contained in:
tsutsui 2018-09-30 06:14:23 +00:00
parent 4dc5649f1c
commit a7be3f0dea
4 changed files with 42 additions and 6 deletions

View File

@ -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. * Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #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 #define __INTR_PRIVATE
@ -99,6 +99,7 @@ apbusattach(device_t parent, device_t self, void *aux)
struct newsmips_intr *ip; struct newsmips_intr *ip;
int i; int i;
apbus_map_romwork();
mips_set_wbflush(apbus_wbflush); mips_set_wbflush(apbus_wbflush);
*(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0xffffffff; *(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0xffffffff;

View File

@ -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. * Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@ -27,15 +27,47 @@
*/ */
#include <sys/cdefs.h> #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/param.h>
#include <sys/systm.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> #include <newsmips/apbus/apbusvar.h>
static void apctl_dump(struct apbus_ctl *); 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 * void *
apbus_device_to_hwaddr(struct apbus_dev *apbus_dev) apbus_device_to_hwaddr(struct apbus_dev *apbus_dev)
{ {

View File

@ -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. * Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
@ -39,6 +39,7 @@ struct apbus_attach_args {
u_long apa_hwbase; /* hardware I/O address */ u_long apa_hwbase; /* hardware I/O address */
}; };
void apbus_map_romwork(void);
void *apbus_device_to_hwaddr(struct apbus_dev *); void *apbus_device_to_hwaddr(struct apbus_dev *);
struct apbus_dev *apbus_lookupdev(char *); struct apbus_dev *apbus_lookupdev(char *);
void apdevice_dump(struct apbus_dev *); void apdevice_dump(struct apbus_dev *);

View File

@ -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 machine newsmips mips
include "conf/std" # MI standard options include "conf/std" # MI standard options
@ -7,5 +7,7 @@ makeoptions MACHINE_ARCH="mipseb"
options EXEC_ELF32 # exec ELF32 binaries options EXEC_ELF32 # exec ELF32 binaries
options EXEC_SCRIPT # exec #! scripts options EXEC_SCRIPT # exec #! scripts
options ENABLE_MIPS3_WIRED_MAP
makeoptions DEFTEXTADDR="0x80001000" makeoptions DEFTEXTADDR="0x80001000"
makeoptions LINKFORMAT="-N" makeoptions LINKFORMAT="-N"