Messages in this thread Patch in this message | | | Date | Mon, 9 Aug 1999 16:25:33 +0200 (CEST) | From | <> | Subject | [patch] 2.3.13 driver update for the Initio 9100U(W) |
| |
Hi *,
Following a patch against 2.3.13-8, which cuts some unused code, and makes it HZ independant, and updates it to the PCI resource scheme in 2.3.13.
Regards,
Bas Vermeulen
-- If I wanted to kill a battleship, I'd use a shitload of Harpoons. -- Paul Tomblin
NT is a lot cheaper. -- Petro diff -uNr linux-2.3.13-8.orig/drivers/scsi/i91uscsi.c linux/drivers/scsi/i91uscsi.c --- linux-2.3.13-8.orig/drivers/scsi/i91uscsi.c Thu Jan 14 19:31:41 1999 +++ linux/drivers/scsi/i91uscsi.c Sun Aug 8 13:44:07 1999 @@ -72,6 +72,8 @@ access to HCS_Semaph, HCS_FirstAvail and HCS_LastAvail members of the HCS structure. 01/09/98 bv, Fix a deadlock on SMP system. + 08/08/99 bv, Changed tul_do_pause to wait x milliseconds; Also + make the code jiffie-independant. **********************************************************************/ #define DEBUG_INTERRUPT 0 @@ -216,10 +218,12 @@ extern int tul_num_ch; +#define JIFFIES_TO_MS(t) ((t) * 1000 / HZ) +#define MS_TO_JIFFIES(j) ((j * HZ) / 1000) -static void tul_do_pause(unsigned amount) -{ /* Pause for amount*10 milliseconds */ - unsigned long the_time = jiffies + amount; /* 0.01 seconds per jiffy */ +static void tul_do_pause(unsigned ms) +{ /* Pause for amount jiffies */ + unsigned long the_time = jiffies + MS_TO_JIFFIES(ms); #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95) while (time_before_eq(jiffies, the_time)); @@ -235,36 +239,7 @@ ********************************************************************/ void tul_se2_wait() { -#if 1 udelay(30); -#else - UCHAR readByte; - - readByte = TUL_RD(0, 0x61); - if ((readByte & 0x10) == 0x10) { - for (;;) { - readByte = TUL_RD(0, 0x61); - if ((readByte & 0x10) == 0x10) - break; - } - for (;;) { - readByte = TUL_RD(0, 0x61); - if ((readByte & 0x10) != 0x10) - break; - } - } else { - for (;;) { - readByte = TUL_RD(0, 0x61); - if ((readByte & 0x10) == 0x10) - break; - } - for (;;) { - readByte = TUL_RD(0, 0x61); - if ((readByte & 0x10) != 0x10) - break; - } - } -#endif } @@ -579,7 +554,7 @@ /* Stall for a while, wait for target's firmware ready,make it 2 sec ! */ /* SONY 5200 tape drive won't work if only stall for 1 sec */ - tul_do_pause(seconds * 100); + tul_do_pause(seconds * 1000); TUL_RD(pCurHcb->HCS_Base, TUL_SInt); diff -uNr linux-2.3.13-8.orig/drivers/scsi/ini9100u.c linux/drivers/scsi/ini9100u.c --- linux-2.3.13-8.orig/drivers/scsi/ini9100u.c Sun Aug 8 13:26:59 1999 +++ linux/drivers/scsi/ini9100u.c Sun Aug 8 13:38:19 1999 @@ -95,6 +95,18 @@ * pSRB_tail members of the HCS structure. * 09/01/99 bv - v1.03d * - Fixed a deadlock problem in SMP. + * 21/01/99 bv - v1.03e + * - Add support for the Domex 3192U PCI SCSI + * This is a slightly modified patch by + * Brian Macy <bmacy@sunshinecomputing.com> + * 22/02/99 bv - v1.03f + * - Didn't detect the INIC-950 in 2.0.x correctly. + * Now fixed. + * 05/07/99 bv - v1.03g + * - Changed the assumption that HZ = 100 + * 08/08/99 bv - v1.03h + * - Updated for 2.3.13 and up to use the new resource + * scheme. **************************************************************************/ #define CVT_LINUX_VERSION(V,P,S) (V * 65536 + P * 256 + S) @@ -109,13 +121,19 @@ #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0) #include <stdarg.h> +#include <asm/io.h> #include <asm/irq.h> +#include <linux/string.h> #include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/ioport.h> #if LINUX_VERSION_CODE <= CVT_LINUX_VERSION(2,1,92) #include <linux/bios32.h> #endif #include <linux/delay.h> +#include <linux/sched.h> #include <linux/pci.h> +#include <linux/proc_fs.h> #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,23) #include <linux/init.h> #endif @@ -123,28 +141,39 @@ #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95) #include <asm/spinlock.h> #endif +#include "sd.h" +#include "scsi.h" +#include "hosts.h" +#include "ini9100u.h" #include <linux/stat.h> +#include <linux/malloc.h> #include <linux/config.h> #else +#include <linux/kernel.h> #include <linux/head.h> #include <linux/types.h> -#include <asm/system.h> -#include "../block/blk.h" -#endif - -#include <linux/kernel.h> #include <linux/string.h> #include <linux/ioport.h> + #include <linux/sched.h> #include <linux/proc_fs.h> +#include <asm/system.h> #include <asm/io.h> +#include "../block/blk.h" #include "scsi.h" #include "sd.h" #include "hosts.h" #include <linux/malloc.h> #include "ini9100u.h" +#endif + +#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,93) +#ifdef CONFIG_PCI +#include <linux/pci.h> +#endif +#endif #ifdef DEBUG_i91u unsigned int i91u_debug = DEBUG_DEFAULT; @@ -158,7 +187,7 @@ char *i91uCopyright = "Copyright (C) 1996-98"; char *i91uInitioName = "by Initio Corporation"; char *i91uProductName = "INI-9X00U/UW"; -char *i91uVersion = "v1.03d"; +char *i91uVersion = "v1.03h"; #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0) struct proc_dir_entry proc_scsi_ini9100u = @@ -230,17 +259,12 @@ /* ---- EXTERNAL VARIABLES ---- */ extern HCS tul_hcs[]; -struct id { - int vendor_id; - int device_id; -}; - -const struct id id_table[] = { - { INI_VENDOR_ID, I950_DEVICE_ID }, - { INI_VENDOR_ID, I940_DEVICE_ID }, - { INI_VENDOR_ID, I935_DEVICE_ID }, - { INI_VENDOR_ID, 0x0002 }, - { DMX_VENDOR_ID, 0x0002 }, +const PCI_ID i91u_pci_devices[] = { + { INI_VENDOR_ID, I950_DEVICE_ID }, + { INI_VENDOR_ID, I940_DEVICE_ID }, + { INI_VENDOR_ID, I935_DEVICE_ID }, + { INI_VENDOR_ID, I920_DEVICE_ID }, + { DMX_VENDOR_ID, I920_DEVICE_ID }, }; /* @@ -334,25 +358,33 @@ int iAdapters = 0; long dRegValue; WORD wBIOS; - const int iNumIdEntries = sizeof(id_table)/sizeof(id_table[0]); int i = 0; init_i91uAdapter_table(); - for (i=0; i < iNumIdEntries; i++) { - struct id curId = id_table[i]; - while ((pDev = pci_find_device(curId.vendor_id, curId.device_id, pDev)) != NULL) { + for (i = 0; i < TULSZ(i91u_pci_devices); i++) + { + while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) { pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue); wBIOS = (UWORD) (dRegValue & 0xFF); if (((dRegValue & 0xFF00) >> 8) == 0xFF) dRegValue = 0; wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8)); +#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2,3,13) if (Addi91u_into_Adapter_table(wBIOS, (pDev->base_address[0] & 0xFFFE), - pDev->irq, - pDev->bus->number, + pDev->irq, + pDev->bus->number, (pDev->devfn >> 3) ) == 0) +#else /* > 2.3.12 */ + if (Addi91u_into_Adapter_table(wBIOS, + (pDev->resource[0].start & 0xFFFE), + pDev->irq, + pDev->bus->number, + (pDev->devfn >> 3) + ) == 0) +#endif iAdapters++; } } @@ -377,17 +409,6 @@ unsigned short command; WORD wBIOS, wBASE; BYTE bPCIBusNum, bInterrupt, bPCIDeviceNum; - struct { - unsigned short vendor_id; - unsigned short device_id; - } const i91u_pci_devices[] = - { - {INI_VENDOR_ID, I935_DEVICE_ID}, - {INI_VENDOR_ID, I940_DEVICE_ID}, - {INI_VENDOR_ID, I950_DEVICE_ID}, - {INI_VENDOR_ID, I920_DEVICE_ID} - }; - iAdapters = 0; /* @@ -398,57 +419,25 @@ unsigned long page_offset, base; #endif -#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) - struct pci_dev *pdev = NULL; -#else int index; unsigned char pci_bus, pci_devfn; -#endif bPCIBusNum = 0; bPCIDeviceNum = 0; init_i91uAdapter_table(); for (i = 0; i < TULSZ(i91u_pci_devices); i++) { -#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) - pdev = NULL; - while ((pdev = pci_find_device(i91u_pci_devices[i].vendor_id, - i91u_pci_devices[i].device_id, - pdev))) -#else index = 0; while (!(pcibios_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, index++, &pci_bus, &pci_devfn))) -#endif { - if (i == 0) { - /* + if (i == 2) { printk("i91u: The RAID controller is not supported by\n"); printk("i91u: this driver, we are ignoring it.\n"); - */ } else { /* * Read sundry information from PCI BIOS. */ -#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) - bPCIBusNum = pdev->bus->number; - bPCIDeviceNum = pdev->devfn; - dRegValue = pdev->base_address[0]; - if (dRegValue == -1) { /* Check return code */ - printk("\n\ri91u: tulip read configuration error.\n"); - return (0); /* Read configuration space error */ - } - /* <02> read from base address + 0x50 offset to get the wBIOS balue. */ - wBASE = (WORD) dRegValue; - - /* Now read the interrupt line */ - dRegValue = pdev->irq; - bInterrupt = dRegValue & 0xFF; /* Assign interrupt line */ - pci_read_config_word(pdev, PCI_COMMAND, &command); - pci_write_config_word(pdev, PCI_COMMAND, - command | PCI_COMMAND_MASTER | PCI_COMMAND_IO); - -#else bPCIBusNum = pci_bus; bPCIDeviceNum = pci_devfn; pcibios_read_config_dword(pci_bus, pci_devfn, PCI_BASE_ADDRESS_0, @@ -467,7 +456,6 @@ pcibios_read_config_word(pci_bus, pci_devfn, PCI_COMMAND, &command); pcibios_write_config_word(pci_bus, pci_devfn, PCI_COMMAND, command | PCI_COMMAND_MASTER | PCI_COMMAND_IO); -#endif wBASE &= PCI_BASE_ADDRESS_IO_MASK; wBIOS = TUL_RDWORD(wBASE, 0x50); diff -uNr linux-2.3.13-8.orig/drivers/scsi/ini9100u.h linux/drivers/scsi/ini9100u.h --- linux-2.3.13-8.orig/drivers/scsi/ini9100u.h Tue Jan 26 01:05:43 1999 +++ linux/drivers/scsi/ini9100u.h Sun Aug 8 12:55:48 1999 @@ -63,7 +63,9 @@ * - Removed unused code * 12/13/98 bv - v1.03b * - Add spinlocks to HCS structure. -*******************************************************************************/ + * 21/01/99 bv - v1.03e + * - Added PCI_ID structure + **************************************************************************/ #ifndef CVT_LINUX_VERSION #define CVT_LINUX_VERSION(V,P,S) (((V) * 65536) + ((P) * 256) + (S)) @@ -88,7 +90,7 @@ extern int i91u_biosparam(Disk *, int, int *); /*for linux v1.13 */ #endif -#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.03d" +#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.03h" #if LINUX_VERSION_CODE < CVT_LINUX_VERSION(1, 3, 0) #define INI9100U { \ @@ -207,11 +209,19 @@ #define SENSE_SIZE 14 #define INI_VENDOR_ID 0x1101 /* Initio's PCI vendor ID */ -#define DMX_VENDOR_ID 0x134a /* Domex's PCI vendor ID */ +#define DMX_VENDOR_ID 0x134a /* Domex's PCI vendor ID */ #define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */ #define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */ #define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */ #define I920_DEVICE_ID 0x0002 /* Initio's other product ID */ + +/************************************************************************/ +/* Vendor ID/Device ID Pair Structure */ +/************************************************************************/ +typedef struct PCI_ID_Struc { + unsigned short vendor_id; + unsigned short device_id; +} PCI_ID; /************************************************************************/ /* Scatter-Gather Element Structure */ | |