[Midnightbsd-cvs] src: sparc64/fhc: Merge changes.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Nov 7 13:38:42 EST 2008


Log Message:
-----------
Merge changes.

Modified Files:
--------------
    src/sys/sparc64/include:
        asi.h (r1.2 -> r1.3)
        intr_machdep.h (r1.2 -> r1.3)
        stdarg.h (r1.2 -> r1.3)
    src/sys/sparc64/sparc64:
        db_trace.c (r1.2 -> r1.3)
        eeprom.c (r1.2 -> r1.3)
        exception.S (r1.2 -> r1.3)
        intr_machdep.c (r1.2 -> r1.3)
        machdep.c (r1.2 -> r1.3)
        mp_machdep.c (r1.2 -> r1.3)
        tick.c (r1.2 -> r1.3)

Removed Files:
-------------
    src/sys/sparc64/creator:
        creator.h
        creator_upa.c
    src/sys/sparc64/fhc:
        fhc_central.c
        fhc_nexus.c
        fhcvar.h
    src/sys/sparc64/include:
        nexusvar.h
        ofw_upa.h
    src/sys/sparc64/pci:
        ofw_pci.c

-------------- next part --------------
--- sys/sparc64/fhc/fhc_nexus.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>                                                         
-__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc_nexus.c,v 1.7.2.1 2006/01/30 22:30:50 marius Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/openfirm.h>
-
-#include <machine/bus.h>
-#include <machine/ofw_upa.h>
-#include <machine/nexusvar.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
-#include <sparc64/fhc/fhcreg.h>
-#include <sparc64/fhc/fhcvar.h>
-
-static device_probe_t fhc_nexus_probe;
-static device_attach_t fhc_nexus_attach;
-
-static device_method_t fhc_nexus_methods[] = {
-	/* Device interface. */
-	DEVMETHOD(device_probe,		fhc_nexus_probe),
-	DEVMETHOD(device_attach,	fhc_nexus_attach),
-	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
-	DEVMETHOD(device_suspend,	bus_generic_suspend),
-	DEVMETHOD(device_resume,	bus_generic_resume),
-
-	/* Bus interface. */
-	DEVMETHOD(bus_print_child,	fhc_print_child),
-	DEVMETHOD(bus_probe_nomatch,	fhc_probe_nomatch),
-	DEVMETHOD(bus_setup_intr,	fhc_setup_intr),
-	DEVMETHOD(bus_teardown_intr,	fhc_teardown_intr),
-	DEVMETHOD(bus_alloc_resource,	fhc_alloc_resource),
-	DEVMETHOD(bus_release_resource,	bus_generic_rl_release_resource),
-	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
-	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-	DEVMETHOD(bus_get_resource_list, fhc_get_resource_list),
-	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
-
-        /* ofw_bus interface */
-	DEVMETHOD(ofw_bus_get_compat,	fhc_get_compat),
-	DEVMETHOD(ofw_bus_get_model,	fhc_get_model),
-	DEVMETHOD(ofw_bus_get_name,	fhc_get_name),
-	DEVMETHOD(ofw_bus_get_node,	fhc_get_node),
-	DEVMETHOD(ofw_bus_get_type,	fhc_get_type),
-
-	{ NULL, NULL }
-};
-
-static driver_t fhc_nexus_driver = {
-	"fhc",
-	fhc_nexus_methods,
-	sizeof(struct fhc_softc),
-};
-
-static devclass_t fhc_nexus_devclass;
-
-DRIVER_MODULE(fhc, nexus, fhc_nexus_driver, fhc_nexus_devclass, 0, 0);
-
-static int
-fhc_nexus_probe(device_t dev)
-{
-
-	if (strcmp(nexus_get_name(dev), "fhc") == 0) {
-		device_set_desc(dev, "fhc");
-		return (fhc_probe(dev));
-	}
-	return (ENXIO);
-}
-
-static int
-fhc_nexus_attach(device_t dev)
-{
-	struct fhc_softc *sc;
-	struct upa_regs *reg;
-	bus_addr_t phys;
-	bus_addr_t size;
-	phandle_t node;
-	int nreg;
-	int rid;
-	int i;
-
-	sc = device_get_softc(dev);
-	node = nexus_get_node(dev);
-	sc->sc_node = node;
-
-	reg = nexus_get_reg(dev);
-	nreg = nexus_get_nreg(dev);
-	if (nreg != FHC_NREG) {
-		device_printf(dev, "wrong number of regs\n");
-		return (ENXIO);
-	}
-	for (i = 0; i < nreg; i++) {
-		phys = UPA_REG_PHYS(reg + i);
-		size = UPA_REG_SIZE(reg + i);
-		rid = 0;
-		sc->sc_memres[i] = bus_alloc_resource(dev, SYS_RES_MEMORY,
-		    &rid, phys, phys + size - 1, size, RF_ACTIVE);
-		if (sc->sc_memres[i] == NULL)
-			panic("%s: can't allocate registers", __func__);
-		sc->sc_bt[i] = rman_get_bustag(sc->sc_memres[i]);
-		sc->sc_bh[i] = rman_get_bushandle(sc->sc_memres[i]);
-	}
-
-	if (OF_getprop(node, "board#", &sc->sc_board,
-	    sizeof(sc->sc_board)) == -1) {
-		device_printf(dev, "could not get board number\n");
-		return (ENXIO);
-	}
-
-	return (fhc_attach(dev));
-}
--- sys/sparc64/fhc/fhcvar.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * 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: src/sys/sparc64/fhc/fhcvar.h,v 1.5 2005/03/19 00:50:28 marius Exp $
- */
-
-#ifndef _SPARC64_FHC_FHCVAR_H_
-#define	_SPARC64_FHC_FHCVAR_H_
-
-#define	FHC_CENTRAL		(1<<0)
-
-struct fhc_softc {
-	phandle_t		sc_node;
-	struct resource *	sc_memres[FHC_NREG];
-	bus_space_handle_t	sc_bh[FHC_NREG];
-	bus_space_tag_t		sc_bt[FHC_NREG];
-	int			sc_nrange;
-	struct sbus_ranges	*sc_ranges;
-	int			sc_board;
-	int			sc_ign;
-	int			sc_flags;
-	struct cdev		*sc_led_dev;
-};
-
-device_probe_t fhc_probe;
-device_attach_t fhc_attach;
-
-bus_print_child_t fhc_print_child;
-bus_probe_nomatch_t fhc_probe_nomatch;
-bus_setup_intr_t fhc_setup_intr;
-bus_teardown_intr_t fhc_teardown_intr;
-bus_alloc_resource_t fhc_alloc_resource;
-bus_get_resource_list_t fhc_get_resource_list;
-
-ofw_bus_get_compat_t fhc_get_compat;
-ofw_bus_get_model_t fhc_get_model;
-ofw_bus_get_name_t fhc_get_name;
-ofw_bus_get_node_t fhc_get_node;
-ofw_bus_get_type_t fhc_get_type;
-
-#endif /* !_SPARC64_FHC_FHCVAR_H_ */
--- sys/sparc64/fhc/fhc_central.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>                                                         
-__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc_central.c,v 1.8.2.1 2006/01/30 22:30:50 marius Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-
-#include <dev/ofw/ofw_bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
-#include <sparc64/fhc/fhcreg.h>
-#include <sparc64/fhc/fhcvar.h>
-
-static device_probe_t fhc_central_probe;
-static device_attach_t fhc_central_attach;
-
-static device_method_t fhc_central_methods[] = {
-	/* Device interface. */
-	DEVMETHOD(device_probe,		fhc_central_probe),
-	DEVMETHOD(device_attach,	fhc_central_attach),
-	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
-	DEVMETHOD(device_suspend,	bus_generic_suspend),
-	DEVMETHOD(device_resume,	bus_generic_resume),
-
-	/* Bus interface. */
-	DEVMETHOD(bus_print_child,	fhc_print_child),
-	DEVMETHOD(bus_probe_nomatch,	fhc_probe_nomatch),
-	DEVMETHOD(bus_setup_intr,	fhc_setup_intr),
-	DEVMETHOD(bus_teardown_intr,	fhc_teardown_intr),
-	DEVMETHOD(bus_alloc_resource,	fhc_alloc_resource),
-	DEVMETHOD(bus_release_resource,	bus_generic_rl_release_resource),
-	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
-	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-	DEVMETHOD(bus_get_resource_list, fhc_get_resource_list),
-	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
-
-	/* ofw_bus interface */
-	DEVMETHOD(ofw_bus_get_compat,	fhc_get_compat),
-	DEVMETHOD(ofw_bus_get_model,	fhc_get_model),
-	DEVMETHOD(ofw_bus_get_name,	fhc_get_name),
-	DEVMETHOD(ofw_bus_get_node,	fhc_get_node),
-	DEVMETHOD(ofw_bus_get_type,	fhc_get_type),
-
-	{ NULL, NULL }
-};
-
-static driver_t fhc_central_driver = {
-	"fhc",
-	fhc_central_methods,
-	sizeof(struct fhc_softc),
-};
-
-static devclass_t fhc_central_devclass;
-
-DRIVER_MODULE(fhc, central, fhc_central_driver, fhc_central_devclass, 0, 0);
-
-static int
-fhc_central_probe(device_t dev)
-{
-
-	if (strcmp(ofw_bus_get_name(dev), "fhc") == 0) {
-		device_set_desc(dev, "fhc");
-		return (fhc_probe(dev));
-	}
-	return (ENXIO);
-}
-
-static int
-fhc_central_attach(device_t dev)
-{
-	struct fhc_softc *sc;
-	phandle_t node;
-	int board;
-	int rid;
-	int i;
-
-	sc = device_get_softc(dev);
-	node = ofw_bus_get_node(dev);
-	sc->sc_node = node;
-	sc->sc_flags |= FHC_CENTRAL;
-
-	for (i = 0; i < FHC_NREG; i++) {
-		rid = i;
-		sc->sc_memres[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
-		    &rid, RF_ACTIVE);
-		if (sc->sc_memres[i] == NULL)
-			panic("%s: can't allocate registers", __func__);
-		sc->sc_bt[i] = rman_get_bustag(sc->sc_memres[i]);
-		sc->sc_bh[i] = rman_get_bushandle(sc->sc_memres[i]);
-	}
-
-	board = bus_space_read_4(sc->sc_bt[FHC_INTERNAL],
-	    sc->sc_bh[FHC_INTERNAL], FHC_BSR);
-	sc->sc_board = ((board >> 16) & 0x1) | ((board >> 12) & 0xe);
-
-	return (fhc_attach(dev));
-}
Index: stdarg.h
===================================================================
RCS file: /home/cvs/src/sys/sparc64/include/stdarg.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/include/stdarg.h -L sys/sparc64/include/stdarg.h -u -r1.2 -r1.3
--- sys/sparc64/include/stdarg.h
+++ sys/sparc64/include/stdarg.h
@@ -1,5 +1,4 @@
 /*-
- * Copyright (c) 2008 Lucas Holt.  All rights reserved.
  * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,8 +35,7 @@
  *
  *	@(#)stdarg.h	8.2 (Berkeley) 9/27/93
  *	$NetBSD: stdarg.h,v 1.11 2000/07/23 21:36:56 mycroft Exp $
- * $FreeBSD: src/sys/sparc64/include/stdarg.h,v 1.8 2005/03/02 21:33:28 joerg Exp $
- * $MidnightBSD$
+ * $FreeBSD: src/sys/sparc64/include/stdarg.h,v 1.9 2006/09/21 01:37:02 kan Exp $
  */
 
 #ifndef _MACHINE_STDARG_H_
@@ -54,7 +52,7 @@
 #ifdef __GNUCLIKE_BUILTIN_STDARG
 
 #define	va_start(ap, last) \
-	__builtin_stdarg_start((ap), (last))
+	__builtin_va_start((ap), (last))
 
 #define	va_arg(ap, type) \
 	__builtin_va_arg((ap), type)
@@ -67,17 +65,6 @@
 #define	va_end(ap) \
 	__builtin_va_end(ap)
 
-#elif defined(__PCC__) /* !__GNUCLIKE_BUILTIN_STDARG */
-
-#define va_start(ap, last) \
-        __builtin_stdarg_start((ap), last)
-#define va_arg(ap, type) \
-        __builtin_va_arg((ap), type)
-#define va_end(ap) \
-        __builtin_va_end((ap))
-#define __va_copy(dest, src) \
-        __builtin_va_copy((dest), (src))
-
 #else	/* ! __GNUCLIKE_BUILTIN_STDARG */
 
 #if !defined(__GNUCLIKE_BUILTIN_NEXT_ARG) && !defined(lint)
Index: intr_machdep.h
===================================================================
RCS file: /home/cvs/src/sys/sparc64/include/intr_machdep.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/include/intr_machdep.h -L sys/sparc64/include/intr_machdep.h -u -r1.2 -r1.3
--- sys/sparc64/include/intr_machdep.h
+++ sys/sparc64/include/intr_machdep.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sparc64/include/intr_machdep.h,v 1.13.10.1 2006/03/10 19:37:35 jhb Exp $
+ * $FreeBSD: src/sys/sparc64/include/intr_machdep.h,v 1.17 2007/09/06 19:16:29 marius Exp $
  */
 
 #ifndef	_MACHINE_INTR_MACHDEP_H_
@@ -39,7 +39,7 @@
 
 #define	IH_SHIFT	PTR_SHIFT
 #define	IQE_SHIFT	5
-#define	IV_SHIFT	5
+#define	IV_SHIFT	6
 
 #define	PIL_LOW		1	/* stray interrupts */
 #define	PIL_ITHREAD	2	/* interrupts that use ithreads */
@@ -49,13 +49,13 @@
 #define	PIL_FAST	13	/* fast interrupts */
 #define	PIL_TICK	14
 
+#ifndef LOCORE
+
 struct trapframe;
 
 typedef	void ih_func_t(struct trapframe *);
 typedef	void iv_func_t(void *);
 
-struct ithd;
-
 struct intr_request {
 	struct	intr_request *ir_next;
 	iv_func_t *ir_func;
@@ -64,25 +64,40 @@
 	u_int	ir_pri;
 };
 
+struct intr_controller {
+	void	(*ic_enable)(void *);
+	void	(*ic_disable)(void *);
+	void	(*ic_eoi)(void *);
+};
+
 struct intr_vector {
 	iv_func_t *iv_func;
 	void	*iv_arg;
+	const struct	intr_controller *iv_ic;
+	void	*iv_icarg;
 	struct	intr_event *iv_event;
 	u_int	iv_pri;
 	u_int	iv_vec;
+	u_int	iv_mid;
+	u_int	iv_refcnt;
+	u_int	iv_pad[2];
 };
 
 extern ih_func_t *intr_handlers[];
 extern struct intr_vector intr_vectors[];
 
 void	intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
-		   void *iva);
+	    void *iva);
 void	intr_init1(void);
 void	intr_init2(void);
-int	inthand_add(const char *name, int vec, void (*handler)(void *),
-    void *arg, int flags, void **cookiep);
+int	intr_controller_register(int vec, const struct intr_controller *ic,
+	    void *icarg);
+int	inthand_add(const char *name, int vec, int (*filt)(void *),
+	    void (*handler)(void *), void *arg, int flags, void **cookiep);
 int	inthand_remove(int vec, void *cookie);
 
 ih_func_t intr_fast;
 
-#endif
+#endif /* !LOCORE */
+
+#endif /* !_MACHINE_INTR_MACHDEP_H_ */
--- sys/sparc64/include/nexusvar.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 2001 by Thomas Moestl <tmm at FreeBSD.org>.
- * All rights reserved.
- *
- * 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 ``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: src/sys/sparc64/include/nexusvar.h,v 1.3 2004/04/30 19:50:50 tmm Exp $
- */
-
-#ifndef _MACHINE_NEXUSVAR_H_
-#define _MACHINE_NEXUSVAR_H_
-
-enum nexus_ivars {
-	NEXUS_IVAR_NODE,
-	NEXUS_IVAR_NAME,
-	NEXUS_IVAR_DEVICE_TYPE,
-	NEXUS_IVAR_MODEL,
-	NEXUS_IVAR_REG,
-	NEXUS_IVAR_NREG,
-	NEXUS_IVAR_INTERRUPTS,
-	NEXUS_IVAR_NINTERRUPTS,
-	NEXUS_IVAR_DMATAG,
-};
-
-#define NEXUS_ACCESSOR(var, ivar, type)					\
-	__BUS_ACCESSOR(nexus, var, NEXUS, ivar, type)
-
-NEXUS_ACCESSOR(node,		NODE,			phandle_t)
-NEXUS_ACCESSOR(name,		NAME,			char *)
-NEXUS_ACCESSOR(device_type,	DEVICE_TYPE,		char *)
-NEXUS_ACCESSOR(model,		MODEL,			char *)
-NEXUS_ACCESSOR(reg,		REG,			struct upa_regs *)
-NEXUS_ACCESSOR(nreg,		NREG,			int)
-NEXUS_ACCESSOR(interrupts,	INTERRUPTS,		u_int *)
-NEXUS_ACCESSOR(ninterrupts,	NINTERRUPTS,		int)
-NEXUS_ACCESSOR(dmatag,		DMATAG,			bus_dma_tag_t)
-
-#undef NEXUS_ACCESSOR
-
-#endif /* _MACHINE_NEXUSVAR_H_ */
--- sys/sparc64/include/ofw_upa.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * Copyright (c) 1998, 1999 Eduardo E. Horvath
- * Copyright (c) 1999 Matthew R. Green
- * All rights reserved.
- *
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- *
- *	from: NetBSD: psychoreg.h,v 1.8 2001/09/10 16:17:06 eeh Exp
- *
- * $FreeBSD: src/sys/sparc64/include/ofw_upa.h,v 1.4 2005/01/07 02:29:22 imp Exp $
- */
-
-#ifndef _MACHINE_OFW_UPA_H_
-#define _MACHINE_OFW_UPA_H_
-
-/*
- * These are the regs and ranges property the psycho uses. They should be
- * applicable to all UPA devices. XXX: verify this.
- */
-
-struct upa_regs {
-	u_int32_t	phys_hi;
-	u_int32_t	phys_lo;
-	u_int32_t	size_hi;
-	u_int32_t	size_lo;
-};
-
-struct upa_ranges {
-	u_int32_t	cspace;
-	u_int32_t	child_hi;
-	u_int32_t	child_lo;
-	u_int32_t	phys_hi;
-	u_int32_t	phys_lo;
-	u_int32_t	size_hi;
-	u_int32_t	size_lo;
-};
-
-#define	UPA_REG_PHYS(r) \
-	(((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
-#define	UPA_REG_SIZE(r) \
-	(((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
-
-#define	UPA_RANGE_CHILD(r) \
-	(((u_int64_t)(r)->child_hi << 32) | (u_int64_t)(r)->child_lo)
-#define	UPA_RANGE_PHYS(r) \
-	(((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
-#define	UPA_RANGE_SIZE(r) \
-	(((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
-#define	UPA_RANGE_CS(r)		(((r)->cspace >> 24) & 0x03)
-
-#endif /* !_MACHINE_OFW_UPA_H_ */
Index: asi.h
===================================================================
RCS file: /home/cvs/src/sys/sparc64/include/asi.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/include/asi.h -L sys/sparc64/include/asi.h -u -r1.2 -r1.3
--- sys/sparc64/include/asi.h
+++ sys/sparc64/include/asi.h
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  *	from: BSDI: asi.h,v 1.3 1997/08/08 14:31:42 torek
- * $FreeBSD: src/sys/sparc64/include/asi.h,v 1.9.14.1 2006/03/31 23:40:42 marius Exp $
+ * $FreeBSD: src/sys/sparc64/include/asi.h,v 1.12 2006/10/09 05:59:04 kmacy Exp $
  */
 
 #ifndef	_MACHINE_ASI_H_
--- sys/sparc64/creator/creator_upa.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/creator/creator_upa.c,v 1.9 2005/07/10 11:16:34 marius Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/consio.h>
-#include <sys/eventhandler.h>
-#include <sys/fbio.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <dev/fb/fbreg.h>
-#include <dev/syscons/syscons.h>
-
-#include <machine/nexusvar.h>
-#include <machine/ofw_upa.h>
-
-#include <sparc64/creator/creator.h>
-
-static int creator_upa_attach(device_t dev);
-static int creator_upa_probe(device_t dev);
-
-static d_open_t creator_open;
-static d_close_t creator_close;
-static d_ioctl_t creator_ioctl;
-static d_mmap_t creator_mmap;
-
-static void creator_shutdown(void *v);
-
-static device_method_t creator_upa_methods[] = {
-	DEVMETHOD(device_probe,		creator_upa_probe),
-	DEVMETHOD(device_attach,	creator_upa_attach),
-
-	{ 0, 0 }
-};
-
-static driver_t creator_upa_driver = {
-	CREATOR_DRIVER_NAME,
-	creator_upa_methods,
-	sizeof(struct creator_softc),
-};
-
-static devclass_t creator_upa_devclass;
-
-static struct cdevsw creator_devsw = {
-	.d_version =	D_VERSION,
-	.d_flags =	D_NEEDGIANT,
-	.d_open =	creator_open,
-	.d_close =	creator_close,
-	.d_ioctl =	creator_ioctl,
-	.d_mmap =	creator_mmap,
-	.d_name =	"fb",
-};
-
-struct ffb_map {
-	uint64_t fm_virt;
-	uint64_t fm_phys;
-	uint64_t fm_size;
-};
-
-static const struct ffb_map ffb_map[] = {
-	{ FFB_VIRT_SFB8R,	FFB_PHYS_SFB8R,		0x00400000 },
-	{ FFB_VIRT_SFB8G,	FFB_PHYS_SFB8G,		0x00400000 },
-	{ FFB_VIRT_SFB8B,	FFB_PHYS_SFB8B,		0x00400000 },
-	{ FFB_VIRT_SFB8X,	FFB_PHYS_SFB8X,		0x00400000 },
-	{ FFB_VIRT_SFB32,	FFB_PHYS_SFB32,		0x01000000 },
-	{ FFB_VIRT_SFB64,	FFB_PHYS_SFB64,		0x02000000 },
-	{ FFB_VIRT_FBC,		FFB_PHYS_FBC,		0x00002000 },
-	{ FFB_VIRT_FBC_BM,	FFB_PHYS_FBC_BM,	0x00002000 },
-	{ FFB_VIRT_DFB8R,	FFB_PHYS_DFB8R,		0x00400000 },
-	{ FFB_VIRT_DFB8G,	FFB_PHYS_DFB8G,		0x00400000 },
-	{ FFB_VIRT_DFB8B,	FFB_PHYS_DFB8B,		0x00400000 },
-	{ FFB_VIRT_DFB8X,	FFB_PHYS_DFB8X,		0x00400000 },
-	{ FFB_VIRT_DFB24,	FFB_PHYS_DFB24,		0x01000000 },
-	{ FFB_VIRT_DFB32,	FFB_PHYS_DFB32,		0x01000000 },
-	{ FFB_VIRT_DFB422A,	FFB_PHYS_DFB422A,	0x00800000 },
-	{ FFB_VIRT_DFB422AD,	FFB_PHYS_DFB422AD,	0x00800000 },
-	{ FFB_VIRT_DFB24B,	FFB_PHYS_DFB24B,	0x01000000 },
-	{ FFB_VIRT_DFB422B,	FFB_PHYS_DFB422B,	0x00800000 },
-	{ FFB_VIRT_DFB422BD,	FFB_PHYS_DFB422BD,	0x00800000 },
-	{ FFB_VIRT_SFB16Z,	FFB_PHYS_SFB16Z,	0x00800000 },
-	{ FFB_VIRT_SFB8Z,	FFB_PHYS_SFB8Z,		0x00800000 },
-	{ FFB_VIRT_SFB422,	FFB_PHYS_SFB422,	0x00800000 },
-	{ FFB_VIRT_SFB422D,	FFB_PHYS_SFB422D,	0x00800000 },
-	{ FFB_VIRT_FBC_KREG,	FFB_PHYS_FBC_KREG,	0x00002000 },
-	{ FFB_VIRT_DAC,		FFB_PHYS_DAC,		0x00002000 },
-	{ FFB_VIRT_PROM,	FFB_PHYS_PROM,		0x00010000 },
-	{ FFB_VIRT_EXP,		FFB_PHYS_EXP,		0x00002000 },
-	{ 0x0,			0x0,			0x00000000 }
-};
-
-DRIVER_MODULE(creator, nexus, creator_upa_driver, creator_upa_devclass, 0, 0);
-
-static int
-creator_upa_probe(device_t dev)
-{
-	const char *name;
-	phandle_t node;
-	int type;
-
-	name = nexus_get_name(dev);
-	node = nexus_get_node(dev);
-	if (strcmp(name, "SUNW,ffb") == 0) {
-		if (OF_getprop(node, "board_type", &type, sizeof(type)) == -1)
-			return (ENXIO);
-		switch (type & 7) {
-		case 0x0:
-			device_set_desc(dev, "Creator");
-			break;
-		case 0x3:
-			device_set_desc(dev, "Creator3D");
-			break;
-		default:
-			return (ENXIO);
-		}
-	} else if (strcmp(name, "SUNW,afb") == 0)
-		device_set_desc(dev, "Elite3D");
-	else
-		return (ENXIO);
-	return (BUS_PROBE_DEFAULT);
-}
-
-static int
-creator_upa_attach(device_t dev)
-{
-	struct creator_softc *sc;
-	struct upa_regs *reg;
-	video_switch_t *sw;
-	phandle_t node;
-	bus_addr_t phys;
-	bus_size_t size;
-	int error;
-	int nreg;
-	int unit;
-	int i;
-
-	node = nexus_get_node(dev);
-	if ((sc = (struct creator_softc *)vid_get_adapter(vid_find_adapter(
-	    CREATOR_DRIVER_NAME, 0))) != NULL && sc->sc_node == node) {
-	    	device_printf(dev, "console\n");
-	    	device_set_softc(dev, sc);
-	} else {
-		sc = device_get_softc(dev);
-		bzero(sc, sizeof(struct creator_softc));
-		sc->sc_node = node;
-		nreg = nexus_get_nreg(dev);
-		reg = nexus_get_reg(dev);
-		for (i = 0; i < nreg; i++) {
-			phys = UPA_REG_PHYS(reg + i);
-			size = UPA_REG_SIZE(reg + i);
-			sc->sc_rid[i] = 0;
-			sc->sc_reg[i] = bus_alloc_resource(dev, SYS_RES_MEMORY,
-			    &sc->sc_rid[i], phys, phys + size - 1, size,
-			    RF_ACTIVE);
-			if (sc->sc_reg[i] == NULL) {
-				device_printf(dev,
-				    "cannot allocate resources\n");
-				error = ENXIO;
-				goto fail;
-			}
-			sc->sc_bt[i] = rman_get_bustag(sc->sc_reg[i]);
-			sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]);
-		}
-		if (strcmp(nexus_get_name(dev), "SUNW,afb") == 0)
-			sc->sc_flags |= CREATOR_AFB;
-		if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) {
-			device_printf(dev, "cannot get video switch\n");
-			error = ENODEV;
-			goto fail;
-		}
-		/*
-		 * During device configuration we don't necessarily probe
-		 * the adapter which is the console first so we can't use
-		 * the device unit number for the video adapter unit. The
-		 * worst case would be that we use the video adapter unit
-		 * 0 twice. As it doesn't really matter which unit number
-		 * the corresponding video adapter has just use the next
-		 * unused one.
-		 */
-		for (i = 0; i < devclass_get_maxunit(creator_upa_devclass); i++)
-			if (vid_find_adapter(CREATOR_DRIVER_NAME, i) < 0)
-				break;
-		if ((error = sw->init(i, &sc->sc_va, 0)) != 0) {
-			device_printf(dev, "cannot initialize adapter\n");
-		    	goto fail;
-		}
-	}
-
-	if (bootverbose) {
-		if (sc->sc_flags & CREATOR_PAC1)
-			device_printf(dev,
-			    "BT9068/PAC1 RAMDAC (%s cursor control)\n",
-			    sc->sc_flags & CREATOR_CURINV ? "inverted" :
-			    "normal");
-		else
-			device_printf(dev, "BT498/PAC2 RAMDAC\n");
-	}
-	device_printf(dev, "resolution %dx%d\n", sc->sc_width, sc->sc_height);
-
-	unit = device_get_unit(dev);
-	sc->sc_si = make_dev(&creator_devsw, unit, UID_ROOT, GID_WHEEL,
-	    0600, "fb%d", unit);
-	sc->sc_si->si_drv1 = sc;
-
-	EVENTHANDLER_REGISTER(shutdown_final, creator_shutdown, sc,
-	    SHUTDOWN_PRI_DEFAULT);
-
-	return (0);
-
- fail:
-	for (i = 0; i < FFB_NREG; i++)
-		if (sc->sc_reg[i] != NULL)
-			bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rid[i],
-			    sc->sc_reg[i]);
- 	return (error);
-}
-
-static int
-creator_open(struct cdev *dev, int flags, int mode, struct thread *td)
-{
-
-	return (0);
-}
-
-static int
-creator_close(struct cdev *dev, int flags, int mode, struct thread *td)
-{
-
-	return (0);
-}
-
-static int
-creator_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags,
-    struct thread *td)
-{
-	struct creator_softc *sc;
-
-	sc = dev->si_drv1;
-	return ((*vidsw[sc->sc_va.va_index]->ioctl)(&sc->sc_va, cmd, data));
-}
-
-static int
-creator_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
-{
-	struct creator_softc *sc;
-	const struct ffb_map *fm;
-
-	sc = dev->si_drv1;
-	for (fm = ffb_map; fm->fm_size != 0; fm++) {
-		if (offset >= fm->fm_virt &&
-		    offset < fm->fm_virt + fm->fm_size) {
-			*paddr = sc->sc_bh[0] + fm->fm_phys +
-			    (offset - fm->fm_virt);
-			return (0);
-		}
-	}
-	return (EINVAL);
-}
-
-static void
-creator_shutdown(void *v)
-{
-	struct creator_softc *sc = v;
-
-	FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE2, FFB_DAC_CUR_CTRL);
-	FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2,
-	    sc->sc_flags & CREATOR_CURINV ? 0 :
-	    FFB_DAC_CUR_CTRL_P0 | FFB_DAC_CUR_CTRL_P1);
-	/*
-	 * In case this is the console set the cursor of the stdout
-	 * instance to the start of the last line so OFW output ends
-	 * up beneath what FreeBSD left on the screen.
-	 */
-	if (sc->sc_flags & CREATOR_CONSOLE) {
-		OF_interpret("stdout @ is my-self 0 to column#", 0);
-		OF_interpret("stdout @ is my-self #lines 1 - to line#", 0);
-	}
-}
--- sys/sparc64/creator/creator.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*-
- * Copyright (C) 2000 David S. Miller (davem at redhat.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *	from: XFree86: ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp
- */
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * 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: src/sys/sparc64/creator/creator.h,v 1.5 2005/07/10 11:16:34 marius Exp $
- */
-
-#ifndef _DEV_FB_CREATOR_H_
-#define	_DEV_FB_CREATOR_H_
-
-#define	FFB_NREG		24
-
-#define	FFB_DAC			1
-#define	FFB_DAC_TYPE		0x0
-#define	FFB_DAC_VALUE		0x4
-#define	FFB_DAC_TYPE2		0x8
-#define	FFB_DAC_VALUE2		0xc
-
-/* FFB_DAC_TYPE configuration and palette register addresses */
-#define	FFB_DAC_CFG_UCTRL	0x1001		/* User Control */
-#define	FFB_DAC_CFG_TGEN	0x6000		/* Timing Generator Control */
-#define	FFB_DAC_CFG_DID		0x8000		/* Device Identification */
-
-/* FFB_DAC_CFG_UCTRL register */
-#define	FFB_DAC_UCTRL_IPDISAB	0x0001		/* Input Pullup Resistor Dis. */
-#define	FFB_DAC_UCTRL_ABLANK	0x0002		/* Asynchronous Blank */
-#define	FFB_DAC_UCTRL_DBENAB	0x0004		/* Double-Buffer Enable */
-#define	FFB_DAC_UCTRL_OVENAB	0x0008		/* Overlay Enable */
-#define	FFB_DAC_UCTRL_WMODE	0x0030		/* Window Mode */
-#define	FFB_DAC_UCTRL_WM_COMB	0x0000		/* Window Mode Combined */
-#define	FFB_DAC_UCTRL_WM_S4	0x0010		/* Window Mode Separate 4 */
-#define	FFB_DAC_UCTRL_WM_S8	0x0020		/* Window Mode Separate 8 */
-#define	FFB_DAC_UCTRL_WM_RESV	0x0030		/* Window Mode Reserved */
-#define	FFB_DAC_UCTRL_MANREV	0x0f00		/* Manufacturing Revision */
-
-/* FFB_DAC_CFG_TGEN register */
-#define	FFB_DAC_CFG_TGEN_VIDE	0x01		/* Video Enable */
-#define	FFB_DAC_CFG_TGEN_TGE	0x02		/* Timing Generator Enable */
-#define	FFB_DAC_CFG_TGEN_HSD	0x04		/* HSYNC* Disable */
-#define	FFB_DAC_CFG_TGEN_VSD	0x08		/* VSYNC* Disable */
-#define	FFB_DAC_CFG_TGEN_EQD	0x10		/* Equalization Disable */
-#define	FFB_DAC_CFG_TGEN_MM	0x20		/* 0 = Slave, 1 = Master */
-#define	FFB_DAC_CFG_TGEN_IM	0x40		/* 1 = Interlaced Mode */
-
-/* FFB_DAC_CFG_DID register */
-#define	FFB_DAC_CFG_DID_ONE	0x00000001	/* Always Set */
-#define	FFB_DAC_CFG_DID_MANUF	0x00000ffe	/* DAC Manufacturer ID */
-#define	FFB_DAC_CFG_DID_PNUM	0x0ffff000	/* DAC Part Number */
-#define	FFB_DAC_CFG_DID_REV	0xf0000000	/* DAC Revision */
-
-/* FFB_DAC_TYPE2 cursor register addresses */
-#define	FFB_DAC_CUR_BITMAP_P0	0x0		/* Plane 0 Cursor Bitmap */
-#define	FFB_DAC_CUR_BITMAP_P1	0x80		/* Plane 1 Cursor Bitmap */
-#define	FFB_DAC_CUR_CTRL	0x100		/* Cursor Control */
-#define	FFB_DAC_CUR_COLOR0	0x101		/* Cursor Color 0 */
-#define	FFB_DAC_CUR_COLOR1	0x102		/* Cursor Color 1 (bg) */
-#define	FFB_DAC_CUR_COLOR2	0x103		/* Cursor Color 2 (fg) */
-#define	FFB_DAC_CUR_POS		0x104		/* Active Cursor Position */
-
-/* FFB_DAC_CUR_CTRL register (might be inverted on PAC1 DACs) */
-#define	FFB_DAC_CUR_CTRL_P0	0x1		/* Plane0 Display Disable */
-#define	FFB_DAC_CUR_CTRL_P1	0x2		/* Plane1 Display Disable */
-
-#define	FFB_FBC			2
-#define	FFB_FBC_BY		0x60
-#define	FFB_FBC_BX		0x64
-#define	FFB_FBC_DY		0x68
-#define	FFB_FBC_DX		0x6c
-#define	FFB_FBC_BH		0x70
-#define	FFB_FBC_BW		0x74
-#define	FFB_FBC_PPC		0x200		/* Pixel Processor Control */
-#define	FFB_FBC_FG		0x208		/* Foreground */
-#define	FFB_FBC_BG		0x20c		/* Background */
-#define	FFB_FBC_FBC		0x254		/* Frame Buffer Control */
-#define	FFB_FBC_ROP		0x258		/* Raster Operation */
-#define	FFB_FBC_PMASK		0x290		/* Pixel Mask */
-#define	FFB_FBC_DRAWOP		0x300		/* Draw Operation */
-#define	FFB_FBC_FONTXY		0x314		/* Font X/Y */
-#define	FFB_FBC_FONTW		0x318		/* Font Width */
-#define	FFB_FBC_FONTINC		0x31c		/* Font Increment */
-#define	FFB_FBC_FONT		0x320		/* Font Data */
-#define	FFB_FBC_UCSR		0x900		/* User Control & Status */
-
-#define	FBC_PPC_VCE_DIS		0x00001000
-#define	FBC_PPC_APE_DIS		0x00000800
-#define	FBC_PPC_TBE_OPAQUE	0x00000200
-#define	FBC_PPC_CS_CONST	0x00000003
-
-#define	FFB_FBC_WB_A		0x20000000
-#define	FFB_FBC_RB_A		0x00004000
-#define	FFB_FBC_SB_BOTH		0x00003000
-#define	FFB_FBC_XE_OFF		0x00000040
-#define	FFB_FBC_RGBE_MASK	0x0000003f
-
-#define	FBC_ROP_NEW		0x83
-
-#define	FBC_DRAWOP_RECTANGLE	0x08
-
-#define	FBC_UCSR_FIFO_OVFL	0x80000000
-#define	FBC_UCSR_READ_ERR	0x40000000
-#define	FBC_UCSR_RP_BUSY	0x02000000
-#define	FBC_UCSR_FB_BUSY	0x01000000
-#define	FBC_UCSR_FIFO_MASK	0x00000fff
-
-#define	FFB_VIRT_SFB8R		0x00000000
-#define	FFB_VIRT_SFB8G		0x00400000
-#define	FFB_VIRT_SFB8B		0x00800000
-#define	FFB_VIRT_SFB8X		0x00c00000
-#define	FFB_VIRT_SFB32		0x01000000
-#define	FFB_VIRT_SFB64		0x02000000
-#define	FFB_VIRT_FBC		0x04000000
-#define	FFB_VIRT_FBC_BM		0x04002000
-#define	FFB_VIRT_DFB8R		0x04004000
-#define	FFB_VIRT_DFB8G		0x04404000
-#define	FFB_VIRT_DFB8B		0x04804000
-#define	FFB_VIRT_DFB8X		0x04c04000
-#define	FFB_VIRT_DFB24		0x05004000
-#define	FFB_VIRT_DFB32		0x06004000
-#define	FFB_VIRT_DFB422A	0x07004000
-#define	FFB_VIRT_DFB422AD	0x07804000
-#define	FFB_VIRT_DFB24B		0x08004000
-#define	FFB_VIRT_DFB422B	0x09004000
-#define	FFB_VIRT_DFB422BD	0x09804000
-#define	FFB_VIRT_SFB16Z		0x0a004000
-#define	FFB_VIRT_SFB8Z		0x0a404000
-#define	FFB_VIRT_SFB422		0x0ac04000
-#define	FFB_VIRT_SFB422D	0x0b404000
-#define	FFB_VIRT_FBC_KREG	0x0bc04000
-#define	FFB_VIRT_DAC		0x0bc06000
-#define	FFB_VIRT_PROM		0x0bc08000
-#define	FFB_VIRT_EXP		0x0bc18000
-
-#define	FFB_PHYS_SFB8R		0x04000000
-#define	FFB_PHYS_SFB8G		0x04400000
-#define	FFB_PHYS_SFB8B		0x04800000
-#define	FFB_PHYS_SFB8X		0x04c00000
-#define	FFB_PHYS_SFB32		0x05000000
-#define	FFB_PHYS_SFB64		0x06000000
-#define	FFB_PHYS_FBC		0x00600000
-#define	FFB_PHYS_FBC_BM		0x00600000
-#define	FFB_PHYS_DFB8R		0x01000000
-#define	FFB_PHYS_DFB8G		0x01400000
-#define	FFB_PHYS_DFB8B		0x01800000
-#define	FFB_PHYS_DFB8X		0x01c00000
-#define	FFB_PHYS_DFB24		0x02000000
-#define	FFB_PHYS_DFB32		0x03000000
-#define	FFB_PHYS_DFB422A	0x09000000
-#define	FFB_PHYS_DFB422AD	0x09800000
-#define	FFB_PHYS_DFB24B		0x0a000000
-#define	FFB_PHYS_DFB422B	0x0b000000
-#define	FFB_PHYS_DFB422BD	0x0b800000
-#define	FFB_PHYS_SFB16Z		0x0c800000
-#define	FFB_PHYS_SFB8Z		0x0c000000
-#define	FFB_PHYS_SFB422		0x0d000000
-#define	FFB_PHYS_SFB422D	0x0d800000
-#define	FFB_PHYS_FBC_KREG	0x00610000
-#define	FFB_PHYS_DAC		0x00400000
-#define	FFB_PHYS_PROM		0x00000000
-#define	FFB_PHYS_EXP		0x00200000
-
-#define	FFB_READ(sc, reg, off) \
-	bus_space_read_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off))
-#define	FFB_WRITE(sc, reg, off, val) \
-	bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val))
-
-#define	CREATOR_DRIVER_NAME	"creator"
-
-struct creator_softc {
-	video_adapter_t		sc_va;			/* XXX must be first */
-
-	phandle_t		sc_node;
-
-	struct cdev		*sc_si;
-
-	int			sc_rid[FFB_NREG];
-	struct resource		*sc_reg[FFB_NREG];
-	bus_space_tag_t		sc_bt[FFB_NREG];
-	bus_space_handle_t	sc_bh[FFB_NREG];
-
-	int			sc_height;
-	int			sc_width;
-
-	int			sc_xmargin;
-	int			sc_ymargin;
-
-	u_char			*sc_font;
-
-	int			sc_bg_cache;
-	int			sc_fg_cache;
-	int			sc_fifo_cache;
-	int			sc_fontinc_cache;
-	int			sc_fontw_cache;
-	int			sc_pmask_cache;
-
-	int			sc_flags;
-#define	CREATOR_AFB		(1 << 0)
-#define	CREATOR_CONSOLE		(1 << 1)
-#define	CREATOR_CUREN		(1 << 2)
-#define	CREATOR_CURINV		(1 << 3)
-#define	CREATOR_PAC1		(1 << 4)
-};
-
-#endif /* !_DEV_FB_CREATOR_H_ */
--- sys/sparc64/pci/ofw_pci.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000 Matthew R. Green
- * Copyright (c) 2001 - 2003 by Thomas Moestl <tmm at FreeBSD.org>
- * All rights reserved.
- *
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- *
- *	from: NetBSD: psycho.c,v 1.35 2001/09/10 16:17:06 eeh Exp
- *
- * $FreeBSD: src/sys/sparc64/pci/ofw_pci.c,v 1.15 2005/01/07 02:29:22 imp Exp $
- */
-
-#include "opt_ofw_pci.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <machine/bus.h>
-
-#include <sparc64/pci/ofw_pci.h>
-
-static u_int8_t pci_bus_cnt;
-static phandle_t *pci_bus_map;
-static int pci_bus_map_sz;
-
-#define	PCI_BUS_MAP_INC	10
-
-u_int8_t
-ofw_pci_alloc_busno(phandle_t node)
-{
-	phandle_t *om;
-	int osz;
-	u_int8_t n;
-
-	n = pci_bus_cnt++;
-	/* Establish a mapping between bus numbers and device nodes. */
-	if (n >= pci_bus_map_sz) {
-		osz = pci_bus_map_sz;
-		om = pci_bus_map;
-		pci_bus_map_sz = n + PCI_BUS_MAP_INC;
-		pci_bus_map = malloc(sizeof(*pci_bus_map) * pci_bus_map_sz,
-		    M_DEVBUF, M_WAITOK | M_ZERO);
-		if (om != NULL) {
-			bcopy(om, pci_bus_map, sizeof(*om) * osz);
-			free(om, M_DEVBUF);
-		}
-	}
-	pci_bus_map[n] = node;
-	return (n);
-}
Index: intr_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/intr_machdep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/intr_machdep.c -L sys/sparc64/sparc64/intr_machdep.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/intr_machdep.c
+++ sys/sparc64/sparc64/intr_machdep.c
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/intr_machdep.c,v 1.23.2.1 2006/03/10 19:37:35 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/intr_machdep.c,v 1.27.2.1 2007/11/26 15:06:50 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -88,7 +88,7 @@
 uint16_t intr_countp[IV_MAX];
 static u_long intr_stray_count[IV_MAX];
 
-static char *pil_names[] = {
+static const char *pil_names[] = {
 	"stray",
 	"low",		/* PIL_LOW */
 	"ithrd",	/* PIL_ITHREAD */
@@ -99,10 +99,11 @@
 	"fast",		/* PIL_FAST */
 	"tick",		/* PIL_TICK */
 };
-	
+
 /* protect the intr_vectors table */
 static struct mtx intr_table_lock;
 
+static void intr_enable_eoi(void *);
 static void intr_execute_handlers(void *);
 static void intr_stray_level(struct trapframe *);
 static void intr_stray_vector(void *);
@@ -219,6 +220,7 @@
 		intr_vectors[i].iv_arg = &intr_vectors[i];
 		intr_vectors[i].iv_pri = PIL_LOW;
 		intr_vectors[i].iv_vec = i;
+		intr_vectors[i].iv_refcnt = 0;
 	}
 	intr_handlers[PIL_LOW] = intr_fast;
 }
@@ -231,32 +233,59 @@
 }
 
 static void
+intr_enable_eoi(void *arg)
+{
+	struct intr_vector *iv;
+	const struct intr_controller *ic;
+
+	iv = arg;
+	ic = iv->iv_ic;
+	ic->ic_enable(iv);
+	ic->ic_eoi(iv);
+}
+
+static void
 intr_execute_handlers(void *cookie)
 {
 	struct intr_vector *iv;
+#ifndef INTR_FILTER
 	struct intr_event *ie;
 	struct intr_handler *ih;
-	int error, thread;
+	int error, thread, ret;
+#endif
 
 	iv = cookie;
+#ifndef INTR_FILTER
 	ie = iv->iv_event;
-	if (ie == NULL) {
+	if (iv->iv_ic == NULL || ie == NULL) {
 		intr_stray_vector(iv);
 		return;
 	}
 
 	/* Execute fast interrupt handlers directly. */
+	ret = 0;
 	thread = 0;
+	critical_enter();
 	TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
-		if (!(ih->ih_flags & IH_FAST)) {
+		if (ih->ih_filter == NULL) {
 			thread = 1;
 			continue;
 		}
-		MPASS(ih->ih_flags & IH_FAST && ih->ih_argument != NULL);
+		MPASS(ih->ih_filter != NULL && ih->ih_argument != NULL);
 		CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__,
-		    ih->ih_handler, ih->ih_argument);
-		ih->ih_handler(ih->ih_argument);
+		    ih->ih_filter, ih->ih_argument);
+		ret = ih->ih_filter(ih->ih_argument);
+		/*
+		 * Wrapper handler special case: see
+		 * i386/intr_machdep.c::intr_execute_handlers()
+		 */
+		if (!thread) {
+			if (ret == FILTER_SCHEDULE_THREAD)
+				thread = 1;
+		}
 	}
+	if (!thread)
+		intr_enable_eoi(iv);
 
 	/* Schedule a heavyweight interrupt process. */
 	if (thread)
@@ -265,56 +294,116 @@
 		error = EINVAL;
 	else
 		error = 0;
+	critical_exit();
 	if (error == EINVAL)
+#else
+	if (intr_event_handle(iv->iv_event, NULL) != 0)
+#endif
 		intr_stray_vector(iv);
 }
 
 int
-inthand_add(const char *name, int vec, void (*handler)(void *), void *arg,
-    int flags, void **cookiep)
+intr_controller_register(int vec, const struct intr_controller *ic,
+    void *icarg)
 {
+	struct intr_event *ie;
 	struct intr_vector *iv;
-	struct intr_event *ie;		/* descriptor for the IRQ */
-	struct intr_event *orphan;
-	int errcode;
+	int error;
 
+	iv = &intr_vectors[vec];
+	mtx_lock_spin(&intr_table_lock);
+	ie = iv->iv_event;
+	mtx_unlock_spin(&intr_table_lock);
+	if (ie != NULL)
+		return (EEXIST);
 	/*
-	 * Work around a race where more than one CPU may be registering
-	 * handlers on the same IRQ at the same time.
+	 * Testing shows that at least with the interrupt controllers of
+	 * Psycho and Schizo bridges enabling an interrupt doesn't cause
+	 * an outstanding interrupt to be issued to the CPU. Thus we can't
+	 * use a function doing disable+EOI for the "disable" pointer as
+	 * done on other architectures because this would lead to a lost
+	 * interrupt if it triggers while we are still processing the
+	 * previous one. Instead we use an enable+EOI approach because as
+	 * outlined in the Tomatillo documentation clearing an interrupt
+	 * in the interrupt controller causes it to be (re)issued to the
+	 * CPU as long as the source of a level sensitive interrupt is
+	 * not cleared.
 	 */
+	error = intr_event_create(&ie, iv, 0, intr_enable_eoi,
+#ifdef INTR_FILTER
+	    ic->ic_eoi, ic->ic_disable, "vec%d:", vec);
+#else
+	    "vec%d:", vec);
+#endif
+	if (error != 0)
+		return (error);
+	mtx_lock_spin(&intr_table_lock);
+	if (iv->iv_event != NULL) {
+		mtx_unlock_spin(&intr_table_lock);
+		intr_event_destroy(ie);
+		return (EEXIST);
+	}
+	iv->iv_ic = ic;
+	iv->iv_icarg = icarg;
+	iv->iv_event = ie;
+	iv->iv_mid = PCPU_GET(mid);
+	mtx_unlock_spin(&intr_table_lock);
+	return (0);
+}
+
+int
+inthand_add(const char *name, int vec, driver_filter_t *filt,
+    driver_intr_t *handler, void *arg, int flags, void **cookiep)
+{
+	const struct intr_controller *ic;
+	struct intr_event *ie;
+	struct intr_handler *ih;
+	struct intr_vector *iv;
+	int error, fast;
+
 	iv = &intr_vectors[vec];
 	mtx_lock_spin(&intr_table_lock);
+	ic = iv->iv_ic;
 	ie = iv->iv_event;
 	mtx_unlock_spin(&intr_table_lock);
-	if (ie == NULL) {
-		errcode = intr_event_create(&ie, (void *)(intptr_t)vec, 0, NULL,
-		    "vec%d:", vec);
-		if (errcode)
-			return (errcode);
-		mtx_lock_spin(&intr_table_lock);
-		if (iv->iv_event == NULL) {
-			iv->iv_event = ie;
-			mtx_unlock_spin(&intr_table_lock);
-		} else {
-			orphan = ie;
-			ie = iv->iv_event;
-			mtx_unlock_spin(&intr_table_lock);
-			intr_event_destroy(orphan);
-		}
-	}
+	if (ic == NULL || ie == NULL)
+		return (EINVAL);
 
-	errcode = intr_event_add_handler(ie, name, handler, arg,
+	error = intr_event_add_handler(ie, name, filt, handler, arg,
 	    intr_priority(flags), flags, cookiep);
-	if (errcode)
-		return (errcode);
-	
-	intr_setup(flags & INTR_FAST ? PIL_FAST : PIL_ITHREAD, intr_fast, vec,
-	    intr_execute_handlers, iv);
+	if (error != 0)
+		return (error);
 
+	mtx_lock_spin(&intr_table_lock);
+	/* Disable the interrupt while we fiddle with it. */
+	ic->ic_disable(iv);
+	iv->iv_refcnt++;
+	if (iv->iv_refcnt == 1)
+		intr_setup(filt != NULL ? PIL_FAST : PIL_ITHREAD, intr_fast,
+		    vec, intr_execute_handlers, iv);
+	else if (filt != NULL) {
+		/*
+		 * Check if we need to upgrade from PIL_ITHREAD to PIL_FAST.
+		 * Given that apart from the on-board SCCs and UARTs shared
+		 * interrupts are rather uncommon on sparc64 this sould be
+		 * pretty rare in practice.
+		 */
+		fast = 0;
+		TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
+			if (ih->ih_filter != NULL && ih->ih_filter != filt) {
+				fast = 1;
+				break;
+			}
+		}
+		if (fast == 0)
+			intr_setup(PIL_FAST, intr_fast, vec,
+			    intr_execute_handlers, iv);
+	}
 	intr_stray_count[vec] = 0;
-
 	intrcnt_updatename(vec, ie->ie_fullname, 0);
-
+	/* Ensure the interrupt is cleared, it might have triggered before. */
+	intr_enable_eoi(iv);
+	mtx_unlock_spin(&intr_table_lock);
 	return (0);
 }
 
@@ -323,22 +412,24 @@
 {
 	struct intr_vector *iv;
 	int error;
-	
+
 	error = intr_event_remove_handler(cookie);
 	if (error == 0) {
 		/*
 		 * XXX: maybe this should be done regardless of whether
 		 * intr_event_remove_handler() succeeded?
-		 * XXX: aren't the PIL's backwards below?
 		 */
 		iv = &intr_vectors[vec];
 		mtx_lock_spin(&intr_table_lock);
-		if (iv->iv_event == NULL)
-			intr_setup(PIL_ITHREAD, intr_fast, vec,
-			    intr_stray_vector, iv);
-		else
+		iv->iv_refcnt--;
+		if (iv->iv_refcnt == 0) {
+			/*
+			 * Don't disable the interrupt for now, so that
+			 * stray interrupts get detected...
+			 */
 			intr_setup(PIL_LOW, intr_fast, vec,
-			    intr_execute_handlers, iv);
+			    intr_stray_vector, iv);
+		}
 		mtx_unlock_spin(&intr_table_lock);
 	}
 	return (error);
Index: tick.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/tick.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/tick.c -L sys/sparc64/sparc64/tick.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/tick.c
+++ sys/sparc64/sparc64/tick.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/tick.c,v 1.16.2.1 2006/03/31 23:38:29 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/tick.c,v 1.22 2007/09/06 19:16:30 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -37,6 +37,7 @@
 #include <sys/timetc.h>
 
 #include <machine/clock.h>
+#include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/intr_machdep.h>
 #include <machine/tick.h>
@@ -62,7 +63,14 @@
 SYSCTL_INT(_machdep_tick, OID_AUTO, adjust_ticks, CTLFLAG_RD, &adjust_ticks,
     0, "total number of tick interrupts with adjustment");
 
-static void tick_hardclock(struct clockframe *);
+static void tick_hardclock(struct trapframe *);
+
+static uint64_t
+tick_cputicks(void)
+{
+
+	return (rd(tick));
+}
 
 void
 cpu_initclocks(void)
@@ -73,20 +81,20 @@
 }
 
 static __inline void
-tick_process(struct clockframe *cf)
+tick_process(struct trapframe *tf)
 {
 
 	if (PCPU_GET(cpuid) == 0)
-		hardclock(cf);
+		hardclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
 	else
-		hardclock_process(cf);
+		hardclock_cpu(TRAPF_USERMODE(tf));
 	if (profprocs != 0)
-		profclock(cf);
-	statclock(cf);
+		profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+	statclock(TRAPF_USERMODE(tf));
 }
 
 static void
-tick_hardclock(struct clockframe *cf)
+tick_hardclock(struct trapframe *tf)
 {
 	u_long adj, s, tick, ref;
 	long delta;
@@ -99,6 +107,7 @@
 	 * the past could be written in the worst case, causing hardclock to
 	 * stop.
 	 */
+	critical_enter();
 	adj = PCPU_GET(tickadj);
 	s = intr_disable();
 	tick = rd(tick);
@@ -108,7 +117,7 @@
 	delta = tick - ref;
 	count = 0;
 	while (delta >= tick_increment) {
-		tick_process(cf);
+		tick_process(tf);
 		delta -= tick_increment;
 		ref += tick_increment;
 		if (adj != 0)
@@ -129,6 +138,7 @@
 	}
 	PCPU_SET(tickref, ref);
 	PCPU_SET(tickadj, adj);
+	critical_exit();
 }
 
 void
@@ -148,6 +158,8 @@
 	 * handled.
 	 */
 	tick_stop();
+
+	set_cputicker(tick_cputicks, tick_freq, 0);
 }
 
 void
@@ -168,8 +180,7 @@
 		    tick_freq / TICK_GRACE);
 
 	if (PCPU_GET(cpuid) == 0)
-		intr_setup(PIL_TICK, (ih_func_t *)tick_hardclock, -1, NULL,
-		    NULL);
+		intr_setup(PIL_TICK, tick_hardclock, -1, NULL, NULL);
 
 	/*
 	 * Try to make the tick interrupts as synchronously as possible on
@@ -190,6 +201,6 @@
 {
 
 	if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
-		wr(asr24, 1L << 63, 0);
+		wr(asr25, 1L << 63, 0);
 	wrtickcmpr(1L << 63, 0);
 }
Index: mp_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/mp_machdep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/mp_machdep.c -L sys/sparc64/sparc64/mp_machdep.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/mp_machdep.c
+++ sys/sparc64/sparc64/mp_machdep.c
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.29.2.1 2006/03/31 23:48:12 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.36 2007/06/16 23:26:00 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,6 +65,7 @@
 #include <sys/mutex.h>
 #include <sys/pcpu.h>
 #include <sys/proc.h>
+#include <sys/sched.h>
 #include <sys/smp.h>
 
 #include <vm/vm.h>
@@ -82,82 +83,102 @@
 #include <machine/md_var.h>
 #include <machine/metadata.h>
 #include <machine/ofw_machdep.h>
+#include <machine/pcb.h>
 #include <machine/smp.h>
 #include <machine/tick.h>
 #include <machine/tlb.h>
 #include <machine/tte.h>
+#include <machine/ver.h>
 
 static ih_func_t cpu_ipi_ast;
 static ih_func_t cpu_ipi_stop;
 
 /*
  * Argument area used to pass data to non-boot processors as they start up.
- * This must be statically initialized with a known invalid upa module id,
- * since the other processors will use it before the boot cpu enters the
+ * This must be statically initialized with a known invalid CPU module ID,
+ * since the other processors will use it before the boot CPU enters the
  * kernel.
  */
 struct	cpu_start_args cpu_start_args = { 0, -1, -1, 0, 0 };
 struct	ipi_cache_args ipi_cache_args;
 struct	ipi_tlb_args ipi_tlb_args;
+struct	pcb stoppcbs[MAXCPU];
 
 struct	mtx ipi_mtx;
 
-vm_offset_t mp_tramp;
+cpu_ipi_selected_t *cpu_ipi_selected;
 
-u_int	mp_boot_mid;
+static vm_offset_t mp_tramp;
+static u_int cpuid_to_mid[MAXCPU];
+static int isjbus;
+static volatile u_int shutdown_cpus;
+
+static void cpu_mp_unleash(void *v);
+static void spitfire_ipi_send(u_int, u_long, u_long, u_long);
+static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg);
+static void sun4u_stopself(void);
 
-static u_int		cpuid_to_mid[MAXCPU];
-static volatile u_int	shutdown_cpus;
+static cpu_ipi_selected_t cheetah_ipi_selected;
+static cpu_ipi_selected_t spitfire_ipi_selected;
 
-void cpu_mp_unleash(void *);
 SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
 
-vm_offset_t
-mp_tramp_alloc(void)
+CTASSERT(MAXCPU <= IDR_CHEETAH_MAX_BN_PAIRS);
+CTASSERT(MAXCPU <= sizeof(u_int) * NBBY);
+CTASSERT(MAXCPU <= sizeof(int) * NBBY);
+
+void
+mp_init(void)
 {
 	struct tte *tp;
-	char *v;
 	int i;
 
-	v = OF_claim(NULL, PAGE_SIZE, PAGE_SIZE);
-	if (v == NULL)
-		panic("mp_tramp_alloc");
-	bcopy(mp_tramp_code, v, mp_tramp_code_len);
-	*(u_long *)(v + mp_tramp_tlb_slots) = kernel_tlb_slots;
-	*(u_long *)(v + mp_tramp_func) = (u_long)mp_startup;
-	tp = (struct tte *)(v + mp_tramp_code_len);
+	mp_tramp = (vm_offset_t)OF_claim(NULL, PAGE_SIZE, PAGE_SIZE);
+	if (mp_tramp == (vm_offset_t)-1)
+		panic("%s", __func__);
+	bcopy(mp_tramp_code, (void *)mp_tramp, mp_tramp_code_len);
+	*(vm_offset_t *)(mp_tramp + mp_tramp_tlb_slots) = kernel_tlb_slots;
+	*(vm_offset_t *)(mp_tramp + mp_tramp_func) = (vm_offset_t)mp_startup;
+	tp = (struct tte *)(mp_tramp + mp_tramp_code_len);
 	for (i = 0; i < kernel_tlb_slots; i++) {
 		tp[i].tte_vpn = TV_VPN(kernel_tlbs[i].te_va, TS_4M);
 		tp[i].tte_data = TD_V | TD_4M | TD_PA(kernel_tlbs[i].te_pa) |
 		    TD_L | TD_CP | TD_CV | TD_P | TD_W;
 	}
-	for (i = 0; i < PAGE_SIZE; i += sizeof(long))
-		flush(v + i);
-	return (vm_offset_t)v;
+	for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t))
+		flush(mp_tramp + i);
+
+	/*
+	 * On UP systems cpu_ipi_selected() can be called while
+	 * cpu_mp_start() wasn't so initialize these here.
+	 */
+	if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi ||
+	    cpu_impl == CPU_IMPL_ULTRASPARCIIIip)
+		isjbus = 1;
+	if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
+		cpu_ipi_selected = cheetah_ipi_selected;
+	else
+		cpu_ipi_selected = spitfire_ipi_selected;
 }
 
 /*
- * Probe for other cpus.
+ * Probe for other CPUs.
  */
 void
 cpu_mp_setmaxid(void)
 {
-	phandle_t child;
-	phandle_t root;
 	char buf[128];
+	phandle_t child;
 	int cpus;
 
-	all_cpus = 1 << PCPU_GET(cpuid);
-	mp_boot_mid = PCPU_GET(mid);
+	all_cpus = 1 << curcpu;
 	mp_ncpus = 1;
 
 	cpus = 0;
-	root = OF_peer(0);
-	for (child = OF_child(root); child != 0; child = OF_peer(child)) {
+	for (child = OF_child(OF_peer(0)); child != 0; child = OF_peer(child))
 		if (OF_getprop(child, "device_type", buf, sizeof(buf)) > 0 &&
 		    strcmp(buf, "cpu") == 0)
 			cpus++;
-	}
 	mp_maxid = cpus - 1;
 }
 
@@ -181,10 +202,6 @@
 	} args = {
 		(cell_t)"SUNW,start-cpu",
 		3,
-		0,
-		0,
-		0,
-		0
 	};
 
 	args.cpu = cpu;
@@ -205,12 +222,10 @@
 		cell_t	nreturns;
 	} args = {
 		(cell_t)"SUNW,stop-self",
-		0,
-		0,
 	};
 
 	openfirmware_exit(&args);
-	panic("sun4u_stopself: failed.");
+	panic("%s: failed.", __func__);
 }
 
 /*
@@ -219,16 +234,15 @@
 void
 cpu_mp_start(void)
 {
+	char buf[128];
 	volatile struct cpu_start_args *csa;
 	struct pcpu *pc;
-	phandle_t child;
-	phandle_t root;
+	register_t s;
 	vm_offset_t va;
-	char buf[128];
+	phandle_t child;
 	u_int clock;
-	int cpuid;
 	u_int mid;
-	u_long s;
+	int cpuid;
 
 	mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN);
 
@@ -237,22 +251,22 @@
 	    -1, NULL, NULL);
 	intr_setup(PIL_STOP, cpu_ipi_stop, -1, NULL, NULL);
 
-	cpuid_to_mid[PCPU_GET(cpuid)] = mp_boot_mid;
+	cpuid_to_mid[curcpu] = PCPU_GET(mid);
 
-	root = OF_peer(0);
 	csa = &cpu_start_args;
-	for (child = OF_child(root); child != 0; child = OF_peer(child)) {
+	for (child = OF_child(OF_peer(0)); child != 0 && mp_ncpus <= MAXCPU;
+	    child = OF_peer(child)) {
 		if (OF_getprop(child, "device_type", buf, sizeof(buf)) <= 0 ||
 		    strcmp(buf, "cpu") != 0)
 			continue;
-		if (OF_getprop(child, "upa-portid", &mid, sizeof(mid)) <= 0 &&
-		    OF_getprop(child, "portid", &mid, sizeof(mid)) <= 0)
-			panic("cpu_mp_start: can't get module id");
-		if (mid == mp_boot_mid)
+		if (OF_getprop(child, cpu_impl < CPU_IMPL_ULTRASPARCIII ?
+		    "upa-portid" : "portid", &mid, sizeof(mid)) <= 0)
+			panic("%s: can't get module ID", __func__);
+		if (mid == PCPU_GET(mid))
 			continue;
 		if (OF_getprop(child, "clock-frequency", &clock,
 		    sizeof(clock)) <= 0)
-			panic("cpu_mp_start: can't get clock");
+			panic("%s: can't get clock", __func__);
 
 		csa->csa_state = 0;
 		sun4u_startcpu(child, (void *)mp_tramp, 0);
@@ -279,25 +293,29 @@
 
 		all_cpus |= 1 << cpuid;
 	}
-	PCPU_SET(other_cpus, all_cpus & ~(1 << PCPU_GET(cpuid)));
+	KASSERT(!isjbus || mp_ncpus <= IDR_JALAPENO_MAX_BN_PAIRS,
+	    ("%s: can only IPI a maximum of %d JBus-CPUs",
+	    __func__, IDR_JALAPENO_MAX_BN_PAIRS));
+	PCPU_SET(other_cpus, all_cpus & ~(1 << curcpu));
 	smp_active = 1;
 }
 
 void
 cpu_mp_announce(void)
 {
+
 }
 
-void
+static void
 cpu_mp_unleash(void *v)
 {
 	volatile struct cpu_start_args *csa;
 	struct pcpu *pc;
+	register_t s;
 	vm_offset_t va;
 	vm_paddr_t pa;
 	u_int ctx_min;
 	u_int ctx_inc;
-	u_long s;
 	int i;
 
 	ctx_min = TLB_CTX_USER_MIN;
@@ -310,17 +328,17 @@
 		pc->pc_tlb_ctx_max = ctx_min + ctx_inc;
 		ctx_min += ctx_inc;
 
-		if (pc->pc_cpuid == PCPU_GET(cpuid))
+		if (pc->pc_cpuid == curcpu)
 			continue;
 		KASSERT(pc->pc_idlethread != NULL,
-		    ("cpu_mp_unleash: idlethread"));
-		pc->pc_curthread = pc->pc_idlethread;	
+		    ("%s: idlethread", __func__));
+		pc->pc_curthread = pc->pc_idlethread;
 		pc->pc_curpcb = pc->pc_curthread->td_pcb;
 		for (i = 0; i < PCPU_PAGES; i++) {
 			va = pc->pc_addr + i * PAGE_SIZE;
 			pa = pmap_kextract(va);
 			if (pa == 0)
-				panic("cpu_mp_unleash: pmap_kextract\n");
+				panic("%s: pmap_kextract", __func__);
 			csa->csa_ttes[i].tte_vpn = TV_VPN(va, TS_8K);
 			csa->csa_ttes[i].tte_data = TD_V | TD_8K | TD_PA(pa) |
 			    TD_L | TD_CP | TD_CV | TD_P | TD_W;
@@ -335,7 +353,7 @@
 	}
 
 	membar(StoreLoad);
-	csa->csa_count = 0; 
+	csa->csa_count = 0;
 	smp_started = 1;
 }
 
@@ -350,9 +368,9 @@
 	tick_start();
 
 	smp_cpus++;
-	KASSERT(curthread != NULL, ("cpu_mp_bootstrap: curthread"));
-	PCPU_SET(other_cpus, all_cpus & ~(1 << PCPU_GET(cpuid)));
-	printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
+	KASSERT(curthread != NULL, ("%s: curthread", __func__));
+	PCPU_SET(other_cpus, all_cpus & ~(1 << curcpu));
+	printf("SMP: AP CPU #%d Launched!\n", curcpu);
 
 	csa->csa_count--;
 	membar(StoreLoad);
@@ -360,12 +378,8 @@
 	while (csa->csa_count != 0)
 		;
 
-	/* ok, now grab sched_lock and enter the scheduler */
-	mtx_lock_spin(&sched_lock);
-	spinlock_exit();
-	binuptime(PCPU_PTR(switchtime));
-	PCPU_SET(switchticks, ticks);
-	cpu_throw(NULL, choosethread());	/* doesn't return */
+	/* ok, now enter the scheduler */
+	sched_throw(NULL);
 }
 
 void
@@ -392,13 +406,15 @@
 static void
 cpu_ipi_ast(struct trapframe *tf)
 {
+
 }
 
 static void
 cpu_ipi_stop(struct trapframe *tf)
 {
 
-	CTR1(KTR_SMP, "cpu_ipi_stop: stopped %d", PCPU_GET(cpuid));
+	CTR2(KTR_SMP, "%s: stopped %d", __func__, curcpu);
+	savectx(&stoppcbs[curcpu]);
 	atomic_set_acq_int(&stopped_cpus, PCPU_GET(cpumask));
 	while ((started_cpus & PCPU_GET(cpumask)) == 0) {
 		if ((shutdown_cpus & PCPU_GET(cpumask)) != 0) {
@@ -408,36 +424,40 @@
 	}
 	atomic_clear_rel_int(&started_cpus, PCPU_GET(cpumask));
 	atomic_clear_rel_int(&stopped_cpus, PCPU_GET(cpumask));
-	CTR1(KTR_SMP, "cpu_ipi_stop: restarted %d", PCPU_GET(cpuid));
+	CTR2(KTR_SMP, "%s: restarted %d", __func__, curcpu);
 }
 
-void
-cpu_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2)
+static void
+spitfire_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2)
 {
 	u_int cpu;
 
+	KASSERT((cpus & (1 << curcpu)) == 0,
+	    ("%s: CPU can't IPI itself", __func__));
 	while (cpus) {
 		cpu = ffs(cpus) - 1;
 		cpus &= ~(1 << cpu);
-		cpu_ipi_send(cpuid_to_mid[cpu], d0, d1, d2);
+		spitfire_ipi_send(cpuid_to_mid[cpu], d0, d1, d2);
 	}
 }
 
-void
-cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2)
+static void
+spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2)
 {
+	register_t s;
 	u_long ids;
-	u_long s;
 	int i;
 
 	KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0,
-	    ("cpu_ipi_send: outstanding dispatch"));
+	    ("%s: outstanding dispatch", __func__));
 	for (i = 0; i < IPI_RETRIES; i++) {
 		s = intr_disable();
 		stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0);
 		stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1);
 		stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2);
-		stxa(AA_INTR_SEND | (mid << 14), ASI_SDB_INTR_W, 0);
+		membar(Sync);
+		stxa(AA_INTR_SEND | (mid << IDC_ITID_SHIFT),
+		    ASI_SDB_INTR_W, 0);
 		/*
 		 * Workaround for SpitFire erratum #54; do a dummy read
 		 * from a SDB internal register before the MEMBAR #Sync
@@ -448,36 +468,115 @@
 		membar(Sync);
 		(void)ldxa(AA_SDB_CNTL_HIGH, ASI_SDB_CONTROL_R);
 		membar(Sync);
-		while ((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) & IDR_BUSY)
+		while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) &
+		    IDR_BUSY) != 0)
+			;
+		intr_restore(s);
+		if ((ids & (IDR_BUSY | IDR_NACK)) == 0)
+			return;
+		/*
+		 * Leave interrupts enabled for a bit before retrying
+		 * in order to avoid deadlocks if the other CPU is also
+		 * trying to send an IPI.
+		 */
+		DELAY(2);
+	}
+	if (
+#ifdef KDB
+	    kdb_active ||
+#endif
+	    panicstr != NULL)
+		printf("%s: couldn't send IPI to module 0x%u\n",
+		    __func__, mid);
+	else
+		panic("%s: couldn't send IPI", __func__);
+}
+
+static void
+cheetah_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2)
+{
+	register_t s;
+	u_long ids;
+	u_int bnp;
+	u_int cpu;
+	int i;
+
+	KASSERT((cpus & (1 << curcpu)) == 0,
+	    ("%s: CPU can't IPI itself", __func__));
+	KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) &
+	    IDR_CHEETAH_ALL_BUSY) == 0,
+	    ("%s: outstanding dispatch", __func__));
+	if (cpus == 0)
+		return;
+	ids = 0;
+	for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) {
+		s = intr_disable();
+		stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0);
+		stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1);
+		stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2);
+		membar(Sync);
+		bnp = 0;
+		for (cpu = 0; cpu < mp_ncpus; cpu++) {
+			if ((cpus & (1 << cpu)) != 0) {
+				stxa(AA_INTR_SEND |
+				    (cpuid_to_mid[cpu] << IDC_ITID_SHIFT) |
+				    (isjbus ? 0 : bnp << IDC_BN_SHIFT),
+				    ASI_SDB_INTR_W, 0);
+				membar(Sync);
+				bnp++;
+			}
+		}
+		while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) &
+		    IDR_CHEETAH_ALL_BUSY) != 0)
 			;
 		intr_restore(s);
-		if ((ids & IDR_NACK) == 0)
+		if ((ids & (IDR_CHEETAH_ALL_BUSY | IDR_CHEETAH_ALL_NACK)) == 0)
 			return;
+		bnp = 0;
+		for (cpu = 0; cpu < mp_ncpus; cpu++) {
+			if ((cpus & (1 << cpu)) != 0) {
+				if ((ids & (IDR_NACK << (isjbus ?
+				    (2 * cpuid_to_mid[cpu]) :
+				    (2 * bnp)))) == 0)
+					cpus &= ~(1 << cpu);
+				bnp++;
+			}
+		}
+		/*
+		 * Leave interrupts enabled for a bit before retrying
+		 * in order to avoid deadlocks if the other CPUs are
+		 * also trying to send IPIs.
+		 */
+		DELAY(2 * bnp);
 	}
 	if (
 #ifdef KDB
 	    kdb_active ||
 #endif
 	    panicstr != NULL)
-		printf("cpu_ipi_send: couldn't send ipi to module %u\n", mid);
+		printf("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)\n",
+		    __func__, cpus, ids);
 	else
-		panic("cpu_ipi_send: couldn't send ipi");
+		panic("%s: couldn't send IPI", __func__);
 }
 
 void
 ipi_selected(u_int cpus, u_int ipi)
 {
+
 	cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi);
 }
 
 void
 ipi_all(u_int ipi)
 {
-	panic("ipi_all");
+
+	panic("%s", __func__);
 }
 
 void
 ipi_all_but_self(u_int ipi)
 {
+
 	cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)tl_ipi_level, ipi);
 }
Index: exception.S
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/exception.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/exception.S -L sys/sparc64/sparc64/exception.S -u -r1.2 -r1.3
--- sys/sparc64/sparc64/exception.S
+++ sys/sparc64/sparc64/exception.S
@@ -54,17 +54,23 @@
  */
 
 #include <machine/asm.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/exception.S,v 1.70.2.2.2.1 2006/04/25 19:37:03 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/exception.S,v 1.75 2007/09/06 19:16:30 marius Exp $");
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
 
 #include <machine/asi.h>
 #include <machine/asmacros.h>
+#include <machine/frame.h>
+#include <machine/fsr.h>
+#include <machine/intr_machdep.h>
 #include <machine/ktr.h>
+#include <machine/pcb.h>
 #include <machine/pstate.h>
 #include <machine/trap.h>
+#include <machine/tsb.h>
 #include <machine/tstate.h>
+#include <machine/utrap.h>
 #include <machine/wstate.h>
 
 #include "assym.s"
@@ -2324,9 +2330,6 @@
 	stx	%i6, [%sp + SPOFF + CCFSZ + TF_O6]
 	stx	%i7, [%sp + SPOFF + CCFSZ + TF_O7]
 
-	call	critical_enter
-	 nop
-
 	SET(intr_handlers, %l1, %l0)
 	sllx	%l3, IH_SHIFT, %l1
 	ldx	[%l0 + %l1], %l1
@@ -2334,9 +2337,6 @@
 	call	%l1
 	 add	%sp, CCFSZ + SPOFF, %o0
 
-	call	critical_exit
-	 nop
-
 	/* %l3 contains PIL */
 	SET(intrcnt, %l1, %l2)
 	prefetcha [%l2] ASI_N, 1
@@ -2841,9 +2841,6 @@
 	mov	%l5, PCPU_REG
 	wrpr	%g0, PSTATE_KERNEL, %pstate
 
-	call	critical_enter
-	 nop
-
 	SET(intr_handlers, %l5, %l4)
 	sllx	%l7, IH_SHIFT, %l5
 	ldx	[%l4 + %l5], %l5
@@ -2851,9 +2848,6 @@
 	call	%l5
 	 add	%sp, CCFSZ + SPOFF, %o0
 
-	call	critical_exit
-	 nop
-
 	/* %l7 contains PIL */
 	SET(intrcnt, %l5, %l4)
 	prefetcha [%l4] ASI_N, 1
Index: machdep.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/machdep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/machdep.c -L sys/sparc64/sparc64/machdep.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/machdep.c
+++ sys/sparc64/sparc64/machdep.c
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/machdep.c,v 1.125.2.2 2006/03/31 23:40:05 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/machdep.c,v 1.138.4.1 2008/01/19 18:15:06 kib Exp $");
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
@@ -354,18 +354,26 @@
 	}
 
 	cache_init(child);
+	uma_set_align(cache.dc_linesize - 1);
 
+	cpu_block_copy = bcopy;
+	cpu_block_zero = bzero;
 	getenv_int("machdep.use_vis", &cpu_use_vis);
 	if (cpu_use_vis) {
-		cpu_block_copy = spitfire_block_copy;
-		cpu_block_zero = spitfire_block_zero;
-	} else {
-		cpu_block_copy = bcopy;
-		cpu_block_zero = bzero;
+		switch (cpu_impl) {
+		case CPU_IMPL_SPARC64:
+		case CPU_IMPL_ULTRASPARCI:
+		case CPU_IMPL_ULTRASPARCII:
+		case CPU_IMPL_ULTRASPARCIIi:
+		case CPU_IMPL_ULTRASPARCIIe:
+			cpu_block_copy = spitfire_block_copy;
+			cpu_block_zero = spitfire_block_zero;
+			break;
+		}
 	}
 
 #ifdef SMP
-	mp_tramp = mp_tramp_alloc();
+	mp_init();
 #endif
 
 	/*
@@ -391,7 +399,7 @@
 	/*
 	 * Initialize proc0 stuff (p_contested needs to be done early).
 	 */
-	proc_linkup(&proc0, &ksegrp0, &thread0);
+	proc_linkup0(&proc0, &thread0);
 	proc0.p_md.md_sigtramp = NULL;
 	proc0.p_md.md_utrap = NULL;
 	thread0.td_kstack = kstack0;
@@ -452,7 +460,7 @@
 }
 
 void
-sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
+sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 {
 	struct trapframe *tf;
 	struct sigframe *sfp;
@@ -463,11 +471,13 @@
 	struct proc *p;
 	int oonstack;
 	u_long sp;
+	int sig;
 
 	oonstack = 0;
 	td = curthread;
 	p = td->td_proc;
 	PROC_LOCK_ASSERT(p, MA_OWNED);
+	sig = ksi->ksi_signo;
 	psp = p->p_sigacts;
 	mtx_assert(&psp->ps_mtx, MA_OWNED);
 	tf = td->td_frame;
@@ -480,7 +490,7 @@
 	/* Make sure we have a signal trampoline to return to. */
 	if (p->p_md.md_sigtramp == NULL) {
 		/*
-		 * No signal tramoline... kill the process.
+		 * No signal trampoline... kill the process.
 		 */
 		CTR0(KTR_SIG, "sendsig: no sigtramp");
 		printf("sendsig: %s is too old, rebuild it\n", p->p_comm);
@@ -514,13 +524,20 @@
 
 	/* Build the argument list for the signal handler. */
 	tf->tf_out[0] = sig;
-	tf->tf_out[1] = (register_t)&sfp->sf_si;
 	tf->tf_out[2] = (register_t)&sfp->sf_uc;
 	tf->tf_out[4] = (register_t)catcher;
-	/* Fill siginfo structure. */
-	sf.sf_si.si_signo = sig;
-	sf.sf_si.si_code = code;
-	sf.sf_si.si_addr = (void *)tf->tf_sfar;
+	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
+		/* Signal handler installed with SA_SIGINFO. */
+		tf->tf_out[1] = (register_t)&sfp->sf_si;
+
+		/* Fill in POSIX parts. */
+		sf.sf_si = ksi->ksi_info;
+		sf.sf_si.si_signo = sig; /* maybe a translated signal */
+	} else {
+		/* Old FreeBSD-style arguments. */
+		tf->tf_out[1] = ksi->ksi_code;
+		tf->tf_out[3] = (register_t)ksi->ksi_addr;
+	}
 
 	/* Copy the sigframe out to the user's stack. */
 	if (rwindow_save(td) != 0 || copyout(&sf, sfp, sizeof(*sfp)) != 0 ||
@@ -546,25 +563,6 @@
 	mtx_lock(&psp->ps_mtx);
 }
 
-/*
- * Build siginfo_t for SA thread
- */
-void
-cpu_thread_siginfo(int sig, u_long code, siginfo_t *si)
-{
-	struct proc *p;
-	struct thread *td;
-
-	td = curthread;
-	p = td->td_proc;
-	PROC_LOCK_ASSERT(p, MA_OWNED);
-
-	bzero(si, sizeof(*si));
-	si->si_signo = sig;
-	si->si_code = code;
-	/* XXXKSE fill other fields */
-}
-
 #ifndef	_SYS_SYSPROTO_H_
 struct sigreturn_args {
 	ucontext_t *ucp;
Index: eeprom.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/eeprom.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/eeprom.c -L sys/sparc64/sparc64/eeprom.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/eeprom.c
+++ sys/sparc64/sparc64/eeprom.c
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/eeprom.c,v 1.9.2.1 2006/03/25 12:17:23 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/eeprom.c,v 1.13 2007/07/23 09:42:32 dwmalone Exp $");
 
 /*
  * clock (eeprom) attaches at EBus, FireHose or SBus
@@ -68,7 +68,6 @@
 #include <dev/ofw/ofw_bus.h>
 
 #include <machine/bus.h>
-#include <machine/idprom.h>
 #include <machine/resource.h>
 #include <machine/ver.h>
 
@@ -78,8 +77,6 @@
 
 #include "clock_if.h"
 
-#define	IDPROM_OFFSET	40
-
 static devclass_t eeprom_devclass;
 
 static device_probe_t eeprom_probe;
@@ -124,11 +121,9 @@
 	struct mk48txx_softc *sc;
 	struct resource *res;
 	struct timespec ts;
-	uint32_t h;
-	int error, i, rid;
+	int error, rid;
 
 	sc = device_get_softc(dev);
-	bzero(sc, sizeof(struct mk48txx_softc));
 
 	mtx_init(&sc->sc_mtx, "eeprom_mtx", NULL, MTX_DEF);
 
@@ -174,30 +169,12 @@
 		goto fail_res;
 	}
 
-	/*
-	 * Get the hostid from the NVRAM. This serves no real purpose other
-	 * than being able to display it below as not all sparc64 models
-	 * have an `eeprom' device and even some that do store the hostid
-	 * elsewhere. The hostid in the NVRAM of the MK48Txx reads all zero
-	 * on the latter models. A generic way to retrieve the hostid is to
-	 * use the `idprom' node.
-	 */
-	mtx_lock(&sc->sc_mtx);
-	h = bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_nvramsz -
-	    IDPROM_OFFSET + offsetof(struct idprom, id_machine)) << 24;
-	for (i = 0; i < 3; i++) {
-		h |= bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_nvramsz -
-		    IDPROM_OFFSET + offsetof(struct idprom, id_hostid[i])) <<
-		    ((2 - i) * 8);
-	}
-	mtx_unlock(&sc->sc_mtx);
-	if (h != 0)
-		device_printf(dev, "hostid %x\n", (u_int)h);
-
 	if (bootverbose) {
-		mk48txx_gettime(dev, &ts);
-		device_printf(dev, "current time: %ld.%09ld\n", (long)ts.tv_sec,
-		    ts.tv_nsec);
+		if (mk48txx_gettime(dev, &ts) != 0)
+			device_printf(dev, "invalid time");
+		else
+			device_printf(dev, "current time: %ld.%09ld\n",
+			    (long)ts.tv_sec, ts.tv_nsec);
 	}
 
 	return (0);
Index: db_trace.c
===================================================================
RCS file: /home/cvs/src/sys/sparc64/sparc64/db_trace.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sparc64/sparc64/db_trace.c -L sys/sparc64/sparc64/db_trace.c -u -r1.2 -r1.3
--- sys/sparc64/sparc64/db_trace.c
+++ sys/sparc64/sparc64/db_trace.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/db_trace.c,v 1.23.2.1 2006/03/13 03:07:05 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/db_trace.c,v 1.26 2006/07/12 21:22:44 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,7 +103,7 @@
  * User stack trace (debugging aid).
  */
 static void
-db_utrace(struct thread *td, struct trapframe *tf, int count, int *quitp)
+db_utrace(struct thread *td, struct trapframe *tf, int count)
 {
 	struct pcb *pcb;
 	db_addr_t sp, rsp, o7, pc;
@@ -115,7 +115,7 @@
 	    FALSE);
 	pc = db_get_value((db_addr_t)&tf->tf_tpc, sizeof(tf->tf_tpc), FALSE);
 	db_printf("user trace: trap %%o7=%#lx\n", o7);
-	while (count-- && sp != 0 && !*quitp) {
+	while (count-- && sp != 0 && !db_pager_quit) {
 		db_printf("pc %#lx, sp %#lx\n", pc, sp);
 		/* First, check whether the frame is in the pcb. */
 		found = 0;
@@ -141,7 +141,7 @@
 }
 
 static int
-db_print_trap(struct thread *td, struct trapframe *tf, int count, int *quitp)
+db_print_trap(struct thread *td, struct trapframe *tf, int count)
 {
 	struct proc *p;
 	const char *symname;
@@ -219,7 +219,7 @@
 		db_printf("userland() at ");
 		db_printsym(tpc, DB_STGY_PROC);
 		db_printf("\n");
-		db_utrace(td, tf, count, quitp);
+		db_utrace(td, tf, count);
 	}
 	return (user);
 }
@@ -236,7 +236,6 @@
 	db_addr_t pc;
 	int trap;
 	int user;
-	int quit;
 
 	if (count == -1)
 		count = 1024;
@@ -244,9 +243,7 @@
 	trap = 0;
 	user = 0;
 	npc = 0;
-	quit = 0;
-	db_setup_paging(db_simple_pager, &quit, db_lines_per_page);
-	while (count-- && !user && !quit) {
+	while (count-- && !user && !db_pager_quit) {
 		pc = (db_addr_t)db_get_value((db_addr_t)&fp->fr_pc,
 		    sizeof(fp->fr_pc), FALSE);
 		if (trap) {
@@ -272,7 +269,7 @@
 			tf = (struct trapframe *)(fp + 1);
 			npc = db_get_value((db_addr_t)&tf->tf_tpc,
 			    sizeof(tf->tf_tpc), FALSE);
-			user = db_print_trap(td, tf, count, &quit);
+			user = db_print_trap(td, tf, count);
 			trap = 1;
 		} else {
 			db_printf("%s() at ", name);


More information about the Midnightbsd-cvs mailing list