Index: Makefile =================================================================== RCS file: Makefile diff -N Makefile --- /dev/null Sun Oct 3 02:13:27 1999 +++ /tmp/cvsXetVSf Wed May 24 16:34:17 2000 @@ -0,0 +1,30 @@ +# Makefile for the tmscsim (AM53C974 chip on Tekram DC390) driver +# (w) 5/2000, garloff@suse.de + +KDIR := /usr/src/linux + +TARGETS := Rules.make arch tmscsim.o +.PHONY: tmscsim.o + +default: $(TARGETS) + + +Rules.make: $(KDIR)/Rules.make + cp -pf $(KDIR)/Rules.make . + +arch: $(KDIR)/arch + rm -f arch + ln -s $(KDIR)/arch . + +clean: + rm -f $(TARGETS) + +tmscsim.o: + $(MAKE) -f Makefile.dc390 KDIR=$(KDIR) + +install: + $(MAKE) -f Makefile.dc390 KDIR=$(KDIR) install_mod + +load: + $(MAKE) -f Makefile.dc390 KDIR=$(KDIR) load_module + Index: Makefile.dc390 =================================================================== RCS file: Makefile.dc390 diff -N Makefile.dc390 --- /dev/null Sun Oct 3 02:13:27 1999 +++ /tmp/cvsKzk80m Wed May 24 16:34:17 2000 @@ -0,0 +1,47 @@ +# Makefile for dc395x_trm to be called by master Makefile that +# does the preparation work (setting up links, copying Rules.make ...) +# (w) 5/2000 garloff@suse.de + +TARGET = tmscsim.o +TARGETMODDIR = scsi + +default: $(TARGET) + +TOPDIR := $(KDIR) +include $(KDIR)/.config +include $(KDIR)/Makefile +TOPDIR := $(KDIR) + +CFLAGS := -I. -I $(KDIR)/drivers/scsi $(CFLAGS) -DMODULE + +tmscsim.o: dc390.h tmscsim.h scsiiom.c tmscsim.c arch Rules.make + +MODLIB := $(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) + +install_mod: $(MODLIB)/$(TARGETMODDIR)/tmscsim.o + +$(MODLIB)/$(TARGETMODDIR)/tmscsim.o: tmscsim.o + @if test $(shell id -u) = 0; then \ + echo "Install tmscsim"; install -o root -g root -d $(MODLIB)/$(TARGETMODDIR); \ + install -o root -g root -m 0644 tmscsim.o $(MODLIB)/$(TARGETMODDIR)/; \ + echo "depmod -a $(KERNELRELEASE)"; depmod -a $(KERNELRELEASE); \ + else \ + echo "Give root password for installation of kernel module"; \ + su -c \ + 'echo "Install tmscsim"; install -o root -g root -d $(MODLIB)/$(TARGETMODDIR); \ + install -o root -g root -m 0644 tmscsim.o $(MODLIB)/$(TARGETMODDIR)/; \ + echo "depmod -a $(KERNELRELEASE)"; depmod -a $(KERNELRELEASE)'; \ + fi + +load_module: install_mod + @if test $(shell id -u) = 0; then \ + if test ! -z "$(shell lsmod | grep tmscsim)"; then echo "Remove tmscsim"; \ + rmmod tmscsim; fi; \ + echo "Load tmscsim"; modprobe tmscsim; \ + else \ + echo "Give root password for loading of kernel module"; \ + su -c \ + 'if test ! -z "$(shell lsmod | grep tmscsim)"; then echo "Remove tmscsim"; \ + rmmod tmscsim; fi; \ + echo "Load tmscsim"; modprobe tmscsim'; \ + fi Index: README.tmscsim =================================================================== RCS file: /home/cvsroot/dc390/README.tmscsim,v retrieving revision 2.25.2.3 retrieving revision 2.25.2.4 diff -u -r2.25.2.3 -r2.25.2.4 --- README.tmscsim 2000/02/14 11:15:23 2.25.2.3 +++ README.tmscsim 2000/05/24 14:31:23 2.25.2.4 @@ -57,6 +57,8 @@ driver. Of course you have to choose to compile SCSI support and DC390(T) support into your kernel or as module when configuring your kernel for compiling. +NEW: You may as well compile this module outside your kernel, using the +supplied Makefile. If you got an old kernel (pre 2.1.127, pre 2.0.37p1) with an old version of this driver: Get dc390-21125-20b.diff.gz or dc390-2036p21-20b1.diff.gz from @@ -440,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.3 2000/02/14 11:15:23 garloff Exp $ +$Id: README.tmscsim,v 2.25.2.4 2000/05/24 14:31:23 garloff Exp $ Index: dc390.h =================================================================== RCS file: /home/cvsroot/dc390/dc390.h,v retrieving revision 2.43.2.11 retrieving revision 2.43.2.13 diff -u -r2.43.2.11 -r2.43.2.13 --- dc390.h 2000/02/14 21:40:09 2.43.2.11 +++ dc390.h 2000/05/23 13:12:55 2.43.2.13 @@ -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.11 2000/02/14 21:40:09 garloff Exp $ */ +/* $Id: dc390.h,v 2.43.2.13 2000/05/23 13:12:55 garloff Exp $ */ /* * DC390/AMD 53C974 driver, header file @@ -19,7 +19,7 @@ #endif #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.0d28 2000/02/14" +#define DC390_VERSION "2.0e 2000/05/23" /* We don't have eh_abort_handler, eh_device_reset_handler, * eh_bus_reset_handler, eh_host_reset_handler yet! Index: scsiiom.c =================================================================== RCS file: /home/cvsroot/dc390/scsiiom.c,v retrieving revision 2.55.2.9 retrieving revision 2.55.2.10 diff -u -r2.55.2.9 -r2.55.2.10 --- scsiiom.c 2000/02/14 21:42:24 2.55.2.9 +++ scsiiom.c 2000/05/22 19:26:47 2.55.2.10 @@ -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.9 2000/02/14 21:42:24 garloff Exp $ */ +/* $Id: scsiiom.c,v 2.55.2.10 2000/05/22 19:26:47 garloff Exp $ */ static void __inline__ dc390_freetag (PDCB pDCB, PSRB pSRB) @@ -1611,6 +1611,10 @@ (pcmd->lun == pACB->pScsiHost->max_lun - 1) ) pACB->scan_devices = 0; }; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30) + pcmd->resid = pSRB->request_bufflen - pSRB->TotalXferredLen; +#endif if (!DCB_removed) dc390_Going_remove (pDCB, pSRB); /* Add to free list */ Index: tmscsim.c =================================================================== RCS file: /home/cvsroot/dc390/tmscsim.c,v retrieving revision 2.60.2.16 retrieving revision 2.60.2.19 diff -u -r2.60.2.16 -r2.60.2.19 --- tmscsim.c 2000/02/14 11:15:23 2.60.2.16 +++ tmscsim.c 2000/05/23 13:12:04 2.60.2.19 @@ -7,7 +7,7 @@ ***********************************************************************/ /* (C) Copyright: put under GNU GPL in 10/96 (see README.tmscsim) * *************************************************************************/ -/* $Id: tmscsim.c,v 2.60.2.16 2000/02/14 11:15:23 garloff Exp $ */ +/* $Id: tmscsim.c,v 2.60.2.19 2000/05/23 13:12:04 garloff Exp $ */ /* Enhancements and bugfixes by * * Kurt Garloff * ***********************************************************************/ @@ -152,6 +152,7 @@ * Use old EH (don't have new EH fns yet) * * Reset: Unlock, but refuse to queue * * 2.3 __setup function * + * 2.0e 00/05/22 KG Return residual for 2.3 * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ @@ -379,7 +380,7 @@ # define PCI_SET_MASTER pci_set_master (pdev) # define PCI_FIND_DEVICE(vend, id) (pdev = pci_find_device (vend, id, pdev)) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,10) -# define PCI_GET_IO_AND_IRQ io_port = pdev->resource[0].start; irq = pdev->irq +# define PCI_GET_IO_AND_IRQ io_port = pci_resource_start (pdev, 0); irq = pdev->irq #else # define PCI_GET_IO_AND_IRQ io_port = pdev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK; irq = pdev->irq #endif @@ -943,6 +944,16 @@ dc390_Going_append (pDCB, pSRB); } +/* 2.0 timer compatibility */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,30) + static inline int timer_pending(struct timer_list * timer) + { + return timer->prev != NULL; + } + #define time_after(a,b) ((long)(b) - (long)(a) < 0) + #define time_before(a,b) time_after(b,a) +#endif + void DC390_waiting_timed_out (unsigned long ptr); /* Sets the timer to wake us up */ static void dc390_waiting_timer (PACB pACB, unsigned long to) @@ -1001,7 +1012,7 @@ PACB pACB = (PACB)ptr; DC390_IFLAGS DC390_AFLAGS - printk ("DC390: Debug: Waiting queue woken up by timer!\n"); + DEBUG0(printk ("DC390: Debug: Waiting queue woken up by timer!\n");) DC390_LOCK_IO; DC390_LOCK_ACB; dc390_Waiting_process (pACB); @@ -2319,6 +2330,56 @@ DC390_queue_command (cmd, dc390_inquiry_done); }; +/*********************************************************************** + * Functions: dc390_sendstart(), dc390_sendstart_done() + * + * Purpose: When changing speed etc., we have to issue an INQUIRY + * command to make sure, we agree upon the nego parameters + * with the device + ***********************************************************************/ + +static void dc390_sendstart_done (Scsi_Cmnd* cmd) +{ + printk (KERN_INFO "DC390: SENDSTART (ID %02x LUN %02x) returned %08x\n", + cmd->target, cmd->lun, cmd->result); + kfree (cmd); +}; + +void dc390_sendstart (PACB pACB, PDCB pDCB) +{ + char* buffer; + Scsi_Cmnd* cmd; + cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC); + if (!cmd) { printk ("DC390: kmalloc failed in sendstart!\n"); return; }; + buffer = (char*)cmd + sizeof(Scsi_Cmnd); + + memset (cmd, 0, sizeof(Scsi_Cmnd) + 256); + cmd->cmnd[0] = 0x1b; /* START_STOP_UNIT */ + cmd->cmnd[1] = (pDCB->TargetLUN << 5) & 0xe0; + cmd->cmnd[4] = 0x01; /* START */ + + cmd->cmd_len = 6; cmd->old_cmd_len = 6; + cmd->host = pACB->pScsiHost; + cmd->target = pDCB->TargetID; + cmd->lun = pDCB->TargetLUN; + cmd->serial_number = 1; + cmd->pid = 310; + cmd->bufflen = 128; + cmd->buffer = buffer; + cmd->request_bufflen = 128; + cmd->request_buffer = &buffer[128]; + cmd->done = dc390_sendstart_done; + cmd->scsi_done = dc390_sendstart_done; + cmd->timeout_per_command = 5*HZ; + + cmd->request.rq_status = RQ_SCSI_BUSY; + + pDCB->SyncMode &= ~SYNC_NEGO_DONE; + printk (KERN_INFO "DC390: Queue SEND_START command to dev ID %02x LUN %02x\n", + pDCB->TargetID, pDCB->TargetLUN); + DC390_queue_command (cmd, dc390_sendstart_done); +}; + /******************************************************************** * Function: dc390_set_info() * @@ -2437,6 +2498,7 @@ else if (!memcmp (pos, "INQUIRY", 7)) goto inquiry; else if (!memcmp (pos, "REMOVE", 6)) goto remove; else if (!memcmp (pos, "ADD", 3)) goto add; + else if (!memcmp (pos, "START", 5)) goto start; else if (!memcmp (pos, "DUMP", 4)) goto dump; if (isdigit (*pos)) @@ -2654,6 +2716,22 @@ if (pDCB) { printk ("DC390: ADD: Device already existing\n"); goto einv; }; dc390_initDCB (pACB, &pDCB, id, lun); DC390_UNLOCK_ACB; + dc390_inquiry (pACB, pDCB); + DC390_UNLOCK_IO; + }; + return (length); + + start: + { + int id, lun; + pos = strtok (0, " \t\n.:;="); + if (pos) { SCANF (pos, p0, id, 0, 7); } else goto einv; + if (pos) { SCANF (pos, p0, lun, 0, 7); } else goto einv; + pDCB = dc390_findDCB (pACB, id, lun); + if (pDCB) printk ("DC390: SendStart: Device already existing ...\n"); + else dc390_initDCB (pACB, &pDCB, id, lun); + DC390_UNLOCK_ACB; + dc390_sendstart (pACB, pDCB); dc390_inquiry (pACB, pDCB); DC390_UNLOCK_IO; };