linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scic: remove mmio wrappers
@ 2011-03-28  0:07 Christoph Hellwig
  2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
  2011-03-31  1:43 ` [PATCH] scic: remove mmio wrappers Dan Williams
  0 siblings, 2 replies; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-28  0:07 UTC (permalink / raw)
  To: Dan Williams
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

Remove a couple of layers around read/writel to make the driver readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>

---
 drivers/scsi/isci/core/scic_sds_controller_registers.h                |  463 ----------
 drivers/scsi/isci/core/scic_sds_pci.h                                 |   94 --
 drivers/scsi/isci/core/scic_sds_phy_registers.h                       |  248 -----
 linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c                |  225 ++--
 linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h                |   34 
 linux-2.6/drivers/scsi/isci/core/scic_sds_phy.c                       |  146 +--
 linux-2.6/drivers/scsi/isci/core/scic_sds_port.c                      |   95 --
 linux-2.6/drivers/scsi/isci/core/scic_sds_port.h                      |   23 
 linux-2.6/drivers/scsi/isci/core/scic_sds_port_registers.h            |   81 -
 linux-2.6/drivers/scsi/isci/core/scic_sds_request.c                   |   11 
 linux-2.6/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c |    4 
 11 files changed, 259 insertions(+), 1165 deletions(-)

Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 00:12:06.457981999 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 01:52:45.240482390 +0200
@@ -59,8 +59,7 @@
 #include "scic_port.h"
 #include "scic_remote_device.h"
 #include "scic_sds_controller.h"
-#include "scic_sds_controller_registers.h"
-#include "scic_sds_pci.h"
+#include "scu_registers.h"
 #include "scic_sds_phy.h"
 #include "scic_sds_port_configuration_agent.h"
 #include "scic_sds_port.h"
@@ -355,7 +354,10 @@ static void scic_sds_controller_ram_init
 	 * Therefore it no longer comes out of memory in the MDL. */
 	mde = &this_controller->memory_descriptors[SCU_MDE_COMPLETION_QUEUE];
 	this_controller->completion_queue = (u32 *)mde->virtual_address;
-	SMU_CQBAR_WRITE(this_controller, mde->physical_address);
+	writel(lower_32_bits(mde->physical_address), \
+		&this_controller->smu_registers->completion_queue_lower);
+	writel(upper_32_bits(mde->physical_address),
+		&this_controller->smu_registers->completion_queue_upper);
 
 	/*
 	 * Program the location of the Remote Node Context table
@@ -363,13 +365,19 @@ static void scic_sds_controller_ram_init
 	mde = &this_controller->memory_descriptors[SCU_MDE_REMOTE_NODE_CONTEXT];
 	this_controller->remote_node_context_table = (union scu_remote_node_context *)
 						     mde->virtual_address;
-	SMU_RNCBAR_WRITE(this_controller, mde->physical_address);
+	writel(lower_32_bits(mde->physical_address),
+		&this_controller->smu_registers->remote_node_context_lower);
+	writel(upper_32_bits(mde->physical_address),
+		&this_controller->smu_registers->remote_node_context_upper);
 
 	/* Program the location of the Task Context table into the SCU. */
 	mde = &this_controller->memory_descriptors[SCU_MDE_TASK_CONTEXT];
 	this_controller->task_context_table = (struct scu_task_context *)
 					      mde->virtual_address;
-	SMU_HTTBAR_WRITE(this_controller, mde->physical_address);
+	writel(lower_32_bits(mde->physical_address),
+		&this_controller->smu_registers->host_task_table_lower);
+	writel(upper_32_bits(mde->physical_address),
+		&this_controller->smu_registers->host_task_table_upper);
 
 	mde = &this_controller->memory_descriptors[SCU_MDE_UF_BUFFER];
 	scic_sds_unsolicited_frame_control_construct(
@@ -378,13 +386,17 @@ static void scic_sds_controller_ram_init
 
 	/*
 	 * Inform the silicon as to the location of the UF headers and
-	 * address table. */
-	SCU_UFHBAR_WRITE(
-		this_controller,
-		this_controller->uf_control.headers.physical_address);
-	SCU_PUFATHAR_WRITE(
-		this_controller,
-		this_controller->uf_control.address_table.physical_address);
+	 * address table.
+	 */
+	writel(lower_32_bits(this_controller->uf_control.headers.physical_address),
+		&this_controller->scu_registers->sdma.uf_header_base_address_lower);
+	writel(upper_32_bits(this_controller->uf_control.headers.physical_address),
+		&this_controller->scu_registers->sdma.uf_header_base_address_upper);
+
+	writel(lower_32_bits(this_controller->uf_control.address_table.physical_address),
+		&this_controller->scu_registers->sdma.uf_address_table_lower);
+	writel(upper_32_bits(this_controller->uf_control.address_table.physical_address),
+		&this_controller->scu_registers->sdma.uf_address_table_upper);
 }
 
 /**
@@ -392,25 +404,26 @@ static void scic_sds_controller_ram_init
  * @this_controller:
  *
  */
-static void scic_sds_controller_assign_task_entries(
-	struct scic_sds_controller *this_controller)
+static void
+scic_sds_controller_assign_task_entries(struct scic_sds_controller *controller)
 {
 	u32 task_assignment;
 
 	/*
 	 * Assign all the TCs to function 0
-	 * TODO: Do we actually need to read this register to write it back? */
-	task_assignment = SMU_TCA_READ(this_controller, 0);
+	 * TODO: Do we actually need to read this register to write it back?
+	 */
 
 	task_assignment =
-		(
-			task_assignment
-			| (SMU_TCA_GEN_VAL(STARTING, 0))
-			| (SMU_TCA_GEN_VAL(ENDING,  this_controller->task_context_entries - 1))
-			| (SMU_TCA_GEN_BIT(RANGE_CHECK_ENABLE))
-		);
+		readl(&controller->smu_registers->task_context_assignment[0]);
+
+	task_assignment |= (SMU_TCA_GEN_VAL(STARTING, 0)) |
+		(SMU_TCA_GEN_VAL(ENDING,  controller->task_context_entries - 1)) |
+		(SMU_TCA_GEN_BIT(RANGE_CHECK_ENABLE));
+
+	writel(task_assignment,
+		&controller->smu_registers->task_context_assignment[0]);
 
-	SMU_TCA_WRITE(this_controller, 0, task_assignment);
 }
 
 /**
@@ -433,7 +446,9 @@ static void scic_sds_controller_initiali
 		| SMU_CQC_EVENT_LIMIT_SET(this_controller->completion_event_entries - 1)
 		);
 
-	SMU_CQC_WRITE(this_controller, completion_queue_control_value);
+	writel(completion_queue_control_value,
+		&this_controller->smu_registers->completion_queue_control);
+
 
 	/* Set the completion queue get pointer and enable the queue */
 	completion_queue_get_value = (
@@ -443,7 +458,8 @@ static void scic_sds_controller_initiali
 		| (SMU_CQGR_GEN_BIT(EVENT_ENABLE))
 		);
 
-	SMU_CQGR_WRITE(this_controller, completion_queue_get_value);
+	writel(completion_queue_get_value,
+		&this_controller->smu_registers->completion_queue_get);
 
 	/* Set the completion queue put pointer */
 	completion_queue_put_value = (
@@ -451,7 +467,9 @@ static void scic_sds_controller_initiali
 		| (SMU_CQPR_GEN_VAL(EVENT_POINTER, 0))
 		);
 
-	SMU_CQPR_WRITE(this_controller, completion_queue_put_value);
+	writel(completion_queue_put_value,
+		&this_controller->smu_registers->completion_queue_put);
+
 
 	/* Initialize the cycle bit of the completion queue entries */
 	for (index = 0; index < this_controller->completion_queue_entries; index++) {
@@ -479,7 +497,8 @@ static void scic_sds_controller_initiali
 	frame_queue_control_value =
 		SCU_UFQC_GEN_VAL(QUEUE_SIZE, this_controller->uf_control.address_table.count);
 
-	SCU_UFQC_WRITE(this_controller, frame_queue_control_value);
+	writel(frame_queue_control_value,
+		&this_controller->scu_registers->sdma.unsolicited_frame_queue_control);
 
 	/* Setup the get pointer for the unsolicited frame queue */
 	frame_queue_get_value = (
@@ -487,12 +506,12 @@ static void scic_sds_controller_initiali
 		|  SCU_UFQGP_GEN_BIT(ENABLE_BIT)
 		);
 
-	SCU_UFQGP_WRITE(this_controller, frame_queue_get_value);
-
+	writel(frame_queue_get_value,
+		&this_controller->scu_registers->sdma.unsolicited_frame_get_pointer);
 	/* Setup the put pointer for the unsolicited frame queue */
 	frame_queue_put_value = SCU_UFQPP_GEN_VAL(POINTER, 0);
-
-	SCU_UFQPP_WRITE(this_controller, frame_queue_put_value);
+	writel(frame_queue_put_value,
+		&this_controller->scu_registers->sdma.unsolicited_frame_put_pointer);
 }
 
 /**
@@ -505,12 +524,12 @@ static void scic_sds_controller_enable_p
 {
 	u32 port_task_scheduler_value;
 
-	port_task_scheduler_value = SCU_PTSGCR_READ(this_controller);
-
+	port_task_scheduler_value =
+		readl(&this_controller->scu_registers->peg0.ptsg.control);
 	port_task_scheduler_value |=
 		(SCU_PTSGCR_GEN_BIT(ETM_ENABLE) | SCU_PTSGCR_GEN_BIT(PTSG_ENABLE));
-
-	SCU_PTSGCR_WRITE(this_controller, port_task_scheduler_value);
+	writel(port_task_scheduler_value,
+		&this_controller->scu_registers->peg0.ptsg.control);
 }
 
 /**
@@ -531,35 +550,34 @@ static void scic_sds_controller_afe_init
 	u32 phy_id;
 
 	/* Clear DFX Status registers */
-	scu_afe_register_write(scic, afe_dfx_master_control0, 0x0081000f);
+	writel(0x0081000f, &scic->scu_registers->afe.afe_dfx_master_control0);
 	udelay(AFE_REGISTER_WRITE_DELAY);
 
 	/* Configure bias currents to normal */
 	if (is_a0())
-		scu_afe_register_write(scic, afe_bias_control, 0x00005500);
+		writel(0x00005500, &scic->scu_registers->afe.afe_bias_control);
 	else
-		scu_afe_register_write(scic, afe_bias_control, 0x00005A00);
+		writel(0x00005A00, &scic->scu_registers->afe.afe_bias_control);
 
 	udelay(AFE_REGISTER_WRITE_DELAY);
 
 	/* Enable PLL */
 	if (is_b0())
-		scu_afe_register_write(scic, afe_pll_control0, 0x80040A08);
+		writel(0x80040A08, &scic->scu_registers->afe.afe_pll_control0);
 	else
-		scu_afe_register_write(scic, afe_pll_control0, 0x80040908);
+		writel(0x80040908, &scic->scu_registers->afe.afe_pll_control0);
 
 	udelay(AFE_REGISTER_WRITE_DELAY);
 
 	/* Wait for the PLL to lock */
 	do {
-		afe_status = scu_afe_register_read(
-			scic, afe_common_block_status);
+		afe_status = readl(&scic->scu_registers->afe.afe_common_block_status);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 	} while ((afe_status & 0x00001000) == 0);
 
 	if (is_b0()) {
 		/* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */
-		scu_afe_register_write(scic, afe_pmsn_master_control0, 0x7bcc96ad);
+		writel(0x7bcc96ad, &scic->scu_registers->afe.afe_pmsn_master_control0);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 	}
 
@@ -568,16 +586,16 @@ static void scic_sds_controller_afe_init
 
 		if (is_b0()) {
 			 /* Configure transmitter SSC parameters */
-			scu_afe_txreg_write(scic, phy_id, afe_tx_ssc_control, 0x00030000);
+			writel(0x00030000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 		} else {
 			/*
 			 * All defaults, except the Receive Word Alignament/Comma Detect
 			 * Enable....(0xe800) */
-			scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004512);
+			writel(0x00004512, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 
-			scu_afe_txreg_write(scic, phy_id, afe_xcvr_control1, 0x0050100F);
+			writel(0x0050100F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control1);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 		}
 
@@ -585,61 +603,65 @@ static void scic_sds_controller_afe_init
 		 * Power up TX and RX out from power down (PWRDNTX and PWRDNRX)
 		 * & increase TX int & ext bias 20%....(0xe85c) */
 		if (is_a0())
-			scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003D4);
+			writel(0x000003D4, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control);
 		else if (is_a2())
-			scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003F0);
+			writel(0x000003F0, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control);
 		else {
 			 /* Power down TX and RX (PWRDNTX and PWRDNRX) */
-			scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d7);
+			writel(0x000003d7, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 
 			/*
 			 * Power up TX and RX out from power down (PWRDNTX and PWRDNRX)
 			 * & increase TX int & ext bias 20%....(0xe85c) */
-			scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d4);
+			writel(0x000003d4, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control);
 		}
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
 		if (is_a0() || is_a2()) {
 			/* Enable TX equalization (0xe824) */
-			scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000);
+			writel(0x00040000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 		}
 
 		/*
 		 * RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On),
 		 * RDD=0x0(RX Detect Enabled) ....(0xe800) */
-		scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004100);
+		writel(0x00004100, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
 		/* Leave DFE/FFE on */
 		if (is_a0())
-			scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F09983F);
+			writel(0x3F09983F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0);
 		else if (is_a2())
-			scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F);
+			writel(0x3F11103F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0);
 		else {
-			scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F);
+			writel(0x3F11103F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0);
 			udelay(AFE_REGISTER_WRITE_DELAY);
 			/* Enable TX equalization (0xe824) */
-			scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000);
+			writel(0x00040000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control);
 		}
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
-		scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, oem_phy->afe_tx_amp_control0);
+		writel(oem_phy->afe_tx_amp_control0,
+			&scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control0);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
-		scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, oem_phy->afe_tx_amp_control1);
+		writel(oem_phy->afe_tx_amp_control1,
+			&scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control1);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
-		scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, oem_phy->afe_tx_amp_control2);
+		writel(oem_phy->afe_tx_amp_control2,
+			&scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control2);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 
-		scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, oem_phy->afe_tx_amp_control3);
+		writel(oem_phy->afe_tx_amp_control3,
+			&scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control3);
 		udelay(AFE_REGISTER_WRITE_DELAY);
 	}
 
 	/* Transfer control to the PEs */
-	scu_afe_register_write(scic, afe_dfx_master_control0, 0x00010f00);
+	writel(0x00010f00, &scic->scu_registers->afe.afe_dfx_master_control0);
 	udelay(AFE_REGISTER_WRITE_DELAY);
 }
 
@@ -1437,8 +1459,9 @@ static void scic_sds_controller_process_
 			| event_cycle | SMU_CQGR_GEN_VAL(EVENT_POINTER, event_index)
 			| get_cycle   | SMU_CQGR_GEN_VAL(POINTER, get_index);
 
-		SMU_CQGR_WRITE(this_controller,
-			       this_controller->completion_queue_get);
+		writel(this_controller->completion_queue_get,
+			&this_controller->smu_registers->completion_queue_get);
+
 	}
 
 	dev_dbg(scic_to_dev(this_controller),
@@ -1456,15 +1479,15 @@ bool scic_sds_controller_isr(struct scic
 		/*
 		 * we have a spurious interrupt it could be that we have already
 		 * emptied the completion queue from a previous interrupt */
-		SMU_ISR_WRITE(scic, SMU_ISR_COMPLETION);
+		writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status);
 
 		/*
 		 * There is a race in the hardware that could cause us not to be notified
 		 * of an interrupt completion if we do not take this step.  We will mask
 		 * then unmask the interrupts so if there is another interrupt pending
 		 * the clearing of the interrupt source we get the next interrupt message. */
-		SMU_IMR_WRITE(scic, 0xFF000000);
-		SMU_IMR_WRITE(scic, 0x00000000);
+		writel(0xFF000000, &scic->smu_registers->interrupt_mask);
+		writel(0, &scic->smu_registers->interrupt_mask);
 	}
 
 	return false;
@@ -1477,18 +1500,18 @@ void scic_sds_controller_completion_hand
 		scic_sds_controller_process_completions(scic);
 
 	/* Clear the interrupt and enable all interrupts again */
-	SMU_ISR_WRITE(scic, SMU_ISR_COMPLETION);
+	writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status);
 	/* Could we write the value of SMU_ISR_COMPLETION? */
-	SMU_IMR_WRITE(scic, 0xFF000000);
-	SMU_IMR_WRITE(scic, 0x00000000);
+	writel(0xFF000000, &scic->smu_registers->interrupt_mask);
+	writel(0, &scic->smu_registers->interrupt_mask);
 }
 
 bool scic_sds_controller_error_isr(struct scic_sds_controller *scic)
 {
 	u32 interrupt_status;
 
-	interrupt_status = SMU_ISR_READ(scic);
-
+	interrupt_status =
+		readl(&scic->smu_registers->interrupt_status);
 	interrupt_status &= (SMU_ISR_QUEUE_ERROR | SMU_ISR_QUEUE_SUSPEND);
 
 	if (interrupt_status != 0) {
@@ -1504,8 +1527,8 @@ bool scic_sds_controller_error_isr(struc
 	 * then unmask the error interrupts so if there was another interrupt
 	 * pending we will be notified.
 	 * Could we write the value of (SMU_ISR_QUEUE_ERROR | SMU_ISR_QUEUE_SUSPEND)? */
-	SMU_IMR_WRITE(scic, 0x000000FF);
-	SMU_IMR_WRITE(scic, 0x00000000);
+	writel(0xff, &scic->smu_registers->interrupt_mask);
+	writel(0, &scic->smu_registers->interrupt_mask);
 
 	return false;
 }
@@ -1514,14 +1537,14 @@ void scic_sds_controller_error_handler(s
 {
 	u32 interrupt_status;
 
-	interrupt_status = SMU_ISR_READ(scic);
+	interrupt_status =
+		readl(&scic->smu_registers->interrupt_status);
 
 	if ((interrupt_status & SMU_ISR_QUEUE_SUSPEND) &&
 	    scic_sds_controller_completion_queue_has_entries(scic)) {
 
 		scic_sds_controller_process_completions(scic);
-		SMU_ISR_WRITE(scic, SMU_ISR_QUEUE_SUSPEND);
-
+		writel(SMU_ISR_QUEUE_SUSPEND, &scic->smu_registers->interrupt_status);
 	} else {
 		dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__,
 			interrupt_status);
@@ -1535,7 +1558,7 @@ void scic_sds_controller_error_handler(s
 	/* If we dont process any completions I am not sure that we want to do this.
 	 * We are in the middle of a hardware fault and should probably be reset.
 	 */
-	SMU_IMR_WRITE(scic, 0x00000000);
+	writel(0, &scic->smu_registers->interrupt_mask);
 }
 
 
@@ -1648,7 +1671,7 @@ void scic_sds_controller_post_request(
 		this_controller,
 		request);
 
-	SMU_PCP_WRITE(this_controller, request);
+	writel(request, &this_controller->smu_registers->post_context_port);
 }
 
 /**
@@ -1871,7 +1894,8 @@ void scic_sds_controller_release_frame(
 {
 	if (scic_sds_unsolicited_frame_control_release_frame(
 		    &this_controller->uf_control, frame_index) == true)
-		SCU_UFQGP_WRITE(this_controller, this_controller->uf_control.get);
+		writel(this_controller->uf_control.get,
+			&this_controller->scu_registers->sdma.unsolicited_frame_get_pointer);
 }
 
 /**
@@ -2478,14 +2502,14 @@ void scic_controller_enable_interrupts(
 	struct scic_sds_controller *scic)
 {
 	BUG_ON(scic->smu_registers == NULL);
-	SMU_IMR_WRITE(scic, 0x00000000);
+	writel(0, &scic->smu_registers->interrupt_mask);
 }
 
 void scic_controller_disable_interrupts(
 	struct scic_sds_controller *scic)
 {
 	BUG_ON(scic->smu_registers == NULL);
-	SMU_IMR_WRITE(scic, 0xffffffff);
+	writel(0xffffffff, &scic->smu_registers->interrupt_mask);
 }
 
 static enum sci_status scic_controller_set_mode(
@@ -2543,16 +2567,16 @@ static void scic_sds_controller_reset_ha
 	scic_controller_disable_interrupts(scic);
 
 	/* Reset the SCU */
-	SMU_SMUSRCR_WRITE(scic, 0xFFFFFFFF);
+	writel(0xFFFFFFFF, &scic->smu_registers->soft_reset_control);
 
 	/* Delay for 1ms to before clearing the CQP and UFQPR. */
 	udelay(1000);
 
 	/* The write to the CQGR clears the CQP */
-	SMU_CQGR_WRITE(scic, 0x00000000);
+	writel(0x00000000, &scic->smu_registers->completion_queue_get);
 
 	/* The write to the UFQGP clears the UFQPR */
-	SCU_UFQGP_WRITE(scic, 0x00000000);
+	writel(0, &scic->scu_registers->sdma.unsolicited_frame_get_pointer);
 }
 
 enum sci_status scic_user_parameters_set(
@@ -2778,11 +2802,10 @@ static enum sci_status scic_controller_s
 			return SCI_FAILURE_INVALID_PARAMETER_VALUE;
 	}
 
-	SMU_ICC_WRITE(
-		scic_controller,
-		(SMU_ICC_GEN_VAL(NUMBER, coalesce_number) |
-		 SMU_ICC_GEN_VAL(TIMER, timeout_encode))
-		);
+	writel(SMU_ICC_GEN_VAL(NUMBER, coalesce_number) |
+	       SMU_ICC_GEN_VAL(TIMER, timeout_encode),
+	       &scic_controller->smu_registers->interrupt_coalesce_control);
+
 
 	scic_controller->interrupt_coalesce_number = (u16)coalesce_number;
 	scic_controller->interrupt_coalesce_timeout = coalesce_timeout / 100;
@@ -2868,7 +2891,7 @@ static enum sci_status scic_sds_controll
 		u32 terminate_loop;
 
 		/* Take the hardware out of reset */
-		SMU_SMUSRCR_WRITE(scic, 0x00000000);
+		writel(0, &scic->smu_registers->soft_reset_control);
 
 		/*
 		 * / @todo Provide meaningfull error code for hardware failure
@@ -2879,7 +2902,7 @@ static enum sci_status scic_sds_controll
 		while (terminate_loop-- && (result != SCI_SUCCESS)) {
 			/* Loop until the hardware reports success */
 			udelay(SCU_CONTEXT_RAM_INIT_STALL_TIME);
-			status = SMU_SMUCSR_READ(scic);
+			status = readl(&scic->smu_registers->control_status);
 
 			if ((status & SCU_RAM_INIT_COMPLETED) ==
 					SCU_RAM_INIT_COMPLETED)
@@ -2896,7 +2919,9 @@ static enum sci_status scic_sds_controll
 		/*
 		 * Determine what are the actaul device capacities that the
 		 * hardware will support */
-		device_context_capacity = SMU_DCC_READ(scic);
+		device_context_capacity =
+			readl(&scic->smu_registers->device_context_capacity);
+
 
 		max_supported_ports = smu_dcc_get_max_ports(device_context_capacity);
 		max_supported_devices = smu_dcc_get_max_remote_node_context(device_context_capacity);
@@ -2910,9 +2935,7 @@ static enum sci_status scic_sds_controll
 			struct scu_port_task_scheduler_group_registers *ptsg =
 				&scic->scu_registers->peg0.ptsg;
 
-			scu_register_write(scic,
-					   ptsg->protocol_engine[index],
-					   index);
+			writel(index, &ptsg->protocol_engine[index]);
 		}
 
 		/* Record the smaller of the two capacity values */
@@ -2939,16 +2962,20 @@ static enum sci_status scic_sds_controll
 		u32 dma_configuration;
 
 		/* Configure the payload DMA */
-		dma_configuration = SCU_PDMACR_READ(scic);
+		dma_configuration =
+			readl(&scic->scu_registers->sdma.pdma_configuration);
 		dma_configuration |=
 			SCU_PDMACR_GEN_BIT(PCI_RELAXED_ORDERING_ENABLE);
-		SCU_PDMACR_WRITE(scic, dma_configuration);
+		writel(dma_configuration,
+			&scic->scu_registers->sdma.pdma_configuration);
 
 		/* Configure the control DMA */
-		dma_configuration = SCU_CDMACR_READ(scic);
+		dma_configuration =
+			readl(&scic->scu_registers->sdma.cdma_configuration);
 		dma_configuration |=
 			SCU_CDMACR_GEN_BIT(PCI_RELAXED_ORDERING_ENABLE);
-		SCU_CDMACR_WRITE(scic, dma_configuration);
+		writel(dma_configuration,
+			&scic->scu_registers->sdma.cdma_configuration);
 	}
 
 	/*
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 00:12:06.393982529 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 00:29:02.285004208 +0200
@@ -57,6 +57,7 @@
 #define _SCIC_SDS_CONTROLLER_H_
 
 #include <linux/string.h>
+#include <linux/io.h>
 
 /**
  * This file contains the structures, constants and prototypes used for the
@@ -80,7 +81,6 @@
 #include "scu_unsolicited_frame.h"
 #include "scic_sds_unsolicited_frame_control.h"
 #include "scic_sds_port_configuration_agent.h"
-#include "scic_sds_pci.h"
 
 struct scic_sds_remote_device;
 struct scic_sds_request;
@@ -428,38 +428,6 @@ extern const struct scic_sds_controller_
 	(&(controller)->port_agent)
 
 /**
- * smu_register_write() -
- *
- * This macro writes to the smu_register for this controller
- */
-#define smu_register_write(controller, reg, value) \
-	scic_sds_pci_write_smu_dword((controller), &(reg), (value))
-
-/**
- * smu_register_read() -
- *
- * This macro reads the smu_register for this controller
- */
-#define smu_register_read(controller, reg) \
-	scic_sds_pci_read_smu_dword((controller), &(reg))
-
-/**
- * scu_register_write() -
- *
- * This mcaro writes the scu_register for this controller
- */
-#define scu_register_write(controller, reg, value) \
-	scic_sds_pci_write_scu_dword((controller), &(reg), (value))
-
-/**
- * scu_register_read() -
- *
- * This macro reads the scu_register for this controller
- */
-#define scu_register_read(controller, reg) \
-	scic_sds_pci_read_scu_dword((controller), &(reg))
-
-/**
  * scic_sds_controller_get_protocol_engine_group() -
  *
  * This macro returns the protocol engine group for this controller object.
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller_registers.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller_registers.h	2011-03-28 00:12:06.417982989 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,463 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCIC_SDS_CONTROLLER_REGISTERS_H_
-#define _SCIC_SDS_CONTROLLER_REGISTERS_H_
-
-/**
- * This file contains macros used to perform the register reads/writes to the
- *    SCU hardware.
- *
- *
- */
-
-#include "scu_registers.h"
-#include "scic_sds_controller.h"
-
-/**
- * scic_sds_controller_smu_register_read() -
- *
- * SMU_REGISTER_ACCESS_MACROS
- */
-#define scic_sds_controller_smu_register_read(controller, reg) \
-	smu_register_read(\
-		(controller), \
-		(controller)->smu_registers->reg \
-		)
-
-#define scic_sds_controller_smu_register_write(controller, reg, value) \
-	smu_register_write(\
-		(controller), \
-		(controller)->smu_registers->reg, \
-		(value)	\
-		)
-
-/**
- * scu_afe_register_write() -
- *
- * AFE_REGISTER_ACCESS_MACROS
- */
-#define scu_afe_register_write(controller, reg, value) \
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->afe.reg, \
-		(value)	\
-		)
-
-#define scu_afe_txreg_write(controller, phy, reg, value) \
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->afe.scu_afe_xcvr[phy].reg,\
-		(value) \
-		)
-
-#define scu_afe_register_read(controller, reg) \
-	scu_register_read(\
-		(controller), \
-		(controller)->scu_registers->afe.reg \
-		)
-
-/**
- * scu_controller_viit_register_write() -
- *
- * VIIT_REGISTER_ACCESS_MACROS
- */
-#define scu_controller_viit_register_write(controller, index, reg, value) \
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->peg0.viit[index].reg, \
-		value \
-		)
-
-/*
- * *****************************************************************************
- * * SMU REGISTERS
- * ***************************************************************************** */
-
-/**
- * SMU_PCP_WRITE() -
- *
- * struct smu_registers
- */
-#define SMU_PCP_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, post_context_port, value \
-		)
-
-#define SMU_TCR_READ(controller, value)	\
-	scic_sds_controller_smu_register_read(\
-		controller, task_context_range \
-		)
-
-#define SMU_TCR_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, task_context_range, value \
-		)
-
-#define SMU_HTTBAR_WRITE(controller, address) \
-	{ \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			host_task_table_lower, \
-			lower_32_bits(address) \
-			); \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			host_task_table_upper, \
-			upper_32_bits(address) \
-			); \
-	}
-
-#define SMU_CQBAR_WRITE(controller, address) \
-	{ \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			completion_queue_lower,	\
-			lower_32_bits(address) \
-			); \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			completion_queue_upper,	\
-			upper_32_bits(address) \
-			); \
-	}
-
-#define SMU_CQGR_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, completion_queue_get, value	\
-		)
-
-#define SMU_CQGR_READ(controller, value) \
-	scic_sds_controller_smu_register_read(\
-		controller, completion_queue_get \
-		)
-
-#define SMU_CQPR_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, completion_queue_put, value	\
-		)
-
-#define SMU_RNCBAR_WRITE(controller, address) \
-	{ \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			remote_node_context_lower, \
-			lower_32_bits(address) \
-			); \
-		scic_sds_controller_smu_register_write(\
-			controller, \
-			remote_node_context_upper, \
-			upper_32_bits(address) \
-			); \
-	}
-
-#define SMU_AMR_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, address_modifier \
-		)
-
-#define SMU_IMR_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, interrupt_mask \
-		)
-
-#define SMU_IMR_WRITE(controller, mask)	\
-	scic_sds_controller_smu_register_write(\
-		controller, interrupt_mask, mask \
-		)
-
-#define SMU_ISR_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, interrupt_status \
-		)
-
-#define SMU_ISR_WRITE(controller, status) \
-	scic_sds_controller_smu_register_write(\
-		controller, interrupt_status, status \
-		)
-
-#define SMU_ICC_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, interrupt_coalesce_control \
-		)
-
-#define SMU_ICC_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, interrupt_coalesce_control, value \
-		)
-
-#define SMU_CQC_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, completion_queue_control, value \
-		)
-
-#define SMU_SMUSRCR_WRITE(controller, value) \
-	scic_sds_controller_smu_register_write(\
-		controller, soft_reset_control, value \
-		)
-
-#define SMU_TCA_WRITE(controller, index, value)	\
-	scic_sds_controller_smu_register_write(\
-		controller, task_context_assignment[index], value \
-		)
-
-#define SMU_TCA_READ(controller, index)	\
-	scic_sds_controller_smu_register_read(\
-		controller, task_context_assignment[index] \
-		)
-
-#define SMU_DCC_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, device_context_capacity \
-		)
-
-#define SMU_DFC_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, device_function_capacity \
-		)
-
-#define SMU_SMUCSR_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, control_status \
-		)
-
-#define SMU_CQPR_READ(controller) \
-	scic_sds_controller_smu_register_read(\
-		controller, completion_queue_put \
-		)
-
-
-/**
- * scic_sds_controller_scu_register_read() -
- *
- * SCU_REGISTER_ACCESS_MACROS
- */
-#define scic_sds_controller_scu_register_read(controller, reg) \
-	scu_register_read(\
-		(controller), \
-		(controller)->scu_registers->reg \
-		)
-
-#define scic_sds_controller_scu_register_write(controller, reg, value) \
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->reg, \
-		(value)	\
-		)
-
-
-/*
- * ****************************************************************************
- * *  SCU SDMA REGISTERS
- * **************************************************************************** */
-
-/**
- * scu_sdma_register_read() -
- *
- * SCU_SDMA_REGISTER_ACCESS_MACROS
- */
-#define scu_sdma_register_read(controller, reg)	\
-	scu_register_read(\
-		(controller), \
-		(controller)->scu_registers->sdma.reg \
-		)
-
-#define scu_sdma_register_write(controller, reg, value)	\
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->sdma.reg, \
-		(value)	\
-		)
-
-/**
- * SCU_PUFATHAR_WRITE() -
- *
- * struct scu_sdma_registers
- */
-#define SCU_PUFATHAR_WRITE(controller, address)	\
-	{ \
-		scu_sdma_register_write(\
-			controller, \
-			uf_address_table_lower,	\
-			lower_32_bits(address) \
-			); \
-		scu_sdma_register_write(\
-			controller, \
-			uf_address_table_upper,	\
-			upper_32_bits(address) \
-			); \
-	}
-
-#define SCU_UFHBAR_WRITE(controller, address) \
-	{ \
-		scu_sdma_register_write(\
-			controller, \
-			uf_header_base_address_lower, \
-			lower_32_bits(address) \
-			); \
-		scu_sdma_register_write(\
-			controller, \
-			uf_header_base_address_upper, \
-			upper_32_bits(address) \
-			); \
-	}
-
-#define SCU_UFQC_READ(controller) \
-	scu_sdma_register_read(\
-		controller,  \
-		unsolicited_frame_queue_control	\
-		)
-
-#define SCU_UFQC_WRITE(controller, value) \
-	scu_sdma_register_write(\
-		controller, \
-		unsolicited_frame_queue_control, \
-		value \
-		)
-
-#define SCU_UFQPP_READ(controller) \
-	scu_sdma_register_read(\
-		controller, \
-		unsolicited_frame_put_pointer \
-		)
-
-#define SCU_UFQPP_WRITE(controller, value) \
-	scu_sdma_register_write(\
-		controller, \
-		unsolicited_frame_put_pointer, \
-		value \
-		)
-
-#define SCU_UFQGP_WRITE(controller, value) \
-	scu_sdma_register_write(\
-		controller, \
-		unsolicited_frame_get_pointer, \
-		value \
-		)
-
-#define SCU_PDMACR_READ(controller) \
-	scu_sdma_register_read(\
-		controller, \
-		pdma_configuration \
-		)
-
-#define SCU_PDMACR_WRITE(controller, value) \
-	scu_sdma_register_write(\
-		controller, \
-		pdma_configuration, \
-		value \
-		)
-
-#define SCU_CDMACR_READ(controller) \
-	scu_sdma_register_read(\
-		controller, \
-		cdma_configuration \
-		)
-
-#define SCU_CDMACR_WRITE(controller, value) \
-	scu_sdma_register_write(\
-		controller, \
-		cdma_configuration, \
-		value \
-		)
-
-/*
- * *****************************************************************************
- * * SCU Port Task Scheduler Group Registers
- * ***************************************************************************** */
-
-/**
- * scu_ptsg_register_read() -
- *
- * SCU_PTSG_REGISTER_ACCESS_MACROS
- */
-#define scu_ptsg_register_read(controller, reg)	\
-	scu_register_read(\
-		(controller), \
-		(controller)->scu_registers->peg0.ptsg.reg \
-		)
-
-#define scu_ptsg_register_write(controller, reg, value)	\
-	scu_register_write(\
-		(controller), \
-		(controller)->scu_registers->peg0.ptsg.reg, \
-		(value)	\
-		)
-
-/**
- * SCU_PTSGCR_READ() -
- *
- * SCU_PTSG_REGISTERS
- */
-#define SCU_PTSGCR_READ(controller) \
-	scu_ptsg_register_read(\
-		(controller), \
-		control	\
-		)
-
-#define SCU_PTSGCR_WRITE(controller, value) \
-	scu_ptsg_register_write(\
-		(controller), \
-		control, \
-		value \
-		)
-
-#define SCU_PTSGRTC_READ(controller) \
-	scu_ptsg_register_read(\
-		contoller, \
-		real_time_clock	\
-		)
-
-#endif /* _SCIC_SDS_CONTROLLER_REGISTERS_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_pci.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_pci.h	2011-03-28 00:12:06.381982317 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,94 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCIC_SDS_PCI_H_
-#define _SCIC_SDS_PCI_H_
-
-/**
- * This file contains the prototypes/macros utilized in writing out PCI data
- *    for the SCI core.
- *
- *
- */
-
-#include <asm/io.h>
-
-struct scic_sds_controller;
-
-void scic_sds_pci_bar_initialization(struct scic_sds_controller *scic);
-
-/* for debug we separate scu and smu accesses and require a controller */
-static inline u32 scic_sds_pci_read_smu_dword(struct scic_sds_controller *scic, void __iomem *addr)
-{
-	return readl(addr);
-}
-
-static inline void scic_sds_pci_write_smu_dword(struct scic_sds_controller *scic, void __iomem *addr, u32 value)
-{
-	writel(value, addr);
-}
-
-static inline u32 scic_sds_pci_read_scu_dword(struct scic_sds_controller *scic, void __iomem *addr)
-{
-	return readl(addr);
-}
-
-static inline void scic_sds_pci_write_scu_dword(struct scic_sds_controller *scic, void __iomem *addr, u32 value)
-{
-	writel(value, addr);
-}
-
-
-#endif /* _SCIC_SDS_PCI_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_phy_registers.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_phy_registers.h	2011-03-28 00:12:06.429982075 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,248 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCIC_SDS_PHY_REGISTERS_H_
-#define _SCIC_SDS_PHY_REGISTERS_H_
-
-/**
- * This file contains the macros used by the phy object to read/write to the
- *    SCU link layer registers.
- *
- *
- */
-
-#include "scic_sds_controller.h"
-
-/* **************************************************************************
- * * SCU TRANSPORT LAYER REGISTER OPERATIONS
- * ************************************************************************** */
-
-/**
- * Macro to read the transport layer register associated with this phy
- * object.
- */
-#define scu_transport_layer_read(phy, reg) \
-	scu_register_read( \
-		scic_sds_phy_get_controller(phy), \
-		(phy)->transport_layer_registers->reg \
-		)
-
-/**
- * Macro to write the transport layer register associated with this phy
- * object.
- */
-#define scu_transport_layer_write(phy, reg, value) \
-	scu_register_write( \
-		scic_sds_phy_get_controller(phy), \
-		(phy)->transport_layer_registers->reg, \
-		(value) \
-		)
-
-/* **************************************************************************
- * * Transport Layer registers controlled by the phy object
- * ************************************************************************** */
-
-/* This macro reads the Transport layer control register */
-#define SCU_TLCR_READ(phy) \
-	scu_transport_layer_read(phy, control)
-
-/* This macro writes the Transport layer control register */
-#define SCU_TLCR_WRITE(phy, value) \
-	scu_transport_layer_write(phy, control, value)
-
-/* This macro reads the Transport layer address translation register */
-#define SCU_TLADTR_READ(phy) \
-	scu_transport_layer_read(phy, address_translation)
-
-/* This macro writes the Transport layer address translation register */
-#define SCU_TLADTR_WRITE(phy) \
-	scu_transport_layer_write(phy, address_translation, value)
-
-/* This macro writes the STP Transport Layer Direct Attached RNi register */
-#define SCU_STPTLDARNI_WRITE(phy, index) \
-	scu_transport_layer_write(phy, stp_rni, index)
-
-/* This macro reads the STP Transport Layer Direct Attached RNi register */
-#define SCU_STPTLDARNI_READ(phy) \
-	scu_transport_layer_read(phy, stp_rni)
-
-/*
- * *****************************************************************************
- * * SCU LINK LAYER REGISTER OPERATIONS
- * ***************************************************************************** */
-
-/**
- * scu_link_layer_register_read() -
- *
- * THis macro requests the SCU register write for the specified link layer
- * register.
- */
-#define scu_link_layer_register_read(phy, reg) \
-	scu_register_read(\
-		scic_sds_phy_get_controller(phy), \
-		(phy)->link_layer_registers->reg \
-		)
-
-/**
- * scu_link_layer_register_write() -
- *
- * This macro requests the SCU register read for the specified link layer
- * register.
- */
-#define scu_link_layer_register_write(phy, reg, value) \
-	scu_register_write(\
-		scic_sds_phy_get_controller(phy), \
-		(phy)->link_layer_registers->reg, \
-		(value)	\
-		)
-
-/*
- * *****************************************************************************
- * * SCU LINK LAYER REGISTERS
- * ***************************************************************************** */
-
-/* / This macro reads from the SAS Identify Frame PHY Identifier register */
-#define SCU_SAS_TIPID_READ(phy)	\
-	scu_link_layer_register_read(phy, identify_frame_phy_id)
-
-/* / This macro writes to the SAS Identify Frame PHY Identifier register */
-#define SCU_SAS_TIPID_WRITE(phy, value)	\
-	scu_link_layer_register_write(phy, identify_frame_phy_id, value)
-
-/* / This macro reads from the SAS Identification register */
-#define SCU_SAS_TIID_READ(phy) \
-	scu_link_layer_register_read(phy, transmit_identification)
-
-/* / This macro writes to the SAS Identification register */
-#define SCU_SAS_TIID_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, transmit_identification, value)
-
-/* / This macro reads the SAS Device Name High register */
-#define SCU_SAS_TIDNH_READ(phy)	\
-	scu_link_layer_register_read(phy, sas_device_name_high)
-
-/* / This macro writes the SAS Device Name High register */
-#define SCU_SAS_TIDNH_WRITE(phy, value)	\
-	scu_link_layer_register_write(phy, sas_device_name_high, value)
-
-/* / This macro reads the SAS Device Name Low register */
-#define SCU_SAS_TIDNL_READ(phy)	\
-	scu_link_layer_register_read(phy, sas_device_name_low)
-
-/* / This macro writes the SAS Device Name Low register */
-#define SCU_SAS_TIDNL_WRITE(phy, value)	\
-	scu_link_layer_register_write(phy, sas_device_name_low, value)
-
-/* / This macro reads the Source SAS Address High register */
-#define SCU_SAS_TISSAH_READ(phy) \
-	scu_link_layer_register_read(phy, source_sas_address_high)
-
-/* / This macro writes the Source SAS Address High register */
-#define SCU_SAS_TISSAH_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, source_sas_address_high, value)
-
-/* / This macro reads the Source SAS Address Low register */
-#define SCU_SAS_TISSAL_READ(phy) \
-	scu_link_layer_register_read(phy, source_sas_address_low)
-
-/* / This macro writes the Source SAS Address Low register */
-#define SCU_SAS_TISSAL_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, source_sas_address_low, value)
-
-/* / This macro reads the PHY Configuration register */
-#define SCU_SAS_PCFG_READ(phy) \
-	scu_link_layer_register_read(phy, phy_configuration);
-
-/* / This macro writes the PHY Configuration register */
-#define SCU_SAS_PCFG_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, phy_configuration, value)
-
-/* / This macro reads the PHY Enable Spinup register */
-#define SCU_SAS_ENSPINUP_READ(phy) \
-	scu_link_layer_register_read(phy, notify_enable_spinup_control)
-
-/* / This macro writes the PHY Enable Spinup register */
-#define SCU_SAS_ENSPINUP_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, notify_enable_spinup_control, value)
-
-/* This macro reads the CLKSM register */
-#define SCU_SAS_CLKSM_READ(phy) \
-	scu_link_layer_register_read(phy, clock_skew_management)
-
-/* This macro writes the CLKSM register */
-#define SCU_SAS_CLKSM_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, clock_skew_management, value)
-
-/* / This macro reads the PHY Capacity register */
-#define SCU_SAS_PHYCAP_READ(phy) \
-	scu_link_layer_register_read(phy, phy_capabilities)
-
-/* / This macro writes the PHY Capacity register */
-#define SCU_SAS_PHYCAP_WRITE(phy, value) \
-	scu_link_layer_register_write(phy, phy_capabilities, value)
-
-/* / This macro reads the Recieved PHY Capacity register */
-#define SCU_SAS_RECPHYCAP_READ(phy) \
-	scu_link_layer_register_read(phy, receive_phycap)
-
-/* / This macro reads the link layer control register */
-#define SCU_SAS_LLCTL_READ(phy)	\
-	scu_link_layer_register_read(phy, link_layer_control);
-
-/* / This macro writes the link layer control register */
-#define SCU_SAS_LLCTL_WRITE(phy, value)	\
-	scu_link_layer_register_write(phy, link_layer_control, value);
-
-#endif /* _SCIC_SDS_PHY_REGISTERS_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_port_registers.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_port_registers.h	2011-03-28 00:12:06.441982180 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_port_registers.h	2011-03-28 00:39:55.020982467 +0200
@@ -63,85 +63,4 @@
  *
  */
 
-/**
- * scu_port_task_scheduler_read() -
- *
- * Macro to read the port task scheduler register associated with this port
- * object
- */
-#define scu_port_task_scheduler_read(port, reg)	\
-	scu_register_read(\
-		scic_sds_port_get_controller(port), \
-		(port)->port_task_scheduler_registers->reg \
-		)
-
-/**
- * scu_port_task_scheduler_write() -
- *
- * Macro to write the port task scheduler register associated with this port
- * object
- */
-#define scu_port_task_scheduler_write(port, reg, value)	\
-	scu_register_write(\
-		scic_sds_port_get_controller(port), \
-		(port)->port_task_scheduler_registers->reg, \
-		(value)	\
-		)
-
-#define scu_port_viit_register_write(port, reg, value) \
-	scu_register_write(\
-		scic_sds_port_get_controller(port), \
-		(port)->viit_registers->reg, \
-		(value)	\
-		)
-
-/*
- * ****************************************************************************
- * * Port Task Scheduler registers controlled by the port object
- * **************************************************************************** */
-
-/**
- * SCU_PTSxCR_READ() -
- *
- * Macro to read the port task scheduler control register
- */
-#define SCU_PTSxCR_READ(port) \
-	scu_port_task_scheduler_read(port, control)
-
-/**
- * SCU_PTSxCR_WRITE() -
- *
- * Macro to write the port task scheduler control regsister
- */
-#define SCU_PTSxCR_WRITE(port, value) \
-	scu_port_task_scheduler_write(port, control, value)
-
-/*
- * ****************************************************************************
- * * Port PE Configuration registers
- * **************************************************************************** */
-
-/**
- * SCU_PCSPExCR_WRITE() -
- *
- * Macro to write the PE Port Configuration Register
- */
-#define SCU_PCSPExCR_WRITE(port, phy_id, value)	\
-	scu_register_write(\
-		scic_sds_port_get_controller(port), \
-		(port)->port_pe_configuration_register[phy_id],	\
-		(value)	\
-		)
-
-/**
- * SCU_PCSPExCR_READ() -
- *
- * Macro to read the PE Port Configuration Regsiter
- */
-#define SCU_PCSPExCR_READ(port, phy_id)	\
-	scu_register_read(\
-		scic_sds_port_get_controller(port), \
-		(port)->port_pe_configuration_register[phy_id] \
-		)
-
 #endif /* _SCIC_SDS_PORT_REGISTERS_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_request.c	2011-03-28 00:12:06.405981154 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_request.c	2011-03-28 01:48:23.120981718 +0200
@@ -62,8 +62,7 @@
 #include "scic_io_request.h"
 #include "scic_remote_device.h"
 #include "scic_sds_controller.h"
-#include "scic_sds_controller_registers.h"
-#include "scic_sds_pci.h"
+#include "scu_registers.h"
 #include "scic_sds_port.h"
 #include "scic_sds_remote_device.h"
 #include "scic_sds_request.h"
@@ -862,20 +861,16 @@ u32 scic_io_request_get_number_of_bytes_
 {
 	u32 ret_val = 0;
 
-	if (SMU_AMR_READ(scic_sds_request->owning_controller) == 0) {
+	if (readl(&scic_sds_request->owning_controller->smu_registers->address_modifier) == 0) {
 		/*
 		 * get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where
 		 *   BAR1 is the scu_registers
 		 *   0x20002C = 0x200000 + 0x2c
 		 *            = start of task context SRAM + offset of (type.ssp.data_offset)
 		 *   TCi is the io_tag of struct scic_sds_request */
-		ret_val =  scic_sds_pci_read_scu_dword(
-			scic_sds_request->owning_controller,
-			(
-				(u8 *)scic_sds_request->owning_controller->scu_registers +
+		ret_val = readl((u8 *)scic_sds_request->owning_controller->scu_registers +
 				(SCU_TASK_CONTEXT_SRAM + SCI_FIELD_OFFSET(struct scu_task_context, type.ssp.data_offset)) +
 				((sizeof(struct scu_task_context)) * scic_sds_io_tag_get_index(scic_sds_request->io_tag))
-			)
 			);
 	}
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_port.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_port.c	2011-03-28 00:30:28.684985234 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_port.c	2011-03-28 01:57:49.824617212 +0200
@@ -60,14 +60,12 @@
 #include "scic_port.h"
 #include "scic_sds_controller.h"
 #include "scic_sds_phy.h"
-#include "scic_sds_phy_registers.h"
 #include "scic_sds_port.h"
-#include "scic_sds_port_registers.h"
 #include "scic_sds_remote_device.h"
 #include "scic_sds_remote_node_context.h"
 #include "scic_sds_request.h"
 #include "sci_environment.h"
-#include "scic_sds_controller_registers.h"
+#include "scu_registers.h"
 
 #define SCIC_SDS_PORT_MIN_TIMER_COUNT  (SCI_MAX_PORTS)
 #define SCIC_SDS_PORT_MAX_TIMER_COUNT  (SCI_MAX_PORTS)
@@ -706,7 +704,8 @@ void scic_sds_port_deactivate_phy(struct
 	sci_phy->max_negotiated_speed = SCI_SAS_NO_LINK_RATE;
 
 	/* Re-assign the phy back to the LP as if it were a narrow port */
-	SCU_PCSPExCR_WRITE(sci_port, sci_phy->phy_index, sci_phy->phy_index);
+	writel(sci_phy->phy_index,
+		&sci_port->port_pe_configuration_register[sci_phy->phy_index]);
 
 	if (do_notify_user == true)
 		isci_port_link_down(ihost, iphy, iport);
@@ -969,25 +968,20 @@ static void scic_sds_port_update_viit_en
 
 	scic_sds_port_get_sas_address(this_port, &sas_address);
 
-	scu_port_viit_register_write(
-		this_port, initiator_sas_address_hi, sas_address.high);
-
-	scu_port_viit_register_write(
-		this_port, initiator_sas_address_lo, sas_address.low);
+	writel(sas_address.high,
+		&this_port->viit_registers->initiator_sas_address_hi);
+	writel(sas_address.low,
+		&this_port->viit_registers->initiator_sas_address_lo);
 
 	/* This value get cleared just in case its not already cleared */
-	scu_port_viit_register_write(
-		this_port, reserved, 0);
+	writel(0, &this_port->viit_registers->reserved);
 
 	/* We are required to update the status register last */
-	scu_port_viit_register_write(
-		this_port, status, (
-			SCU_VIIT_ENTRY_ID_VIIT
-			| SCU_VIIT_IPPT_INITIATOR
-			| ((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT)
-			| SCU_VIIT_STATUS_ALL_VALID
-			)
-		);
+	writel(SCU_VIIT_ENTRY_ID_VIIT |
+	       SCU_VIIT_IPPT_INITIATOR |
+	       ((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) |
+	       SCU_VIIT_STATUS_ALL_VALID,
+	       &this_port->viit_registers->status);
 }
 
 /**
@@ -1059,10 +1053,12 @@ void scic_port_enable_broadcast_change_n
 	for (index = 0; index < SCI_MAX_PHYS; index++) {
 		phy = port->phy_table[index];
 		if (phy != NULL) {
-			register_value = SCU_SAS_LLCTL_READ(phy);
+			register_value =
+				readl(&phy->link_layer_registers->link_layer_control);
 
 			/* clear the bit by writing 1. */
-			SCU_SAS_LLCTL_WRITE(phy, register_value);
+			writel(register_value,
+				&phy->link_layer_registers->link_layer_control);
 		}
 	}
 }
@@ -1618,16 +1614,14 @@ scic_sds_port_ready_substate_handler_tab
  *
  * This method will susped the port task scheduler for this port object. none
  */
-static void scic_sds_port_suspend_port_task_scheduler(
-	struct scic_sds_port *this_port)
+static void
+scic_sds_port_suspend_port_task_scheduler(struct scic_sds_port *port)
 {
 	u32 pts_control_value;
 
-	pts_control_value = scu_port_task_scheduler_read(this_port, control);
-
+	pts_control_value = readl(&port->port_task_scheduler_registers->control);
 	pts_control_value |= SCU_PTSxCR_GEN_BIT(SUSPEND);
-
-	scu_port_task_scheduler_write(this_port, control, pts_control_value);
+	writel(pts_control_value, &port->port_task_scheduler_registers->control);
 }
 
 /**
@@ -1688,16 +1682,14 @@ static void scic_sds_port_abort_dummy_re
  *
  * This method will resume the port task scheduler for this port object. none
  */
-static void scic_sds_port_resume_port_task_scheduler(
-	struct scic_sds_port *this_port)
+static void
+scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port)
 {
 	u32 pts_control_value;
 
-	pts_control_value = scu_port_task_scheduler_read(this_port, control);
-
+	pts_control_value = readl(&port->port_task_scheduler_registers->control);
 	pts_control_value &= ~SCU_PTSxCR_GEN_BIT(SUSPEND);
-
-	scu_port_task_scheduler_write(this_port, control, pts_control_value);
+	writel(pts_control_value, &port->port_task_scheduler_registers->control);
 }
 
 /*
@@ -1763,10 +1755,11 @@ static void scic_sds_port_ready_substate
 	isci_port_ready(ihost, iport);
 
 	for (index = 0; index < SCI_MAX_PHYS; index++) {
-		if (sci_port->phy_table[index] != NULL)
-			scic_sds_port_write_phy_assignment(
-					sci_port,
-					sci_port->phy_table[index]);
+		if (sci_port->phy_table[index]) {
+			writel(sci_port->physical_port_index,
+				&sci_port->port_pe_configuration_register[
+					sci_port->phy_table[index]->phy_index]);
+		}
 	}
 
 	scic_sds_port_update_viit_entry(sci_port);
@@ -2308,16 +2301,14 @@ scic_sds_port_state_handler_table[SCI_BA
  * This method will enable the SCU Port Task Scheduler for this port object but
  * will leave the port task scheduler in a suspended state. none
  */
-static void scic_sds_port_enable_port_task_scheduler(
-	struct scic_sds_port *this_port)
+static void
+scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port)
 {
 	u32 pts_control_value;
 
-	pts_control_value = scu_port_task_scheduler_read(this_port, control);
-
+	pts_control_value = readl(&port->port_task_scheduler_registers->control);
 	pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND);
-
-	scu_port_task_scheduler_write(this_port, control, pts_control_value);
+	writel(pts_control_value, &port->port_task_scheduler_registers->control);
 }
 
 /**
@@ -2327,17 +2318,15 @@ static void scic_sds_port_enable_port_ta
  * This method will disable the SCU port task scheduler for this port object.
  * none
  */
-static void scic_sds_port_disable_port_task_scheduler(
-	struct scic_sds_port *this_port)
+static void
+scic_sds_port_disable_port_task_scheduler(struct scic_sds_port *port)
 {
 	u32 pts_control_value;
 
-	pts_control_value = scu_port_task_scheduler_read(this_port, control);
-
-	pts_control_value &= ~(SCU_PTSxCR_GEN_BIT(ENABLE)
-			       | SCU_PTSxCR_GEN_BIT(SUSPEND));
-
-	scu_port_task_scheduler_write(this_port, control, pts_control_value);
+	pts_control_value = readl(&port->port_task_scheduler_registers->control);
+	pts_control_value &=
+		~(SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND));
+	writel(pts_control_value, &port->port_task_scheduler_registers->control);
 }
 
 static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port)
@@ -2359,7 +2348,7 @@ static void scic_sds_port_post_dummy_rem
 	/* ensure hardware has seen the post rnc command and give it
 	 * ample time to act before sending the suspend
 	 */
-	SMU_ISR_READ(scic); /* flush */
+	readl(&scic->smu_registers->interrupt_status); /* flush */
 	udelay(10);
 
 	command = SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX |
@@ -2384,7 +2373,7 @@ static void scic_sds_port_invalidate_dum
 	 * controller and give it ample time to act before posting the rnc
 	 * invalidate
 	 */
-	SMU_ISR_READ(scic); /* flush */
+	readl(&scic->smu_registers->interrupt_status); /* flush */
 	udelay(10);
 
 	command = SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE |
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_port.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_port.h	2011-03-28 00:35:42.529982343 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_port.h	2011-03-28 00:39:59.228982545 +0200
@@ -289,29 +289,6 @@ static inline void scic_sds_port_decreme
 		sci_port->started_request_count--;
 }
 
-/**
- * scic_sds_port_write_phy_assignment() -
- *
- * Helper macro to write the phys port assignment
- */
-#define scic_sds_port_write_phy_assignment(port, phy) \
-	SCU_PCSPExCR_WRITE(\
-		(port),	\
-		(phy)->phy_index, \
-		(port)->physical_port_index \
-		)
-
-/**
- * scic_sds_port_read_phy_assignment() -
- *
- * Helper macro to read the phys port assignment
- */
-#define scic_sds_port_read_phy_assignment(port, phy) \
-	SCU_PCSPExCR_READ(\
-		(port),	\
-		(phy)->phy_index \
-		)
-
 #define scic_sds_port_active_phy(port, phy) \
 	(((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_phy.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_phy.c	2011-03-28 00:43:26.000980085 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_phy.c	2011-03-28 01:58:40.708982284 +0200
@@ -60,7 +60,6 @@
 #include "scic_phy.h"
 #include "scic_sds_controller.h"
 #include "scic_sds_phy.h"
-#include "scic_sds_phy_registers.h"
 #include "scic_sds_port.h"
 #include "scic_sds_remote_node_context.h"
 #include "sci_environment.h"
@@ -98,12 +97,13 @@ static enum sci_status scic_sds_phy_tran
 
 	this_phy->transport_layer_registers = transport_layer_registers;
 
-	SCU_STPTLDARNI_WRITE(this_phy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
+	writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX,
+		&this_phy->transport_layer_registers->stp_rni);
 
 	/* Hardware team recommends that we enable the STP prefetch for all transports */
-	tl_control = SCU_TLCR_READ(this_phy);
+	tl_control = readl(&this_phy->transport_layer_registers->control);
 	tl_control |= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH);
-	SCU_TLCR_WRITE(this_phy, tl_control);
+	writel(tl_control, &this_phy->transport_layer_registers->control);
 
 	return SCI_SUCCESS;
 }
@@ -135,30 +135,36 @@ scic_sds_phy_link_layer_initialization(s
 	/* Set our IDENTIFY frame data */
 	#define SCI_END_DEVICE 0x01
 
-	SCU_SAS_TIID_WRITE(sci_phy, (SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
-				     SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
-				     SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
-				     SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
-				     SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE)));
+	writel(SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
+	       SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
+	       SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
+	       SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
+	       SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE),
+	       &sci_phy->link_layer_registers->transmit_identification);
 
 	/* Write the device SAS Address */
-	SCU_SAS_TIDNH_WRITE(sci_phy, 0xFEDCBA98);
-	SCU_SAS_TIDNL_WRITE(sci_phy, phy_idx);
+	writel(0xFEDCBA98, &sci_phy->link_layer_registers->sas_device_name_high);
+	writel(phy_idx, &sci_phy->link_layer_registers->sas_device_name_low);
 
 	/* Write the source SAS Address */
-	SCU_SAS_TISSAH_WRITE(sci_phy, phy_oem->sas_address.high);
-	SCU_SAS_TISSAL_WRITE(sci_phy, phy_oem->sas_address.low);
+	writel(phy_oem->sas_address.high,
+		&sci_phy->link_layer_registers->source_sas_address_high);
+	writel(phy_oem->sas_address.low,
+		&sci_phy->link_layer_registers->source_sas_address_low);
 
 	/* Clear and Set the PHY Identifier */
-	SCU_SAS_TIPID_WRITE(sci_phy, 0x00000000);
-	SCU_SAS_TIPID_WRITE(sci_phy, SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx));
+	writel(0, &sci_phy->link_layer_registers->identify_frame_phy_id);
+	writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx),
+		&sci_phy->link_layer_registers->identify_frame_phy_id);
 
 	/* Change the initial state of the phy configuration register */
-	phy_configuration = SCU_SAS_PCFG_READ(sci_phy);
+	phy_configuration =
+		readl(&sci_phy->link_layer_registers->phy_configuration);
 
 	/* Hold OOB state machine in reset */
 	phy_configuration |=  SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
-	SCU_SAS_PCFG_WRITE(sci_phy, phy_configuration);
+	writel(phy_configuration,
+		&sci_phy->link_layer_registers->phy_configuration);
 
 	/* Configure the SNW capabilities */
 	phy_capabilities.u.all = 0;
@@ -188,13 +194,15 @@ scic_sds_phy_link_layer_initialization(s
 	if ((parity_count % 2) != 0)
 		phy_capabilities.u.bits.parity = 1;
 
-	SCU_SAS_PHYCAP_WRITE(sci_phy, phy_capabilities.u.all);
+	writel(phy_capabilities.u.all,
+		&sci_phy->link_layer_registers->phy_capabilities);
 
 	/* Set the enable spinup period but disable the ability to send
 	 * notify enable spinup
 	 */
-	SCU_SAS_ENSPINUP_WRITE(sci_phy, SCU_ENSPINUP_GEN_VAL(COUNT,
-			       phy_user->notify_enable_spin_up_insertion_frequency));
+	writel(SCU_ENSPINUP_GEN_VAL(COUNT,
+			phy_user->notify_enable_spin_up_insertion_frequency),
+		&sci_phy->link_layer_registers->notify_enable_spinup_control);
 
 	/* Write the ALIGN Insertion Ferequency for connected phy and
 	 * inpendent of connected state
@@ -205,10 +213,11 @@ scic_sds_phy_link_layer_initialization(s
 	clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL,
 			phy_user->align_insertion_frequency);
 
-	SCU_SAS_CLKSM_WRITE(sci_phy, clksm_value);
+	writel(clksm_value, &sci_phy->link_layer_registers->clock_skew_management);
 
 	/* @todo Provide a way to write this register correctly */
-	scu_link_layer_register_write(sci_phy, afe_lookup_table_control, 0x02108421);
+	writel(0x02108421,
+		&sci_phy->link_layer_registers->afe_lookup_table_control);
 
 	llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT,
 		(u8)scic->user_parameters.sds1.no_outbound_task_timeout);
@@ -225,8 +234,7 @@ scic_sds_phy_link_layer_initialization(s
 		break;
 	}
 	llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);
-
-	scu_link_layer_register_write(sci_phy, link_layer_control, llctl);
+	writel(llctl, &sci_phy->link_layer_registers->link_layer_control);
 
 	if (is_a0() || is_a2()) {
 		/* Program the max ARB time for the PHY to 700us so we inter-operate with
@@ -234,16 +242,15 @@ scic_sds_phy_link_layer_initialization(s
 		 * many breaks.  This time value will guarantee that the initiator PHY will
 		 * generate the break.
 		 */
-		scu_link_layer_register_write(sci_phy,
-					      maximum_arbitration_wait_timer_timeout,
-					      SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME);
+		writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME,
+			&sci_phy->link_layer_registers->maximum_arbitration_wait_timer_timeout);
 	}
 
 	/*
 	 * Set the link layer hang detection to 500ms (0x1F4) from its default
-	 * value of 128ms.  Max value is 511 ms. */
-	scu_link_layer_register_write(sci_phy, link_layer_hang_detection_timeout,
-				      0x1F4);
+	 * value of 128ms.  Max value is 511 ms.
+	 */
+	writel(0x1F4, &sci_phy->link_layer_registers->link_layer_hang_detection_timeout);
 
 	/* We can exit the initial state to the stopped state */
 	sci_base_state_machine_change_state(&sci_phy->parent.state_machine,
@@ -367,15 +374,15 @@ void scic_sds_phy_setup_transport(
 {
 	u32 tl_control;
 
-	SCU_STPTLDARNI_WRITE(this_phy, device_id);
+	writel(device_id, &this_phy->transport_layer_registers->stp_rni);
 
 	/*
 	 * The read should guarantee that the first write gets posted
 	 * before the next write
 	 */
-	tl_control = SCU_TLCR_READ(this_phy);
+	tl_control = readl(&this_phy->transport_layer_registers->control);
 	tl_control |= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE);
-	SCU_TLCR_WRITE(this_phy, tl_control);
+	writel(tl_control, &this_phy->transport_layer_registers->control);
 }
 
 /**
@@ -390,9 +397,12 @@ static void scic_sds_phy_suspend(
 {
 	u32 scu_sas_pcfg_value;
 
-	scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
+	scu_sas_pcfg_value =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
-	SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&this_phy->link_layer_registers->phy_configuration);
+
 	scic_sds_phy_setup_transport(this_phy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
 }
 
@@ -408,11 +418,11 @@ void scic_sds_phy_resume(
 {
 	u32 scu_sas_pcfg_value;
 
-	scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
-
+	scu_sas_pcfg_value =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
-
-	SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&this_phy->link_layer_registers->phy_configuration);
 }
 
 /**
@@ -427,8 +437,8 @@ void scic_sds_phy_get_sas_address(
 	struct scic_sds_phy *this_phy,
 	struct sci_sas_address *sas_address)
 {
-	sas_address->high = SCU_SAS_TISSAH_READ(this_phy);
-	sas_address->low  = SCU_SAS_TISSAL_READ(this_phy);
+	sas_address->high = readl(&this_phy->link_layer_registers->source_sas_address_high);
+	sas_address->low = readl(&this_phy->link_layer_registers->source_sas_address_low);
 }
 
 /**
@@ -460,7 +470,10 @@ void scic_sds_phy_get_protocols(
 	struct scic_sds_phy *this_phy,
 	struct sci_sas_identify_address_frame_protocols *protocols)
 {
-	protocols->u.all = (u16)(SCU_SAS_TIID_READ(this_phy) & 0x0000FFFF);
+	protocols->u.all =
+		(u16)(readl(&this_phy->
+			link_layer_registers->transmit_identification) &
+				0x0000FFFF);
 }
 
 /**
@@ -589,8 +602,8 @@ enum sci_status scic_sas_phy_get_propert
 			sizeof(struct sci_sas_identify_address_frame)
 			);
 
-		properties->received_capabilities.u.all
-			= SCU_SAS_RECPHYCAP_READ(sci_phy);
+		properties->received_capabilities.u.all =
+			readl(&sci_phy->link_layer_registers->receive_phycap);
 
 		return SCI_SUCCESS;
 	}
@@ -639,9 +652,11 @@ static void scic_sds_phy_start_sas_link_
 {
 	u32 phy_control;
 
-	phy_control = SCU_SAS_PCFG_READ(this_phy);
+	phy_control =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD);
-	SCU_SAS_PCFG_WRITE(this_phy, phy_control);
+	writel(phy_control,
+		&this_phy->link_layer_registers->phy_configuration);
 
 	sci_base_state_machine_change_state(
 		&this_phy->starting_substate_machine,
@@ -1331,9 +1346,9 @@ static enum sci_status scic_sds_phy_star
 {
 	u32 enable_spinup;
 
-	enable_spinup = SCU_SAS_ENSPINUP_READ(sci_phy);
+	enable_spinup = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control);
 	enable_spinup |= SCU_ENSPINUP_GEN_BIT(ENABLE);
-	SCU_SAS_ENSPINUP_WRITE(sci_phy, enable_spinup);
+	writel(enable_spinup, &sci_phy->link_layer_registers->notify_enable_spinup_control);
 
 	/* Change state to the final state this substate machine has run to completion */
 	sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
@@ -1357,16 +1372,19 @@ static enum sci_status scic_sds_phy_star
 	u32 scu_sas_pcfg_value;
 
 	/* Release the spinup hold state and reset the OOB state machine */
-	scu_sas_pcfg_value = SCU_SAS_PCFG_READ(sci_phy);
+	scu_sas_pcfg_value =
+		readl(&sci_phy->link_layer_registers->phy_configuration);
 	scu_sas_pcfg_value &=
 		~(SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD) | SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE));
 	scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
-	SCU_SAS_PCFG_WRITE(sci_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&sci_phy->link_layer_registers->phy_configuration);
 
 	/* Now restart the OOB operation */
 	scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
 	scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
-	SCU_SAS_PCFG_WRITE(sci_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&sci_phy->link_layer_registers->phy_configuration);
 
 	/* Change state to the final state this substate machine has run to completion */
 	sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
@@ -2120,18 +2138,20 @@ static void scu_link_layer_stop_protocol
 	u32 enable_spinup_value;
 
 	/* Suspend the protocol engine and place it in a sata spinup hold state */
-	scu_sas_pcfg_value  = SCU_SAS_PCFG_READ(this_phy);
+	scu_sas_pcfg_value =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	scu_sas_pcfg_value |= (
 		SCU_SAS_PCFG_GEN_BIT(OOB_RESET)
 		| SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE)
 		| SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD)
 		);
-	SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&this_phy->link_layer_registers->phy_configuration);
 
 	/* Disable the notify enable spinup primitives */
-	enable_spinup_value = SCU_SAS_ENSPINUP_READ(this_phy);
+	enable_spinup_value = readl(&this_phy->link_layer_registers->notify_enable_spinup_control);
 	enable_spinup_value &= ~SCU_ENSPINUP_GEN_BIT(ENABLE);
-	SCU_SAS_ENSPINUP_WRITE(this_phy, enable_spinup_value);
+	writel(enable_spinup_value, &this_phy->link_layer_registers->notify_enable_spinup_control);
 }
 
 /**
@@ -2144,12 +2164,13 @@ static void scu_link_layer_start_oob(
 {
 	u32 scu_sas_pcfg_value;
 
-	scu_sas_pcfg_value = SCU_SAS_PCFG_READ(this_phy);
+	scu_sas_pcfg_value =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
 	scu_sas_pcfg_value &=
 		~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) | SCU_SAS_PCFG_GEN_BIT(HARD_RESET));
-
-	SCU_SAS_PCFG_WRITE(this_phy, scu_sas_pcfg_value);
+	writel(scu_sas_pcfg_value,
+		&this_phy->link_layer_registers->phy_configuration);
 }
 
 /**
@@ -2168,15 +2189,18 @@ static void scu_link_layer_tx_hard_reset
 	/*
 	 * SAS Phys must wait for the HARD_RESET_TX event notification to transition
 	 * to the starting state. */
-	phy_configuration_value = SCU_SAS_PCFG_READ(this_phy);
+	phy_configuration_value =
+		readl(&this_phy->link_layer_registers->phy_configuration);
 	phy_configuration_value |=
 		(SCU_SAS_PCFG_GEN_BIT(HARD_RESET) | SCU_SAS_PCFG_GEN_BIT(OOB_RESET));
-	SCU_SAS_PCFG_WRITE(this_phy, phy_configuration_value);
+	writel(phy_configuration_value,
+		&this_phy->link_layer_registers->phy_configuration);
 
 	/* Now take the OOB state machine out of reset */
 	phy_configuration_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
 	phy_configuration_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
-	SCU_SAS_PCFG_WRITE(this_phy, phy_configuration_value);
+	writel(phy_configuration_value,
+		&this_phy->link_layer_registers->phy_configuration);
 }
 
 /*
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c	2011-03-28 01:40:43.704981485 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c	2011-03-28 01:41:14.336982622 +0200
@@ -317,8 +317,8 @@ enum sci_status scic_sds_unsolicited_fra
  * This method returns an indication to the caller as to whether the
  * unsolicited frame get pointer should be updated. true This value indicates
  * the unsolicited frame get pointer should be updated (i.e. write
- * SCU_UFQGP_WRITE). false This value indicates the get pointer should not be
- * updated.
+ * scu_registers->sdma.unsolicited_frame_get_pointer).
+ * false This value indicates the get pointer should not be updated.
  */
 bool scic_sds_unsolicited_frame_control_release_frame(
 	struct scic_sds_unsolicited_frame_control *uf_control,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH, RFC 0/2] scic: remove pointless stuctures
  2011-03-28  0:07 [PATCH] scic: remove mmio wrappers Christoph Hellwig
@ 2011-03-28 13:20 ` Christoph Hellwig
  2011-03-28 13:21   ` [PATCH 1/2] isci: remove base_controller abstraction Christoph Hellwig
                     ` (2 more replies)
  2011-03-31  1:43 ` [PATCH] scic: remove mmio wrappers Dan Williams
  1 sibling, 3 replies; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-28 13:20 UTC (permalink / raw)
  To: Dan Williams
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

Start killing off the pointless sci_base* structures which do nothing
but causing a lot of unreadable code by converting forth and back
between them and the real structures.

I've done the sci_base_controller, and sci_base_request on a rainy
sunday afternoon, but the port, phy and remote device also need the
same treatment.  And after that the sci_base_object crap needs to
go in favour of just using container_of or properly typed pointers.

But I'll rather leave that to you Intel guys, spending more time
on this codebase won't be good for my mental health.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] isci: remove base_controller abstraction
  2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
@ 2011-03-28 13:21   ` Christoph Hellwig
  2011-03-31 21:21     ` Dan Williams
  2011-03-28 13:21   ` [PATCH 2/2] isci: remove base_request abstraction Christoph Hellwig
  2011-03-31 22:24   ` [PATCH, RFC 0/2] scic: remove pointless stuctures Dan Williams
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-28 13:21 UTC (permalink / raw)
  To: Dan Williams
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

Merge struct sci_base_controller into scic_sds_controller, and also factor
the two types of state machine handlers into one function.  While we're at
it also remove lots of duplicate incorrect kerneldoc comments for the state
machine handlers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/drivers/scsi/isci/core/sci_base_controller.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/sci_base_controller.h	2011-03-28 10:47:51.502837983 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,304 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCI_BASE_CONTROLLER_H_
-#define _SCI_BASE_CONTROLLER_H_
-
-#include "intel_sas.h"
-#include "sci_controller_constants.h"
-#include "sci_base_state.h"
-#include "sci_base_memory_descriptor_list.h"
-#include "sci_base_state_machine.h"
-#include "sci_object.h"
-
-struct sci_base_memory_descriptor_list;
-
-/**
- * enum sci_base_controller_states - This enumeration depicts all the states
- *    for the common controller state machine.
- *
- *
- */
-enum sci_base_controller_states {
-	/**
-	 * Simply the initial state for the base controller state machine.
-	 */
-	SCI_BASE_CONTROLLER_STATE_INITIAL = 0,
-
-	/**
-	 * This state indicates that the controller is reset.  The memory for
-	 * the controller is in it's initial state, but the controller requires
-	 * initialization.
-	 * This state is entered from the INITIAL state.
-	 * This state is entered from the RESETTING state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_RESET,
-
-	/**
-	 * This state is typically an action state that indicates the controller
-	 * is in the process of initialization.  In this state no new IO operations
-	 * are permitted.
-	 * This state is entered from the RESET state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_INITIALIZING,
-
-	/**
-	 * This state indicates that the controller has been successfully
-	 * initialized.  In this state no new IO operations are permitted.
-	 * This state is entered from the INITIALIZING state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_INITIALIZED,
-
-	/**
-	 * This state indicates the the controller is in the process of becoming
-	 * ready (i.e. starting).  In this state no new IO operations are permitted.
-	 * This state is entered from the INITIALIZED state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_STARTING,
-
-	/**
-	 * This state indicates the controller is now ready.  Thus, the user
-	 * is able to perform IO operations on the controller.
-	 * This state is entered from the STARTING state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_READY,
-
-	/**
-	 * This state is typically an action state that indicates the controller
-	 * is in the process of resetting.  Thus, the user is unable to perform
-	 * IO operations on the controller.  A reset is considered destructive in
-	 * most cases.
-	 * This state is entered from the READY state.
-	 * This state is entered from the FAILED state.
-	 * This state is entered from the STOPPED state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_RESETTING,
-
-	/**
-	 * This state indicates that the controller is in the process of stopping.
-	 * In this state no new IO operations are permitted, but existing IO
-	 * operations are allowed to complete.
-	 * This state is entered from the READY state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_STOPPING,
-
-	/**
-	 * This state indicates that the controller has successfully been stopped.
-	 * In this state no new IO operations are permitted.
-	 * This state is entered from the STOPPING state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_STOPPED,
-
-	/**
-	 * This state indicates that the controller could not successfully be
-	 * initialized.  In this state no new IO operations are permitted.
-	 * This state is entered from the INITIALIZING state.
-	 * This state is entered from the STARTING state.
-	 * This state is entered from the STOPPING state.
-	 * This state is entered from the RESETTING state.
-	 */
-	SCI_BASE_CONTROLLER_STATE_FAILED,
-
-	SCI_BASE_CONTROLLER_MAX_STATES
-
-};
-
-/**
- * struct sci_base_controller - The base controller object abstracts the fields
- *    common to all SCI controller objects.
- *
- *
- */
-struct sci_base_controller {
-	/**
-	 * The field specifies that the parent object for the base controller
-	 * is the base object itself.
-	 */
-	struct sci_base_object parent;
-
-	/**
-	 * This field points to the memory descriptor list associated with this
-	 * controller.  The MDL indicates the memory requirements necessary for
-	 * this controller object.
-	 */
-	struct sci_base_memory_descriptor_list mdl;
-
-	/**
-	 * This field contains the information for the base controller state
-	 * machine.
-	 */
-	struct sci_base_state_machine state_machine;
-};
-
-/* Forward declarations */
-struct sci_base_remote_device;
-struct sci_base_request;
-
-typedef enum sci_status
-(*sci_base_controller_handler_t)(struct sci_base_controller *);
-
-typedef enum sci_status
-(*sci_base_controller_timed_handler_t)(struct sci_base_controller *, u32);
-
-typedef enum sci_status
-(*sci_base_controller_request_handler_t)(struct sci_base_controller *,
-					 struct sci_base_remote_device *,
-					 struct sci_base_request *);
-
-typedef enum sci_status
-(*sci_base_controller_start_request_handler_t)(struct sci_base_controller *,
-					       struct sci_base_remote_device *,
-					       struct sci_base_request *, u16);
-
-/**
- * struct sci_base_controller_state_handler - This structure contains all of
- *    the state handler methods common to base controller state machines.
- *    Handler methods provide the ability to change the behavior for user
- *    requests or transitions depending on the state the machine is in.
- *
- *
- */
-struct sci_base_controller_state_handler {
-	/**
-	 * The start_handler specifies the method invoked when a user attempts to
-	 * start a controller.
-	 */
-	sci_base_controller_timed_handler_t start;
-
-	/**
-	 * The stop_handler specifies the method invoked when a user attempts to
-	 * stop a controller.
-	 */
-	sci_base_controller_timed_handler_t stop;
-
-	/**
-	 * The reset_handler specifies the method invoked when a user attempts to
-	 * reset a controller.
-	 */
-	sci_base_controller_handler_t reset;
-
-	/**
-	 * The initialize_handler specifies the method invoked when a user
-	 * attempts to initialize a controller.
-	 */
-	sci_base_controller_handler_t initialize;
-
-	/**
-	 * The start_io_handler specifies the method invoked when a user
-	 * attempts to start an IO request for a controller.
-	 */
-	sci_base_controller_start_request_handler_t start_io;
-
-	/**
-	 * The complete_io_handler specifies the method invoked when a user
-	 * attempts to complete an IO request for a controller.
-	 */
-	sci_base_controller_request_handler_t complete_io;
-
-	/**
-	 * The continue_io_handler specifies the method invoked when a user
-	 * attempts to continue an IO request for a controller.
-	 */
-	sci_base_controller_request_handler_t continue_io;
-
-	/**
-	 * The start_task_handler specifies the method invoked when a user
-	 * attempts to start a task management request for a controller.
-	 */
-	sci_base_controller_start_request_handler_t start_task;
-
-	/**
-	 * The complete_task_handler specifies the method invoked when a user
-	 * attempts to complete a task management request for a controller.
-	 */
-	sci_base_controller_request_handler_t complete_task;
-
-};
-
-/**
- * sci_base_controller_construct() - Construct the base controller
- * @this_controller: This parameter specifies the base controller to be
- *    constructed.
- * @state_table: This parameter specifies the table of state definitions to be
- *    utilized for the controller state machine.
- * @mde_array: This parameter specifies the array of memory descriptor entries
- *    to be managed by this list.
- * @mde_array_length: This parameter specifies the size of the array of entries.
- * @next_mdl: This parameter specifies a subsequent MDL object to be managed by
- *    this MDL object.
- * @oem_parameters: This parameter specifies the original equipment
- *    manufacturer parameters to be utilized by this controller object.
- *
- */
-static inline void sci_base_controller_construct(
-	struct sci_base_controller *scic_base,
-	const struct sci_base_state *state_table,
-	struct sci_physical_memory_descriptor *mdes,
-	u32 mde_count,
-	struct sci_base_memory_descriptor_list *next_mdl)
-{
-	sci_base_state_machine_construct(
-		&scic_base->state_machine,
-		&scic_base->parent,
-		state_table,
-		SCI_BASE_CONTROLLER_STATE_INITIAL
-		);
-
-	sci_base_mdl_construct(&scic_base->mdl, mdes, mde_count, next_mdl);
-
-	sci_base_state_machine_start(&scic_base->state_machine);
-}
-
-#endif /* _SCI_BASE_CONTROLLER_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 10:47:51.518838336 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 11:17:28.785838750 +0200
@@ -212,12 +212,6 @@ static void scic_sds_controller_power_co
 		SMU_CQGR_EVENT_CYCLE_BIT \
 		)
 
-struct sci_base_memory_descriptor_list *
-sci_controller_get_memory_descriptor_list_handle(struct scic_sds_controller *scic)
-{
-       return &scic->parent.mdl;
-}
-
 static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic)
 {
 	struct isci_host *ihost = sci_object_get_association(scic);
@@ -688,13 +682,13 @@ static void scic_sds_controller_transiti
 {
 	struct isci_host *ihost = sci_object_get_association(scic);
 
-	if (scic->parent.state_machine.current_state_id ==
-			SCI_BASE_CONTROLLER_STATE_STARTING) {
+	if (scic->state_machine.current_state_id ==
+	    SCI_BASE_CONTROLLER_STATE_STARTING) {
 		/*
 		 * We move into the ready state, because some of the phys/ports
 		 * may be up and operational.
 		 */
-		sci_base_state_machine_change_state(&scic->parent.state_machine,
+		sci_base_state_machine_change_state(&scic->state_machine,
 						    SCI_BASE_CONTROLLER_STATE_READY);
 
 		isci_host_start_complete(ihost, status);
@@ -705,7 +699,7 @@ static void scic_sds_controller_timeout_
 {
 	struct scic_sds_controller *scic = _scic;
 	struct isci_host *ihost = sci_object_get_association(scic);
-	struct sci_base_state_machine *sm = &scic->parent.state_machine;
+	struct sci_base_state_machine *sm = &scic->state_machine;
 
 	if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING)
 		scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT);
@@ -1549,7 +1543,7 @@ void scic_sds_controller_error_handler(s
 		dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__,
 			interrupt_status);
 
-		sci_base_state_machine_change_state(&scic->parent.state_machine,
+		sci_base_state_machine_change_state(&scic->state_machine,
 						    SCI_BASE_CONTROLLER_STATE_FAILED);
 
 		return;
@@ -1572,7 +1566,7 @@ void scic_sds_controller_link_up(
 	scic_sds_controller_phy_handler_t link_up;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
+	state = scic->state_machine.current_state_id;
 	link_up = scic_sds_controller_state_handler_table[state].link_up;
 
 	if (link_up)
@@ -1593,7 +1587,7 @@ void scic_sds_controller_link_down(
 	u32 state;
 	scic_sds_controller_phy_handler_t link_down;
 
-	state = scic->parent.state_machine.current_state_id;
+	state = scic->state_machine.current_state_id;
 	link_down = scic_sds_controller_state_handler_table[state].link_down;
 
 	if (link_down)
@@ -1639,7 +1633,7 @@ void scic_sds_controller_remote_device_s
 	u32 state;
 	scic_sds_controller_device_handler_t stopped;
 
-	state = scic->parent.state_machine.current_state_id;
+	state = scic->state_machine.current_state_id;
 	stopped = scic_sds_controller_state_handler_table[state].device_stopped;
 
 	if (stopped)
@@ -1969,14 +1963,14 @@ enum sci_status scic_controller_initiali
 	struct scic_sds_controller *scic)
 {
 	enum sci_status status = SCI_FAILURE_INVALID_STATE;
-	sci_base_controller_handler_t initialize;
+	scic_sds_controller_handler_t initialize;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
-	initialize = scic_sds_controller_state_handler_table[state].base.initialize;
+	state = scic->state_machine.current_state_id;
+	initialize = scic_sds_controller_state_handler_table[state].initialize;
 
 	if (initialize)
-		status = initialize(&scic->parent);
+		status = initialize(scic);
 	else
 		dev_warn(scic_to_dev(scic),
 			 "%s: SCIC Controller initialize operation requested "
@@ -2050,14 +2044,14 @@ enum sci_status scic_controller_start(
 	u32 timeout)
 {
 	enum sci_status status = SCI_FAILURE_INVALID_STATE;
-	sci_base_controller_timed_handler_t start;
+	scic_sds_controller_timed_handler_t start;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
-	start = scic_sds_controller_state_handler_table[state].base.start;
+	state = scic->state_machine.current_state_id;
+	start = scic_sds_controller_state_handler_table[state].start;
 
 	if (start)
-		status = start(&scic->parent, timeout);
+		status = start(scic, timeout);
 	else
 		dev_warn(scic_to_dev(scic),
 			 "%s: SCIC Controller start operation requested in "
@@ -2089,14 +2083,14 @@ enum sci_status scic_controller_stop(
 	u32 timeout)
 {
 	enum sci_status status = SCI_FAILURE_INVALID_STATE;
-	sci_base_controller_timed_handler_t stop;
+	scic_sds_controller_timed_handler_t stop;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
-	stop = scic_sds_controller_state_handler_table[state].base.stop;
+	state = scic->state_machine.current_state_id;
+	stop = scic_sds_controller_state_handler_table[state].stop;
 
 	if (stop)
-		status = stop(&scic->parent, timeout);
+		status = stop(scic, timeout);
 	else
 		dev_warn(scic_to_dev(scic),
 			 "%s: SCIC Controller stop operation requested in "
@@ -2121,14 +2115,14 @@ enum sci_status scic_controller_reset(
 	struct scic_sds_controller *scic)
 {
 	enum sci_status status = SCI_FAILURE_INVALID_STATE;
-	sci_base_controller_handler_t reset;
+	scic_sds_controller_handler_t reset;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
-	reset = scic_sds_controller_state_handler_table[state].base.reset;
+	state = scic->state_machine.current_state_id;
+	reset = scic_sds_controller_state_handler_table[state].reset;
 
 	if (reset)
-		status = reset(&scic->parent);
+		status = reset(scic);
 	else
 		dev_warn(scic_to_dev(scic),
 			 "%s: SCIC Controller reset operation requested in "
@@ -2171,12 +2165,12 @@ enum sci_io_status scic_controller_start
 	u16 io_tag)
 {
 	u32 state;
-	sci_base_controller_start_request_handler_t start_io;
+	scic_sds_controller_start_request_handler_t start_io;
 
-	state = scic->parent.state_machine.current_state_id;
-	start_io = scic_sds_controller_state_handler_table[state].base.start_io;
+	state = scic->state_machine.current_state_id;
+	start_io = scic_sds_controller_state_handler_table[state].start_io;
 
-	return start_io(&scic->parent,
+	return start_io(scic,
 			(struct sci_base_remote_device *) remote_device,
 			(struct sci_base_request *)io_request, io_tag);
 }
@@ -2202,13 +2196,13 @@ enum sci_status scic_controller_terminat
 	struct scic_sds_remote_device *remote_device,
 	struct scic_sds_request *request)
 {
-	sci_base_controller_request_handler_t terminate_request;
+	scic_sds_controller_request_handler_t terminate_request;
 	u32 state;
 
-	state = scic->parent.state_machine.current_state_id;
+	state = scic->state_machine.current_state_id;
 	terminate_request = scic_sds_controller_state_handler_table[state].terminate_request;
 
-	return terminate_request(&scic->parent,
+	return terminate_request(scic,
 				 (struct sci_base_remote_device *)remote_device,
 				 (struct sci_base_request *)request);
 }
@@ -2241,12 +2235,12 @@ enum sci_status scic_controller_complete
 	struct scic_sds_request *io_request)
 {
 	u32 state;
-	sci_base_controller_request_handler_t complete_io;
+	scic_sds_controller_request_handler_t complete_io;
 
-	state = scic->parent.state_machine.current_state_id;
-	complete_io = scic_sds_controller_state_handler_table[state].base.complete_io;
+	state = scic->state_machine.current_state_id;
+	complete_io = scic_sds_controller_state_handler_table[state].complete_io;
 
-	return complete_io(&scic->parent,
+	return complete_io(scic,
 			   (struct sci_base_remote_device *)remote_device,
 			   (struct sci_base_request *)io_request);
 }
@@ -2286,14 +2280,14 @@ enum sci_task_status scic_controller_sta
 	u16 task_tag)
 {
 	u32 state;
-	sci_base_controller_start_request_handler_t start_task;
+	scic_sds_controller_start_request_handler_t start_task;
 	enum sci_task_status status = SCI_TASK_FAILURE_INVALID_STATE;
 
-	state = scic->parent.state_machine.current_state_id;
-	start_task = scic_sds_controller_state_handler_table[state].base.start_task;
+	state = scic->state_machine.current_state_id;
+	start_task = scic_sds_controller_state_handler_table[state].start_task;
 
 	if (start_task)
-		status = start_task(&scic->parent,
+		status = start_task(scic,
 				    (struct sci_base_remote_device *)remote_device,
 				    (struct sci_base_request *)task_request,
 				    task_tag);
@@ -2326,14 +2320,14 @@ enum sci_status scic_controller_complete
 	struct scic_sds_request *task_request)
 {
 	u32 state;
-	sci_base_controller_request_handler_t complete_task;
+	scic_sds_controller_request_handler_t complete_task;
 	enum sci_status status = SCI_FAILURE_INVALID_STATE;
 
-	state = scic->parent.state_machine.current_state_id;
-	complete_task = scic_sds_controller_state_handler_table[state].base.complete_task;
+	state = scic->state_machine.current_state_id;
+	complete_task = scic_sds_controller_state_handler_table[state].complete_task;
 
 	if (complete_task)
-		status = complete_task(&scic->parent,
+		status = complete_task(scic,
 				       (struct sci_base_remote_device *)remote_device,
 				       (struct sci_base_request *)task_request);
 	else
@@ -2518,9 +2512,9 @@ static enum sci_status scic_controller_s
 {
 	enum sci_status status          = SCI_SUCCESS;
 
-	if ((scic->parent.state_machine.current_state_id ==
+	if ((scic->state_machine.current_state_id ==
 				SCI_BASE_CONTROLLER_STATE_INITIALIZING) ||
-	    (scic->parent.state_machine.current_state_id ==
+	    (scic->state_machine.current_state_id ==
 				SCI_BASE_CONTROLLER_STATE_INITIALIZED)) {
 		switch (operating_mode) {
 		case SCI_MODE_SPEED:
@@ -2583,7 +2577,7 @@ enum sci_status scic_user_parameters_set
 	struct scic_sds_controller *scic,
 	union scic_user_parameters *scic_parms)
 {
-	u32 state = scic->parent.state_machine.current_state_id;
+	u32 state = scic->state_machine.current_state_id;
 
 	if (state == SCI_BASE_CONTROLLER_STATE_RESET ||
 	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZING ||
@@ -2637,7 +2631,7 @@ enum sci_status scic_oem_parameters_set(
 	struct scic_sds_controller *scic,
 	union scic_oem_parameters *scic_parms)
 {
-	u32 state = scic->parent.state_machine.current_state_id;
+	u32 state = scic->state_machine.current_state_id;
 
 	if (state == SCI_BASE_CONTROLLER_STATE_RESET ||
 	    state == SCI_BASE_CONTROLLER_STATE_INITIALIZING ||
@@ -2819,54 +2813,52 @@ struct scic_sds_controller *scic_control
 	return devm_kzalloc(dev, sizeof(struct scic_sds_controller), GFP_KERNEL);
 }
 
-static enum sci_status default_controller_handler(struct sci_base_controller *base_scic,
-						  const char *func)
+static enum sci_status
+default_controller_handler(struct scic_sds_controller *scic, const char *func)
 {
-	struct scic_sds_controller *scic = container_of(base_scic, typeof(*scic), parent);
-	u32 state = base_scic->state_machine.current_state_id;
-
-	dev_warn(scic_to_dev(scic), "%s: invalid state %d\n", func, state);
+	dev_warn(scic_to_dev(scic), "%s: invalid state %d\n", func,
+		 scic->state_machine.current_state_id);
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
 static enum sci_status scic_sds_controller_default_start_operation_handler(
-	struct sci_base_controller *base_scic,
+	struct scic_sds_controller *scic,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request,
 	u16 io_tag)
 {
-	return default_controller_handler(base_scic, __func__);
+	return default_controller_handler(scic, __func__);
 }
 
 static enum sci_status scic_sds_controller_default_request_handler(
-	struct sci_base_controller *base_scic,
+	struct scic_sds_controller *scic,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request)
 {
-	return default_controller_handler(base_scic, __func__);
+	return default_controller_handler(scic, __func__);
 }
 
-static enum sci_status scic_sds_controller_general_reset_handler(struct sci_base_controller *base_scic)
+static enum sci_status
+scic_sds_controller_general_reset_handler(struct scic_sds_controller *scic)
 {
 	/* The reset operation is not a graceful cleanup just perform the state
 	 * transition.
 	 */
-	sci_base_state_machine_change_state(&base_scic->state_machine,
+	sci_base_state_machine_change_state(&scic->state_machine,
 					    SCI_BASE_CONTROLLER_STATE_RESETTING);
 
 	return SCI_SUCCESS;
 }
 
-static enum sci_status scic_sds_controller_reset_state_initialize_handler(struct sci_base_controller *base_scic)
+static enum sci_status
+scic_sds_controller_reset_state_initialize_handler(struct scic_sds_controller *scic)
 {
-	struct sci_base_state_machine *sm = &base_scic->state_machine;
+	struct sci_base_state_machine *sm = &scic->state_machine;
 	enum sci_status result = SCI_SUCCESS;
-	struct scic_sds_controller *scic;
 	struct isci_host *ihost;
 	u32 index, state;
 
-	scic = container_of(base_scic, typeof(*scic), parent);
 	ihost = sci_object_get_association(scic);
 
 	sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING);
@@ -3028,13 +3020,7 @@ static enum sci_status scic_sds_controll
  * * INITIALIZED STATE HANDLERS
  * ***************************************************************************** */
 
-/**
- *
- * @controller: This is the struct sci_base_controller object which is cast
- * into a struct scic_sds_controller object.
- * @timeout: This is the allowed time for the controller object to reach the
- *    started state.
- *
+/*
  * This function is the struct scic_sds_controller start handler for the
  * initialized state.
  * - Validate we have a good memory descriptor table - Initialze the
@@ -3049,14 +3035,10 @@ static enum sci_status scic_sds_controll
  * descriptor fields is invalid.
  */
 static enum sci_status scic_sds_controller_initialized_state_start_handler(
-	struct sci_base_controller *base_scic,
-	u32 timeout)
+	struct scic_sds_controller *scic, u32 timeout)
 {
 	u16 index;
 	enum sci_status result;
-	struct scic_sds_controller *scic;
-
-	scic = container_of(base_scic, typeof(*scic), parent);
 
 	/*
 	 * Make sure that the SCI User filled in the memory descriptor
@@ -3119,7 +3101,7 @@ static enum sci_status scic_sds_controll
 
 		isci_timer_start(scic->timeout_timer, timeout);
 
-		sci_base_state_machine_change_state(&base_scic->state_machine,
+		sci_base_state_machine_change_state(&scic->state_machine,
 						    SCI_BASE_CONTROLLER_STATE_STARTING);
 	}
 
@@ -3180,79 +3162,54 @@ static void scic_sds_controller_starting
 	/* scic_sds_port_link_down(port, phy); */
 }
 
-static enum sci_status scic_sds_controller_ready_state_stop_handler(struct sci_base_controller *base_scic,
-								    u32 timeout)
+static enum sci_status scic_sds_controller_ready_state_stop_handler(
+		struct scic_sds_controller *scic,
+		u32 timeout)
 {
-	struct scic_sds_controller *scic;
-
-	scic = container_of(base_scic, typeof(*scic), parent);
 	isci_timer_start(scic->timeout_timer, timeout);
-	sci_base_state_machine_change_state(&base_scic->state_machine,
+	sci_base_state_machine_change_state(&scic->state_machine,
 					    SCI_BASE_CONTROLLER_STATE_STOPPING);
-
 	return SCI_SUCCESS;
 }
 
-/**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- * @io_tag: This is the IO tag to be assigned to the IO request or
- *    SCI_CONTROLLER_INVALID_IO_TAG.
- *
+/*
  * This method is called when the struct scic_sds_controller is in the ready state and
  * the start io handler is called. - Start the io request on the remote device
  * - if successful - assign the io_request to the io_request_table - post the
  * request to the hardware enum sci_status SCI_SUCCESS if the start io operation
  * succeeds SCI_FAILURE_INSUFFICIENT_RESOURCES if the IO tag could not be
  * allocated for the io request. SCI_FAILURE_INVALID_STATE if one or more
- * objects are not in a valid state to accept io requests. How does the io_tag
- * parameter get assigned to the io request?
+ * objects are not in a valid state to accept io requests.
+ *
+ * XXX: How does the io_tag parameter get assigned to the io request?
  */
 static enum sci_status scic_sds_controller_ready_state_start_io_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request,
 	u16 io_tag)
 {
 	enum sci_status status;
 
-	struct scic_sds_controller *this_controller;
 	struct scic_sds_request *the_request;
 	struct scic_sds_remote_device *the_device;
 
-	this_controller = (struct scic_sds_controller *)controller;
 	the_request = (struct scic_sds_request *)io_request;
 	the_device = (struct scic_sds_remote_device *)remote_device;
 
-	status = scic_sds_remote_device_start_io(this_controller, the_device, the_request);
-
-	if (status == SCI_SUCCESS) {
-		this_controller->io_request_table[
-			scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+	status = scic_sds_remote_device_start_io(controller, the_device, the_request);
 
-		scic_sds_controller_post_request(
-			this_controller,
-			scic_sds_request_get_post_context(the_request)
-			);
-	}
+	if (status != SCI_SUCCESS)
+		return status;
 
-	return status;
+	controller->io_request_table[
+		scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+	scic_sds_controller_post_request(controller,
+		scic_sds_request_get_post_context(the_request));
+	return SCI_SUCCESS;
 }
 
-/**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- *
+/*
  * This method is called when the struct scic_sds_controller is in the ready state and
  * the complete io handler is called. - Complete the io request on the remote
  * device - if successful - remove the io_request to the io_request_table
@@ -3261,76 +3218,49 @@ static enum sci_status scic_sds_controll
  * accept io requests.
  */
 static enum sci_status scic_sds_controller_ready_state_complete_io_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request)
 {
 	u16 index;
 	enum sci_status status;
-	struct scic_sds_controller *this_controller;
 	struct scic_sds_request *the_request;
 	struct scic_sds_remote_device *the_device;
 
-	this_controller = (struct scic_sds_controller *)controller;
 	the_request = (struct scic_sds_request *)io_request;
 	the_device = (struct scic_sds_remote_device *)remote_device;
 
-	status = scic_sds_remote_device_complete_io(
-		this_controller, the_device, the_request);
-
-	if (status == SCI_SUCCESS) {
-		index = scic_sds_io_tag_get_index(the_request->io_tag);
-		this_controller->io_request_table[index] = NULL;
-	}
+	status = scic_sds_remote_device_complete_io(controller, the_device,
+			the_request);
+	if (status != SCI_SUCCESS)
+		return status;
 
-	return status;
+	index = scic_sds_io_tag_get_index(the_request->io_tag);
+	controller->io_request_table[index] = NULL;
+	return SCI_SUCCESS;
 }
 
-/**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- *
+/*
  * This method is called when the struct scic_sds_controller is in the ready state and
  * the continue io handler is called. enum sci_status
  */
 static enum sci_status scic_sds_controller_ready_state_continue_io_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request)
 {
-	struct scic_sds_controller *this_controller;
 	struct scic_sds_request *the_request;
 
 	the_request     = (struct scic_sds_request *)io_request;
-	this_controller = (struct scic_sds_controller *)controller;
 
-	this_controller->io_request_table[
+	controller->io_request_table[
 		scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
-
-	scic_sds_controller_post_request(
-		this_controller,
-		scic_sds_request_get_post_context(the_request)
-		);
-
+	scic_sds_controller_post_request(controller,
+		scic_sds_request_get_post_context(the_request));
 	return SCI_SUCCESS;
 }
 
-/**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- * @task_tag: This is the task tag to be assigned to the task request or
- *    SCI_CONTROLLER_INVALID_IO_TAG.
- *
+/*
  * This method is called when the struct scic_sds_controller is in the ready state and
  * the start task handler is called. - The remote device is requested to start
  * the task request - if successful - assign the task to the io_request_table -
@@ -3341,33 +3271,28 @@ static enum sci_status scic_sds_controll
  * tag get assigned in this code path?
  */
 static enum sci_status scic_sds_controller_ready_state_start_task_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request,
 	u16 task_tag)
 {
-	struct scic_sds_controller *this_controller = (struct scic_sds_controller *)
-						 controller;
 	struct scic_sds_request *the_request     = (struct scic_sds_request *)
 					      io_request;
 	struct scic_sds_remote_device *the_device      = (struct scic_sds_remote_device *)
 						    remote_device;
 	enum sci_status status;
 
-	status = scic_sds_remote_device_start_task(
-		this_controller, the_device, the_request
-		);
+	status = scic_sds_remote_device_start_task(controller, the_device,
+			the_request);
 
 	if (status == SCI_SUCCESS) {
-		this_controller->io_request_table[
+		controller->io_request_table[
 			scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
 
-		scic_sds_controller_post_request(
-			this_controller,
-			scic_sds_request_get_post_context(the_request)
-			);
+		scic_sds_controller_post_request(controller,
+			scic_sds_request_get_post_context(the_request));
 	} else if (status == SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS) {
-		this_controller->io_request_table[
+		controller->io_request_table[
 			scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
 
 		/*
@@ -3379,15 +3304,7 @@ static enum sci_status scic_sds_controll
 	return status;
 }
 
-/**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- *
+/*
  * This method is called when the struct scic_sds_controller is in the ready state and
  * the terminate request handler is called. - call the io request terminate
  * function - if successful - post the terminate request to the SCU hardware
@@ -3396,29 +3313,26 @@ static enum sci_status scic_sds_controll
  * accept io requests.
  */
 static enum sci_status scic_sds_controller_ready_state_terminate_request_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request)
 {
-	struct scic_sds_controller *this_controller = (struct scic_sds_controller *)
-						 controller;
 	struct scic_sds_request *the_request     = (struct scic_sds_request *)
 					      io_request;
 	enum sci_status status;
 
 	status = scic_sds_io_request_terminate(the_request);
-	if (status == SCI_SUCCESS) {
-		/*
-		 * Utilize the original post context command and or in the POST_TC_ABORT
-		 * request sub-type. */
-		scic_sds_controller_post_request(
-			this_controller,
-			scic_sds_request_get_post_context(the_request)
-			| SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT
-			);
-	}
+	if (status != SCI_SUCCESS)
+		return status;
 
-	return status;
+	/*
+	 * Utilize the original post context command and or in the POST_TC_ABORT
+	 * request sub-type.
+	 */
+	scic_sds_controller_post_request(controller,
+		scic_sds_request_get_post_context(the_request) |
+		SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT);
+	return SCI_SUCCESS;
 }
 
 /**
@@ -3470,38 +3384,20 @@ static void scic_sds_controller_ready_st
  * ***************************************************************************** */
 
 /**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- * @io_request: This is the struct sci_base_request which is cast to a
- *    SCIC_SDS_IO_REQUEST object.
- *
  * This method is called when the struct scic_sds_controller is in a stopping state
  * and the complete io handler is called. - This function is not yet
  * implemented enum sci_status SCI_FAILURE
  */
 static enum sci_status scic_sds_controller_stopping_state_complete_io_handler(
-	struct sci_base_controller *controller,
+	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
 	struct sci_base_request *io_request)
 {
-	struct scic_sds_controller *this_controller;
-
-	this_controller = (struct scic_sds_controller *)controller;
-
-	/* / @todo Implement this function */
+	/* XXX: Implement this function */
 	return SCI_FAILURE;
 }
 
 /**
- *
- * @controller: This is struct sci_base_controller object which is cast into a
- *    struct scic_sds_controller object.
- * @remote_device: This is struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device object.
- *
  * This method is called when the struct scic_sds_controller is in a stopping state
  * and the remote device has stopped.
  **/
@@ -3511,8 +3407,7 @@ static void scic_sds_controller_stopping
 )
 {
 	if (!scic_sds_controller_has_remote_devices_stopping(controller)) {
-		sci_base_state_machine_change_state(
-			&controller->parent.state_machine,
+		sci_base_state_machine_change_state(&controller->state_machine,
 			SCI_BASE_CONTROLLER_STATE_STOPPED
 		);
 	}
@@ -3520,77 +3415,77 @@ static void scic_sds_controller_stopping
 
 const struct scic_sds_controller_state_handler scic_sds_controller_state_handler_table[] = {
 	[SCI_BASE_CONTROLLER_STATE_INITIAL] = {
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_RESET] = {
-		.base.reset        = scic_sds_controller_general_reset_handler,
-		.base.initialize   = scic_sds_controller_reset_state_initialize_handler,
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.reset        = scic_sds_controller_general_reset_handler,
+		.initialize   = scic_sds_controller_reset_state_initialize_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_INITIALIZING] = {
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_INITIALIZED] = {
-		.base.start        = scic_sds_controller_initialized_state_start_handler,
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start        = scic_sds_controller_initialized_state_start_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_STARTING] = {
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 		.link_up           = scic_sds_controller_starting_state_link_up_handler,
 		.link_down	   = scic_sds_controller_starting_state_link_down_handler
 	},
 	[SCI_BASE_CONTROLLER_STATE_READY] = {
-		.base.stop         = scic_sds_controller_ready_state_stop_handler,
-		.base.reset        = scic_sds_controller_general_reset_handler,
-		.base.start_io     = scic_sds_controller_ready_state_start_io_handler,
-		.base.complete_io  = scic_sds_controller_ready_state_complete_io_handler,
-		.base.continue_io  = scic_sds_controller_ready_state_continue_io_handler,
-		.base.start_task   = scic_sds_controller_ready_state_start_task_handler,
-		.base.complete_task = scic_sds_controller_ready_state_complete_io_handler,
+		.stop         = scic_sds_controller_ready_state_stop_handler,
+		.reset        = scic_sds_controller_general_reset_handler,
+		.start_io     = scic_sds_controller_ready_state_start_io_handler,
+		.complete_io  = scic_sds_controller_ready_state_complete_io_handler,
+		.continue_io  = scic_sds_controller_ready_state_continue_io_handler,
+		.start_task   = scic_sds_controller_ready_state_start_task_handler,
+		.complete_task = scic_sds_controller_ready_state_complete_io_handler,
 		.terminate_request = scic_sds_controller_ready_state_terminate_request_handler,
 		.link_up           = scic_sds_controller_ready_state_link_up_handler,
 		.link_down	   = scic_sds_controller_ready_state_link_down_handler
 	},
 	[SCI_BASE_CONTROLLER_STATE_RESETTING] = {
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_STOPPING] = {
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_stopping_state_complete_io_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_stopping_state_complete_io_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 		.device_stopped    = scic_sds_controller_stopping_state_device_stopped_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_STOPPED] = {
-		.base.reset        = scic_sds_controller_general_reset_handler,
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.reset        = scic_sds_controller_general_reset_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_FAILED] = {
-		.base.reset        = scic_sds_controller_general_reset_handler,
-		.base.start_io     = scic_sds_controller_default_start_operation_handler,
-		.base.complete_io  = scic_sds_controller_default_request_handler,
-		.base.continue_io  = scic_sds_controller_default_request_handler,
+		.reset        = scic_sds_controller_general_reset_handler,
+		.start_io     = scic_sds_controller_default_start_operation_handler,
+		.complete_io  = scic_sds_controller_default_request_handler,
+		.continue_io  = scic_sds_controller_default_request_handler,
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 };
@@ -3612,8 +3507,8 @@ static void scic_sds_controller_initial_
 
 	this_controller = (struct scic_sds_controller *)object;
 
-	sci_base_state_machine_change_state(
-		&this_controller->parent.state_machine, SCI_BASE_CONTROLLER_STATE_RESET);
+	sci_base_state_machine_change_state(&this_controller->state_machine,
+			SCI_BASE_CONTROLLER_STATE_RESET);
 }
 
 /**
@@ -3718,9 +3613,9 @@ static void scic_sds_controller_resettin
 {
 	struct scic_sds_controller *scic;
 
-	scic = container_of(object, typeof(*scic), parent.parent);
+	scic = container_of(object, typeof(*scic), parent);
 	scic_sds_controller_reset_hardware(scic);
-	sci_base_state_machine_change_state(&scic->parent.state_machine,
+	sci_base_state_machine_change_state(&scic->state_machine,
 					    SCI_BASE_CONTROLLER_STATE_RESET);
 }
 
@@ -3771,10 +3666,13 @@ enum sci_status scic_controller_construc
 {
 	u8 i;
 
-	sci_base_controller_construct(&scic->parent,
-				      scic_sds_controller_state_table,
-				      scic->memory_descriptors,
-				      ARRAY_SIZE(scic->memory_descriptors), NULL);
+	sci_base_state_machine_construct(&scic->state_machine,
+		&scic->parent, scic_sds_controller_state_table,
+		SCI_BASE_CONTROLLER_STATE_INITIAL);
+
+	sci_base_mdl_construct(&scic->mdl, scic->memory_descriptors,
+				ARRAY_SIZE(scic->memory_descriptors), NULL);
+	sci_base_state_machine_start(&scic->state_machine);
 
 	scic->scu_registers = scu_base;
 	scic->smu_registers = smu_base;
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 10:47:51.534838954 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 11:16:43.589338840 +0200
@@ -69,7 +69,9 @@
 #include "sci_pool.h"
 #include "sci_controller_constants.h"
 #include "sci_memory_descriptor_list.h"
-#include "sci_base_controller.h"
+#include "sci_base_state.h"
+#include "sci_base_state_machine.h"
+#include "sci_base_memory_descriptor_list.h"
 #include "scic_config_parameters.h"
 #include "scic_sds_port.h"
 #include "scic_sds_phy.h"
@@ -82,11 +84,12 @@
 #include "scic_sds_unsolicited_frame_control.h"
 #include "scic_sds_port_configuration_agent.h"
 
+struct sci_base_remote_device;
 struct scic_sds_remote_device;
+struct sci_base_request;
 struct scic_sds_request;
 struct scic_sds_controller;
 
-
 #define SCU_COMPLETION_RAM_ALIGNMENT            (64)
 
 /**
@@ -166,10 +169,23 @@ struct scic_power_control {
  */
 struct scic_sds_controller {
 	/**
-	 * The struct sci_base_controller is the parent object for the struct scic_sds_controller
-	 * object.
+	 * The field specifies that the parent object for the base controller
+	 * is the base object itself.
+	 */
+	struct sci_base_object parent;
+
+	/**
+	 * This field points to the memory descriptor list associated with this
+	 * controller.  The MDL indicates the memory requirements necessary for
+	 * this controller object.
+	 */
+	struct sci_base_memory_descriptor_list mdl;
+
+	/**
+	 * This field contains the information for the base controller state
+	 * machine.
 	 */
-	struct sci_base_controller parent;
+	struct sci_base_state_machine state_machine;
 
 	/**
 	 * This field is the driver timer object handler used to time the controller
@@ -376,24 +392,170 @@ struct scic_sds_controller {
 
 };
 
-typedef void (*scic_sds_controller_phy_handler_t)(struct scic_sds_controller *,
-						  struct scic_sds_port *,
-						  struct scic_sds_phy *);
+/**
+ * enum scic_sds_controller_states - This enumeration depicts all the states
+ *    for the common controller state machine.
+ */
+enum scic_sds_controller_states {
+	/**
+	 * Simply the initial state for the base controller state machine.
+	 */
+	SCI_BASE_CONTROLLER_STATE_INITIAL = 0,
 
-typedef void (*scic_sds_controller_device_handler_t)(struct scic_sds_controller *,
-						  struct scic_sds_remote_device *);
+	/**
+	 * This state indicates that the controller is reset.  The memory for
+	 * the controller is in it's initial state, but the controller requires
+	 * initialization.
+	 * This state is entered from the INITIAL state.
+	 * This state is entered from the RESETTING state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_RESET,
 
+	/**
+	 * This state is typically an action state that indicates the controller
+	 * is in the process of initialization.  In this state no new IO operations
+	 * are permitted.
+	 * This state is entered from the RESET state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_INITIALIZING,
+
+	/**
+	 * This state indicates that the controller has been successfully
+	 * initialized.  In this state no new IO operations are permitted.
+	 * This state is entered from the INITIALIZING state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_INITIALIZED,
+
+	/**
+	 * This state indicates the the controller is in the process of becoming
+	 * ready (i.e. starting).  In this state no new IO operations are permitted.
+	 * This state is entered from the INITIALIZED state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_STARTING,
+
+	/**
+	 * This state indicates the controller is now ready.  Thus, the user
+	 * is able to perform IO operations on the controller.
+	 * This state is entered from the STARTING state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_READY,
+
+	/**
+	 * This state is typically an action state that indicates the controller
+	 * is in the process of resetting.  Thus, the user is unable to perform
+	 * IO operations on the controller.  A reset is considered destructive in
+	 * most cases.
+	 * This state is entered from the READY state.
+	 * This state is entered from the FAILED state.
+	 * This state is entered from the STOPPED state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_RESETTING,
+
+	/**
+	 * This state indicates that the controller is in the process of stopping.
+	 * In this state no new IO operations are permitted, but existing IO
+	 * operations are allowed to complete.
+	 * This state is entered from the READY state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_STOPPING,
+
+	/**
+	 * This state indicates that the controller has successfully been stopped.
+	 * In this state no new IO operations are permitted.
+	 * This state is entered from the STOPPING state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_STOPPED,
+
+	/**
+	 * This state indicates that the controller could not successfully be
+	 * initialized.  In this state no new IO operations are permitted.
+	 * This state is entered from the INITIALIZING state.
+	 * This state is entered from the STARTING state.
+	 * This state is entered from the STOPPING state.
+	 * This state is entered from the RESETTING state.
+	 */
+	SCI_BASE_CONTROLLER_STATE_FAILED,
+
+	SCI_BASE_CONTROLLER_MAX_STATES
+
+};
+
+typedef enum sci_status (*scic_sds_controller_handler_t)
+				(struct scic_sds_controller *);
+typedef enum sci_status (*scic_sds_controller_timed_handler_t)
+				(struct scic_sds_controller *, u32);
+typedef enum sci_status (*scic_sds_controller_request_handler_t)
+				(struct scic_sds_controller *,
+				 struct sci_base_remote_device *,
+				 struct sci_base_request *);
+typedef enum sci_status (*scic_sds_controller_start_request_handler_t)
+				(struct scic_sds_controller *,
+				 struct sci_base_remote_device *,
+				 struct sci_base_request *, u16);
+typedef void (*scic_sds_controller_phy_handler_t)
+				(struct scic_sds_controller *,
+				 struct scic_sds_port *,
+				 struct scic_sds_phy *);
+typedef void (*scic_sds_controller_device_handler_t)
+				(struct scic_sds_controller *,
+				 struct scic_sds_remote_device *);
 
-/**
- * struct scic_sds_controller_state_handler -
- *
- * This structure contains the SDS core specific definition for the state
- * handlers.
- */
 struct scic_sds_controller_state_handler {
-	struct sci_base_controller_state_handler base;
+	/**
+	 * The start_handler specifies the method invoked when a user attempts to
+	 * start a controller.
+	 */
+	scic_sds_controller_timed_handler_t start;
+
+	/**
+	 * The stop_handler specifies the method invoked when a user attempts to
+	 * stop a controller.
+	 */
+	scic_sds_controller_timed_handler_t stop;
+
+	/**
+	 * The reset_handler specifies the method invoked when a user attempts to
+	 * reset a controller.
+	 */
+	scic_sds_controller_handler_t reset;
+
+	/**
+	 * The initialize_handler specifies the method invoked when a user
+	 * attempts to initialize a controller.
+	 */
+	scic_sds_controller_handler_t initialize;
+
+	/**
+	 * The start_io_handler specifies the method invoked when a user
+	 * attempts to start an IO request for a controller.
+	 */
+	scic_sds_controller_start_request_handler_t start_io;
+
+	/**
+	 * The complete_io_handler specifies the method invoked when a user
+	 * attempts to complete an IO request for a controller.
+	 */
+	scic_sds_controller_request_handler_t complete_io;
+
+	/**
+	 * The continue_io_handler specifies the method invoked when a user
+	 * attempts to continue an IO request for a controller.
+	 */
+	scic_sds_controller_request_handler_t continue_io;
+
+	/**
+	 * The start_task_handler specifies the method invoked when a user
+	 * attempts to start a task management request for a controller.
+	 */
+	scic_sds_controller_start_request_handler_t start_task;
+
+	/**
+	 * The complete_task_handler specifies the method invoked when a user
+	 * attempts to complete a task management request for a controller.
+	 */
+	scic_sds_controller_request_handler_t complete_task;
 
-	sci_base_controller_request_handler_t terminate_request;
+	scic_sds_controller_request_handler_t terminate_request;
 	scic_sds_controller_phy_handler_t link_up;
 	scic_sds_controller_phy_handler_t link_down;
 	scic_sds_controller_device_handler_t device_stopped;
Index: linux-2.6/drivers/scsi/isci/core/sci_controller.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/sci_controller.h	2011-03-28 10:51:18.373839042 +0200
+++ linux-2.6/drivers/scsi/isci/core/sci_controller.h	2011-03-28 10:51:57.169340947 +0200
@@ -63,36 +63,7 @@
  *
  */
 
-
-struct sci_base_memory_descriptor_list;
-struct scic_sds_controller;
-
 #define SCI_CONTROLLER_INVALID_IO_TAG 0xFFFF
 
-/**
- * sci_controller_get_memory_descriptor_list_handle() - This method simply
- *    returns a handle for the memory descriptor list associated with the
- *    supplied controller.  The descriptor list provides DMA safe/capable
- *    memory requirements for this controller.
- * @controller: This parameter specifies the controller for which to retrieve
- *    the DMA safe memory descriptor list.
- *
- * The user must adhere to the alignment requirements specified in memory
- * descriptor.  In situations where the operating environment does not offer
- * memory allocation utilities supporting alignment, then it is the
- * responsibility of the user to manually align the memory buffer for SCI.
- * Thus, the user may have to allocate a larger buffer to meet the alignment.
- * Additionally, the user will need to remember the actual memory allocation
- * addresses in order to ensure the memory can be properly freed when necessary
- * to do so. This method will return a valid handle, but the MDL may not be
- * accurate until after the user has invoked the associated
- * sci_controller_initialize() routine. A pointer to a physical memory
- * descriptor array.
- */
-struct sci_base_memory_descriptor_list *
-	sci_controller_get_memory_descriptor_list_handle(
-	struct scic_sds_controller *controller);
-
-
 #endif  /* _SCI_CONTROLLER_H_ */
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_remote_device.c	2011-03-28 11:00:58.162838072 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.c	2011-03-28 11:14:57.437839475 +0200
@@ -563,12 +563,11 @@ void scic_sds_remote_device_continue_req
 	/* we need to check if this request is still valid to continue. */
 	if (sci_req) {
 		struct scic_sds_controller *scic = sci_req->owning_controller;
-		u32 state = scic->parent.state_machine.current_state_id;
-		sci_base_controller_request_handler_t continue_io;
+		u32 state = scic->state_machine.current_state_id;
+		scic_sds_controller_request_handler_t continue_io;
 
-		continue_io = scic_sds_controller_state_handler_table[state].base.continue_io;
-		continue_io(&scic->parent, &sci_req->target_device->parent,
-			    &sci_req->parent);
+		continue_io = scic_sds_controller_state_handler_table[state].continue_io;
+		continue_io(scic, &sci_req->target_device->parent, &sci_req->parent);
 	}
 }
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_stp_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_stp_request.c	2011-03-28 11:01:29.481838605 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_stp_request.c	2011-03-28 11:14:59.897907145 +0200
@@ -649,7 +649,7 @@ static enum sci_status scic_sds_stp_requ
 	u32 length)
 {
 	struct scic_sds_stp_request *this_sds_stp_request = (struct scic_sds_stp_request *)this_request;
-	sci_base_controller_request_handler_t continue_io;
+	scic_sds_controller_request_handler_t continue_io;
 	struct scu_sgl_element *current_sgl;
 	struct scic_sds_controller *scic;
 	u32 state;
@@ -675,9 +675,9 @@ static enum sci_status scic_sds_stp_requ
 
 	/* send the new TC out. */
 	scic = this_request->owning_controller;
-	state = scic->parent.state_machine.current_state_id;
-	continue_io = scic_sds_controller_state_handler_table[state].base.continue_io;
-	return continue_io(&scic->parent, &this_request->target_device->parent,
+	state = scic->state_machine.current_state_id;
+	continue_io = scic_sds_controller_state_handler_table[state].continue_io;
+	return continue_io(scic, &this_request->target_device->parent,
 			   &this_request->parent);
 }
 
@@ -1822,7 +1822,7 @@ static void scic_sds_stp_request_started
 	struct sci_base_object *object)
 {
 	struct scic_sds_request *this_request = (struct scic_sds_request *)object;
-	sci_base_controller_request_handler_t continue_io;
+	scic_sds_controller_request_handler_t continue_io;
 	struct scu_task_context *task_context;
 	struct sata_fis_reg_h2d *h2d_fis;
 	struct scic_sds_controller *scic;
@@ -1839,10 +1839,10 @@ static void scic_sds_stp_request_started
 	task_context->control_frame = 0;
 
 	scic = this_request->owning_controller;
-	state = scic->parent.state_machine.current_state_id;
-	continue_io = scic_sds_controller_state_handler_table[state].base.continue_io;
+	state = scic->state_machine.current_state_id;
+	continue_io = scic_sds_controller_state_handler_table[state].continue_io;
 
-	status = continue_io(&scic->parent, &this_request->target_device->parent,
+	status = continue_io(scic, &this_request->target_device->parent,
 			     &this_request->parent);
 
 	if (status == SCI_SUCCESS) {
Index: linux-2.6/drivers/scsi/isci/host.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/host.c	2011-03-28 10:51:18.393839193 +0200
+++ linux-2.6/drivers/scsi/isci/host.c	2011-03-28 10:54:35.953897776 +0200
@@ -62,6 +62,7 @@
 #include "request.h"
 #include "host.h"
 #include "probe_roms.h"
+#include "core/scic_sds_controller.h"
 
 irqreturn_t isci_msix_isr(int vec, void *data)
 {
@@ -231,9 +232,8 @@ static int isci_host_mdl_allocate_cohere
 	struct coherent_memory_info *mdl_struct;
 	u32 size = 0;
 
-	struct sci_base_memory_descriptor_list *mdl_handle
-		= sci_controller_get_memory_descriptor_list_handle(
-		isci_host->core_controller);
+	struct sci_base_memory_descriptor_list *mdl_handle =
+		&isci_host->core_controller->mdl;
 
 	sci_mdl_first_entry(mdl_handle);
 
Index: linux-2.6/drivers/scsi/isci/isci.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/isci.h	2011-03-28 11:05:31.970896757 +0200
+++ linux-2.6/drivers/scsi/isci/isci.h	2011-03-28 11:06:01.485461661 +0200
@@ -65,7 +65,7 @@
 #include <scsi/libsas.h>
 #include <scsi/scsi.h>
 
-#include "sci_base_controller.h"
+#include "core/sci_object.h"
 #include "scic_controller.h"
 #include "host.h"
 #include "timers.h"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] isci: remove base_request abstraction
  2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
  2011-03-28 13:21   ` [PATCH 1/2] isci: remove base_controller abstraction Christoph Hellwig
@ 2011-03-28 13:21   ` Christoph Hellwig
  2011-03-31 22:14     ` Dan Williams
  2011-03-31 22:24   ` [PATCH, RFC 0/2] scic: remove pointless stuctures Dan Williams
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-28 13:21 UTC (permalink / raw)
  To: Dan Williams
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

Merge struct sci_base_request into scic_sds_request, and also factor the two
types of state machine handlers into one function.  While we're at it also
remove lots of duplicate incorrect kerneldoc comments for the state machine
handlers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/drivers/scsi/isci/core/sci_base_remote_device.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/sci_base_remote_device.h	2011-03-28 11:21:32.845838101 +0200
+++ linux-2.6/drivers/scsi/isci/core/sci_base_remote_device.h	2011-03-28 11:40:42.229838870 +0200
@@ -65,7 +65,7 @@
 
 #include "sci_base_state_machine.h"
 
-struct sci_base_request;
+struct scic_sds_request;
 
 /**
  * enum sci_base_remote_device_states - This enumeration depicts all the states
@@ -159,12 +159,12 @@ typedef enum sci_status (*sci_base_remot
 
 typedef enum sci_status (*sci_base_remote_device_request_handler_t)(
 	struct sci_base_remote_device *,
-	struct sci_base_request *
+	struct scic_sds_request *
 	);
 
 typedef enum sci_status (*sci_base_remote_device_high_priority_request_complete_handler_t)(
 	struct sci_base_remote_device *,
-	struct sci_base_request *,
+	struct scic_sds_request *,
 	void *,
 	enum sci_io_status
 	);
Index: linux-2.6/drivers/scsi/isci/core/sci_base_request.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/sci_base_request.h	2011-03-28 11:19:07.474839171 +0200
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,195 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCI_BASE_REQUST_H_
-#define _SCI_BASE_REQUST_H_
-
-/**
- * This file contains all of the constants, types, and method declarations for
- *    the SCI base IO and task request objects.
- *
- *
- */
-
-#include "sci_base_state_machine.h"
-
-/**
- * enum sci_base_request_states - This enumeration depicts all the states for
- *    the common request state machine.
- *
- *
- */
-enum sci_base_request_states {
-	/**
-	 * Simply the initial state for the base request state machine.
-	 */
-	SCI_BASE_REQUEST_STATE_INITIAL,
-
-	/**
-	 * This state indicates that the request has been constructed. This state
-	 * is entered from the INITIAL state.
-	 */
-	SCI_BASE_REQUEST_STATE_CONSTRUCTED,
-
-	/**
-	 * This state indicates that the request has been started. This state is
-	 * entered from the CONSTRUCTED state.
-	 */
-	SCI_BASE_REQUEST_STATE_STARTED,
-
-	/**
-	 * This state indicates that the request has completed.
-	 * This state is entered from the STARTED state. This state is entered from
-	 * the ABORTING state.
-	 */
-	SCI_BASE_REQUEST_STATE_COMPLETED,
-
-	/**
-	 * This state indicates that the request is in the process of being
-	 * terminated/aborted.
-	 * This state is entered from the CONSTRUCTED state.
-	 * This state is entered from the STARTED state.
-	 */
-	SCI_BASE_REQUEST_STATE_ABORTING,
-
-	/**
-	 * Simply the final state for the base request state machine.
-	 */
-	SCI_BASE_REQUEST_STATE_FINAL,
-};
-
-/**
- * struct sci_base_request - The base request object abstracts the fields
- *    common to all SCI IO and task request objects.
- *
- *
- */
-struct sci_base_request {
-	/**
-	 * The field specifies that the parent object for the base request is the
-	 * base object itself.
-	 */
-	struct sci_base_object parent;
-
-	/**
-	 * This field contains the information for the base request state machine.
-	 */
-	struct sci_base_state_machine state_machine;
-};
-
-typedef enum sci_status (*sci_base_request_handler_t)(
-	struct sci_base_request *this_request
-	);
-
-/**
- * struct sci_base_request_state_handler - This structure contains all of the
- *    state handler methods common to base IO and task request state machines.
- *    Handler methods provide the ability to change the behavior for user
- *    requests or transitions depending on the state the machine is in.
- *
- *
- */
-struct sci_base_request_state_handler {
-	/**
-	 * The start_handler specifies the method invoked when a user attempts to
-	 * start a request.
-	 */
-	sci_base_request_handler_t start_handler;
-
-	/**
-	 * The abort_handler specifies the method invoked when a user attempts to
-	 * abort a request.
-	 */
-	sci_base_request_handler_t abort_handler;
-
-	/**
-	 * The complete_handler specifies the method invoked when a user attempts to
-	 * complete a request.
-	 */
-	sci_base_request_handler_t complete_handler;
-
-	/**
-	 * The destruct_handler specifies the method invoked when a user attempts to
-	 * destruct a request.
-	 */
-	sci_base_request_handler_t destruct_handler;
-
-};
-
-/**
- * sci_base_request_construct() - Construct the base request.
- * @this_request: This parameter specifies the base request to be constructed.
- * @state_table: This parameter specifies the table of state definitions to be
- *    utilized for the request state machine.
- *
- */
-static inline void sci_base_request_construct(
-	struct sci_base_request *base_req,
-	const struct sci_base_state *my_state_table)
-{
-	base_req->parent.private = NULL;
-	sci_base_state_machine_construct(
-		&base_req->state_machine,
-		&base_req->parent,
-		my_state_table,
-		SCI_BASE_REQUEST_STATE_INITIAL
-		);
-
-	sci_base_state_machine_start(
-		&base_req->state_machine
-		);
-}
-
-#endif /* _SCI_BASE_REQUST_H_ */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 11:21:32.865841675 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.c	2011-03-28 11:24:41.181837740 +0200
@@ -2161,7 +2161,7 @@ enum sci_status scic_controller_reset(
 enum sci_io_status scic_controller_start_io(
 	struct scic_sds_controller *scic,
 	struct scic_sds_remote_device *remote_device,
-	struct scic_sds_request *io_request,
+	struct scic_sds_request *request,
 	u16 io_tag)
 {
 	u32 state;
@@ -2172,7 +2172,7 @@ enum sci_io_status scic_controller_start
 
 	return start_io(scic,
 			(struct sci_base_remote_device *) remote_device,
-			(struct sci_base_request *)io_request, io_tag);
+			request, io_tag);
 }
 
 /**
@@ -2204,7 +2204,7 @@ enum sci_status scic_controller_terminat
 
 	return terminate_request(scic,
 				 (struct sci_base_remote_device *)remote_device,
-				 (struct sci_base_request *)request);
+				 request);
 }
 
 /**
@@ -2232,7 +2232,7 @@ enum sci_status scic_controller_terminat
 enum sci_status scic_controller_complete_io(
 	struct scic_sds_controller *scic,
 	struct scic_sds_remote_device *remote_device,
-	struct scic_sds_request *io_request)
+	struct scic_sds_request *request)
 {
 	u32 state;
 	scic_sds_controller_request_handler_t complete_io;
@@ -2242,7 +2242,7 @@ enum sci_status scic_controller_complete
 
 	return complete_io(scic,
 			   (struct sci_base_remote_device *)remote_device,
-			   (struct sci_base_request *)io_request);
+			   request);
 }
 
 /**
@@ -2289,7 +2289,7 @@ enum sci_task_status scic_controller_sta
 	if (start_task)
 		status = start_task(scic,
 				    (struct sci_base_remote_device *)remote_device,
-				    (struct sci_base_request *)task_request,
+				    task_request,
 				    task_tag);
 	else
 		dev_warn(scic_to_dev(scic),
@@ -2329,7 +2329,7 @@ enum sci_status scic_controller_complete
 	if (complete_task)
 		status = complete_task(scic,
 				       (struct sci_base_remote_device *)remote_device,
-				       (struct sci_base_request *)task_request);
+				       task_request);
 	else
 		dev_warn(scic_to_dev(scic),
 			 "%s: SCIC Controller completing task from invalid "
@@ -2825,7 +2825,7 @@ default_controller_handler(struct scic_s
 static enum sci_status scic_sds_controller_default_start_operation_handler(
 	struct scic_sds_controller *scic,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request,
+	struct scic_sds_request *request,
 	u16 io_tag)
 {
 	return default_controller_handler(scic, __func__);
@@ -2834,7 +2834,7 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_default_request_handler(
 	struct scic_sds_controller *scic,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request)
+	struct scic_sds_request *request)
 {
 	return default_controller_handler(scic, __func__);
 }
@@ -3186,26 +3186,24 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_ready_state_start_io_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request,
+	struct scic_sds_request *request,
 	u16 io_tag)
 {
 	enum sci_status status;
 
-	struct scic_sds_request *the_request;
 	struct scic_sds_remote_device *the_device;
 
-	the_request = (struct scic_sds_request *)io_request;
 	the_device = (struct scic_sds_remote_device *)remote_device;
 
-	status = scic_sds_remote_device_start_io(controller, the_device, the_request);
+	status = scic_sds_remote_device_start_io(controller, the_device, request);
 
 	if (status != SCI_SUCCESS)
 		return status;
 
 	controller->io_request_table[
-		scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+		scic_sds_io_tag_get_index(request->io_tag)] = request;
 	scic_sds_controller_post_request(controller,
-		scic_sds_request_get_post_context(the_request));
+		scic_sds_request_get_post_context(request));
 	return SCI_SUCCESS;
 }
 
@@ -3220,22 +3218,20 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_ready_state_complete_io_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request)
+	struct scic_sds_request *request)
 {
 	u16 index;
 	enum sci_status status;
-	struct scic_sds_request *the_request;
 	struct scic_sds_remote_device *the_device;
 
-	the_request = (struct scic_sds_request *)io_request;
 	the_device = (struct scic_sds_remote_device *)remote_device;
 
 	status = scic_sds_remote_device_complete_io(controller, the_device,
-			the_request);
+			request);
 	if (status != SCI_SUCCESS)
 		return status;
 
-	index = scic_sds_io_tag_get_index(the_request->io_tag);
+	index = scic_sds_io_tag_get_index(request->io_tag);
 	controller->io_request_table[index] = NULL;
 	return SCI_SUCCESS;
 }
@@ -3247,16 +3243,12 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_ready_state_continue_io_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *the_request;
-
-	the_request     = (struct scic_sds_request *)io_request;
-
 	controller->io_request_table[
-		scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+		scic_sds_io_tag_get_index(request->io_tag)] = request;
 	scic_sds_controller_post_request(controller,
-		scic_sds_request_get_post_context(the_request));
+		scic_sds_request_get_post_context(request));
 	return SCI_SUCCESS;
 }
 
@@ -3273,27 +3265,25 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_ready_state_start_task_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request,
+	struct scic_sds_request *request,
 	u16 task_tag)
 {
-	struct scic_sds_request *the_request     = (struct scic_sds_request *)
-					      io_request;
 	struct scic_sds_remote_device *the_device      = (struct scic_sds_remote_device *)
 						    remote_device;
 	enum sci_status status;
 
 	status = scic_sds_remote_device_start_task(controller, the_device,
-			the_request);
+			request);
 
 	if (status == SCI_SUCCESS) {
 		controller->io_request_table[
-			scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+			scic_sds_io_tag_get_index(request->io_tag)] = request;
 
 		scic_sds_controller_post_request(controller,
-			scic_sds_request_get_post_context(the_request));
+			scic_sds_request_get_post_context(request));
 	} else if (status == SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS) {
 		controller->io_request_table[
-			scic_sds_io_tag_get_index(the_request->io_tag)] = the_request;
+			scic_sds_io_tag_get_index(request->io_tag)] = request;
 
 		/*
 		 * We will let framework know this task request started successfully,
@@ -3315,13 +3305,11 @@ static enum sci_status scic_sds_controll
 static enum sci_status scic_sds_controller_ready_state_terminate_request_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *the_request     = (struct scic_sds_request *)
-					      io_request;
 	enum sci_status status;
 
-	status = scic_sds_io_request_terminate(the_request);
+	status = scic_sds_io_request_terminate(request);
 	if (status != SCI_SUCCESS)
 		return status;
 
@@ -3330,7 +3318,7 @@ static enum sci_status scic_sds_controll
 	 * request sub-type.
 	 */
 	scic_sds_controller_post_request(controller,
-		scic_sds_request_get_post_context(the_request) |
+		scic_sds_request_get_post_context(request) |
 		SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT);
 	return SCI_SUCCESS;
 }
@@ -3391,7 +3379,7 @@ static void scic_sds_controller_ready_st
 static enum sci_status scic_sds_controller_stopping_state_complete_io_handler(
 	struct scic_sds_controller *controller,
 	struct sci_base_remote_device *remote_device,
-	struct sci_base_request *io_request)
+	struct scic_sds_request *request)
 {
 	/* XXX: Implement this function */
 	return SCI_FAILURE;
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 11:21:32.885840675 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_controller.h	2011-03-28 11:40:36.973838334 +0200
@@ -86,7 +86,6 @@
 
 struct sci_base_remote_device;
 struct scic_sds_remote_device;
-struct sci_base_request;
 struct scic_sds_request;
 struct scic_sds_controller;
 
@@ -487,11 +486,11 @@ typedef enum sci_status (*scic_sds_contr
 typedef enum sci_status (*scic_sds_controller_request_handler_t)
 				(struct scic_sds_controller *,
 				 struct sci_base_remote_device *,
-				 struct sci_base_request *);
+				 struct scic_sds_request *);
 typedef enum sci_status (*scic_sds_controller_start_request_handler_t)
 				(struct scic_sds_controller *,
 				 struct sci_base_remote_device *,
-				 struct sci_base_request *, u16);
+				 struct scic_sds_request *, u16);
 typedef void (*scic_sds_controller_phy_handler_t)
 				(struct scic_sds_controller *,
 				 struct scic_sds_port *,
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_port.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_port.c	2011-03-28 11:21:32.901837516 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_port.c	2011-03-28 11:25:05.641338436 +0200
@@ -1090,15 +1090,7 @@ static enum sci_status scic_sds_port_rea
 	return SCI_SUCCESS;
 }
 
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- *    object.
- * @device: This is the struct sci_base_remote_device object which is not used in this
- *    function.
- * @io_request: This is the struct sci_base_request object which is not used in this
- *    function.
- *
+/*
  * This method is the general ready substate complete io handler for the
  * struct scic_sds_port object.  This function decrments the outstanding request count
  * for this port object. enum sci_status SCI_SUCCESS
@@ -1194,15 +1186,7 @@ static void scic_sds_port_ready_waiting_
 		);
 }
 
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- *    object.
- * @device: This is the struct sci_base_remote_device object which is not used in this
- *    request.
- * @io_request: This is the struct sci_base_request object which is not used in this
- *    function.
- *
+/*
  * This method is the ready waiting substate start io handler for the
  * struct scic_sds_port object. The port object can not accept new requests so the
  * request is failed. enum sci_status SCI_FAILURE_INVALID_STATE
@@ -1316,15 +1300,7 @@ static void scic_sds_port_ready_operatio
 						    SCIC_SDS_PORT_READY_SUBSTATE_WAITING);
 }
 
-/**
- *
- * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
- *    object.
- * @device: This is the struct sci_base_remote_device object which is not used in this
- *    function.
- * @io_request: This is the struct sci_base_request object which is not used in this
- *    function.
- *
+/*
  * This method is the ready operational substate start io handler for the
  * struct scic_sds_port object.  This function incremetns the outstanding request
  * count for this port object. enum sci_status SCI_SUCCESS
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_remote_device.c	2011-03-28 11:21:32.913838684 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.c	2011-03-28 12:16:36.469839797 +0200
@@ -363,7 +363,7 @@ enum sci_status scic_sds_remote_device_s
 	struct scic_sds_request *io_request)
 {
 	return this_device->state_handlers->parent.start_io_handler(
-		       &this_device->parent, &io_request->parent);
+		       &this_device->parent, io_request);
 }
 
 /**
@@ -381,7 +381,7 @@ enum sci_status scic_sds_remote_device_c
 	struct scic_sds_request *io_request)
 {
 	return this_device->state_handlers->parent.complete_io_handler(
-		       &this_device->parent, &io_request->parent);
+		       &this_device->parent, io_request);
 }
 
 /**
@@ -399,7 +399,7 @@ enum sci_status scic_sds_remote_device_s
 	struct scic_sds_request *io_request)
 {
 	return this_device->state_handlers->parent.start_task_handler(
-		       &this_device->parent, &io_request->parent);
+		       &this_device->parent, io_request);
 }
 
 /**
@@ -567,7 +567,7 @@ void scic_sds_remote_device_continue_req
 		scic_sds_controller_request_handler_t continue_io;
 
 		continue_io = scic_sds_controller_state_handler_table[state].continue_io;
-		continue_io(scic, &sci_req->target_device->parent, &sci_req->parent);
+		continue_io(scic, &sci_req->target_device->parent, sci_req);
 	}
 }
 
@@ -792,21 +792,21 @@ enum sci_status scic_sds_remote_device_d
 
 enum sci_status scic_sds_remote_device_default_start_request_handler(
 	struct sci_base_remote_device *base_dev,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return default_device_handler(base_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_complete_request_handler(
 	struct sci_base_remote_device *base_dev,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return default_device_handler(base_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_continue_request_handler(
 	struct sci_base_remote_device *base_dev,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return default_device_handler(base_dev, __func__);
 }
@@ -1019,13 +1019,7 @@ enum sci_status scic_sds_remote_device_r
 	return SCI_SUCCESS;
 }
 
-/**
- *
- * @device: The struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device for which the request is to be started.
- * @request: The struct sci_base_request which is cast to a SCIC_SDS_IO_REQUEST that
- *    is to be started.
- *
+/*
  * This method will attempt to start a task request for this device object. The
  * remote device object will issue the start request for the task and if
  * successful it will start the request for the port object then increment its
@@ -1035,38 +1029,28 @@ enum sci_status scic_sds_remote_device_r
  */
 static enum sci_status scic_sds_remote_device_ready_state_start_task_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status result;
 	struct scic_sds_remote_device *this_device  = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *task_request = (struct scic_sds_request *)request;
 
 	/* See if the port is in a state where we can start the IO request */
 	result = scic_sds_port_start_io(
-		scic_sds_remote_device_get_port(this_device), this_device, task_request);
+		scic_sds_remote_device_get_port(this_device), this_device, request);
 
 	if (result == SCI_SUCCESS) {
 		result = scic_sds_remote_node_context_start_task(
-			this_device->rnc, task_request
-			);
-
-		if (result == SCI_SUCCESS) {
-			result = scic_sds_request_start(task_request);
-		}
+			this_device->rnc, request);
+		if (result == SCI_SUCCESS)
+			result = scic_sds_request_start(request);
 
-		scic_sds_remote_device_start_request(this_device, task_request, result);
+		scic_sds_remote_device_start_request(this_device, request, result);
 	}
 
 	return result;
 }
 
-/**
- *
- * @device: The struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device for which the request is to be started.
- * @request: The struct sci_base_request which is cast to a SCIC_SDS_IO_REQUEST that
- *    is to be started.
- *
+/*
  * This method will attempt to start an io request for this device object. The
  * remote device object will issue the start request for the io and if
  * successful it will start the request for the port object then increment its
@@ -1076,38 +1060,28 @@ static enum sci_status scic_sds_remote_d
  */
 static enum sci_status scic_sds_remote_device_ready_state_start_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status result;
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *io_request  = (struct scic_sds_request *)request;
 
 	/* See if the port is in a state where we can start the IO request */
 	result = scic_sds_port_start_io(
-		scic_sds_remote_device_get_port(this_device), this_device, io_request);
+		scic_sds_remote_device_get_port(this_device), this_device, request);
 
 	if (result == SCI_SUCCESS) {
 		result = scic_sds_remote_node_context_start_io(
-			this_device->rnc, io_request
-			);
+			this_device->rnc, request);
+		if (result == SCI_SUCCESS)
+			result = scic_sds_request_start(request);
 
-		if (result == SCI_SUCCESS) {
-			result = scic_sds_request_start(io_request);
-		}
-
-		scic_sds_remote_device_start_request(this_device, io_request, result);
+		scic_sds_remote_device_start_request(this_device, request, result);
 	}
 
 	return result;
 }
 
-/**
- *
- * @device: The struct sci_base_remote_device which is cast to a
- *    struct scic_sds_remote_device for which the request is to be completed.
- * @request: The struct sci_base_request which is cast to a SCIC_SDS_IO_REQUEST that
- *    is to be completed.
- *
+/*
  * This method will complete the request for the remote device object.  The
  * method will call the completion handler for the request object and if
  * successful it will complete the request on the port object then decrement
@@ -1115,18 +1089,17 @@ static enum sci_status scic_sds_remote_d
  */
 static enum sci_status scic_sds_remote_device_ready_state_complete_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status result;
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *the_request = (struct scic_sds_request *)request;
 
-	result = scic_sds_request_complete(the_request);
+	result = scic_sds_request_complete(request);
 
 	if (result == SCI_SUCCESS) {
 		/* See if the port is in a state where we can start the IO request */
 		result = scic_sds_port_complete_io(
-			scic_sds_remote_device_get_port(this_device), this_device, the_request);
+			scic_sds_remote_device_get_port(this_device), this_device, request);
 
 		if (result == SCI_SUCCESS) {
 			scic_sds_remote_device_decrement_request_count(this_device);
@@ -1178,19 +1151,16 @@ static enum sci_status scic_sds_remote_d
  */
 static enum sci_status scic_sds_remote_device_stopping_state_complete_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status = SCI_SUCCESS;
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
-	status = scic_sds_request_complete(this_request);
+	status = scic_sds_request_complete(request);
 	if (status == SCI_SUCCESS) {
 		status = scic_sds_port_complete_io(
 			scic_sds_remote_device_get_port(this_device),
-			this_device,
-			this_request
-			);
+			this_device, request);
 
 		if (status == SCI_SUCCESS) {
 			scic_sds_remote_device_decrement_request_count(this_device);
@@ -1255,11 +1225,7 @@ static enum sci_status scic_sds_remote_d
 	return SCI_SUCCESS;
 }
 
-/**
- *
- * @device: The device object for which the request is completing.
- * @request: The task request that is being completed.
- *
+/*
  * This method completes requests for this struct scic_sds_remote_device while it is
  * in the SCI_BASE_REMOTE_DEVICE_STATE_RESETTING state. This method calls the
  * complete method for the request object and if that is successful the port
@@ -1268,17 +1234,16 @@ static enum sci_status scic_sds_remote_d
  */
 static enum sci_status scic_sds_remote_device_resetting_state_complete_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status = SCI_SUCCESS;
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
-	status = scic_sds_request_complete(this_request);
+	status = scic_sds_request_complete(request);
 
 	if (status == SCI_SUCCESS) {
 		status = scic_sds_port_complete_io(
-			scic_sds_remote_device_get_port(this_device), this_device, this_request);
+			scic_sds_remote_device_get_port(this_device), this_device, request);
 
 		if (status == SCI_SUCCESS) {
 			scic_sds_remote_device_decrement_request_count(this_device);
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_remote_device.h	2011-03-28 11:21:32.929838543 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_remote_device.h	2011-03-28 12:08:01.793838917 +0200
@@ -65,7 +65,6 @@
 
 #include "intel_sas.h"
 #include "sci_base_remote_device.h"
-#include "sci_base_request.h"
 #include "scu_remote_node_context.h"
 #include "scic_sds_remote_node_context.h"
 
@@ -507,15 +506,15 @@ enum sci_status scic_sds_remote_device_d
 
 enum sci_status scic_sds_remote_device_default_start_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_complete_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_continue_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_suspend_handler(
 	struct scic_sds_remote_device *this_device,
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_request.c	2011-03-28 11:19:52.374837312 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_request.c	2011-03-28 12:11:15.433838915 +0200
@@ -57,7 +57,6 @@
 #include "intel_sas.h"
 #include "intel_sata.h"
 #include "intel_sat.h"
-#include "sci_base_request.h"
 #include "scic_controller.h"
 #include "scic_io_request.h"
 #include "scic_remote_device.h"
@@ -728,10 +727,8 @@ enum sci_status scic_io_request_construc
 
 	scic_sds_io_request_build_ssp_command_iu(sci_req);
 
-	sci_base_state_machine_change_state(
-		&sci_req->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_CONSTRUCTED
-		);
+	sci_base_state_machine_change_state(&sci_req->state_machine,
+		SCI_BASE_REQUEST_STATE_CONSTRUCTED);
 
 	return SCI_SUCCESS;
 }
@@ -746,10 +743,8 @@ enum sci_status scic_task_request_constr
 	/* Fill in the SSP Task IU */
 	scic_sds_task_request_build_ssp_task_iu(sci_req);
 
-	sci_base_state_machine_change_state(
-		&sci_req->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_CONSTRUCTED
-		);
+	sci_base_state_machine_change_state(&sci_req->state_machine,
+		SCI_BASE_REQUEST_STATE_CONSTRUCTED);
 
 	return SCI_SUCCESS;
 }
@@ -780,10 +775,8 @@ enum sci_status scic_io_request_construc
 	status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy);
 
 	if (status == SCI_SUCCESS)
-		sci_base_state_machine_change_state(
-			&sci_req->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_CONSTRUCTED
-			);
+		sci_base_state_machine_change_state(&sci_req->state_machine,
+			SCI_BASE_REQUEST_STATE_CONSTRUCTED);
 
 	return status;
 }
@@ -818,10 +811,8 @@ enum sci_status scic_task_request_constr
 	}
 
 	if (status == SCI_SUCCESS)
-		sci_base_state_machine_change_state(
-			&sci_req->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_CONSTRUCTED
-			);
+		sci_base_state_machine_change_state(&sci_req->state_machine,
+			SCI_BASE_REQUEST_STATE_CONSTRUCTED);
 
 	return status;
 }
@@ -891,18 +882,12 @@ u32 scic_io_request_get_number_of_bytes_
  * This method invokes the base state start request handler for the
  * SCIC_SDS_IO_REQUEST_T object. enum sci_status
  */
-enum sci_status scic_sds_request_start(
-	struct scic_sds_request *this_request)
+enum sci_status
+scic_sds_request_start(struct scic_sds_request *request)
 {
-	if (
-		this_request->device_sequence
-		== scic_sds_remote_device_get_sequence(this_request->target_device)
-		) {
-		return this_request->state_handlers->parent.start_handler(
-			       &this_request->parent
-			       );
-	}
-
+	if (request->device_sequence ==
+	    scic_sds_remote_device_get_sequence(request->target_device))
+		return request->state_handlers->start_handler(request);
 	return SCI_FAILURE;
 }
 
@@ -914,11 +899,10 @@ enum sci_status scic_sds_request_start(
  * This method invokes the base state terminate request handber for the
  * SCIC_SDS_IO_REQUEST_T object. enum sci_status
  */
-enum sci_status scic_sds_io_request_terminate(
-	struct scic_sds_request *this_request)
+enum sci_status
+scic_sds_io_request_terminate(struct scic_sds_request *request)
 {
-	return this_request->state_handlers->parent.abort_handler(
-		       &this_request->parent);
+	return request->state_handlers->abort_handler(request);
 }
 
 /**
@@ -929,11 +913,10 @@ enum sci_status scic_sds_io_request_term
  * This method invokes the base state request completion handler for the
  * SCIC_SDS_IO_REQUEST_T object. enum sci_status
  */
-enum sci_status scic_sds_io_request_complete(
-	struct scic_sds_request *this_request)
+enum sci_status
+scic_sds_io_request_complete(struct scic_sds_request *request)
 {
-	return this_request->state_handlers->parent.complete_handler(
-		       &this_request->parent);
+	return request->state_handlers->complete_handler(request);
 }
 
 /**
@@ -1023,175 +1006,132 @@ void scic_sds_io_request_copy_response(s
  * *  DEFAULT STATE HANDLERS
  * ***************************************************************************** */
 
-/**
- * scic_sds_request_default_start_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_start() request.  The default action is
  * to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_start_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *scic_request =
-		(struct scic_sds_request *)request;
-
-	dev_warn(scic_to_dev(scic_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		 "%s: SCIC IO Request requested to start while in wrong "
 		 "state %d\n",
 		 __func__,
-		 sci_base_state_machine_get_state(
-			 &((struct scic_sds_request *)request)->parent.state_machine));
+		 sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
 static enum sci_status scic_sds_request_default_abort_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *scic_request =
-		(struct scic_sds_request *)request;
-
-	dev_warn(scic_to_dev(scic_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		"%s: SCIC IO Request requested to abort while in wrong "
 		"state %d\n",
 		__func__,
-		sci_base_state_machine_get_state(
-			&((struct scic_sds_request *)request)->parent.state_machine));
+		sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
-/**
- * scic_sds_request_default_complete_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_complete() request.  The default action
  * is to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_complete_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *scic_request =
-		(struct scic_sds_request *)request;
-
-	dev_warn(scic_to_dev(scic_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		"%s: SCIC IO Request requested to complete while in wrong "
 		"state %d\n",
 		__func__,
-		sci_base_state_machine_get_state(
-			&((struct scic_sds_request *)request)->parent.state_machine));
+		sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
-/**
- * scic_sds_request_default_destruct_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_complete() request.  The default action
  * is to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_destruct_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *scic_request =
-		(struct scic_sds_request *)request;
-
-	dev_warn(scic_to_dev(scic_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		 "%s: SCIC IO Request requested to destroy while in wrong "
 		 "state %d\n",
 		 __func__,
-		 sci_base_state_machine_get_state(
-			 &((struct scic_sds_request *)request)->parent.state_machine));
+		 sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
 /**
- * scic_sds_request_default_tc_completion_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_task_request_complete() request.  The default
  * action is to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_tc_completion_handler(
-	struct scic_sds_request *this_request,
+	struct scic_sds_request *request,
 	u32 completion_code)
 {
-	dev_warn(scic_to_dev(this_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		"%s: SCIC IO Request given task completion notification %x "
 		"while in wrong state %d\n",
 		__func__,
 		completion_code,
-		sci_base_state_machine_get_state(
-			&this_request->parent.state_machine));
+		sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 
 }
 
-/**
- * scic_sds_request_default_event_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_event_handler() request.  The default
  * action is to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_event_handler(
-	struct scic_sds_request *this_request,
+	struct scic_sds_request *request,
 	u32 event_code)
 {
-	dev_warn(scic_to_dev(this_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		 "%s: SCIC IO Request given event code notification %x while "
 		 "in wrong state %d\n",
 		 __func__,
 		 event_code,
-		 sci_base_state_machine_get_state(
-			 &this_request->parent.state_machine));
+		 sci_base_state_machine_get_state(&request->state_machine));
 
 	return SCI_FAILURE_INVALID_STATE;
 }
 
-/**
- * scic_sds_request_default_frame_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_event_handler() request.  The default
  * action is to log a warning and return a failure status. enum sci_status
  * SCI_FAILURE_INVALID_STATE
  */
 enum sci_status scic_sds_request_default_frame_handler(
-	struct scic_sds_request *this_request,
+	struct scic_sds_request *request,
 	u32 frame_index)
 {
-	dev_warn(scic_to_dev(this_request->owning_controller),
+	dev_warn(scic_to_dev(request->owning_controller),
 		 "%s: SCIC IO Request given unexpected frame %x while in "
 		 "state %d\n",
 		 __func__,
 		 frame_index,
-		 sci_base_state_machine_get_state(
-			 &this_request->parent.state_machine));
+		 sci_base_state_machine_get_state(&request->state_machine));
 
 	scic_sds_controller_release_frame(
-		this_request->owning_controller, frame_index);
+		request->owning_controller, frame_index);
 
 	return SCI_FAILURE_INVALID_STATE;
 }
@@ -1201,11 +1141,7 @@ enum sci_status scic_sds_request_default
  * *  CONSTRUCTED STATE HANDLERS
  * ***************************************************************************** */
 
-/**
- * scic_sds_request_constructed_state_start_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action taken when a constructed
  * SCIC_SDS_IO_REQUEST_T object receives a scic_sds_request_start() request.
  * This method will, if necessary, allocate a TCi for the io request object and
@@ -1215,34 +1151,33 @@ enum sci_status scic_sds_request_default
  * SCI_SUCCESS SCI_FAILURE_INSUFFICIENT_RESOURCES
  */
 static enum sci_status scic_sds_request_constructed_state_start_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	struct scu_task_context *task_context;
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
 
-	if (this_request->io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
-		this_request->io_tag =
-			scic_controller_allocate_io_tag(this_request->owning_controller);
+	if (request->io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
+		request->io_tag =
+			scic_controller_allocate_io_tag(request->owning_controller);
 	}
 
 	/* Record the IO Tag in the request */
-	if (this_request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
-		task_context = this_request->task_context_buffer;
+	if (request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
+		task_context = request->task_context_buffer;
 
-		task_context->task_index = scic_sds_io_tag_get_index(this_request->io_tag);
+		task_context->task_index = scic_sds_io_tag_get_index(request->io_tag);
 
 		switch (task_context->protocol_type) {
 		case SCU_TASK_CONTEXT_PROTOCOL_SMP:
 		case SCU_TASK_CONTEXT_PROTOCOL_SSP:
 			/* SSP/SMP Frame */
-			task_context->type.ssp.tag = this_request->io_tag;
+			task_context->type.ssp.tag = request->io_tag;
 			task_context->type.ssp.target_port_transfer_tag = 0xFFFF;
 			break;
 
 		case SCU_TASK_CONTEXT_PROTOCOL_STP:
 			/*
 			 * STP/SATA Frame
-			 * task_context->type.stp.ncq_tag = this_request->ncq_tag; */
+			 * task_context->type.stp.ncq_tag = request->ncq_tag; */
 			break;
 
 		case SCU_TASK_CONTEXT_PROTOCOL_NONE:
@@ -1257,20 +1192,17 @@ static enum sci_status scic_sds_request_
 		/*
 		 * Check to see if we need to copy the task context buffer
 		 * or have been building into the task context buffer */
-		if (this_request->was_tag_assigned_by_user == false) {
+		if (request->was_tag_assigned_by_user == false) {
 			scic_sds_controller_copy_task_context(
-				this_request->owning_controller, this_request
-				);
+				request->owning_controller, request);
 		}
 
 		/* Add to the post_context the io tag value */
-		this_request->post_context |= scic_sds_io_tag_get_index(this_request->io_tag);
+		request->post_context |= scic_sds_io_tag_get_index(request->io_tag);
 
 		/* Everything is good go ahead and change state */
-		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_STARTED
-			);
+		sci_base_state_machine_change_state(&request->state_machine,
+			SCI_BASE_REQUEST_STATE_STARTED);
 
 		return SCI_SUCCESS;
 	}
@@ -1278,35 +1210,24 @@ static enum sci_status scic_sds_request_
 	return SCI_FAILURE_INSUFFICIENT_RESOURCES;
 }
 
-/**
- * scic_sds_request_constructed_state_abort_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_terminate() request. Since the request
  * has not yet been posted to the hardware the request transitions to the
  * completed state. enum sci_status SCI_SUCCESS
  */
 static enum sci_status scic_sds_request_constructed_state_abort_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
-
 	/*
 	 * This request has been terminated by the user make sure that the correct
 	 * status code is returned */
-	scic_sds_request_set_status(
-		this_request,
+	scic_sds_request_set_status(request,
 		SCU_TASK_DONE_TASK_ABORT,
-		SCI_FAILURE_IO_TERMINATED
-		);
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
+		SCI_FAILURE_IO_TERMINATED);
 
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
 	return SCI_SUCCESS;
 }
 
@@ -1315,30 +1236,20 @@ static enum sci_status scic_sds_request_
  * *  STARTED STATE HANDLERS
  * ***************************************************************************** */
 
-/**
- * scic_sds_request_started_state_abort_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_terminate() request. Since the request
  * has been posted to the hardware the io request state is changed to the
  * aborting state. enum sci_status SCI_SUCCESS
  */
 enum sci_status scic_sds_request_started_state_abort_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
-
-	if (this_request->has_started_substate_machine) {
-		sci_base_state_machine_stop(&this_request->started_substate_machine);
-	}
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_ABORTING
-		);
+	if (request->has_started_substate_machine)
+		sci_base_state_machine_stop(&request->started_substate_machine);
 
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_ABORTING);
 	return SCI_SUCCESS;
 }
 
@@ -1512,20 +1423,12 @@ enum sci_status scic_sds_request_started
 	 */
 
 	/* In all cases we will treat this as the completion of the IO request. */
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
-
+	sci_base_state_machine_change_state(&this_request->state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
 	return SCI_SUCCESS;
 }
 
-/**
- * scic_sds_request_started_state_frame_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- * @frame_index: This is the index of the unsolicited frame to be processed.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_frame_handler() request. This method
  * first determines the frame type received.  If this is a response frame then
@@ -1601,11 +1504,7 @@ static enum sci_status scic_sds_request_
  * ***************************************************************************** */
 
 
-/**
- * scic_sds_request_completed_state_complete_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_complete() request. This method frees up
  * any io request resources that have been allocated and transitions the
@@ -1613,26 +1512,20 @@ static enum sci_status scic_sds_request_
  * transitioning to the final state? enum sci_status SCI_SUCCESS
  */
 static enum sci_status scic_sds_request_completed_state_complete_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
-
-	if (this_request->was_tag_assigned_by_user != true) {
+	if (request->was_tag_assigned_by_user != true) {
 		scic_controller_free_io_tag(
-			this_request->owning_controller, this_request->io_tag
-			);
+			request->owning_controller, request->io_tag);
 	}
 
-	if (this_request->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) {
+	if (request->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) {
 		scic_sds_controller_release_frame(
-			this_request->owning_controller, this_request->saved_rx_frame_index);
+			request->owning_controller, request->saved_rx_frame_index);
 	}
 
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_FINAL
-		);
-
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_FINAL);
 	return SCI_SUCCESS;
 }
 
@@ -1641,11 +1534,7 @@ static enum sci_status scic_sds_request_
  * *  ABORTING STATE HANDLERS
  * ***************************************************************************** */
 
-/**
- * scic_sds_request_aborting_state_abort_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_terminate() request. This method is the
  * io request aborting state abort handlers.  On receipt of a multiple
@@ -1653,23 +1542,14 @@ static enum sci_status scic_sds_request_
  * This should not happen in normal operation. enum sci_status SCI_SUCCESS
  */
 static enum sci_status scic_sds_request_aborting_state_abort_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
-
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
 	return SCI_SUCCESS;
 }
 
-/**
- * scic_sds_request_aborting_state_tc_completion_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_task_completion() request. This method
  * decodes the completion type waiting for the abort task complete
@@ -1687,10 +1567,8 @@ static enum sci_status scic_sds_request_
 			this_request, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED
 			);
 
-		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+		sci_base_state_machine_change_state(&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 
 	default:
@@ -1703,11 +1581,7 @@ static enum sci_status scic_sds_request_
 	return SCI_SUCCESS;
 }
 
-/**
- * scic_sds_request_aborting_state_frame_handler() -
- * @request: This is the struct sci_base_request object that is cast to the
- *    SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
- *
+/*
  * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
  * object receives a scic_sds_request_frame_handler() request. This method
  * discards the unsolicited frame since we are waiting for the abort task
@@ -1727,58 +1601,58 @@ static enum sci_status scic_sds_request_
 
 static const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
 	[SCI_BASE_REQUEST_STATE_INITIAL] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_default_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_default_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
-		.parent.start_handler    = scic_sds_request_constructed_state_start_handler,
-		.parent.abort_handler    = scic_sds_request_constructed_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_constructed_state_start_handler,
+		.abort_handler		= scic_sds_request_constructed_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCI_BASE_REQUEST_STATE_STARTED] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_started_state_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_started_state_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_started_state_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_started_state_frame_handler,
 	},
 	[SCI_BASE_REQUEST_STATE_COMPLETED] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_default_abort_handler,
-		.parent.complete_handler = scic_sds_request_completed_state_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_default_abort_handler,
+		.complete_handler	= scic_sds_request_completed_state_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCI_BASE_REQUEST_STATE_ABORTING] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_aborting_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_aborting_state_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_aborting_state_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_aborting_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_aborting_state_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_aborting_state_frame_handler,
 	},
 	[SCI_BASE_REQUEST_STATE_FINAL] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_default_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_default_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 };
 
@@ -1978,7 +1852,11 @@ static void scic_sds_general_request_con
 					       void *user_io_request_object,
 					       struct scic_sds_request *sci_req)
 {
-	sci_base_request_construct(&sci_req->parent, scic_sds_request_state_table);
+	sci_req->parent.private = NULL;
+	sci_base_state_machine_construct(&sci_req->state_machine, &sci_req->parent,
+			scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL);
+	sci_base_state_machine_start(&sci_req->state_machine);
+
 	sci_req->io_tag = io_tag;
 	sci_req->user_request = user_io_request_object;
 	sci_req->owning_controller = scic;
@@ -2070,7 +1948,7 @@ enum sci_status scic_task_request_constr
 		/* Construct the started sub-state machine. */
 		sci_base_state_machine_construct(
 			&sci_req->started_substate_machine,
-			&sci_req->parent.parent,
+			&sci_req->parent,
 			scic_sds_io_request_started_task_mgmt_substate_table,
 			SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
 			);
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_request.h
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_request.h	2011-03-28 11:21:32.953838657 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_request.h	2011-03-28 12:08:17.102838333 +0200
@@ -64,8 +64,7 @@
  */
 
 #include "scic_io_request.h"
-
-#include "sci_base_request.h"
+#include "sci_base_state_machine.h"
 #include "scu_task_context.h"
 #include "intel_sas.h"
 
@@ -127,9 +126,15 @@ enum scic_sds_smp_request_started_substa
  */
 struct scic_sds_request {
 	/**
-	 * This field indictes the parent object of the request.
+	 * The field specifies that the parent object for the base request is the
+	 * base object itself.
 	 */
-	struct sci_base_request parent;
+	struct sci_base_object parent;
+
+	/**
+	 * This field contains the information for the base request state machine.
+	 */
+	struct sci_base_state_machine state_machine;
 
 	void *user_request;
 
@@ -231,15 +236,59 @@ struct scic_sds_request {
 
 };
 
+/**
+ * enum sci_base_request_states - This enumeration depicts all the states for
+ *    the common request state machine.
+ *
+ *
+ */
+enum sci_base_request_states {
+	/**
+	 * Simply the initial state for the base request state machine.
+	 */
+	SCI_BASE_REQUEST_STATE_INITIAL,
+
+	/**
+	 * This state indicates that the request has been constructed. This state
+	 * is entered from the INITIAL state.
+	 */
+	SCI_BASE_REQUEST_STATE_CONSTRUCTED,
+
+	/**
+	 * This state indicates that the request has been started. This state is
+	 * entered from the CONSTRUCTED state.
+	 */
+	SCI_BASE_REQUEST_STATE_STARTED,
+
+	/**
+	 * This state indicates that the request has completed.
+	 * This state is entered from the STARTED state. This state is entered from
+	 * the ABORTING state.
+	 */
+	SCI_BASE_REQUEST_STATE_COMPLETED,
 
-typedef enum sci_status
-(*scic_sds_io_request_frame_handler_t)(struct scic_sds_request *req, u32 frame);
+	/**
+	 * This state indicates that the request is in the process of being
+	 * terminated/aborted.
+	 * This state is entered from the CONSTRUCTED state.
+	 * This state is entered from the STARTED state.
+	 */
+	SCI_BASE_REQUEST_STATE_ABORTING,
 
-typedef enum sci_status
-(*scic_sds_io_request_event_handler_t)(struct scic_sds_request *req, u32 event);
+	/**
+	 * Simply the final state for the base request state machine.
+	 */
+	SCI_BASE_REQUEST_STATE_FINAL,
+};
 
-typedef enum sci_status
-(*scic_sds_io_request_task_completion_handler_t)(struct scic_sds_request *req, u32 completion_code);
+typedef enum sci_status (*scic_sds_io_request_handler_t)
+				(struct scic_sds_request *request);
+typedef enum sci_status (*scic_sds_io_request_frame_handler_t)
+				(struct scic_sds_request *req, u32 frame);
+typedef enum sci_status (*scic_sds_io_request_event_handler_t)
+				(struct scic_sds_request *req, u32 event);
+typedef enum sci_status (*scic_sds_io_request_task_completion_handler_t)
+				(struct scic_sds_request *req, u32 completion_code);
 
 /**
  * struct scic_sds_io_request_state_handler - This is the SDS core definition
@@ -248,7 +297,30 @@ typedef enum sci_status
  *
  */
 struct scic_sds_io_request_state_handler {
-	struct sci_base_request_state_handler parent;
+	/**
+	 * The start_handler specifies the method invoked when a user attempts to
+	 * start a request.
+	 */
+	scic_sds_io_request_handler_t start_handler;
+
+	/**
+	 * The abort_handler specifies the method invoked when a user attempts to
+	 * abort a request.
+	 */
+	scic_sds_io_request_handler_t abort_handler;
+
+	/**
+	 * The complete_handler specifies the method invoked when a user attempts to
+	 * complete a request.
+	 */
+	scic_sds_io_request_handler_t complete_handler;
+
+	/**
+	 * The destruct_handler specifies the method invoked when a user attempts to
+	 * destruct a request.
+	 */
+	scic_sds_io_request_handler_t destruct_handler;
+
 
 	scic_sds_io_request_task_completion_handler_t tc_completion_handler;
 	scic_sds_io_request_event_handler_t event_handler;
@@ -319,7 +391,7 @@ extern const struct sci_base_state scic_
 	}
 
 #define scic_sds_request_complete(a_request) \
-	((a_request)->state_handlers->parent.complete_handler(&(a_request)->parent))
+	((a_request)->state_handlers->complete_handler(a_request))
 
 
 
@@ -331,15 +403,15 @@ extern const struct sci_base_state scic_
  * struct scic_sds_io_request object.
  */
 #define scic_sds_io_request_tc_completion(this_request, completion_code) \
-	{ \
-		if (this_request->parent.state_machine.current_state_id	 \
-		    == SCI_BASE_REQUEST_STATE_STARTED \
-		    && this_request->has_started_substate_machine \
-		    == false) \
-			scic_sds_request_started_state_tc_completion_handler(this_request, completion_code); \
-		else \
-			this_request->state_handlers->tc_completion_handler(this_request, completion_code); \
-	}
+{ \
+	if (this_request->state_machine.current_state_id	 \
+	    == SCI_BASE_REQUEST_STATE_STARTED \
+	    && this_request->has_started_substate_machine \
+	    == false) \
+		scic_sds_request_started_state_tc_completion_handler(this_request, completion_code); \
+	else \
+		this_request->state_handlers->tc_completion_handler(this_request, completion_code); \
+}
 
 /**
  * SCU_SGL_ZERO() -
@@ -426,14 +498,14 @@ enum sci_status scic_sds_task_request_te
  * ***************************************************************************** */
 
 enum sci_status scic_sds_request_default_start_handler(
-	struct sci_base_request *this_request);
+	struct scic_sds_request *request);
 
 
 enum sci_status scic_sds_request_default_complete_handler(
-	struct sci_base_request *this_request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_request_default_destruct_handler(
-	struct sci_base_request *this_request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_request_default_tc_completion_handler(
 	struct scic_sds_request *this_request,
@@ -453,7 +525,7 @@ enum sci_status scic_sds_request_default
  * ***************************************************************************** */
 
 enum sci_status scic_sds_request_started_state_abort_handler(
-	struct sci_base_request *this_request);
+	struct scic_sds_request *request);
 
 enum sci_status scic_sds_request_started_state_tc_completion_handler(
 	struct scic_sds_request *this_request,
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_smp_remote_device.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_smp_remote_device.c	2011-03-28 11:21:32.969838392 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_smp_remote_device.c	2011-03-28 11:35:46.181338558 +0200
@@ -78,29 +78,24 @@
  */
 static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status;
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *io_request  = (struct scic_sds_request *)request;
 
 	/* Will the port allow the io request to start? */
 	status = this_device->owning_port->state_handlers->start_io_handler(
-		this_device->owning_port,
-		this_device,
-		io_request
-		);
+		this_device->owning_port, this_device, request);
 
 	if (status == SCI_SUCCESS) {
 		status =
-			scic_sds_remote_node_context_start_io(this_device->rnc, io_request);
+			scic_sds_remote_node_context_start_io(this_device->rnc, request);
 
-		if (status == SCI_SUCCESS) {
-			status = scic_sds_request_start(io_request);
-		}
+		if (status == SCI_SUCCESS)
+			status = scic_sds_request_start(request);
 
 		if (status == SCI_SUCCESS) {
-			this_device->working_request = io_request;
+			this_device->working_request = request;
 
 			sci_base_state_machine_change_state(
 				&this_device->ready_substate_machine,
@@ -108,7 +103,7 @@ static enum sci_status scic_sds_smp_remo
 				);
 		}
 
-		scic_sds_remote_device_start_request(this_device, io_request, status);
+		scic_sds_remote_device_start_request(this_device, request, status);
 	}
 
 	return status;
@@ -129,7 +124,7 @@ static enum sci_status scic_sds_smp_remo
  */
 static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return SCI_FAILURE_INVALID_STATE;
 }
@@ -144,7 +139,7 @@ static enum sci_status scic_sds_smp_remo
  */
 static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status;
 	struct scic_sds_remote_device *this_device;
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_ssp_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_ssp_request.c	2011-03-28 11:21:32.989839000 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_ssp_request.c	2011-03-28 12:22:22.045838340 +0200
@@ -120,10 +120,8 @@ static enum sci_status scic_sds_ssp_task
 			SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
 			);
 
-		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+		sci_base_state_machine_change_state(&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -143,20 +141,12 @@ static enum sci_status scic_sds_ssp_task
  * pattern for this particular device).
  */
 static enum sci_status scic_sds_ssp_task_request_await_tc_response_abort_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_ABORTING
-		);
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
-
+	sci_base_state_machine_change_state(&request->state_machine,
+			SCI_BASE_REQUEST_STATE_ABORTING);
+	sci_base_state_machine_change_state(&request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 	return SCI_SUCCESS;
 }
 
@@ -176,41 +166,36 @@ static enum sci_status scic_sds_ssp_task
  * probably update to check frame type and make sure it is a response frame.
  */
 static enum sci_status scic_sds_ssp_task_request_await_tc_response_frame_handler(
-	struct scic_sds_request *this_request,
+	struct scic_sds_request *request,
 	u32 frame_index)
 {
-	scic_sds_io_request_copy_response(this_request);
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
-
-	scic_sds_controller_release_frame(
-		this_request->owning_controller, frame_index
-		);
+	scic_sds_io_request_copy_response(request);
 
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
+	scic_sds_controller_release_frame(request->owning_controller,
+			frame_index);
 	return SCI_SUCCESS;
 }
 
 static const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_started_substate_handler_table[] = {
 	[SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_ssp_task_request_await_tc_response_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_ssp_task_request_await_tc_response_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_ssp_task_request_await_tc_response_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_ssp_task_request_await_tc_response_frame_handler,
 	}
 };
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_stp_packet_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_stp_packet_request.c	2011-03-28 11:21:33.009844742 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_stp_packet_request.c	2011-03-28 11:36:39.425839493 +0200
@@ -659,16 +659,12 @@ enum sci_status scic_sds_stp_packet_requ
 }
 
 enum sci_status scic_sds_stp_packet_request_started_completion_delay_complete_handler(
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
+	sci_base_state_machine_change_state(&request->parent.state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
 
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
-
-	return this_request->sci_status;
+	return request->sci_status;
 }
 
 /* --------------------------------------------------------------------------- */
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_stp_remote_device.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_stp_remote_device.c	2011-03-28 11:21:33.029840702 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_stp_remote_device.c	2011-03-28 12:21:27.245402648 +0200
@@ -78,22 +78,20 @@
  */
 static enum sci_status scic_sds_stp_remote_device_complete_request(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *the_request = (struct scic_sds_request *)request;
 	enum sci_status status;
 
-	status = scic_sds_io_request_complete(the_request);
+	status = scic_sds_io_request_complete(request);
 
 	if (status == SCI_SUCCESS) {
 		status = scic_sds_port_complete_io(
-			this_device->owning_port, this_device, the_request
-			);
+			this_device->owning_port, this_device, request);
 
 		if (status == SCI_SUCCESS) {
 			scic_sds_remote_device_decrement_request_count(this_device);
-			if (the_request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) {
+			if (request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) {
 				/*
 				 * This request causes hardware error, device needs to be Lun Reset.
 				 * So here we force the state machine to IDLE state so the rest IOs
@@ -119,7 +117,7 @@ static enum sci_status scic_sds_stp_remo
 			__func__,
 			this_device->owning_port,
 			this_device,
-			the_request,
+			request,
 			status);
 
 	return status;
@@ -143,64 +141,54 @@ static enum sci_status scic_sds_stp_remo
  */
 static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status;
 	struct scic_sds_remote_device *this_device  = (struct scic_sds_remote_device *)device;
-	struct scic_sds_request *this_request = (struct scic_sds_request *)request;
 
 	/* Will the port allow the io request to start? */
 	status = this_device->owning_port->state_handlers->start_io_handler(
-		this_device->owning_port,
-		this_device,
-		this_request
-		);
-
-	if (SCI_SUCCESS == status) {
-		status =
-			scic_sds_remote_node_context_start_task(this_device->rnc, this_request);
-
-		if (SCI_SUCCESS == status) {
-			status = this_request->state_handlers->parent.start_handler(request);
-		}
-
-		if (status == SCI_SUCCESS) {
-			/*
-			 * / @note If the remote device state is not IDLE this will replace
-			 * /       the request that probably resulted in the task management
-			 * /       request. */
-			this_device->working_request = this_request;
+		this_device->owning_port, this_device, request);
+	if (status != SCI_SUCCESS)
+		return status;
 
-			sci_base_state_machine_change_state(
-				&this_device->ready_substate_machine,
-				SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD
-				);
+	status = scic_sds_remote_node_context_start_task(this_device->rnc, request);
+	if (status != SCI_SUCCESS)
+		goto out;
 
-			/*
-			 * The remote node context must cleanup the TCi to NCQ mapping table.
-			 * The only way to do this correctly is to either write to the TLCR
-			 * register or to invalidate and repost the RNC. In either case the
-			 * remote node context state machine will take the correct action when
-			 * the remote node context is suspended and later resumed. */
-			scic_sds_remote_node_context_suspend(
-				this_device->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL);
-
-			scic_sds_remote_node_context_resume(
-				this_device->rnc,
-				scic_sds_remote_device_continue_request,
-				this_device);
-		}
+	status = request->state_handlers->start_handler(request);
+	if (status != SCI_SUCCESS)
+		goto out;
 
-		scic_sds_remote_device_start_request(this_device, this_request, status);
+	/*
+	 * Note: If the remote device state is not IDLE this will replace
+	 * the request that probably resulted in the task management request.
+	 */
+	this_device->working_request = request;
+	sci_base_state_machine_change_state(&this_device->ready_substate_machine,
+			SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
 
-		/*
-		 * We need to let the controller start request handler know that it can't
-		 * post TC yet. We will provide a callback function to post TC when RNC gets
-		 * resumed. */
-		return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS;
-	}
+	/*
+	 * The remote node context must cleanup the TCi to NCQ mapping table.
+	 * The only way to do this correctly is to either write to the TLCR
+	 * register or to invalidate and repost the RNC. In either case the
+	 * remote node context state machine will take the correct action when
+	 * the remote node context is suspended and later resumed.
+	 */
+	scic_sds_remote_node_context_suspend(this_device->rnc,
+			SCI_SOFTWARE_SUSPENSION, NULL, NULL);
+	scic_sds_remote_node_context_resume(this_device->rnc,
+			scic_sds_remote_device_continue_request,
+			this_device);
 
-	return status;
+out:
+	scic_sds_remote_device_start_request(this_device, request, status);
+	/*
+	 * We need to let the controller start request handler know that it can't
+	 * post TC yet. We will provide a callback function to post TC when RNC gets
+	 * resumed.
+	 */
+	return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS;
 }
 
 /*
@@ -221,53 +209,39 @@ static enum sci_status scic_sds_stp_remo
  */
 static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler(
 	struct sci_base_remote_device *base_device,
-	struct sci_base_request *base_request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status;
 	struct scic_sds_remote_device *device =
 		(struct scic_sds_remote_device *)&base_device->parent;
-	struct scic_sds_request *sds_request  =
-		(struct scic_sds_request *)&base_request->parent;
 	struct isci_request *isci_request =
-		(struct isci_request *)sci_object_get_association(sds_request);
+		(struct isci_request *)sci_object_get_association(request);
 
 
 	/* Will the port allow the io request to start? */
 	status = device->owning_port->state_handlers->start_io_handler(
-			device->owning_port,
-			device,
-			sds_request);
-
-	if (status == SCI_SUCCESS) {
-		status =
-			scic_sds_remote_node_context_start_io(device->rnc,
-							      sds_request);
-
-		if (status == SCI_SUCCESS)
-			status =
-				sds_request->state_handlers->
-					parent.start_handler(base_request);
+			device->owning_port, device, request);
+	if (status != SCI_SUCCESS)
+		return status;
 
-		if (status == SCI_SUCCESS) {
-			if (isci_sata_get_sat_protocol(isci_request) ==
-					SAT_PROTOCOL_FPDMA)
-				sci_base_state_machine_change_state(
-					&device->ready_substate_machine,
-					SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
-			else {
-				device->working_request = sds_request;
+	status = scic_sds_remote_node_context_start_io(device->rnc, request);
+	if (status != SCI_SUCCESS)
+		goto out;
 
-				sci_base_state_machine_change_state(
-					&device->ready_substate_machine,
-					SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
-			}
-		}
+	status = request->state_handlers->start_handler(request);
+	if (status != SCI_SUCCESS)
+		goto out;
 
-		scic_sds_remote_device_start_request(device,
-						     sds_request,
-						     status);
+	if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
+		sci_base_state_machine_change_state(&device->ready_substate_machine,
+				SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
+	} else {
+		device->working_request = request;
+		sci_base_state_machine_change_state(&device->ready_substate_machine,
+				SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
 	}
-
+out:
+	scic_sds_remote_device_start_request(device, request, status);
 	return status;
 }
 
@@ -308,33 +282,30 @@ static enum sci_status scic_sds_stp_remo
 
 static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler(
 	struct sci_base_remote_device *base_device,
-	struct sci_base_request *base_request)
+	struct scic_sds_request *request)
 {
 	enum sci_status status;
 	struct scic_sds_remote_device *device =
 		(struct scic_sds_remote_device *)&base_device->parent;
-	struct scic_sds_request *sds_request  =
-		(struct scic_sds_request *)&base_request->parent;
 	struct isci_request *isci_request =
-		(struct isci_request *)sci_object_get_association(sds_request);
+		(struct isci_request *)sci_object_get_association(request);
 
 	if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
 		status = device->owning_port->state_handlers->start_io_handler(
 				device->owning_port,
 				device,
-				sds_request);
+				request);
 
 		if (status == SCI_SUCCESS) {
 			status = scic_sds_remote_node_context_start_io(
 					device->rnc,
-					sds_request);
+					request);
 
 			if (status == SCI_SUCCESS)
-				status = sds_request->state_handlers->
-					parent.start_handler(base_request);
+				status = request->state_handlers->start_handler(request);
 
 			scic_sds_remote_device_start_request(device,
-							     sds_request,
+							     request,
 							     status);
 		}
 	} else
@@ -422,7 +393,7 @@ static enum sci_status scic_sds_stp_remo
  */
 static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return SCI_FAILURE_INVALID_STATE;
 }
@@ -475,7 +446,7 @@ static enum sci_status scic_sds_stp_remo
  * ***************************************************************************** */
 static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
 }
@@ -494,7 +465,7 @@ static enum sci_status scic_sds_stp_remo
  */
 static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler(
 	struct sci_base_remote_device *device,
-	struct sci_base_request *request)
+	struct scic_sds_request *request)
 {
 	struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 	struct scic_sds_request *the_request = (struct scic_sds_request *)request;
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_smp_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_smp_request.c	2011-03-28 12:02:45.578837563 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_smp_request.c	2011-03-28 12:23:16.189838474 +0200
@@ -394,7 +394,7 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
+			&this_request->state_machine,
 			SCI_BASE_REQUEST_STATE_COMPLETED
 			);
 	}
@@ -433,9 +433,8 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 
 	case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR):
@@ -452,9 +451,8 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 
 	default:
@@ -468,9 +466,8 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -502,9 +499,8 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 
 	default:
@@ -518,9 +514,8 @@ static enum sci_status scic_sds_smp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -530,22 +525,22 @@ static enum sci_status scic_sds_smp_requ
 
 static const struct scic_sds_io_request_state_handler scic_sds_smp_request_started_substate_handler_table[] = {
 	[SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_smp_request_await_response_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_smp_request_await_response_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_smp_request_await_response_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_smp_request_await_response_frame_handler,
 	},
 	[SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   =  scic_sds_smp_request_await_tc_completion_tc_completion_handler,
-		.event_handler           =  scic_sds_request_default_event_handler,
-		.frame_handler           =  scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	=  scic_sds_smp_request_await_tc_completion_tc_completion_handler,
+		.event_handler		=  scic_sds_request_default_event_handler,
+		.frame_handler		=  scic_sds_request_default_frame_handler,
 	}
 };
 
@@ -626,7 +621,7 @@ enum sci_status scic_io_request_construc
 	/* Construct the started sub-state machine. */
 	sci_base_state_machine_construct(
 		&sci_req->started_substate_machine,
-		&sci_req->parent.parent,
+		&sci_req->parent,
 		scic_sds_smp_request_started_substate_table,
 		SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
 		);
@@ -657,10 +652,8 @@ enum sci_status scic_io_request_construc
 
 	scu_smp_request_construct_task_context(sci_req, smp_req);
 
-	sci_base_state_machine_change_state(
-		&sci_req->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_CONSTRUCTED
-		);
+	sci_base_state_machine_change_state(&sci_req->state_machine,
+		SCI_BASE_REQUEST_STATE_CONSTRUCTED);
 
 	kfree(smp_req);
 
Index: linux-2.6/drivers/scsi/isci/core/scic_sds_stp_request.c
===================================================================
--- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_stp_request.c	2011-03-28 11:53:12.190837117 +0200
+++ linux-2.6/drivers/scsi/isci/core/scic_sds_stp_request.c	2011-03-28 12:16:18.761839304 +0200
@@ -465,8 +465,7 @@ static enum sci_status scic_sds_stp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine, SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -495,7 +494,7 @@ static enum sci_status scic_sds_stp_requ
 	struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request;
 
 	status = scic_sds_unsolicited_frame_control_get_header(
-		&(this_request->parent.owning_controller->uf_control),
+		&this_request->parent.owning_controller->uf_control,
 		frame_index,
 		(void **)&frame_header
 		);
@@ -504,7 +503,7 @@ static enum sci_status scic_sds_stp_requ
 		switch (frame_header->fis_type) {
 		case SATA_FIS_TYPE_REGD2H:
 			scic_sds_unsolicited_frame_control_get_buffer(
-				&(this_request->parent.owning_controller->uf_control),
+				&this_request->parent.owning_controller->uf_control,
 				frame_index,
 				(void **)&frame_buffer
 				);
@@ -536,14 +535,13 @@ static enum sci_status scic_sds_stp_requ
 		}
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.parent.state_machine,
+			&this_request->parent.state_machine,
 			SCI_BASE_REQUEST_STATE_COMPLETED
 			);
 
 		/* Frame has been decoded return it to the controller */
 		scic_sds_controller_release_frame(
-			this_request->parent.owning_controller, frame_index
-			);
+			this_request->parent.owning_controller, frame_index);
 	} else
 		dev_err(scic_to_dev(request->owning_controller),
 			"%s: SCIC IO Request 0x%p could not get frame header "
@@ -557,22 +555,22 @@ static enum sci_status scic_sds_stp_requ
 
 static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_non_data_substate_handler_table[] = {
 	[SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_non_data_await_h2d_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_non_data_await_h2d_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_stp_request_non_data_await_d2h_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_stp_request_non_data_await_d2h_frame_handler,
 	}
 };
 
@@ -625,7 +623,7 @@ enum sci_status scic_sds_stp_non_data_re
 	scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
 
 	sci_base_state_machine_construct(&sci_req->started_substate_machine,
-					 &sci_req->parent.parent,
+					 &sci_req->parent,
 					 scic_sds_stp_request_started_non_data_substate_table,
 					 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE);
 
@@ -677,8 +675,7 @@ static enum sci_status scic_sds_stp_requ
 	scic = this_request->owning_controller;
 	state = scic->state_machine.current_state_id;
 	continue_io = scic_sds_controller_state_handler_table[state].continue_io;
-	return continue_io(scic, &this_request->target_device->parent,
-			   &this_request->parent);
+	return continue_io(scic, &this_request->target_device->parent, this_request);
 }
 
 /**
@@ -859,7 +856,7 @@ static enum sci_status scic_sds_stp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
+			&this_request->state_machine,
 			SCI_BASE_REQUEST_STATE_COMPLETED
 			);
 		break;
@@ -961,7 +958,7 @@ static enum sci_status scic_sds_stp_requ
 					);
 
 				sci_base_state_machine_change_state(
-					&this_request->parent.parent.state_machine,
+					&this_request->parent.state_machine,
 					SCI_BASE_REQUEST_STATE_COMPLETED
 					);
 			} else {
@@ -1056,12 +1053,12 @@ static enum sci_status scic_sds_stp_requ
 						);
 
 					sci_base_state_machine_change_state(
-						&this_request->parent.parent.state_machine,
+						&this_request->parent.state_machine,
 						SCI_BASE_REQUEST_STATE_COMPLETED
 						);
 				} else {
 					sci_base_state_machine_change_state(
-						&this_request->parent.started_substate_machine,
+						&request->started_substate_machine,
 						SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE
 						);
 				}
@@ -1083,7 +1080,7 @@ static enum sci_status scic_sds_stp_requ
 				);
 
 			sci_base_state_machine_change_state(
-				&this_request->parent.parent.state_machine,
+				&this_request->parent.state_machine,
 				SCI_BASE_REQUEST_STATE_COMPLETED
 				);
 
@@ -1160,7 +1157,7 @@ static enum sci_status scic_sds_stp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine,
+			&this_request->state_machine,
 			SCI_BASE_REQUEST_STATE_COMPLETED
 			);
 		break;
@@ -1215,40 +1212,40 @@ static enum sci_status scic_sds_stp_requ
 
 static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_pio_substate_handler_table[] = {
 	[SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_stp_request_pio_await_frame_frame_handler
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_stp_request_pio_await_frame_frame_handler
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_stp_request_pio_data_in_await_data_event_handler,
-		.frame_handler           = scic_sds_stp_request_pio_data_in_await_data_frame_handler
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_stp_request_pio_data_in_await_data_event_handler,
+		.frame_handler		= scic_sds_stp_request_pio_data_in_await_data_frame_handler
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	}
 };
 
@@ -1352,7 +1349,7 @@ enum sci_status scic_sds_stp_pio_request
 	}
 
 	sci_base_state_machine_construct(&sci_req->started_substate_machine,
-					 &sci_req->parent.parent,
+					 &sci_req->parent,
 					 scic_sds_stp_request_started_pio_substate_table,
 					 SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE);
 
@@ -1360,18 +1357,13 @@ enum sci_status scic_sds_stp_pio_request
 }
 
 static void scic_sds_stp_request_udma_complete_request(
-	struct scic_sds_request *this_request,
+	struct scic_sds_request *request,
 	u32 scu_status,
 	enum sci_status sci_status)
 {
-	scic_sds_request_set_status(
-		this_request, scu_status, sci_status
-		);
-
-	sci_base_state_machine_change_state(
-		&this_request->parent.state_machine,
-		SCI_BASE_REQUEST_STATE_COMPLETED
-		);
+	scic_sds_request_set_status(request, scu_status, sci_status);
+	sci_base_state_machine_change_state(&request->state_machine,
+		SCI_BASE_REQUEST_STATE_COMPLETED);
 }
 
 /**
@@ -1518,22 +1510,22 @@ static enum sci_status scic_sds_stp_requ
 
 static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_udma_substate_handler_table[] = {
 	[SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_udma_await_tc_completion_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_stp_request_udma_general_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_udma_await_tc_completion_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_stp_request_udma_general_frame_handler,
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_stp_request_udma_await_d2h_reg_fis_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_stp_request_udma_await_d2h_reg_fis_frame_handler,
 	},
 };
 
@@ -1590,7 +1582,7 @@ enum sci_status scic_sds_stp_udma_reques
 
 	sci_base_state_machine_construct(
 		&sci_req->started_substate_machine,
-		&sci_req->parent.parent,
+		&sci_req->parent,
 		scic_sds_stp_request_started_udma_substate_table,
 		SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
 		);
@@ -1635,8 +1627,7 @@ static enum sci_status scic_sds_stp_requ
 			);
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine, SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -1679,9 +1670,8 @@ static enum sci_status scic_sds_stp_requ
 			SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
 			);
 
-		sci_base_state_machine_change_state(
-			&this_request->parent.state_machine, SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+		sci_base_state_machine_change_state(&this_request->state_machine,
+				SCI_BASE_REQUEST_STATE_COMPLETED);
 		break;
 	}
 
@@ -1753,9 +1743,8 @@ static enum sci_status scic_sds_stp_requ
 		}
 
 		sci_base_state_machine_change_state(
-			&this_request->parent.parent.state_machine,
-			SCI_BASE_REQUEST_STATE_COMPLETED
-			);
+			&this_request->parent.state_machine,
+			SCI_BASE_REQUEST_STATE_COMPLETED);
 
 		/* Frame has been decoded return it to the controller */
 		scic_sds_controller_release_frame(
@@ -1774,31 +1763,31 @@ static enum sci_status scic_sds_stp_requ
 
 static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_soft_reset_substate_handler_table[] = {
 	[SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_request_default_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_request_default_frame_handler,
 	},
 	[SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE] = {
-		.parent.start_handler    = scic_sds_request_default_start_handler,
-		.parent.abort_handler    = scic_sds_request_started_state_abort_handler,
-		.parent.complete_handler = scic_sds_request_default_complete_handler,
-		.parent.destruct_handler = scic_sds_request_default_destruct_handler,
-		.tc_completion_handler   = scic_sds_request_default_tc_completion_handler,
-		.event_handler           = scic_sds_request_default_event_handler,
-		.frame_handler           = scic_sds_stp_request_soft_reset_await_d2h_frame_handler,
+		.start_handler		= scic_sds_request_default_start_handler,
+		.abort_handler		= scic_sds_request_started_state_abort_handler,
+		.complete_handler	= scic_sds_request_default_complete_handler,
+		.destruct_handler	= scic_sds_request_default_destruct_handler,
+		.tc_completion_handler	= scic_sds_request_default_tc_completion_handler,
+		.event_handler		= scic_sds_request_default_event_handler,
+		.frame_handler		= scic_sds_stp_request_soft_reset_await_d2h_frame_handler,
 	},
 };
 
@@ -1842,8 +1831,7 @@ static void scic_sds_stp_request_started
 	state = scic->state_machine.current_state_id;
 	continue_io = scic_sds_controller_state_handler_table[state].continue_io;
 
-	status = continue_io(scic, &this_request->target_device->parent,
-			     &this_request->parent);
+	status = continue_io(scic, &this_request->target_device->parent, this_request);
 
 	if (status == SCI_SUCCESS) {
 		SET_STATE_HANDLER(
@@ -1888,7 +1876,7 @@ enum sci_status scic_sds_stp_soft_reset_
 	scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
 
 	sci_base_state_machine_construct(&sci_req->started_substate_machine,
-					 &sci_req->parent.parent,
+					 &sci_req->parent,
 					 scic_sds_stp_request_started_soft_reset_substate_table,
 					 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE);
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] scic: remove mmio wrappers
  2011-03-28  0:07 [PATCH] scic: remove mmio wrappers Christoph Hellwig
  2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
@ 2011-03-31  1:43 ` Dan Williams
  2011-03-31  6:31   ` Christoph Hellwig
  1 sibling, 1 reply; 10+ messages in thread
From: Dan Williams @ 2011-03-31  1:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

On Sun, Mar 27, 2011 at 5:07 PM, Christoph Hellwig <hch@infradead.org> wrote:
> Remove a couple of layers around read/writel to make the driver readable.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Thanks!

Smoketests ok, applied, but without the hunk below, which gives away
the fact that this was automated to some extent.

> Index: linux-2.6/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c
> ===================================================================
> --- linux-2.6.orig/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c  2011-03-28 01:40:43.704981485 +0200
> +++ linux-2.6/drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c       2011-03-28 01:41:14.336982622 +0200
> @@ -317,8 +317,8 @@ enum sci_status scic_sds_unsolicited_fra
>  * This method returns an indication to the caller as to whether the
>  * unsolicited frame get pointer should be updated. true This value indicates
>  * the unsolicited frame get pointer should be updated (i.e. write
> - * SCU_UFQGP_WRITE). false This value indicates the get pointer should not be
> - * updated.
> + * scu_registers->sdma.unsolicited_frame_get_pointer).
> + * false This value indicates the get pointer should not be updated.
>  */

Do you mind sharing the script you used to perform this conversion?  I
have a growing collection of hacked together cleanup tools from this
effort and would like to add this one.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] scic: remove mmio wrappers
  2011-03-31  1:43 ` [PATCH] scic: remove mmio wrappers Dan Williams
@ 2011-03-31  6:31   ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2011-03-31  6:31 UTC (permalink / raw)
  To: Dan Williams
  Cc: Christoph Hellwig, dave.jiang, linux-scsi, jacek.danecki,
	ed.ciechanowski, jeffrey.d.skirvin, edmund.nadolski

On Wed, Mar 30, 2011 at 06:43:45PM -0700, Dan Williams wrote:
> Smoketests ok, applied, but without the hunk below, which gives away
> the fact that this was automated to some extent.

This wasn't automated, but I don't think leaving stale references to
macros that have been removed is a good idea.  Which btw is something
that can be seen a lot in the current codebase - there's tons of
comments referring to non-existing types.  But most of these are rather
pointless boilerplates explaining the signatures operation vectors the 
Nth time.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] isci: remove base_controller abstraction
  2011-03-28 13:21   ` [PATCH 1/2] isci: remove base_controller abstraction Christoph Hellwig
@ 2011-03-31 21:21     ` Dan Williams
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Williams @ 2011-03-31 21:21 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

On Mon, Mar 28, 2011 at 6:21 AM, Christoph Hellwig <hch@infradead.org> wrote:
> Merge struct sci_base_controller into scic_sds_controller, and also factor
> the two types of state machine handlers into one function.  While we're at
> it also remove lots of duplicate incorrect kerneldoc comments for the state
> machine handlers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Conversion looks correct to me and smoketests fine, applied.

> + * XXX: How does the io_tag parameter get assigned to the io request?

This is an area where I think we can make some further
simplifications.  Currently the core supports a concept of
lldd-assigned and core-assigned io tags (the latter is currently being
used and is set at scic_sds_request_constructed_state_start_handler
time).  The Linux driver will never have use for more than one
assignment mode and to me it is awkward to have separate
hw-task-context (tci pool index) and lldd-request-object
(dma_pool_alloc) allocation domains.  One allocation can handle the
request object, tci, and tag allocation.  So this looks like:

1/ Convert to mvsas style pre-allocation of request objects so a
single number space handles available requests, task contexts, and
tags.  Since libsas drivers do not queue we will never be in a
situation of needing to oversubscribe requests to hw-task-contexts.
Although I have found that the sci_pool interface is faster than a
bitmap by a wide margin for randomly arriving completions.  It does
tradeoff space and simple detection of double-free conditions.  If
acceptable that probably wants to be a generic kernel facility unless
there is an existing ring-buffer method for tracking unique numbers?

2/ Reuse the request object allocation index as the tag/tci and move
sequence number management to the request allocation routine.

Essentially this is the next level of detail on the
isci_request/scic_sds_request unification.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] isci: remove base_request abstraction
  2011-03-28 13:21   ` [PATCH 2/2] isci: remove base_request abstraction Christoph Hellwig
@ 2011-03-31 22:14     ` Dan Williams
  2011-04-01 13:11       ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Williams @ 2011-03-31 22:14 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

On Mon, Mar 28, 2011 at 6:21 AM, Christoph Hellwig <hch@infradead.org> wrote:
> Merge struct sci_base_request into scic_sds_request, and also factor the two
> types of state machine handlers into one function.  While we're at it also
> remove lots of duplicate incorrect kerneldoc comments for the state machine
> handlers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>

Applied, thanks.

We'll want to do a tree-wide s/sci_base_/sci_/, but maybe not until we
settle on the final unified object names... put it off for now.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, RFC 0/2] scic: remove pointless stuctures
  2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
  2011-03-28 13:21   ` [PATCH 1/2] isci: remove base_controller abstraction Christoph Hellwig
  2011-03-28 13:21   ` [PATCH 2/2] isci: remove base_request abstraction Christoph Hellwig
@ 2011-03-31 22:24   ` Dan Williams
  2 siblings, 0 replies; 10+ messages in thread
From: Dan Williams @ 2011-03-31 22:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: dave.jiang, linux-scsi, jacek.danecki, ed.ciechanowski,
	jeffrey.d.skirvin, edmund.nadolski

On Mon, Mar 28, 2011 at 6:20 AM, Christoph Hellwig <hch@infradead.org> wrote:
> Start killing off the pointless sci_base* structures which do nothing
> but causing a lot of unreadable code by converting forth and back
> between them and the real structures.
>
> I've done the sci_base_controller, and sci_base_request on a rainy
> sunday afternoon, but the port, phy and remote device also need the
> same treatment.  And after that the sci_base_object crap needs to
> go in favour of just using container_of or properly typed pointers.
>
> But I'll rather leave that to you Intel guys, spending more time
> on this codebase won't be good for my mental health.

Understood, but it's not everyday you get to submit patches that
consistently have a 2x deletions/insertions ratio.  In fact that has
been my rule of thumb for this driver for a while, any cleanup patch
that falls short of that ratio is probably too narrow of a cleanup.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] isci: remove base_request abstraction
  2011-03-31 22:14     ` Dan Williams
@ 2011-04-01 13:11       ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2011-04-01 13:11 UTC (permalink / raw)
  To: Dan Williams
  Cc: Christoph Hellwig, dave.jiang, linux-scsi, jacek.danecki,
	ed.ciechanowski, jeffrey.d.skirvin, edmund.nadolski

On Thu, Mar 31, 2011 at 03:14:14PM -0700, Dan Williams wrote:
> We'll want to do a tree-wide s/sci_base_/sci_/, but maybe not until we
> settle on the final unified object names... put it off for now.

I don't think much of the sci_base names will be left, basically just
the core state machine helpers.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-01 13:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28  0:07 [PATCH] scic: remove mmio wrappers Christoph Hellwig
2011-03-28 13:20 ` [PATCH, RFC 0/2] scic: remove pointless stuctures Christoph Hellwig
2011-03-28 13:21   ` [PATCH 1/2] isci: remove base_controller abstraction Christoph Hellwig
2011-03-31 21:21     ` Dan Williams
2011-03-28 13:21   ` [PATCH 2/2] isci: remove base_request abstraction Christoph Hellwig
2011-03-31 22:14     ` Dan Williams
2011-04-01 13:11       ` Christoph Hellwig
2011-03-31 22:24   ` [PATCH, RFC 0/2] scic: remove pointless stuctures Dan Williams
2011-03-31  1:43 ` [PATCH] scic: remove mmio wrappers Dan Williams
2011-03-31  6:31   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).