summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2008-12-20 00:33:10 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2008-12-20 00:33:10 +0000
commit3fcef6d9c20b6c3577c741e4a0fe24807fd08a66 (patch)
tree25aa78cf699f4beb5681bc0e1e056803a5395bd5 /sys/sparc64
parentf1d5ce3d64d95a7fc58c2c93fd5f97f510a8f9ba (diff)
downloadFreeBSD-src-3fcef6d9c20b6c3577c741e4a0fe24807fd08a66.zip
FreeBSD-src-3fcef6d9c20b6c3577c741e4a0fe24807fd08a66.tar.gz
Modularize the Open Firmware client interface to allow run-time switching
of OFW access semantics, in order to allow future support for real-mode OF access and flattened device frees. OF client interface modules are implemented using KOBJ, in a similar way to the PPC PMAP modules. Because we need Open Firmware to be available before mutexes can be used on sparc64, changes are also included to allow KOBJ to be used very early in the boot process by only using the mutex once we know it has been initialized. Reviewed by: marius, grehan
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/ofw_machdep.h7
-rw-r--r--sys/sparc64/sparc64/machdep.c21
-rw-r--r--sys/sparc64/sparc64/mp_machdep.c4
-rw-r--r--sys/sparc64/sparc64/support.S12
-rw-r--r--sys/sparc64/sparc64/trap.c3
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c2
6 files changed, 27 insertions, 22 deletions
diff --git a/sys/sparc64/include/ofw_machdep.h b/sys/sparc64/include/ofw_machdep.h
index ac1fcc1..625b131 100644
--- a/sys/sparc64/include/ofw_machdep.h
+++ b/sys/sparc64/include/ofw_machdep.h
@@ -29,10 +29,15 @@
#define _MACHINE_OFW_MACHDEP_H_
#include <sys/bus.h>
+#include <machine/bus.h>
+#include <dev/ofw/openfirm.h>
+
+typedef uint64_t cell_t;
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
void cpu_shutdown(void *);
-void openfirmware_exit(void *);
+int ofw_entry(void *);
+void ofw_exit(void *);
#endif /* _MACHINE_OFW_MACHDEP_H_ */
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 0be9af9..4e1e300 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -276,9 +276,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
tick_stop();
/*
- * Initialize Open Firmware (needed for console).
+ * Set up Open Firmware entry points
*/
- OF_init(vec);
+ ofw_tba = rdpr(tba);
+ ofw_vec = (u_long)vec;
/*
* Parse metadata if present and fetch parameters. Must be before the
@@ -301,6 +302,12 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
init_param1();
/*
+ * Initialize Open Firmware (needed for console).
+ */
+ OF_install(OFW_STD_DIRECT, 0);
+ OF_init(ofw_entry);
+
+ /*
* Prime our per-CPU data page for use. Note, we are using it for
* our stack, so don't pass the real size (PAGE_SIZE) to pcpu_init
* or it'll zero it out from under us.
@@ -481,14 +488,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
}
void
-set_openfirm_callback(ofw_vec_t *vec)
-{
-
- ofw_tba = rdpr(tba);
- ofw_vec = (u_long)vec;
-}
-
-void
sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
{
struct trapframe *tf;
@@ -725,7 +724,7 @@ cpu_shutdown(void *args)
#ifdef SMP
cpu_mp_shutdown();
#endif
- openfirmware_exit(args);
+ ofw_exit(args);
}
/* Get current clock frequency for the given CPU ID. */
diff --git a/sys/sparc64/sparc64/mp_machdep.c b/sys/sparc64/sparc64/mp_machdep.c
index 5cace48..bf79adf 100644
--- a/sys/sparc64/sparc64/mp_machdep.c
+++ b/sys/sparc64/sparc64/mp_machdep.c
@@ -221,7 +221,7 @@ sun4u_startcpu(phandle_t cpu, void *func, u_long arg)
args.cpu = cpu;
args.func = (cell_t)func;
args.arg = (cell_t)arg;
- openfirmware(&args);
+ ofw_entry(&args);
}
/*
@@ -238,7 +238,7 @@ sun4u_stopself(void)
(cell_t)SUNW_STOPSELF,
};
- openfirmware_exit(&args);
+ ofw_exit(&args);
panic("%s: failed.", __func__);
}
diff --git a/sys/sparc64/sparc64/support.S b/sys/sparc64/sparc64/support.S
index a3f6501..821e694 100644
--- a/sys/sparc64/sparc64/support.S
+++ b/sys/sparc64/sparc64/support.S
@@ -745,9 +745,9 @@ ENTRY(setjmp)
END(setjmp)
/*
- * void openfirmware(cell_t args[])
+ * void ofw_entry(cell_t args[])
*/
-ENTRY(openfirmware)
+ENTRY(ofw_entry)
save %sp, -CCFSZ, %sp
SET(ofw_vec, %l7, %l6)
ldx [%l6], %l6
@@ -758,12 +758,12 @@ ENTRY(openfirmware)
wrpr %l7, 0, %pil
ret
restore %o0, %g0, %o0
-END(openfirmware)
+END(ofw_entry)
/*
- * void openfirmware_exit(cell_t args[])
+ * void ofw_exit(cell_t args[])
*/
-ENTRY(openfirmware_exit)
+ENTRY(ofw_exit)
save %sp, -CCFSZ, %sp
flushw
wrpr %g0, PIL_TICK, %pil
@@ -783,7 +783,7 @@ ENTRY(openfirmware_exit)
call %l6
mov %i0, %o0
! never to return
-END(openfirmware_exit)
+END(ofw_exit)
#ifdef GPROF
diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c
index 9de8e26..c10dbc4 100644
--- a/sys/sparc64/sparc64/trap.c
+++ b/sys/sparc64/sparc64/trap.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include <security/audit/audit.h>
#include <dev/ofw/openfirm.h>
+#include <machine/ofw_machdep.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -248,7 +249,7 @@ sun4u_set_traptable(void *tba_addr)
};
args.tba_addr = (cell_t)tba_addr;
- openfirmware(&args);
+ ofw_entry(&args);
}
void
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index c163fd8..b769753 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -334,7 +334,7 @@ cpu_reset(void)
bspec[sizeof(bspec) - 1] = '\0';
}
- openfirmware_exit(&args);
+ ofw_exit(&args);
}
/*
OpenPOWER on IntegriCloud