--- old/usr/src/uts/common/io/mr_sas/fusion.h	Fri Oct 12 14:59:03 2012
+++ new/usr/src/uts/common/io/mr_sas/fusion.h	Fri Oct 12 14:59:02 2012
@@ -524,7 +524,7 @@
 	 * FW Ld Tgt Id to LD, but will purge. For example: if tgt Id is 4
 	 * and FW LD is 2, and there is only one LD, FW will populate the
 	 * array like this. [0xFF, 0xFF, 0xFF, 0xFF, 0x0.....]. This is to
-	 * help reduce the entire strcture size if there are few LDs or
+	 * help reduce the entire structure size if there are few LDs or
 	 * driver is looking info for 1 LD only.
 	 */
 	U8			ldTgtIdToLd[MAX_RAIDMAP_LOGICAL_DRIVES+ \
--- old/usr/src/uts/common/io/mr_sas/ld_pd_map.c	Fri Oct 12 14:59:04 2012
+++ new/usr/src/uts/common/io/mr_sas/ld_pd_map.c	Fri Oct 12 14:59:03 2012
@@ -28,7 +28,7 @@
 
 /*
  * This function will check if FAST IO is possible on this logical drive
- * by checking the EVENT information availabe in the driver
+ * by checking the EVENT information available in the driver
  */
 #define	MR_LD_STATE_OPTIMAL 3
 #define	ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
@@ -210,6 +210,8 @@
 	U32		armQ;
 	U32		arm;
 
+	ASSERT(raid->rowDataSize != 0);
+
 	row = (stripRow / raid->rowDataSize);
 
 	if (raid->level == 6) {
@@ -220,7 +222,7 @@
 		}
 		rowMod = (row % (raid->rowSize));
 		armQ = raid->rowSize-1-rowMod;
-		arm = armQ+1+logArm;
+		arm = armQ + 1 + logArm;
 		if (arm >= raid->rowSize)
 			arm -= raid->rowSize;
 		physArm = (U8)arm;
@@ -333,7 +335,7 @@
 	ref_in_end_stripe	= (U16)(endLba & stripe_mask);
 	endStrip		= endLba >> raid->stripeShift;
 	num_strips		= (U8)(endStrip - start_strip + 1);
-	/* Check to make sure is not deviding by zero */
+	/* Check to make sure is not dividing by zero */
 	if (raid->rowDataSize == 0)
 		return (FALSE);
 	start_row		=  (start_strip / raid->rowDataSize);
@@ -349,15 +351,16 @@
 
 	/* Check if we can send this I/O via FastPath */
 	if (raid->capability.fpCapable) {
-		if (isRead)
+		if (isRead) {
 			io_info->fpOkForIo = (raid->capability.fpReadCapable &&
 			    ((num_strips == 1) ||
 			    raid->capability.fpReadAcrossStripe));
-		else
+		} else {
 			io_info->fpOkForIo =
 			    (raid->capability.fpWriteCapable &&
 			    ((num_strips == 1) ||
 			    raid->capability.fpWriteAcrossStripe));
+		}
 	} else
 		io_info->fpOkForIo = FALSE;
 
@@ -383,11 +386,11 @@
 		}
 
 		if (numRows > 2) {
-			regSize += (numRows-2) << raid->stripeShift;
+			regSize += (numRows - 2) << raid->stripeShift;
 		}
 
-		if (endStrip == endRow*raid->rowDataSize) {
-			regSize += ref_in_end_stripe+1;
+		if (endStrip == endRow * raid->rowDataSize) {
+			regSize += ref_in_end_stripe + 1;
 		} else {
 			regSize += stripSize;
 		}
--- old/usr/src/uts/common/io/mr_sas/ld_pd_map.h	Fri Oct 12 14:59:04 2012
+++ new/usr/src/uts/common/io/mr_sas/ld_pd_map.h	Fri Oct 12 14:59:04 2012
@@ -67,7 +67,7 @@
 } MR_FW_RAID_MAP_ALL;
 
 /*
- * Raid Context structure which describes MegaRAID specific IO Paramenters
+ * Raid Context structure which describes MegaRAID specific IO Parameters
  * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames
  */
 typedef struct _MPI2_SCSI_IO_VENDOR_UNIQUE {
--- 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"));
--- old/usr/src/uts/common/io/mr_sas/mr_sas.h	Fri Oct 12 14:59:06 2012
+++ new/usr/src/uts/common/io/mr_sas/mr_sas.h	Fri Oct 12 14:59:06 2012
@@ -559,13 +559,13 @@
 		uint8_t timer;		/* Timer started. */
 		uint8_t aenPend;	/* AEN cmd pending f/w. */
 		uint8_t mapUpdate_pend; /* LD MAP update cmd pending f/w. */
-		uint8_t soft_isr;
-		uint8_t ldlist_buff;
-		uint8_t pdlist_buff;
-		uint8_t syncCmd;
-		uint8_t verBuff;
-		uint8_t alloc_space_mfi;
-		uint8_t alloc_space_mpi2;
+		uint8_t soft_isr;	/* Soft interrupt handler allocated. */
+		uint8_t ldlist_buff;	/* Logical disk list allocated. */
+		uint8_t pdlist_buff;	/* Physical disk list allocated. */
+		uint8_t syncCmd;	/* Sync map command allocated. */
+		uint8_t verBuff;	/* 2108 MFI buffer allocated. */
+		uint8_t alloc_space_mfi;  /* Allocated space for 2108 MFI. */
+		uint8_t alloc_space_mpi2; /* Allocated space for 2208 MPI2. */
 	} unroll;
 
 
@@ -663,7 +663,7 @@
  */
 #define	CL_NONE		0	/* No debug information */
 #define	CL_ANN		1	/* print unconditionally, announcements */
-#define	CL_ANN1		2	/* No o/p  */
+#define	CL_ANN1		2	/* No-op  */
 #define	CL_DLEVEL1	3	/* debug level 1, informative */
 #define	CL_DLEVEL2	4	/* debug level 2, verbose */
 #define	CL_DLEVEL3	5	/* debug level 3, very verbose */
@@ -1953,18 +1953,16 @@
 #define	DDI_VENDOR_LSI		"LSI"
 #endif /* DDI_VENDOR_LSI */
 
-int 	mrsas_config_scsi_device(struct mrsas_instance *,
-		    struct scsi_device *, dev_info_t **);
+int mrsas_config_scsi_device(struct mrsas_instance *,
+    struct scsi_device *, dev_info_t **);
 
 #ifdef PDSUPPORT
-int 	mrsas_tbolt_config_pd(struct mrsas_instance *, uint16_t,
-			uint8_t, dev_info_t **);
+int mrsas_tbolt_config_pd(struct mrsas_instance *, uint16_t,
+    uint8_t, dev_info_t **);
 #endif
 
-dev_info_t *mrsas_find_child(struct mrsas_instance *, uint16_t,
-			uint8_t);
-int	mrsas_service_evt(struct mrsas_instance *, int, int, int,
-			uint64_t);
+dev_info_t *mrsas_find_child(struct mrsas_instance *, uint16_t, uint8_t);
+int mrsas_service_evt(struct mrsas_instance *, int, int, int, uint64_t);
 void return_raid_msg_pkt(struct mrsas_instance *, struct mrsas_cmd *);
 struct mrsas_cmd *get_raid_msg_mfi_pkt(struct mrsas_instance *);
 void return_raid_msg_mfi_pkt(struct mrsas_instance *, struct mrsas_cmd *);
--- old/usr/src/uts/common/io/mr_sas/mr_sas_list.c	Fri Oct 12 14:59:07 2012
+++ new/usr/src/uts/common/io/mr_sas/mr_sas_list.c	Fri Oct 12 14:59:07 2012
@@ -2,7 +2,7 @@
  * mr_sas_list.h: header for mr_sas
  *
  * Solaris MegaRAID driver for SAS2.0 controllers
- * Copyright (c) 2008-20012, LSI Logic Corporation.
+ * Copyright (c) 2008-2012, LSI Logic Corporation.
  * All rights reserved.
  */
 
--- old/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c	Fri Oct 12 14:59:08 2012
+++ new/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c	Fri Oct 12 14:59:07 2012
@@ -551,7 +551,7 @@
 /*
  * mrsas_alloc_cmd_pool_tbolt
  *
- * TODO: merge tbolt-specific codee into mrsas_alloc_cmd_pool() to have single
+ * TODO: merge tbolt-specific code into mrsas_alloc_cmd_pool() to have single
  * routine
  */
 int
@@ -2799,8 +2799,8 @@
 
 			tbolt_complete_cmd(instance, cmd);
 		}
-		/* set it back to all 0xfffffffff. */
-		desc->Words = (uint64_t)~0;
+		/* set it back to all 1s. */
+		desc->Words = -1LL;
 
 		instance->reply_read_index++;
 
