All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	"Juergen E. Fischer" <fischer@norbit.de>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH 12/44] aha152x: Move the SCSI pointer to private command data
Date: Fri, 28 Jan 2022 14:18:37 -0800	[thread overview]
Message-ID: <20220128221909.8141-13-bvanassche@acm.org> (raw)
In-Reply-To: <20220128221909.8141-1-bvanassche@acm.org>

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aha152x.c | 259 ++++++++++++++++++++++++-----------------
 1 file changed, 155 insertions(+), 104 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 901b78e8ffe6..b2f716120fba 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -316,6 +316,17 @@ enum {
 	check_condition = 0x0800,	/* requesting sense after CHECK CONDITION */
 };
 
+struct aha152x_cmd_priv {
+	struct scsi_pointer scsi_pointer;
+};
+
+static struct scsi_pointer *aha152x_scsi_pointer(struct scsi_cmnd *cmd)
+{
+	struct aha152x_cmd_priv *acmd = scsi_cmd_priv(cmd);
+
+	return &acmd->scsi_pointer;
+}
+
 MODULE_AUTHOR("Jürgen Fischer");
 MODULE_DESCRIPTION(AHA152X_REVID);
 MODULE_LICENSE("GPL");
@@ -879,14 +890,17 @@ void aha152x_release(struct Scsi_Host *shpnt)
 static int setup_expected_interrupts(struct Scsi_Host *shpnt)
 {
 	if(CURRENT_SC) {
-		CURRENT_SC->SCp.phase |= 1 << 16;
+		struct scsi_pointer *scsi_pointer =
+			aha152x_scsi_pointer(CURRENT_SC);
 
-		if(CURRENT_SC->SCp.phase & selecting) {
+		scsi_pointer->phase |= 1 << 16;
+
+		if (scsi_pointer->phase & selecting) {
 			SETPORT(SSTAT1, SELTO);
 			SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
 			SETPORT(SIMODE1, ENSELTIMO);
 		} else {
-			SETPORT(SIMODE0, (CURRENT_SC->SCp.phase & spiordy) ? ENSPIORDY : 0);
+			SETPORT(SIMODE0, (scsi_pointer->phase & spiordy) ? ENSPIORDY : 0);
 			SETPORT(SIMODE1, ENPHASEMIS | ENSCSIRST | ENSCSIPERR | ENBUSFREE);
 		}
 	} else if(STATE==seldi) {
@@ -910,16 +924,17 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)
 static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
 				  struct completion *complete, int phase)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(SCpnt);
 	struct Scsi_Host *shpnt = SCpnt->device->host;
 	unsigned long flags;
 
-	SCpnt->SCp.phase	= not_issued | phase;
-	SCpnt->SCp.Status	= 0x1; /* Ilegal status by SCSI standard */
-	SCpnt->SCp.Message	= 0;
-	SCpnt->SCp.have_data_in	= 0;
-	SCpnt->SCp.sent_command	= 0;
+	scsi_pointer->phase	   = not_issued | phase;
+	scsi_pointer->Status	   = 0x1; /* Ilegal status by SCSI standard */
+	scsi_pointer->Message	   = 0;
+	scsi_pointer->have_data_in = 0;
+	scsi_pointer->sent_command = 0;
 
-	if(SCpnt->SCp.phase & (resetting|check_condition)) {
+	if (scsi_pointer->phase & (resetting | check_condition)) {
 		if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
 			scmd_printk(KERN_ERR, SCpnt, "cannot reuse command\n");
 			return FAILED;
@@ -942,15 +957,15 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
 	   SCp.phase            : current state of the command */
 
 	if ((phase & resetting) || !scsi_sglist(SCpnt)) {
-		SCpnt->SCp.ptr           = NULL;
-		SCpnt->SCp.this_residual = 0;
+		scsi_pointer->ptr           = NULL;
+		scsi_pointer->this_residual = 0;
 		scsi_set_resid(SCpnt, 0);
-		SCpnt->SCp.buffer           = NULL;
+		scsi_pointer->buffer        = NULL;
 	} else {
 		scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
-		SCpnt->SCp.buffer           = scsi_sglist(SCpnt);
-		SCpnt->SCp.ptr              = SG_ADDRESS(SCpnt->SCp.buffer);
-		SCpnt->SCp.this_residual    = SCpnt->SCp.buffer->length;
+		scsi_pointer->buffer        = scsi_sglist(SCpnt);
+		scsi_pointer->ptr           = SG_ADDRESS(scsi_pointer->buffer);
+		scsi_pointer->this_residual = scsi_pointer->buffer->length;
 	}
 
 	DO_LOCK(flags);
@@ -1000,7 +1015,7 @@ static void reset_done(struct scsi_cmnd *SCpnt)
 
 static void aha152x_scsi_done(struct scsi_cmnd *SCpnt)
 {
-	if (SCpnt->SCp.phase & resetting)
+	if (aha152x_scsi_pointer(SCpnt)->phase & resetting)
 		reset_done(SCpnt);
 	else
 		scsi_done(SCpnt);
@@ -1086,7 +1101,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt)
 
 	DO_LOCK(flags);
 
-	if(SCpnt->SCp.phase & resetted) {
+	if (aha152x_scsi_pointer(SCpnt)->phase & resetted) {
 		HOSTDATA(shpnt)->commands--;
 		if (!HOSTDATA(shpnt)->commands)
 			SETPORT(PORTA, 0);
@@ -1380,28 +1395,31 @@ static void busfree_run(struct Scsi_Host *shpnt)
 	SETPORT(SSTAT1, CLRBUSFREE);
 
 	if(CURRENT_SC) {
+		struct scsi_pointer *scsi_pointer =
+			aha152x_scsi_pointer(CURRENT_SC);
+
 #if defined(AHA152X_STAT)
 		action++;
 #endif
-		CURRENT_SC->SCp.phase &= ~syncneg;
+		scsi_pointer->phase &= ~syncneg;
 
-		if(CURRENT_SC->SCp.phase & completed) {
+		if (scsi_pointer->phase & completed) {
 			/* target sent COMMAND COMPLETE */
-			done(shpnt, CURRENT_SC->SCp.Status, DID_OK);
+			done(shpnt, scsi_pointer->Status, DID_OK);
 
-		} else if(CURRENT_SC->SCp.phase & aborted) {
-			done(shpnt, CURRENT_SC->SCp.Status, DID_ABORT);
+		} else if (scsi_pointer->phase & aborted) {
+			done(shpnt, scsi_pointer->Status, DID_ABORT);
 
-		} else if(CURRENT_SC->SCp.phase & resetted) {
-			done(shpnt, CURRENT_SC->SCp.Status, DID_RESET);
+		} else if (scsi_pointer->phase & resetted) {
+			done(shpnt, scsi_pointer->Status, DID_RESET);
 
-		} else if(CURRENT_SC->SCp.phase & disconnected) {
+		} else if (scsi_pointer->phase & disconnected) {
 			/* target sent DISCONNECT */
 #if defined(AHA152X_STAT)
 			HOSTDATA(shpnt)->disconnections++;
 #endif
 			append_SC(&DISCONNECTED_SC, CURRENT_SC);
-			CURRENT_SC->SCp.phase |= 1 << 16;
+			scsi_pointer->phase |= 1 << 16;
 			CURRENT_SC = NULL;
 
 		} else {
@@ -1420,23 +1438,24 @@ static void busfree_run(struct Scsi_Host *shpnt)
 		action++;
 #endif
 
-		if(DONE_SC->SCp.phase & check_condition) {
+		if (aha152x_scsi_pointer(DONE_SC)->phase & check_condition) {
 			struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC;
 			struct aha152x_scdata *sc = SCDATA(cmd);
 
 			scsi_eh_restore_cmnd(cmd, &sc->ses);
 
-			cmd->SCp.Status = SAM_STAT_CHECK_CONDITION;
+			aha152x_scsi_pointer(cmd)->Status = SAM_STAT_CHECK_CONDITION;
 
 			HOSTDATA(shpnt)->commands--;
 			if (!HOSTDATA(shpnt)->commands)
 				SETPORT(PORTA, 0);	/* turn led off */
-		} else if(DONE_SC->SCp.Status==SAM_STAT_CHECK_CONDITION) {
+		} else if (aha152x_scsi_pointer(DONE_SC)->Status ==
+			   SAM_STAT_CHECK_CONDITION) {
 #if defined(AHA152X_STAT)
 			HOSTDATA(shpnt)->busfree_with_check_condition++;
 #endif
 
-			if(!(DONE_SC->SCp.phase & not_issued)) {
+			if(!(aha152x_scsi_pointer(DONE_SC)->phase & not_issued)) {
 				struct aha152x_scdata *sc;
 				struct scsi_cmnd *ptr = DONE_SC;
 				DONE_SC=NULL;
@@ -1461,7 +1480,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 			if (!HOSTDATA(shpnt)->commands)
 				SETPORT(PORTA, 0);	/* turn led off */
 
-			if (!(ptr->SCp.phase & resetting)) {
+			if (!(aha152x_scsi_pointer(ptr)->phase & resetting)) {
 				kfree(ptr->host_scribble);
 				ptr->host_scribble=NULL;
 			}
@@ -1484,10 +1503,13 @@ static void busfree_run(struct Scsi_Host *shpnt)
 	DO_UNLOCK(flags);
 
 	if(CURRENT_SC) {
+		struct scsi_pointer *scsi_pointer =
+			aha152x_scsi_pointer(CURRENT_SC);
+
 #if defined(AHA152X_STAT)
 		action++;
 #endif
-		CURRENT_SC->SCp.phase |= selecting;
+		scsi_pointer->phase |= selecting;
 
 		/* clear selection timeout */
 		SETPORT(SSTAT1, SELTO);
@@ -1515,11 +1537,13 @@ static void busfree_run(struct Scsi_Host *shpnt)
  */
 static void seldo_run(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+
 	SETPORT(SCSISIG, 0);
 	SETPORT(SSTAT1, CLRBUSFREE);
 	SETPORT(SSTAT1, CLRPHASECHG);
 
-	CURRENT_SC->SCp.phase &= ~(selecting|not_issued);
+	scsi_pointer->phase &= ~(selecting | not_issued);
 
 	SETPORT(SCSISEQ, 0);
 
@@ -1534,12 +1558,12 @@ static void seldo_run(struct Scsi_Host *shpnt)
 
 	ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
 
-	if (CURRENT_SC->SCp.phase & aborting) {
+	if (scsi_pointer->phase & aborting) {
 		ADDMSGO(ABORT);
-	} else if (CURRENT_SC->SCp.phase & resetting) {
+	} else if (scsi_pointer->phase & resetting) {
 		ADDMSGO(BUS_DEVICE_RESET);
 	} else if (SYNCNEG==0 && SYNCHRONOUS) {
-		CURRENT_SC->SCp.phase |= syncneg;
+		scsi_pointer->phase |= syncneg;
 		MSGOLEN += spi_populate_sync_msg(&MSGO(MSGOLEN), 50, 8);
 		SYNCNEG=1;		/* negotiation in progress */
 	}
@@ -1554,15 +1578,17 @@ static void seldo_run(struct Scsi_Host *shpnt)
  */
 static void selto_run(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+
 	SETPORT(SCSISEQ, 0);
 	SETPORT(SSTAT1, CLRSELTIMO);
 
 	if (!CURRENT_SC)
 		return;
 
-	CURRENT_SC->SCp.phase &= ~selecting;
+	scsi_pointer->phase &= ~selecting;
 
-	if (CURRENT_SC->SCp.phase & aborted)
+	if (scsi_pointer->phase & aborted)
 		done(shpnt, SAM_STAT_GOOD, DID_ABORT);
 	else if (TESTLO(SSTAT0, SELINGO))
 		done(shpnt, SAM_STAT_GOOD, DID_BUS_BUSY);
@@ -1590,7 +1616,10 @@ static void seldi_run(struct Scsi_Host *shpnt)
 	SETPORT(SSTAT1, CLRPHASECHG);
 
 	if(CURRENT_SC) {
-		if(!(CURRENT_SC->SCp.phase & not_issued))
+		struct scsi_pointer *scsi_pointer =
+			aha152x_scsi_pointer(CURRENT_SC);
+
+		if (!(scsi_pointer->phase & not_issued))
 			scmd_printk(KERN_ERR, CURRENT_SC,
 				    "command should not have been issued yet\n");
 
@@ -1647,6 +1676,7 @@ static void seldi_run(struct Scsi_Host *shpnt)
 static void msgi_run(struct Scsi_Host *shpnt)
 {
 	for(;;) {
+		struct scsi_pointer *scsi_pointer;
 		int sstat1 = GETPORT(SSTAT1);
 
 		if(sstat1 & (PHASECHG|PHASEMIS|BUSFREE) || !(sstat1 & REQINIT))
@@ -1684,8 +1714,9 @@ static void msgi_run(struct Scsi_Host *shpnt)
 				continue;
 			}
 
-			CURRENT_SC->SCp.Message = MSGI(0);
-			CURRENT_SC->SCp.phase &= ~disconnected;
+			scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+			scsi_pointer->Message = MSGI(0);
+			scsi_pointer->phase &= ~disconnected;
 
 			MSGILEN=0;
 
@@ -1693,7 +1724,8 @@ static void msgi_run(struct Scsi_Host *shpnt)
 			continue;
 		}
 
-		CURRENT_SC->SCp.Message = MSGI(0);
+		scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+		scsi_pointer->Message = MSGI(0);
 
 		switch (MSGI(0)) {
 		case DISCONNECT:
@@ -1701,11 +1733,11 @@ static void msgi_run(struct Scsi_Host *shpnt)
 				scmd_printk(KERN_WARNING, CURRENT_SC,
 					    "target was not allowed to disconnect\n");
 
-			CURRENT_SC->SCp.phase |= disconnected;
+			scsi_pointer->phase |= disconnected;
 			break;
 
 		case COMMAND_COMPLETE:
-			CURRENT_SC->SCp.phase |= completed;
+			scsi_pointer->phase |= completed;
 			break;
 
 		case MESSAGE_REJECT:
@@ -1835,8 +1867,11 @@ static void msgi_end(struct Scsi_Host *shpnt)
  */
 static void msgo_init(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+
 	if(MSGOLEN==0) {
-		if((CURRENT_SC->SCp.phase & syncneg) && SYNCNEG==2 && SYNCRATE==0) {
+		if ((scsi_pointer->phase & syncneg) && SYNCNEG==2 &&
+		    SYNCRATE==0) {
 			ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
 		} else {
 			scmd_printk(KERN_INFO, CURRENT_SC,
@@ -1853,6 +1888,8 @@ static void msgo_init(struct Scsi_Host *shpnt)
  */
 static void msgo_run(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+
 	while(MSGO_I<MSGOLEN) {
 		if (TESTLO(SSTAT0, SPIORDY))
 			return;
@@ -1864,13 +1901,13 @@ static void msgo_run(struct Scsi_Host *shpnt)
 
 
 		if (MSGO(MSGO_I) & IDENTIFY_BASE)
-			CURRENT_SC->SCp.phase |= identified;
+			scsi_pointer->phase |= identified;
 
 		if (MSGO(MSGO_I)==ABORT)
-			CURRENT_SC->SCp.phase |= aborted;
+			scsi_pointer->phase |= aborted;
 
 		if (MSGO(MSGO_I)==BUS_DEVICE_RESET)
-			CURRENT_SC->SCp.phase |= resetted;
+			scsi_pointer->phase |= resetted;
 
 		SETPORT(SCSIDAT, MSGO(MSGO_I++));
 	}
@@ -1899,7 +1936,7 @@ static void msgo_end(struct Scsi_Host *shpnt)
  */
 static void cmd_init(struct Scsi_Host *shpnt)
 {
-	if (CURRENT_SC->SCp.sent_command) {
+	if (aha152x_scsi_pointer(CURRENT_SC)->sent_command) {
 		scmd_printk(KERN_ERR, CURRENT_SC,
 			    "command already sent\n");
 		done(shpnt, SAM_STAT_GOOD, DID_ERROR);
@@ -1930,7 +1967,7 @@ static void cmd_end(struct Scsi_Host *shpnt)
 			    "command sent incompletely (%d/%d)\n",
 			    CMD_I, CURRENT_SC->cmd_len);
 	else
-		CURRENT_SC->SCp.sent_command++;
+		aha152x_scsi_pointer(CURRENT_SC)->sent_command++;
 }
 
 /*
@@ -1942,7 +1979,7 @@ static void status_run(struct Scsi_Host *shpnt)
 	if (TESTLO(SSTAT0, SPIORDY))
 		return;
 
-	CURRENT_SC->SCp.Status = GETPORT(SCSIDAT);
+	aha152x_scsi_pointer(CURRENT_SC)->Status = GETPORT(SCSIDAT);
 
 }
 
@@ -1966,6 +2003,7 @@ static void datai_init(struct Scsi_Host *shpnt)
 
 static void datai_run(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer;
 	unsigned long the_time;
 	int fifodata, data_count;
 
@@ -2003,35 +2041,36 @@ static void datai_run(struct Scsi_Host *shpnt)
 			fifodata = GETPORT(FIFOSTAT);
 		}
 
-		if(CURRENT_SC->SCp.this_residual>0) {
-			while(fifodata>0 && CURRENT_SC->SCp.this_residual>0) {
-				data_count = fifodata > CURRENT_SC->SCp.this_residual ?
-						CURRENT_SC->SCp.this_residual :
+		scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+		if (scsi_pointer->this_residual>0) {
+			while(fifodata>0 && scsi_pointer->this_residual>0) {
+				data_count = fifodata > scsi_pointer->this_residual ?
+						scsi_pointer->this_residual :
 						fifodata;
 				fifodata -= data_count;
 
 				if (data_count & 1) {
 					SETPORT(DMACNTRL0, ENDMA|_8BIT);
-					*CURRENT_SC->SCp.ptr++ = GETPORT(DATAPORT);
-					CURRENT_SC->SCp.this_residual--;
+					*scsi_pointer->ptr++ = GETPORT(DATAPORT);
+					scsi_pointer->this_residual--;
 					DATA_LEN++;
 					SETPORT(DMACNTRL0, ENDMA);
 				}
 
 				if (data_count > 1) {
 					data_count >>= 1;
-					insw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
-					CURRENT_SC->SCp.ptr += 2 * data_count;
-					CURRENT_SC->SCp.this_residual -= 2 * data_count;
+					insw(DATAPORT, scsi_pointer->ptr, data_count);
+					scsi_pointer->ptr += 2 * data_count;
+					scsi_pointer->this_residual -= 2 * data_count;
 					DATA_LEN += 2 * data_count;
 				}
 
-				if (CURRENT_SC->SCp.this_residual == 0 &&
-				    !sg_is_last(CURRENT_SC->SCp.buffer)) {
+				if (scsi_pointer->this_residual == 0 &&
+				    !sg_is_last(scsi_pointer->buffer)) {
 					/* advance to next buffer */
-					CURRENT_SC->SCp.buffer = sg_next(CURRENT_SC->SCp.buffer);
-					CURRENT_SC->SCp.ptr           = SG_ADDRESS(CURRENT_SC->SCp.buffer);
-					CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
+					scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
+					scsi_pointer->ptr           = SG_ADDRESS(scsi_pointer->buffer);
+					scsi_pointer->this_residual = scsi_pointer->buffer->length;
 				}
 			}
 		} else if (fifodata > 0) {
@@ -2099,14 +2138,15 @@ static void datao_init(struct Scsi_Host *shpnt)
 
 static void datao_run(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
 	unsigned long the_time;
 	int data_count;
 
 	/* until phase changes or all data sent */
-	while(TESTLO(DMASTAT, INTSTAT) && CURRENT_SC->SCp.this_residual>0) {
+	while (TESTLO(DMASTAT, INTSTAT) && scsi_pointer->this_residual > 0) {
 		data_count = 128;
-		if(data_count > CURRENT_SC->SCp.this_residual)
-			data_count=CURRENT_SC->SCp.this_residual;
+		if (data_count > scsi_pointer->this_residual)
+			data_count = scsi_pointer->this_residual;
 
 		if(TESTLO(DMASTAT, DFIFOEMP)) {
 			scmd_printk(KERN_ERR, CURRENT_SC,
@@ -2117,26 +2157,26 @@ static void datao_run(struct Scsi_Host *shpnt)
 
 		if(data_count & 1) {
 			SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT);
-			SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++);
-			CURRENT_SC->SCp.this_residual--;
+			SETPORT(DATAPORT, *scsi_pointer->ptr++);
+			scsi_pointer->this_residual--;
 			CMD_INC_RESID(CURRENT_SC, -1);
 			SETPORT(DMACNTRL0,WRITE_READ|ENDMA);
 		}
 
 		if(data_count > 1) {
 			data_count >>= 1;
-			outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
-			CURRENT_SC->SCp.ptr           += 2 * data_count;
-			CURRENT_SC->SCp.this_residual -= 2 * data_count;
+			outsw(DATAPORT, scsi_pointer->ptr, data_count);
+			scsi_pointer->ptr           += 2 * data_count;
+			scsi_pointer->this_residual -= 2 * data_count;
 			CMD_INC_RESID(CURRENT_SC, -2 * data_count);
 		}
 
-		if (CURRENT_SC->SCp.this_residual == 0 &&
-		    !sg_is_last(CURRENT_SC->SCp.buffer)) {
+		if (scsi_pointer->this_residual == 0 &&
+		    !sg_is_last(scsi_pointer->buffer)) {
 			/* advance to next buffer */
-			CURRENT_SC->SCp.buffer = sg_next(CURRENT_SC->SCp.buffer);
-			CURRENT_SC->SCp.ptr           = SG_ADDRESS(CURRENT_SC->SCp.buffer);
-			CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
+			scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
+			scsi_pointer->ptr           = SG_ADDRESS(scsi_pointer->buffer);
+			scsi_pointer->this_residual = scsi_pointer->buffer->length;
 		}
 
 		the_time=jiffies + 100*HZ;
@@ -2152,6 +2192,8 @@ static void datao_run(struct Scsi_Host *shpnt)
 
 static void datao_end(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
+
 	if(TESTLO(DMASTAT, DFIFOEMP)) {
 		u32 datao_cnt = GETSTCNT();
 		int datao_out = DATA_LEN - scsi_get_resid(CURRENT_SC);
@@ -2169,9 +2211,9 @@ static void datao_end(struct Scsi_Host *shpnt)
 			sg = sg_next(sg);
 		}
 
-		CURRENT_SC->SCp.buffer = sg;
-		CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) + done;
-		CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length -
+		scsi_pointer->buffer = sg;
+		scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer) + done;
+		scsi_pointer->this_residual = scsi_pointer->buffer->length -
 			done;
 	}
 
@@ -2187,6 +2229,7 @@ static void datao_end(struct Scsi_Host *shpnt)
  */
 static int update_state(struct Scsi_Host *shpnt)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC);
 	int dataphase=0;
 	unsigned int stat0 = GETPORT(SSTAT0);
 	unsigned int stat1 = GETPORT(SSTAT1);
@@ -2200,7 +2243,8 @@ static int update_state(struct Scsi_Host *shpnt)
 		SETPORT(SSTAT1,SCSIRSTI);
 	} else if (stat0 & SELDI && PREVSTATE == busfree) {
 		STATE=seldi;
-	} else if(stat0 & SELDO && CURRENT_SC && (CURRENT_SC->SCp.phase & selecting)) {
+	} else if (stat0 & SELDO && CURRENT_SC &&
+		   (scsi_pointer->phase & selecting)) {
 		STATE=seldo;
 	} else if(stat1 & SELTO) {
 		STATE=selto;
@@ -2332,7 +2376,8 @@ static void is_complete(struct Scsi_Host *shpnt)
 			SETPORT(SXFRCTL0, CH1);
 			SETPORT(DMACNTRL0, 0);
 			if(CURRENT_SC)
-				CURRENT_SC->SCp.phase &= ~spiordy;
+				aha152x_scsi_pointer(CURRENT_SC)->phase &=
+					~spiordy;
 		}
 
 		/*
@@ -2354,7 +2399,8 @@ static void is_complete(struct Scsi_Host *shpnt)
 			SETPORT(DMACNTRL0, 0);
 			SETPORT(SXFRCTL0, CH1|SPIOEN);
 			if(CURRENT_SC)
-				CURRENT_SC->SCp.phase |= spiordy;
+				aha152x_scsi_pointer(CURRENT_SC)->phase |=
+					spiordy;
 		}
 
 		/*
@@ -2444,21 +2490,23 @@ static void disp_enintr(struct Scsi_Host *shpnt)
  */
 static void show_command(struct scsi_cmnd *ptr)
 {
+	const int phase = aha152x_scsi_pointer(ptr)->phase;
+
 	scsi_print_command(ptr);
 	scmd_printk(KERN_DEBUG, ptr,
 		    "request_bufflen=%d; resid=%d; "
 		    "phase |%s%s%s%s%s%s%s%s%s; next=0x%p",
 		    scsi_bufflen(ptr), scsi_get_resid(ptr),
-		    (ptr->SCp.phase & not_issued) ? "not issued|" : "",
-		    (ptr->SCp.phase & selecting) ? "selecting|" : "",
-		    (ptr->SCp.phase & identified) ? "identified|" : "",
-		    (ptr->SCp.phase & disconnected) ? "disconnected|" : "",
-		    (ptr->SCp.phase & completed) ? "completed|" : "",
-		    (ptr->SCp.phase & spiordy) ? "spiordy|" : "",
-		    (ptr->SCp.phase & syncneg) ? "syncneg|" : "",
-		    (ptr->SCp.phase & aborted) ? "aborted|" : "",
-		    (ptr->SCp.phase & resetted) ? "resetted|" : "",
-		    (SCDATA(ptr)) ? SCNEXT(ptr) : NULL);
+		    phase & not_issued ? "not issued|" : "",
+		    phase & selecting ? "selecting|" : "",
+		    phase & identified ? "identified|" : "",
+		    phase & disconnected ? "disconnected|" : "",
+		    phase & completed ? "completed|" : "",
+		    phase & spiordy ? "spiordy|" : "",
+		    phase & syncneg ? "syncneg|" : "",
+		    phase & aborted ? "aborted|" : "",
+		    phase & resetted ? "resetted|" : "",
+		    SCDATA(ptr) ? SCNEXT(ptr) : NULL);
 }
 
 /*
@@ -2490,6 +2538,8 @@ static void show_queues(struct Scsi_Host *shpnt)
 
 static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)
 {
+	struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(ptr);
+	const int phase = scsi_pointer->phase;
 	int i;
 
 	seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
@@ -2499,24 +2549,24 @@ static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)
 		seq_printf(m, "0x%02x ", ptr->cmnd[i]);
 
 	seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |",
-		scsi_get_resid(ptr), ptr->SCp.this_residual,
-		sg_nents(ptr->SCp.buffer) - 1);
+		scsi_get_resid(ptr), scsi_pointer->this_residual,
+		sg_nents(scsi_pointer->buffer) - 1);
 
-	if (ptr->SCp.phase & not_issued)
+	if (phase & not_issued)
 		seq_puts(m, "not issued|");
-	if (ptr->SCp.phase & selecting)
+	if (phase & selecting)
 		seq_puts(m, "selecting|");
-	if (ptr->SCp.phase & disconnected)
+	if (phase & disconnected)
 		seq_puts(m, "disconnected|");
-	if (ptr->SCp.phase & aborted)
+	if (phase & aborted)
 		seq_puts(m, "aborted|");
-	if (ptr->SCp.phase & identified)
+	if (phase & identified)
 		seq_puts(m, "identified|");
-	if (ptr->SCp.phase & completed)
+	if (phase & completed)
 		seq_puts(m, "completed|");
-	if (ptr->SCp.phase & spiordy)
+	if (phase & spiordy)
 		seq_puts(m, "spiordy|");
-	if (ptr->SCp.phase & syncneg)
+	if (phase & syncneg)
 		seq_puts(m, "syncneg|");
 	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
 }
@@ -2921,6 +2971,7 @@ static struct scsi_host_template aha152x_driver_template = {
 	.sg_tablesize			= SG_ALL,
 	.dma_boundary			= PAGE_SIZE - 1,
 	.slave_alloc			= aha152x_adjust_queue,
+	.cmd_size			= sizeof(struct aha152x_cmd_priv),
 };
 
 #if !defined(AHA152X_PCMCIA)

  parent reply	other threads:[~2022-01-28 22:21 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 22:18 [PATCH 00/44] Remove the SCSI pointer from struct scsi_cmnd Bart Van Assche
2022-01-28 22:18 ` [PATCH 01/44] ips: Use true and false instead of TRUE and FALSE Bart Van Assche
2022-01-31  9:53   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 02/44] nsp_cs: " Bart Van Assche
2022-01-31  9:55   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 03/44] scsi: Remove drivers/scsi/scsi.h Bart Van Assche
2022-01-31 12:53   ` Greg Kroah-Hartman
2022-01-28 22:18 ` [PATCH 04/44] NCR5380: Remove the NCR5380_CMD_SIZE macro Bart Van Assche
2022-01-31  9:58   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 05/44] NCR5380: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 10:04   ` Johannes Thumshirn
2022-01-31 22:39   ` Finn Thain
2022-01-31 23:36     ` Bart Van Assche
2022-02-01  0:11       ` Finn Thain
2022-01-28 22:18 ` [PATCH 06/44] scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h Bart Van Assche
2022-01-31 10:09   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 07/44] scsi: arm: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:18 ` [PATCH 08/44] 53c700: Stop clearing SCSI pointer fields Bart Van Assche
2022-01-31 10:15   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 09/44] aacraid: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:18 ` [PATCH 10/44] advansys: " Bart Van Assche
2022-01-31 10:23   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 11/44] aha1542: Remove a set-but-not-used array Bart Van Assche
2022-01-31 10:25   ` Johannes Thumshirn
2022-01-31 17:13     ` Bart Van Assche
2022-01-28 22:18 ` Bart Van Assche [this message]
2022-01-31 10:32   ` [PATCH 12/44] aha152x: Move the SCSI pointer to private command data Johannes Thumshirn
2022-01-31 17:16     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 13/44] bfa: Stop using the SCSI pointer Bart Van Assche
2022-01-31 10:39   ` Johannes Thumshirn
2022-01-31 17:19     ` Bart Van Assche
2022-02-01  9:16       ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 14/44] csio: " Bart Van Assche
2022-01-31 10:41   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 15/44] dc395x: " Bart Van Assche
2022-01-31 10:42   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 16/44] esp_scsi: " Bart Van Assche
2022-01-31 10:43   ` Johannes Thumshirn
2022-01-31 22:46   ` Finn Thain
2022-02-01 21:20     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 17/44] fdomain: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 10:44   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 18/44] fnic: Fix a tracing statement Bart Van Assche
2022-01-28 22:18 ` [PATCH 19/44] fnic: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:01   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 20/44] hptiop: " Bart Van Assche
2022-01-31 11:03   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 21/44] imm: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:17   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 22/44] iscsi: Stop using the SCSI pointer Bart Van Assche
2022-01-28 22:18 ` [PATCH 23/44] initio: " Bart Van Assche
2022-01-31 11:19   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 24/44] libfc: " Bart Van Assche
2022-01-28 22:18 ` [PATCH 25/44] mac53c94: Fix a set-but-not-used compiler warning Bart Van Assche
2022-01-31 11:21   ` Johannes Thumshirn
2022-01-31 17:22     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 26/44] mac53c94: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:22   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 27/44] megaraid: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:27   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 28/44] megasas: " Bart Van Assche
2022-01-31 11:28   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 29/44] mesh: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:31   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 30/44] mvsas: Fix a set-but-not-used warning Bart Van Assche
2022-01-31 11:33   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 31/44] mvumi: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:34   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 32/44] nsp32: " Bart Van Assche
2022-01-31  2:53   ` Masanori Goto
2022-01-31 17:28     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 33/44] nsp_cs: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:18 ` [PATCH 34/44] sym53c500_cs: " Bart Van Assche
2022-01-31 11:37   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 35/44] ppa: " Bart Van Assche
2022-01-31 11:38   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 36/44] qla1280: " Bart Van Assche
2022-01-31 11:39   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 37/44] qla2xxx: Stop using the SCSI pointer Bart Van Assche
2022-01-28 22:19 ` [PATCH 38/44] smartpqi: " Bart Van Assche
2022-01-31 11:41   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 39/44] sym53c8xx_2: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:42   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 40/44] scsi: usb: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:43   ` Johannes Thumshirn
2022-01-31 12:53   ` Greg Kroah-Hartman
2022-02-02  8:14   ` Oliver Neukum
2022-01-28 22:19 ` [PATCH 41/44] wd719x: " Bart Van Assche
2022-01-31 11:44   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 42/44] wdc33c93: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:19 ` [PATCH 43/44] zalon: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:46   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd Bart Van Assche
2022-01-31 11:47   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128221909.8141-13-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=fischer@norbit.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.