Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 sun4v: trap table setup - currently populat...
details: https://anonhg.NetBSD.org/src/rev/2b3f9233cc20
branches: trunk
changeset: 325821:2b3f9233cc20
user: palle <palle%NetBSD.org@localhost>
date: Tue Jan 07 20:11:35 2014 +0000
description:
sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
diffstat:
sys/arch/sparc64/include/cpu.h | 8 +++++-
sys/arch/sparc64/include/sparc64.h | 7 +++-
sys/arch/sparc64/sparc64/cpu.c | 8 ++++-
sys/arch/sparc64/sparc64/genassym.cf | 5 +++-
sys/arch/sparc64/sparc64/locore.s | 44 +++++++++++++++++++++++++++++++--
sys/arch/sparc64/sparc64/ofw_machdep.c | 32 +++++++++++++++++++++---
sys/arch/sparc64/sparc64/pmap.c | 11 ++++---
7 files changed, 97 insertions(+), 18 deletions(-)
diffs (266 lines):
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/include/cpu.h Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.106 2013/12/16 20:17:35 palle Exp $ */
+/* $NetBSD: cpu.h,v 1.107 2014/01/07 20:11:35 palle Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -174,6 +174,12 @@
pte_t *ci_tsb_dmmu;
pte_t *ci_tsb_immu;
+#ifdef SUN4V
+ /* MMU Fault Status Area. Will be initialized to the physical
+ address of the bottom of the interrupt stack */
+ paddr_t ci_mmfsa;
+#endif
+
/* probe fault in PCI config space reads */
bool ci_pci_probe;
bool ci_pci_fault;
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/include/sparc64.h
--- a/sys/arch/sparc64/include/sparc64.h Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/include/sparc64.h Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sparc64.h,v 1.11 2010/02/20 16:46:38 martin Exp $ */
+/* $NetBSD: sparc64.h,v 1.12 2014/01/07 20:11:35 palle Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -38,7 +38,10 @@
uint64_t size;
};
-int prom_set_trap_table(vaddr_t);
+int prom_set_trap_table_sun4u(vaddr_t);
+#ifdef SUN4V
+int prom_set_trap_table_sun4v(vaddr_t, paddr_t);
+#endif
paddr_t prom_vtop(vaddr_t);
vaddr_t prom_claim_virt(vaddr_t, int);
vaddr_t prom_alloc_virt(int, int);
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.106 2013/12/16 20:17:35 palle Exp $ */
+/* $NetBSD: cpu.c,v 1.107 2014/01/07 20:11:35 palle Exp $ */
/*
* Copyright (c) 1996
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2013/12/16 20:17:35 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2014/01/07 20:11:35 palle Exp $");
#include "opt_multiprocessor.h"
@@ -179,6 +179,10 @@
cpi->ci_spinup = NULL;
cpi->ci_paddr = pa0;
cpi->ci_self = cpi;
+#ifdef SUN4V
+ if ( CPU_ISSUN4V )
+ cpi->ci_mmfsa = pa0;
+#endif
cpi->ci_node = cpu_node;
cpi->ci_idepth = -1;
memset(cpi->ci_intrpending, -1, sizeof(cpi->ci_intrpending));
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/sparc64/genassym.cf
--- a/sys/arch/sparc64/sparc64/genassym.cf Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/sparc64/genassym.cf Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.68 2013/12/28 11:12:09 nakayama Exp $
+# $NetBSD: genassym.cf,v 1.69 2014/01/07 20:11:35 palle Exp $
#
# Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -163,6 +163,9 @@
define CI_CTXBUSY offsetof(struct cpu_info, ci_ctxbusy)
define CI_TSB_DMMU offsetof(struct cpu_info, ci_tsb_dmmu)
define CI_TSB_IMMU offsetof(struct cpu_info, ci_tsb_immu)
+#ifdef SUN4V
+define CI_MMFSA offsetof(struct cpu_info, ci_mmfsa)
+#endif
ifdef MULTIPROCESSOR
define CI_IPIEVC offsetof(struct cpu_info, ci_ipi_evcnt[0].ev_count)
endif
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.352 2013/12/29 12:36:30 nakayama Exp $ */
+/* $NetBSD: locore.s,v 1.353 2014/01/07 20:11:35 palle Exp $ */
/*
* Copyright (c) 2006-2010 Matthew R. Green
@@ -864,6 +864,27 @@
UTRAP(0x1f0); UTRAP(0x1f1); UTRAP(0x1f2); UTRAP(0x1f3); UTRAP(0x1f4); UTRAP(0x1f5); UTRAP(0x1f6); UTRAP(0x1f7)
UTRAP(0x1f8); UTRAP(0x1f9); UTRAP(0x1fa); UTRAP(0x1fb); UTRAP(0x1fc); UTRAP(0x1fd); UTRAP(0x1fe); UTRAP(0x1ff)
+#ifdef SUN4V
+
+/* Macros for sun4v traps */
+
+ .macro sun4v_trap_entry count
+ .rept \count
+ ba,a,pt %xcc, slowtrap
+ nop
+ .align 32
+ .endr
+ .endm
+
+/* The actual trap base for sun4v */
+ .align 0x8000
+ .globl _C_LABEL(trapbase_sun4v)
+_C_LABEL(trapbase_sun4v):
+ sun4v_trap_entry 512 ! trap level 0: 0x000-0x1ff
+ sun4v_trap_entry 512 ! trap level 1: 0x000-0x1ff
+
+#endif
+
#if 0
/*
* If the cleanwin trap handler detects an overfow we come here.
@@ -4179,9 +4200,26 @@
1:
/* set trap table */
+#ifdef SUN4V
+ cmp %l6, CPU_SUN4V
+ bne,pt %icc, 6f
+ nop
+ /* sun4v */
+ set _C_LABEL(trapbase_sun4v), %o0
+ sethi %hi(CPUINFO_VA + CI_MMFSA), %o1
+ ldx [%o1 + %lo(CPUINFO_VA + CI_MMFSA)], %o1
+ call _C_LABEL(prom_set_trap_table_sun4v) ! Now we should be running 100% from our handlers
+ nop
+
+ ba 7f
+ nop
+6:
+#endif
+ /* sun4u */
set _C_LABEL(trapbase), %l1
- call _C_LABEL(prom_set_trap_table) ! Now we should be running 100% from our handlers
+ call _C_LABEL(prom_set_trap_table_sun4u) ! Now we should be running 100% from our handlers
mov %l1, %o0
+7:
wrpr %l1, 0, %tba ! Make sure the PROM didn't foul up.
/*
@@ -4324,7 +4362,7 @@
/* set trap table */
set _C_LABEL(trapbase), %l1
- call _C_LABEL(prom_set_trap_table)
+ call _C_LABEL(prom_set_trap_table_sun4u)
mov %l1, %o0
wrpr %l1, 0, %tba ! Make sure the PROM didn't
! foul up.
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/sparc64/ofw_machdep.c
--- a/sys/arch/sparc64/sparc64/ofw_machdep.c Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/sparc64/ofw_machdep.c Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_machdep.c,v 1.40 2013/07/09 20:32:11 martin Exp $ */
+/* $NetBSD: ofw_machdep.c,v 1.41 2014/01/07 20:11:35 palle Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.40 2013/07/09 20:32:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.41 2014/01/07 20:11:35 palle Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -95,10 +95,10 @@
/*
- * Point prom to our trap table. This stops the prom from mapping us.
+ * Point prom to our sun4u trap table. This stops the prom from mapping us.
*/
int
-prom_set_trap_table(vaddr_t tba)
+prom_set_trap_table_sun4u(vaddr_t tba)
{
struct {
cell_t name;
@@ -114,6 +114,30 @@
return openfirmware(&args);
}
+#ifdef SUN4V
+/*
+ * Point prom to our sun4v trap table. This stops the prom from mapping us.
+ */
+int
+prom_set_trap_table_sun4v(vaddr_t tba, paddr_t mmfsa)
+{
+ struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t tba;
+ cell_t mmfsa;
+ } args;
+
+ args.name = ADR2CELL("SUNW,set-trap-table");
+ args.nargs = 2;
+ args.nreturns = 0;
+ args.tba = ADR2CELL(tba);
+ args.mmfsa = ADR2CELL(mmfsa);
+ return openfirmware(&args);
+}
+#endif
+
/*
* Have the prom convert from virtual to physical addresses.
*
diff -r 704483ce281e -r 2b3f9233cc20 sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Tue Jan 07 16:47:13 2014 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Tue Jan 07 20:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.284 2013/12/28 11:08:56 nakayama Exp $ */
+/* $NetBSD: pmap.c,v 1.285 2014/01/07 20:11:35 palle Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.284 2013/12/28 11:08:56 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.285 2014/01/07 20:11:35 palle Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -1157,6 +1157,10 @@
cpus->ci_eintstack = NULL;
cpus->ci_spinup = main; /* Call main when we're running. */
cpus->ci_paddr = cpu0paddr;
+#ifdef SUN4V
+ if ( CPU_ISSUN4V )
+ cpus->ci_mmfsa = cpu0paddr;
+#endif
cpus->ci_cpcb = (struct pcb *)u0va;
cpus->ci_idepth = -1;
memset(cpus->ci_intrpending, -1, sizeof(cpus->ci_intrpending));
@@ -3802,9 +3806,6 @@
panic("hv_mmu_map_perm_addr() failed - rc = %" PRId64 "\n",
hv_rc);
}
- else {
- memset((void *)INTSTACK, 0, 64 * KB);
- }
}
void
Home |
Main Index |
Thread Index |
Old Index