svn commit: r208191 - in projects/ppc64: cddl/contrib/opensolaris/lib/libzpool/common/sys lib/libarchive sbin/geom/class/part sys/amd64/amd64 sys/arm/arm sys/cddl/contrib/opensolaris/uts/common/fs/...

Nathan Whitehorn nwhitehorn at FreeBSD.org
Mon May 17 14:00:48 UTC 2010


Author: nwhitehorn
Date: Mon May 17 14:00:46 2010
New Revision: 208191
URL: http://svn.freebsd.org/changeset/base/208191

Log:
  IFC @ 208190

Modified:
  projects/ppc64/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  projects/ppc64/lib/libarchive/Makefile
  projects/ppc64/lib/libarchive/config_freebsd.h
  projects/ppc64/sbin/geom/class/part/geom_part.c
  projects/ppc64/sys/amd64/amd64/pmap.c
  projects/ppc64/sys/arm/arm/pmap.c
  projects/ppc64/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  projects/ppc64/sys/conf/files
  projects/ppc64/sys/dev/ata/chipsets/ata-serverworks.c
  projects/ppc64/sys/dev/ofw/ofw_if.m
  projects/ppc64/sys/dev/ofw/ofw_standard.c
  projects/ppc64/sys/dev/ofw/openfirm.c
  projects/ppc64/sys/dev/ofw/openfirm.h
  projects/ppc64/sys/geom/part/g_part_apm.c
  projects/ppc64/sys/i386/i386/pmap.c
  projects/ppc64/sys/i386/xen/pmap.c
  projects/ppc64/sys/ia64/ia64/pmap.c
  projects/ppc64/sys/kern/sched_ule.c
  projects/ppc64/sys/kern/subr_smp.c
  projects/ppc64/sys/mips/conf/XLR
  projects/ppc64/sys/mips/include/locore.h
  projects/ppc64/sys/mips/include/param.h
  projects/ppc64/sys/mips/include/smp.h
  projects/ppc64/sys/mips/mips/cpu.c
  projects/ppc64/sys/mips/mips/machdep.c
  projects/ppc64/sys/mips/mips/mp_machdep.c
  projects/ppc64/sys/mips/mips/mpboot.S
  projects/ppc64/sys/mips/mips/pmap.c
  projects/ppc64/sys/mips/rmi/dev/xlr/rge.c
  projects/ppc64/sys/mips/rmi/files.xlr
  projects/ppc64/sys/mips/rmi/interrupt.h
  projects/ppc64/sys/mips/rmi/intr_machdep.c
  projects/ppc64/sys/mips/rmi/iodi.c
  projects/ppc64/sys/mips/rmi/on_chip.c
  projects/ppc64/sys/mips/rmi/pic.h
  projects/ppc64/sys/mips/rmi/xlr_machdep.c
  projects/ppc64/sys/mips/rmi/xlr_pci.c
  projects/ppc64/sys/mips/rmi/xlrconfig.h
  projects/ppc64/sys/modules/mvs/Makefile
  projects/ppc64/sys/net/flowtable.c
  projects/ppc64/sys/net/flowtable.h
  projects/ppc64/sys/netinet/sctp_bsd_addr.c
  projects/ppc64/sys/netinet/sctp_bsd_addr.h
  projects/ppc64/sys/netinet/sctp_constants.h
  projects/ppc64/sys/netinet/sctp_lock_bsd.h
  projects/ppc64/sys/netinet/sctp_pcb.c
  projects/ppc64/sys/netinet/sctp_pcb.h
  projects/ppc64/sys/netinet/sctp_structs.h
  projects/ppc64/sys/netinet/sctp_timer.c
  projects/ppc64/sys/netinet/sctputil.c
  projects/ppc64/sys/netinet6/ip6_input.c
  projects/ppc64/sys/powerpc/aim/mmu_oea.c
  projects/ppc64/sys/powerpc/aim/mmu_oea64.c
  projects/ppc64/sys/powerpc/aim/ofw_machdep.c
  projects/ppc64/sys/powerpc/booke/pmap.c
  projects/ppc64/sys/powerpc/ofw/ofw_pcibus.c
  projects/ppc64/sys/powerpc/ofw/ofw_real.c
  projects/ppc64/sys/powerpc/powermac/ata_kauai.c
  projects/ppc64/sys/powerpc/powermac/smu.c
  projects/ppc64/sys/sparc64/sparc64/pmap.c
  projects/ppc64/sys/sun4v/sun4v/pmap.c
  projects/ppc64/sys/vm/vm_object.c
  projects/ppc64/sys/vm/vm_page.c
  projects/ppc64/sys/vm/vm_page.h
  projects/ppc64/usr.bin/ar/Makefile
  projects/ppc64/usr.bin/ar/acpyacc.y
  projects/ppc64/usr.bin/ar/ar.1
  projects/ppc64/usr.bin/ar/ar.c
  projects/ppc64/usr.bin/ar/ar.h
  projects/ppc64/usr.bin/ar/read.c
  projects/ppc64/usr.bin/ar/write.c
  projects/ppc64/usr.bin/wc/wc.c
  projects/ppc64/usr.sbin/daemon/daemon.8
Directory Properties:
  projects/ppc64/   (props changed)
  projects/ppc64/cddl/contrib/opensolaris/   (props changed)
  projects/ppc64/contrib/ee/   (props changed)
  projects/ppc64/contrib/expat/   (props changed)
  projects/ppc64/contrib/file/   (props changed)
  projects/ppc64/contrib/gdb/   (props changed)
  projects/ppc64/contrib/gnu-sort/   (props changed)
  projects/ppc64/contrib/groff/   (props changed)
  projects/ppc64/contrib/less/   (props changed)
  projects/ppc64/contrib/libpcap/   (props changed)
  projects/ppc64/contrib/ncurses/   (props changed)
  projects/ppc64/contrib/one-true-awk/   (props changed)
  projects/ppc64/contrib/openbsm/   (props changed)
  projects/ppc64/contrib/openpam/   (props changed)
  projects/ppc64/contrib/pf/   (props changed)
  projects/ppc64/contrib/tcpdump/   (props changed)
  projects/ppc64/contrib/tcsh/   (props changed)
  projects/ppc64/contrib/tzcode/stdtime/   (props changed)
  projects/ppc64/contrib/tzcode/zic/   (props changed)
  projects/ppc64/contrib/tzdata/   (props changed)
  projects/ppc64/contrib/wpa/   (props changed)
  projects/ppc64/lib/libutil/   (props changed)
  projects/ppc64/lib/libz/   (props changed)
  projects/ppc64/sbin/   (props changed)
  projects/ppc64/sbin/ipfw/   (props changed)
  projects/ppc64/sys/   (props changed)
  projects/ppc64/sys/amd64/include/xen/   (props changed)
  projects/ppc64/sys/cddl/contrib/opensolaris/   (props changed)
  projects/ppc64/sys/contrib/dev/acpica/   (props changed)
  projects/ppc64/sys/contrib/x86emu/   (props changed)
  projects/ppc64/sys/dev/xen/xenpci/   (props changed)
  projects/ppc64/usr.bin/csup/   (props changed)
  projects/ppc64/usr.bin/procstat/   (props changed)

Modified: projects/ppc64/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==============================================================================
--- projects/ppc64/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon May 17 14:00:46 2010	(r208191)
@@ -343,6 +343,9 @@ extern void	taskq_wait(taskq_t *);
 extern int	taskq_member(taskq_t *, void *);
 extern void	system_taskq_init(void);
 
+#define	taskq_dispatch_safe(tq, func, arg, task)			\
+	taskq_dispatch((tq), (func), (arg), TQ_SLEEP)
+
 #define	XVA_MAPSIZE	3
 #define	XVA_MAGIC	0x78766174
 

Modified: projects/ppc64/lib/libarchive/Makefile
==============================================================================
--- projects/ppc64/lib/libarchive/Makefile	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/lib/libarchive/Makefile	Mon May 17 14:00:46 2010	(r208191)
@@ -2,8 +2,16 @@
 .include <bsd.own.mk>
 
 LIB=	archive
-DPADD=	${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBLZMA}
-LDADD=	-lbz2 -lz -lmd -llzma
+DPADD=	${LIBZ} ${LIBMD}
+LDADD=	-lz -lmd
+
+DPADD+= ${LIBBZ2}
+LDADD+= -lbz2
+CFLAGS+= -DHAVE_BZLIB_H=1
+
+DPADD+= ${LIBLZMA}
+LDADD+= -llzma
+CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
 
 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
 # It has no real relation to the libarchive version number.
@@ -11,7 +19,6 @@ SHLIB_MAJOR= 5
 
 CFLAGS+=	-DPLATFORM_CONFIG_H=\"config_freebsd.h\"
 CFLAGS+=	-I${.OBJDIR}
-CFLAGS+=	-DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
 
 .if ${MK_OPENSSL} != "no"
 CFLAGS+=	-DWITH_OPENSSL

Modified: projects/ppc64/lib/libarchive/config_freebsd.h
==============================================================================
--- projects/ppc64/lib/libarchive/config_freebsd.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/lib/libarchive/config_freebsd.h	Mon May 17 14:00:46 2010	(r208191)
@@ -52,7 +52,6 @@
 #endif
 
 #define	HAVE_BSDXML_H 1
-#define	HAVE_BZLIB_H 1
 #define	HAVE_CHFLAGS 1
 #define	HAVE_CHOWN 1
 #define	HAVE_DECL_INT64_MAX 1

Modified: projects/ppc64/sbin/geom/class/part/geom_part.c
==============================================================================
--- projects/ppc64/sbin/geom/class/part/geom_part.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sbin/geom/class/part/geom_part.c	Mon May 17 14:00:46 2010	(r208191)
@@ -705,7 +705,7 @@ gpart_bootcode(struct gctl_req *req, uns
 
 	if (gctl_has_param(req, bootcode_param)) {
 		s = gctl_get_ascii(req, bootcode_param);
-		bootsize = 64 * 1024;		/* Arbitrary limit. */
+		bootsize = 800 * 1024;		/* Arbitrary limit. */
 		bootcode = gpart_bootfile_read(s, &bootsize);
 		error = gctl_change_param(req, bootcode_param, bootsize,
 		    bootcode);

Modified: projects/ppc64/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/ppc64/sys/amd64/amd64/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/amd64/amd64/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -3139,7 +3139,10 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	va = trunc_page(va);
 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
 	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
-	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va));
+	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)",
+	    va));
+	KASSERT((m->oflags & VPO_BUSY) != 0,
+	    ("pmap_enter: page %p is not busy", m));
 
 	mpte = NULL;
 
@@ -4240,7 +4243,16 @@ pmap_remove_write(vm_page_t m)
 	pt_entry_t oldpte, *pte;
 	vm_offset_t va;
 
-	if ((m->flags & PG_FICTITIOUS) != 0 ||
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 	vm_page_lock_queues();

Modified: projects/ppc64/sys/arm/arm/pmap.c
==============================================================================
--- projects/ppc64/sys/arm/arm/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/arm/arm/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -3318,6 +3318,8 @@ pmap_enter_locked(pmap_t pmap, vm_offset
 	u_int oflags;
 	vm_paddr_t pa;
 
+	KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0,
+	    ("pmap_enter_locked: page %p is not busy", m));
 	PMAP_ASSERT_LOCKED(pmap);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	if (va == vector_page) {
@@ -4527,7 +4529,17 @@ void
 pmap_remove_write(vm_page_t m)
 {
 
-	if (m->flags & PG_WRITEABLE) {
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) != 0 ||
+	    (m->flags & PG_WRITEABLE) != 0) {
 		vm_page_lock_queues();
 		pmap_clearbit(m, PVF_WRITE);
 		vm_page_unlock_queues();

Modified: projects/ppc64/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==============================================================================
--- projects/ppc64/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Mon May 17 14:00:46 2010	(r208191)
@@ -317,8 +317,10 @@ struct zio {
 	/* FMA state */
 	uint64_t	io_ena;
 
+#ifdef _KERNEL
 	/* FreeBSD only. */
 	struct ostask	io_task;
+#endif
 };
 
 extern zio_t *zio_null(zio_t *pio, spa_t *spa,

Modified: projects/ppc64/sys/conf/files
==============================================================================
--- projects/ppc64/sys/conf/files	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/conf/files	Mon May 17 14:00:46 2010	(r208191)
@@ -1294,7 +1294,7 @@ dev/mpt/mpt_raid.c		optional mpt
 dev/mpt/mpt_user.c		optional mpt
 dev/msk/if_msk.c		optional msk inet
 dev/mvs/mvs.c			optional mvs
-dev/mvs/mvs_if.m		standard
+dev/mvs/mvs_if.m		optional mvs
 dev/mvs/mvs_pci.c		optional mvs pci
 dev/mwl/if_mwl.c		optional mwl
 dev/mwl/if_mwl_pci.c		optional mwl pci

Modified: projects/ppc64/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- projects/ppc64/sys/dev/ata/chipsets/ata-serverworks.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/dev/ata/chipsets/ata-serverworks.c	Mon May 17 14:00:46 2010	(r208191)
@@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/sema.h>
 #include <sys/taskqueue.h>
 #include <vm/uma.h>
-#ifdef __powerpc__
-#include <machine/intr_machdep.h>
-#endif
 #include <machine/stdarg.h>
 #include <machine/resource.h>
 #include <machine/bus.h>
@@ -220,10 +217,6 @@ ata_serverworks_ch_attach(device_t dev)
     ch->hw.tf_write = ata_serverworks_tf_write;
 #ifdef __powerpc__
     ch->hw.status = ata_serverworks_status;
-
-    /* Make sure that our interrupt is edge triggered */
-    powerpc_config_intr(bus_get_resource_start(device_get_parent(dev),
-	SYS_RES_IRQ, 0), INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH);
 #endif
 
     if (ctlr->chip->chipid == ATA_K2) {

Modified: projects/ppc64/sys/dev/ofw/ofw_if.m
==============================================================================
--- projects/ppc64/sys/dev/ofw/ofw_if.m	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/dev/ofw/ofw_if.m	Mon May 17 14:00:46 2010	(r208191)
@@ -340,13 +340,6 @@ METHOD void release {
 # Commands for returning control to the firmware
 
 /**
- * @brief Turn off firmware background activities
- */
-METHOD void quiesce {
-	ofw_t		_ofw;
-};
-
-/**
  * @brief Temporarily return control to firmware.
  */
 METHOD void enter {

Modified: projects/ppc64/sys/dev/ofw/ofw_standard.c
==============================================================================
--- projects/ppc64/sys/dev/ofw/ofw_standard.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/dev/ofw/ofw_standard.c	Mon May 17 14:00:46 2010	(r208191)
@@ -105,7 +105,6 @@ static ssize_t ofw_std_write(ofw_t ofw, 
 static int ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos);
 static caddr_t ofw_std_claim(ofw_t ofw, void *virt, size_t size, u_int align);
 static void ofw_std_release(ofw_t ofw, void *virt, size_t size);
-static void ofw_std_quiesce(ofw_t ofw);
 static void ofw_std_enter(ofw_t ofw);
 static void ofw_std_exit(ofw_t ofw);
 
@@ -134,7 +133,6 @@ static ofw_method_t ofw_std_methods[] = 
 	OFWMETHOD(ofw_seek,			ofw_std_seek),
 	OFWMETHOD(ofw_claim,			ofw_std_claim),
 	OFWMETHOD(ofw_release,			ofw_std_release),
-	OFWMETHOD(ofw_quiesce,			ofw_std_quiesce),
 	OFWMETHOD(ofw_enter,			ofw_std_enter),
 	OFWMETHOD(ofw_exit,			ofw_std_exit),
 
@@ -731,23 +729,6 @@ ofw_std_release(ofw_t ofw, void *virt, s
  * Control transfer functions
  */
 
-/* Turn off OF background tasks */
-static void
-ofw_std_quiesce(ofw_t ofw)
-{
-	struct {
-		cell_t name;
-		cell_t nargs;
-		cell_t nreturns;
-	} args = {
-		(cell_t)"quiesce",
-		0,
-		0,
-	};
-
-	openfirmware(&args);
-}
-
 /* Suspend and drop back to the Open Firmware interface. */
 static void
 ofw_std_enter(ofw_t ofw)

Modified: projects/ppc64/sys/dev/ofw/openfirm.c
==============================================================================
--- projects/ppc64/sys/dev/ofw/openfirm.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/dev/ofw/openfirm.c	Mon May 17 14:00:46 2010	(r208191)
@@ -409,15 +409,6 @@ OF_release(void *virt, size_t size)
  * Control transfer functions
  */
 
-/* Turn off OF background tasks */
-void
-OF_quiesce()
-{
-
-	OFW_QUIESCE(ofw_obj);
-}
-
-
 /* Suspend and drop back to the Open Firmware interface. */
 void
 OF_enter()

Modified: projects/ppc64/sys/dev/ofw/openfirm.h
==============================================================================
--- projects/ppc64/sys/dev/ofw/openfirm.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/dev/ofw/openfirm.h	Mon May 17 14:00:46 2010	(r208191)
@@ -134,7 +134,6 @@ void		*OF_claim(void *virtrequest, size_
 void		OF_release(void *virt, size_t size);
 
 /* Control transfer functions */
-void		OF_quiesce(void);
 void		OF_enter(void);
 void		OF_exit(void) __attribute__((noreturn));
 

Modified: projects/ppc64/sys/geom/part/g_part_apm.c
==============================================================================
--- projects/ppc64/sys/geom/part/g_part_apm.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/geom/part/g_part_apm.c	Mon May 17 14:00:46 2010	(r208191)
@@ -131,6 +131,26 @@ apm_parse_type(const char *type, char *b
 		strncpy(buf, type, bufsz);
 		return (0);
 	}
+	alias = g_part_alias_name(G_PART_ALIAS_APPLE_BOOT);
+	if (!strcasecmp(type, alias)) {
+		strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
+		return (0);
+	}
+	alias = g_part_alias_name(G_PART_ALIAS_APPLE_HFS);
+	if (!strcasecmp(type, alias)) {
+		strcpy(buf, APM_ENT_TYPE_APPLE_HFS);
+		return (0);
+	}
+	alias = g_part_alias_name(G_PART_ALIAS_APPLE_UFS);
+	if (!strcasecmp(type, alias)) {
+		strcpy(buf, APM_ENT_TYPE_APPLE_UFS);
+		return (0);
+	}
+	alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_BOOT);
+	if (!strcasecmp(type, alias)) {
+		strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
+		return (0);
+	}
 	alias = g_part_alias_name(G_PART_ALIAS_FREEBSD);
 	if (!strcasecmp(type, alias)) {
 		strcpy(buf, APM_ENT_TYPE_FREEBSD);
@@ -445,6 +465,12 @@ g_part_apm_type(struct g_part_table *bas
 
 	entry = (struct g_part_apm_entry *)baseentry;
 	type = entry->ent.ent_type;
+	if (!strcmp(type, APM_ENT_TYPE_APPLE_BOOT))
+		return (g_part_alias_name(G_PART_ALIAS_APPLE_BOOT));
+	if (!strcmp(type, APM_ENT_TYPE_APPLE_HFS))
+		return (g_part_alias_name(G_PART_ALIAS_APPLE_HFS));
+	if (!strcmp(type, APM_ENT_TYPE_APPLE_UFS))
+		return (g_part_alias_name(G_PART_ALIAS_APPLE_UFS));
 	if (!strcmp(type, APM_ENT_TYPE_FREEBSD))
 		return (g_part_alias_name(G_PART_ALIAS_FREEBSD));
 	if (!strcmp(type, APM_ENT_TYPE_FREEBSD_SWAP))

Modified: projects/ppc64/sys/i386/i386/pmap.c
==============================================================================
--- projects/ppc64/sys/i386/i386/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/i386/i386/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -3268,7 +3268,10 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	va = trunc_page(va);
 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
 	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
-	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va));
+	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)",
+	    va));
+	KASSERT((m->oflags & VPO_BUSY) != 0,
+	    ("pmap_enter: page %p is not busy", m));
 
 	mpte = NULL;
 
@@ -4410,7 +4413,16 @@ pmap_remove_write(vm_page_t m)
 	pt_entry_t oldpte, *pte;
 	vm_offset_t va;
 
-	if ((m->flags & PG_FICTITIOUS) != 0 ||
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 	vm_page_lock_queues();

Modified: projects/ppc64/sys/i386/xen/pmap.c
==============================================================================
--- projects/ppc64/sys/i386/xen/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/i386/xen/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -2682,12 +2682,12 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	CTR6(KTR_PMAP, "pmap_enter: pmap=%08p va=0x%08x access=0x%x ma=0x%08x prot=0x%x wired=%d",
 	    pmap, va, access, xpmap_ptom(VM_PAGE_TO_PHYS(m)), prot, wired);
 	va = trunc_page(va);
-#ifdef PMAP_DIAGNOSTIC
-	if (va > VM_MAX_KERNEL_ADDRESS)
-		panic("pmap_enter: toobig");
-	if ((va >= UPT_MIN_ADDRESS) && (va < UPT_MAX_ADDRESS))
-		panic("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va);
-#endif
+ 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
+ 	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
+	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)",
+	    va));
+	KASSERT((m->oflags & VPO_BUSY) != 0,
+	    ("pmap_enter: page %p is not busy", m));
 
 	mpte = NULL;
 
@@ -3780,7 +3780,16 @@ pmap_remove_write(vm_page_t m)
 	pmap_t pmap;
 	pt_entry_t oldpte, *pte;
 
-	if ((m->flags & PG_FICTITIOUS) != 0 ||
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 	vm_page_lock_queues();

Modified: projects/ppc64/sys/ia64/ia64/pmap.c
==============================================================================
--- projects/ppc64/sys/ia64/ia64/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/ia64/ia64/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -1497,10 +1497,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	oldpmap = pmap_switch(pmap);
 
 	va &= ~PAGE_MASK;
-#ifdef DIAGNOSTIC
-	if (va > VM_MAX_KERNEL_ADDRESS)
-		panic("pmap_enter: toobig");
-#endif
+ 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
+	KASSERT((m->oflags & VPO_BUSY) != 0,
+	    ("pmap_enter: page %p is not busy", m));
 
 	/*
 	 * Find (or create) a pte for the given mapping.
@@ -2116,7 +2115,16 @@ pmap_remove_write(vm_page_t m)
 	pv_entry_t pv;
 	vm_prot_t prot;
 
-	if ((m->flags & PG_FICTITIOUS) != 0 ||
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 	vm_page_lock_queues();

Modified: projects/ppc64/sys/kern/sched_ule.c
==============================================================================
--- projects/ppc64/sys/kern/sched_ule.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/kern/sched_ule.c	Mon May 17 14:00:46 2010	(r208191)
@@ -80,7 +80,7 @@ dtrace_vtime_switch_func_t	dtrace_vtime_
 #include <machine/cpu.h>
 #include <machine/smp.h>
 
-#if defined(__sparc64__) || defined(__mips__)
+#if defined(__sparc64__)
 #error "This architecture is not currently compatible with ULE"
 #endif
 

Modified: projects/ppc64/sys/kern/subr_smp.c
==============================================================================
--- projects/ppc64/sys/kern/subr_smp.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/kern/subr_smp.c	Mon May 17 14:00:46 2010	(r208191)
@@ -503,7 +503,10 @@ smp_topo_none(void)
 	top = &group[0];
 	top->cg_parent = NULL;
 	top->cg_child = NULL;
-	top->cg_mask = (1 << mp_ncpus) - 1;
+	if (mp_ncpus == sizeof(top->cg_mask) * 8)
+		top->cg_mask = -1;
+	else
+		top->cg_mask = (1 << mp_ncpus) - 1;
 	top->cg_count = mp_ncpus;
 	top->cg_children = 0;
 	top->cg_level = CG_SHARE_NONE;

Modified: projects/ppc64/sys/mips/conf/XLR
==============================================================================
--- projects/ppc64/sys/mips/conf/XLR	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/conf/XLR	Mon May 17 14:00:46 2010	(r208191)
@@ -59,10 +59,11 @@ include		"../rmi/std.xlr"
 makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols
 #profile		2
 
-#options 	SCHED_ULE		# ULE scheduler
+options 	SCHED_ULE		# ULE scheduler
 #options		VERBOSE_SYSINIT
-options 	SCHED_4BSD		# 4BSD scheduler
-#options 	PREEMPTION		# Enable kernel thread preemption
+#options 	SCHED_4BSD		# 4BSD scheduler
+options         SMP
+options 	PREEMPTION		# Enable kernel thread preemption
 #options 	FULL_PREEMPTION		# Enable kernel thread preemption
 options 	INET			# InterNETworking
 options 	INET6			# IPv6 communications protocols

Modified: projects/ppc64/sys/mips/include/locore.h
==============================================================================
--- projects/ppc64/sys/mips/include/locore.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/include/locore.h	Mon May 17 14:00:46 2010	(r208191)
@@ -60,6 +60,7 @@ typedef int mips_prid_t;
 				/*	0x09	unannounced */
 				/*	0x0a	unannounced */
 #define     MIPS_PRID_CID_LEXRA		0x0b	/* Lexra */
+#define     MIPS_PRID_CID_RMI		0x0c	/* RMI */
 #define     MIPS_PRID_CID_CAVIUM	0x0d	/* Cavium */
 #define MIPS_PRID_COPTS(x)	(((x) >> 24) & 0x00ff)	/* Company Options */
 

Modified: projects/ppc64/sys/mips/include/param.h
==============================================================================
--- projects/ppc64/sys/mips/include/param.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/include/param.h	Mon May 17 14:00:46 2010	(r208191)
@@ -70,7 +70,7 @@
 #define	MID_MACHINE	0	/* None but has to be defined */
 
 #ifdef SMP
-#define	MAXSMPCPU	16
+#define	MAXSMPCPU	32
 #define	MAXCPU		MAXSMPCPU
 #else
 #define	MAXSMPCPU	1

Modified: projects/ppc64/sys/mips/include/smp.h
==============================================================================
--- projects/ppc64/sys/mips/include/smp.h	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/include/smp.h	Mon May 17 14:00:46 2010	(r208191)
@@ -26,6 +26,7 @@
 #define	IPI_AST			0x0004
 #define	IPI_STOP		0x0008
 #define	IPI_STOP_HARD		0x0008
+#define	IPI_PREEMPT		0x0010
 
 #ifndef LOCORE
 

Modified: projects/ppc64/sys/mips/mips/cpu.c
==============================================================================
--- projects/ppc64/sys/mips/mips/cpu.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/mips/cpu.c	Mon May 17 14:00:46 2010	(r208191)
@@ -178,6 +178,9 @@ cpu_identify(void)
 	case MIPS_PRID_CID_LEXRA:
 		printf("Lexra");
 		break;
+	case MIPS_PRID_CID_RMI:
+		printf("RMI");
+		break;
 	case MIPS_PRID_CID_CAVIUM:
 		printf("Cavium");
 		break;

Modified: projects/ppc64/sys/mips/mips/machdep.c
==============================================================================
--- projects/ppc64/sys/mips/mips/machdep.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/mips/machdep.c	Mon May 17 14:00:46 2010	(r208191)
@@ -346,7 +346,7 @@ mips_vector_init(void)
 	bcopy(MipsTLBMiss, (void *)TLB_MISS_EXC_VEC,
 	      MipsTLBMissEnd - MipsTLBMiss);
 
-#ifdef TARGET_OCTEON
+#if defined(TARGET_OCTEON) || defined(TARGET_XLR_XLS)
 /* Fake, but sufficient, for the 32-bit with 64-bit hardware addresses  */
 	bcopy(MipsTLBMiss, (void *)XTLB_MISS_EXC_VEC,
 	      MipsTLBMissEnd - MipsTLBMiss);

Modified: projects/ppc64/sys/mips/mips/mp_machdep.c
==============================================================================
--- projects/ppc64/sys/mips/mips/mp_machdep.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/mips/mp_machdep.c	Mon May 17 14:00:46 2010	(r208191)
@@ -141,6 +141,10 @@ mips_ipi_handler(void *arg)
 			atomic_clear_int(&stopped_cpus, cpumask);
 			CTR0(KTR_SMP, "IPI_STOP (restart)");
 			break;
+		case IPI_PREEMPT:
+			CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__);
+			sched_preempt(curthread);
+			break;
 		default:
 			panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu);
 		}
@@ -234,7 +238,9 @@ cpu_mp_start(void)
 void
 smp_init_secondary(u_int32_t cpuid)
 {
+#ifndef TARGET_XLR_XLS
 	int ipi_int_mask, clock_int_mask;
+#endif
 
 	/* TLB */
 	Mips_SetWIRED(0);
@@ -288,12 +294,16 @@ smp_init_secondary(u_int32_t cpuid)
 	while (smp_started == 0)
 		; /* nothing */
 
+#ifndef TARGET_XLR_XLS
 	/*
 	 * Unmask the clock and ipi interrupts.
 	 */
 	clock_int_mask = hard_int_mask(5);
 	ipi_int_mask = hard_int_mask(platform_ipi_intrnum());
 	set_intr_mask(ALL_INT_MASK & ~(ipi_int_mask | clock_int_mask));
+#else
+	platform_init_ap(cpuid);
+#endif
 
 	/*
 	 * Bootstrap the compare register.

Modified: projects/ppc64/sys/mips/mips/mpboot.S
==============================================================================
--- projects/ppc64/sys/mips/mips/mpboot.S	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/mips/mpboot.S	Mon May 17 14:00:46 2010	(r208191)
@@ -76,9 +76,10 @@ GLOBAL(mpentry)
 
 	PTR_LA	gp, _C_LABEL(_gp)
 
+#ifndef TARGET_XLR_XLS
 	jal	platform_init_ap
 	move	a0, s0
-
+#endif
 	jal	smp_init_secondary
 	move	a0, s0
 

Modified: projects/ppc64/sys/mips/mips/pmap.c
==============================================================================
--- projects/ppc64/sys/mips/mips/pmap.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/mips/pmap.c	Mon May 17 14:00:46 2010	(r208191)
@@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$");
 
 #include <vm/vm.h>
 #include <vm/vm_param.h>
+#include <vm/vm_phys.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <vm/vm_kern.h>
@@ -109,6 +110,10 @@ __FBSDID("$FreeBSD$");
 #define	PMAP_SHPGPERPROC 200
 #endif
 
+#if defined(TARGET_XLR_XLS)
+#define HIGHMEM_SUPPORT
+#endif
+
 #if !defined(PMAP_DIAGNOSTIC)
 #define	PMAP_INLINE __inline
 #else
@@ -183,12 +188,18 @@ static int pmap_unuse_pt(pmap_t, vm_offs
 static int init_pte_prot(vm_offset_t va, vm_page_t m, vm_prot_t prot);
 static void pmap_TLB_invalidate_kernel(vm_offset_t);
 static void pmap_TLB_update_kernel(vm_offset_t, pt_entry_t);
+static vm_page_t pmap_alloc_pte_page(pmap_t, unsigned int, int, vm_offset_t *);
+static void pmap_release_pte_page(vm_page_t);
 
 #ifdef SMP
 static void pmap_invalidate_page_action(void *arg);
 static void pmap_invalidate_all_action(void *arg);
 static void pmap_update_page_action(void *arg);
+#endif
 
+#ifdef HIGHMEM_SUPPORT
+static void * pmap_ptpgzone_allocf(uma_zone_t, int, u_int8_t*, int);
+static uma_zone_t ptpgzone;
 #endif
 
 struct local_sysmaps {
@@ -530,6 +541,12 @@ pmap_init(void)
 	pv_entry_max = PMAP_SHPGPERPROC * maxproc + cnt.v_page_count;
 	pv_entry_high_water = 9 * (pv_entry_max / 10);
 	uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
+
+#ifdef HIGHMEM_SUPPORT
+	ptpgzone = uma_zcreate("PT ENTRY", PAGE_SIZE, NULL,
+	    NULL, NULL, NULL, PAGE_SIZE-1, UMA_ZONE_NOFREE);
+	uma_zone_set_allocf(ptpgzone, pmap_ptpgzone_allocf);
+#endif
 }
 
 /***************************************************
@@ -887,7 +904,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_pa
 	/*
 	 * If the page is finally unwired, simply free it.
 	 */
-	vm_page_free_zero(m);
+	pmap_release_pte_page(m);
 	atomic_subtract_int(&cnt.v_wire_count, 1);
 	return (1);
 }
@@ -947,6 +964,118 @@ pmap_pinit0(pmap_t pmap)
 	bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
 }
 
+#ifdef HIGHMEM_SUPPORT
+static void *
+pmap_ptpgzone_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
+{
+	vm_page_t m;
+	vm_paddr_t paddr;
+
+	*flags = UMA_SLAB_PRIV;
+	m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS,
+	     PAGE_SIZE, PAGE_SIZE);
+	if (m == NULL)
+		return (NULL);
+
+	paddr = VM_PAGE_TO_PHYS(m);
+	return ((void *)MIPS_PHYS_TO_KSEG0(paddr));
+}	
+
+static vm_page_t
+pmap_alloc_pte_page(pmap_t pmap, unsigned int index, int wait, vm_offset_t *vap)
+{
+	vm_paddr_t paddr;
+	void *va;
+	vm_page_t m;
+	int locked;
+
+	locked = mtx_owned(&pmap->pm_mtx);
+	if (locked) {
+		mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+		PMAP_UNLOCK(pmap);
+		vm_page_unlock_queues();
+	}
+	va = uma_zalloc(ptpgzone, wait);
+	if (locked) {
+		vm_page_lock_queues();
+		PMAP_LOCK(pmap);
+	}
+	if (va == NULL)
+		return (NULL);
+
+	paddr = MIPS_KSEG0_TO_PHYS(va);
+	m = PHYS_TO_VM_PAGE(paddr);
+	
+	if ((m->flags & PG_ZERO) == 0)
+		bzero(va, PAGE_SIZE);
+	m->pindex = index;
+	m->valid = VM_PAGE_BITS_ALL;
+	m->wire_count = 1;
+	atomic_add_int(&cnt.v_wire_count, 1);
+	*vap = (vm_offset_t)va;
+	return (m);
+}
+
+static void
+pmap_release_pte_page(vm_page_t m)
+{
+	void *va;
+	vm_paddr_t paddr;
+
+	paddr = VM_PAGE_TO_PHYS(m);
+	va = (void *)MIPS_PHYS_TO_KSEG0(paddr);
+	uma_zfree(ptpgzone, va);
+}
+#else
+static vm_page_t
+pmap_alloc_pte_page(pmap_t pmap, unsigned int index, int wait, vm_offset_t *vap)
+{
+	vm_offset_t va;
+	vm_page_t m;
+	int locked, req;
+
+	locked = mtx_owned(&pmap->pm_mtx);
+	req = VM_ALLOC_WIRED | VM_ALLOC_NOOBJ;
+	if (wait & M_WAITOK)
+		req |= VM_ALLOC_NORMAL;
+	else
+		req |= VM_ALLOC_INTERRUPT;
+
+	m = vm_page_alloc(NULL, index, req);
+	if (m == NULL) {
+		if (wait & M_WAITOK) {
+			if (locked) {
+				mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+				PMAP_UNLOCK(pmap);
+				vm_page_unlock_queues();
+			}
+			VM_WAIT;
+			if (locked) {
+				vm_page_lock_queues();
+				PMAP_LOCK(pmap);
+			}
+		}
+		return NULL;
+	}
+	
+	va = MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(m));
+	if ((m->flags & PG_ZERO) == 0)
+		bzero((void *)va, PAGE_SIZE);
+	else
+		vm_page_flag_clear(m, PG_ZERO);
+	
+	m->valid = VM_PAGE_BITS_ALL;
+	*vap = (vm_offset_t)va;
+	return (m);
+}
+
+static void
+pmap_release_pte_page(vm_page_t m)
+{
+	vm_page_free(m);
+}
+#endif
+
 /*
  * Initialize a preallocated and zeroed pmap structure,
  * such as one in a vmspace structure.
@@ -955,37 +1084,16 @@ int
 pmap_pinit(pmap_t pmap)
 {
 	vm_offset_t ptdva;
-	vm_paddr_t ptdpa;
 	vm_page_t ptdpg;
 	int i;
-	int req;
 
 	PMAP_LOCK_INIT(pmap);
 
-	req = VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | VM_ALLOC_WIRED |
-	    VM_ALLOC_ZERO;
-
 	/*
 	 * allocate the page directory page
 	 */
-	while ((ptdpg = vm_page_alloc(NULL, NUSERPGTBLS, req)) == NULL)
-		VM_WAIT;
-
-	ptdpg->valid = VM_PAGE_BITS_ALL;
-
-	ptdpa = VM_PAGE_TO_PHYS(ptdpg);
-	if (ptdpa < MIPS_KSEG0_LARGEST_PHYS) {
-		ptdva = MIPS_PHYS_TO_KSEG0(ptdpa);
-	} else {
-		ptdva = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
-		if (ptdva == 0)
-			panic("pmap_pinit: unable to allocate kva");
-		pmap_kenter(ptdva, ptdpa);
-	}
-
+	ptdpg = pmap_alloc_pte_page(pmap, NUSERPGTBLS, M_WAITOK, &ptdva);
 	pmap->pm_segtab = (pd_entry_t *)ptdva;
-	if ((ptdpg->flags & PG_ZERO) == 0)
-		bzero(pmap->pm_segtab, PAGE_SIZE);
 
 	pmap->pm_active = 0;
 	pmap->pm_ptphint = NULL;
@@ -1006,7 +1114,7 @@ pmap_pinit(pmap_t pmap)
 static vm_page_t
 _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags)
 {
-	vm_offset_t pteva, ptepa;
+	vm_offset_t pteva;
 	vm_page_t m;
 	int req;
 
@@ -1018,25 +1126,9 @@ _pmap_allocpte(pmap_t pmap, unsigned pte
 	/*
 	 * Find or fabricate a new pagetable page
 	 */
-	if ((m = vm_page_alloc(NULL, ptepindex, req)) == NULL) {
-		if (flags & M_WAITOK) {
-			PMAP_UNLOCK(pmap);
-			vm_page_unlock_queues();
-			VM_WAIT;
-			vm_page_lock_queues();
-			PMAP_LOCK(pmap);
-		}
-		/*
-		 * Indicate the need to retry.	While waiting, the page
-		 * table page may have been allocated.
-		 */
+	m = pmap_alloc_pte_page(pmap, ptepindex, flags, &pteva);
+	if (m == NULL)
 		return (NULL);
-	}
-	if ((m->flags & PG_ZERO) == 0)
-		pmap_zero_page(m);
-
-	KASSERT(m->queue == PQ_NONE,
-	    ("_pmap_allocpte: %p->queue != PQ_NONE", m));
 
 	/*
 	 * Map the pagetable page into the process address space, if it
@@ -1044,34 +1136,12 @@ _pmap_allocpte(pmap_t pmap, unsigned pte
 	 */
 
 	pmap->pm_stats.resident_count++;
-
-	ptepa = VM_PAGE_TO_PHYS(m);
-	if (ptepa < MIPS_KSEG0_LARGEST_PHYS) {
-		pteva = MIPS_PHYS_TO_KSEG0(ptepa);
-	} else {
-		pteva = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
-		if (pteva == 0)
-			panic("_pmap_allocpte: unable to allocate kva");
-		pmap_kenter(pteva, ptepa);
-	}
-
 	pmap->pm_segtab[ptepindex] = (pd_entry_t)pteva;
 
 	/*
 	 * Set the page table hint
 	 */
 	pmap->pm_ptphint = m;
-
-	/*
-	 * Kernel page tables are allocated in pmap_bootstrap() or
-	 * pmap_growkernel().
-	 */
-	if (is_kernel_pmap(pmap))
-		panic("_pmap_allocpte() called for kernel pmap\n");
-
-	m->valid = VM_PAGE_BITS_ALL;
-	vm_page_flag_clear(m, PG_ZERO);
-
 	return (m);
 }
 
@@ -1158,17 +1228,12 @@ pmap_release(pmap_t pmap)
 	ptdva = (vm_offset_t)pmap->pm_segtab;
 	ptdpg = PHYS_TO_VM_PAGE(vtophys(ptdva));
 
-	if (ptdva >= VM_MIN_KERNEL_ADDRESS) {
-		pmap_kremove(ptdva);
-		kmem_free(kernel_map, ptdva, PAGE_SIZE);
-	} else {
-		KASSERT(MIPS_IS_KSEG0_ADDR(ptdva),
-		    ("pmap_release: 0x%0lx is not in kseg0", (long)ptdva));
-	}
+	KASSERT(MIPS_IS_KSEG0_ADDR(ptdva),
+	    ("pmap_release: 0x%0lx is not in kseg0", (long)ptdva));
 
 	ptdpg->wire_count--;
 	atomic_subtract_int(&cnt.v_wire_count, 1);
-	vm_page_free_zero(ptdpg);
+	pmap_release_pte_page(ptdpg);
 	PMAP_LOCK_DESTROY(pmap);
 }
 
@@ -1178,10 +1243,10 @@ pmap_release(pmap_t pmap)
 void
 pmap_growkernel(vm_offset_t addr)
 {
-	vm_offset_t ptppaddr;
+	vm_offset_t pageva;
 	vm_page_t nkpg;
 	pt_entry_t *pte;
-	int i, req;
+	int i;
 
 	mtx_assert(&kernel_map->system_mtx, MA_OWNED);
 	if (kernel_vm_end == 0) {
@@ -1213,26 +1278,13 @@ pmap_growkernel(vm_offset_t addr)
 		/*
 		 * This index is bogus, but out of the way
 		 */
-		req = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ;
-		nkpg = vm_page_alloc(NULL, nkpt, req);
+		nkpg = pmap_alloc_pte_page(kernel_pmap, nkpt, M_NOWAIT, &pageva);
+
 		if (!nkpg)
 			panic("pmap_growkernel: no memory to grow kernel");
 
 		nkpt++;
-
-		ptppaddr = VM_PAGE_TO_PHYS(nkpg);
-		if (ptppaddr >= MIPS_KSEG0_LARGEST_PHYS) {
-			/*
-			 * We need to do something here, but I am not sure
-			 * what. We can access anything in the 0 - 512Meg
-			 * region, but if we get a page to go in the kernel
-			 * segmap that is outside of of that we really need
-			 * to have another mapping beyond the temporary ones
-			 * I have. Not sure how to do this yet. FIXME FIXME.
-			 */
-			panic("Gak, can't handle a k-page table outside of lower 512Meg");
-		}
-		pte = (pt_entry_t *)MIPS_PHYS_TO_KSEG0(ptppaddr);
+		pte = (pt_entry_t *)pageva;
 		segtab_pde(kernel_segmap, kernel_vm_end) = (pd_entry_t)pte;
 
 		/*
@@ -1396,7 +1448,8 @@ pmap_remove_entry(struct pmap *pmap, vm_
 		}
 	}
 
-	KASSERT(pv != NULL, ("pmap_remove_entry: pv not found"));
+	KASSERT(pv != NULL, ("pmap_remove_entry: pv not found, pa %lx va %lx",
+	     (u_long)VM_PAGE_TO_PHYS(m), (u_long)va));
 	TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
 	m->md.pv_list_count--;
 	if (TAILQ_FIRST(&m->md.pv_list) == NULL)
@@ -1738,10 +1791,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 		return;
 
 	va &= ~PAGE_MASK;
-#ifdef PMAP_DIAGNOSTIC
-	if (va > VM_MAX_KERNEL_ADDRESS)
-		panic("pmap_enter: toobig");
-#endif
+ 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
+	KASSERT((m->oflags & VPO_BUSY) != 0,
+	    ("pmap_enter: page %p is not busy", m));
 
 	mpte = NULL;
 
@@ -2531,7 +2583,16 @@ pmap_remove_write(vm_page_t m)
 	vm_offset_t va;
 	pt_entry_t *pte;
 
-	if ((m->flags & PG_FICTITIOUS) != 0 ||
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_remove_write: page %p is not managed", m));
+
+	/*
+	 * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by
+	 * another thread while the object is locked.  Thus, if PG_WRITEABLE
+	 * is clear, no page table entries need updating.
+	 */
+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	if ((m->oflags & VPO_BUSY) == 0 &&
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 

Modified: projects/ppc64/sys/mips/rmi/dev/xlr/rge.c
==============================================================================
--- projects/ppc64/sys/mips/rmi/dev/xlr/rge.c	Mon May 17 11:18:33 2010	(r208190)
+++ projects/ppc64/sys/mips/rmi/dev/xlr/rge.c	Mon May 17 14:00:46 2010	(r208191)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #define __RMAN_RESOURCE_VISIBLE
 #include <sys/rman.h>
 #include <sys/taskqueue.h>
+#include <sys/smp.h>
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -83,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/param.h>
 #include <machine/intr_machdep.h>
 #include <machine/clock.h>	/* for DELAY */
+#include <machine/cpuregs.h>
 #include <machine/bus.h>	/* */
 #include <machine/resource.h>
 #include <mips/rmi/interrupt.h>
@@ -112,7 +114,6 @@ MODULE_DEPEND(rge, ether, 1, 1, 1);
 MODULE_DEPEND(rge, miibus, 1, 1, 1);
 
 /* #define DEBUG */
-/*#define RX_COPY */
 
 #define RGE_TX_THRESHOLD 1024
 #define RGE_TX_Q_SIZE 1024
@@ -204,10 +205,18 @@ ldadd_wu(unsigned int value, unsigned lo
 	return value;
 }
 
+static __inline__ uint32_t 
+xlr_enable_kx(void)
+{
+	uint32_t sr = mips_rd_status();
+
+	mips_wr_status((sr & ~MIPS_SR_INT_IE) | MIPS_SR_KX);
+	return sr;
+}
+
 /* #define mac_stats_add(x, val) ({(x) += (val);}) */
 #define mac_stats_add(x, val) ldadd_wu(val, &x)
 
-
 #define XLR_MAX_CORE 8
 #define RGE_LOCK_INIT(_sc, _name) \
   mtx_init(&(_sc)->rge_mtx, _name, MTX_NETWORK_LOCK, MTX_DEF)
@@ -332,56 +341,6 @@ DRIVER_MODULE(miibus, rge, miibus_driver
 #define STR(x) __STR(x)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list