[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Wed Feb 1 10:56:18 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/b584ac3f214f
changeset: 302:b584ac3f214f
user: ray at terran.dlink.ua
date: Wed Feb 01 11:29:19 2012 +0200
description:
Update sparc64 platform code
diffstat:
head/sys/sparc64/include/clock.h | 32 +-----------------
head/sys/sparc64/include/cpu.h | 6 +-
head/sys/sparc64/include/float.h | 17 +++++++++-
head/sys/sparc64/include/ofw_machdep.h | 7 ++-
head/sys/sparc64/include/vmparam.h | 4 +-
head/sys/sparc64/pci/schizo.c | 58 ++++++++++++++++++++++++---------
head/sys/sparc64/pci/schizovar.h | 4 +-
head/sys/sparc64/sparc64/cache.c | 14 ++++----
head/sys/sparc64/sparc64/clock.c | 26 +--------------
head/sys/sparc64/sparc64/machdep.c | 51 +++++++++++------------------
head/sys/sparc64/sparc64/ofw_machdep.c | 16 ++++++++-
head/sys/sparc64/sparc64/pmap.c | 39 +++++++++++-----------
head/sys/sparc64/sparc64/support.S | 20 +++++-----
13 files changed, 143 insertions(+), 151 deletions(-)
diffs (757 lines):
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/include/clock.h
--- a/head/sys/sparc64/include/clock.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/include/clock.h Wed Feb 01 11:29:19 2012 +0200
@@ -1,38 +1,10 @@
/*-
- * Copyright (c) 2001 Jake Burkholder.
- * All rights reserved.
+ * This file is in the public domain.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * $FreeBSD: head/sys/sparc64/include/clock.h 230633 2012-01-27 23:21:54Z marius $
*/
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
-extern void (*delay_func)(int usec);
-extern u_long clock_boot;
-
-void delay_boot(int usec);
-void delay_tick(int usec);
-
#endif /* !_MACHINE_CLOCK_H_ */
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/include/cpu.h
--- a/head/sys/sparc64/include/cpu.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/include/cpu.h Wed Feb 01 11:29:19 2012 +0200
@@ -31,7 +31,7 @@
*
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
* from: FreeBSD: src/sys/i386/include/cpu.h,v 1.62 2001/06/29
- * $FreeBSD: head/sys/sparc64/include/cpu.h 223719 2011-07-02 11:14:54Z marius $
+ * $FreeBSD: head/sys/sparc64/include/cpu.h 230628 2012-01-27 22:04:43Z marius $
*/
#ifndef _MACHINE_CPU_H_
@@ -53,8 +53,8 @@
extern char etext[];
void cheetah_init(u_int cpu_impl);
-void cpu_halt(void);
-void cpu_reset(void);
+void cpu_halt(void) __dead2;
+void cpu_reset(void) __dead2;
void fork_trampoline(void);
void swi_vm(void *v);
void zeus_init(u_int cpu_impl);
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/include/float.h
--- a/head/sys/sparc64/include/float.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/include/float.h Wed Feb 01 11:29:19 2012 +0200
@@ -32,7 +32,7 @@
*
* @(#)float.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: float.h,v 1.3 2001/09/21 20:48:02 eeh Exp
- * $FreeBSD$
+ * $FreeBSD: head/sys/sparc64/include/float.h 230475 2012-01-23 06:36:41Z das $
*/
#ifndef _MACHINE_FLOAT_H_
@@ -60,6 +60,11 @@
#define FLT_MAX_EXP 128 /* emax */
#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
+#if __ISO_C_VISIBLE >= 2011
+#define FLT_TRUE_MIN 1.40129846E-45F /* b**(emin-p) */
+#define FLT_DECIMAL_DIG 9 /* ceil(1+p*log10(b)) */
+#define FLT_HAS_SUBNORM 1
+#endif /* __ISO_C_VISIBLE >= 2011 */
#define DBL_MANT_DIG 53
#define DBL_EPSILON 2.2204460492503131E-16
@@ -70,6 +75,11 @@
#define DBL_MAX_EXP 1024
#define DBL_MAX 1.7976931348623157E+308
#define DBL_MAX_10_EXP 308
+#if __ISO_C_VISIBLE >= 2011
+#define DBL_TRUE_MIN 4.9406564584124654E-324
+#define DBL_DECIMAL_DIG 17
+#define DBL_HAS_SUBNORM 1
+#endif /* __ISO_C_VISIBLE >= 2011 */
#define LDBL_MANT_DIG 113
#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L
@@ -80,5 +90,10 @@
#define LDBL_MAX_EXP (+16384)
#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L
#define LDBL_MAX_10_EXP (+4932)
+#if __ISO_C_VISIBLE >= 2011
+#define LDBL_TRUE_MIN 6.475175119438025110924438958227646552E-4966L
+#define LDBL_DECIMAL_DIG 36
+#define LDBL_HAS_SUBNORM 1
+#endif /* __ISO_C_VISIBLE >= 2011 */
#endif /* _MACHINE_FLOAT_H_ */
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/include/ofw_machdep.h
--- a/head/sys/sparc64/include/ofw_machdep.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/include/ofw_machdep.h Wed Feb 01 11:29:19 2012 +0200
@@ -22,7 +22,7 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/sys/sparc64/include/ofw_machdep.h 230632 2012-01-27 22:35:53Z marius $
*/
#ifndef _MACHINE_OFW_MACHDEP_H_
@@ -37,8 +37,9 @@
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
u_int OF_getscsinitid(device_t);
-void cpu_shutdown(void *);
+void OF_panic(const char *fmt, ...) __dead2 __printflike(1, 2);
+void cpu_shutdown(void *) __dead2;
int ofw_entry(void *);
-void ofw_exit(void *);
+void ofw_exit(void *) __dead2;
#endif /* _MACHINE_OFW_MACHDEP_H_ */
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/include/vmparam.h
--- a/head/sys/sparc64/include/vmparam.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/include/vmparam.h Wed Feb 01 11:29:19 2012 +0200
@@ -33,7 +33,7 @@
*
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
* from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30
- * $FreeBSD: head/sys/sparc64/include/vmparam.h 223379 2011-06-21 20:50:55Z marius $
+ * $FreeBSD: head/sys/sparc64/include/vmparam.h 230630 2012-01-27 22:25:46Z marius $
*/
#ifndef _MACHINE_VMPARAM_H_
@@ -218,7 +218,7 @@
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
-#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 1)
+#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 2)
#endif
/*
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/pci/schizo.c
--- a/head/sys/sparc64/pci/schizo.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/pci/schizo.c Wed Feb 01 11:29:19 2012 +0200
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/sparc64/pci/schizo.c 227960 2011-11-24 23:48:22Z marius $");
+__FBSDID("$FreeBSD: head/sys/sparc64/pci/schizo.c 230664 2012-01-28 22:42:33Z marius $");
/*
* Driver for `Schizo' Fireplane/Safari to PCI 2.1, `Tomatillo' JBus to
@@ -178,6 +178,8 @@
bus_addr_t sica_clr;
};
+#define SCHIZO_CDMA_TIMEOUT 1 /* 1 second per try */
+#define SCHIZO_CDMA_TRIES 15
#define SCHIZO_PERF_CNT_QLTY 100
#define SCHIZO_SPC_BARRIER(spc, sc, offs, len, flags) \
@@ -706,13 +708,15 @@
i = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ,
4));
if (i == STX_CDMA_A_INO || i == STX_CDMA_B_INO) {
- (void)schizo_get_intrmap(sc, i, NULL,
- &sc->sc_cdma_clr);
+ sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i);
+ (void)schizo_get_intrmap(sc, i,
+ &sc->sc_cdma_map, &sc->sc_cdma_clr);
schizo_set_intr(sc, 4, i, schizo_cdma);
} else {
i = STX_CDMA_A_INO + sc->sc_half;
+ sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i);
if (bus_set_resource(dev, SYS_RES_IRQ, 5,
- INTMAP_VEC(sc->sc_ign, i), 1) != 0)
+ sc->sc_cdma_vec, 1) != 0)
panic("%s: failed to add CDMA "
"interrupt", __func__);
j = schizo_intr_register(sc, i);
@@ -720,8 +724,8 @@
panic("%s: could not register "
"interrupt controller for CDMA "
"(%d)", __func__, j);
- (void)schizo_get_intrmap(sc, i, NULL,
- &sc->sc_cdma_clr);
+ (void)schizo_get_intrmap(sc, i,
+ &sc->sc_cdma_map, &sc->sc_cdma_clr);
schizo_set_intr(sc, 5, i, schizo_cdma);
}
} else {
@@ -988,7 +992,8 @@
{
struct schizo_softc *sc = arg;
- atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_RECEIVED);
+ atomic_cmpset_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_PENDING,
+ SCHIZO_CDMA_STATE_RECEIVED);
return (FILTER_HANDLED);
}
@@ -1153,7 +1158,10 @@
struct timeval cur, end;
struct schizo_iommu_state *sis = dt->dt_cookie;
struct schizo_softc *sc = sis->sis_sc;
- int res;
+ int i, res;
+#ifdef INVARIANTS
+ register_t pil;
+#endif
if ((map->dm_flags & DMF_STREAMED) != 0) {
iommu_dma_methods.dm_dmamap_sync(dt, map, op);
@@ -1170,20 +1178,36 @@
* but given that these disable interrupts we have to emulate
* one.
*/
+ critical_enter();
+ KASSERT((rdpr(pstate) & PSTATE_IE) != 0,
+ ("%s: interrupts disabled", __func__));
+ KASSERT((pil = rdpr(pil)) <= PIL_BRIDGE,
+ ("%s: PIL too low (%ld)", __func__, pil));
for (; atomic_cmpset_acq_32(&sc->sc_cdma_state,
SCHIZO_CDMA_STATE_IDLE, SCHIZO_CDMA_STATE_PENDING) == 0;)
;
- SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, INTCLR_RECEIVED);
- microuptime(&cur);
- end.tv_sec = 15;
- end.tv_usec = 0;
- timevaladd(&end, &cur);
- for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state,
- SCHIZO_CDMA_STATE_RECEIVED, SCHIZO_CDMA_STATE_IDLE)) ==
- 0 && timevalcmp(&cur, &end, <=);)
+ SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_map,
+ INTMAP_ENABLE(sc->sc_cdma_vec, PCPU_GET(mid)));
+ for (i = 0; i < SCHIZO_CDMA_TRIES; i++) {
+ if (i > 0)
+ printf("%s: try %d\n", __func__, i);
+ SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr,
+ INTCLR_RECEIVED);
microuptime(&cur);
+ end.tv_sec = SCHIZO_CDMA_TIMEOUT;
+ end.tv_usec = 0;
+ timevaladd(&end, &cur);
+ for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state,
+ SCHIZO_CDMA_STATE_RECEIVED,
+ SCHIZO_CDMA_STATE_IDLE)) == 0 &&
+ timevalcmp(&cur, &end, <=);)
+ microuptime(&cur);
+ if (res != 0)
+ break;
+ }
if (res == 0)
panic("%s: DMA does not sync", __func__);
+ critical_exit();
}
if ((op & BUS_DMASYNC_PREWRITE) != 0)
@@ -1352,7 +1376,7 @@
panic("%s: XXX: interrupt range", __func__);
start = end = INTMAP_VEC(sc->sc_ign, end);
return (bus_generic_alloc_resource(bus, child, type, rid,
- start, end, count, flags));
+ start, end, count, flags));
case SYS_RES_MEMORY:
rm = &sc->sc_pci_mem_rman;
break;
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/pci/schizovar.h
--- a/head/sys/sparc64/pci/schizovar.h Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/pci/schizovar.h Wed Feb 01 11:29:19 2012 +0200
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: head/sys/sparc64/pci/schizovar.h 225931 2011-10-02 23:22:38Z marius $
+ * $FreeBSD: head/sys/sparc64/pci/schizovar.h 230664 2012-01-28 22:42:33Z marius $
*/
#ifndef _SPARC64_PCI_SCHIZOVAR_H_
@@ -59,7 +59,9 @@
#define SCHIZO_FLAGS_BSWAR (1 << 0)
#define SCHIZO_FLAGS_XMODE (1 << 1)
+ bus_addr_t sc_cdma_map;
bus_addr_t sc_cdma_clr;
+ uint32_t sc_cdma_vec;
uint32_t sc_cdma_state;
#define SCHIZO_CDMA_STATE_IDLE (1 << 0)
#define SCHIZO_CDMA_STATE_PENDING (1 << 1)
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/cache.c
--- a/head/sys/sparc64/sparc64/cache.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/cache.c Wed Feb 01 11:29:19 2012 +0200
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/cache.c 223719 2011-07-02 11:14:54Z marius $");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/cache.c 230633 2012-01-27 23:21:54Z marius $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -142,24 +142,24 @@
"l2-cache-line-size", pcpu->pc_cache.ec_linesize) == -1 ||
OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-associativity" :
"l2-cache-associativity", pcpu->pc_cache.ec_assoc) == -1)
- panic("cache_init: could not retrieve cache parameters");
+ OF_panic("%s: could not retrieve cache parameters", __func__);
set = pcpu->pc_cache.ic_size / pcpu->pc_cache.ic_assoc;
if ((set & ~(1UL << (ffs(set) - 1))) != 0)
- panic("cache_init: I$ set size not a power of 2");
+ OF_panic("%s: I$ set size not a power of 2", __func__);
if ((pcpu->pc_cache.dc_size &
~(1UL << (ffs(pcpu->pc_cache.dc_size) - 1))) != 0)
- panic("cache_init: D$ size not a power of 2");
+ OF_panic("%s: D$ size not a power of 2", __func__);
/*
* For CPUs which don't support unaliasing in hardware ensure that
* the data cache doesn't have too many virtual colors.
*/
if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size /
pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS)
- panic("cache_init: too many D$ colors");
+ OF_panic("%s: too many D$ colors", __func__);
set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc;
if ((set & ~(1UL << (ffs(set) - 1))) != 0)
- panic("cache_init: E$ set size not a power of 2");
+ OF_panic("%s: E$ set size not a power of 2", __func__);
if (pcpu->pc_impl >= CPU_IMPL_ULTRASPARCIII) {
cache_enable = cheetah_cache_enable;
@@ -184,5 +184,5 @@
tlb_flush_nonlocked = spitfire_tlb_flush_nonlocked;
tlb_flush_user = spitfire_tlb_flush_user;
} else
- panic("cache_init: unknown CPU");
+ OF_panic("%s: unknown CPU", __func__);
}
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/clock.c
--- a/head/sys/sparc64/sparc64/clock.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/clock.c Wed Feb 01 11:29:19 2012 +0200
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/clock.c 230633 2012-01-27 23:21:54Z marius $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -33,36 +33,12 @@
#include <sys/proc.h>
#include <sys/sched.h>
-#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
-void (*delay_func)(int usec);
-u_long clock_boot;
-
void
DELAY(int usec)
{
-
- (*delay_func)(usec);
-}
-
-void
-delay_boot(int usec)
-{
- u_long end;
-
- if (usec < 0)
- return;
-
- end = rd(tick) + (u_long)usec * clock_boot / 1000000;
- while (rd(tick) < end)
- cpu_spinwait();
-}
-
-void
-delay_tick(int usec)
-{
u_long end;
if (usec < 0)
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/machdep.c
--- a/head/sys/sparc64/sparc64/machdep.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/machdep.c Wed Feb 01 11:29:19 2012 +0200
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/machdep.c 225888 2011-09-30 20:23:18Z marius $");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/machdep.c 230633 2012-01-27 23:21:54Z marius $");
#include "opt_compat.h"
#include "opt_ddb.h"
@@ -88,7 +88,6 @@
#include <machine/bus.h>
#include <machine/cache.h>
-#include <machine/clock.h>
#include <machine/cmt.h>
#include <machine/cpu.h>
#include <machine/fireplane.h>
@@ -376,7 +375,7 @@
/*
* Parse metadata if present and fetch parameters. Must be before the
- * console is inited so cninit gets the right value of boothowto.
+ * console is inited so cninit() gets the right value of boothowto.
*/
if (mdp != NULL) {
preload_metadata = mdp;
@@ -421,37 +420,19 @@
root = OF_peer(0);
pc->pc_node = find_bsp(root, pc->pc_mid, cpu_impl);
if (pc->pc_node == 0)
- OF_exit();
+ OF_panic("%s: cannot find boot CPU node", __func__);
if (OF_getprop(pc->pc_node, "clock-frequency", &pc->pc_clock,
sizeof(pc->pc_clock)) <= 0)
- OF_exit();
-
- /*
- * Provide a DELAY() that works before PCPU_REG is set. We can't
- * set PCPU_REG without also taking over the trap table or the
- * firmware will overwrite it. Unfortunately, it's way to early
- * to also take over the trap table at this point.
- */
- clock_boot = pc->pc_clock;
- delay_func = delay_boot;
-
- /*
- * Initialize the console before printing anything.
- * NB: the low-level console drivers require a working DELAY() at
- * this point.
- */
- cninit();
+ OF_panic("%s: cannot determine boot CPU clock", __func__);
/*
* Panic if there is no metadata. Most likely the kernel was booted
* directly, instead of through loader(8).
*/
if (mdp == NULL || kmdp == NULL || end == 0 ||
- kernel_tlb_slots == 0 || kernel_tlbs == NULL) {
- printf("sparc64_init: missing loader metadata.\n"
- "This probably means you are not using loader(8).\n");
- panic("sparc64_init");
- }
+ kernel_tlb_slots == 0 || kernel_tlbs == NULL)
+ OF_panic("%s: missing loader metadata.\nThis probably means "
+ "you are not using loader(8).", __func__);
/*
* Work around the broken loader behavior of not demapping no
@@ -461,7 +442,7 @@
for (va = KERNBASE + (kernel_tlb_slots - 1) * PAGE_SIZE_4M;
va >= roundup2(end, PAGE_SIZE_4M); va -= PAGE_SIZE_4M) {
if (bootverbose)
- printf("demapping unused kernel TLB slot "
+ OF_printf("demapping unused kernel TLB slot "
"(va %#lx - %#lx)\n", va, va + PAGE_SIZE_4M - 1);
stxa(TLB_DEMAP_VA(va) | TLB_DEMAP_PRIMARY | TLB_DEMAP_PAGE,
ASI_DMMU_DEMAP, 0);
@@ -479,13 +460,15 @@
*/
if (OF_getprop(pc->pc_node, "#dtlb-entries", &dtlb_slots,
sizeof(dtlb_slots)) == -1)
- panic("sparc64_init: cannot determine number of dTLB slots");
+ OF_panic("%s: cannot determine number of dTLB slots",
+ __func__);
if (OF_getprop(pc->pc_node, "#itlb-entries", &itlb_slots,
sizeof(itlb_slots)) == -1)
- panic("sparc64_init: cannot determine number of iTLB slots");
+ OF_panic("%s: cannot determine number of iTLB slots",
+ __func__);
/*
- * Initialize and enable the caches. Note that his may include
+ * Initialize and enable the caches. Note that this may include
* applying workarounds.
*/
cache_init(pc);
@@ -573,9 +556,13 @@
sun4u_set_traptable(tl0_base);
/*
- * It's now safe to use the real DELAY().
+ * Initialize the console.
+ * NB: the low-level console drivers require a working DELAY() and
+ * some compiler optimizations may cause the curthread accesses of
+ * mutex(9) to be factored out even if the latter aren't actually
+ * called, both requiring PCPU_REG to be set.
*/
- delay_func = delay_tick;
+ cninit();
/*
* Initialize the dynamic per-CPU area for the BSP and the message
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/ofw_machdep.c
--- a/head/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/ofw_machdep.c Wed Feb 01 11:29:19 2012 +0200
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/ofw_machdep.c 228201 2011-12-02 15:24:39Z jchandra $");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/ofw_machdep.c 230632 2012-01-27 22:35:53Z marius $");
/*
* Some Open Firmware helper functions that are likely machine dependent.
@@ -44,6 +44,7 @@
#include <machine/bus.h>
#include <machine/idprom.h>
#include <machine/ofw_machdep.h>
+#include <machine/stdarg.h>
void
OF_getetheraddr(device_t dev, u_char *addr)
@@ -81,6 +82,19 @@
return (7);
}
+void
+OF_panic(const char *fmt, ...)
+{
+ char buf[256];
+ va_list ap;
+
+ va_start(ap, fmt);
+ (void)vsnprintf(buf, sizeof(buf), fmt, ap);
+ OF_printf("OF_panic: %s\n", buf);
+ va_end(ap);
+ OF_exit();
+}
+
static __inline uint32_t
phys_hi_mask_space(const char *bus, uint32_t phys_hi)
{
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/pmap.c
--- a/head/sys/sparc64/sparc64/pmap.c Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/pmap.c Wed Feb 01 11:29:19 2012 +0200
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/pmap.c 226054 2011-10-06 11:01:31Z marius $");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/pmap.c 230634 2012-01-27 23:25:24Z marius $");
/*
* Manages physical address maps.
@@ -333,16 +333,16 @@
* pmap_bootstrap_alloc is called.
*/
if ((pmem = OF_finddevice("/memory")) == -1)
- panic("pmap_bootstrap: finddevice /memory");
+ OF_panic("%s: finddevice /memory", __func__);
if ((sz = OF_getproplen(pmem, "available")) == -1)
- panic("pmap_bootstrap: getproplen /memory/available");
+ OF_panic("%s: getproplen /memory/available", __func__);
if (sizeof(phys_avail) < sz)
- panic("pmap_bootstrap: phys_avail too small");
+ OF_panic("%s: phys_avail too small", __func__);
if (sizeof(mra) < sz)
- panic("pmap_bootstrap: mra too small");
+ OF_panic("%s: mra too small", __func__);
bzero(mra, sz);
if (OF_getprop(pmem, "available", mra, sz) == -1)
- panic("pmap_bootstrap: getprop /memory/available");
+ OF_panic("%s: getprop /memory/available", __func__);
sz /= sizeof(*mra);
CTR0(KTR_PMAP, "pmap_bootstrap: physical memory");
qsort(mra, sz, sizeof (*mra), mr_cmp);
@@ -414,7 +414,7 @@
*/
pa = pmap_bootstrap_alloc(tsb_kernel_size, colors);
if (pa & PAGE_MASK_4M)
- panic("pmap_bootstrap: TSB unaligned\n");
+ OF_panic("%s: TSB unaligned", __func__);
tsb_kernel_phys = pa;
if (tsb_kernel_ldd_phys == 0) {
tsb_kernel =
@@ -461,7 +461,7 @@
#define PATCH_ASI(addr, asi) do { \
if (addr[0] != WR_R_I(IF_F3_RD(addr[0]), 0x0, \
IF_F3_RS1(addr[0]))) \
- panic("%s: patched instructions have changed", \
+ OF_panic("%s: patched instructions have changed", \
__func__); \
addr[0] |= EIF_IMM((asi), 13); \
flush(addr); \
@@ -470,7 +470,7 @@
#define PATCH_LDD(addr, asi) do { \
if (addr[0] != LDDA_R_I_R(IF_F3_RD(addr[0]), 0x0, \
IF_F3_RS1(addr[0]), IF_F3_RS2(addr[0]))) \
- panic("%s: patched instructions have changed", \
+ OF_panic("%s: patched instructions have changed", \
__func__); \
addr[0] |= EIF_F3_IMM_ASI(asi); \
flush(addr); \
@@ -481,7 +481,7 @@
addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \
IF_F3_RS1(addr[1])) || \
addr[3] != SETHI(IF_F2_RD(addr[3]), 0x0)) \
- panic("%s: patched instructions have changed", \
+ OF_panic("%s: patched instructions have changed", \
__func__); \
addr[0] |= EIF_IMM((val) >> 42, 22); \
addr[1] |= EIF_IMM((val) >> 32, 10); \
@@ -495,7 +495,7 @@
if (addr[0] != SETHI(IF_F2_RD(addr[0]), 0x0) || \
addr[1] != OR_R_I_R(IF_F3_RD(addr[1]), 0x0, \
IF_F3_RS1(addr[1]))) \
- panic("%s: patched instructions have changed", \
+ OF_panic("%s: patched instructions have changed", \
__func__); \
addr[0] |= EIF_IMM((val) >> 10, 22); \
addr[1] |= EIF_IMM((val), 10); \
@@ -604,14 +604,15 @@
* Add the PROM mappings to the kernel TSB.
*/
if ((vmem = OF_finddevice("/virtual-memory")) == -1)
- panic("pmap_bootstrap: finddevice /virtual-memory");
+ OF_panic("%s: finddevice /virtual-memory", __func__);
if ((sz = OF_getproplen(vmem, "translations")) == -1)
- panic("pmap_bootstrap: getproplen translations");
+ OF_panic("%s: getproplen translations", __func__);
if (sizeof(translations) < sz)
- panic("pmap_bootstrap: translations too small");
+ OF_panic("%s: translations too small", __func__);
bzero(translations, sz);
if (OF_getprop(vmem, "translations", translations, sz) == -1)
- panic("pmap_bootstrap: getprop /virtual-memory/translations");
+ OF_panic("%s: getprop /virtual-memory/translations",
+ __func__);
sz /= sizeof(*translations);
translations_size = sz;
CTR0(KTR_PMAP, "pmap_bootstrap: translations");
@@ -649,11 +650,11 @@
* calls in that situation.
*/
if ((sz = OF_getproplen(pmem, "reg")) == -1)
- panic("pmap_bootstrap: getproplen /memory/reg");
+ OF_panic("%s: getproplen /memory/reg", __func__);
if (sizeof(sparc64_memreg) < sz)
- panic("pmap_bootstrap: sparc64_memreg too small");
+ OF_panic("%s: sparc64_memreg too small", __func__);
if (OF_getprop(pmem, "reg", sparc64_memreg, sz) == -1)
- panic("pmap_bootstrap: getprop /memory/reg");
+ OF_panic("%s: getprop /memory/reg", __func__);
sparc64_nmemreg = sz / sizeof(*sparc64_memreg);
/*
@@ -726,7 +727,7 @@
phys_avail[i] += size;
return (pa);
}
- panic("pmap_bootstrap_alloc");
+ OF_panic("%s: no suitable region found", __func__);
}
/*
diff -r 3316ea33d242 -r b584ac3f214f head/sys/sparc64/sparc64/support.S
--- a/head/sys/sparc64/sparc64/support.S Wed Feb 01 11:29:01 2012 +0200
+++ b/head/sys/sparc64/sparc64/support.S Wed Feb 01 11:29:19 2012 +0200
@@ -25,7 +25,7 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/support.S 230662 2012-01-28 22:22:05Z marius $");
#include <sys/errno.h>
@@ -580,8 +580,8 @@
* void spitfire_block_copy(void *src, void *dst, size_t len)
*/
ENTRY(spitfire_block_copy)
- rdpr %pil, %o3
- wrpr %g0, PIL_TICK, %pil
+ rdpr %pstate, %o3
+ wrpr %g0, PSTATE_NORMAL, %pstate
wr %g0, ASI_BLK_S, %asi
wr %g0, FPRS_FEF, %fprs
@@ -603,7 +603,7 @@
or %o4, PCB_FEF, %o4
stx %o4, [PCB_REG + PCB_FLAGS]
-1: wrpr %o3, 0, %pil
+1: wrpr %o3, 0, %pstate
ldda [%o0] %asi, %f0
add %o0, 64, %o0
@@ -653,8 +653,8 @@
ENTRY(zeus_block_copy)
prefetch [%o0 + (0 * 64)], 0
- rdpr %pil, %o3
- wrpr %g0, PIL_TICK, %pil
+ rdpr %pstate, %o3
+ wrpr %g0, PSTATE_NORMAL, %pstate
wr %g0, ASI_BLK_S, %asi
wr %g0, FPRS_FEF, %fprs
@@ -676,7 +676,7 @@
or %o4, PCB_FEF, %o4
stx %o4, [PCB_REG + PCB_FLAGS]
-1: wrpr %o3, 0, %pil
+1: wrpr %o3, 0, %pstate
ldd [%o0 + (0 * 8)], %f0
prefetch [%o0 + (1 * 64)], 0
@@ -764,8 +764,8 @@
*/
ALTENTRY(zeus_block_zero)
ENTRY(spitfire_block_zero)
- rdpr %pil, %o3
- wrpr %g0, PIL_TICK, %pil
+ rdpr %pstate, %o3
+ wrpr %g0, PSTATE_NORMAL, %pstate
wr %g0, ASI_BLK_S, %asi
wr %g0, FPRS_FEF, %fprs
@@ -787,7 +787,7 @@
or %o4, PCB_FEF, %o4
stx %o4, [PCB_REG + PCB_FLAGS]
-1: wrpr %o3, 0, %pil
+1: wrpr %o3, 0, %pstate
fzero %f0
fzero %f2
More information about the Zrouter-src-freebsd
mailing list