Commit 65ccf7f1 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Bottomley

[PATCH] tmscsim: 64-bit cleanup

Ok, here comes the first one. I chose this one because it fixes an actual
bug in the driver. This bug was (partially) introduced by myself when
porting to 2.6. Partly the reason was that I disliked using
function-like macros as lvalues:

sg_dma_address(x) = ...
sg_dma_len(x) = ...

[OT] wouldn't it be better to introduce some macros like
set_sg_dma_{address|len}(x, y)?

A part of the original patch has already been merged (s/UINT/ULONG/), so,
the actual version is re-diffed against 2.6.6-bk6 and re-tested (on a
plain Pentium).

Also updates the driver-version, printed on startup.
parent 7d2370c1
......@@ -19,7 +19,7 @@
#endif
#define DC390_BANNER "Tekram DC390/AM53C974"
#define DC390_VERSION "2.0f 2000-12-20"
#define DC390_VERSION "2.1b 2004-04-13"
/* We don't have eh_abort_handler, eh_device_reset_handler,
* eh_bus_reset_handler, eh_host_reset_handler yet!
......
......@@ -740,9 +740,9 @@ dc390_restore_ptr (PACB pACB, PSRB pSRB)
psgl = pSRB->pSegmentList;
//dc390_pci_sync(pSRB);
while (pSRB->TotalXferredLen + (ULONG) psgl->length < pSRB->Saved_Ptr)
while (pSRB->TotalXferredLen + (ULONG) sg_dma_len(psgl) < pSRB->Saved_Ptr)
{
pSRB->TotalXferredLen += (ULONG) psgl->length;
pSRB->TotalXferredLen += (ULONG) sg_dma_len(psgl);
pSRB->SGIndex++;
if( pSRB->SGIndex < pSRB->SGcount )
{
......@@ -762,7 +762,7 @@ dc390_restore_ptr (PACB pACB, PSRB pSRB)
} else if(pcmd->request_buffer) {
//dc390_pci_sync(pSRB);
pSRB->Segmentx.length = pcmd->request_bufflen - pSRB->Saved_Ptr;
sg_dma_len(&pSRB->Segmentx) = pcmd->request_bufflen - pSRB->Saved_Ptr;
pSRB->SGcount = 1;
pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
} else {
......@@ -885,6 +885,8 @@ dc390_DataIO_Comm( PACB pACB, PSRB pSRB, UCHAR ioDir)
if (pDCB) printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (%02i-%i)\n",
pDCB->TargetID, pDCB->TargetLUN);
else printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (DCB 0!)\n");
pSRB->pSRBDCB = pDCB;
dc390_EnableMsgOut_Abort (pACB, pSRB);
if (pDCB) pDCB->DCBFlag |= ABORT_DEV;
return;
......@@ -1466,7 +1468,7 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB )
ptr2 = pSRB->pSegmentList;
for( i=pSRB->SGIndex; i < bval; i++)
{
swlval += ptr2->length;
swlval += sg_dma_len(ptr2);
ptr2++;
}
REMOVABLEDEBUG(printk(KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n",\
......
......@@ -168,6 +168,7 @@
* 2.1a 03/11/29 GL, KG Initial fixing for 2.6. Convert to *
* use the current PCI-mapping API, update *
* command-queuing. *
* 2.1b 04/04/13 GL Fix for 64-bit platforms *
***********************************************************************/
/* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */
......@@ -1022,7 +1023,7 @@ static int dc390_pci_map (PSRB pSRB)
pci_map_page(pdev, virt_to_page(pcmd->sense_buffer),
(unsigned long)pcmd->sense_buffer & ~PAGE_MASK, sizeof(pcmd->sense_buffer),
DMA_FROM_DEVICE);
pSRB->Segmentx.length = sizeof(pcmd->sense_buffer);
sg_dma_len(&pSRB->Segmentx) = sizeof(pcmd->sense_buffer);
pSRB->SGcount = 1;
pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
DEBUG1(printk("%s(): Mapped sense buffer %p at %x\n", __FUNCTION__, pcmd->sense_buffer, cmdp->saved_dma_handle));
......@@ -1043,7 +1044,7 @@ static int dc390_pci_map (PSRB pSRB)
(unsigned long)pcmd->request_buffer & ~PAGE_MASK,
pcmd->request_bufflen, scsi_to_pci_dma_dir(pcmd->sc_data_direction));
/* TODO: error handling */
pSRB->Segmentx.length = pcmd->request_bufflen;
sg_dma_len(&pSRB->Segmentx) = pcmd->request_bufflen;
pSRB->SGcount = 1;
pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
DEBUG1(printk("%s(): Mapped request buffer %p at %x\n", __FUNCTION__, pcmd->request_buffer, cmdp->saved_dma_handle));
......@@ -1180,7 +1181,7 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
/* Assume BAD_TARGET; will be cleared later */
cmd->result = DID_BAD_TARGET << 16;
/* TODO: Change the policy: Alway accept TEST_UNIT_READY or INQUIRY
/* TODO: Change the policy: Always accept TEST_UNIT_READY or INQUIRY
* commands and alloc a DCB for the device if not yet there. DCB will
* be removed in dc390_SRBdone if SEL_TIMEOUT */
......@@ -1767,7 +1768,7 @@ void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun )
PDCB pDCB, pDCB2;
pDCB = kmalloc (sizeof(DC390_DCB), GFP_ATOMIC);
DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n" \
DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n", \
id, lun, pDCB));
*ppDCB = pDCB;
......@@ -2229,10 +2230,13 @@ int __init DC390_detect (Scsi_Host_Template *psht)
if ( PCI_PRESENT )
while (PCI_FIND_DEVICE (PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974))
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30)
if (pci_enable_device (pdev))
continue;
#endif
if (pci_set_dma_mask(pdev, 0xffffffff)) {
printk(KERN_ERR "DC390(%i): No suitable DMA available.\n", dc390_adapterCnt);
continue;
}
PCI_GET_IO_AND_IRQ;
DEBUG0(printk(KERN_INFO "DC390(%i): IO_PORT=%04x,IRQ=%x\n", dc390_adapterCnt, (UINT) io_port, irq));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment