Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jan 2012 17:04:40 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r230142 - in projects/pseries: amd64/linux32 arm/at91 arm/sa11x0 boot/forth boot/powerpc/ps3 cam/ctl cam/scsi compat/linux compat/svr4 conf contrib/dev/npe contrib/dev/nve/amd64 contrib...
Message-ID:  <201201151704.q0FH4eWE092033@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Jan 15 17:04:39 2012
New Revision: 230142
URL: http://svn.freebsd.org/changeset/base/230142

Log:
  IFC @ r230140. This obsoletes r223407 from this branch, which has been
  superseded by a similar change in HEAD.

Added:
  projects/pseries/dev/sound/pci/hda/hdaa.c
     - copied unchanged from r230140, head/sys/dev/sound/pci/hda/hdaa.c
  projects/pseries/dev/sound/pci/hda/hdaa.h
     - copied unchanged from r230140, head/sys/dev/sound/pci/hda/hdaa.h
  projects/pseries/dev/sound/pci/hda/hdaa_patches.c
     - copied unchanged from r230140, head/sys/dev/sound/pci/hda/hdaa_patches.c
  projects/pseries/dev/sound/pci/hda/hdac_if.m
     - copied unchanged from r230140, head/sys/dev/sound/pci/hda/hdac_if.m
  projects/pseries/dev/sound/pci/hda/hdacc.c
     - copied unchanged from r230140, head/sys/dev/sound/pci/hda/hdacc.c
Modified:
  projects/pseries/amd64/linux32/linux.h
  projects/pseries/amd64/linux32/linux32_dummy.c
  projects/pseries/amd64/linux32/linux32_sysvec.c
  projects/pseries/arm/at91/at91_st.c
  projects/pseries/arm/sa11x0/sa11x0_ost.c
  projects/pseries/boot/forth/loader.conf
  projects/pseries/boot/powerpc/ps3/ps3mmu.c
  projects/pseries/cam/ctl/scsi_ctl.c
  projects/pseries/cam/scsi/scsi_all.c
  projects/pseries/cam/scsi/scsi_all.h
  projects/pseries/cam/scsi/scsi_da.c
  projects/pseries/compat/linux/linux_file.c
  projects/pseries/compat/linux/linux_ioctl.c
  projects/pseries/compat/linux/linux_ipc.c
  projects/pseries/compat/linux/linux_misc.c
  projects/pseries/compat/linux/linux_signal.c
  projects/pseries/compat/linux/linux_socket.c
  projects/pseries/compat/linux/linux_stats.c
  projects/pseries/compat/svr4/imgact_svr4.c
  projects/pseries/conf/files
  projects/pseries/conf/kmod.mk
  projects/pseries/contrib/dev/npe/LICENSE
  projects/pseries/contrib/dev/nve/amd64/nvenetlib.README
  projects/pseries/contrib/dev/nve/i386/nvenetlib.README
  projects/pseries/contrib/octeon-sdk/cvmx-pcie.c
  projects/pseries/contrib/pf/net/pf_table.c
  projects/pseries/dev/ahci/ahci.h
  projects/pseries/dev/ata/ata-all.c
  projects/pseries/dev/ata/ata-all.h
  projects/pseries/dev/ata/ata-card.c
  projects/pseries/dev/ata/ata-cbus.c
  projects/pseries/dev/ata/ata-disk.c
  projects/pseries/dev/ata/ata-disk.h
  projects/pseries/dev/ata/ata-dma.c
  projects/pseries/dev/ata/ata-isa.c
  projects/pseries/dev/ata/ata-lowlevel.c
  projects/pseries/dev/ata/ata-pci.c
  projects/pseries/dev/ata/ata-pci.h
  projects/pseries/dev/ata/ata-queue.c
  projects/pseries/dev/ata/ata-raid.c
  projects/pseries/dev/ata/ata-raid.h
  projects/pseries/dev/ata/ata-sata.c
  projects/pseries/dev/ata/ata_if.m
  projects/pseries/dev/ata/atapi-cd.c
  projects/pseries/dev/ata/atapi-cd.h
  projects/pseries/dev/ata/atapi-fd.c
  projects/pseries/dev/ata/atapi-fd.h
  projects/pseries/dev/ata/atapi-tape.c
  projects/pseries/dev/ata/atapi-tape.h
  projects/pseries/dev/ata/chipsets/ata-acard.c
  projects/pseries/dev/ata/chipsets/ata-acerlabs.c
  projects/pseries/dev/ata/chipsets/ata-adaptec.c
  projects/pseries/dev/ata/chipsets/ata-ahci.c
  projects/pseries/dev/ata/chipsets/ata-amd.c
  projects/pseries/dev/ata/chipsets/ata-ati.c
  projects/pseries/dev/ata/chipsets/ata-cenatek.c
  projects/pseries/dev/ata/chipsets/ata-cypress.c
  projects/pseries/dev/ata/chipsets/ata-cyrix.c
  projects/pseries/dev/ata/chipsets/ata-highpoint.c
  projects/pseries/dev/ata/chipsets/ata-intel.c
  projects/pseries/dev/ata/chipsets/ata-ite.c
  projects/pseries/dev/ata/chipsets/ata-jmicron.c
  projects/pseries/dev/ata/chipsets/ata-marvell.c
  projects/pseries/dev/ata/chipsets/ata-micron.c
  projects/pseries/dev/ata/chipsets/ata-national.c
  projects/pseries/dev/ata/chipsets/ata-netcell.c
  projects/pseries/dev/ata/chipsets/ata-nvidia.c
  projects/pseries/dev/ata/chipsets/ata-promise.c
  projects/pseries/dev/ata/chipsets/ata-serverworks.c
  projects/pseries/dev/ata/chipsets/ata-siliconimage.c
  projects/pseries/dev/ata/chipsets/ata-sis.c
  projects/pseries/dev/ata/chipsets/ata-via.c
  projects/pseries/dev/bxe/bxe_hsi.h
  projects/pseries/dev/ex/if_ex.c
  projects/pseries/dev/ex/if_exreg.h
  projects/pseries/dev/fb/boot_font.c
  projects/pseries/dev/fb/splash_pcx.c
  projects/pseries/dev/fb/vga.c
  projects/pseries/dev/hpt27xx/README
  projects/pseries/dev/hptmv/readme.txt
  projects/pseries/dev/hwpmc/hwpmc_uncore.c
  projects/pseries/dev/hwpmc/hwpmc_uncore.h
  projects/pseries/dev/ieee488/ibfoo.c
  projects/pseries/dev/ieee488/pcii.c
  projects/pseries/dev/ieee488/upd7210.c
  projects/pseries/dev/ieee488/upd7210.h
  projects/pseries/dev/netmap/if_re_netmap.h
  projects/pseries/dev/netmap/netmap.c
  projects/pseries/dev/netmap/netmap_kern.h
  projects/pseries/dev/nxge/include/xgehal-channel.h
  projects/pseries/dev/nxge/include/xgehal-config.h
  projects/pseries/dev/nxge/xgehal/xgehal-fifo-fp.c
  projects/pseries/dev/pst/pst-iop.c
  projects/pseries/dev/pst/pst-iop.h
  projects/pseries/dev/pst/pst-pci.c
  projects/pseries/dev/pst/pst-raid.c
  projects/pseries/dev/sound/pci/ds1-fw.h
  projects/pseries/dev/sound/pci/emu10kx.c
  projects/pseries/dev/sound/pci/hda/hda_reg.h
  projects/pseries/dev/sound/pci/hda/hdac.c
  projects/pseries/dev/sound/pci/hda/hdac.h
  projects/pseries/dev/sound/pci/hda/hdac_private.h
  projects/pseries/dev/sound/pci/hda/hdac_reg.h
  projects/pseries/dev/syscons/blank/blank_saver.c
  projects/pseries/dev/syscons/fade/fade_saver.c
  projects/pseries/dev/syscons/green/green_saver.c
  projects/pseries/dev/syscons/logo/logo_saver.c
  projects/pseries/dev/syscons/rain/rain_saver.c
  projects/pseries/dev/syscons/schistory.c
  projects/pseries/dev/syscons/snake/snake_saver.c
  projects/pseries/dev/syscons/star/star_saver.c
  projects/pseries/dev/syscons/syscons.c
  projects/pseries/dev/syscons/syscons.h
  projects/pseries/dev/syscons/warp/warp_saver.c
  projects/pseries/dev/usb/controller/xhci.c
  projects/pseries/dev/usb/serial/ucycom.c
  projects/pseries/dev/usb/usb.h
  projects/pseries/dev/usb/usb_hub.c
  projects/pseries/dev/usb/usb_request.c
  projects/pseries/dev/usb/usb_request.h
  projects/pseries/dev/vxge/include/vxgehal-ll.h
  projects/pseries/fs/nfsserver/nfs_nfsdstate.c
  projects/pseries/fs/procfs/procfs.c
  projects/pseries/fs/procfs/procfs_ioctl.c
  projects/pseries/fs/pseudofs/pseudofs.c
  projects/pseries/fs/pseudofs/pseudofs.h
  projects/pseries/fs/pseudofs/pseudofs_fileno.c
  projects/pseries/fs/pseudofs/pseudofs_internal.h
  projects/pseries/fs/pseudofs/pseudofs_vncache.c
  projects/pseries/fs/pseudofs/pseudofs_vnops.c
  projects/pseries/fs/tmpfs/tmpfs_subr.c
  projects/pseries/fs/tmpfs/tmpfs_vnops.c
  projects/pseries/geom/part/g_part_ebr.c
  projects/pseries/geom/part/g_part_mbr.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_fs.h
  projects/pseries/gnu/fs/reiserfs/reiserfs_fs_i.h
  projects/pseries/gnu/fs/reiserfs/reiserfs_fs_sb.h
  projects/pseries/gnu/fs/reiserfs/reiserfs_hashes.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_inode.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_item_ops.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_mount.h
  projects/pseries/gnu/fs/reiserfs/reiserfs_namei.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_prints.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_stree.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_vfsops.c
  projects/pseries/gnu/fs/reiserfs/reiserfs_vnops.c
  projects/pseries/i386/ibcs2/coff.h
  projects/pseries/i386/ibcs2/ibcs2_isc.c
  projects/pseries/i386/ibcs2/ibcs2_sysi86.c
  projects/pseries/i386/ibcs2/ibcs2_xenix.c
  projects/pseries/i386/ibcs2/imgact_coff.c
  projects/pseries/i386/include/pcaudioio.h
  projects/pseries/i386/linux/imgact_linux.c
  projects/pseries/i386/linux/linux.h
  projects/pseries/i386/linux/linux_dummy.c
  projects/pseries/i386/linux/linux_sysvec.c
  projects/pseries/kern/imgact_elf.c
  projects/pseries/kern/kern_jail.c
  projects/pseries/kern/link_elf_obj.c
  projects/pseries/kern/subr_bus.c
  projects/pseries/kern/vfs_cache.c
  projects/pseries/kern/vfs_mount.c
  projects/pseries/mips/include/db_machdep.h
  projects/pseries/mips/mips/db_trace.c
  projects/pseries/mips/mips/elf_machdep.c
  projects/pseries/mips/mips/support.S
  projects/pseries/modules/sound/driver/hda/Makefile
  projects/pseries/net/bpf_buffer.c
  projects/pseries/net/bpf_buffer.h
  projects/pseries/net/bpf_zerocopy.c
  projects/pseries/net/bpf_zerocopy.h
  projects/pseries/netinet/sctp_output.c
  projects/pseries/netinet/sctp_usrreq.c
  projects/pseries/netinet/sctputil.c
  projects/pseries/netinet6/sctp6_var.h
  projects/pseries/ofed/drivers/infiniband/core/local_sa.c
  projects/pseries/ofed/drivers/infiniband/core/notice.c
  projects/pseries/powerpc/aim/machdep.c
  projects/pseries/powerpc/aim/slb.c
  projects/pseries/powerpc/aim/trap.c
  projects/pseries/powerpc/aim/trap_subr64.S
  projects/pseries/powerpc/include/pcpu.h
  projects/pseries/powerpc/powermac/windtunnel.c
  projects/pseries/powerpc/powerpc/genassym.c
  projects/pseries/powerpc/ps3/platform_ps3.c
  projects/pseries/sys/ata.h
  projects/pseries/sys/cdrio.h
  projects/pseries/sys/consio.h
  projects/pseries/sys/dvdio.h
  projects/pseries/sys/imgact_elf.h
  projects/pseries/sys/vnode.h
  projects/pseries/ufs/ffs/ffs_vfsops.c
Directory Properties:
  projects/pseries/   (props changed)
  projects/pseries/boot/   (props changed)
  projects/pseries/conf/   (props changed)
  projects/pseries/contrib/octeon-sdk/   (props changed)
  projects/pseries/contrib/pf/   (props changed)

Modified: projects/pseries/amd64/linux32/linux.h
==============================================================================
--- projects/pseries/amd64/linux32/linux.h	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/amd64/linux32/linux.h	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2004 Tim J. Robbins
  * Copyright (c) 2001 Doug Rabson
- * Copyright (c) 1994-1996 Søren Schmidt
+ * Copyright (c) 1994-1996 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/amd64/linux32/linux32_dummy.c
==============================================================================
--- projects/pseries/amd64/linux32/linux32_dummy.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/amd64/linux32/linux32_dummy.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/amd64/linux32/linux32_sysvec.c
==============================================================================
--- projects/pseries/amd64/linux32/linux32_sysvec.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/amd64/linux32/linux32_sysvec.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -3,7 +3,7 @@
  * Copyright (c) 2003 Peter Wemm
  * Copyright (c) 2002 Doug Rabson
  * Copyright (c) 1998-1999 Andrew Gallatin
- * Copyright (c) 1994-1996 Søren Schmidt
+ * Copyright (c) 1994-1996 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/arm/at91/at91_st.c
==============================================================================
--- projects/pseries/arm/at91/at91_st.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/arm/at91/at91_st.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -200,7 +200,7 @@ cpu_initclocks(void)
 		hz = 32768 / rel_value;
 		tick = 1000000 / hz;
 	}
-	/* Disable all interrupts. */
+	/* Disable all interrupts. */
 	WR4(ST_IDR, 0xffffffff);
 	/* The system timer shares the system irq (1) */
 	irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 1, 1, 1,

Modified: projects/pseries/arm/sa11x0/sa11x0_ost.c
==============================================================================
--- projects/pseries/arm/sa11x0/sa11x0_ost.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/arm/sa11x0/sa11x0_ost.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -251,7 +251,7 @@ cpu_initclocks()
 	stathz = STATHZ;
 	profhz = stathz;
 #if 0
-	mtx_init(&clock_lock, "SA1110 Clock locké", NULL, MTX_SPIN);
+	mtx_init(&clock_lock, "SA1110 Clock locked", NULL, MTX_SPIN);
 #endif
 	saost_sc->sc_statclock_step = TIMER_FREQUENCY / stathz;
 	struct resource *irq1, *irq2;

Modified: projects/pseries/boot/forth/loader.conf
==============================================================================
--- projects/pseries/boot/forth/loader.conf	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/boot/forth/loader.conf	Sun Jan 15 17:04:39 2012	(r230142)
@@ -31,9 +31,10 @@ verbose_loading="NO"		# Set to YES for v
 
 splash_bmp_load="NO"		# Set this to YES for bmp splash screen!
 splash_pcx_load="NO"		# Set this to YES for pcx splash screen!
+splash_txt_load="NO"		# Set this to YES for TheDraw splash screen!
 vesa_load="NO"			# Set this to YES to load the vesa module
 bitmap_load="NO"		# Set this to YES if you want splash screen!
-bitmap_name="splash.bmp"	# Set this to the name of the bmp or pcx file
+bitmap_name="splash.bmp"	# Set this to the name of the file
 bitmap_type="splash_image_data" # and place it on the module_path
 
 

Modified: projects/pseries/boot/powerpc/ps3/ps3mmu.c
==============================================================================
--- projects/pseries/boot/powerpc/ps3/ps3mmu.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/boot/powerpc/ps3/ps3mmu.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -113,7 +113,7 @@ ps3mmu_init(int maxmem)
 	    "r"(1 << SLBV_VSID_SHIFT),
 	    "r"((1 << SLBE_ESID_SHIFT) | SLBE_VALID | 1));
 
-	mtmsr(mfmsr() | PSL_IR | PSL_DR | PSL_RI | PSL_ME);
+	mtmsr(PSL_IR | PSL_DR | PSL_RI | PSL_ME);
 
 	return (0);
 }

Modified: projects/pseries/cam/ctl/scsi_ctl.c
==============================================================================
--- projects/pseries/cam/ctl/scsi_ctl.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/cam/ctl/scsi_ctl.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -305,8 +305,10 @@ ctlfeasync(void *callback_arg, uint32_t 
 
 		/* Don't attach if it doesn't support target mode */
 		if ((cpi->target_sprt & PIT_PROCESSOR) == 0) {
+#ifdef CTLFEDEBUG
 			printf("%s: SIM %s%d doesn't support target mode\n",
 			       __func__, cpi->dev_name, cpi->unit_number);
+#endif
 			break;
 		}
 
@@ -421,8 +423,10 @@ ctlfeasync(void *callback_arg, uint32_t 
 		 * XXX KDM need to figure out whether we're the master or
 		 * slave.
 		 */
+#ifdef CTLFEDEBUG
 		printf("%s: calling ctl_frontend_register() for %s%d\n",
 		       __func__, cpi->dev_name, cpi->unit_number);
+#endif
 		retval = ctl_frontend_register(fe, /*master_SC*/ 1);
 		if (retval != 0) {
 			printf("%s: ctl_frontend_register() failed with "

Modified: projects/pseries/cam/scsi/scsi_all.c
==============================================================================
--- projects/pseries/cam/scsi/scsi_all.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/cam/scsi/scsi_all.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -364,6 +364,8 @@ static struct op_table_entry scsi_op_cod
 	{ 0x40,	D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" },
 	/* 41  O               WRITE SAME(10) */
 	{ 0x41,	D, "WRITE SAME(10)" },
+	/* 42       O          UNMAP */
+	{ 0x42,	D, "UNMAP" },
 	/* 42       O          READ SUB-CHANNEL */
 	{ 0x42,	R, "READ SUB-CHANNEL" },
 	/* 43       O          READ TOC/PMA/ATIP */
@@ -5570,6 +5572,104 @@ scsi_read_write(struct ccb_scsiio *csio,
 }
 
 void
+scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries,
+		void (*cbfcnp)(struct cam_periph *, union ccb *),
+		u_int8_t tag_action, u_int8_t byte2,
+		int minimum_cmd_size, u_int64_t lba, u_int32_t block_count,
+		u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len,
+		u_int32_t timeout)
+{
+	u_int8_t cdb_len;
+	if ((minimum_cmd_size < 16) &&
+	    ((block_count & 0xffff) == block_count) &&
+	    ((lba & 0xffffffff) == lba)) {
+		/*
+		 * Need a 10 byte cdb.
+		 */
+		struct scsi_write_same_10 *scsi_cmd;
+
+		scsi_cmd = (struct scsi_write_same_10 *)&csio->cdb_io.cdb_bytes;
+		scsi_cmd->opcode = WRITE_SAME_10;
+		scsi_cmd->byte2 = byte2;
+		scsi_ulto4b(lba, scsi_cmd->addr);
+		scsi_cmd->group = 0;
+		scsi_ulto2b(block_count, scsi_cmd->length);
+		scsi_cmd->control = 0;
+		cdb_len = sizeof(*scsi_cmd);
+
+		CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE,
+			  ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0],
+			   scsi_cmd->addr[1], scsi_cmd->addr[2],
+			   scsi_cmd->addr[3], scsi_cmd->length[0],
+			   scsi_cmd->length[1], dxfer_len));
+	} else {
+		/*
+		 * 16 byte CDB.  We'll only get here if the LBA is larger
+		 * than 2^32, or if the user asks for a 16 byte command.
+		 */
+		struct scsi_write_same_16 *scsi_cmd;
+
+		scsi_cmd = (struct scsi_write_same_16 *)&csio->cdb_io.cdb_bytes;
+		scsi_cmd->opcode = WRITE_SAME_16;
+		scsi_cmd->byte2 = byte2;
+		scsi_u64to8b(lba, scsi_cmd->addr);
+		scsi_ulto4b(block_count, scsi_cmd->length);
+		scsi_cmd->group = 0;
+		scsi_cmd->control = 0;
+		cdb_len = sizeof(*scsi_cmd);
+
+		CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE,
+			  ("16byte: %x%x%x%x%x%x%x%x:%x%x%x%x: %d\n",
+			   scsi_cmd->addr[0], scsi_cmd->addr[1],
+			   scsi_cmd->addr[2], scsi_cmd->addr[3],
+			   scsi_cmd->addr[4], scsi_cmd->addr[5],
+			   scsi_cmd->addr[6], scsi_cmd->addr[7],
+			   scsi_cmd->length[0], scsi_cmd->length[1],
+			   scsi_cmd->length[2], scsi_cmd->length[3],
+			   dxfer_len));
+	}
+	cam_fill_csio(csio,
+		      retries,
+		      cbfcnp,
+		      /*flags*/CAM_DIR_OUT,
+		      tag_action,
+		      data_ptr,
+		      dxfer_len,
+		      sense_len,
+		      cdb_len,
+		      timeout);
+}
+
+void
+scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries,
+	   void (*cbfcnp)(struct cam_periph *, union ccb *),
+	   u_int8_t tag_action, u_int8_t byte2,
+	   u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len,
+	   u_int32_t timeout)
+{
+	struct scsi_unmap *scsi_cmd;
+
+	scsi_cmd = (struct scsi_unmap *)&csio->cdb_io.cdb_bytes;
+	scsi_cmd->opcode = UNMAP;
+	scsi_cmd->byte2 = byte2;
+	scsi_ulto4b(0, scsi_cmd->reserved);
+	scsi_cmd->group = 0;
+	scsi_ulto2b(dxfer_len, scsi_cmd->length);
+	scsi_cmd->control = 0;
+
+	cam_fill_csio(csio,
+		      retries,
+		      cbfcnp,
+		      /*flags*/CAM_DIR_OUT,
+		      tag_action,
+		      data_ptr,
+		      dxfer_len,
+		      sense_len,
+		      sizeof(*scsi_cmd),
+		      timeout);
+}
+
+void
 scsi_receive_diagnostic_results(struct ccb_scsiio *csio, u_int32_t retries,
 				void (*cbfcnp)(struct cam_periph *, union ccb*),
 				uint8_t tag_action, int pcv, uint8_t page_code,

Modified: projects/pseries/cam/scsi/scsi_all.h
==============================================================================
--- projects/pseries/cam/scsi/scsi_all.h	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/cam/scsi/scsi_all.h	Sun Jan 15 17:04:39 2012	(r230142)
@@ -819,6 +819,41 @@ struct scsi_rw_16
 	u_int8_t control;
 };
 
+struct scsi_write_same_10
+{
+	uint8_t	opcode;
+	uint8_t	byte2;
+#define	SWS_LBDATA	0x02
+#define	SWS_PBDATA	0x04
+#define	SWS_UNMAP	0x08
+#define	SWS_ANCHOR	0x10
+	uint8_t	addr[4];
+	uint8_t	group;
+	uint8_t	length[2];
+	uint8_t	control;
+};
+
+struct scsi_write_same_16
+{
+	uint8_t	opcode;
+	uint8_t	byte2;
+	uint8_t	addr[8];
+	uint8_t	length[4];
+	uint8_t	group;
+	uint8_t	control;
+};
+
+struct scsi_unmap
+{
+	uint8_t	opcode;
+	uint8_t	byte2;
+#define	SU_ANCHOR	0x01
+	uint8_t	reserved[4];
+	uint8_t	group;
+	uint8_t	length[2];
+	uint8_t	control;
+};
+
 struct scsi_write_verify_10
 {
 	uint8_t	opcode;
@@ -957,6 +992,8 @@ struct ata_pass_16 {
 #define	WRITE_BUFFER            0x3B
 #define	READ_BUFFER             0x3C
 #define	CHANGE_DEFINITION	0x40
+#define	WRITE_SAME_10		0x41
+#define	UNMAP			0x42
 #define	LOG_SELECT		0x4C
 #define	LOG_SENSE		0x4D
 #define	MODE_SELECT_10		0x55
@@ -970,6 +1007,7 @@ struct ata_pass_16 {
 #define	WRITE_16		0x8A
 #define	WRITE_VERIFY_16		0x8E
 #define	SYNCHRONIZE_CACHE_16	0x91
+#define	WRITE_SAME_16		0x93
 #define	SERVICE_ACTION_IN	0x9E
 #define	REPORT_LUNS		0xA0
 #define	ATA_PASS_12		0xA1
@@ -2312,6 +2350,20 @@ void scsi_read_write(struct ccb_scsiio *
 		     u_int32_t dxfer_len, u_int8_t sense_len,
 		     u_int32_t timeout);
 
+void scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries,
+		     void (*cbfcnp)(struct cam_periph *, union ccb *),
+		     u_int8_t tag_action, u_int8_t byte2, 
+		     int minimum_cmd_size, u_int64_t lba,
+		     u_int32_t block_count, u_int8_t *data_ptr,
+		     u_int32_t dxfer_len, u_int8_t sense_len,
+		     u_int32_t timeout);
+
+void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries,
+		void (*cbfcnp)(struct cam_periph *, union ccb *),
+		u_int8_t tag_action, u_int8_t byte2,
+		u_int8_t *data_ptr, u_int16_t dxfer_len,
+		u_int8_t sense_len, u_int32_t timeout);
+
 void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries,
 		     void (*cbfcnp)(struct cam_periph *, union ccb *),
 		     u_int8_t tag_action, int start, int load_eject,

Modified: projects/pseries/cam/scsi/scsi_da.c
==============================================================================
--- projects/pseries/cam/scsi/scsi_da.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/cam/scsi/scsi_da.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -83,8 +83,7 @@ typedef enum {
 	DA_FLAG_RETRY_UA	= 0x080,
 	DA_FLAG_OPEN		= 0x100,
 	DA_FLAG_SCTX_INIT	= 0x200,
-	DA_FLAG_CAN_RC16	= 0x400,
-	DA_FLAG_CAN_LBPME	= 0x800
+	DA_FLAG_CAN_RC16	= 0x400
 } da_flags;
 
 typedef enum {
@@ -101,10 +100,24 @@ typedef enum {
 	DA_CCB_BUFFER_IO	= 0x03,
 	DA_CCB_WAITING		= 0x04,
 	DA_CCB_DUMP		= 0x05,
+	DA_CCB_DELETE		= 0x06,
 	DA_CCB_TYPE_MASK	= 0x0F,
 	DA_CCB_RETRY_UA		= 0x10
 } da_ccb_state;
 
+typedef enum {
+	DA_DELETE_NONE,
+	DA_DELETE_DISABLE,
+	DA_DELETE_ZERO,
+	DA_DELETE_WS10,
+	DA_DELETE_WS16,
+	DA_DELETE_UNMAP,
+	DA_DELETE_MAX = DA_DELETE_UNMAP
+} da_delete_methods;
+
+static const char *da_delete_method_names[] =
+    { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" };
+
 /* Offsets into our private area for storing information */
 #define ccb_state	ppriv_field0
 #define ccb_bp		ppriv_ptr1
@@ -119,8 +132,12 @@ struct disk_params {
 	u_int     stripeoffset;
 };
 
+#define UNMAP_MAX_RANGES	512
+
 struct da_softc {
 	struct	 bio_queue_head bio_queue;
+	struct	 bio_queue_head delete_queue;
+	struct	 bio_queue_head delete_run_queue;
 	SLIST_ENTRY(da_softc) links;
 	LIST_HEAD(, ccb_hdr) pending_ccbs;
 	da_state state;
@@ -130,6 +147,10 @@ struct da_softc {
 	int	 error_inject;
 	int	 ordered_tag_count;
 	int	 outstanding_cmds;
+	int	 unmap_max_ranges;
+	int	 unmap_max_lba;
+	int	 delete_running;
+	da_delete_methods	 delete_method;
 	struct	 disk_params params;
 	struct	 disk *disk;
 	union	 ccb saved_ccb;
@@ -138,6 +159,7 @@ struct da_softc {
 	struct sysctl_oid	*sysctl_tree;
 	struct callout		sendordered_c;
 	uint64_t wwpn;
+	uint8_t	 unmap_buf[UNMAP_MAX_RANGES * 16 + 8];
 };
 
 struct da_quirk_entry {
@@ -796,6 +818,7 @@ static	void		daasync(void *callback_arg,
 				struct cam_path *path, void *arg);
 static	void		dasysctlinit(void *context, int pending);
 static	int		dacmdsizesysctl(SYSCTL_HANDLER_ARGS);
+static	int		dadeletemethodsysctl(SYSCTL_HANDLER_ARGS);
 static	periph_ctor_t	daregister;
 static	periph_dtor_t	dacleanup;
 static	periph_start_t	dastart;
@@ -916,6 +939,10 @@ daopen(struct disk *dp)
 		softc->disk->d_fwheads = softc->params.heads;
 		softc->disk->d_devstat->block_size = softc->params.secsize;
 		softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE;
+		if (softc->delete_method > DA_DELETE_DISABLE)
+			softc->disk->d_flags |= DISKFLAG_CANDELETE;
+		else
+			softc->disk->d_flags &= ~DISKFLAG_CANDELETE;
 
 		if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 &&
 		    (softc->quirks & DA_Q_NO_PREVENT) == 0)
@@ -1013,6 +1040,26 @@ daclose(struct disk *dp)
 	return (0);	
 }
 
+static void
+daschedule(struct cam_periph *periph)
+{
+	struct da_softc *softc = (struct da_softc *)periph->softc;
+	uint32_t prio;
+
+	/* Check if cam_periph_getccb() was called. */
+	prio = periph->immediate_priority;
+
+	/* Check if we have more work to do. */
+	if (bioq_first(&softc->bio_queue) ||
+	    (!softc->delete_running && bioq_first(&softc->delete_queue))) {
+		prio = CAM_PRIORITY_NORMAL;
+	}
+
+	/* Schedule CCB if any of above is true. */
+	if (prio != CAM_PRIORITY_NONE)
+		xpt_schedule(periph, prio);
+}
+
 /*
  * Actually translate the requested transfer into one the physical driver
  * can understand.  The transfer is described by a buf and will include
@@ -1045,12 +1092,18 @@ dastrategy(struct bio *bp)
 	/*
 	 * Place it in the queue of disk activities for this disk
 	 */
-	bioq_disksort(&softc->bio_queue, bp);
+	if (bp->bio_cmd == BIO_DELETE) {
+		if (bp->bio_bcount == 0)
+			biodone(bp);
+		else
+			bioq_disksort(&softc->delete_queue, bp);
+	} else
+		bioq_disksort(&softc->bio_queue, bp);
 
 	/*
 	 * Schedule ourselves for performing the work.
 	 */
-	xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+	daschedule(periph);
 	cam_periph_unlock(periph);
 
 	return;
@@ -1213,6 +1266,7 @@ daoninvalidate(struct cam_periph *periph
 	 *     with XPT_ABORT_CCB.
 	 */
 	bioq_flush(&softc->bio_queue, NULL, ENXIO);
+	bioq_flush(&softc->delete_queue, NULL, ENXIO);
 
 	disk_gone(softc->disk);
 	xpt_print(periph->path, "lost device - %d outstanding, %d refs\n",
@@ -1358,6 +1412,10 @@ dasysctlinit(void *context, int pending)
 	 * the fly.
 	 */
 	SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+		OID_AUTO, "delete_method", CTLTYPE_STRING | CTLFLAG_RW,
+		&softc->delete_method, 0, dadeletemethodsysctl, "A",
+		"BIO_DELETE execution method");
+	SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
 		OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW,
 		&softc->minimum_cmd_size, 0, dacmdsizesysctl, "I",
 		"Minimum CDB size");
@@ -1431,6 +1489,32 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
+static int
+dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
+{
+	char buf[16];
+	int error;
+	const char *p;
+	int i, value;
+
+	value = *(int *)arg1;
+	if (value < 0 || value > DA_DELETE_MAX)
+		p = "UNKNOWN";
+	else
+		p = da_delete_method_names[value];
+	strncpy(buf, p, sizeof(buf));
+	error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
+	if (error != 0 || req->newptr == NULL)
+		return (error);
+	for (i = 0; i <= DA_DELETE_MAX; i++) {
+		if (strcmp(buf, da_delete_method_names[i]) != 0)
+			continue;
+		*(int *)arg1 = i;
+		return (0);
+	}
+	return (EINVAL);
+}
+
 static cam_status
 daregister(struct cam_periph *periph, void *arg)
 {
@@ -1463,10 +1547,14 @@ daregister(struct cam_periph *periph, vo
 	LIST_INIT(&softc->pending_ccbs);
 	softc->state = DA_STATE_PROBE;
 	bioq_init(&softc->bio_queue);
+	bioq_init(&softc->delete_queue);
+	bioq_init(&softc->delete_run_queue);
 	if (SID_IS_REMOVABLE(&cgd->inq_data))
 		softc->flags |= DA_FLAG_PACK_REMOVABLE;
 	if ((cgd->inq_data.flags & SID_CmdQue) != 0)
 		softc->flags |= DA_FLAG_TAGGED_QUEUING;
+	softc->unmap_max_ranges = UNMAP_MAX_RANGES;
+	softc->unmap_max_lba = 1024*1024*2;
 
 	periph->softc = softc;
 
@@ -1621,13 +1709,10 @@ dastart(struct cam_periph *periph, union
 	switch (softc->state) {
 	case DA_STATE_NORMAL:
 	{
-		/* Pull a buffer from the queue and get going on it */		
-		struct bio *bp;
+		struct bio *bp, *bp1;
+		uint8_t tag_code;
 
-		/*
-		 * See if there is a buf with work for us to do..
-		 */
-		bp = bioq_first(&softc->bio_queue);
+		/* Execute immediate CCB if waiting. */
 		if (periph->immediate_priority <= periph->pinfo.priority) {
 			CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE,
 					("queuing for immediate ccb\n"));
@@ -1636,84 +1721,186 @@ dastart(struct cam_periph *periph, union
 					  periph_links.sle);
 			periph->immediate_priority = CAM_PRIORITY_NONE;
 			wakeup(&periph->ccb_list);
-		} else if (bp == NULL) {
-			xpt_release_ccb(start_ccb);
-		} else {
-			u_int8_t tag_code;
+			/* May have more work to do, so ensure we stay scheduled */
+			daschedule(periph);
+			break;
+		}
 
-			bioq_remove(&softc->bio_queue, bp);
+		/* Run BIO_DELETE if not running yet. */
+		if (!softc->delete_running &&
+		    (bp = bioq_first(&softc->delete_queue)) != NULL) {
+		    uint64_t lba;
+		    u_int count;
+
+		    if (softc->delete_method == DA_DELETE_UNMAP) {
+			uint8_t *buf = softc->unmap_buf;
+			uint64_t lastlba = (uint64_t)-1;
+			uint32_t lastcount = 0;
+			int blocks = 0, off, ranges = 0;
+
+			softc->delete_running = 1;
+			bzero(softc->unmap_buf, sizeof(softc->unmap_buf));
+			bp1 = bp;
+			do {
+				bioq_remove(&softc->delete_queue, bp1);
+				if (bp1 != bp)
+					bioq_insert_tail(&softc->delete_run_queue, bp1);
+				lba = bp1->bio_pblkno;
+				count = bp1->bio_bcount / softc->params.secsize;
+
+				/* Try to extend the previous range. */
+				if (lba == lastlba) {
+					lastcount += count;
+					off = (ranges - 1) * 16 + 8;
+					scsi_ulto4b(lastcount, &buf[off + 8]);
+				} else if (count > 0) {
+					off = ranges * 16 + 8;
+					scsi_u64to8b(lba, &buf[off + 0]);
+					scsi_ulto4b(count, &buf[off + 8]);
+					lastcount = count;
+					ranges++;
+				}
+				blocks += count;
+				lastlba = lba + count;
+				bp1 = bioq_first(&softc->delete_queue);
+				if (bp1 == NULL ||
+				    ranges >= softc->unmap_max_ranges ||
+				    blocks + bp1->bio_bcount /
+				     softc->params.secsize > softc->unmap_max_lba)
+					break;
+			} while (1);
+			scsi_ulto2b(count * 16 + 6, &buf[0]);
+			scsi_ulto2b(count * 16, &buf[2]);
+
+			scsi_unmap(&start_ccb->csio,
+					/*retries*/da_retry_count,
+					/*cbfcnp*/dadone,
+					/*tag_action*/MSG_SIMPLE_Q_TAG,
+					/*byte2*/0,
+					/*data_ptr*/ buf,
+					/*dxfer_len*/ count * 16 + 8,
+					/*sense_len*/SSD_FULL_SIZE,
+					da_default_timeout * 1000);
+			start_ccb->ccb_h.ccb_state = DA_CCB_DELETE;
+			goto out;
+		    } else if (softc->delete_method == DA_DELETE_ZERO ||
+			       softc->delete_method == DA_DELETE_WS10 ||
+			       softc->delete_method == DA_DELETE_WS16) {
+			softc->delete_running = 1;
+			lba = bp->bio_pblkno;
+			count = 0;
+			bp1 = bp;
+			do {
+				bioq_remove(&softc->delete_queue, bp1);
+				if (bp1 != bp)
+					bioq_insert_tail(&softc->delete_run_queue, bp1);
+				count += bp1->bio_bcount / softc->params.secsize;
+				bp1 = bioq_first(&softc->delete_queue);
+				if (bp1 == NULL ||
+				    lba + count != bp1->bio_pblkno ||
+				    count + bp1->bio_bcount /
+				     softc->params.secsize > 0xffff)
+					break;
+			} while (1);
+
+			scsi_write_same(&start_ccb->csio,
+					/*retries*/da_retry_count,
+					/*cbfcnp*/dadone,
+					/*tag_action*/MSG_SIMPLE_Q_TAG,
+					/*byte2*/softc->delete_method ==
+					    DA_DELETE_ZERO ? 0 : SWS_UNMAP,
+					softc->delete_method ==
+					    DA_DELETE_WS16 ? 16 : 10,
+					/*lba*/lba,
+					/*block_count*/count,
+					/*data_ptr*/ __DECONST(void *,
+					    zero_region),
+					/*dxfer_len*/ softc->params.secsize,
+					/*sense_len*/SSD_FULL_SIZE,
+					da_default_timeout * 1000);
+			start_ccb->ccb_h.ccb_state = DA_CCB_DELETE;
+			goto out;
+		    } else {
+			bioq_flush(&softc->delete_queue, NULL, 0);
+			/* FALLTHROUGH */
+		    }
+		}
 
-			if ((bp->bio_flags & BIO_ORDERED) != 0
-			 || (softc->flags & DA_FLAG_NEED_OTAG) != 0) {
-				softc->flags &= ~DA_FLAG_NEED_OTAG;
-				softc->ordered_tag_count++;
-				tag_code = MSG_ORDERED_Q_TAG;
-			} else {
-				tag_code = MSG_SIMPLE_Q_TAG;
-			}
-			switch (bp->bio_cmd) {
-			case BIO_READ:
-			case BIO_WRITE:
-				scsi_read_write(&start_ccb->csio,
-						/*retries*/da_retry_count,
-						/*cbfcnp*/dadone,
-						/*tag_action*/tag_code,
-						/*read_op*/bp->bio_cmd
-							== BIO_READ,
-						/*byte2*/0,
-						softc->minimum_cmd_size,
-						/*lba*/bp->bio_pblkno,
-						/*block_count*/bp->bio_bcount /
-						softc->params.secsize,
-						/*data_ptr*/ bp->bio_data,
-						/*dxfer_len*/ bp->bio_bcount,
-						/*sense_len*/SSD_FULL_SIZE,
-						da_default_timeout * 1000);
-				break;
-			case BIO_FLUSH:
-				/*
-				 * BIO_FLUSH doesn't currently communicate
-				 * range data, so we synchronize the cache
-				 * over the whole disk.  We also force
-				 * ordered tag semantics the flush applies
-				 * to all previously queued I/O.
-				 */
-				scsi_synchronize_cache(&start_ccb->csio,
-						       /*retries*/1,
-						       /*cbfcnp*/dadone,
-						       MSG_ORDERED_Q_TAG,
-						       /*begin_lba*/0,
-						       /*lb_count*/0,
-						       SSD_FULL_SIZE,
-						       da_default_timeout*1000);
-				break;
-			}
-			start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
+		/* Run regular command. */
+		bp = bioq_takefirst(&softc->bio_queue);
+		if (bp == NULL) {
+			xpt_release_ccb(start_ccb);
+			break;
+		}
+
+		if ((bp->bio_flags & BIO_ORDERED) != 0 ||
+		    (softc->flags & DA_FLAG_NEED_OTAG) != 0) {
+			softc->flags &= ~DA_FLAG_NEED_OTAG;
+			softc->ordered_tag_count++;
+			tag_code = MSG_ORDERED_Q_TAG;
+		} else {
+			tag_code = MSG_SIMPLE_Q_TAG;
+		}
 
+		switch (bp->bio_cmd) {
+		case BIO_READ:
+		case BIO_WRITE:
+			scsi_read_write(&start_ccb->csio,
+					/*retries*/da_retry_count,
+					/*cbfcnp*/dadone,
+					/*tag_action*/tag_code,
+					/*read_op*/bp->bio_cmd
+						== BIO_READ,
+					/*byte2*/0,
+					softc->minimum_cmd_size,
+					/*lba*/bp->bio_pblkno,
+					/*block_count*/bp->bio_bcount /
+					softc->params.secsize,
+					/*data_ptr*/ bp->bio_data,
+					/*dxfer_len*/ bp->bio_bcount,
+					/*sense_len*/SSD_FULL_SIZE,
+					da_default_timeout * 1000);
+			break;
+		case BIO_FLUSH:
 			/*
-			 * Block out any asyncronous callbacks
-			 * while we touch the pending ccb list.
+			 * BIO_FLUSH doesn't currently communicate
+			 * range data, so we synchronize the cache
+			 * over the whole disk.  We also force
+			 * ordered tag semantics the flush applies
+			 * to all previously queued I/O.
 			 */
-			LIST_INSERT_HEAD(&softc->pending_ccbs,
-					 &start_ccb->ccb_h, periph_links.le);
-			softc->outstanding_cmds++;
-
-			/* We expect a unit attention from this device */
-			if ((softc->flags & DA_FLAG_RETRY_UA) != 0) {
-				start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA;
-				softc->flags &= ~DA_FLAG_RETRY_UA;
-			}
-
-			start_ccb->ccb_h.ccb_bp = bp;
-			bp = bioq_first(&softc->bio_queue);
-
-			xpt_action(start_ccb);
+			scsi_synchronize_cache(&start_ccb->csio,
+					       /*retries*/1,
+					       /*cbfcnp*/dadone,
+					       MSG_ORDERED_Q_TAG,
+					       /*begin_lba*/0,
+					       /*lb_count*/0,
+					       SSD_FULL_SIZE,
+					       da_default_timeout*1000);
+			break;
 		}
-		
-		if (bp != NULL) {
-			/* Have more work to do, so ensure we stay scheduled */
-			xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+		start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
+
+out:
+		/*
+		 * Block out any asyncronous callbacks
+		 * while we touch the pending ccb list.
+		 */
+		LIST_INSERT_HEAD(&softc->pending_ccbs,
+				 &start_ccb->ccb_h, periph_links.le);
+		softc->outstanding_cmds++;
+
+		/* We expect a unit attention from this device */
+		if ((softc->flags & DA_FLAG_RETRY_UA) != 0) {
+			start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA;
+			softc->flags &= ~DA_FLAG_RETRY_UA;
 		}
+
+		start_ccb->ccb_h.ccb_bp = bp;
+		xpt_action(start_ccb);
+
+		/* May have more work to do, so ensure we stay scheduled */
+		daschedule(periph);
 		break;
 	}
 	case DA_STATE_PROBE:
@@ -1779,9 +1966,42 @@ cmd6workaround(union ccb *ccb)
 	struct scsi_rw_10 *cmd10;
 	struct da_softc *softc;
 	u_int8_t *cdb;
+	struct bio *bp;
 	int frozen;
 
 	cdb = ccb->csio.cdb_io.cdb_bytes;
+	softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc;
+
+	if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) {
+		if (softc->delete_method == DA_DELETE_UNMAP) {
+			xpt_print(ccb->ccb_h.path, "UNMAP is not supported, "
+			    "switching to WRITE SAME(16) with UNMAP.\n");
+			softc->delete_method = DA_DELETE_WS16;
+		} else if (softc->delete_method == DA_DELETE_WS16) {
+			xpt_print(ccb->ccb_h.path,
+			    "WRITE SAME(16) with UNMAP is not supported, "
+			    "disabling BIO_DELETE.\n");
+			softc->delete_method = DA_DELETE_DISABLE;
+		} else if (softc->delete_method == DA_DELETE_WS10) {
+			xpt_print(ccb->ccb_h.path,
+			    "WRITE SAME(10) with UNMAP is not supported, "
+			    "disabling BIO_DELETE.\n");
+			softc->delete_method = DA_DELETE_DISABLE;
+		} else if (softc->delete_method == DA_DELETE_ZERO) {
+			xpt_print(ccb->ccb_h.path,
+			    "WRITE SAME(10) is not supported, "
+			    "disabling BIO_DELETE.\n");
+			softc->delete_method = DA_DELETE_DISABLE;
+		} else
+			softc->delete_method = DA_DELETE_DISABLE;
+		while ((bp = bioq_takefirst(&softc->delete_run_queue))
+		    != NULL)
+			bioq_disksort(&softc->delete_queue, bp);
+		bioq_insert_tail(&softc->delete_queue,
+		    (struct bio *)ccb->ccb_h.ccb_bp);
+		ccb->ccb_h.ccb_bp = NULL;
+		return (0);
+	}
 
 	/* Translation only possible if CDB is an array and cmd is R/W6 */
 	if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0 ||
@@ -1790,8 +2010,7 @@ cmd6workaround(union ccb *ccb)
 
 	xpt_print(ccb->ccb_h.path, "READ(6)/WRITE(6) not supported, "
 	    "increasing minimum_cmd_size to 10.\n");
- 	softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc;
-	softc->minimum_cmd_size = 10;
+ 	softc->minimum_cmd_size = 10;
 
 	bcopy(cdb, &cmd6, sizeof(struct scsi_rw_6));
 	cmd10 = (struct scsi_rw_10 *)cdb;
@@ -1829,8 +2048,9 @@ dadone(struct cam_periph *periph, union 
 	csio = &done_ccb->csio;
 	switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) {
 	case DA_CCB_BUFFER_IO:
+	case DA_CCB_DELETE:
 	{
-		struct bio *bp;
+		struct bio *bp, *bp1;
 
 		bp = (struct bio *)done_ccb->ccb_h.ccb_bp;
 		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
@@ -1850,6 +2070,7 @@ dadone(struct cam_periph *periph, union 
 				 */
 				return;
 			}
+			bp = (struct bio *)done_ccb->ccb_h.ccb_bp;
 			if (error != 0) {
 				int queued_error;
 
@@ -1877,10 +2098,12 @@ dadone(struct cam_periph *periph, union 
 				}
 				bioq_flush(&softc->bio_queue, NULL,
 					   queued_error);
-				bp->bio_error = error;
-				bp->bio_resid = bp->bio_bcount;
-				bp->bio_flags |= BIO_ERROR;
-			} else {
+				if (bp != NULL) {
+					bp->bio_error = error;
+					bp->bio_resid = bp->bio_bcount;
+					bp->bio_flags |= BIO_ERROR;
+				}
+			} else if (bp != NULL) {
 				bp->bio_resid = csio->resid;
 				bp->bio_error = 0;
 				if (bp->bio_resid != 0)
@@ -1892,7 +2115,7 @@ dadone(struct cam_periph *periph, union 
 						 /*reduction*/0,
 						 /*timeout*/0,
 						 /*getcount_only*/0);
-		} else {
+		} else if (bp != NULL) {
 			if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
 				panic("REQ_CMP with QFRZN");
 			bp->bio_resid = csio->resid;
@@ -1921,7 +2144,22 @@ dadone(struct cam_periph *periph, union 
 				  softc->outstanding_cmds);
 		}
 
-		biodone(bp);
+		if ((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) ==
+		    DA_CCB_DELETE) {
+			while ((bp1 = bioq_takefirst(&softc->delete_run_queue))
+			    != NULL) {
+				bp1->bio_resid = bp->bio_resid;
+				bp1->bio_error = bp->bio_error;
+				if (bp->bio_flags & BIO_ERROR)
+					bp1->bio_flags |= BIO_ERROR;
+				biodone(bp1);
+			}
+			softc->delete_running = 0;
+			if (bp != NULL)
+				biodone(bp);
+			daschedule(periph);
+		} else if (bp != NULL)
+			biodone(bp);
 		break;
 	}
 	case DA_CCB_PROBE:
@@ -1991,10 +2229,9 @@ dadone(struct cam_periph *periph, union 
 			} else {
 				dasetgeom(periph, block_size, maxsector,
 				    lbppbe, lalba & SRC16_LALBA);
-				if (lalba & SRC16_LBPME)
-					softc->flags |= DA_FLAG_CAN_LBPME;
-				else
-					softc->flags &= ~DA_FLAG_CAN_LBPME;
+				if ((lalba & SRC16_LBPME) &&
+				    softc->delete_method == DA_DELETE_NONE)
+					softc->delete_method = DA_DELETE_UNMAP;
 				dp = &softc->params;
 				snprintf(announce_buf, sizeof(announce_buf),
 				        "%juMB (%ju %u byte sectors: %dH %dS/T "
@@ -2381,10 +2618,9 @@ done:
 		} else {
 			dasetgeom(periph, block_len, maxsector,
 			    lbppbe, lalba & SRC16_LALBA);
-			if (lalba & SRC16_LBPME)
-				softc->flags |= DA_FLAG_CAN_LBPME;
-			else
-				softc->flags &= ~DA_FLAG_CAN_LBPME;
+			if ((lalba & SRC16_LBPME) &&
+			    softc->delete_method == DA_DELETE_NONE)
+				softc->delete_method = DA_DELETE_UNMAP;
 		}
 	}
 

Modified: projects/pseries/compat/linux/linux_file.c
==============================================================================
--- projects/pseries/compat/linux/linux_file.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_file.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_ioctl.c
==============================================================================
--- projects/pseries/compat/linux/linux_ioctl.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_ioctl.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_ipc.c
==============================================================================
--- projects/pseries/compat/linux/linux_ipc.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_ipc.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_misc.c
==============================================================================
--- projects/pseries/compat/linux/linux_misc.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_misc.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2002 Doug Rabson
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_signal.c
==============================================================================
--- projects/pseries/compat/linux/linux_signal.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_signal.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_socket.c
==============================================================================
--- projects/pseries/compat/linux/linux_socket.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_socket.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1995 Søren Schmidt
+ * Copyright (c) 1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/linux/linux_stats.c
==============================================================================
--- projects/pseries/compat/linux/linux_stats.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/linux/linux_stats.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 1994-1995 Søren Schmidt
+ * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: projects/pseries/compat/svr4/imgact_svr4.c
==============================================================================
--- projects/pseries/compat/svr4/imgact_svr4.c	Sun Jan 15 17:01:28 2012	(r230141)
+++ projects/pseries/compat/svr4/imgact_svr4.c	Sun Jan 15 17:04:39 2012	(r230142)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1998 Mark Newton
- * Copyright (c) 1994-1996 Søren Schmidt
+ * Copyright (c) 1994-1996 Søren Schmidt
  * All rights reserved.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201151704.q0FH4eWE092033>