From 3fcef6d9c20b6c3577c741e4a0fe24807fd08a66 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Sat, 20 Dec 2008 00:33:10 +0000 Subject: 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 --- sys/sun4v/sun4v/machdep.c | 25 ++++++++++++------------- sys/sun4v/sun4v/mp_machdep.c | 2 +- sys/sun4v/sun4v/support.S | 10 +++++----- sys/sun4v/sun4v/trap.c | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) (limited to 'sys/sun4v') diff --git a/sys/sun4v/sun4v/machdep.c b/sys/sun4v/sun4v/machdep.c index 6281f00..b7c0869 100644 --- a/sys/sun4v/sun4v/machdep.c +++ b/sys/sun4v/sun4v/machdep.c @@ -310,18 +310,18 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) end = 0; kmdp = NULL; - /* - * Initialize Open Firmware (needed for console). - */ - OF_init(vec); - - /* * XXX */ bootverbose = 1; /* + * Set up Open Firmware entry points + */ + ofw_tba = rdpr(tba); + ofw_vec = (u_long)vec; + + /* * Parse metadata if present and fetch parameters. Must be before the * console is inited so cninit gets the right value of boothowto. */ @@ -344,6 +344,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); + root = OF_peer(0); for (child = OF_child(root); child != 0; child = OF_peer(child)) { OF_getprop(child, "device_type", type, sizeof(type)); @@ -516,13 +522,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; diff --git a/sys/sun4v/sun4v/mp_machdep.c b/sys/sun4v/sun4v/mp_machdep.c index 8bd4ba6..5f4f632 100644 --- a/sys/sun4v/sun4v/mp_machdep.c +++ b/sys/sun4v/sun4v/mp_machdep.c @@ -272,7 +272,7 @@ start_ap_bycpuid(int cpuid, void *func, u_long arg) args.cpuid = cpuid; args.func = (cell_t)func; args.arg = (cell_t)arg; - openfirmware(&args); + ofw_entry(&args); return (int)args.result; } diff --git a/sys/sun4v/sun4v/support.S b/sys/sun4v/sun4v/support.S index e6bac5d..699a40f 100644 --- a/sys/sun4v/sun4v/support.S +++ b/sys/sun4v/sun4v/support.S @@ -622,9 +622,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 @@ -635,14 +635,14 @@ ENTRY(openfirmware) wrpr %l7, 0, %pil ret restore %o0, %g0, %o0 -END(openfirmware) +END(ofw_entry) #ifdef notyet /* SUN4V_FIXME - uses a now illegal ASI */ /* * void ofw_exit(cell_t args[]) */ -ENTRY(openfirmware_exit) +ENTRY(ofw_exit) save %sp, -CCFSZ, %sp flushw wrpr %g0, PIL_TICK, %pil @@ -661,7 +661,7 @@ ENTRY(openfirmware_exit) call %l6 mov %i0, %o0 ! never to return -END(openfirmware_exit) +END(ofw_exit) #endif ENTRY(set_mmfsa_scratchpad) diff --git a/sys/sun4v/sun4v/trap.c b/sys/sun4v/sun4v/trap.c index f04c424..bac4f55 100644 --- a/sys/sun4v/sun4v/trap.c +++ b/sys/sun4v/sun4v/trap.c @@ -261,7 +261,7 @@ set_mmfsa_traptable(void *tba_addr, uint64_t mmfsa_ra) args.tba_addr = (cell_t)tba_addr; args.mmfsa_ra = mmfsa_ra; - openfirmware(&args); + ofw_entry(&args); } void -- cgit v1.1