Index: Makefile.dc395 =================================================================== RCS file: /home/cvsroot/dc395/Makefile.dc395,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile.dc395 2000/05/18 07:42:07 1.2 +++ Makefile.dc395 2000/09/29 20:00:43 1.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 dc395x_trm.o: dc395x_trm.c dc395x_trm.h arch Rules.make Index: README.dc395x =================================================================== RCS file: /home/cvsroot/dc395/README.dc395x,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- README.dc395x 2000/05/24 14:56:57 1.9 +++ README.dc395x 2000/09/29 20:21:40 1.10 @@ -2,7 +2,7 @@ ========================================== Preliminary. 2000-02-14 Kurt Garloff -$Id: README.dc395x,v 1.9 2000/05/24 14:56:57 garloff Exp $ +$Id: README.dc395x,v 1.10 2000/09/29 20:21:40 garloff Exp $ This driver is similar to the DC390/AM53c974 driver (tmscsim), so you might want to have a look into the README.tmscsim. @@ -168,11 +168,12 @@ > cp -p dc395/README.dc395x /usr/src/linux/drivers/scsi/ and apply the appropriate patch to your kernel source tree. Depending on your kernel version, this is dc395-integ20.diff, dc395-integ22.diff or -dc395-integ23.diff. (Replace XX by 20, 22, or 23) +dc395-integ24.diff. (Replace XX by 20, 22, 23 or 24) > cd /usr/src/ > patch -p0 -d /usr/src depmod -ae NEW: You may be able to skip compilation of the kernel by just using the -Makefile. +Makefile. For 2.4 kernels, if you compile outside the kernel source tree, +you don't even need to apply a patch to your kernel any more. I will provide a complete patch which makes kernel integration easier and will ask to apply it to the main tree, as soon as I got enough reports about @@ -221,7 +223,7 @@ http://www.garloff.de/kurt/linux/dc395/ ftp://ftp.suse.com/pub/people/garloff/linux/dc395/ (and mirrors, of course) -Announcements will be sent to the linux-scsi@vger.rutgers.edu list. +Announcements will be sent to the linux-scsi@vger.kernel.org list. Acknowledgements Index: dc395-integ24.diff =================================================================== RCS file: dc395-integ24.diff diff -N dc395-integ24.diff --- /dev/null Thu Aug 24 01:06:10 2000 +++ /tmp/cvs70TMAc Fri Sep 29 22:23:04 2000 @@ -0,0 +1,65 @@ +diff -uNr linux-2.4.0-test9-pre7/Documentation/Configure.help linux-2.4.0-test9-pre7.dc395/Documentation/Configure.help +--- linux-2.4.0-test9-pre7/Documentation/Configure.help Wed Sep 27 00:27:04 2000 ++++ linux-2.4.0-test9-pre7.dc395/Documentation/Configure.help Fri Sep 29 22:13:36 2000 +@@ -6130,6 +6130,19 @@ + say M here and read Documentation/modules.txt. The module will be + called sim710.o. + ++Tekram DC395/U/UW and DC315/U SCSI support ++CONFIG_SCSI_DC395x_TRMS1040 ++ This driver supports the PCI SCSI host adapters baseds on Tekram's ++ ASIC TRM-S1040 chip, i.e. Tekram DC315 and DC395 variants. ++ This driver does work, but please note that it is still beta status, ++ so better have a bootable disk and a backup in case of emergency. ++ Please read the file drivers/scsi/README.dc395x. ++ ++ If you want to compile this driver as a module ( = code which can be ++ inserted in and removed from the running kernel whenever you want), ++ say M here and read Documentation/modules.txt. The module will be ++ called dc395x_trm.o. ++ + Tekram DC390(T) and Am53/79C974 (PCscsi) SCSI support + CONFIG_SCSI_DC390T + This driver supports PCI SCSI host adapters based on the Am53C974A +diff -uNr linux-2.4.0-test9-pre7/MAINTAINERS linux-2.4.0-test9-pre7.dc395/MAINTAINERS +--- linux-2.4.0-test9-pre7/MAINTAINERS Wed Sep 27 00:27:05 2000 ++++ linux-2.4.0-test9-pre7.dc395/MAINTAINERS Fri Sep 29 22:13:36 2000 +@@ -301,10 +301,12 @@ + L: linux-hams@vger.kernel.org + S: Maintained + +-DC390/AM53C974 SCSI driver ++DC390/AM53C974 and DC395/TRM-S1040 SCSI drivers + P: Kurt Garloff ++M: garloff@suse.de + M: kurt@garloff.de +-W: http://www.garloff.de/kurt/linux/dc390/ ++W: http://www.garloff.de/kurt/linux/ ++L: linux-scsi@vger.rutgers.edu + S: Maintained + + DECnet NETWORK LAYER +diff -uNr linux-2.4.0-test9-pre7/drivers/scsi/Config.in linux-2.4.0-test9-pre7.dc395/drivers/scsi/Config.in +--- linux-2.4.0-test9-pre7/drivers/scsi/Config.in Wed Sep 27 00:27:08 2000 ++++ linux-2.4.0-test9-pre7.dc395/drivers/scsi/Config.in Fri Sep 29 22:13:36 2000 +@@ -155,6 +155,9 @@ + dep_tristate 'Simple 53c710 SCSI support (Compaq, NCR machines)' CONFIG_SCSI_SIM710 $CONFIG_SCSI + dep_tristate 'Symbios 53c416 SCSI support' CONFIG_SCSI_SYM53C416 $CONFIG_SCSI + if [ "$CONFIG_PCI" = "y" ]; then ++ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then ++ dep_tristate 'Tekram DC395/U/UW and DC315/U SCSI support' CONFIG_SCSI_DC395x_TRMS1040 $CONFIG_SCSI ++ fi + dep_tristate 'Tekram DC390(T) and Am53/79C974 SCSI support' CONFIG_SCSI_DC390T $CONFIG_SCSI + if [ "$CONFIG_SCSI_DC390T" != "n" ]; then + bool ' _omit_ support for non-DC390 adapters' CONFIG_SCSI_DC390T_NOGENSUPP +diff -uNr linux-2.4.0-test9-pre7/drivers/scsi/Makefile linux-2.4.0-test9-pre7.dc395/drivers/scsi/Makefile +--- linux-2.4.0-test9-pre7/drivers/scsi/Makefile Wed Sep 27 00:27:08 2000 ++++ linux-2.4.0-test9-pre7.dc395/drivers/scsi/Makefile Fri Sep 29 22:15:15 2000 +@@ -90,6 +90,7 @@ + obj-$(CONFIG_SCSI_IBMMCA) += ibmmca.o + obj-$(CONFIG_SCSI_EATA) += eata.o + obj-$(CONFIG_SCSI_DC390T) += tmscsim.o ++obj-$(CONFIG_SCSI_DC395x_TRMS1040) += dc395x_trm.o + obj-$(CONFIG_SCSI_AM53C974) += AM53C974.o + obj-$(CONFIG_SCSI_MEGARAID) += megaraid.o + obj-$(CONFIG_SCSI_ACARD) += atp870u.o Index: dc395x_trm.c =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.c,v retrieving revision 1.60 retrieving revision 1.62 diff -u -r1.60 -r1.62 --- dc395x_trm.c 2000/05/23 13:16:09 1.60 +++ dc395x_trm.c 2000/09/29 20:00:44 1.62 @@ -12,7 +12,7 @@ //* Kurt Garloff //* (C) 1999-2000 Kurt Garloff //* License: GNU GPL -//* $Id: dc395x_trm.c,v 1.60 2000/05/23 13:16:09 garloff Exp $ +//* $Id: dc395x_trm.c,v 1.62 2000/09/29 20:00:44 garloff Exp $ //*********************************************************************** //* Tekram PCI SCSI adapter (DC395/U/UW/F or DC315/U) revision history //* @@ -76,7 +76,10 @@ //* Timer for chip flaw (misses SelTO), //* (but disabled, as it does fail smtms) //* Connector cfg output changed -//+ No clrfifo after MIP1 +//* No clrfifo after MIP1 +//* 1.28 00/09/29 KG Only try sync/wide nego, if device reports +//* to be capable of doing so. 2.4 fixes: +//* New scanning sequence ... Fix typo //*********************************************************************** /* ************************************************************************* @@ -174,6 +177,7 @@ #ifdef DC395x_DEBUGTRACE # define DEBUGTRACEBUFSZ 704 char DC395x_tracebuf[64]; +char DC395x_traceoverflow[8] = {0,0,0,0,0,0,0,0}; # define TRACEPRINTF(x...) \ do { int ln = sprintf (DC395x_tracebuf, ## x); \ if (pSRB->debugpos + ln >= DEBUGTRACEBUFSZ) \ @@ -331,7 +335,7 @@ typedef Scsi_Cmnd *PSCSICMD; typedef void *PVOID; typedef struct scatterlist *PSGL, SGL; - + /* **struct scatterlist **{ @@ -523,7 +527,7 @@ DWORD CmdInQ; DWORD CmdOutOfSRB; - //DC395X_TRM_DCB DCB_array[DC395x_MAX_DCB]; /* +74h, Len=3E8 */ + //DC395X_TRM_DCB DCB_array[DC395x_MAX_DCB]; /* +74h, Len=3E8 */ #ifdef NEW_PCI struct pci_dev *pdev; #else @@ -741,8 +745,13 @@ /* Peripheral Device Type definitions */ /* See include/scsi/scsi.h */ #define TYPE_NODEV SCSI_DEVTYPE /* Unknown or no device type */ -#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) */ @@ -2007,7 +2016,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; @@ -2109,7 +2119,7 @@ void DC395x_updateDCB (PACB pACB, PDCB pDCB) { /* Prevent disconnection of narrow devices if this_id > 7 */ - if (!(pDCB->DevMode & NTC_DO_WIDE_NEGO) && pACB->pScsiHost->this_id > 7) + if (!(pDCB->DevMode & NTC_DO_WIDE_NEGO) && pACB->pScsiHost->this_id > 7) pDCB->DevMode &= ~NTC_DO_DISCONNECT; /* TagQ w/o DisCn is impossible */ @@ -2802,24 +2812,27 @@ if( ( (pSRB->pcmd->cmnd[0] == INQUIRY) || (pSRB->pcmd->cmnd[0] == REQUEST_SENSE) || (pSRB->SRBFlag & AUTO_REQSENSE) ) && ( ((pDCB->SyncMode & WIDE_NEGO_ENABLE) && !(pDCB->SyncMode & WIDE_NEGO_DONE)) || ((pDCB->SyncMode & SYNC_NEGO_ENABLE) && !(pDCB->SyncMode & SYNC_NEGO_DONE)) ) - && (pDCB->TargetLUN == 0)) + && (pDCB->TargetLUN == 0) ) { pSRB->MsgOutBuf[0] = identify_message; pSRB->MsgCnt = 1; scsicommand = SCMD_SEL_ATNSTOP; pSRB->SRBState = SRB_MSGOUT; #ifndef SYNC_FIRST - if (pDCB->SyncMode & WIDE_NEGO_ENABLE) + if (pDCB->SyncMode & WIDE_NEGO_ENABLE && + pSRB->pcmd->device->wide) { DC395x_Build_WDTR (pACB, pDCB, pSRB); goto no_cmd; } #endif - if (pDCB->SyncMode & SYNC_NEGO_ENABLE) + if (pDCB->SyncMode & SYNC_NEGO_ENABLE && + pSRB->pcmd->device->sync) { DC395x_Build_SDTR (pACB, pDCB, pSRB); goto no_cmd; } - if (pDCB->SyncMode & WIDE_NEGO_ENABLE) + if (pDCB->SyncMode & WIDE_NEGO_ENABLE && + pSRB->pcmd->device->wide) { DC395x_Build_WDTR (pACB, pDCB, pSRB); goto no_cmd; @@ -4929,6 +4942,9 @@ #endif TRACEPRINTF("DONE *"); + ptr = (PSCSI_INQDATA) (pcmd->request_buffer); + if( pcmd->use_sg ) + ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); status = pSRB->TargetStatus; if(pSRB->SRBFlag & AUTO_REQSENSE) { @@ -5014,7 +5030,7 @@ pcmd->result = DID_NO_CONNECT << 16; } 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; @@ -5053,13 +5069,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 DC395x_DEBUG0 - printk (KERN_INFO "\nDC395x: Test_Unit_Ready: result: %08x", pcmd->result); + printk (KERN_INFO "\nDC395x: %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]); @@ -5094,13 +5130,10 @@ //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) ) { DEBUG0(int i;) - ptr = (PSCSI_INQDATA) (pcmd->request_buffer); - if( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) (((PSGL) ptr)->address); #ifdef DC395x_DEBUG0 printk ("DC395x: Inquiry result:"); for (i = 0; i < 8; i++) printk (" %02x", ((PBYTE)ptr)[i]); @@ -5112,7 +5145,10 @@ printk ("DC395x: Device %02i-%i: TYPE_NODEV?\n", pDCB->TargetID, pDCB->TargetLUN); /* device not present: remove */ - //DC395x_remove_dev (pACB, pDCB); DCB_removed = 1; + /*if (!DCB_removed) + DC395x_remove_dev (pACB, pDCB); + DCB_removed = 1; + */ } else { @@ -6324,7 +6360,9 @@ /* get adapter io_port ,irq */ //DC395x_DRV_LOCK(drv_flags); #ifdef NEW_PCI -# if LINUX_VERSION_CODE >= KERNEL_VERSION (2,3,10) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30) + if (pci_enable_device (pPCI_DEVICE)) + continue; io_port = pci_resource_start (pPCI_DEVICE, 0) & PCI_BASE_ADDRESS_IO_MASK; # else io_port = pPCI_DEVICE->base_address[0] & PCI_BASE_ADDRESS_IO_MASK; Index: dc395x_trm.h =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- dc395x_trm.h 2000/05/23 09:53:01 1.26 +++ dc395x_trm.h 2000/09/29 20:00:44 1.27 @@ -8,7 +8,7 @@ ** ********************************************************************** */ -/* $Id: dc395x_trm.h,v 1.26 2000/05/23 09:53:01 garloff Exp $ */ +/* $Id: dc395x_trm.h,v 1.27 2000/09/29 20:00:44 garloff Exp $ */ /* ***************************************************** ** Tekram TRM_S1040 for DC395x driver, header file @@ -17,8 +17,10 @@ #ifndef DC395x_trm_H #define DC395x_trm_H +#include + #define DC395x_BANNER "Tekram DC395U/UW/F DC315/U" -#define DC395x_VERSION "1.27, 2000-05-23" +#define DC395x_VERSION "1.28, 2000-09-29" /* Kernel version autodetection */ #include @@ -35,6 +37,10 @@ #define VERSION_2_0_0 #endif +#if defined(__SMP__) && !defined(CONFIG_SMP) +# define CONFIG_SMP +#endif + #define DC395x_MAX_CMD_QUEUE 32 //#define DC395x_MAX_QTAGS 32 #define DC395x_MAX_QTAGS 16 @@ -82,9 +88,6 @@ # define DC395x_release NULL # endif //-------------- -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30) -extern struct proc_dir_entry DC395x_proc_scsi; -#endif extern int DC395x_proc_info(char*, char**, off_t, int, int, int); //-------------- @@ -108,6 +111,7 @@ use_clustering: DISABLE_CLUSTERING \ } #else +extern struct proc_dir_entry DC395x_proc_scsi; # define DC395x_TRMS1040 { \ proc_dir: &DC395x_proc_scsi, \ proc_info: DC395x_proc_info, \