--- old/usr/src/uts/common/io/mr_sas/mr_sas.c	Fri Oct 12 14:59:05 2012
+++ new/usr/src/uts/common/io/mr_sas/mr_sas.c	Fri Oct 12 14:59:05 2012
@@ -215,7 +215,6 @@
 	.disable_intr = disable_intr_ppc,
 	.intr_ack = intr_ack_ppc,
 	.init_adapter = mrsas_init_adapter_ppc
-/*	.reset_adapter = mrsas_reset_adapter_ppc */
 };
 
 
@@ -303,7 +302,6 @@
 #else	/* __sparc */
 	mrsas_quiesce	/* quiesce */
 #endif	/* __sparc */
-
 };
 
 static struct modldrv modldrv = {
@@ -325,7 +323,7 @@
 	DDI_DEFAULT_ACC
 };
 
-
+/* Use the LSI Fast Path for the 2208 (tbolt) commands. */
 unsigned int enable_fp = 1;
 
 
@@ -513,8 +511,6 @@
 			return (DDI_FAILURE);
 		}
 
-		bzero(instance, sizeof (struct mrsas_instance));
-
 		instance->unroll.softs	= 1;
 
 		/* Setup the PCI configuration space handles */
@@ -527,16 +523,7 @@
 			ddi_soft_state_free(mrsas_state, instance_no);
 			return (DDI_FAILURE);
 		}
-		if (instance->pci_handle == NULL) {
-			cmn_err(CE_WARN,
-			    "mr_sas%d: pci config setup failed ",
-			    instance_no);
-			ddi_soft_state_free(mrsas_state, instance_no);
-			return (DDI_FAILURE);
-		}
 
-
-
 		if (ddi_dev_nregs(dip, &nregs) != DDI_SUCCESS) {
 			cmn_err(CE_WARN,
 			    "mr_sas: failed to get registers.");
@@ -654,11 +641,6 @@
 			    "mr_sas: couldn't map control registers");
 			goto fail_attach;
 		}
-		if (instance->regmap_handle == NULL) {
-			cmn_err(CE_WARN,
-			    "mr_sas: couldn't map control registers");
-			goto fail_attach;
-		}
 
 		instance->unroll.regs = 1;
 
@@ -1194,22 +1176,22 @@
 	instance_no = ddi_get_instance(dip);
 
 
-	if (instance->unroll.ioctl == 1)  {
+	if (instance->unroll.ioctl == 1) {
 		ddi_remove_minor_node(dip, instance->iocnode);
 		instance->unroll.ioctl = 0;
 	}
 
-	if (instance->unroll.scsictl == 1)  {
+	if (instance->unroll.scsictl == 1) {
 		ddi_remove_minor_node(dip, "scsi");
 		instance->unroll.scsictl = 0;
 	}
 
-	if (instance->unroll.devctl == 1)  {
+	if (instance->unroll.devctl == 1) {
 		ddi_remove_minor_node(dip, "devctl");
 		instance->unroll.devctl = 0;
 	}
 
-	if (instance->unroll.tranSetup == 1)  {
+	if (instance->unroll.tranSetup == 1) {
 		if (scsi_hba_detach(dip) != DDI_SUCCESS) {
 			cmn_err(CE_WARN,
 			    "mr_sas2%d: failed to detach", instance_no);
@@ -1225,7 +1207,7 @@
 		con_log(CL_ANN1, (CE_CONT, "scsi_hba_tran_free()  done."));
 	}
 
-	if (instance->unroll.syncCmd == 1)  {
+	if (instance->unroll.syncCmd == 1) {
 		if (instance->tbolt) {
 			if (abort_syncmap_cmd(instance,
 			    instance->map_update_cmd)) {
@@ -1238,7 +1220,7 @@
 		}
 	}
 
-	if (instance->unroll.aenPend == 1)  {
+	if (instance->unroll.aenPend == 1) {
 		if (abort_aen_cmd(instance, instance->aen_cmd))
 			cmn_err(CE_WARN, "mrsas_detach: "
 			    "failed to abort prevous AEN command");
@@ -1245,7 +1227,7 @@
 
 		instance->unroll.aenPend = 0;
 		con_log(CL_ANN1, (CE_CONT, "aen cmd aborted, done."));
-		/* This means the controller is fully initialzed and running */
+		/* This means the controller is fully initialized and running */
 		/* Shutdown should be a last command to controller. */
 		/* shutdown_controller(); */
 	}
@@ -1252,7 +1234,7 @@
 
 
 	if (instance->unroll.timer == 1)	 {
-		if (instance->timeout_id != (timeout_id_t)-1)  {
+		if (instance->timeout_id != (timeout_id_t)-1) {
 			(void) untimeout(instance->timeout_id);
 			instance->timeout_id = (timeout_id_t)-1;
 
@@ -1263,7 +1245,7 @@
 	instance->func_ptr->disable_intr(instance);
 
 
-	if (instance->unroll.mutexs == 1)  {
+	if (instance->unroll.mutexs == 1) {
 		mutex_destroy(&instance->cmd_pool_mtx);
 		mutex_destroy(&instance->app_cmd_pool_mtx);
 		mutex_destroy(&instance->cmd_pend_mtx);
@@ -1474,7 +1456,7 @@
 		/* Failed to allocate memory for ioctl	*/
 		con_log(CL_ANN, (CE_WARN, "mr_sas_ioctl: "
 		    "failed to allocate memory for ioctl"));
-		return (ENXIO);
+		return (ENOMEM);
 	}
 
 	switch ((uint_t)cmd) {
@@ -2548,7 +2530,6 @@
 	struct mrsas_cmd	*cmd = NULL;
 
 	mutex_enter(&instance->cmd_pool_mtx);
-	ASSERT(mutex_owned(&instance->cmd_pool_mtx));
 
 	if (!mlist_empty(head)) {
 		cmd = mlist_entry(head->next, struct mrsas_cmd, list);
@@ -2572,7 +2553,6 @@
 	struct mrsas_cmd	*cmd = NULL;
 
 	mutex_enter(&instance->app_cmd_pool_mtx);
-	ASSERT(mutex_owned(&instance->app_cmd_pool_mtx));
 
 	if (!mlist_empty(head)) {
 		cmd = mlist_entry(head->next, struct mrsas_cmd, list);
@@ -2595,7 +2575,6 @@
 return_mfi_pkt(struct mrsas_instance *instance, struct mrsas_cmd *cmd)
 {
 	mutex_enter(&instance->cmd_pool_mtx);
-	ASSERT(mutex_owned(&instance->cmd_pool_mtx));
 	/* use mlist_add_tail for debug assistance */
 	mlist_add_tail(&cmd->list, &instance->cmd_pool_list);
 
@@ -2606,7 +2585,6 @@
 return_mfi_app_pkt(struct mrsas_instance *instance, struct mrsas_cmd *cmd)
 {
 	mutex_enter(&instance->app_cmd_pool_mtx);
-	ASSERT(mutex_owned(&instance->app_cmd_pool_mtx));
 
 	mlist_add(&cmd->list, &instance->app_cmd_pool_list);
 
@@ -2619,7 +2597,6 @@
 	struct mrsas_header	*hdr;
 	con_log(CL_DLEVEL2, (CE_NOTE, "push_pending_pkt(): Called\n"));
 	mutex_enter(&instance->cmd_pend_mtx);
-	ASSERT(mutex_owned(&instance->cmd_pend_mtx));
 	mlist_del_init(&cmd->list);
 	mlist_add_tail(&cmd->list, &instance->cmd_pend_list);
 	if (cmd->sync_cmd == MRSAS_TRUE) {
@@ -2678,7 +2655,6 @@
 	int saved_level;
 	int cmd_count = 0;
 
-
 	saved_level = debug_level_g;
 	debug_level_g = CL_ANN1;
 
@@ -3684,7 +3660,7 @@
 
 	if (mrsas_common_check(instance, cmd) != DDI_SUCCESS)
 		goto fail_fw_init;
-	/* return_mfi_pkt(instance, cmd); */ /* XXX KEBE ASKS, inherit? */
+	return_mfi_pkt(instance, cmd);
 
 	if (ctio_enable &&
 	    (instance->func_ptr->read_fw_status_reg(instance) & 0x04000000)) {
@@ -4884,11 +4860,6 @@
 
 		return (-1);
 	}
-	if (obj->dma_handle == NULL) {
-		/* XXX KEBE ASKS --> fm_service_impact()? */
-		con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_mem_alloc"));
-		return (-1);
-	}
 
 	if (ddi_dma_addr_bind_handle(obj->dma_handle, NULL, obj->buffer,
 	    obj->size, DDI_DMA_RDWR | DDI_DMA_STREAMING, DDI_DMA_SLEEP,
@@ -4901,15 +4872,7 @@
 
 		return (-1);
 	}
-	if (obj->acc_handle == NULL) {
-		/* XXX KEBE ASKS --> fm_service_impact()? */
-		ddi_dma_mem_free(&obj->acc_handle);
-		ddi_dma_free_handle(&obj->dma_handle);
 
-		con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_addr_bind_handle"));
-		return (-1);
-	}
-
 	if (mrsas_check_dma_handle(obj->dma_handle) != DDI_SUCCESS) {
 		ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
 		return (-1);
@@ -5498,7 +5461,7 @@
 	void		*ubuf;
 	uint32_t	kphys_addr = 0;
 	uint32_t	xferlen = 0;
-	uint32_t new_xfer_length = 0;
+	uint32_t	new_xfer_length = 0;
 	uint_t		model;
 	ddi_acc_handle_t	acc_handle = cmd->frame_dma_obj.acc_handle;
 	dma_obj_t			pthru_dma_obj;
@@ -6847,7 +6810,6 @@
 	}
 
 	mutex_enter(&instance->reg_write_mtx);
-	ASSERT(mutex_owned(&instance->reg_write_mtx));
 	/* Issue the command to the FW */
 	WR_IB_QPORT((cmd->frame_phys_addr) |
 	    (((cmd->frame_count - 1) << 1) | 1), instance);
@@ -6888,7 +6850,6 @@
 	cmd->cmd_status	= ENODATA;
 
 	mutex_enter(&instance->reg_write_mtx);
-	ASSERT(mutex_owned(&instance->reg_write_mtx));
 	/* Issue the command to the FW */
 	WR_IB_QPORT((cmd->frame_phys_addr) |
 	    (((cmd->frame_count - 1) << 1) | 1), instance);
@@ -7190,7 +7151,7 @@
 	    "Calling mrsas_issue_pending_cmds"));
 	(void) mrsas_issue_pending_cmds(instance);
 	con_log(CL_ANN1, (CE_NOTE, "mrsas_reset_ppc: "
-	"issue_pending_cmds done.\n"));
+	    "issue_pending_cmds done.\n"));
 
 	con_log(CL_ANN1, (CE_NOTE, "mrsas_reset_ppc: "
 	    "Calling aen registration"));
