Index: Makefile.dc390 =================================================================== RCS file: /home/cvsroot/dc390/Attic/Makefile.dc390,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- Makefile.dc390 2000/05/18 07:42:35 1.1.2.2 +++ Makefile.dc390 2000/09/29 20:01:47 1.1.2.3 @@ -12,7 +12,7 @@ include $(KDIR)/Makefile TOPDIR := $(KDIR) -CFLAGS := -I. -I $(KDIR)/drivers/scsi $(CFLAGS) -DMODULE +CFLAGS := -I. -I $(KDIR)/drivers/scsi -I $(KDIR)/include $(CFLAGS) -DMODULE tmscsim.o: dc390.h tmscsim.h scsiiom.c tmscsim.c arch Rules.make Index: README.tmscsim =================================================================== RCS file: /home/cvsroot/dc390/README.tmscsim,v retrieving revision 2.25.2.4 retrieving revision 2.25.2.5 diff -u -r2.25.2.4 -r2.25.2.5 --- README.tmscsim 2000/05/24 14:31:23 2.25.2.4 +++ README.tmscsim 2000/09/29 17:32:35 2.25.2.5 @@ -401,7 +401,7 @@ maybe the DC390 log messages to the report. Bug reports should be send to me (Kurt Garloff ) as well -as to the linux-scsi list (), as sometimes bugs +as to the linux-scsi list (), as sometimes bugs are caused by the SCSI mid-level code. I will ask you for some more details and probably I will also ask you to @@ -442,4 +442,4 @@ ------------------------------------------------------------------------- Written by Kurt Garloff 1998/06/11 Last updated 2000/01/17, driver revision 2.0d25 -$Id: README.tmscsim,v 2.25.2.4 2000/05/24 14:31:23 garloff Exp $ +$Id: README.tmscsim,v 2.25.2.5 2000/09/29 17:32:35 garloff Exp $ Index: dc390.h =================================================================== RCS file: /home/cvsroot/dc390/dc390.h,v retrieving revision 2.43.2.15 retrieving revision 2.43.2.16 diff -u -r2.43.2.15 -r2.43.2.16 --- dc390.h 2000/05/29 09:06:54 2.43.2.15 +++ dc390.h 2000/09/29 17:32:35 2.43.2.16 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390(T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: dc390.h,v 2.43.2.15 2000/05/29 09:06:54 garloff Exp $ */ +/* $Id: dc390.h,v 2.43.2.16 2000/09/29 17:32:35 garloff Exp $ */ /* * DC390/AMD 53C974 driver, header file @@ -19,7 +19,7 @@ #endif #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.0e2 2000/05/27" +#define DC390_VERSION "2.0e3 2000/09/29" /* We don't have eh_abort_handler, eh_device_reset_handler, * eh_bus_reset_handler, eh_host_reset_handler yet! @@ -47,9 +47,6 @@ # define DC390_release NULL #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30) -extern struct proc_dir_entry DC390_proc_scsi_tmscsim; -#endif extern int DC390_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30) @@ -72,6 +69,7 @@ use_clustering: DISABLE_CLUSTERING \ } #else +extern struct proc_dir_entry DC390_proc_scsi_tmscsim; #define DC390_T { \ proc_dir: &DC390_proc_scsi_tmscsim, \ proc_info: DC390_proc_info, \ Index: scsiiom.c =================================================================== RCS file: /home/cvsroot/dc390/scsiiom.c,v retrieving revision 2.55.2.11 retrieving revision 2.55.2.15 diff -u -r2.55.2.11 -r2.55.2.15 --- scsiiom.c 2000/05/25 15:18:37 2.55.2.11 +++ scsiiom.c 2000/09/29 19:56:14 2.55.2.15 @@ -4,7 +4,7 @@ * Description: Device Driver for Tekram DC-390 (T) PCI SCSI * * Bus Master Host Adapter * ***********************************************************************/ -/* $Id: scsiiom.c,v 2.55.2.11 2000/05/25 15:18:37 garloff Exp $ */ +/* $Id: scsiiom.c,v 2.55.2.15 2000/09/29 19:56:14 garloff Exp $ */ static void __inline__ dc390_freetag (PDCB pDCB, PSRB pSRB) @@ -56,7 +56,7 @@ * (pSRB->pcmd->cmnd[0] == TEST_UNIT_READY)) && pACB->scan_devices) ||*/ (pSRB->SRBFlag & AUTO_REQSENSE) ) disc_allowed = 0; - if ( (pDCB->SyncMode & SYNC_ENABLE) && (pDCB->TargetLUN == 0) && + if ( (pDCB->SyncMode & SYNC_ENABLE) && (pDCB->TargetLUN == 0) && (pSRB->pcmd->device->sync) && ( ( ( (pSRB->pcmd->cmnd[0] == REQUEST_SENSE) || (pSRB->SRBFlag & AUTO_REQSENSE) ) && !(pDCB->SyncMode & SYNC_NEGO_DONE) ) || (pSRB->pcmd->cmnd[0] == INQUIRY) ) ) try_sync_nego = 1; @@ -1366,6 +1366,10 @@ pcmd = pSRB->pcmd; DCB_removed = 0; status = pSRB->TargetStatus; + ptr = (PSCSI_INQDATA) (pcmd->request_buffer); + if( pcmd->use_sg ) + ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); + DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ pSRB, pcmd->pid);) if(pSRB->SRBFlag & AUTO_REQSENSE) @@ -1491,7 +1495,7 @@ /* Devices are removed below ... */ } else if (status_byte(status) == BUSY && - (pSRB->pcmd->cmnd[0] == TEST_UNIT_READY || pSRB->pcmd->cmnd[0] == INQUIRY) && + (pcmd->cmnd[0] == TEST_UNIT_READY || pcmd->cmnd[0] == INQUIRY) && pACB->scan_devices) { pSRB->AdaptStatus = 0; @@ -1553,14 +1557,33 @@ SET_RES_DID(pcmd->result,DID_OK); } } + if ((pcmd->result & RES_DID) == 0 && + pcmd->cmnd[0] == INQUIRY && + pcmd->cmnd[2] == 0 && + pcmd->request_bufflen >= 8 && + ptr && + (ptr->Vers & 0x07) >= 2) + { + if (ptr->Flags & SCSI_INQ_SYNC) + pcmd->device->sync = 1; + if (ptr->Flags & SCSI_INQ_WBUS16) + pcmd->device->wide = 1; + /* Handled by mid-layer + if (((unsigned char*)(pcmd->buffer))[7] & 0x02) + pcmd->device->tagged_supported = 1; + */ + } ckc_e: if( pACB->scan_devices ) { - if( pSRB->pcmd->cmnd[0] == TEST_UNIT_READY ) + if( pcmd->cmnd[0] == TEST_UNIT_READY /*|| + pcmd->cmnd[0] == INQUIRY*/) { #ifdef DC390_DEBUG0 - printk (KERN_INFO "DC390: Test_Unit_Ready: result: %08x", pcmd->result); + printk (KERN_INFO "DC390: %s: result: %08x", + (pcmd->cmnd[0] == INQUIRY? "INQUIRY": "TEST_UNIT_READY"), + pcmd->result); if (pcmd->result & (DRIVER_SENSE << 24)) printk (" (sense: %02x %02x %02x %02x)\n", pcmd->sense_buffer[0], pcmd->sense_buffer[1], pcmd->sense_buffer[2], pcmd->sense_buffer[3]); @@ -1590,12 +1613,9 @@ //if( pSRB->pcmd->cmnd[0] == INQUIRY && // (host_byte(pcmd->result) == DID_OK || status_byte(pcmd->result) & CHECK_CONDITION) ) - if( pSRB->pcmd->cmnd[0] == INQUIRY && + if( pcmd->cmnd[0] == INQUIRY && (pcmd->result == (DID_OK << 16) || status_byte(pcmd->result) & CHECK_CONDITION) ) { - ptr = (PSCSI_INQDATA) (pcmd->request_buffer); - if( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV) { /* device not present: remove */ Index: tmscsim.c =================================================================== RCS file: /home/cvsroot/dc390/tmscsim.c,v retrieving revision 2.60.2.22 retrieving revision 2.60.2.23 diff -u -r2.60.2.22 -r2.60.2.23 --- tmscsim.c 2000/05/29 09:06:54 2.60.2.22 +++ tmscsim.c 2000/09/29 17:32:35 2.60.2.23 @@ -7,7 +7,7 @@ ***********************************************************************/ /* (C) Copyright: put under GNU GPL in 10/96 (see README.tmscsim) * *************************************************************************/ -/* $Id: tmscsim.c,v 2.60.2.22 2000/05/29 09:06:54 garloff Exp $ */ +/* $Id: tmscsim.c,v 2.60.2.23 2000/09/29 17:32:35 garloff Exp $ */ /* Enhancements and bugfixes by * * Kurt Garloff * ***********************************************************************/ @@ -155,6 +155,9 @@ * 2.0e 00/05/22 KG Return residual for 2.3 * * 2.0e1 00/05/25 KG Compile fixes for 2.3.99 * * 2.0e2 00/05/27 KG Jeff Garzik's pci_enable_device() * + * 2.0e3 00/09/29 KG Some 2.4 changes. Don't try Sync Nego * + * before INQUIRY has reported ability. * + * Recognise INQUIRY as scanning command. * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ @@ -274,7 +277,7 @@ # if USE_SPINLOCKS == 3 /* both */ -# if defined (__SMP__) || DEBUG_SPINLOCKS > 0 +# if defined (CONFIG_SMP) || DEBUG_SPINLOCKS > 0 # define DC390_LOCKA_INIT { spinlock_t __unlocked = SPIN_LOCK_UNLOCKED; pACB->lock = __unlocked; }; # else # define DC390_LOCKA_INIT @@ -1200,7 +1203,8 @@ return (0); } - if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY) && !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) ) + if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) && + !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) ) { pACB->scan_devices = 1; @@ -1210,7 +1214,7 @@ printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", cmd->target, cmd->lun); DC390_UNLOCK_ACB; - printk ("DC390: No DCB in queuecommand!\n"); + printk ("DC390: No DCB in queue_command!\n"); #ifdef USE_NEW_EH return (1); #else Index: tmscsim.h =================================================================== RCS file: /home/cvsroot/dc390/tmscsim.h,v retrieving revision 2.15.2.1 retrieving revision 2.15.2.2 diff -u -r2.15.2.1 -r2.15.2.2 --- tmscsim.h 2000/02/08 21:53:57 2.15.2.1 +++ tmscsim.h 2000/09/29 17:32:36 2.15.2.2 @@ -3,12 +3,22 @@ ;* TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter * ;* Device Driver * ;***********************************************************************/ -/* $Id: tmscsim.h,v 2.15.2.1 2000/02/08 21:53:57 garloff Exp $ */ +/* $Id: tmscsim.h,v 2.15.2.2 2000/09/29 17:32:36 garloff Exp $ */ #ifndef _TMSCSIM_H #define _TMSCSIM_H #include +#include +/* 2.0 compat */ +#if defined(__SMP__) && !defined(CONFIG_SMP) +# if LINUX_VERSION_CODE < KERNEL_VERSION (2,2,0) +# define CONFIG_SMP +# else +# error __SMP__ defined but not CONFIG_SMP +# endif +#endif + #define IRQ_NONE 255 @@ -222,7 +232,7 @@ UCHAR pad; /* 0x3c: */ -#if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(__SMP__) || DEBUG_SPINLOCKS > 0) +#if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0) spinlock_t lock; #endif UCHAR sel_timeout; @@ -438,8 +448,12 @@ /* Peripheral Device Type definitions */ /* see include/scsi/scsi.h for the rest */ -#define TYPE_PRINTER 0x02 /* Printer device */ -#define TYPE_COMM 0x09 /* Communications device */ +#ifndef TYPE_PRINTER +# define TYPE_PRINTER 0x02 /* Printer device */ +#endif +#ifndef TYPE_COMM +# define TYPE_COMM 0x09 /* Communications device */ +#endif /* ** Inquiry flag definitions (Inq data byte 7)