svn commit: r209087 - in projects/altix/sys: amd64/acpica amd64/amd64 amd64/linux32 arm/arm cam cam/scsi cddl/contrib/opensolaris/uts/common/dtrace cddl/dev/cyclic cddl/dev/dtrace cddl/dev/dtrace/a...

Marcel Moolenaar marcel at FreeBSD.org
Sat Jun 12 04:41:14 UTC 2010


Author: marcel
Date: Sat Jun 12 04:41:13 2010
New Revision: 209087
URL: http://svn.freebsd.org/changeset/base/209087

Log:
  Merge svn+ssh://svn.freebsd.org/base/head@209086

Added:
  projects/altix/sys/modules/netgraph/patch/
     - copied from r209086, head/sys/modules/netgraph/patch/
  projects/altix/sys/netgraph/ng_patch.c
     - copied unchanged from r209086, head/sys/netgraph/ng_patch.c
  projects/altix/sys/netgraph/ng_patch.h
     - copied unchanged from r209086, head/sys/netgraph/ng_patch.h
  projects/altix/sys/x86/x86/io_apic.c
     - copied unchanged from r209086, head/sys/x86/x86/io_apic.c
  projects/altix/sys/x86/x86/mca.c
     - copied unchanged from r209086, head/sys/x86/x86/mca.c
  projects/altix/sys/x86/x86/msi.c
     - copied unchanged from r209086, head/sys/x86/x86/msi.c
Deleted:
  projects/altix/sys/amd64/amd64/io_apic.c
  projects/altix/sys/amd64/amd64/mca.c
  projects/altix/sys/amd64/amd64/msi.c
  projects/altix/sys/i386/i386/io_apic.c
  projects/altix/sys/i386/i386/mca.c
  projects/altix/sys/i386/i386/msi.c
Modified:
  projects/altix/sys/amd64/acpica/madt.c
  projects/altix/sys/amd64/amd64/legacy.c
  projects/altix/sys/amd64/amd64/pmap.c
  projects/altix/sys/amd64/linux32/linux32_machdep.c
  projects/altix/sys/arm/arm/pmap.c
  projects/altix/sys/cam/cam_debug.h
  projects/altix/sys/cam/cam_xpt.c
  projects/altix/sys/cam/cam_xpt_internal.h
  projects/altix/sys/cam/scsi/scsi_all.c
  projects/altix/sys/cam/scsi/scsi_all.h
  projects/altix/sys/cam/scsi/scsi_ch.h
  projects/altix/sys/cam/scsi/scsi_da.c
  projects/altix/sys/cam/scsi/scsi_xpt.c
  projects/altix/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  projects/altix/sys/cddl/dev/cyclic/cyclic.c
  projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  projects/altix/sys/cddl/dev/dtrace/dtrace_debug.c
  projects/altix/sys/cddl/dev/dtrace/dtrace_load.c
  projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c
  projects/altix/sys/compat/linprocfs/linprocfs.c
  projects/altix/sys/conf/NOTES
  projects/altix/sys/conf/files
  projects/altix/sys/conf/files.amd64
  projects/altix/sys/conf/files.i386
  projects/altix/sys/conf/files.pc98
  projects/altix/sys/conf/options
  projects/altix/sys/dev/acpi_support/acpi_asus.c
  projects/altix/sys/dev/acpi_support/acpi_fujitsu.c
  projects/altix/sys/dev/acpi_support/acpi_hp.c
  projects/altix/sys/dev/acpi_support/acpi_ibm.c
  projects/altix/sys/dev/acpica/acpi.c
  projects/altix/sys/dev/acpica/acpi_cpu.c
  projects/altix/sys/dev/acpica/acpi_dock.c
  projects/altix/sys/dev/acpica/acpi_thermal.c
  projects/altix/sys/dev/acpica/acpi_video.c
  projects/altix/sys/dev/ahci/ahci.c
  projects/altix/sys/dev/bge/if_bgereg.h
  projects/altix/sys/dev/cxgb/cxgb_main.c
  projects/altix/sys/dev/e1000/if_igb.c
  projects/altix/sys/dev/isp/isp_freebsd.c
  projects/altix/sys/dev/isp/isp_library.c
  projects/altix/sys/dev/ixgbe/ixgbe.c
  projects/altix/sys/dev/sound/pci/hda/hdac.c
  projects/altix/sys/dev/twa/tw_cl.h
  projects/altix/sys/dev/twa/tw_cl_fwif.h
  projects/altix/sys/dev/twa/tw_cl_init.c
  projects/altix/sys/dev/twa/tw_cl_intr.c
  projects/altix/sys/dev/twa/tw_cl_io.c
  projects/altix/sys/dev/twa/tw_cl_misc.c
  projects/altix/sys/dev/twa/tw_cl_share.h
  projects/altix/sys/dev/twa/tw_osl.h
  projects/altix/sys/dev/twa/tw_osl_cam.c
  projects/altix/sys/dev/twa/tw_osl_externs.h
  projects/altix/sys/dev/twa/tw_osl_freebsd.c
  projects/altix/sys/dev/twa/tw_osl_inline.h
  projects/altix/sys/dev/twa/tw_osl_share.h
  projects/altix/sys/dev/usb/usb_dev.c
  projects/altix/sys/dev/usb/usb_device.c
  projects/altix/sys/dev/usb/usb_process.c
  projects/altix/sys/dev/xen/netfront/netfront.c
  projects/altix/sys/fs/devfs/devfs.h
  projects/altix/sys/fs/devfs/devfs_devs.c
  projects/altix/sys/fs/devfs/devfs_vnops.c
  projects/altix/sys/fs/procfs/procfs_type.c
  projects/altix/sys/geom/geom_dev.c
  projects/altix/sys/geom/geom_event.c
  projects/altix/sys/geom/geom_io.c
  projects/altix/sys/i386/acpica/madt.c
  projects/altix/sys/i386/i386/legacy.c
  projects/altix/sys/i386/i386/mp_machdep.c
  projects/altix/sys/i386/i386/pmap.c
  projects/altix/sys/i386/linux/linux_machdep.c
  projects/altix/sys/i386/xen/pmap.c
  projects/altix/sys/ia64/ia64/busdma_machdep.c
  projects/altix/sys/ia64/ia64/exception.S
  projects/altix/sys/ia64/ia64/pmap.c
  projects/altix/sys/ia64/ia64/vm_machdep.c
  projects/altix/sys/ia64/include/md_var.h
  projects/altix/sys/kern/kern_clock.c
  projects/altix/sys/kern/kern_intr.c
  projects/altix/sys/kern/kern_switch.c
  projects/altix/sys/kern/kern_sx.c
  projects/altix/sys/kern/kern_timeout.c
  projects/altix/sys/kern/sched_4bsd.c
  projects/altix/sys/kern/sched_ule.c
  projects/altix/sys/kern/subr_bus.c
  projects/altix/sys/kern/subr_kdb.c
  projects/altix/sys/kern/subr_lock.c
  projects/altix/sys/kern/subr_pcpu.c
  projects/altix/sys/kern/subr_smp.c
  projects/altix/sys/kern/subr_taskqueue.c
  projects/altix/sys/kern/sysv_sem.c
  projects/altix/sys/kern/sysv_shm.c
  projects/altix/sys/kern/vfs_bio.c
  projects/altix/sys/mips/mips/pmap.c
  projects/altix/sys/modules/netgraph/Makefile
  projects/altix/sys/net/flowtable.c
  projects/altix/sys/net/if_epair.c
  projects/altix/sys/net/netisr.c
  projects/altix/sys/net80211/ieee80211_hwmp.c
  projects/altix/sys/net80211/ieee80211_sta.c
  projects/altix/sys/netinet/sctp_indata.c
  projects/altix/sys/netinet/sctp_pcb.c
  projects/altix/sys/netinet/sctp_usrreq.c
  projects/altix/sys/netinet/sctputil.c
  projects/altix/sys/powerpc/aim/mmu_oea.c
  projects/altix/sys/powerpc/aim/mmu_oea64.c
  projects/altix/sys/powerpc/booke/pmap.c
  projects/altix/sys/sparc64/sparc64/pmap.c
  projects/altix/sys/sun4v/sun4v/pmap.c
  projects/altix/sys/sys/buf.h
  projects/altix/sys/sys/file.h
  projects/altix/sys/sys/nlist_aout.h
  projects/altix/sys/sys/param.h
  projects/altix/sys/sys/proc.h
  projects/altix/sys/sys/smp.h
  projects/altix/sys/sys/vnode.h
  projects/altix/sys/ufs/ffs/ffs_softdep.c
  projects/altix/sys/vm/uma_core.c
  projects/altix/sys/vm/vm_page.c
  projects/altix/sys/vm/vm_page.h
  projects/altix/sys/vm/vm_pageout.c
Directory Properties:
  projects/altix/lib/libstand/   (props changed)
  projects/altix/sys/   (props changed)
  projects/altix/sys/amd64/include/xen/   (props changed)
  projects/altix/sys/cddl/contrib/opensolaris/   (props changed)
  projects/altix/sys/contrib/dev/acpica/   (props changed)
  projects/altix/sys/contrib/x86emu/   (props changed)
  projects/altix/sys/dev/xen/xenpci/   (props changed)

Modified: projects/altix/sys/amd64/acpica/madt.c
==============================================================================
--- projects/altix/sys/amd64/acpica/madt.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/amd64/acpica/madt.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -557,9 +557,7 @@ madt_set_ids(void *dummy)
 
 	if (madt == NULL)
 		return;
-	for (i = 0; i < MAXCPU; i++) {
-		if (CPU_ABSENT(i))
-			continue;
+	CPU_FOREACH(i) {
 		pc = pcpu_find(i);
 		KASSERT(pc != NULL, ("no pcpu data for CPU %u", i));
 		la = &lapics[pc->pc_apic_id];

Modified: projects/altix/sys/amd64/amd64/legacy.c
==============================================================================
--- projects/altix/sys/amd64/amd64/legacy.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/amd64/amd64/legacy.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -269,12 +269,11 @@ cpu_identify(driver_t *driver, device_t 
 	 * so that these devices are attached after the Host-PCI
 	 * bridges (which are added at order 100).
 	 */
-	for (i = 0; i <= mp_maxid; i++)
-		if (!CPU_ABSENT(i)) {
-			child = BUS_ADD_CHILD(parent, 150, "cpu", i);
-			if (child == NULL)
-				panic("legacy_attach cpu");
-		}
+	CPU_FOREACH(i) {
+		child = BUS_ADD_CHILD(parent, 150, "cpu", i);
+		if (child == NULL)
+			panic("legacy_attach cpu");
+	}
 }
 
 static device_t

Modified: projects/altix/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/altix/sys/amd64/amd64/pmap.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/amd64/amd64/pmap.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -3138,7 +3138,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
 	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)",
 	    va));
-	KASSERT((m->oflags & VPO_BUSY) != 0,
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 ||
+	    (m->oflags & VPO_BUSY) != 0,
 	    ("pmap_enter: page %p is not busy", m));
 
 	mpte = NULL;
@@ -3899,30 +3900,35 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 	struct md_page *pvh;
 	pv_entry_t pv;
 	int loops = 0;
+	boolean_t rv;
 
-	if (m->flags & PG_FICTITIOUS)
-		return (FALSE);
-
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_page_exists_quick: page %p is not managed", m));
+	rv = FALSE;
+	vm_page_lock_queues();
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 		if (PV_PMAP(pv) == pmap) {
-			return (TRUE);
+			rv = TRUE;
+			break;
 		}
 		loops++;
 		if (loops >= 16)
 			break;
 	}
-	if (loops < 16) {
+	if (!rv && loops < 16) {
 		pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 		TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
-			if (PV_PMAP(pv) == pmap)
-				return (TRUE);
+			if (PV_PMAP(pv) == pmap) {
+				rv = TRUE;
+				break;
+			}
 			loops++;
 			if (loops >= 16)
 				break;
 		}
 	}
-	return (FALSE);
+	vm_page_unlock_queues();
+	return (rv);
 }
 
 /*
@@ -4335,10 +4341,10 @@ pmap_ts_referenced(vm_page_t m)
 	vm_offset_t va;
 	int rtval = 0;
 
-	if (m->flags & PG_FICTITIOUS)
-		return (rtval);
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_ts_referenced: page %p is not managed", m));
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
+	vm_page_lock_queues();
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, pvn) {
 		pmap = PV_PMAP(pv);
 		PMAP_LOCK(pmap);
@@ -4362,7 +4368,7 @@ pmap_ts_referenced(vm_page_t m)
 					rtval++;
 					if (rtval > 4) {
 						PMAP_UNLOCK(pmap);
-						return (rtval);
+						goto out;
 					}
 				}
 			}
@@ -4391,6 +4397,8 @@ pmap_ts_referenced(vm_page_t m)
 			PMAP_UNLOCK(pmap);
 		} while ((pv = pvn) != NULL && pv != pvf);
 	}
+out:
+	vm_page_unlock_queues();
 	return (rtval);
 }
 

Modified: projects/altix/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- projects/altix/sys/amd64/linux32/linux32_machdep.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/amd64/linux32/linux32_machdep.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -835,9 +835,13 @@ linux_mmap_common(struct thread *td, l_u
 		bsd_args.flags |= MAP_PRIVATE;
 	if (flags & LINUX_MAP_FIXED)
 		bsd_args.flags |= MAP_FIXED;
-	if (flags & LINUX_MAP_ANON)
+	if (flags & LINUX_MAP_ANON) {
+		/* Enforce pos to be on page boundary, then ignore. */
+		if ((pos & PAGE_MASK) != 0)
+			return (EINVAL);
+		pos = 0;
 		bsd_args.flags |= MAP_ANON;
-	else
+	} else
 		bsd_args.flags |= MAP_NOSYNC;
 	if (flags & LINUX_MAP_GROWSDOWN)
 		bsd_args.flags |= MAP_STACK;

Modified: projects/altix/sys/arm/arm/pmap.c
==============================================================================
--- projects/altix/sys/arm/arm/pmap.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/arm/arm/pmap.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -1423,7 +1423,7 @@ pmap_clearbit(struct vm_page *pg, u_int 
 	u_int oflags;
 	int count = 0;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	vm_page_lock_queues();
 
 	if (maskbits & PVF_WRITE)
 		maskbits |= PVF_MOD;
@@ -1433,6 +1433,7 @@ pmap_clearbit(struct vm_page *pg, u_int 
 	pg->md.pvh_attrs &= ~(maskbits & (PVF_MOD | PVF_REF));
 
 	if (TAILQ_EMPTY(&pg->md.pv_list)) {
+		vm_page_unlock_queues();
 		return (0);
 	}
 
@@ -1568,6 +1569,7 @@ pmap_clearbit(struct vm_page *pg, u_int 
 
 	if (maskbits & PVF_WRITE)
 		vm_page_flag_clear(pg, PG_WRITEABLE);
+	vm_page_unlock_queues();
 	return (count);
 }
 
@@ -3324,7 +3326,8 @@ pmap_enter_locked(pmap_t pmap, vm_offset
 		pa = systempage.pv_pa;
 		m = NULL;
 	} else {
-		KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0,
+		KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0 ||
+		    (m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0,
 		    ("pmap_enter_locked: page %p is not busy", m));
 		pa = VM_PAGE_TO_PHYS(m);
 	}
@@ -4417,24 +4420,23 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 {
 	pv_entry_t pv;
 	int loops = 0;
+	boolean_t rv;
 	
-	if (m->flags & PG_FICTITIOUS)
-		return (FALSE);
-		
-	/*
-	 * Not found, check current mappings returning immediately
-	 */
-	for (pv = TAILQ_FIRST(&m->md.pv_list);
-	    pv;
-	    pv = TAILQ_NEXT(pv, pv_list)) {
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_page_exists_quick: page %p is not managed", m));
+	rv = FALSE;
+	vm_page_lock_queues();
+	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 	    	if (pv->pv_pmap == pmap) {
-	    		return (TRUE);
+			rv = TRUE;
+			break;
 	    	}
 		loops++;
 		if (loops >= 16)
 			break;
 	}
-	return (FALSE);
+	vm_page_unlock_queues();
+	return (rv);
 }
 
 /*
@@ -4469,8 +4471,8 @@ int
 pmap_ts_referenced(vm_page_t m)
 {
 
-	if (m->flags & PG_FICTITIOUS)
-		return (0);
+	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+	    ("pmap_ts_referenced: page %p is not managed", m));
 	return (pmap_clearbit(m, PVF_REF));
 }
 
@@ -4508,10 +4510,8 @@ pmap_clear_modify(vm_page_t m)
 	 */
 	if ((m->flags & PG_WRITEABLE) == 0)
 		return;
-	vm_page_lock_queues();
 	if (m->md.pvh_attrs & PVF_MOD)
 		pmap_clearbit(m, PVF_MOD);
-	vm_page_unlock_queues();
 }
 
 
@@ -4541,10 +4541,8 @@ pmap_clear_reference(vm_page_t m)
 
 	KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
 	    ("pmap_clear_reference: page %p is not managed", m));
-	vm_page_lock_queues();
 	if (m->md.pvh_attrs & PVF_REF) 
 		pmap_clearbit(m, PVF_REF);
-	vm_page_unlock_queues();
 }
 
 
@@ -4565,11 +4563,8 @@ pmap_remove_write(vm_page_t m)
 	 */
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	if ((m->oflags & VPO_BUSY) != 0 ||
-	    (m->flags & PG_WRITEABLE) != 0) {
-		vm_page_lock_queues();
+	    (m->flags & PG_WRITEABLE) != 0)
 		pmap_clearbit(m, PVF_WRITE);
-		vm_page_unlock_queues();
-	}
 }
 
 

Modified: projects/altix/sys/cam/cam_debug.h
==============================================================================
--- projects/altix/sys/cam/cam_debug.h	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/cam/cam_debug.h	Sat Jun 12 04:41:13 2010	(r209087)
@@ -40,7 +40,8 @@ typedef enum {
 	CAM_DEBUG_SUBTRACE	= 0x04,	/* internal to routine flows */
 	CAM_DEBUG_CDB		= 0x08, /* print out SCSI CDBs only */
 	CAM_DEBUG_XPT		= 0x10,	/* print out xpt scheduling */
-	CAM_DEBUG_PERIPH	= 0x20  /* print out peripheral calls */
+	CAM_DEBUG_PERIPH	= 0x20, /* print out peripheral calls */
+	CAM_DEBUG_PROBE		= 0x40  /* print out probe actions */
 } cam_debug_flags;
 
 #if defined(CAMDEBUG) && defined(_KERNEL)
@@ -58,6 +59,7 @@ extern u_int32_t cam_debug_delay;
 	 && (cam_dpath != NULL)				\
 	 && (xpt_path_comp(cam_dpath, path) >= 0)	\
 	 && (xpt_path_comp(cam_dpath, path) < 2))
+
 #define	CAM_DEBUG(path, flag, printfargs)		\
 	if ((cam_dflags & (flag))			\
 	 && (cam_dpath != NULL)				\
@@ -68,6 +70,7 @@ extern u_int32_t cam_debug_delay;
 		if (cam_debug_delay != 0)		\
 			DELAY(cam_debug_delay);		\
 	}
+
 #define	CAM_DEBUG_PRINT(flag, printfargs)		\
 	if (cam_dflags & (flag)) {			\
 		printf("cam_debug: ");			\
@@ -76,11 +79,20 @@ extern u_int32_t cam_debug_delay;
 			DELAY(cam_debug_delay);		\
 	}
 
+#define	CAM_DEBUG_PATH_PRINT(flag, path, printfargs)	\
+	if (cam_dflags & (flag)) {			\
+		xpt_print(path, "cam_debug: ");		\
+ 		printf printfargs;			\
+		if (cam_debug_delay != 0)		\
+			DELAY(cam_debug_delay);		\
+	}
+
 #else /* !CAMDEBUG || !_KERNEL */
 
 #define	CAM_DEBUGGED(A, B)	0
 #define	CAM_DEBUG(A, B, C)
 #define	CAM_DEBUG_PRINT(A, B)
+#define	CAM_DEBUG_PATH_PRINT(A, B, C)
 
 #endif /* CAMDEBUG && _KERNEL */
 

Modified: projects/altix/sys/cam/cam_xpt.c
==============================================================================
--- projects/altix/sys/cam/cam_xpt.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/cam/cam_xpt.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -196,8 +196,18 @@ static struct cdevsw xpt_cdevsw = {
 /* Storage for debugging datastructures */
 #ifdef	CAMDEBUG
 struct cam_path *cam_dpath;
-u_int32_t cam_dflags;
+#ifdef	CAM_DEBUG_FLAGS
+u_int32_t cam_dflags = CAM_DEBUG_FLAGS;
+#else
+u_int32_t cam_dflags = CAM_DEBUG_NONE;
+#endif
+TUNABLE_INT("kern.cam.dflags", &cam_dflags);
+SYSCTL_INT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RW,
+	&cam_dflags, 0, "Cam Debug Flags");
 u_int32_t cam_debug_delay;
+TUNABLE_INT("kern.cam.debug_delay", &cam_debug_delay);
+SYSCTL_INT(_kern_cam, OID_AUTO, debug_delay, CTLFLAG_RW,
+	&cam_debug_delay, 0, "Cam Debug Flags");
 #endif
 
 /* Our boot-time initialization hook */
@@ -4212,6 +4222,7 @@ xpt_alloc_target(struct cam_eb *bus, tar
 		target->target_id = target_id;
 		target->refcount = 1;
 		target->generation = 0;
+		target->luns = NULL;
 		timevalclear(&target->last_reset);
 		/*
 		 * Hold a reference to our parent bus so it
@@ -4243,6 +4254,8 @@ xpt_release_target(struct cam_et *target
 		TAILQ_REMOVE(&target->bus->et_entries, target, links);
 		target->bus->generation++;
 		xpt_release_bus(target->bus);
+		if (target->luns)
+			free(target->luns, M_CAMXPT);
 		free(target, M_CAMXPT);
 	}
 }
@@ -4505,11 +4518,6 @@ xpt_config(void *arg)
 
 #ifdef CAMDEBUG
 	/* Setup debugging flags and path */
-#ifdef CAM_DEBUG_FLAGS
-	cam_dflags = CAM_DEBUG_FLAGS;
-#else /* !CAM_DEBUG_FLAGS */
-	cam_dflags = CAM_DEBUG_NONE;
-#endif /* CAM_DEBUG_FLAGS */
 #ifdef CAM_DEBUG_BUS
 	if (cam_dflags != CAM_DEBUG_NONE) {
 		/*

Modified: projects/altix/sys/cam/cam_xpt_internal.h
==============================================================================
--- projects/altix/sys/cam/cam_xpt_internal.h	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/cam/cam_xpt_internal.h	Sat Jun 12 04:41:13 2010	(r209087)
@@ -135,6 +135,8 @@ struct cam_et {
 	u_int32_t	refcount;
 	u_int		generation;
 	struct		timeval last_reset;
+	u_int		rpl_size;
+	struct scsi_report_luns_data *luns;
 };
 
 /*

Modified: projects/altix/sys/cam/scsi/scsi_all.c
==============================================================================
--- projects/altix/sys/cam/scsi/scsi_all.c	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/cam/scsi/scsi_all.c	Sat Jun 12 04:41:13 2010	(r209087)
@@ -3954,6 +3954,57 @@ scsi_report_luns(struct ccb_scsiio *csio
 	scsi_ulto4b(alloc_len, scsi_cmd->length);
 }
 
+void
+scsi_report_target_group(struct ccb_scsiio *csio, u_int32_t retries,
+		 void (*cbfcnp)(struct cam_periph *, union ccb *),
+		 u_int8_t tag_action, u_int8_t pdf,
+		 void *buf, u_int32_t alloc_len,
+		 u_int8_t sense_len, u_int32_t timeout)
+{
+	struct scsi_target_group *scsi_cmd;
+
+	cam_fill_csio(csio,
+		      retries,
+		      cbfcnp,
+		      /*flags*/CAM_DIR_IN,
+		      tag_action,
+		      /*data_ptr*/(u_int8_t *)buf,
+		      /*dxfer_len*/alloc_len,
+		      sense_len,
+		      sizeof(*scsi_cmd),
+		      timeout);
+	scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes;
+	bzero(scsi_cmd, sizeof(*scsi_cmd));
+	scsi_cmd->opcode = MAINTENANCE_IN;
+	scsi_cmd->service_action = REPORT_TARGET_PORT_GROUPS | pdf;
+	scsi_ulto4b(alloc_len, scsi_cmd->length);
+}
+
+void
+scsi_set_target_group(struct ccb_scsiio *csio, u_int32_t retries,
+		 void (*cbfcnp)(struct cam_periph *, union ccb *),
+		 u_int8_t tag_action, void *buf, u_int32_t alloc_len,
+		 u_int8_t sense_len, u_int32_t timeout)
+{
+	struct scsi_target_group *scsi_cmd;
+
+	cam_fill_csio(csio,
+		      retries,
+		      cbfcnp,
+		      /*flags*/CAM_DIR_OUT,
+		      tag_action,
+		      /*data_ptr*/(u_int8_t *)buf,
+		      /*dxfer_len*/alloc_len,
+		      sense_len,
+		      sizeof(*scsi_cmd),
+		      timeout);
+	scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes;
+	bzero(scsi_cmd, sizeof(*scsi_cmd));
+	scsi_cmd->opcode = MAINTENANCE_OUT;
+	scsi_cmd->service_action = SET_TARGET_PORT_GROUPS;
+	scsi_ulto4b(alloc_len, scsi_cmd->length);
+}
+
 /*
  * Syncronize the media to the contents of the cache for
  * the given lba/count pair.  Specifying 0/0 means sync

Modified: projects/altix/sys/cam/scsi/scsi_all.h
==============================================================================
--- projects/altix/sys/cam/scsi/scsi_all.h	Sat Jun 12 02:00:15 2010	(r209086)
+++ projects/altix/sys/cam/scsi/scsi_all.h	Sat Jun 12 04:41:13 2010	(r209087)
@@ -22,7 +22,7 @@
  */
 
 #ifndef	_SCSI_SCSI_ALL_H
-#define _SCSI_SCSI_ALL_H 1
+#define	_SCSI_SCSI_ALL_H 1
 
 #include <sys/cdefs.h>
 
@@ -41,13 +41,13 @@ extern int scsi_delay;
 /*
  * Define dome bits that are in ALL (or a lot of) scsi commands
  */
-#define SCSI_CTL_LINK		0x01
-#define SCSI_CTL_FLAG		0x02
-#define SCSI_CTL_VENDOR		0xC0
+#define	SCSI_CTL_LINK		0x01
+#define	SCSI_CTL_FLAG		0x02
+#define	SCSI_CTL_VENDOR		0xC0
 #define	SCSI_CMD_LUN		0xA0	/* these two should not be needed */
 #define	SCSI_CMD_LUN_SHIFT	5	/* LUN in the cmd is no longer SCSI */
 
-#define SCSI_MAX_CDBLEN		16	/* 
+#define	SCSI_MAX_CDBLEN		16	/* 
 					 * 16 byte commands are in the 
 					 * SCSI-3 spec 
 					 */
@@ -56,7 +56,7 @@ extern int scsi_delay;
 #endif
 
 /* 6byte CDBs special case 0 length to be 256 */
-#define SCSI_CDB6_LEN(len)	((len) == 0 ? 256 : len)
+#define	SCSI_CDB6_LEN(len)	((len) == 0 ? 256 : len)
 
 /*
  * This type defines actions to be taken when a particular sense code is
@@ -94,16 +94,16 @@ typedef enum {
 } scsi_sense_action_qualifier;
 
 /* Mask for error status values */
-#define SS_ERRMASK	0xff
+#define	SS_ERRMASK	0xff
 
 /* The default, retyable, error action */
-#define SS_RDEF		SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE|EIO
+#define	SS_RDEF		SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE|EIO
 
 /* The retyable, error action, with table specified error code */
-#define SS_RET		SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE
+#define	SS_RET		SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE
 
 /* Fatal error action, with table specified error code */
-#define SS_FATAL	SS_FAIL|SSQ_PRINT_SENSE
+#define	SS_FATAL	SS_FAIL|SSQ_PRINT_SENSE
 
 struct scsi_generic
 {
@@ -168,16 +168,16 @@ struct scsi_mode_sense_6
 #define	SMS_DBD				0x08
 	u_int8_t page;
 #define	SMS_PAGE_CODE 			0x3F
-#define SMS_VENDOR_SPECIFIC_PAGE	0x00
-#define SMS_DISCONNECT_RECONNECT_PAGE	0x02
-#define SMS_FORMAT_DEVICE_PAGE		0x03
-#define SMS_GEOMETRY_PAGE		0x04
-#define SMS_CACHE_PAGE			0x08
-#define SMS_PERIPHERAL_DEVICE_PAGE	0x09
-#define SMS_CONTROL_MODE_PAGE		0x0A
-#define SMS_PROTO_SPECIFIC_PAGE		0x19
-#define SMS_INFO_EXCEPTIONS_PAGE	0x1C
-#define SMS_ALL_PAGES_PAGE		0x3F
+#define	SMS_VENDOR_SPECIFIC_PAGE	0x00
+#define	SMS_DISCONNECT_RECONNECT_PAGE	0x02
+#define	SMS_FORMAT_DEVICE_PAGE		0x03
+#define	SMS_GEOMETRY_PAGE		0x04
+#define	SMS_CACHE_PAGE			0x08
+#define	SMS_PERIPHERAL_DEVICE_PAGE	0x09
+#define	SMS_CONTROL_MODE_PAGE		0x0A
+#define	SMS_PROTO_SPECIFIC_PAGE		0x19
+#define	SMS_INFO_EXCEPTIONS_PAGE	0x1C
+#define	SMS_ALL_PAGES_PAGE		0x3F
 #define	SMS_PAGE_CTRL_MASK		0xC0
 #define	SMS_PAGE_CTRL_CURRENT 		0x00
 #define	SMS_PAGE_CTRL_CHANGEABLE 	0x40
@@ -262,8 +262,8 @@ struct scsi_log_sense
 #define	SLS_ERROR_VERIFY_PAGE		0x05
 #define	SLS_ERROR_NONMEDIUM_PAGE	0x06
 #define	SLS_ERROR_LASTN_PAGE		0x07
-#define SLS_SELF_TEST_PAGE		0x10
-#define SLS_IE_PAGE			0x2f
+#define	SLS_SELF_TEST_PAGE		0x10
+#define	SLS_IE_PAGE			0x2f
 #define	SLS_PAGE_CTRL_MASK		0xC0
 #define	SLS_PAGE_CTRL_THRESHOLD		0x00
 #define	SLS_PAGE_CTRL_CUMULATIVE	0x40
@@ -320,30 +320,30 @@ struct scsi_control_page {
 	u_int8_t page_code;
 	u_int8_t page_length;
 	u_int8_t rlec;
-#define SCB_RLEC			0x01	/*Report Log Exception Cond*/
+#define	SCB_RLEC			0x01	/*Report Log Exception Cond*/
 	u_int8_t queue_flags;
-#define SCP_QUEUE_ALG_MASK		0xF0
-#define SCP_QUEUE_ALG_RESTRICTED	0x00
-#define SCP_QUEUE_ALG_UNRESTRICTED	0x10
-#define SCP_QUEUE_ERR			0x02	/*Queued I/O aborted for CACs*/
-#define SCP_QUEUE_DQUE			0x01	/*Queued I/O disabled*/
+#define	SCP_QUEUE_ALG_MASK		0xF0
+#define	SCP_QUEUE_ALG_RESTRICTED	0x00
+#define	SCP_QUEUE_ALG_UNRESTRICTED	0x10
+#define	SCP_QUEUE_ERR			0x02	/*Queued I/O aborted for CACs*/
+#define	SCP_QUEUE_DQUE			0x01	/*Queued I/O disabled*/
 	u_int8_t eca_and_aen;
-#define SCP_EECA			0x80	/*Enable Extended CA*/
-#define SCP_RAENP			0x04	/*Ready AEN Permission*/
-#define SCP_UAAENP			0x02	/*UA AEN Permission*/
-#define SCP_EAENP			0x01	/*Error AEN Permission*/
+#define	SCP_EECA			0x80	/*Enable Extended CA*/
+#define	SCP_RAENP			0x04	/*Ready AEN Permission*/
+#define	SCP_UAAENP			0x02	/*UA AEN Permission*/
+#define	SCP_EAENP			0x01	/*Error AEN Permission*/
 	u_int8_t reserved;
 	u_int8_t aen_holdoff_period[2];
 };
 
 struct scsi_cache_page {
 	u_int8_t page_code;
-#define SCHP_PAGE_SAVABLE		0x80	/* Page is savable */
+#define	SCHP_PAGE_SAVABLE		0x80	/* Page is savable */
 	u_int8_t page_length;
 	u_int8_t cache_flags;
-#define SCHP_FLAGS_WCE			0x04	/* Write Cache Enable */
-#define SCHP_FLAGS_MF			0x02	/* Multiplication factor */
-#define SCHP_FLAGS_RCD			0x01	/* Read Cache Disable */
+#define	SCHP_FLAGS_WCE			0x04	/* Write Cache Enable */
+#define	SCHP_FLAGS_MF			0x02	/* Multiplication factor */
+#define	SCHP_FLAGS_RCD			0x01	/* Read Cache Disable */
 	u_int8_t rw_cache_policy;
 	u_int8_t dis_prefetch[2];
 	u_int8_t min_prefetch[2];
@@ -353,16 +353,16 @@ struct scsi_cache_page {
 
 struct scsi_info_exceptions_page {
 	u_int8_t page_code;
-#define SIEP_PAGE_SAVABLE		0x80	/* Page is savable */
+#define	SIEP_PAGE_SAVABLE		0x80	/* Page is savable */
 	u_int8_t page_length;
 	u_int8_t info_flags;
-#define SIEP_FLAGS_PERF			0x80
-#define SIEP_FLAGS_EBF			0x20
-#define SIEP_FLAGS_EWASC		0x10
-#define SIEP_FLAGS_DEXCPT		0x08
-#define SIEP_FLAGS_TEST			0x04
-#define SIEP_FLAGS_EBACKERR		0x02
-#define SIEP_FLAGS_LOGERR		0x01
+#define	SIEP_FLAGS_PERF			0x80
+#define	SIEP_FLAGS_EBF			0x20
+#define	SIEP_FLAGS_EWASC		0x10
+#define	SIEP_FLAGS_DEXCPT		0x08
+#define	SIEP_FLAGS_TEST			0x04
+#define	SIEP_FLAGS_EBACKERR		0x02
+#define	SIEP_FLAGS_LOGERR		0x01
 	u_int8_t mrie;
 	u_int8_t interval_timer[4];
 	u_int8_t report_count[4];
@@ -370,19 +370,19 @@ struct scsi_info_exceptions_page {
 
 struct scsi_proto_specific_page {
 	u_int8_t page_code;
-#define SPSP_PAGE_SAVABLE		0x80	/* Page is savable */
+#define	SPSP_PAGE_SAVABLE		0x80	/* Page is savable */
 	u_int8_t page_length;
 	u_int8_t protocol;
-#define SPSP_PROTO_FC			0x00
-#define SPSP_PROTO_SPI			0x01
-#define SPSP_PROTO_SSA			0x02
-#define SPSP_PROTO_1394			0x03
-#define SPSP_PROTO_RDMA			0x04
-#define SPSP_PROTO_ISCSI		0x05
-#define SPSP_PROTO_SAS			0x06
-#define SPSP_PROTO_ADT			0x07
-#define SPSP_PROTO_ATA			0x08
-#define SPSP_PROTO_NONE			0x0f
+#define	SPSP_PROTO_FC			0x00
+#define	SPSP_PROTO_SPI			0x01
+#define	SPSP_PROTO_SSA			0x02
+#define	SPSP_PROTO_1394			0x03
+#define	SPSP_PROTO_RDMA			0x04
+#define	SPSP_PROTO_ISCSI		0x05
+#define	SPSP_PROTO_SAS			0x06
+#define	SPSP_PROTO_ADT			0x07
+#define	SPSP_PROTO_ATA			0x08
+#define	SPSP_PROTO_NONE			0x0f
 };
 
 struct scsi_reserve
@@ -412,7 +412,7 @@ struct scsi_prevent
 	u_int8_t control;
 };
 #define	PR_PREVENT 0x01
-#define PR_ALLOW   0x00
+#define	PR_ALLOW   0x00
 
 struct scsi_sync_cache
 {
@@ -490,7 +490,7 @@ struct scsi_rw_12
 {
 	u_int8_t opcode;
 #define	SRW12_RELADDR	0x01
-#define SRW12_FUA	0x08
+#define	SRW12_FUA	0x08
 #define	SRW12_DPO	0x10
 	u_int8_t byte2;
 	u_int8_t addr[4];
@@ -527,13 +527,13 @@ struct scsi_start_stop_unit
 struct ata_pass_12 {
 	u_int8_t opcode;
 	u_int8_t protocol;
-#define AP_MULTI	0xe0
+#define	AP_MULTI	0xe0
 	u_int8_t flags;
-#define AP_T_LEN	0x03
-#define AP_BB		0x04
-#define AP_T_DIR	0x08
-#define AP_CK_COND	0x20
-#define AP_OFFLINE	0x60
+#define	AP_T_LEN	0x03
+#define	AP_BB		0x04
+#define	AP_T_DIR	0x08
+#define	AP_CK_COND	0x20
+#define	AP_OFFLINE	0x60
 	u_int8_t features;
 	u_int8_t sector_count;
 	u_int8_t lba_low;
@@ -548,7 +548,7 @@ struct ata_pass_12 {
 struct ata_pass_16 {
 	u_int8_t opcode;
 	u_int8_t protocol;
-#define AP_EXTEND	0x01
+#define	AP_EXTEND	0x01
 	u_int8_t flags;
 	u_int8_t features_ext;
 	u_int8_t features;
@@ -565,51 +565,69 @@ struct ata_pass_16 {
 	u_int8_t control;
 };
 
-#define SC_SCSI_1 0x01
-#define SC_SCSI_2 0x03
+#define	SC_SCSI_1 0x01
+#define	SC_SCSI_2 0x03
 
 /*
  * Opcodes
  */
 
 #define	TEST_UNIT_READY		0x00
-#define REQUEST_SENSE		0x03
+#define	REQUEST_SENSE		0x03
 #define	READ_6			0x08
-#define WRITE_6			0x0a
-#define INQUIRY			0x12
-#define MODE_SELECT_6		0x15
-#define MODE_SENSE_6		0x1a
-#define START_STOP_UNIT		0x1b
-#define START_STOP		0x1b
-#define RESERVE      		0x16
-#define RELEASE      		0x17
-#define	RECEIVE_DIAGNOSTIC	0x1c
-#define	SEND_DIAGNOSTIC		0x1d
-#define PREVENT_ALLOW		0x1e
+#define	WRITE_6			0x0A
+#define	INQUIRY			0x12
+#define	MODE_SELECT_6		0x15
+#define	MODE_SENSE_6		0x1A
+#define	START_STOP_UNIT		0x1B
+#define	START_STOP		0x1B
+#define	RESERVE      		0x16
+#define	RELEASE      		0x17
+#define	RECEIVE_DIAGNOSTIC	0x1C
+#define	SEND_DIAGNOSTIC		0x1D
+#define	PREVENT_ALLOW		0x1E
 #define	READ_CAPACITY		0x25
 #define	READ_10			0x28
-#define WRITE_10		0x2a
-#define POSITION_TO_ELEMENT	0x2b
+#define	WRITE_10		0x2A
+#define	POSITION_TO_ELEMENT	0x2B
 #define	SYNCHRONIZE_CACHE	0x35
 #define	READ_DEFECT_DATA_10	0x37
-#define	WRITE_BUFFER            0x3b
-#define	READ_BUFFER             0x3c
+#define	WRITE_BUFFER            0x3B
+#define	READ_BUFFER             0x3C
 #define	CHANGE_DEFINITION	0x40
-#define	LOG_SELECT		0x4c
-#define	LOG_SENSE		0x4d
+#define	LOG_SELECT		0x4C
+#define	LOG_SENSE		0x4D
 #define	MODE_SELECT_10		0x55
 #define	MODE_SENSE_10		0x5A
 #define	ATA_PASS_16		0x85
 #define	READ_16			0x88
-#define	WRITE_16		0x8a
-#define	SERVICE_ACTION_IN	0x9e
+#define	WRITE_16		0x8A
+#define	SERVICE_ACTION_IN	0x9E
 #define	REPORT_LUNS		0xA0
-#define	ATA_PASS_12		0xa1
-#define	MOVE_MEDIUM     	0xa5
-#define	READ_12			0xa8
-#define	WRITE_12		0xaa
-#define	READ_ELEMENT_STATUS	0xb8
-
+#define	ATA_PASS_12		0xA1
+#define	MAINTENANCE_IN		0xA3
+#define	MAINTENANCE_OUT		0xA4
+#define	MOVE_MEDIUM     	0xA5
+#define	READ_12			0xA8
+#define	WRITE_12		0xAA
+#define	READ_ELEMENT_STATUS	0xB8
+
+/* Maintenance In Service Action Codes */
+#define	REPORT_IDENTIFYING_INFRMATION		0x05
+#define	REPORT_TARGET_PORT_GROUPS		0x0A
+#define	REPORT_ALIASES				0x0B
+#define	REPORT_SUPPORTED_OPERATION_CODES	0x0C
+#define	REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS	0x0D
+#define	REPORT_PRIORITY				0x0E
+#define	REPORT_TIMESTAMP			0x0F
+#define	MANAGEMENT_PROTOCOL_IN			0x10
+/* Maintenance Out Service Action Codes */
+#define	SET_IDENTIFY_INFORMATION		0x06
+#define	SET_TARGET_PORT_GROUPS			0x0A
+#define	CHANGE_ALIASES				0x0B
+#define	SET_PRIORITY				0x0E
+#define	SET_TIMESTAMP				0x0F
+#define	MANGAEMENT_PROTOCOL_OUT			0x10
 
 /*
  * Device Types
@@ -635,7 +653,7 @@ struct ata_pass_16 {
 #define	T_NODEVICE	0x1f
 #define	T_ANY		0xff	/* Used in Quirk table matches */
 
-#define T_REMOV		1
+#define	T_REMOV		1
 #define	T_FIXED		0
 
 /*
@@ -670,7 +688,7 @@ struct scsi_inquiry_data
 					 * physical device is not currently
 					 * connected to this logical unit.
 					 */
-#define SID_QUAL_RSVD		0x02
+#define	SID_QUAL_RSVD		0x02
 #define	SID_QUAL_BAD_LU		0x03	/*
 					 * The target is not capable of
 					 * supporting a physical device on
@@ -688,30 +706,39 @@ struct scsi_inquiry_data
 #define	SID_QUAL2	0x7F
 #define	SID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & 0x80) != 0)
 	u_int8_t version;
-#define SID_ANSI_REV(inq_data) ((inq_data)->version & 0x07)
+#define	SID_ANSI_REV(inq_data) ((inq_data)->version & 0x07)
 #define		SCSI_REV_0		0
 #define		SCSI_REV_CCS		1
 #define		SCSI_REV_2		2
 #define		SCSI_REV_SPC		3
 #define		SCSI_REV_SPC2		4
+#define		SCSI_REV_SPC3		5
+#define		SCSI_REV_SPC4		6
 
-#define SID_ECMA	0x38
-#define SID_ISO		0xC0
+#define	SID_ECMA	0x38
+#define	SID_ISO		0xC0
 	u_int8_t response_format;
-#define SID_AENC	0x80
-#define SID_TrmIOP	0x40
+#define	SID_AENC	0x80
+#define	SID_TrmIOP	0x40
 	u_int8_t additional_length;
 #define	SID_ADDITIONAL_LENGTH(iqd)					\
 	((iqd)->additional_length +					\
 	offsetof(struct scsi_inquiry_data, additional_length) + 1)
-	u_int8_t reserved;
+	u_int8_t spc3_flags;
+#define	SPC3_SID_PROTECT	0x01
+#define	SPC3_SID_3PC		0x08
+#define	SPC3_SID_TPGS_MASK	0x30
+#define	SPC3_SID_TPGS_IMPLICIT	0x10
+#define	SPC3_SID_TPGS_EXPLICIT	0x20
+#define	SPC3_SID_ACC		0x40
+#define	SPC3_SID_SCCS		0x80
 	u_int8_t spc2_flags;
-#define SPC2_SID_MChngr 	0x08
-#define SPC2_SID_MultiP 	0x10
-#define SPC2_SID_EncServ	0x40
-#define SPC2_SID_BQueue		0x80
+#define	SPC2_SID_MChngr 	0x08
+#define	SPC2_SID_MultiP 	0x10
+#define	SPC2_SID_EncServ	0x40
+#define	SPC2_SID_BQueue		0x80
 
-#define INQ_DATA_TQ_ENABLED(iqd)				\
+#define	INQ_DATA_TQ_ENABLED(iqd)				\
     ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) :	\
     (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \
     (!((iqd)->flags & SID_CmdQue) && ((iqd)->spc2_flags & SPC2_SID_BQueue)))
@@ -724,11 +751,11 @@ struct scsi_inquiry_data
 #define	SID_WBus16	0x20
 #define	SID_WBus32	0x40
 #define	SID_RelAdr	0x80
-#define SID_VENDOR_SIZE   8
+#define	SID_VENDOR_SIZE   8
 	char	 vendor[SID_VENDOR_SIZE];
-#define SID_PRODUCT_SIZE  16
+#define	SID_PRODUCT_SIZE  16
 	char	 product[SID_PRODUCT_SIZE];
-#define SID_REVISION_SIZE 4
+#define	SID_REVISION_SIZE 4
 	char	 revision[SID_REVISION_SIZE];
 	/*
 	 * The following fields were taken from SCSI Primary Commands - 2
@@ -769,10 +796,10 @@ struct scsi_vpd_supported_page_list
 {
 	u_int8_t device;
 	u_int8_t page_code;
-#define SVPD_SUPPORTED_PAGE_LIST 0x00
+#define	SVPD_SUPPORTED_PAGE_LIST 0x00
 	u_int8_t reserved;
 	u_int8_t length;	/* number of VPD entries */
-#define SVPD_SUPPORTED_PAGES_SIZE	251
+#define	SVPD_SUPPORTED_PAGES_SIZE	251
 	u_int8_t list[SVPD_SUPPORTED_PAGES_SIZE];
 };
 
@@ -780,10 +807,10 @@ struct scsi_vpd_unit_serial_number
 {
 	u_int8_t device;
 	u_int8_t page_code;
-#define SVPD_UNIT_SERIAL_NUMBER	0x80
+#define	SVPD_UNIT_SERIAL_NUMBER	0x80
 	u_int8_t reserved;
 	u_int8_t length; /* serial number length */
-#define SVPD_SERIAL_NUM_SIZE 251
+#define	SVPD_SERIAL_NUM_SIZE 251
 	u_int8_t serial_num[SVPD_SERIAL_NUM_SIZE];
 };
 
@@ -860,6 +887,63 @@ struct scsi_report_luns_data {
 #define	RPL_LUNDATA_ATYP_LUN	0x80
 #define	RPL_LUNDATA_ATYP_EXTLUN	0xc0
 
+struct scsi_target_group
+{
+	uint8_t opcode;
+	uint8_t service_action;
+#define	STG_PDF_LENGTH		0x00
+#define	RPL_PDF_EXTENDED	0x20
+	uint8_t reserved1[4];
+	uint8_t length[4];
+	uint8_t reserved2;
+	uint8_t control;
+};
+
+struct scsi_target_port_descriptor {
+	uint8_t	reserved[2];
+	uint8_t	relative_target_port_identifier[2];
+};
+
+struct scsi_target_port_group_descriptor {
+	uint8_t	pref_state;
+#define	TPG_PRIMARY				0x80
+#define	TPG_ASYMMETRIC_ACCESS_STATE_MASK	0xf
+#define	TPG_ASYMMETRIC_ACCESS_OPTIMIZED		0x0
+#define	TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED	0x1
+#define	TPG_ASYMMETRIC_ACCESS_STANDBY		0x2
+#define	TPG_ASYMMETRIC_ACCESS_UNAVAILABLE	0x3
+#define	TPG_ASYMMETRIC_ACCESS_LBA_DEPENDENT	0x4
+#define	TPG_ASYMMETRIC_ACCESS_OFFLINE		0xE
+#define	TPG_ASYMMETRIC_ACCESS_TRANSITIONING	0xF
+	uint8_t support;
+#define	TPG_AO_SUP	0x01
+#define	TPG_AN_SUP	0x02
+#define	TPG_S_SUP	0x04
+#define	TPG_U_SUP	0x08
+#define	TPG_LBD_SUP	0x10
+#define	TPG_O_SUP	0x40
+#define	TPG_T_SUP	0x80
+	uint8_t target_port_group[2];
+	uint8_t reserved;
+	uint8_t status;
+	uint8_t vendor_specific;
+	uint8_t	target_port_count;
+	struct scsi_target_port_descriptor descriptors[1];
+};
+
+struct scsi_target_group_data {
+	uint8_t length[4];	/* length of returned data, in bytes */
+	struct scsi_target_port_group_descriptor groups[1];
+};
+
+struct scsi_target_group_data_extended {
+	uint8_t length[4];	/* length of returned data, in bytes */
+	uint8_t format_type;	/* STG_PDF_LENGTH or RPL_PDF_EXTENDED */
+	uint8_t	implicit_transition_time;
+	uint8_t reserved[2];
+	struct scsi_target_port_group_descriptor groups[1];
+};
+
 
 struct scsi_sense_data
 {
@@ -898,12 +982,12 @@ struct scsi_sense_data
 	u_int8_t fru;
 	u_int8_t sense_key_spec[3];
 #define	SSD_SCS_VALID		0x80
-#define SSD_FIELDPTR_CMD	0x40
-#define SSD_BITPTR_VALID	0x08
-#define SSD_BITPTR_VALUE	0x07
-#define SSD_MIN_SIZE 18
+#define	SSD_FIELDPTR_CMD	0x40
+#define	SSD_BITPTR_VALID	0x08
+#define	SSD_BITPTR_VALUE	0x07
+#define	SSD_MIN_SIZE 18
 	u_int8_t extra_bytes[14];
-#define SSD_FULL_SIZE sizeof(struct scsi_sense_data)
+#define	SSD_FULL_SIZE sizeof(struct scsi_sense_data)
 };
 
 struct scsi_mode_header_6
@@ -948,13 +1032,13 @@ struct scsi_mode_blk_desc
 #define	SCSI_STATUS_CHECK_COND		0x02
 #define	SCSI_STATUS_COND_MET		0x04
 #define	SCSI_STATUS_BUSY		0x08
-#define SCSI_STATUS_INTERMED		0x10
-#define SCSI_STATUS_INTERMED_COND_MET	0x14
-#define SCSI_STATUS_RESERV_CONFLICT	0x18
-#define SCSI_STATUS_CMD_TERMINATED	0x22	/* Obsolete in SAM-2 */
-#define SCSI_STATUS_QUEUE_FULL		0x28
-#define SCSI_STATUS_ACA_ACTIVE		0x30
-#define SCSI_STATUS_TASK_ABORTED	0x40
+#define	SCSI_STATUS_INTERMED		0x10
+#define	SCSI_STATUS_INTERMED_COND_MET	0x14
+#define	SCSI_STATUS_RESERV_CONFLICT	0x18
+#define	SCSI_STATUS_CMD_TERMINATED	0x22	/* Obsolete in SAM-2 */
+#define	SCSI_STATUS_QUEUE_FULL		0x28
+#define	SCSI_STATUS_ACA_ACTIVE		0x30
+#define	SCSI_STATUS_TASK_ABORTED	0x40
 
 struct scsi_inquiry_pattern {
 	u_int8_t   type;
@@ -1065,9 +1149,9 @@ int		scsi_interpret_sense(struct cam_dev
 #endif /* _KERNEL */
 
 #define	SF_RETRY_UA	0x01
-#define SF_NO_PRINT	0x02
-#define SF_QUIET_IR	0x04	/* Be quiet about Illegal Request reponses */
-#define SF_PRINT_ALWAYS	0x08
+#define	SF_NO_PRINT	0x02
+#define	SF_QUIET_IR	0x04	/* Be quiet about Illegal Request reponses */
+#define	SF_PRINT_ALWAYS	0x08
 
 
 const char *	scsi_op_desc(u_int16_t opcode, 
@@ -1174,6 +1258,20 @@ void		scsi_report_luns(struct ccb_scsiio
 				 u_int32_t alloc_len, u_int8_t sense_len,

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


More information about the svn-src-projects mailing list