kill obsolete typedefs and wrappers from tmscsim
PATCH 1/1 kill obsolete typedefs and wrappers from tmscsim
drivers/scsi/scsiiom.c +44 -45
@@ -121,8 +121,8 @@ }else /* write cmnd to bus */ { -PUCHAR ptr;UCHAR i; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; +u8 *ptr;UCHAR i; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i<pSRB->pcmd->cmd_len; i++)DC390_write8 (ScsiFifo, *(ptr++)); }
@@ -159,13 +159,12 @@ {PSRB pSRB;UCHAR dstate; - DEBUG0(USHORT pstate;PDEVDECL1); + DEBUG0(USHORT pstate; struct pci_dev *pdev = pACB->pdev); -DEBUG0 (PDEVSET1 ); -DEBUG0 (PCI_READ_CONFIG_WORD (PDEV ,PCI_STATUS , &pstate)); +DEBUG0 (pci_read_config_word (pdev,PCI_STATUS , &pstate)); DEBUG0(if (pstate & (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY))\ {printk (KERN_WARNING "DC390: PCI state = %04x!\n" , pstate); \ -PCI_WRITE_CONFIG_WORD (PDEV ,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); +pci_write_config_word (pdev,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); dstate =DC390_read8 (DMA_Status);
@@ -222,7 +221,7 @@PSRB pSRB;UCHAR sstatus=0 ;UCHAR phase; -void (*stateV)(PACB ,PSRB ,PUCHAR ); +void (*stateV)(PACB ,PSRB ,u8 *);UCHAR istate, istatus;#if DMA_INT UCHAR dstatus;
@@ -345,10 +344,10 @@ }static void -dc390_DataOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOut_0 (PACB pACB,PSRB pSRB,u8 *psstatus) {UCHAR sstatus; -PSGL psgl; +struct scatterlist *psgl;UINT ResidCnt, xferCnt;UCHAR dstate =0 ;
@@ -409,13 +408,13 @@ }static void -dc390_DataIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataIn_0 (PACB pACB,PSRB pSRB,u8 *psstatus) {UCHAR sstatus, residual, bval; -PSGL psgl; +struct scatterlist *psgl;UINT ResidCnt, i;ULONG xferCnt; -PUCHAR ptr; +u8 *ptr; sstatus = *psstatus;
@@ -515,7 +514,7 @@if ( residual ) { bval =DC390_read8 (ScsiFifo);/* get one residual byte */ - ptr = (PUCHAR )bus_to_virt ( pSRB->SGBusAddr ); + ptr = (u8 *)bus_to_virt ( pSRB->SGBusAddr ); *ptr = bval; pSRB->SGBusAddr++; xferCnt++; pSRB->TotalXferredLen++;
@@ -534,12 +533,12 @@ }static void -dc390_Command_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Command_0 (PACB pACB,PSRB pSRB,u8 *psstatus) { }static void -dc390_Status_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Status_0 (PACB pACB,PSRB pSRB,u8 *psstatus) { pSRB->TargetStatus =DC390_read8 (ScsiFifo);
@@ -552,7 +551,7 @@ }static void -dc390_MsgOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOut_0 (PACB pACB,PSRB pSRB,u8 *psstatus) {if ( pSRB->SRBState & (SRB_UNEXPECT_RESEL +SRB_ABORT_SENT ) ) *psstatus =SCSI_NOP0 ;
@@ -740,12 +739,12 @@static void dc390_restore_ptr (PACB pACB,PSRB pSRB) { -Scsi_Cmnd * pcmd = pSRB->pcmd; -PSGL psgl; +struct scsi_cmnd *pcmd = pSRB->pcmd; +struct scatterlist *psgl; pSRB->TotalXferredLen =0 ; pSRB->SGIndex =0 ;if (pcmd->use_sg) { - pSRB->pSegmentList = (PSGL ) pcmd->request_buffer; + pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; psgl = pSRB->pSegmentList;//dc390_pci_sync(pSRB);
@@ -773,7 +772,7 @@sg_dma_len (&pSRB->Segmentx) = pcmd->request_bufflen - pSRB->Saved_Ptr; pSRB->SGcount =1 ; - pSRB->pSegmentList = (PSGL ) &pSRB->Segmentx; + pSRB->pSegmentList = (struct scatterlist *) &pSRB->Segmentx; }else { pSRB->SGcount =0 ;printk (KERN_INFO "DC390: RESTORE_PTR message for Transfer without Scatter-Gather ??\n" );
@@ -809,7 +808,7 @@/* read and eval received messages */ static void -dc390_MsgIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgIn_0 (PACB pACB,PSRB pSRB,u8 *psstatus) {PDCB pDCB = pACB->pActiveDCB;
@@ -885,7 +884,7 @@static void dc390_DataIO_Comm (PACB pACB,PSRB pSRB,UCHAR ioDir) { -PSGL psgl; +struct scatterlist *psgl;ULONG lval;PDCB pDCB = pACB->pActiveDCB;
@@ -956,30 +955,30 @@static void -dc390_DataOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOutPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,WRITE_DIRECTION ); }static void -dc390_DataInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataInPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,READ_DIRECTION ); }static void -dc390_CommandPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_CommandPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {PDCB pDCB;UCHAR i, cnt; -PUCHAR ptr; +u8 *ptr;DC390_write8 (ScsiCmd,RESET_ATN_CMD );DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBFlag &AUTO_REQSENSE ) ) { - cnt = (UCHAR ) pSRB->pcmd->cmd_len; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; + cnt = (u8 ) pSRB->pcmd->cmd_len; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); }
@@ -1000,7 +999,7 @@ }static void -dc390_StatusPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_StatusPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); pSRB->SRBState =SRB_STATUS ;
@@ -1009,10 +1008,10 @@ }static void -dc390_MsgOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOutPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {UCHAR bval, i, cnt; -PUCHAR ptr; +u8 *ptr;PDCB pDCB;DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );
@@ -1022,7 +1021,7 @@ cnt = pSRB->MsgCnt;if ( cnt ) { - ptr = (PUCHAR ) pSRB->MsgOutBuf; + ptr = (u8 *) pSRB->MsgOutBuf;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); pSRB->MsgCnt =0 ;
@@ -1062,7 +1061,7 @@ }static void -dc390_MsgInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgInPhase (PACB pACB,PSRB pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBState &SRB_MSGIN ) )
@@ -1075,12 +1074,12 @@ }static void -dc390_Nop_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_0 (PACB pACB,PSRB pSRB,u8 *psstatus) { }static void -dc390_Nop_1 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_1 (PACB pACB,PSRB pSRB,u8 *psstatus) { }
@@ -1330,9 +1329,9 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB ) { UCHAR bval, status, i; -PSCSICMD pcmd; +struct scsi_cmnd *pcmd;PSCSI_INQDATA ptr; -PSGL ptr2; +struct scatterlist *ptr2;ULONG swlval; pcmd = pSRB->pcmd;
@@ -1340,9 +1339,11 @@dc390_pci_unmap (pSRB); status = pSRB->TargetStatus; - ptr = (PSCSI_INQDATA ) (pcmd->request_buffer); -if ( pcmd->use_sg ) - ptr = (PSCSI_INQDATA ) (page_address (((PSGL ) ptr)->page) + ((PSGL ) ptr)->offset); +if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) ptr; + ptr = (PSCSI_INQDATA ) (page_address (ptr2->page) + ptr2->offset); + }else + ptr = (PSCSI_INQDATA ) (pcmd->request_buffer);DEBUG0 (printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n" , status, pcmd->result,\ pSRB, pcmd->pid));
@@ -1395,8 +1396,6 @@ pSRB->RetryCnt--; pSRB->AdaptStatus =0 ; pSRB->TargetStatus =0 ; -//*((PUINT) &(pSRB->CmdBlock[0])) = pSRB->Segment0[0]; -//*((PUINT) &(pSRB->CmdBlock[4])) = pSRB->Segment0[1]; /* Don't retry on TEST_UNIT_READY */ if ( pSRB->pcmd->cmnd[0 ] ==TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */ ) {
@@ -1569,12 +1568,12 @@/* Remove all SRBs from Going list and inform midlevel */ static void -dc390_DoingSRB_Done (PACB pACB,PSCSICMD cmd ) +dc390_DoingSRB_Done (PACB pACB,struct scsi_cmnd *cmd) {PDCB pDCB, pdcb;PSRB psrb, psrb2;UCHAR i; -PSCSICMD pcmd; +struct scsi_cmnd *pcmd; pDCB = pACB->pLinkDCB; pdcb = pDCB;
@@ -1660,7 +1659,7 @@static void __inline__dc390_RequestSense (PACB pACB,PDCB pDCB,PSRB pSRB ) { -PSCSICMD pcmd; +struct scsi_cmnd *pcmd; pcmd = pSRB->pcmd;
===== drivers/scsi/tmscsim.c 1.42 vs edited =====
drivers/scsi/tmscsim.c +85 -128
482 lines not on this page · raw message
===== drivers/scsi/tmscsim.h 1.7 vs edited =====
drivers/scsi/tmscsim.h +5 -21
@@ -29,17 +29,6 @@typedef u32 UINT ;/* 32 bits */ typedef unsigned long ULONG ;/* 32/64 bits */ -typedef UCHAR *PUCHAR ; -typedef USHORT *PUSHORT ; -typedef UINT *PUINT ; -typedef ULONG *PULONG ; -typedef Scsi_Host_Template *PSHT ; -typedef struct Scsi_Host *PSH ; -typedef Scsi_Device *PSCSIDEV ; -typedef Scsi_Cmnd *PSCSICMD ; -typedef void *PVOID ; -typedef struct scatterlist *PSGL ,SGL ; -/*;-----------------------------------------------------------------------*/ typedef struct _SyncMsg
@@ -81,11 +70,11 @@struct _SRB *pNextSRB;struct _DCB *pSRBDCB; -PSCSICMD pcmd; -PSGL pSegmentList; +struct scsi_cmnd *pcmd; +struct scatterlist *pSegmentList;/* 0x10: */ -SGL Segmentx;/* make a one entry of S/G list table */ +struct scatterlist Segmentx;/* make a one entry of S/G list table */ /* 0x1c: */ ULONG SGBusAddr;/*;a segment starting address as seen by AM53C974A*/
@@ -135,11 +124,6 @@struct _DCB *pNextDCB;struct _ACB *pDCBACB; -/* Aborted Commands */ -//PSCSICMD AboIORBhead; -//PSCSICMD AboIORBtail; -//ULONG AboIORBcnt; -/* 0x08: */ /* Queued SRBs */ PSRB pWaitingSRB;
@@ -186,7 +170,7 @@*/ struct _ACB { -PSH pScsiHost; +struct Scsi_Host *pScsiHost;struct _ACB *pNextACB;USHORT IOPortBase;UCHAR IRQLevel;
@@ -223,7 +207,7 @@UCHAR MsgLen;UCHAR Ignore_IRQ;/* Not used */ -PDEVDECL1 ;/* Pointer to PCI cfg. space */ +struct pci_dev *pdev;ULONG Cmds;UINT SelLost;
Great! Thanks very much, Christoph! It would take me, perhaps, until 2.8 to clean up all that stuff. However, I've got a couple of questions to this your patch:
Review
Quoted 4 lines · Christoph Hellwig
(quoted diff) +2
-2- PUCHAR ptr; UCHAR i; - ptr = (PUCHAR) pSRB->pcmd->cmnd; + u8 *ptr; UCHAR i; + ptr = (u8 *) pSRB->pcmd->cmnd;
Why don't we remove all UCHAR / USHORT / UINT / ULONG... types altogether? PUCHAR == (UCHAR*), and you replace PUCHAR with (u8*), although it is not obvious, that UCHAR == u8... I know, many scsi (at least) drivers use them, and each of them defines them itself, but... As well as all those PACB, PSRB, PDCB,...
Quoted 5 lines
(quoted diff) +0
-1@@ -1340,9 +1339,11 @@ dc390_pci_unmap(pSRB); status = pSRB->TargetStatus; - ptr = (PSCSI_INQDATA) (pcmd->request_buffer);
Review line 1349
Quoted 10 lines
(quoted diff) +5
-2- if( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) (page_address(((PSGL) ptr)->page) + ((PSGL) ptr)->offset); + if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) ptr; + ptr = (PSCSI_INQDATA) (page_address(ptr2->page) + ptr2->offset); + } else + ptr = (PSCSI_INQDATA) (pcmd->request_buffer); DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ pSRB, pcmd->pid));
This seems a typo (ptr uninitialised).
Attaching a new, extended, and, hopefully, fixed version of your patch. Please, have a look. I think, it is better to push all this cleanup as a single patch, even though it looks horribly big... It compiles, will run-test tomorrow (well, already today, but in about 20 hours).
Thanks
Guennadi
---
Guennadi Liakhovetski
drivers/scsi/scsiiom.c +153 -154
@@ -6,7 +6,7 @@***********************************************************************/ /* $Id: scsiiom.c,v 2.55.2.17 2000/12/20 00:39:37 garloff Exp $ */ static void __inline__ -dc390_freetag (PDCB pDCB,PSRB pSRB) +dc390_freetag (struct dc390_DCB * pDCB,struct dc390_SRB * pSRB) {if (pSRB->TagNumber <255 ) { pDCB->TagMask &= ~(1 << pSRB->TagNumber);/* free tag mask */
@@ -15,10 +15,10 @@ } -static UCHAR -dc390_StartSCSI (PACB pACB,PDCB pDCB,PSRB pSRB ) +static u8 +dc390_StartSCSI (struct dc390_ACB * pACB,struct dc390_DCB * pDCB,struct dc390_SRB * pSRB ) { -UCHAR cmd;UCHAR disc_allowed, try_sync_nego; +u8 cmd;u8 disc_allowed, try_sync_nego; pSRB->ScsiPhase =SCSI_NOP0 ;
@@ -69,7 +69,7 @@/* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */ if ((pDCB->SyncMode &EN_TAG_QUEUEING ) && disc_allowed) { -UCHAR tag_no =0 ; +u8 tag_no =0 ;while ((1 << tag_no) & pDCB->TagMask) tag_no++;if (tag_no >=sizeof (pDCB->TagMask)*8 || tag_no >= pDCB->MaxCommand) {printk (KERN_WARNING "DC390: Out of tags for Dev. %02x %02x\n" , pDCB->TargetID, pDCB->TargetLUN);
@@ -92,7 +92,7 @@if (try_sync_nego) { -UCHAR Sync_Off = pDCB->SyncOffset; +u8 Sync_Off = pDCB->SyncOffset;DEBUG0 (printk (KERN_INFO "DC390: NEW Sync Nego code triggered (%i %i)\n" , pDCB->TargetID, pDCB->TargetLUN)); pSRB->MsgOutBuf[0 ] =EXTENDED_MESSAGE ; pSRB->MsgOutBuf[1 ] =3 ;
@@ -121,8 +121,8 @@ }else /* write cmnd to bus */ { -PUCHAR ptr;UCHAR i; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; +u8 *ptr;u8 i; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i<pSRB->pcmd->cmd_len; i++)DC390_write8 (ScsiFifo, *(ptr++)); }
@@ -154,18 +154,17 @@#if DMA_INT /* This is similar to AM53C974.c ... */ -static UCHAR -dc390_dma_intr (PACB pACB) +static u8 +dc390_dma_intr (struct dc390_ACB * pACB) { -PSRB pSRB; -UCHAR dstate; - DEBUG0(USHORT pstate;PDEVDECL1); +struct dc390_SRB * pSRB; +u8 dstate; + DEBUG0(u16 pstate; struct pci_dev *pdev = pACB->pdev); -DEBUG0 (PDEVSET1 ); -DEBUG0 (PCI_READ_CONFIG_WORD (PDEV ,PCI_STATUS , &pstate)); +DEBUG0 (pci_read_config_word (pdev,PCI_STATUS , &pstate)); DEBUG0(if (pstate & (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY))\ {printk (KERN_WARNING "DC390: PCI state = %04x!\n" , pstate); \ -PCI_WRITE_CONFIG_WORD (PDEV ,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); +pci_write_config_word (pdev,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); dstate =DC390_read8 (DMA_Status);
@@ -179,7 +178,7 @@ }if (dstate &DMA_XFER_DONE ) { -UINT residual, xferCnt;int ctr =6000000 ; +u32 residual, xferCnt;int ctr =6000000 ;if (! (DC390_read8 (DMA_Cmd) &READ_DIRECTION )) { do
@@ -217,18 +216,18 @@static irqreturn_t __inline__DC390_Interrupt (int irq,void *dev_id,struct pt_regs *regs) { -PACB pACB, pACB2; -PDCB pDCB; -PSRB pSRB; -UCHAR sstatus=0 ; -UCHAR phase; -void (*stateV)(PACB ,PSRB ,PUCHAR ); -UCHAR istate, istatus; +struct dc390_ACB *pACB, *pACB2; +struct dc390_DCB *pDCB; +struct dc390_SRB *pSRB; +u8 sstatus=0 ; +u8 phase; +void (*stateV)(struct dc390_ACB *,struct dc390_SRB *,u8 *); +u8 istate, istatus;#if DMA_INT -UCHAR dstatus; +u8 dstatus;#endif - pACB = (PACB )dev_id; + pACB = (struct dc390_ACB *)dev_id;for (pACB2 = dc390_pACB_start; (pACB2 && pACB2 != pACB); pACB2 = pACB2->pNextACB);if (!pACB2) {
@@ -323,7 +322,7 @@ ( *stateV )( pACB, pSRB, &sstatus ); pSRB->ScsiPhase = sstatus &7 ; - phase = (UCHAR ) sstatus &7 ; + phase = (u8 ) sstatus &7 ;DEBUG1 (printk (KERN_INFO "DC390: [%i]%s(1) (%02x)\n" , phase, dc390_p1_str[phase], sstatus)); stateV = (void *) dc390_phase1[phase]; ( *stateV )( pACB, pSRB, &sstatus );
@@ -345,12 +344,12 @@ }static void -dc390_DataOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOut_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { -UCHAR sstatus; -PSGL psgl; -UINT ResidCnt, xferCnt; -UCHAR dstate =0 ; +u8 sstatus; +struct scatterlist *psgl; +u32 ResidCnt, xferCnt; +u8 dstate =0 ; sstatus = *psstatus;
@@ -390,10 +389,10 @@ }else { - ResidCnt = (UINT )DC390_read8 (Current_Fifo) &0x1f ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_High) <<16 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Mid) <<8 ; - ResidCnt += (UINT )DC390_read8 (CtcReg_Low); + ResidCnt = (u32 )DC390_read8 (Current_Fifo) &0x1f ; + ResidCnt |= (u32 )DC390_read8 (CtcReg_High) <<16 ; + ResidCnt |= (u32 )DC390_read8 (CtcReg_Mid) <<8 ; + ResidCnt += (u32 )DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt;
@@ -409,13 +408,13 @@ }static void -dc390_DataIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataIn_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { -UCHAR sstatus, residual, bval; -PSGL psgl; -UINT ResidCnt, i; -ULONG xferCnt; -PUCHAR ptr; +u8 sstatus, residual, bval; +struct scatterlist *psgl; +u32 ResidCnt, i; +unsigned long xferCnt; +u8 *ptr; sstatus = *psstatus;
@@ -443,9 +442,9 @@ } dc390_laststatus &= ~0xff000000 ; dc390_laststatus |= dstate <<24 ; -DEBUG1 (ResidCnt = ((ULONG )DC390_read8 (CtcReg_High) <<16 ) \ - + ((ULONG )DC390_read8 (CtcReg_Mid) <<8 ) \ - + ((ULONG )DC390_read8 (CtcReg_Low))); +DEBUG1 (ResidCnt = ((unsigned long )DC390_read8 (CtcReg_High) <<16 ) \ + + ((unsigned long )DC390_read8 (CtcReg_Mid) <<8 ) \ + + ((unsigned long )DC390_read8 (CtcReg_Low)));DEBUG1 (printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li)," , ResidCnt, pSRB->SGToBeXferLen));DC390_write8 (DMA_Cmd,READ_DIRECTION +DMA_IDLE_CMD );/* | DMA_INT */
@@ -501,11 +500,11 @@ dc390_laststatus &= ~0xff000000 ; dc390_laststatus |= bval <<24 ;DEBUG1 (printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x" ,0xa000 -i, bval)); - ResidCnt = (UINT )DC390_read8 (CtcReg_High); + ResidCnt = (u32 )DC390_read8 (CtcReg_High); ResidCnt <<=8 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Mid); + ResidCnt |= (u32 )DC390_read8 (CtcReg_Mid); ResidCnt <<=8 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Low); + ResidCnt |= (u32 )DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt;
@@ -515,7 +514,7 @@if ( residual ) { bval =DC390_read8 (ScsiFifo);/* get one residual byte */ - ptr = (PUCHAR )bus_to_virt ( pSRB->SGBusAddr ); + ptr = (u8 *)bus_to_virt ( pSRB->SGBusAddr ); *ptr = bval; pSRB->SGBusAddr++; xferCnt++; pSRB->TotalXferredLen++;
@@ -534,12 +533,12 @@ }static void -dc390_Command_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Command_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { }static void -dc390_Status_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Status_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { pSRB->TargetStatus =DC390_read8 (ScsiFifo);
@@ -552,7 +551,7 @@ }static void -dc390_MsgOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOut_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) {if ( pSRB->SRBState & (SRB_UNEXPECT_RESEL +SRB_ABORT_SENT ) ) *psstatus =SCSI_NOP0 ;
@@ -561,7 +560,7 @@static void __inline__ -dc390_reprog (PACB pACB,PDCB pDCB) +dc390_reprog (struct dc390_ACB * pACB,struct dc390_DCB * pDCB) {DC390_write8 (Sync_Period, pDCB->SyncPeriod);DC390_write8 (Sync_Offset, pDCB->SyncOffset);
@@ -573,7 +572,7 @@#ifdef DC390_DEBUG0 static void -dc390_printMsg (UCHAR *MsgBuf,UCHAR len) +dc390_printMsg (u8 *MsgBuf,u8 len) {int i;printk (" %02x" , MsgBuf[0 ]);
@@ -587,7 +586,7 @@/* reject_msg */ static void __inline__ -dc390_MsgIn_reject (PACB pACB,PSRB pSRB) +dc390_MsgIn_reject (struct dc390_ACB * pACB,struct dc390_SRB * pSRB) { pSRB->MsgOutBuf[0 ] =MESSAGE_REJECT ; pSRB->MsgCnt =1 ;DC390_ENABLE_MSGOUT ;
@@ -596,18 +595,18 @@/* abort command */ static void __inline__ -dc390_EnableMsgOut_Abort (PACB pACB,PSRB pSRB ) +dc390_EnableMsgOut_Abort (struct dc390_ACB * pACB,struct dc390_SRB * pSRB ) { pSRB->MsgOutBuf[0 ] =ABORT ; pSRB->MsgCnt =1 ;DC390_ENABLE_MSGOUT ; pSRB->pSRBDCB->DCBFlag &= ~ABORT_DEV_ ; } -static PSRB -dc390_MsgIn_QTag (PACB pACB,PDCB pDCB,UCHAR tag) +static struct dc390_SRB * +dc390_MsgIn_QTag (struct dc390_ACB * pACB,struct dc390_DCB * pDCB,u8 tag) { -PSRB lastSRB = pDCB->pGoingLast; -PSRB pSRB = pDCB->pGoingSRB; +struct dc390_SRB * lastSRB = pDCB->pGoingLast; +struct dc390_SRB * pSRB = pDCB->pGoingSRB;if (pSRB) {
@@ -645,9 +644,9 @@/* set async transfer mode */ static void -dc390_MsgIn_set_async (PACB pACB,PSRB pSRB) +dc390_MsgIn_set_async (struct dc390_ACB * pACB,struct dc390_SRB * pSRB) { -PDCB pDCB = pSRB->pSRBDCB; +struct dc390_DCB * pDCB = pSRB->pSRBDCB;if (!(pSRB->SRBState &DO_SYNC_NEGO ))printk (KERN_INFO "DC390: Target %i initiates Non-Sync?\n" , pDCB->TargetID); pSRB->SRBState &= ~DO_SYNC_NEGO ;
@@ -663,13 +662,13 @@/* set sync transfer mode */ static void -dc390_MsgIn_set_sync (PACB pACB,PSRB pSRB) +dc390_MsgIn_set_sync (struct dc390_ACB * pACB,struct dc390_SRB * pSRB) { -UCHAR bval; -USHORT wval, wval1; -PDCB pDCB = pSRB->pSRBDCB; -UCHAR oldsyncperiod = pDCB->SyncPeriod; -UCHAR oldsyncoffset = pDCB->SyncOffset; +u8 bval; +u16 wval, wval1; +struct dc390_DCB * pDCB = pSRB->pSRBDCB; +u8 oldsyncperiod = pDCB->SyncPeriod; +u8 oldsyncoffset = pDCB->SyncOffset;if (!(pSRB->SRBState &DO_SYNC_NEGO )) {
@@ -702,7 +701,7 @@ pDCB->SyncOffset |= pSRB->MsgInBuf[4 ]; pDCB->NegoPeriod = pSRB->MsgInBuf[3 ]; - wval = (USHORT ) pSRB->MsgInBuf[3 ]; + wval = (u16 ) pSRB->MsgInBuf[3 ]; wval = wval <<2 ; wval -=3 ; wval1 = wval /25 ;/* compute speed */ if ( (wval1 *25 ) != wval) wval1++; bval =FAST_CLK +FAST_SCSI ;/* fast clock / fast scsi */
@@ -722,7 +721,7 @@ } pDCB->CtrlR3 = bval; - pDCB->SyncPeriod = (UCHAR )wval1; + pDCB->SyncPeriod = (u8 )wval1;if ((oldsyncperiod != wval1 || oldsyncoffset != pDCB->SyncOffset) && pDCB->TargetLUN ==0 ) {
@@ -738,20 +737,20 @@/* handle RESTORE_PTR */ /* I presume, this command is already mapped, so, have to remap. */ static void -dc390_restore_ptr (PACB pACB,PSRB pSRB) +dc390_restore_ptr (struct dc390_ACB * pACB,struct dc390_SRB * pSRB) { -Scsi_Cmnd * pcmd = pSRB->pcmd; -PSGL psgl; +struct scsi_cmnd *pcmd = pSRB->pcmd; +struct scatterlist *psgl; pSRB->TotalXferredLen =0 ; pSRB->SGIndex =0 ;if (pcmd->use_sg) { - pSRB->pSegmentList = (PSGL ) pcmd->request_buffer; + pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; psgl = pSRB->pSegmentList;//dc390_pci_sync(pSRB); -while (pSRB->TotalXferredLen + (ULONG )sg_dma_len (psgl) < pSRB->Saved_Ptr) +while (pSRB->TotalXferredLen + (unsigned long )sg_dma_len (psgl) < pSRB->Saved_Ptr) { - pSRB->TotalXferredLen += (ULONG )sg_dma_len (psgl); + pSRB->TotalXferredLen += (unsigned long )sg_dma_len (psgl); pSRB->SGIndex++;if ( pSRB->SGIndex < pSRB->SGcount ) {
@@ -773,7 +772,7 @@sg_dma_len (&pSRB->Segmentx) = pcmd->request_bufflen - pSRB->Saved_Ptr; pSRB->SGcount =1 ; - pSRB->pSegmentList = (PSGL ) &pSRB->Segmentx; + pSRB->pSegmentList = (struct scatterlist *) &pSRB->Segmentx; }else { pSRB->SGcount =0 ;printk (KERN_INFO "DC390: RESTORE_PTR message for Transfer without Scatter-Gather ??\n" );
@@ -792,8 +791,8 @@/* The old implementation was correct. Sigh! */ /* Check if the message is complete */ -static UCHAR __inline__ -dc390_MsgIn_complete (UCHAR *msgbuf,UINT len) +static u8 __inline__ +dc390_MsgIn_complete (u8 *msgbuf,u32 len) {if (*msgbuf ==EXTENDED_MESSAGE ) {
@@ -809,9 +808,9 @@/* read and eval received messages */ static void -dc390_MsgIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgIn_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { -PDCB pDCB = pACB->pActiveDCB; +struct dc390_DCB * pDCB = pACB->pActiveDCB;/* Read the msg */
@@ -856,7 +855,7 @@// nothing has to be done case COMMAND_COMPLETE :break ; -// SAVE POINTER may be ignored as we have the PSRB associated with the +// SAVE POINTER may be ignored as we have the struct dc390_SRB* associated with the // scsi command. Thanks, Gerard, for pointing it out. case SAVE_POINTERS : pSRB->Saved_Ptr = pSRB->TotalXferredLen;
@@ -883,11 +882,11 @@static void -dc390_DataIO_Comm (PACB pACB,PSRB pSRB,UCHAR ioDir) +dc390_DataIO_Comm (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 ioDir) { -PSGL psgl; -ULONG lval; -PDCB pDCB = pACB->pActiveDCB; +struct scatterlist *psgl; +unsigned long lval; +struct dc390_DCB * pDCB = pACB->pActiveDCB;if (pSRB == pACB->pTmpSRB) {
@@ -913,11 +912,11 @@ } lval = pSRB->SGToBeXferLen;DEBUG1 (printk (KERN_DEBUG " DC390: Start transfer: %li bytes (address %08lx)\n" , lval, pSRB->SGBusAddr)); -DC390_write8 (CtcReg_Low, (UCHAR ) lval); +DC390_write8 (CtcReg_Low, (u8 ) lval); lval >>=8 ; -DC390_write8 (CtcReg_Mid, (UCHAR ) lval); +DC390_write8 (CtcReg_Mid, (u8 ) lval); lval >>=8 ; -DC390_write8 (CtcReg_High, (UCHAR ) lval); +DC390_write8 (CtcReg_High, (u8 ) lval);DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen);DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr);
@@ -956,36 +955,36 @@static void -dc390_DataOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOutPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,WRITE_DIRECTION ); }static void -dc390_DataInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataInPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,READ_DIRECTION ); }static void -dc390_CommandPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_CommandPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { -PDCB pDCB; -UCHAR i, cnt; -PUCHAR ptr; +struct dc390_DCB * pDCB; +u8 i, cnt; +u8 *ptr;DC390_write8 (ScsiCmd,RESET_ATN_CMD );DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBFlag &AUTO_REQSENSE ) ) { - cnt = (UCHAR ) pSRB->pcmd->cmd_len; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; + cnt = (u8 ) pSRB->pcmd->cmd_len; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); }else { -UCHAR bval =0 ; +u8 bval =0 ;DC390_write8 (ScsiFifo,REQUEST_SENSE ); pDCB = pACB->pActiveDCB;DC390_write8 (ScsiFifo, pDCB->TargetLUN <<5 );
@@ -1000,7 +999,7 @@ }static void -dc390_StatusPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_StatusPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); pSRB->SRBState =SRB_STATUS ;
@@ -1009,11 +1008,11 @@ }static void -dc390_MsgOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOutPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { -UCHAR bval, i, cnt; -PUCHAR ptr; -PDCB pDCB; +u8 bval, i, cnt; +u8 *ptr; +struct dc390_DCB * pDCB;DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); pDCB = pACB->pActiveDCB;
@@ -1022,7 +1021,7 @@ cnt = pSRB->MsgCnt;if ( cnt ) { - ptr = (PUCHAR ) pSRB->MsgOutBuf; + ptr = (u8 *) pSRB->MsgOutBuf;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); pSRB->MsgCnt =0 ;
@@ -1062,7 +1061,7 @@ }static void -dc390_MsgInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgInPhase (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBState &SRB_MSGIN ) )
@@ -1075,21 +1074,21 @@ }static void -dc390_Nop_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_0 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { }static void -dc390_Nop_1 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_1 (struct dc390_ACB * pACB,struct dc390_SRB * pSRB,u8 *psstatus) { }static void -dc390_SetXferRate (PACB pACB,PDCB pDCB ) +dc390_SetXferRate (struct dc390_ACB * pACB,struct dc390_DCB * pDCB ) { -UCHAR bval, i, cnt; -PDCB ptr; +u8 bval, i, cnt; +struct dc390_DCB * ptr;if ( !(pDCB->TargetLUN) ) {
@@ -1117,11 +1116,11 @@static void -dc390_Disconnect (PACB pACB ) +dc390_Disconnect (struct dc390_ACB * pACB ) { -PDCB pDCB; -PSRB pSRB, psrb; -UCHAR i, cnt; +struct dc390_DCB *pDCB; +struct dc390_SRB *pSRB, *psrb; +u8 i, cnt;DEBUG0 (printk (KERN_INFO "DISC," ));
@@ -1198,11 +1197,11 @@static void -dc390_Reselect (PACB pACB ) +dc390_Reselect (struct dc390_ACB * pACB ) { -PDCB pDCB; -PSRB pSRB; -UCHAR id, lun; +struct dc390_DCB * pDCB; +struct dc390_SRB * pSRB; +u8 id, lun;DEBUG0 (printk (KERN_INFO "RSEL," )); pACB->Connected =1 ;
@@ -1283,10 +1282,10 @@DC390_write8 (ScsiCmd,MSG_ACCEPTED_CMD );/* ;to release the /ACK signal */ } -static UCHAR __inline__ +static u8 __inline__dc390_tagq_blacklist (char * name) { -UCHAR i; +u8 i;for (i=0 ; i<BADDEVCNT ; i++)if (memcmp (name, dc390_baddevname1[i],28 ) ==0 )return 1 ;
@@ -1295,7 +1294,7 @@static void -dc390_disc_tagq_set (PDCB pDCB,PSCSI_INQDATA ptr) +dc390_disc_tagq_set (struct dc390_DCB * pDCB,PSCSI_INQDATA ptr) {/* Check for SCSI format (ANSI and Response data format) */ if ( (ptr->Vers &0x07 ) >=2 || (ptr->RDF &0x0F ) ==2 )
@@ -1317,9 +1316,9 @@static void -dc390_add_dev (PACB pACB,PDCB pDCB,PSCSI_INQDATA ptr) +dc390_add_dev (struct dc390_ACB * pACB,struct dc390_DCB * pDCB,PSCSI_INQDATA ptr) { -UCHAR bval1 = ptr->DevType &SCSI_DEVTYPE ; +u8 bval1 = ptr->DevType &SCSI_DEVTYPE ; pDCB->DevType = bval1;/* if (bval1 == TYPE_DISK || bval1 == TYPE_MOD) */ dc390_disc_tagq_set (pDCB, ptr);
@@ -1327,22 +1326,24 @@static void -dc390_SRBdone (PACB pACB,PDCB pDCB,PSRB pSRB ) +dc390_SRBdone (struct dc390_ACB * pACB,struct dc390_DCB * pDCB,struct dc390_SRB * pSRB ) { -UCHAR bval, status, i; -PSCSICMD pcmd; +u8 bval, status, i; +struct scsi_cmnd *pcmd;PSCSI_INQDATA ptr; -PSGL ptr2; -ULONG swlval; +struct scatterlist *ptr2; +unsigned long swlval; pcmd = pSRB->pcmd;/* KG: Moved pci_unmap here */ dc390_pci_unmap (pSRB); status = pSRB->TargetStatus; - ptr = (PSCSI_INQDATA ) (pcmd->request_buffer); -if ( pcmd->use_sg ) - ptr = (PSCSI_INQDATA ) (page_address (((PSGL ) ptr)->page) + ((PSGL ) ptr)->offset); +if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) (pcmd->request_buffer); + ptr = (PSCSI_INQDATA ) (page_address (ptr2->page) + ptr2->offset); + }else + ptr = (PSCSI_INQDATA ) (pcmd->request_buffer);DEBUG0 (printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n" , status, pcmd->result,\ pSRB, pcmd->pid));
@@ -1379,7 +1380,7 @@ }if (pSRB->RetryCnt ==0 ) { -//(UINT)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; +//(u32)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; pSRB->TotalXferredLen = pSRB->SavedTotXLen;if ( (pSRB->TotalXferredLen) && (pSRB->TotalXferredLen >= pcmd->underflow) )
@@ -1387,7 +1388,7 @@else pcmd->result =MK_RES_LNX (DRIVER_SENSE ,DID_OK ,0 ,CHECK_CONDITION );REMOVABLEDEBUG (printk (KERN_INFO "Cmd=%02x,Result=%08x,XferL=%08x\n" ,pSRB->pcmd->cmnd[0 ],\ - (UINT ) pcmd->result, (UINT ) pSRB->TotalXferredLen)); + (u32 ) pcmd->result, (u32 ) pSRB->TotalXferredLen)); goto ckc_e; }else /* Retry */
@@ -1395,19 +1396,17 @@ pSRB->RetryCnt--; pSRB->AdaptStatus =0 ; pSRB->TargetStatus =0 ; -//*((PUINT) &(pSRB->CmdBlock[0])) = pSRB->Segment0[0]; -//*((PUINT) &(pSRB->CmdBlock[4])) = pSRB->Segment0[1]; /* Don't retry on TEST_UNIT_READY */ if ( pSRB->pcmd->cmnd[0 ] ==TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */ ) { pcmd->result =MK_RES_LNX (DRIVER_SENSE ,DID_OK ,0 ,CHECK_CONDITION );REMOVABLEDEBUG (printk (KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n" ,pSRB->pcmd->cmnd[0 ],\ - (UINT ) pcmd->result, (UINT ) pSRB->TotalXferredLen)); + (u32 ) pcmd->result, (u32 ) pSRB->TotalXferredLen)); goto ckc_e; }SET_RES_DRV (pcmd->result,DRIVER_SENSE ); pcmd->use_sg = pSRB->SavedSGCount; -//pSRB->ScsiCmdLen = (UCHAR) (pSRB->Segment1[0] >> 8); +//pSRB->ScsiCmdLen = (u8) (pSRB->Segment1[0] >> 8); DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n" , pcmd->pid, pcmd->cmnd[0 ], pcmd->device->id, pcmd->device->lun)); pSRB->SGIndex =0 ; pSRB->TotalXferredLen =0 ;
@@ -1437,14 +1436,14 @@ ptr2++; }REMOVABLEDEBUG (printk (KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n" ,\ - (UINT ) pSRB->TotalXferredLen, (UINT ) swlval)); + (u32 ) pSRB->TotalXferredLen, (u32 ) swlval)); }dc390_RequestSense ( pACB, pDCB, pSRB );return ; }else if (status_byte (status) ==QUEUE_FULL ) { - bval = (UCHAR ) pDCB->GoingSRBCnt; + bval = (u8 ) pDCB->GoingSRBCnt; bval--; pDCB->MaxCommand = bval;dc390_freetag (pDCB, pSRB);
@@ -1569,12 +1568,12 @@/* Remove all SRBs from Going list and inform midlevel */ static void -dc390_DoingSRB_Done (PACB pACB,PSCSICMD cmd ) +dc390_DoingSRB_Done (struct dc390_ACB * pACB,struct scsi_cmnd *cmd) { -PDCB pDCB, pdcb; -PSRB psrb, psrb2; -UCHAR i; -PSCSICMD pcmd; +struct dc390_DCB *pDCB, *pdcb; +struct dc390_SRB *psrb, *psrb2; +u8 i; +struct scsi_cmnd *pcmd; pDCB = pACB->pLinkDCB; pdcb = pDCB;
@@ -1610,7 +1609,7 @@static void -dc390_ResetSCSIBus (PACB pACB ) +dc390_ResetSCSIBus (struct dc390_ACB * pACB ) {//DC390_write8 (ScsiCmd, RST_DEVICE_CMD); //udelay (250);
@@ -1625,7 +1624,7 @@ }static void -dc390_ScsiRstDetect (PACB pACB ) +dc390_ScsiRstDetect (struct dc390_ACB * pACB ) {printk ("DC390: Rst_Detect: laststat = %08x\n" , dc390_laststatus);//DEBUG0(printk(KERN_INFO "RST_DETECT,"));
@@ -1658,9 +1657,9 @@static void __inline__ -dc390_RequestSense (PACB pACB,PDCB pDCB,PSRB pSRB ) +dc390_RequestSense (struct dc390_ACB * pACB,struct dc390_DCB * pDCB,struct dc390_SRB * pSRB ) { -PSCSICMD pcmd; +struct scsi_cmnd *pcmd; pcmd = pSRB->pcmd;
@@ -1668,9 +1667,9 @@ pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN)); pSRB->SRBFlag |=AUTO_REQSENSE ; -//pSRB->Segment0[0] = (UINT) pSRB->CmdBlock[0]; -//pSRB->Segment0[1] = (UINT) pSRB->CmdBlock[4]; -//pSRB->Segment1[0] = ((UINT)(pcmd->cmd_len) << 8) + pSRB->SGcount; +//pSRB->Segment0[0] = (u32) pSRB->CmdBlock[0]; +//pSRB->Segment0[1] = (u32) pSRB->CmdBlock[4]; +//pSRB->Segment1[0] = ((u32)(pcmd->cmd_len) << 8) + pSRB->SGcount; //pSRB->Segment1[1] = pSRB->TotalXferredLen; pSRB->SavedSGCount = pcmd->use_sg; pSRB->SavedTotXLen = pSRB->TotalXferredLen;
@@ -1683,8 +1682,8 @@//pSRB->CmdBlock[0] = REQUEST_SENSE; //pSRB->CmdBlock[1] = pDCB->TargetLUN << 5; -//(USHORT) pSRB->CmdBlock[2] = 0; -//(USHORT) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer); +//(u16) pSRB->CmdBlock[2] = 0; +//(u16) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer); //pSRB->ScsiCmdLen = 6; pSRB->TotalXferredLen =0 ;
@@ -1698,7 +1697,7 @@static void __inline__ -dc390_InvalidCmd (PACB pACB ) +dc390_InvalidCmd (struct dc390_ACB * pACB ) {if ( pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_ +SRB_MSGOUT ) )DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );
drivers/scsi/tmscsim.c +196 -239
949 lines not on this page · raw message
drivers/scsi/tmscsim.h +114 -162
370 lines not on this page · raw message
Quoted 1 line · Guennadi Liakhovetski
Why don't we remove all UCHAR / USHORT / UINT / ULONG... types altogether?
One thing at a time, the patch is already huge enough.
Quoted 4 lines
PUCHAR == (UCHAR*), and you replace PUCHAR with (u8*), although it is not obvious, that UCHAR == u8... I know, many scsi (at least) drivers use them, and each of them defines them itself, but... As well as all those PACB, PSRB, PDCB,...
That'll happen sooner or later :)
Quoted 10 lines
Quoted 10 lines
drivers/scsi/scsiiom.c +0
-3- ptr = (PSCSI_INQDATA ) (pcmd->request_buffer); -if ( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) (page_address(((PSGL) ptr)->page) + ((PSGL)ptr)->offset);
drivers/scsi/scsiiom.c +5
-0+if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) ptr; + ptr = (PSCSI_INQDATA ) (page_address (ptr2->page) + ptr2->offset); + }else + ptr = (PSCSI_INQDATA ) (pcmd->request_buffer);
Quoted 5 lines
Quoted 3 lines
DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ pSRB, pcmd->pid));This seems a typo (ptr uninitialised).
Indeed, thanks. I wonder why gcc didn't spit a warning.
Quoted 4 lines
Attaching a new, extended, and, hopefully, fixed version of your patch. Please, have a look. I think, it is better to push all this cleanup as a single patch, even though it looks horribly big... It compiles, will run-test tomorrow (well, already today, but in about 20 hours).
We hsould probably call the types dc390_acb and dc390_dcb instead of the shouting names? Or maybe even better dc390_hba and dc390_lun so the names are descriptive?
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Guennadi Liakhovetski
Why don't we remove all UCHAR / USHORT / UINT / ULONG... types altogether?
One thing at a time, the patch is already huge enough.
Well, I thought, it was inconsistent to leave UCHAR, removing PUCHAR, thus allowing
UCHAR c; u8 *pc = &c;
and, since we are already at it...
Quoted 6 lines
Quoted 4 lines
PUCHAR == (UCHAR*), and you replace PUCHAR with (u8*), although it is not obvious, that UCHAR == u8... I know, many scsi (at least) drivers use them, and each of them defines them itself, but... As well as all those PACB, PSRB, PDCB,...
That'll happen sooner or later :)
So, why not now?:-)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/scsi/scsiiom.c +0
-3- ptr = (PSCSI_INQDATA ) (pcmd->request_buffer); -if ( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) (page_address(((PSGL) ptr)->page) + ((PSGL)ptr)->offset);
drivers/scsi/scsiiom.c +5
-0+if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) ptr; + ptr = (PSCSI_INQDATA ) (page_address (ptr2->page) + ptr2->offset); + }else + ptr = (PSCSI_INQDATA ) (pcmd->request_buffer);
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ pSRB, pcmd->pid));This seems a typo (ptr uninitialised).
Indeed, thanks. I wonder why gcc didn't spit a warning.
Mine did (3.3.2). Otherwise, how would I find it?:-)
Quoted 8 lines
Quoted 4 lines
Attaching a new, extended, and, hopefully, fixed version of your patch. Please, have a look. I think, it is better to push all this cleanup as a single patch, even though it looks horribly big... It compiles, will run-test tomorrow (well, already today, but in about 20 hours).
We hsould probably call the types
dc390_acbanddc390_dcbinstead of the shouting names? Or maybe even betterdc390_hbaanddc390_lunso the names are descriptive?
Sure, that's easy!:-) I kept capitals initially, because all functions are called like FindDCB, DoingSRB_Done, etc. But if we rename dc390_dcb into dc390_lun, we would have to rename all respective functions, but that's a bit too much, I think. So, is it ok to just "smallify" the types, going the Middle Way?:-) If you don't object, I'll send tomorrow a new version of the patch with the only chenge: s/dc390_ACB/dc390_acb/g, s/dc390_DCB/dc390_dcb/g, s/dc390_SRB/dc390_srb/g.
Do you want to rediff your 3rd patch yourself or should I do it? Essentially, as you know, up to now the "old" EH code was used by tmscsim. Switching to the "new" one seems a pretty essential change. Is there a way I could test it a bit? I can now boot and run from IDE, loading tmscsim as a module, to which I have a disk and a CD-ROM connected. How can I exercise eh-paths a bit without destroying the hardware?:-)
Thanks
Guennadi
---
Guennadi Liakhovetski
Quoted 3 lines
Quoted 1 line
That'll happen sooner or later :)
So, why not now?:-)
Okay, okay - you've won :)
Quoted 5 lines
Sure, that's easy!:-) I kept capitals initially, because all functions are called like FindDCB,
DoingSRB_Done, etc. But if we renamedc390_dcbintodc390_lun, we would have to rename all respective functions, but that's a bit too much, I think. So, is it ok to just "smallify" the types, going the Middle Way?:-)
Yes.
Quoted 1 line
Do you want to rediff your 3rd patch yourself or should I do it?
I can rediff it.
Quoted 2 lines
Essentially, as you know, up to now the "old" EH code was used by tmscsim. Switching to the "new" one seems a pretty essential change.
No. Old EH is completely gone in 2.6. The tmscsim driver claims to implement new EH but gets it wrong currently..
Quoted 4 lines
Is there a way
I could test it a bit? I can now boot and run from IDE, loading tmscsim as a module, to which I have a disk and a CD-ROM connected. How can I exercise eh-paths a bit without destroying the hardware?:-)
A good way to test EH is to improperly terminate the bus and wait for failures to happen or similar things.
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines
Quoted 1 line
That'll happen sooner or later :)
So, why not now?:-)
Okay, okay - you've won :)
Quoted 7 lines
Quoted 5 lines
Sure, that's easy!:-) I kept capitals initially, because all functions are called like FindDCB,
DoingSRB_Done, etc. But if we renamedc390_dcbintodc390_lun, we would have to rename all respective functions, but that's a bit too much, I think. So, is it ok to just "smallify" the types, going the Middle Way?:-)Yes.
Ok, attached. You didn't sign-off for it. After half an hour searching through my LKML archives I found that email from Linus, explaining what to do in this case:-) And it was pretty much what I had in head, so, I put "originally submitted" by you, and then signed-off myself. Ough. Hope, you don't mind:-)
James, please, apply.
Quoted 3 lines
Quoted 1 line
Do you want to rediff your 3rd patch yourself or should I do it?
I can rediff it.
Ok, thanks.
Quoted 5 lines
Quoted 2 lines
Essentially, as you know, up to now the "old" EH code was used by tmscsim. Switching to the "new" one seems a pretty essential change.
No. Old EH is completely gone in 2.6. The tmscsim driver claims to implement new EH but gets it wrong currently..
Ok, I was just confused by
#define OLD_EH
in dc390.h
I looked through this your patch. Ok, I more or less can understand it, great, thanks! One question, though. Is result = DID_ABORT << 16 no more needed in ->eh_abort_handler()?
And one more - del_timer in bus_reset. Shouldn't we rather drop the host_lock, call del_timer_sync and then re-accuire the lock? There might be some other places like that...
Quoted 7 lines
Quoted 4 lines
Is there a way
I could test it a bit? I can now boot and run from IDE, loading tmscsim as a module, to which I have a disk and a CD-ROM connected. How can I exercise eh-paths a bit without destroying the hardware?:-)A good way to test EH is to improperly terminate the bus and wait for failures to happen or similar things.
Hm, on that PC I can only boot either from SCSI or from a floppy. So, to test that I would have to make a boot-floppy... And then I would better disconnect the disk, right?:-)
Thanks
Guennadi
---
Guennadi Liakhovetski
Original version submitted on 24 June 2004 by Christoph Hellwig. Additions and modifications by:
drivers/scsi/scsiiom.c +153 -154
@@ -6,7 +6,7 @@***********************************************************************/ /* $Id: scsiiom.c,v 2.55.2.17 2000/12/20 00:39:37 garloff Exp $ */ static void __inline__ -dc390_freetag (PDCB pDCB,PSRB pSRB) +dc390_freetag (struct dc390_dcb * pDCB,struct dc390_srb * pSRB) {if (pSRB->TagNumber <255 ) { pDCB->TagMask &= ~(1 << pSRB->TagNumber);/* free tag mask */
@@ -15,10 +15,10 @@ } -static UCHAR -dc390_StartSCSI (PACB pACB,PDCB pDCB,PSRB pSRB ) +static u8 +dc390_StartSCSI (struct dc390_acb * pACB,struct dc390_dcb * pDCB,struct dc390_srb * pSRB ) { -UCHAR cmd;UCHAR disc_allowed, try_sync_nego; +u8 cmd;u8 disc_allowed, try_sync_nego; pSRB->ScsiPhase =SCSI_NOP0 ;
@@ -69,7 +69,7 @@/* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */ if ((pDCB->SyncMode &EN_TAG_QUEUEING ) && disc_allowed) { -UCHAR tag_no =0 ; +u8 tag_no =0 ;while ((1 << tag_no) & pDCB->TagMask) tag_no++;if (tag_no >=sizeof (pDCB->TagMask)*8 || tag_no >= pDCB->MaxCommand) {printk (KERN_WARNING "DC390: Out of tags for Dev. %02x %02x\n" , pDCB->TargetID, pDCB->TargetLUN);
@@ -92,7 +92,7 @@if (try_sync_nego) { -UCHAR Sync_Off = pDCB->SyncOffset; +u8 Sync_Off = pDCB->SyncOffset;DEBUG0 (printk (KERN_INFO "DC390: NEW Sync Nego code triggered (%i %i)\n" , pDCB->TargetID, pDCB->TargetLUN)); pSRB->MsgOutBuf[0 ] =EXTENDED_MESSAGE ; pSRB->MsgOutBuf[1 ] =3 ;
@@ -121,8 +121,8 @@ }else /* write cmnd to bus */ { -PUCHAR ptr;UCHAR i; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; +u8 *ptr;u8 i; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i<pSRB->pcmd->cmd_len; i++)DC390_write8 (ScsiFifo, *(ptr++)); }
@@ -154,18 +154,17 @@#if DMA_INT /* This is similar to AM53C974.c ... */ -static UCHAR -dc390_dma_intr (PACB pACB) +static u8 +dc390_dma_intr (struct dc390_acb * pACB) { -PSRB pSRB; -UCHAR dstate; - DEBUG0(USHORT pstate;PDEVDECL1); +struct dc390_srb * pSRB; +u8 dstate; + DEBUG0(u16 pstate; struct pci_dev *pdev = pACB->pdev); -DEBUG0 (PDEVSET1 ); -DEBUG0 (PCI_READ_CONFIG_WORD (PDEV ,PCI_STATUS , &pstate)); +DEBUG0 (pci_read_config_word (pdev,PCI_STATUS , &pstate)); DEBUG0(if (pstate & (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY))\ {printk (KERN_WARNING "DC390: PCI state = %04x!\n" , pstate); \ -PCI_WRITE_CONFIG_WORD (PDEV ,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); +pci_write_config_word (pdev,PCI_STATUS , (PCI_STATUS_SIG_SYSTEM_ERROR |PCI_STATUS_DETECTED_PARITY ));}); dstate =DC390_read8 (DMA_Status);
@@ -179,7 +178,7 @@ }if (dstate &DMA_XFER_DONE ) { -UINT residual, xferCnt;int ctr =6000000 ; +u32 residual, xferCnt;int ctr =6000000 ;if (! (DC390_read8 (DMA_Cmd) &READ_DIRECTION )) { do
@@ -217,18 +216,18 @@static irqreturn_t __inline__DC390_Interrupt (int irq,void *dev_id,struct pt_regs *regs) { -PACB pACB, pACB2; -PDCB pDCB; -PSRB pSRB; -UCHAR sstatus=0 ; -UCHAR phase; -void (*stateV)(PACB ,PSRB ,PUCHAR ); -UCHAR istate, istatus; +struct dc390_acb *pACB, *pACB2; +struct dc390_dcb *pDCB; +struct dc390_srb *pSRB; +u8 sstatus=0 ; +u8 phase; +void (*stateV)(struct dc390_acb *,struct dc390_srb *,u8 *); +u8 istate, istatus;#if DMA_INT -UCHAR dstatus; +u8 dstatus;#endif - pACB = (PACB )dev_id; + pACB = (struct dc390_acb *)dev_id;for (pACB2 = dc390_pACB_start; (pACB2 && pACB2 != pACB); pACB2 = pACB2->pNextACB);if (!pACB2) {
@@ -323,7 +322,7 @@ ( *stateV )( pACB, pSRB, &sstatus ); pSRB->ScsiPhase = sstatus &7 ; - phase = (UCHAR ) sstatus &7 ; + phase = (u8 ) sstatus &7 ;DEBUG1 (printk (KERN_INFO "DC390: [%i]%s(1) (%02x)\n" , phase, dc390_p1_str[phase], sstatus)); stateV = (void *) dc390_phase1[phase]; ( *stateV )( pACB, pSRB, &sstatus );
@@ -345,12 +344,12 @@ }static void -dc390_DataOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOut_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { -UCHAR sstatus; -PSGL psgl; -UINT ResidCnt, xferCnt; -UCHAR dstate =0 ; +u8 sstatus; +struct scatterlist *psgl; +u32 ResidCnt, xferCnt; +u8 dstate =0 ; sstatus = *psstatus;
@@ -390,10 +389,10 @@ }else { - ResidCnt = (UINT )DC390_read8 (Current_Fifo) &0x1f ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_High) <<16 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Mid) <<8 ; - ResidCnt += (UINT )DC390_read8 (CtcReg_Low); + ResidCnt = (u32 )DC390_read8 (Current_Fifo) &0x1f ; + ResidCnt |= (u32 )DC390_read8 (CtcReg_High) <<16 ; + ResidCnt |= (u32 )DC390_read8 (CtcReg_Mid) <<8 ; + ResidCnt += (u32 )DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt;
@@ -409,13 +408,13 @@ }static void -dc390_DataIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataIn_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { -UCHAR sstatus, residual, bval; -PSGL psgl; -UINT ResidCnt, i; -ULONG xferCnt; -PUCHAR ptr; +u8 sstatus, residual, bval; +struct scatterlist *psgl; +u32 ResidCnt, i; +unsigned long xferCnt; +u8 *ptr; sstatus = *psstatus;
@@ -443,9 +442,9 @@ } dc390_laststatus &= ~0xff000000 ; dc390_laststatus |= dstate <<24 ; -DEBUG1 (ResidCnt = ((ULONG )DC390_read8 (CtcReg_High) <<16 ) \ - + ((ULONG )DC390_read8 (CtcReg_Mid) <<8 ) \ - + ((ULONG )DC390_read8 (CtcReg_Low))); +DEBUG1 (ResidCnt = ((unsigned long )DC390_read8 (CtcReg_High) <<16 ) \ + + ((unsigned long )DC390_read8 (CtcReg_Mid) <<8 ) \ + + ((unsigned long )DC390_read8 (CtcReg_Low)));DEBUG1 (printk (KERN_DEBUG "Count_2_Zero (ResidCnt=%i,ToBeXfer=%li)," , ResidCnt, pSRB->SGToBeXferLen));DC390_write8 (DMA_Cmd,READ_DIRECTION +DMA_IDLE_CMD );/* | DMA_INT */
@@ -501,11 +500,11 @@ dc390_laststatus &= ~0xff000000 ; dc390_laststatus |= bval <<24 ;DEBUG1 (printk (KERN_DEBUG "Blast: Read %i times DMA_Status %02x" ,0xa000 -i, bval)); - ResidCnt = (UINT )DC390_read8 (CtcReg_High); + ResidCnt = (u32 )DC390_read8 (CtcReg_High); ResidCnt <<=8 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Mid); + ResidCnt |= (u32 )DC390_read8 (CtcReg_Mid); ResidCnt <<=8 ; - ResidCnt |= (UINT )DC390_read8 (CtcReg_Low); + ResidCnt |= (u32 )DC390_read8 (CtcReg_Low); xferCnt = pSRB->SGToBeXferLen - ResidCnt; pSRB->SGBusAddr += xferCnt;
@@ -515,7 +514,7 @@if ( residual ) { bval =DC390_read8 (ScsiFifo);/* get one residual byte */ - ptr = (PUCHAR )bus_to_virt ( pSRB->SGBusAddr ); + ptr = (u8 *)bus_to_virt ( pSRB->SGBusAddr ); *ptr = bval; pSRB->SGBusAddr++; xferCnt++; pSRB->TotalXferredLen++;
@@ -534,12 +533,12 @@ }static void -dc390_Command_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Command_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { }static void -dc390_Status_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Status_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { pSRB->TargetStatus =DC390_read8 (ScsiFifo);
@@ -552,7 +551,7 @@ }static void -dc390_MsgOut_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOut_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) {if ( pSRB->SRBState & (SRB_UNEXPECT_RESEL +SRB_ABORT_SENT ) ) *psstatus =SCSI_NOP0 ;
@@ -561,7 +560,7 @@static void __inline__ -dc390_reprog (PACB pACB,PDCB pDCB) +dc390_reprog (struct dc390_acb * pACB,struct dc390_dcb * pDCB) {DC390_write8 (Sync_Period, pDCB->SyncPeriod);DC390_write8 (Sync_Offset, pDCB->SyncOffset);
@@ -573,7 +572,7 @@#ifdef DC390_DEBUG0 static void -dc390_printMsg (UCHAR *MsgBuf,UCHAR len) +dc390_printMsg (u8 *MsgBuf,u8 len) {int i;printk (" %02x" , MsgBuf[0 ]);
@@ -587,7 +586,7 @@/* reject_msg */ static void __inline__ -dc390_MsgIn_reject (PACB pACB,PSRB pSRB) +dc390_MsgIn_reject (struct dc390_acb * pACB,struct dc390_srb * pSRB) { pSRB->MsgOutBuf[0 ] =MESSAGE_REJECT ; pSRB->MsgCnt =1 ;DC390_ENABLE_MSGOUT ;
@@ -596,18 +595,18 @@/* abort command */ static void __inline__ -dc390_EnableMsgOut_Abort (PACB pACB,PSRB pSRB ) +dc390_EnableMsgOut_Abort (struct dc390_acb * pACB,struct dc390_srb * pSRB ) { pSRB->MsgOutBuf[0 ] =ABORT ; pSRB->MsgCnt =1 ;DC390_ENABLE_MSGOUT ; pSRB->pSRBDCB->DCBFlag &= ~ABORT_DEV_ ; } -static PSRB -dc390_MsgIn_QTag (PACB pACB,PDCB pDCB,UCHAR tag) +static struct dc390_srb * +dc390_MsgIn_QTag (struct dc390_acb * pACB,struct dc390_dcb * pDCB,u8 tag) { -PSRB lastSRB = pDCB->pGoingLast; -PSRB pSRB = pDCB->pGoingSRB; +struct dc390_srb * lastSRB = pDCB->pGoingLast; +struct dc390_srb * pSRB = pDCB->pGoingSRB;if (pSRB) {
@@ -645,9 +644,9 @@/* set async transfer mode */ static void -dc390_MsgIn_set_async (PACB pACB,PSRB pSRB) +dc390_MsgIn_set_async (struct dc390_acb * pACB,struct dc390_srb * pSRB) { -PDCB pDCB = pSRB->pSRBDCB; +struct dc390_dcb * pDCB = pSRB->pSRBDCB;if (!(pSRB->SRBState &DO_SYNC_NEGO ))printk (KERN_INFO "DC390: Target %i initiates Non-Sync?\n" , pDCB->TargetID); pSRB->SRBState &= ~DO_SYNC_NEGO ;
@@ -663,13 +662,13 @@/* set sync transfer mode */ static void -dc390_MsgIn_set_sync (PACB pACB,PSRB pSRB) +dc390_MsgIn_set_sync (struct dc390_acb * pACB,struct dc390_srb * pSRB) { -UCHAR bval; -USHORT wval, wval1; -PDCB pDCB = pSRB->pSRBDCB; -UCHAR oldsyncperiod = pDCB->SyncPeriod; -UCHAR oldsyncoffset = pDCB->SyncOffset; +u8 bval; +u16 wval, wval1; +struct dc390_dcb * pDCB = pSRB->pSRBDCB; +u8 oldsyncperiod = pDCB->SyncPeriod; +u8 oldsyncoffset = pDCB->SyncOffset;if (!(pSRB->SRBState &DO_SYNC_NEGO )) {
@@ -702,7 +701,7 @@ pDCB->SyncOffset |= pSRB->MsgInBuf[4 ]; pDCB->NegoPeriod = pSRB->MsgInBuf[3 ]; - wval = (USHORT ) pSRB->MsgInBuf[3 ]; + wval = (u16 ) pSRB->MsgInBuf[3 ]; wval = wval <<2 ; wval -=3 ; wval1 = wval /25 ;/* compute speed */ if ( (wval1 *25 ) != wval) wval1++; bval =FAST_CLK +FAST_SCSI ;/* fast clock / fast scsi */
@@ -722,7 +721,7 @@ } pDCB->CtrlR3 = bval; - pDCB->SyncPeriod = (UCHAR )wval1; + pDCB->SyncPeriod = (u8 )wval1;if ((oldsyncperiod != wval1 || oldsyncoffset != pDCB->SyncOffset) && pDCB->TargetLUN ==0 ) {
@@ -738,20 +737,20 @@/* handle RESTORE_PTR */ /* I presume, this command is already mapped, so, have to remap. */ static void -dc390_restore_ptr (PACB pACB,PSRB pSRB) +dc390_restore_ptr (struct dc390_acb * pACB,struct dc390_srb * pSRB) { -Scsi_Cmnd * pcmd = pSRB->pcmd; -PSGL psgl; +struct scsi_cmnd *pcmd = pSRB->pcmd; +struct scatterlist *psgl; pSRB->TotalXferredLen =0 ; pSRB->SGIndex =0 ;if (pcmd->use_sg) { - pSRB->pSegmentList = (PSGL ) pcmd->request_buffer; + pSRB->pSegmentList = (struct scatterlist *)pcmd->request_buffer; psgl = pSRB->pSegmentList;//dc390_pci_sync(pSRB); -while (pSRB->TotalXferredLen + (ULONG )sg_dma_len (psgl) < pSRB->Saved_Ptr) +while (pSRB->TotalXferredLen + (unsigned long )sg_dma_len (psgl) < pSRB->Saved_Ptr) { - pSRB->TotalXferredLen += (ULONG )sg_dma_len (psgl); + pSRB->TotalXferredLen += (unsigned long )sg_dma_len (psgl); pSRB->SGIndex++;if ( pSRB->SGIndex < pSRB->SGcount ) {
@@ -773,7 +772,7 @@sg_dma_len (&pSRB->Segmentx) = pcmd->request_bufflen - pSRB->Saved_Ptr; pSRB->SGcount =1 ; - pSRB->pSegmentList = (PSGL ) &pSRB->Segmentx; + pSRB->pSegmentList = (struct scatterlist *) &pSRB->Segmentx; }else { pSRB->SGcount =0 ;printk (KERN_INFO "DC390: RESTORE_PTR message for Transfer without Scatter-Gather ??\n" );
@@ -792,8 +791,8 @@/* The old implementation was correct. Sigh! */ /* Check if the message is complete */ -static UCHAR __inline__ -dc390_MsgIn_complete (UCHAR *msgbuf,UINT len) +static u8 __inline__ +dc390_MsgIn_complete (u8 *msgbuf,u32 len) {if (*msgbuf ==EXTENDED_MESSAGE ) {
@@ -809,9 +808,9 @@/* read and eval received messages */ static void -dc390_MsgIn_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgIn_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { -PDCB pDCB = pACB->pActiveDCB; +struct dc390_dcb * pDCB = pACB->pActiveDCB;/* Read the msg */
@@ -856,7 +855,7 @@// nothing has to be done case COMMAND_COMPLETE :break ; -// SAVE POINTER may be ignored as we have the PSRB associated with the +// SAVE POINTER may be ignored as we have the struct dc390_srb* associated with the // scsi command. Thanks, Gerard, for pointing it out. case SAVE_POINTERS : pSRB->Saved_Ptr = pSRB->TotalXferredLen;
@@ -883,11 +882,11 @@static void -dc390_DataIO_Comm (PACB pACB,PSRB pSRB,UCHAR ioDir) +dc390_DataIO_Comm (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 ioDir) { -PSGL psgl; -ULONG lval; -PDCB pDCB = pACB->pActiveDCB; +struct scatterlist *psgl; +unsigned long lval; +struct dc390_dcb * pDCB = pACB->pActiveDCB;if (pSRB == pACB->pTmpSRB) {
@@ -913,11 +912,11 @@ } lval = pSRB->SGToBeXferLen;DEBUG1 (printk (KERN_DEBUG " DC390: Start transfer: %li bytes (address %08lx)\n" , lval, pSRB->SGBusAddr)); -DC390_write8 (CtcReg_Low, (UCHAR ) lval); +DC390_write8 (CtcReg_Low, (u8 ) lval); lval >>=8 ; -DC390_write8 (CtcReg_Mid, (UCHAR ) lval); +DC390_write8 (CtcReg_Mid, (u8 ) lval); lval >>=8 ; -DC390_write8 (CtcReg_High, (UCHAR ) lval); +DC390_write8 (CtcReg_High, (u8 ) lval);DC390_write32 (DMA_XferCnt, pSRB->SGToBeXferLen);DC390_write32 (DMA_XferAddr, pSRB->SGBusAddr);
@@ -956,36 +955,36 @@static void -dc390_DataOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataOutPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,WRITE_DIRECTION ); }static void -dc390_DataInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_DataInPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) {dc390_DataIO_Comm (pACB, pSRB,READ_DIRECTION ); }static void -dc390_CommandPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_CommandPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { -PDCB pDCB; -UCHAR i, cnt; -PUCHAR ptr; +struct dc390_dcb * pDCB; +u8 i, cnt; +u8 *ptr;DC390_write8 (ScsiCmd,RESET_ATN_CMD );DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBFlag &AUTO_REQSENSE ) ) { - cnt = (UCHAR ) pSRB->pcmd->cmd_len; - ptr = (PUCHAR ) pSRB->pcmd->cmnd; + cnt = (u8 ) pSRB->pcmd->cmd_len; + ptr = (u8 *) pSRB->pcmd->cmnd;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); }else { -UCHAR bval =0 ; +u8 bval =0 ;DC390_write8 (ScsiFifo,REQUEST_SENSE ); pDCB = pACB->pActiveDCB;DC390_write8 (ScsiFifo, pDCB->TargetLUN <<5 );
@@ -1000,7 +999,7 @@ }static void -dc390_StatusPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_StatusPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); pSRB->SRBState =SRB_STATUS ;
@@ -1009,11 +1008,11 @@ }static void -dc390_MsgOutPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgOutPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { -UCHAR bval, i, cnt; -PUCHAR ptr; -PDCB pDCB; +u8 bval, i, cnt; +u8 *ptr; +struct dc390_dcb * pDCB;DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); pDCB = pACB->pActiveDCB;
@@ -1022,7 +1021,7 @@ cnt = pSRB->MsgCnt;if ( cnt ) { - ptr = (PUCHAR ) pSRB->MsgOutBuf; + ptr = (u8 *) pSRB->MsgOutBuf;for (i=0 ; i < cnt; i++)DC390_write8 (ScsiFifo, *(ptr++)); pSRB->MsgCnt =0 ;
@@ -1062,7 +1061,7 @@ }static void -dc390_MsgInPhase (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_MsgInPhase (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) {DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );if ( !(pSRB->SRBState &SRB_MSGIN ) )
@@ -1075,21 +1074,21 @@ }static void -dc390_Nop_0 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_0 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { }static void -dc390_Nop_1 (PACB pACB,PSRB pSRB,PUCHAR psstatus) +dc390_Nop_1 (struct dc390_acb * pACB,struct dc390_srb * pSRB,u8 *psstatus) { }static void -dc390_SetXferRate (PACB pACB,PDCB pDCB ) +dc390_SetXferRate (struct dc390_acb * pACB,struct dc390_dcb * pDCB ) { -UCHAR bval, i, cnt; -PDCB ptr; +u8 bval, i, cnt; +struct dc390_dcb * ptr;if ( !(pDCB->TargetLUN) ) {
@@ -1117,11 +1116,11 @@static void -dc390_Disconnect (PACB pACB ) +dc390_Disconnect (struct dc390_acb * pACB ) { -PDCB pDCB; -PSRB pSRB, psrb; -UCHAR i, cnt; +struct dc390_dcb *pDCB; +struct dc390_srb *pSRB, *psrb; +u8 i, cnt;DEBUG0 (printk (KERN_INFO "DISC," ));
@@ -1198,11 +1197,11 @@static void -dc390_Reselect (PACB pACB ) +dc390_Reselect (struct dc390_acb * pACB ) { -PDCB pDCB; -PSRB pSRB; -UCHAR id, lun; +struct dc390_dcb * pDCB; +struct dc390_srb * pSRB; +u8 id, lun;DEBUG0 (printk (KERN_INFO "RSEL," )); pACB->Connected =1 ;
@@ -1283,10 +1282,10 @@DC390_write8 (ScsiCmd,MSG_ACCEPTED_CMD );/* ;to release the /ACK signal */ } -static UCHAR __inline__ +static u8 __inline__dc390_tagq_blacklist (char * name) { -UCHAR i; +u8 i;for (i=0 ; i<BADDEVCNT ; i++)if (memcmp (name, dc390_baddevname1[i],28 ) ==0 )return 1 ;
@@ -1295,7 +1294,7 @@static void -dc390_disc_tagq_set (PDCB pDCB,PSCSI_INQDATA ptr) +dc390_disc_tagq_set (struct dc390_dcb * pDCB,PSCSI_INQDATA ptr) {/* Check for SCSI format (ANSI and Response data format) */ if ( (ptr->Vers &0x07 ) >=2 || (ptr->RDF &0x0F ) ==2 )
@@ -1317,9 +1316,9 @@static void -dc390_add_dev (PACB pACB,PDCB pDCB,PSCSI_INQDATA ptr) +dc390_add_dev (struct dc390_acb * pACB,struct dc390_dcb * pDCB,PSCSI_INQDATA ptr) { -UCHAR bval1 = ptr->DevType &SCSI_DEVTYPE ; +u8 bval1 = ptr->DevType &SCSI_DEVTYPE ; pDCB->DevType = bval1;/* if (bval1 == TYPE_DISK || bval1 == TYPE_MOD) */ dc390_disc_tagq_set (pDCB, ptr);
@@ -1327,22 +1326,24 @@static void -dc390_SRBdone (PACB pACB,PDCB pDCB,PSRB pSRB ) +dc390_SRBdone (struct dc390_acb * pACB,struct dc390_dcb * pDCB,struct dc390_srb * pSRB ) { -UCHAR bval, status, i; -PSCSICMD pcmd; +u8 bval, status, i; +struct scsi_cmnd *pcmd;PSCSI_INQDATA ptr; -PSGL ptr2; -ULONG swlval; +struct scatterlist *ptr2; +unsigned long swlval; pcmd = pSRB->pcmd;/* KG: Moved pci_unmap here */ dc390_pci_unmap (pSRB); status = pSRB->TargetStatus; - ptr = (PSCSI_INQDATA ) (pcmd->request_buffer); -if ( pcmd->use_sg ) - ptr = (PSCSI_INQDATA ) (page_address (((PSGL ) ptr)->page) + ((PSGL ) ptr)->offset); +if (pcmd->use_sg) { + ptr2 = (struct scatterlist *) (pcmd->request_buffer); + ptr = (PSCSI_INQDATA ) (page_address (ptr2->page) + ptr2->offset); + }else + ptr = (PSCSI_INQDATA ) (pcmd->request_buffer);DEBUG0 (printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n" , status, pcmd->result,\ pSRB, pcmd->pid));
@@ -1379,7 +1380,7 @@ }if (pSRB->RetryCnt ==0 ) { -//(UINT)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; +//(u32)(pSRB->pcmd->cmnd[0]) = pSRB->Segment0[0]; pSRB->TotalXferredLen = pSRB->SavedTotXLen;if ( (pSRB->TotalXferredLen) && (pSRB->TotalXferredLen >= pcmd->underflow) )
@@ -1387,7 +1388,7 @@else pcmd->result =MK_RES_LNX (DRIVER_SENSE ,DID_OK ,0 ,CHECK_CONDITION );REMOVABLEDEBUG (printk (KERN_INFO "Cmd=%02x,Result=%08x,XferL=%08x\n" ,pSRB->pcmd->cmnd[0 ],\ - (UINT ) pcmd->result, (UINT ) pSRB->TotalXferredLen)); + (u32 ) pcmd->result, (u32 ) pSRB->TotalXferredLen)); goto ckc_e; }else /* Retry */
@@ -1395,19 +1396,17 @@ pSRB->RetryCnt--; pSRB->AdaptStatus =0 ; pSRB->TargetStatus =0 ; -//*((PUINT) &(pSRB->CmdBlock[0])) = pSRB->Segment0[0]; -//*((PUINT) &(pSRB->CmdBlock[4])) = pSRB->Segment0[1]; /* Don't retry on TEST_UNIT_READY */ if ( pSRB->pcmd->cmnd[0 ] ==TEST_UNIT_READY /* || pSRB->pcmd->cmnd[0] == START_STOP */ ) { pcmd->result =MK_RES_LNX (DRIVER_SENSE ,DID_OK ,0 ,CHECK_CONDITION );REMOVABLEDEBUG (printk (KERN_INFO "Cmd=%02x, Result=%08x, XferL=%08x\n" ,pSRB->pcmd->cmnd[0 ],\ - (UINT ) pcmd->result, (UINT ) pSRB->TotalXferredLen)); + (u32 ) pcmd->result, (u32 ) pSRB->TotalXferredLen)); goto ckc_e; }SET_RES_DRV (pcmd->result,DRIVER_SENSE ); pcmd->use_sg = pSRB->SavedSGCount; -//pSRB->ScsiCmdLen = (UCHAR) (pSRB->Segment1[0] >> 8); +//pSRB->ScsiCmdLen = (u8) (pSRB->Segment1[0] >> 8); DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n" , pcmd->pid, pcmd->cmnd[0 ], pcmd->device->id, pcmd->device->lun)); pSRB->SGIndex =0 ; pSRB->TotalXferredLen =0 ;
@@ -1437,14 +1436,14 @@ ptr2++; }REMOVABLEDEBUG (printk (KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n" ,\ - (UINT ) pSRB->TotalXferredLen, (UINT ) swlval)); + (u32 ) pSRB->TotalXferredLen, (u32 ) swlval)); }dc390_RequestSense ( pACB, pDCB, pSRB );return ; }else if (status_byte (status) ==QUEUE_FULL ) { - bval = (UCHAR ) pDCB->GoingSRBCnt; + bval = (u8 ) pDCB->GoingSRBCnt; bval--; pDCB->MaxCommand = bval;dc390_freetag (pDCB, pSRB);
@@ -1569,12 +1568,12 @@/* Remove all SRBs from Going list and inform midlevel */ static void -dc390_DoingSRB_Done (PACB pACB,PSCSICMD cmd ) +dc390_DoingSRB_Done (struct dc390_acb * pACB,struct scsi_cmnd *cmd) { -PDCB pDCB, pdcb; -PSRB psrb, psrb2; -UCHAR i; -PSCSICMD pcmd; +struct dc390_dcb *pDCB, *pdcb; +struct dc390_srb *psrb, *psrb2; +u8 i; +struct scsi_cmnd *pcmd; pDCB = pACB->pLinkDCB; pdcb = pDCB;
@@ -1610,7 +1609,7 @@static void -dc390_ResetSCSIBus (PACB pACB ) +dc390_ResetSCSIBus (struct dc390_acb * pACB ) {//DC390_write8 (ScsiCmd, RST_DEVICE_CMD); //udelay (250);
@@ -1625,7 +1624,7 @@ }static void -dc390_ScsiRstDetect (PACB pACB ) +dc390_ScsiRstDetect (struct dc390_acb * pACB ) {printk ("DC390: Rst_Detect: laststat = %08x\n" , dc390_laststatus);//DEBUG0(printk(KERN_INFO "RST_DETECT,"));
@@ -1658,9 +1657,9 @@static void __inline__ -dc390_RequestSense (PACB pACB,PDCB pDCB,PSRB pSRB ) +dc390_RequestSense (struct dc390_acb * pACB,struct dc390_dcb * pDCB,struct dc390_srb * pSRB ) { -PSCSICMD pcmd; +struct scsi_cmnd *pcmd; pcmd = pSRB->pcmd;
@@ -1668,9 +1667,9 @@ pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN)); pSRB->SRBFlag |=AUTO_REQSENSE ; -//pSRB->Segment0[0] = (UINT) pSRB->CmdBlock[0]; -//pSRB->Segment0[1] = (UINT) pSRB->CmdBlock[4]; -//pSRB->Segment1[0] = ((UINT)(pcmd->cmd_len) << 8) + pSRB->SGcount; +//pSRB->Segment0[0] = (u32) pSRB->CmdBlock[0]; +//pSRB->Segment0[1] = (u32) pSRB->CmdBlock[4]; +//pSRB->Segment1[0] = ((u32)(pcmd->cmd_len) << 8) + pSRB->SGcount; //pSRB->Segment1[1] = pSRB->TotalXferredLen; pSRB->SavedSGCount = pcmd->use_sg; pSRB->SavedTotXLen = pSRB->TotalXferredLen;
@@ -1683,8 +1682,8 @@//pSRB->CmdBlock[0] = REQUEST_SENSE; //pSRB->CmdBlock[1] = pDCB->TargetLUN << 5; -//(USHORT) pSRB->CmdBlock[2] = 0; -//(USHORT) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer); +//(u16) pSRB->CmdBlock[2] = 0; +//(u16) pSRB->CmdBlock[4] = sizeof(pcmd->sense_buffer); //pSRB->ScsiCmdLen = 6; pSRB->TotalXferredLen =0 ;
@@ -1698,7 +1697,7 @@static void __inline__ -dc390_InvalidCmd (PACB pACB ) +dc390_InvalidCmd (struct dc390_acb * pACB ) {if ( pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_ +SRB_MSGOUT ) )DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );
drivers/scsi/tmscsim.c +196 -239
949 lines not on this page · raw message
drivers/scsi/tmscsim.h +114 -162
370 lines not on this page · raw message
Quoted 3 lines · Christoph Hellwig
Quoted 1 line
Do you want to rediff your 3rd patch yourself or should I do it?
I can rediff it.
Christoph, attached is a port of your patch to my current (after the bug-2139 patch, they don't collide, however) tree. Please, have a look if I've done it right. Notice, I didn't change the del_timer() call, I'd like to hear somebody's comments to it, and, as said before, there are 2 more places, where del_timer() is called, so, if indeed needed, they can be addressed together in a separate patch.
Thanks
Guennadi
---
Guennadi Liakhovetski
drivers/scsi/dc390.h +0 -32
@@ -1,32 +0,0 @@ -/*********************************************************************** -* FILE NAME : DC390.H * -* BY : C.L. Huang * -* Description: Device Driver for Tekram DC-390(T) PCI SCSI * -* Bus Master Host Adapter * -***********************************************************************/ -/* $Id: dc390.h,v 2.43.2.22 2000/12/20 00:39:36 garloff Exp $ */ - -/* -* DC390/AMD 53C974 driver, header file -*/ - -#ifndef DC390_H -#define DC390_H - -#include <linux/version.h> - -#define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.1d 2004-05-27" - -/* We don't have eh_abort_handler, eh_device_reset_handler, -* eh_bus_reset_handler, eh_host_reset_handler yet! -* So long: Use old exception handling :-( */ -#define OLD_EH - -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,1 ,70 ) || defined (OLD_EH ) -# define NEW_EH -#else -# define NEW_EH use_new_eh_code: 1, -# define USE_NEW_EH -#endif -#endif /* DC390_H */
drivers/scsi/scsiiom.c +0 -12
@@ -1594,18 +1594,6 @@ psrb2 = psrb->pNextSRB; pcmd = psrb->pcmd;dc390_Free_insert (pACB, psrb); -#ifndef USE_NEW_EH -/* New EH will crash on being given timed out cmnds */ -if (pcmd == cmd) - pcmd->result =MK_RES (0 ,DID_ABORT ,0 ,0 ); -else - pcmd->result =MK_RES (0 ,DID_RESET ,0 ,0 ); - -/* ReleaseSRB( pDCB, pSRB ); */ - -DEBUG0 (printk (KERN_DEBUG "DC390: DoingSRB_Done: done pid %li\n" , pcmd->pid)); - pcmd->scsi_done ( pcmd ); -#endif psrb = psrb2; } pdcb->GoingSRBCnt =0 ;
drivers/scsi/tmscsim.c +66 -216
336 lines not on this page · raw message
Quoted 7 lines · Guennadi Liakhovetski
Quoted 3 lines · Christoph Hellwig
Quoted 1 line
Do you want to rediff your 3rd patch yourself or should I do it?
I can rediff it.
Christoph, attached is a port of your patch to my current (after the bug-2139 patch, they don't collide, however) tree. Please, have a look if I've done it right.
Christoph, a bug in the "actual" (2.6.7) tmscsim error-handling was triggered by the patch from Kurt, removing the CONFIG_SCSI_REPORT_LUNS config-option, reported by Matthias Haase (he's also sent an email to you). My current tree, including your patch + a couple of other my irrelevant for this problem patches, doesn't have this problem! So, thanks again! And this is yet another reason to get your patch into the scsi-misc. I guess, your confirmation, that my port is ok, is needed.
Quoted 1 line
Notice, I didn't change the
del_timer()call, I'd like to hear somebody's comments to it, and, as said before, there are 2 more places, wheredel_timer()is called, so, if indeed needed, they can be addressed together in a separate patch.
That's still on the TODO.
Thanks
Guennadi
---
Guennadi Liakhovetski