summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2008-09-04 20:52:54 +0000
committermarius <marius@FreeBSD.org>2008-09-04 20:52:54 +0000
commit4f69477c32bf9f7797910367d4f1ced088c71297 (patch)
treeee6a09d4b005629bade261a278c2b2934ce62aab /sys/sparc64
parent2508db45354b244cdaf47becd55bd73f57ba38fc (diff)
downloadFreeBSD-src-4f69477c32bf9f7797910367d4f1ced088c71297.zip
FreeBSD-src-4f69477c32bf9f7797910367d4f1ced088c71297.tar.gz
Use the PROM provided SUNW,set-trap-table to take over the trap
table. This is required in order to set obp-control-relinquished within the PROM, allowing to safely read the OFW translations node. Without this, f.e. a `ofwdump -ap` triggers a fatal reset error or worse things on machines based on USIII and beyond. In theory this should allow to remove touching %tba in cpu_setregs(), in practice we seem to currently face a chicken and egg problem when doing so however.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/trap.h1
-rw-r--r--sys/sparc64/sparc64/machdep.c10
-rw-r--r--sys/sparc64/sparc64/trap.c24
3 files changed, 35 insertions, 0 deletions
diff --git a/sys/sparc64/include/trap.h b/sys/sparc64/include/trap.h
index e4adc78..f73340c 100644
--- a/sys/sparc64/include/trap.h
+++ b/sys/sparc64/include/trap.h
@@ -90,6 +90,7 @@
#define T_KERNEL 64
#ifndef LOCORE
+void sun4u_set_traptable(void *tba_addr);
extern const char *trap_msg[];
#endif
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index fa173cb..cd3194b 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -437,6 +437,16 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
cpu_setregs(pc);
/*
+ * Take over the trap table via the PROM. Using the PROM for this
+ * is necessary in order to set obp-control-relinquished to true
+ * within the PROM so obtaining /virtual-memory/translations doesn't
+ * trigger a fatal reset error or worse things further down the road.
+ * XXX it should be possible to use this soley instead of writing
+ * %tba in cpu_setregs(). Doing so causes a hang however.
+ */
+ sun4u_set_traptable(tl0_base);
+
+ /*
* It's now safe to use the real DELAY().
*/
delay_func = delay_tick;
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index c1a81cd..9de8e26 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$");
#endif
#include <security/audit/audit.h>
+#include <dev/ofw/openfirm.h>
+
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
@@ -227,6 +229,28 @@ int debugger_on_signal = 0;
SYSCTL_INT(_debug, OID_AUTO, debugger_on_signal, CTLFLAG_RW,
&debugger_on_signal, 0, "");
+/*
+ * SUNW,set-trap-table allows to take over %tba from the PROM, which
+ * will turn off interrupts and handle outstanding ones while doing so,
+ * in a safe way.
+ */
+void
+sun4u_set_traptable(void *tba_addr)
+{
+ static struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t tba_addr;
+ } args = {
+ (cell_t)"SUNW,set-trap-table",
+ 2,
+ };
+
+ args.tba_addr = (cell_t)tba_addr;
+ openfirmware(&args);
+}
+
void
trap(struct trapframe *tf)
{
OpenPOWER on IntegriCloud