diff options
Diffstat (limited to 'drivers/ide')
46 files changed, 923 insertions, 725 deletions
diff --git a/drivers/ide/Config.in b/drivers/ide/Config.in index 2d4d2228c..15e1fd52b 100644 --- a/drivers/ide/Config.in +++ b/drivers/ide/Config.in @@ -38,11 +38,12 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then dep_bool ' AEC6210 chipset support' CONFIG_BLK_DEV_AEC6210 $CONFIG_BLK_DEV_IDEDMA_PCI dep_mbool ' AEC6210 Tuning support (WIP)' CONFIG_AEC6210_TUNING $CONFIG_BLK_DEV_AEC6210 $CONFIG_IDEDMA_PCI_WIP dep_bool ' ALI M15x3 chipset support' CONFIG_BLK_DEV_ALI15X3 $CONFIG_BLK_DEV_IDEDMA_PCI + dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3 dep_bool ' AMD Viper support' CONFIG_BLK_DEV_AMD7409 $CONFIG_BLK_DEV_IDEDMA_PCI dep_mbool ' AMD Viper ATA-66 Override (WIP)' CONFIG_AMD7409_OVERRIDE $CONFIG_BLK_DEV_AMD7409 $CONFIG_IDEDMA_PCI_WIP dep_bool ' CMD64X chipset support' CONFIG_BLK_DEV_CMD64X $CONFIG_BLK_DEV_IDEDMA_PCI dep_mbool ' CMD64X chipset RAID (WIP)' CONFIG_CMD64X_RAID $CONFIG_BLK_DEV_CMD64X $CONFIG_IDEDMA_PCI_WIP - dep_bool ' CY82C693 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_CY82C693 $CONFIG_IDEDMA_PCI_EXPERIMENTAL + dep_bool ' CY82C693 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_CY82C693 $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' Cyrix CS5530 MediaGX chipset support' CONFIG_BLK_DEV_CS5530 $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' HPT34X chipset support' CONFIG_BLK_DEV_HPT34X $CONFIG_BLK_DEV_IDEDMA_PCI dep_mbool ' HPT34X AUTODMA support (WIP)' CONFIG_HPT34X_AUTODMA $CONFIG_BLK_DEV_HPT34X $CONFIG_IDEDMA_PCI_WIP @@ -53,14 +54,14 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then dep_mbool ' Intel PIIXn chipsets support' CONFIG_BLK_DEV_PIIX $CONFIG_BLK_DEV_IDEDMA_PCI dep_mbool ' PIIXn Tuning support' CONFIG_PIIX_TUNING $CONFIG_BLK_DEV_PIIX $CONFIG_IDEDMA_PCI_AUTO fi - dep_bool ' NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415 $CONFIG_IDEDMA_PCI_EXPERIMENTAL + dep_bool ' NS87415 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_NS87415 $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' OPTi 82C621 chipset enhanced support (EXPERIMENTAL)' CONFIG_BLK_DEV_OPTI621 $CONFIG_EXPERIMENTAL dep_bool ' PROMISE PDC20246/PDC20262 support' CONFIG_BLK_DEV_PDC202XX $CONFIG_BLK_DEV_IDEDMA_PCI dep_bool ' Special UDMA Feature' CONFIG_PDC202XX_BURST $CONFIG_BLK_DEV_PDC202XX dep_mbool ' Special Mode Feature (WIP)' CONFIG_PDC202XX_MASTER $CONFIG_BLK_DEV_PDC202XX $CONFIG_IDEDMA_PCI_WIP dep_bool ' SiS5513 chipset support' CONFIG_BLK_DEV_SIS5513 $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86 - dep_bool ' Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290 $CONFIG_IDEDMA_PCI_EXPERIMENTAL - dep_bool ' VIA82CXXX chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_VIA82CXXX $CONFIG_IDEDMA_PCI_EXPERIMENTAL + dep_bool ' Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290 $CONFIG_BLK_DEV_IDEDMA_PCI + dep_bool ' VIA82CXXX chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_VIA82CXXX $CONFIG_BLK_DEV_IDEDMA_PCI fi if [ "$CONFIG_PPC" = "y" -o "$CONFIG_ARM" = "y" ]; then bool ' Winbond SL82c105 support' CONFIG_BLK_DEV_SL82C105 diff --git a/drivers/ide/aec6210.c b/drivers/ide/aec6210.c index cc0aca5fd..cf41fa3d0 100644 --- a/drivers/ide/aec6210.c +++ b/drivers/ide/aec6210.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/aec6210.c Version 0.05 Feb. 10, 2000 + * linux/drivers/ide/aec6210.c Version 0.06 Mar. 18, 2000 * * Copyright (C) 1998-2000 Andre Hedrick (andre@suse.com) * May be copied or modified under the terms of the GNU General Public License @@ -191,6 +191,7 @@ static int aec6210_tune_chipset (ide_drive_t *drive, byte speed) return(err); } +#ifdef CONFIG_BLK_DEV_IDEDMA static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) { struct hd_driveid *id = drive->id; @@ -230,6 +231,7 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) ((id->dma_1word >> 8) & 7) ? ide_dma_on : ide_dma_off_quietly); } +#endif /* CONFIG_BLK_DEV_IDEDMA */ static void aec6210_tune_drive (ide_drive_t *drive, byte pio) { @@ -252,6 +254,7 @@ static void aec6210_tune_drive (ide_drive_t *drive, byte pio) (void) aec6210_tune_chipset(drive, speed); } +#ifdef CONFIG_BLK_DEV_IDEDMA static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -314,6 +317,7 @@ int aec6210_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_AEC6210_TUNING */ unsigned int __init pci_init_aec6210 (struct pci_dev *dev, const char *name) @@ -336,13 +340,13 @@ void __init ide_init_aec6210 (ide_hwif_t *hwif) { #ifdef CONFIG_AEC6210_TUNING hwif->tuneproc = &aec6210_tune_drive; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; - if (hwif->dma_base) { +#ifdef CONFIG_BLK_DEV_IDEDMA + if (hwif->dma_base) hwif->dmaproc = &aec6210_dmaproc; - } else { - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; - } +#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_AEC6210_TUNING */ } diff --git a/drivers/ide/ali14xx.c b/drivers/ide/ali14xx.c index b3ffaa529..ff87917c5 100644 --- a/drivers/ide/ali14xx.c +++ b/drivers/ide/ali14xx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ali14xx.c Version 0.03 Feb 09, 1996 + * linux/drivers/ide/ali14xx.c Version 0.03 Feb 09, 1996 * * Copyright (C) 1996 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index bc3d2b9e3..b043d6774 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/alim15x3.c Version 0.08 Jan. 14, 2000 + * linux/drivers/ide/alim15x3.c Version 0.09 Mar. 18, 2000 * * Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer @@ -37,7 +37,7 @@ static int ali_get_info(char *buffer, char **addr, off_t offset, int count); extern int (*ali_display_info)(char *, char **, off_t, int); /* ide-proc.c */ -struct pci_dev *bmide_dev; +static struct pci_dev *bmide_dev; char *fifo[4] = { "FIFO Off", @@ -67,7 +67,7 @@ char *channel_status[8] = { "error DRQ busy" }; -static int ali_get_info(char *buffer, char **addr, off_t offset, int count) +static int ali_get_info (char *buffer, char **addr, off_t offset, int count) { byte reg53h, reg5xh, reg5yh, reg5xh1, reg5yh1; unsigned int bibma; @@ -356,6 +356,12 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, byte speed) return (err); } +static void config_chipset_for_pio (ide_drive_t *drive) +{ + ali15x3_tune_drive(drive, 5); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA static int config_chipset_for_dma (ide_drive_t *drive, byte ultra33) { struct hd_driveid *id = drive->id; @@ -401,26 +407,21 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra33) return rval; } -static void config_chipset_for_pio (ide_drive_t *drive) -{ - ali15x3_tune_drive(drive, 5); -} - - static byte ali15x3_can_ultra (ide_drive_t *drive) { +#ifdef CONFIG_WDC_ALI15X3 struct hd_driveid *id = drive->id; +#endif /* CONFIG_WDC_ALI15X3 */ -#if 0 - if (m5229_revision < 0x20) { -#else if (m5229_revision <= 0x20) { -#endif return 0; } else if ((m5229_revision < 0xC2) && - ((drive->media!=ide_disk) || - (chip_is_1543c_e && - strstr(id->model, "WDC ")))) { +#ifdef CONFIG_WDC_ALI15X3 + ((chip_is_1543c_e && strstr(id->model, "WDC ")) || + (drive->media!=ide_disk))) { +#else /* CONFIG_WDC_ALI15X3 */ + (drive->media!=ide_disk)) { +#endif /* CONFIG_WDC_ALI15X3 */ return 0; } else { return 1; @@ -495,6 +496,7 @@ static int ali15x3_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_ali15x3 (struct pci_dev *dev, const char *name) { @@ -519,9 +521,11 @@ unsigned int __init pci_init_ali15x3 (struct pci_dev *dev, const char *name) } #if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) - ali_proc = 1; - bmide_dev = dev; - ali_display_info = &ali_get_info; + if (!ali_proc) { + ali_proc = 1; + bmide_dev = dev; + ali_display_info = &ali_get_info; + } #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */ return 0; @@ -666,18 +670,20 @@ void __init ide_init_ali15x3 (ide_hwif_t *hwif) } hwif->tuneproc = &ali15x3_tune_drive; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; +#ifndef CONFIG_BLK_DEV_IDEDMA + hwif->autodma = 0; + return; +#endif /* CONFIG_BLK_DEV_IDEDMA */ + if ((hwif->dma_base) && (m5229_revision >= 0x20)) { /* * M1543C or newer for DMAing */ hwif->dmaproc = &ali15x3_dmaproc; hwif->autodma = 1; - } else { - hwif->autodma = 0; - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; } - return; } void ide_dmacapable_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) diff --git a/drivers/ide/amd7409.c b/drivers/ide/amd7409.c index 7d2018029..2d44044dd 100644 --- a/drivers/ide/amd7409.c +++ b/drivers/ide/amd7409.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/amd7409.c Version 0.03 Feb. 10, 2000 + * linux/drivers/ide/amd7409.c Version 0.04 Mar. 18, 2000 * * Copyright (C) 2000 Andre Hedrick <andre@suse.com> * May be copied or modified under the terms of the GNU General Public License @@ -194,49 +194,6 @@ static int amd7409_tune_chipset (ide_drive_t *drive, byte speed) return (err); } -/* - * This allows the configuration of ide_pci chipset registers - * for cards that learn about the drive's UDMA, DMA, PIO capabilities - * after the drive is reported by the OS. - */ -static int config_chipset_for_dma (ide_drive_t *drive) -{ - struct hd_driveid *id = drive->id; - byte udma_66 = ((id->hw_config & 0x2000) && - (HWIF(drive)->udma_four)) ? 1 : 0; - byte speed = 0x00; - int rval; - - if ((id->dma_ultra & 0x0010) && (udma_66)) { - speed = XFER_UDMA_4; - } else if ((id->dma_ultra & 0x0008) && (udma_66)) { - speed = XFER_UDMA_3; - } else if (id->dma_ultra & 0x0004) { - speed = XFER_UDMA_2; - } else if (id->dma_ultra & 0x0002) { - speed = XFER_UDMA_1; - } else if (id->dma_ultra & 0x0001) { - speed = XFER_UDMA_0; - } else if (id->dma_mword & 0x0004) { - speed = XFER_MW_DMA_2; - } else if (id->dma_mword & 0x0002) { - speed = XFER_MW_DMA_1; - } else if (id->dma_mword & 0x0001) { - speed = XFER_MW_DMA_0; - } else { - return ((int) ide_dma_off_quietly); - } - - (void) amd7409_tune_chipset(drive, speed); - - rval = (int)( ((id->dma_ultra >> 11) & 3) ? ide_dma_on : - ((id->dma_ultra >> 8) & 7) ? ide_dma_on : - ((id->dma_mword >> 8) & 7) ? ide_dma_on : - ide_dma_off_quietly); - - return rval; -} - static void config_chipset_for_pio (ide_drive_t *drive) { unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; @@ -288,6 +245,52 @@ static void amd7409_tune_drive (ide_drive_t *drive, byte pio) (void) amd7409_tune_chipset(drive, speed); } +#ifdef CONFIG_BLK_DEV_IDEDMA +/* + * This allows the configuration of ide_pci chipset registers + * for cards that learn about the drive's UDMA, DMA, PIO capabilities + * after the drive is reported by the OS. + */ +static int config_chipset_for_dma (ide_drive_t *drive) +{ + struct hd_driveid *id = drive->id; + byte udma_66 = ((id->hw_config & 0x2000) && + (HWIF(drive)->udma_four)) ? 1 : 0; + byte speed = 0x00; + int rval; + + if ((id->dma_ultra & 0x0010) && (udma_66)) { + speed = XFER_UDMA_4; + } else if ((id->dma_ultra & 0x0008) && (udma_66)) { + speed = XFER_UDMA_3; + } else if (id->dma_ultra & 0x0004) { + speed = XFER_UDMA_2; + } else if (id->dma_ultra & 0x0002) { + speed = XFER_UDMA_1; + } else if (id->dma_ultra & 0x0001) { + speed = XFER_UDMA_0; + } else if (id->dma_mword & 0x0004) { + speed = XFER_MW_DMA_2; + } else if (id->dma_mword & 0x0002) { + speed = XFER_MW_DMA_1; + } else if (id->dma_mword & 0x0001) { + speed = XFER_MW_DMA_0; + } else { + return ((int) ide_dma_off_quietly); + } + + (void) amd7409_tune_chipset(drive, speed); + + rval = (int)( ((id->dma_ultra >> 11) & 3) ? ide_dma_on : + ((id->dma_ultra >> 8) & 7) ? ide_dma_on : + ((id->dma_mword >> 8) & 7) ? ide_dma_on : + ide_dma_off_quietly); + + return rval; +} + + + static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -351,6 +354,7 @@ int amd7409_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_amd7409 (struct pci_dev *dev, const char *name) { @@ -370,9 +374,11 @@ unsigned int __init pci_init_amd7409 (struct pci_dev *dev, const char *name) printk("%s: simplex device: DMA will fail!!\n", name); } #if defined(DISPLAY_VIPER_TIMINGS) && defined(CONFIG_PROC_FS) - amd7409_proc = 1; - bmide_dev = dev; - amd7409_display_info = &amd7409_get_info; + if (!amd7409_proc) { + amd7409_proc = 1; + bmide_dev = dev; + amd7409_display_info = &amd7409_get_info; + } #endif /* DISPLAY_VIPER_TIMINGS && CONFIG_PROC_FS */ return 0; @@ -396,8 +402,17 @@ unsigned int __init ata66_amd7409 (ide_hwif_t *hwif) void __init ide_init_amd7409 (ide_hwif_t *hwif) { hwif->tuneproc = &amd7409_tune_drive; + +#ifndef CONFIG_BLK_DEV_IDEDMA + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; + return; +#endif /* CONFIG_BLK_DEV_IDEDMA */ + if (hwif->dma_base) { hwif->dmaproc = &amd7409_dmaproc; + hwif->autodma = 1; } else { hwif->autodma = 0; hwif->drives[0].autotune = 1; diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index 3e1cfcd33..da53155c1 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/buddha.c -- Amiga Buddha and Catweasel IDE Driver + * linux/drivers/ide/buddha.c -- Amiga Buddha and Catweasel IDE Driver * * Copyright (C) 1997 by Geert Uytterhoeven * diff --git a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c index b2077df6d..7a094d497 100644 --- a/drivers/ide/cmd640.c +++ b/drivers/ide/cmd640.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/cmd640.c Version 1.02 Sep 01, 1996 + * linux/drivers/ide/cmd640.c Version 1.02 Sep 01, 1996 * * Copyright (C) 1995-1996 Linus Torvalds & authors (see below) */ diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index b2ae2e6b8..2aaf83b26 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c @@ -1,5 +1,7 @@ /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 * + * linux/drivers/ide/cmd64x.c Version 1.21 Mar. 18, 2000 + * * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. * Note, this driver is not used at all on other systems because * there the "BIOS" has done all of the following already. @@ -116,19 +118,27 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n"); p += sprintf(p, " %sabled %sabled\n", - (reg72&0x80) ? "dis" : " en", (reg7a&0x80) ? "dis" : " en"); + (reg72&0x80)?"dis":" en",(reg7a&0x80)?"dis":" en"); p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n"); p += sprintf(p, "DMA enabled: %s %s %s %s\n", - (reg72&0x20) ? "yes" : "no ", (reg72&0x40) ? "yes" : "no ", (reg7a&0x20) ? "yes" : "no ", (reg7a&0x40) ? "yes" : "no " ); + (reg72&0x20)?"yes":"no ",(reg72&0x40)?"yes":"no ",(reg7a&0x20)?"yes":"no ",(reg7a&0x40)?"yes":"no "); p += sprintf(p, "DMA Mode: %s(%s) %s(%s) %s(%s) %s(%s)\n", (reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO", - (reg72&0x20)?(((reg73&0x15)==0x15)?"4":((reg73&0x25)==0x25)?"3":((reg73&0x10)==0x10)?"2":((reg73&0x20)==0x20)?"1":((reg73&0x30)==0x30)?"0":"X"):"?", + (reg72&0x20)?( ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"): + ((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"): + ((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"):"X"):"?", (reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO", - (reg72&0x40)?(((reg73&0x4A)==0x4A)?"4":((reg73&0x8A)==0x8A)?"3":((reg73&0x40)==0x40)?"2":((reg73&0x80)==0x80)?"1":((reg73&0xC0)==0xC0)?"0":"X"):"?", + (reg72&0x40)?( ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"): + ((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"): + ((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"):"X"):"?", (reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO", - (reg7a&0x20)?(((reg7b&0x15)==0x15)?"4":((reg7b&0x25)==0x25)?"3":((reg7b&0x10)==0x10)?"2":((reg7b&0x20)==0x20)?"1":((reg7b&0x30)==0x30)?"0":"X"):"?", + (reg7a&0x20)?( ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"): + ((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"): + ((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"):"X"):"?", (reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO", - (reg7a&0x40)?(((reg7b&0x4A)==0x4A)?"4":((reg7b&0x8A)==0x8A)?"3":((reg7b&0x40)==0x40)?"2":((reg7b&0x80)==0x80)?"1":((reg7b&0xC0)==0xC0)?"0":"X"):"?" ); + (reg7a&0x40)?( ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"): + ((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"): + ((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"):"X"):"?" ); p += sprintf(p, "PIO Mode: %s %s %s %s\n", "?", "?", "?", "?"); @@ -155,6 +165,22 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) return p-buffer; /* => must be less than 4k! */ } + +#if 0 +static char * cmd64x_chipset_data (char *buf, struct pci_dev *dev) +{ + char *p = buf; + p += sprintf(p, "thingy stuff\n"); + return (char *)p; +} +static int __init cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) +{ + char *p = buffer; + p = cmd64x_chipset_data(buffer, bmide_dev); + return p-buffer; /* hoping it is less than 4K... */ +} +#endif + #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ byte cmd64x_proc = 0; @@ -305,76 +331,60 @@ static void cmd64x_tuneproc (ide_drive_t *drive, byte mode_wanted) setup_count, active_count, recovery_count); } +static void config_chipset_for_pio (ide_drive_t *drive, byte set_speed) +{ + byte speed= 0x00; + byte set_pio= ide_get_best_pio_mode(drive, 4, 5, NULL); + + cmd64x_tuneproc(drive, set_pio); + speed = XFER_PIO_0 + set_pio; + if (set_speed) + (void) ide_config_drive_speed(drive, speed); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA static int tune_chipset_for_dma (ide_drive_t *drive, byte speed) { -#if 0 - struct hd_driveid *id = drive->id; ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; - unsigned long dma_base = hwif->dma_base; byte unit = (drive->select.b.unit & 0x01); - - u8 reg72 = 0, reg73 = 0; /* primary */ - u8 reg7a = 0, reg7b = 0; /* secondary */ - u8 pciU = (hwif->channel) ? UDIDETCR1 : UDIDETCR0; - u8 pciD = (hwif->channel) ? BMIDESR1 : BMIDESR0; - u8 regU = (hwif->channel) ? 2 : 0; - u8 regD = (hwif->channel) ? 2 : 0; - - (void) pci_read_config_byte(dev, BMIDESR0, ®72); - (void) pci_read_config_byte(dev, UDIDETCR0, ®73); - (void) pci_read_config_byte(dev, BMIDESR1, ®7a); - (void) pci_read_config_byte(dev, UDIDETCR1, ®7b); - + int err = 0; + + u8 pciU = (hwif->channel) ? UDIDETCR1 : UDIDETCR0; + u8 pciD = (hwif->channel) ? BMIDESR1 : BMIDESR0; + u8 regU = 0; + u8 regD = 0; + + (void) pci_read_config_byte(dev, pciD, ®D); + (void) pci_read_config_byte(dev, pciU, ®U); + regD &= ~(unit ? 0x40 : 0x20); + regU &= ~(unit ? 0xCA : 0x35); + (void) pci_write_config_byte(dev, pciD, regD); + (void) pci_write_config_byte(dev, pciU, regU); + + (void) pci_read_config_byte(dev, pciD, ®D); + (void) pci_read_config_byte(dev, pciU, ®U); switch(speed) { - case XFER_UDMA_4: - pciU = unit ? 0x4A : 0x15; - case XFER_UDMA_3: - pciU = unit ? 0x8A : 0x25; - case XFER_UDMA_2: - pciU = unit ? 0x42 : 0x11; - case XFER_UDMA_1: - pciU = unit ? 0x82 : 0x21; - case XFER_UDMA_0: - pciU = unit ? 0xC2 : 0x31 -(reg73&0x15)?"4":(reg73&0x25)?"3":(reg73&0x11)?"2":(reg73&0x21)?"1":(reg73&0x31)?"0":"X", -(reg73&0x4A)?"4":(reg73&0x8A)?"3":(reg73&0x42)?"2":(reg73&0x82)?"1":(reg73&0xC2)?"0":"X", -(reg7b&0x15)?"4":(reg7b&0x25)?"3":(reg7b&0x11)?"2":(reg7b&0x21)?"1":(reg7b&0x31)?"0":"X", -(reg7b&0x4A)?"4":(reg7b&0x8A)?"3":(reg7b&0x42)?"2":(reg7b&0x82)?"1":(reg7b&0xC2)?"0":"X", - - case XFER_MW_DMA_2: - pciD = unit ? 0x40 : 0x10; - case XFER_MW_DMA_1: - pciD = unit ? 0x80 : 0x20; - case XFER_MW_DMA_0: - pciD = unit ? 0xC0 : 0x30; - case XFER_SW_DMA_2: - case XFER_SW_DMA_1: - case XFER_SW_DMA_0: -(reg73&0x10)?"2":(reg73&0x20)?"1":(reg73&0x30)?"0":"X", -(reg73&0x40)?"2":(reg73&0x80)?"1":(reg73&0xC0)?"0":"X", -(reg7b&0x10)?"2":(reg7b&0x20)?"1":(reg7b&0x30)?"0":"X", -(reg7b&0x40)?"2":(reg7b&0x80)?"1":(reg7b&0xC0)?"0":"X" ); - + case XFER_UDMA_4: regU |= (unit ? 0x4A : 0x15); break; + case XFER_UDMA_3: regU |= (unit ? 0x8A : 0x25); break; + case XFER_UDMA_2: regU |= (unit ? 0x42 : 0x11); break; + case XFER_UDMA_1: regU |= (unit ? 0x82 : 0x21); break; + case XFER_UDMA_0: regU |= (unit ? 0xC2 : 0x31); break; + case XFER_MW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; + case XFER_MW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; + case XFER_MW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; + case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; + case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; + case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; default: return 1; } + (void) pci_write_config_byte(dev, pciU, regU); + err = ide_config_drive_speed(drive, speed); + regD |= (unit ? 0x40 : 0x20); + (void) pci_write_config_byte(dev, pciD, regD); - (void) ide_config_drive_speed(drive, speed); - outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2); -#endif - return 0; -} - -static void config_chipset_for_pio (ide_drive_t *drive, byte set_speed) -{ - byte speed = 0x00; - byte set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); - - cmd64x_tuneproc(drive, set_pio); - speed = XFER_PIO_0 + set_pio; - if (set_speed) - (void) ide_config_drive_speed(drive, speed); + return err; } static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ultra_66) @@ -382,21 +392,17 @@ static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ul struct hd_driveid *id = drive->id; ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; - unsigned long dma_base = hwif->dma_base; - byte unit = (drive->select.b.unit & 0x01); byte speed = 0x00; byte set_pio = 0x00; - byte udma_timing_bits = 0x00; byte udma_33 = ((rev >= 0x05) || (ultra_66)) ? 1 : 0; byte udma_66 = ((id->hw_config & 0x2000) && (hwif->udma_four)) ? 1 : 0; - /* int drive_number = ((hwif->channel ? 2 : 0) + unit); */ int rval; switch(dev->device) { - case PCI_DEVICE_ID_CMD_643: - case PCI_DEVICE_ID_CMD_646: case PCI_DEVICE_ID_CMD_648: + case PCI_DEVICE_ID_CMD_646: + case PCI_DEVICE_ID_CMD_643: default: break; } @@ -416,22 +422,16 @@ static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ul * in the 646U2. * So we only do UltraDMA on revision 0x05 and 0x07 chipsets. */ - if ((id->dma_ultra & 0x0010) && (udma_66) && (udma_33)) { speed = XFER_UDMA_4; - udma_timing_bits = 0x10; /* 2 clock */ } else if ((id->dma_ultra & 0x0008) && (udma_66) && (udma_33)) { speed = XFER_UDMA_3; - udma_timing_bits = 0x20; /* 3 clock */ } else if ((id->dma_ultra & 0x0004) && (udma_33)) { speed = XFER_UDMA_2; - udma_timing_bits = 0x10; /* 2 clock */ } else if ((id->dma_ultra & 0x0002) && (udma_33)) { speed = XFER_UDMA_1; - udma_timing_bits = 0x20; /* 3 clock */ } else if ((id->dma_ultra & 0x0001) && (udma_33)) { speed = XFER_UDMA_0; - udma_timing_bits = 0x30; /* 4 clock */ } else if (id->dma_mword & 0x0004) { speed = XFER_MW_DMA_2; } else if (id->dma_mword & 0x0002) { @@ -453,27 +453,6 @@ static int config_chipset_for_dma (ide_drive_t *drive, unsigned int rev, byte ul if (set_pio) return ((int) ide_dma_off_quietly); -#if 1 - /* - * This the alternate access method. :-( - * The correct method is to directly setup the pci-config space. - */ - (void) ide_config_drive_speed(drive, speed); - outb(inb(dma_base+2)|(1<<(5+unit)), dma_base+2); - - if (speed >= XFER_UDMA_0) { - byte udma_ctrl = inb(dma_base + 3); - /* Put this channel into UDMA mode. */ - udma_ctrl |= (1 << unit); - udma_ctrl &= ~(0x04 << unit); - if (udma_66) - udma_ctrl |= (0x04 << unit); - udma_ctrl &= ~(0x30 << (unit * 2)); - udma_ctrl |= (udma_timing_bits << (unit * 2)); - outb(udma_ctrl, dma_base+3); - } -#endif - if (tune_chipset_for_dma(drive, speed)) return ((int) ide_dma_off); @@ -500,17 +479,14 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) class_rev &= 0xff; switch(dev->device) { + case PCI_DEVICE_ID_CMD_648: + can_ultra_66 = 1; case PCI_DEVICE_ID_CMD_643: - can_ultra_33 = 1; - can_ultra_66 = 0; + can_ultra_33 = 1; break; case PCI_DEVICE_ID_CMD_646: - can_ultra_33 = (class_rev >= 0x05) ? 1 : 0; - can_ultra_66 = 0; - break; - case PCI_DEVICE_ID_CMD_648: - can_ultra_33 = 1; - can_ultra_66 = 1; + can_ultra_33 = (class_rev >= 0x05) ? 1 : 0; + can_ultra_66 = 0; break; default: return hwif->dmaproc(ide_dma_off, drive); @@ -595,6 +571,7 @@ static int cmd646_1_dmaproc (ide_dma_action_t func, ide_drive_t *drive) /* Other cases are done by generic IDE-DMA code. */ return cmd64x_dmaproc(func, drive); } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_cmd64x (struct pci_dev *dev, const char *name) { @@ -604,9 +581,11 @@ unsigned int __init pci_init_cmd64x (struct pci_dev *dev, const char *name) pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); class_rev &= 0xff; -#if 0 - if (dev->resource[PCI_ROM_RESOURCE].start) +#ifdef __i386__ + if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); + printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start); + } #endif switch(dev->device) { @@ -702,7 +681,9 @@ void __init ide_init_cmd64x (ide_hwif_t *hwif) if (!hwif->dma_base) return; +#ifdef CONFIG_BLK_DEV_IDEDMA switch(dev->device) { + case PCI_DEVICE_ID_CMD_648: case PCI_DEVICE_ID_CMD_643: hwif->dmaproc = &cmd64x_dmaproc; break; @@ -714,10 +695,8 @@ void __init ide_init_cmd64x (ide_hwif_t *hwif) hwif->dmaproc = &cmd64x_dmaproc; } break; - case PCI_DEVICE_ID_CMD_648: - hwif->dmaproc = &cmd64x_dmaproc; - break; default: break; } +#endif /* CONFIG_BLK_DEV_IDEDMA */ } diff --git a/drivers/ide/cs5530.c b/drivers/ide/cs5530.c index bb68f7b2e..b160d7716 100644 --- a/drivers/ide/cs5530.c +++ b/drivers/ide/cs5530.c @@ -1,5 +1,8 @@ /* - * linux/drivers/block/cs5530.c Version 0.5 Feb 13, 2000 + * linux/drivers/ide/cs5530.c Version 0.6 Mar. 18, 2000 + * + * Copyright (C) 2000 Andre Hedrick <andre@suse.com> + * Ditto of GNU General Public License. * * Copyright (C) 2000 Mark Lord <mlord@pobox.com> * May be copied or modified under the terms of the GNU General Public License @@ -23,6 +26,7 @@ #include <linux/ide.h> #include <asm/io.h> #include <asm/irq.h> + #include "ide_modes.h" #define DISPLAY_CS5530_TIMINGS @@ -120,6 +124,7 @@ static void cs5530_tuneproc (ide_drive_t *drive, byte pio) /* pio=255 means "aut } } +#ifdef CONFIG_BLK_DEV_IDEDMA /* * cs5530_config_dma() handles selection/setting of DMA/UDMA modes * for both the chipset and drive. @@ -241,6 +246,7 @@ int cs5530_dmaproc (ide_dma_action_t func, ide_drive_t *drive) /* Other cases are done by generic IDE-DMA code. */ return ide_dmaproc(func, drive); } +#endif /* CONFIG_BLK_DEV_IDEDMA */ /* * Initialize the cs5530 bridge for reliable IDE DMA operation. @@ -322,9 +328,11 @@ unsigned int __init pci_init_cs5530 (struct pci_dev *dev, const char *name) restore_flags(flags); #if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS) - cs5530_proc = 1; - bmide_dev = dev; - cs5530_display_info = &cs5530_get_info; + if (!cs5530_proc) { + cs5530_proc = 1; + bmide_dev = dev; + cs5530_display_info = &cs5530_get_info; + } #endif /* DISPLAY_CS5530_TIMINGS && CONFIG_PROC_FS */ return 0; @@ -343,7 +351,12 @@ void __init ide_init_cs5530 (ide_hwif_t *hwif) } else { unsigned int basereg, d0_timings; +#ifdef CONFIG_BLK_DEV_IDEDMA hwif->dmaproc = &cs5530_dmaproc; +#else + hwif->autodma = 0; +#endif /* CONFIG_BLK_DEV_IDEDMA */ + hwif->tuneproc = &cs5530_tuneproc; basereg = CS5530_BASEREG(hwif); d0_timings = inl(basereg+0); diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c index cfff0381c..4498b754b 100644 --- a/drivers/ide/cy82c693.c +++ b/drivers/ide/cy82c693.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/cy82c693.c Version 0.34 Dec. 13, 1999 + * linux/drivers/ide/cy82c693.c Version 0.34 Dec. 13, 1999 * * Copyright (C) 1998-99 Andreas S. Krebs (akrebs@altavista.net), Maintainer * Copyright (C) 1998-99 Andre Hedrick, Integrater @@ -44,6 +44,7 @@ * */ +#include <linux/config.h> #include <linux/types.h> #include <linux/pci.h> #include <linux/delay.h> @@ -176,6 +177,7 @@ static void compute_clocks (byte pio, pio_clocks_t *p_pclk) p_pclk->time_8 = (byte)clk1; } +#ifdef CONFIG_BLK_DEV_IDEDMA /* * set DMA mode a specific channel for CY82C693 */ @@ -262,6 +264,7 @@ static int cy82c693_dmaproc(ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); } +#endif /* CONFIG_BLK_DEV_IDEDMA */ /* * tune ide drive - set PIO mode @@ -432,10 +435,14 @@ void __init ide_init_cy82c693(ide_hwif_t *hwif) { hwif->chipset = ide_cy82c693; hwif->tuneproc = &cy82c693_tune_drive; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; + +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) { hwif->dmaproc = &cy82c693_dmaproc; - } else { - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; + hwif->autodma = 1; } +#endif /* CONFIG_BLK_DEV_IDEDMA */ } diff --git a/drivers/ide/dtc2278.c b/drivers/ide/dtc2278.c index d8838e111..28537d048 100644 --- a/drivers/ide/dtc2278.c +++ b/drivers/ide/dtc2278.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/dtc2278.c Version 0.02 Feb 10, 1996 + * linux/drivers/ide/dtc2278.c Version 0.02 Feb 10, 1996 * * Copyright (C) 1996 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index 7bce07517..096d75fc0 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/falconide.c -- Atari Falcon IDE Driver + * linux/drivers/ide/falconide.c -- Atari Falcon IDE Driver * * Created 12 Jul 1997 by Geert Uytterhoeven * diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c index 29cceb20e..170bf16f7 100644 --- a/drivers/ide/gayle.c +++ b/drivers/ide/gayle.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/gayle.c -- Amiga Gayle IDE Driver + * linux/drivers/ide/gayle.c -- Amiga Gayle IDE Driver * * Created 9 Jul 1997 by Geert Uytterhoeven * diff --git a/drivers/ide/hd.c b/drivers/ide/hd.c index 5520c17b0..b64a9738c 100644 --- a/drivers/ide/hd.c +++ b/drivers/ide/hd.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/hd.c + * linux/drivers/ide/hd.c * * Copyright (C) 1991, 1992 Linus Torvalds */ diff --git a/drivers/ide/hpt34x.c b/drivers/ide/hpt34x.c index 425ce35a4..a68e7f740 100644 --- a/drivers/ide/hpt34x.c +++ b/drivers/ide/hpt34x.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/hpt34x.c Version 0.29 Feb. 10, 2000 + * linux/drivers/ide/hpt34x.c Version 0.30 Mar. 18, 2000 * * Copyright (C) 1998-2000 Andre Hedrick (andre@suse.com) * May be copied or modified under the terms of the GNU General Public License @@ -144,6 +144,59 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, byte speed) return(err); } +static void config_chipset_for_pio (ide_drive_t *drive) +{ + unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; + unsigned short xfer_pio = drive->id->eide_pio_modes; + + byte timing, speed, pio; + + pio = ide_get_best_pio_mode(drive, 255, 5, NULL); + + if (xfer_pio> 4) + xfer_pio = 0; + + if (drive->id->eide_pio_iordy > 0) { + for (xfer_pio = 5; + xfer_pio>0 && + drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; + xfer_pio--); + } else { + xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : + (drive->id->eide_pio_modes & 2) ? 0x04 : + (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio; + } + + timing = (xfer_pio >= pio) ? xfer_pio : pio; + + switch(timing) { + case 4: speed = XFER_PIO_4;break; + case 3: speed = XFER_PIO_3;break; + case 2: speed = XFER_PIO_2;break; + case 1: speed = XFER_PIO_1;break; + default: + speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; + break; + } + (void) hpt34x_tune_chipset(drive, speed); +} + +static void hpt34x_tune_drive (ide_drive_t *drive, byte pio) +{ + byte speed; + + switch(pio) { + case 4: speed = XFER_PIO_4;break; + case 3: speed = XFER_PIO_3;break; + case 2: speed = XFER_PIO_2;break; + case 1: speed = XFER_PIO_1;break; + default: speed = XFER_PIO_0;break; + } + hpt34x_clear_chipset(drive); + (void) hpt34x_tune_chipset(drive, speed); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA /* * This allows the configuration of ide_pci chipset registers * for cards that learn about the drive's UDMA, DMA, PIO capabilities @@ -195,58 +248,6 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) ide_dma_off_quietly); } -static void config_chipset_for_pio (ide_drive_t *drive) -{ - unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; - unsigned short xfer_pio = drive->id->eide_pio_modes; - - byte timing, speed, pio; - - pio = ide_get_best_pio_mode(drive, 255, 5, NULL); - - if (xfer_pio> 4) - xfer_pio = 0; - - if (drive->id->eide_pio_iordy > 0) { - for (xfer_pio = 5; - xfer_pio>0 && - drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; - xfer_pio--); - } else { - xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : - (drive->id->eide_pio_modes & 2) ? 0x04 : - (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio; - } - - timing = (xfer_pio >= pio) ? xfer_pio : pio; - - switch(timing) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: - speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; - break; - } - (void) hpt34x_tune_chipset(drive, speed); -} - -static void hpt34x_tune_drive (ide_drive_t *drive, byte pio) -{ - byte speed; - - switch(pio) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: speed = XFER_PIO_0;break; - } - hpt34x_clear_chipset(drive); - (void) hpt34x_tune_chipset(drive, speed); -} - static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -347,6 +348,7 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ /* * If the BIOS does not set the IO base addaress to XX00, 343 will fail. @@ -395,9 +397,11 @@ unsigned int __init pci_init_hpt34x (struct pci_dev *dev, const char *name) __restore_flags(flags); /* local CPU only */ #if defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) - hpt34x_proc = 1; - bmide_dev = dev; - hpt34x_display_info = &hpt34x_get_info; + if (!hpt34x_proc) { + hpt34x_proc = 1; + bmide_dev = dev; + hpt34x_display_info = &hpt34x_get_info; + } #endif /* DISPLAY_HPT34X_TIMINGS && CONFIG_PROC_FS */ return dev->irq; @@ -406,6 +410,8 @@ unsigned int __init pci_init_hpt34x (struct pci_dev *dev, const char *name) void __init ide_init_hpt34x (ide_hwif_t *hwif) { hwif->tuneproc = &hpt34x_tune_drive; + +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) { unsigned short pcicmd = 0; @@ -416,4 +422,9 @@ void __init ide_init_hpt34x (ide_hwif_t *hwif) hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; } +#else /* !CONFIG_BLK_DEV_IDEDMA */ + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; +#endif /* CONFIG_BLK_DEV_IDEDMA */ } diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index d2f2fb433..fd5971ef9 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/hpt366.c Version 0.16 Feb. 10, 2000 + * linux/drivers/ide/hpt366.c Version 0.17 Mar. 18, 2000 * * Copyright (C) 1999-2000 Andre Hedrick <andre@suse.com> * May be copied or modified under the terms of the GNU General Public License @@ -259,6 +259,64 @@ static int hpt366_tune_chipset (ide_drive_t *drive, byte speed) return(err); } +static void config_chipset_for_pio (ide_drive_t *drive) +{ + unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; + unsigned short xfer_pio = drive->id->eide_pio_modes; + byte timing, speed, pio; + +#if HPT366_DEBUG_DRIVE_INFO + printk("%s: config_chipset_for_pio\n", drive->name); +#endif /* HPT366_DEBUG_DRIVE_INFO */ + pio = ide_get_best_pio_mode(drive, 255, 5, NULL); + + if (xfer_pio> 4) + xfer_pio = 0; + + if (drive->id->eide_pio_iordy > 0) { + for (xfer_pio = 5; + xfer_pio>0 && + drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; + xfer_pio--); + } else { + xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : + (drive->id->eide_pio_modes & 2) ? 0x04 : + (drive->id->eide_pio_modes & 1) ? 0x03 : + (drive->id->tPIO & 2) ? 0x02 : + (drive->id->tPIO & 1) ? 0x01 : xfer_pio; + } + + timing = (xfer_pio >= pio) ? xfer_pio : pio; + + switch(timing) { + case 4: speed = XFER_PIO_4;break; + case 3: speed = XFER_PIO_3;break; + case 2: speed = XFER_PIO_2;break; + case 1: speed = XFER_PIO_1;break; + default: + speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; + break; + } +#if HPT366_DEBUG_DRIVE_INFO + printk("%s: config_chipset_for_pio: speed=0x%04x\n", drive->name, speed); +#endif /* HPT366_DEBUG_DRIVE_INFO */ + (void) hpt366_tune_chipset(drive, speed); +} + +static void hpt366_tune_drive (ide_drive_t *drive, byte pio) +{ + byte speed; + switch(pio) { + case 4: speed = XFER_PIO_4;break; + case 3: speed = XFER_PIO_3;break; + case 2: speed = XFER_PIO_2;break; + case 1: speed = XFER_PIO_1;break; + default: speed = XFER_PIO_0;break; + } + (void) hpt366_tune_chipset(drive, speed); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA /* * This allows the configuration of ide_pci chipset registers * for cards that learn about the drive's UDMA, DMA, PIO capabilities @@ -347,63 +405,6 @@ static int config_chipset_for_dma (ide_drive_t *drive) return rval; } -static void config_chipset_for_pio (ide_drive_t *drive) -{ - unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; - unsigned short xfer_pio = drive->id->eide_pio_modes; - byte timing, speed, pio; - -#if HPT366_DEBUG_DRIVE_INFO - printk("%s: config_chipset_for_pio\n", drive->name); -#endif /* HPT366_DEBUG_DRIVE_INFO */ - pio = ide_get_best_pio_mode(drive, 255, 5, NULL); - - if (xfer_pio> 4) - xfer_pio = 0; - - if (drive->id->eide_pio_iordy > 0) { - for (xfer_pio = 5; - xfer_pio>0 && - drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; - xfer_pio--); - } else { - xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : - (drive->id->eide_pio_modes & 2) ? 0x04 : - (drive->id->eide_pio_modes & 1) ? 0x03 : - (drive->id->tPIO & 2) ? 0x02 : - (drive->id->tPIO & 1) ? 0x01 : xfer_pio; - } - - timing = (xfer_pio >= pio) ? xfer_pio : pio; - - switch(timing) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: - speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; - break; - } -#if HPT366_DEBUG_DRIVE_INFO - printk("%s: config_chipset_for_pio: speed=0x%04x\n", drive->name, speed); -#endif /* HPT366_DEBUG_DRIVE_INFO */ - (void) hpt366_tune_chipset(drive, speed); -} - -static void hpt366_tune_drive (ide_drive_t *drive, byte pio) -{ - byte speed; - switch(pio) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: speed = XFER_PIO_0;break; - } - (void) hpt366_tune_chipset(drive, speed); -} - static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -478,6 +479,7 @@ int hpt366_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_hpt366 (struct pci_dev *dev, const char *name) { @@ -532,13 +534,20 @@ unsigned int __init ata66_hpt366 (ide_hwif_t *hwif) void __init ide_init_hpt366 (ide_hwif_t *hwif) { hwif->tuneproc = &hpt366_tune_drive; +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) { hwif->dmaproc = &hpt366_dmaproc; + hwif->autodma = 1; } else { hwif->autodma = 0; hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; } +#else /* !CONFIG_BLK_DEV_IDEDMA */ + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; +#endif /* CONFIG_BLK_DEV_IDEDMA */ } void ide_dmacapable_hpt366 (ide_hwif_t *hwif, unsigned long dmabase) diff --git a/drivers/ide/ht6560b.c b/drivers/ide/ht6560b.c index 6b7d5af72..1c0b55dac 100644 --- a/drivers/ide/ht6560b.c +++ b/drivers/ide/ht6560b.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ht6560b.c Version 0.07 Feb 1, 2000 + * linux/drivers/ide/ht6560b.c Version 0.07 Feb 1, 2000 * * Copyright (C) 1995-2000 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index d0e8f8328..213ddbff0 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/icside.c + * linux/drivers/ide/icside.c * * Copyright (c) 1996,1997 Russell King. * diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 641783e9c..17cc3eb88 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1,5 +1,6 @@ /* - * linux/drivers/block/ide-cd.c + * linux/drivers/ide/ide-cd.c + * * Copyright (C) 1994, 1995, 1996 scott snyder <snyder@fnald0.fnal.gov> * Copyright (C) 1996-1998 Erik Andersen <andersee@debian.org> * Copyright (C) 1998, 1999 Jens Axboe <axboe@image.dk> @@ -276,6 +277,7 @@ #define IDECD_VERSION "4.56" +#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -2400,21 +2402,10 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) printk (", %dkB Cache", be16_to_cpu(buf.cap.buffer_size)); - if (drive->using_dma) { - if ((drive->id->field_valid & 4) && - (drive->id->hw_config & 0x2000) && - (HWIF(drive)->udma_four) && - (drive->id->dma_ultra & (drive->id->dma_ultra >> 11) & 3)) { - printk(", UDMA(66)"); /* UDMA BIOS-enabled! */ - } else if ((drive->id->field_valid & 4) && - (drive->id->dma_ultra & (drive->id->dma_ultra >> 8) & 7)) { - printk(", UDMA(33)"); /* UDMA BIOS-enabled! */ - } else if (drive->id->field_valid & 4) { - printk(", (U)DMA"); /* Can be BIOS-enabled! */ - } else { - printk(", DMA"); - } - } +#ifdef CONFIG_BLK_DEV_IDEDMA + if (drive->using_dma) + (void) HWIF(drive)->dmaproc(ide_dma_verbose, drive); +#endif /* CONFIG_BLK_DEV_IDEDMA */ printk("\n"); return nslots; diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 1eb48ef6c..77937dd4b 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide_cd.h + * linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen * Copyright (C) 1998-2000 Jens Axboe diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 2ef50f285..33014bc06 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-disk.c Version 1.09 April 23, 1999 + * linux/drivers/ide/ide-disk.c Version 1.09 April 23, 1999 * * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) */ @@ -821,21 +821,10 @@ static void idedisk_setup (ide_drive_t *drive) drive->name, id->model, capacity/2048L, id->buf_size/2, drive->bios_cyl, drive->bios_head, drive->bios_sect); - - if (drive->using_dma) { - if ((id->field_valid & 4) && (id->hw_config & 0x2000) && - (HWIF(drive)->udma_four) && - (id->dma_ultra & (id->dma_ultra >> 11) & 3)) { - printk(", UDMA(66)"); /* UDMA BIOS-enabled! */ - } else if ((id->field_valid & 4) && - (id->dma_ultra & (id->dma_ultra >> 8) & 7)) { - printk(", UDMA(33)"); /* UDMA BIOS-enabled! */ - } else if (id->field_valid & 4) { - printk(", (U)DMA"); /* Can be BIOS-enabled! */ - } else { - printk(", DMA"); - } - } +#ifdef CONFIG_BLK_DEV_IDEDMA + if (drive->using_dma) + (void) HWIF(drive)->dmaproc(ide_dma_verbose, drive); +#endif /* CONFIG_BLK_DEV_IDEDMA */ printk("\n"); drive->mult_count = 0; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 751424831..9caffd2f1 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-dma.c Version 4.09 April 23, 1999 + * linux/drivers/ide/ide-dma.c Version 4.09 April 23, 1999 * * Copyright (c) 1999 Andre Hedrick * May be copied or modified under the terms of the GNU General Public License @@ -354,6 +354,29 @@ int check_drive_lists (ide_drive_t *drive, int good_bad) return 0; } +int report_drive_dmaing (ide_drive_t *drive) +{ + struct hd_driveid *id = drive->id; + + if ((id->field_valid & 4) && (id->hw_config & 0x2000) && + (HWIF(drive)->udma_four) && + (id->dma_ultra & (id->dma_ultra >> 11) & 3)) { + if ((id->dma_ultra >> 12) & 1) { + printk(", UDMA(66)"); /* UDMA BIOS-enabled! */ + } else { + printk(", UDMA(44)"); /* UDMA BIOS-enabled! */ + } + } else if ((id->field_valid & 4) && + (id->dma_ultra & (id->dma_ultra >> 8) & 7)) { + printk(", UDMA(33)"); /* UDMA BIOS-enabled! */ + } else if (id->field_valid & 4) { + printk(", (U)DMA"); /* Can be BIOS-enabled! */ + } else { + printk(", DMA"); + } + return 1; +} + static int config_drive_for_dma (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -453,6 +476,9 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive) case ide_dma_bad_drive: case ide_dma_good_drive: return check_drive_lists(drive, (func == ide_dma_good_drive)); + case ide_dma_verbose: + return report_drive_dmaing(drive); + case ide_dma_retune: case ide_dma_lostirq: case ide_dma_timeout: printk("ide_dmaproc: chipset supported %s func only: %d\n", ide_dmafunc_verbose(func), func); diff --git a/drivers/ide/ide-features.c b/drivers/ide/ide-features.c index 3f29ed591..371f57ad8 100644 --- a/drivers/ide/ide-features.c +++ b/drivers/ide/ide-features.c @@ -100,6 +100,8 @@ char *ide_dmafunc_verbose (ide_dma_action_t dmafunc) case ide_dma_test_irq: return("ide_dma_test_irq"); case ide_dma_bad_drive: return("ide_dma_bad_drive"); case ide_dma_good_drive: return("ide_dma_good_drive"); + case ide_dma_verbose: return("ide_dma_verbose"); + case ide_dma_retune: return("ide_dma_retune"); case ide_dma_lostirq: return("ide_dma_lostirq"); case ide_dma_timeout: return("ide_dma_timeout"); default: return("unknown"); diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 58eb2411d..55349e92a 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-floppy.c Version 0.9 Jul 4, 1999 + * linux/drivers/ide/ide-floppy.c Version 0.9 Jul 4, 1999 * * Copyright (C) 1996 - 1999 Gadi Oxman <gadio@netvision.net.il> */ diff --git a/drivers/ide/ide-geometry.c b/drivers/ide/ide-geometry.c index 4c67d0911..29de5bb09 100644 --- a/drivers/ide/ide-geometry.c +++ b/drivers/ide/ide-geometry.c @@ -1,9 +1,9 @@ /* - * linux/drivers/block/ide-geometry.c + * linux/drivers/ide/ide-geometry.c */ #include <linux/config.h> -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) +#ifdef CONFIG_IDE #include <linux/ide.h> #include <asm/io.h> @@ -211,4 +211,4 @@ int ide_xlate_1024 (kdev_t i_rdev, int xparm, int ptheads, const char *msg) drive->bios_cyl, drive->bios_head, drive->bios_sect); return ret; } -#endif /* (CONFIG_BLK_DEV_IDE) || (CONFIG_BLK_DEV_IDE_MODULE) */ +#endif /* CONFIG_IDE */ diff --git a/drivers/ide/ide-pci.c b/drivers/ide/ide-pci.c index f667ee6dd..cdd10f6e1 100644 --- a/drivers/ide/ide-pci.c +++ b/drivers/ide/ide-pci.c @@ -1,7 +1,7 @@ /* - * linux/drivers/block/ide-pci.c Version 1.04 July 27, 1999 + * linux/drivers/ide/ide-pci.c Version 1.04 July 27, 1999 * - * Copyright (c) 1998-1999 Andre Hedrick + * Copyright (c) 1998-2000 Andre Hedrick <andre@linux-ide.org> * * Copyright (c) 1995-1998 Mark Lord * May be copied or modified under the terms of the GNU General Public License diff --git a/drivers/ide/ide-pmac.c b/drivers/ide/ide-pmac.c index e0803e6fa..7f5226db9 100644 --- a/drivers/ide/ide-pmac.c +++ b/drivers/ide/ide-pmac.c @@ -1,4 +1,6 @@ /* + * linux/drivers/ide/ide-pmac.c Version ?.?? Mar. 18, 2000 + * * Support for IDE interfaces on PowerMacs. * These IDE interfaces are memory-mapped and have a DBDMA channel * for doing DMA. @@ -10,7 +12,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Some code taken from drivers/block/ide-dma.c: + * Some code taken from drivers/ide/ide-dma.c: * * Copyright (c) 1995-1998 Mark Lord * diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index ffa3ade56..d8edb89c5 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-pnp.c + * linux/drivers/ide/ide-pnp.c * * This file provides autodetection for ISA PnP IDE interfaces. * It was tested with "ESS ES1868 Plug and Play AudioDrive" IDE interface. diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 0e617216d..200204ee6 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-probe.c Version 1.05 July 3, 1999 + * linux/drivers/ide/ide-probe.c Version 1.05 July 3, 1999 * * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) */ diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 753597e9c..fd33e4e42 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-proc.c Version 1.03 January 2, 1998 + * linux/drivers/ide/ide-proc.c Version 1.03 January 2, 1998 * * Copyright (C) 1997-1998 Mark Lord */ diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 95e780abf..c4424cf90 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide-tape.c Version 1.16f Dec 15, 1999 + * linux/drivers/ide/ide-tape.c Version 1.16f Dec 15, 1999 * * Copyright (C) 1995 - 1999 Gadi Oxman <gadio@netvision.net.il> * diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 9c409dfb6..89921f7b9 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide.c Version 6.30 Dec 28, 1999 + * linux/drivers/ide/ide.c Version 6.30 Dec 28, 1999 * * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) */ @@ -1809,9 +1809,9 @@ static void revalidate_drives (void) static void ide_probe_module (void) { if (!ide_probe) { -#ifdef CONFIG_KMOD +#if defined(CONFIG_KMOD) && defined(CONFIG_BLK_DEV_IDE_MODULE) (void) request_module("ide-probe-mod"); -#endif /* CONFIG_KMOD */ +#endif /* (CONFIG_KMOD) && (CONFIG_BLK_DEV_IDE_MODULE) */ } else { (void) ide_probe->init(); } @@ -2491,6 +2491,30 @@ static int ide_ioctl (struct inode *inode, struct file *file, return 0; } + case HDIO_GETGEO_BIG: + { + struct hd_big_geometry *loc = (struct hd_big_geometry *) arg; + if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL; + if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT; + if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT; + if (put_user(drive->bios_cyl, (unsigned int *) &loc->cylinders)) return -EFAULT; + if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect, + (unsigned long *) &loc->start)) return -EFAULT; + return 0; + } + + case HDIO_GETGEO_BIG_RAW: + { + struct hd_big_geometry *loc = (struct hd_big_geometry *) arg; + if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL; + if (put_user(drive->head, (byte *) &loc->heads)) return -EFAULT; + if (put_user(drive->sect, (byte *) &loc->sectors)) return -EFAULT; + if (put_user(drive->cyl, (unsigned int *) &loc->cylinders)) return -EFAULT; + if (put_user((unsigned)drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect, + (unsigned long *) &loc->start)) return -EFAULT; + return 0; + } + case BLKGETSIZE: /* Return device size */ return put_user(drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects, (long *) arg); @@ -2564,8 +2588,7 @@ static int ide_ioctl (struct inode *inode, struct file *file, } case HDIO_UNREGISTER_HWIF: if (!capable(CAP_SYS_ADMIN)) return -EACCES; - /* should I check here for arg > MAX_HWIFS, or - just let ide_unregister fail silently? -- shaver */ + /* (arg > MAX_HWIFS) checked in function */ ide_unregister(arg); return 0; case HDIO_SET_NICE: diff --git a/drivers/ide/ide_modes.h b/drivers/ide/ide_modes.h index f94d91313..ff71b2c2c 100644 --- a/drivers/ide/ide_modes.h +++ b/drivers/ide/ide_modes.h @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide_modes.h + * linux/drivers/ide/ide_modes.h * * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord */ diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index 0e5675fde..7a24fce25 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c @@ -1,12 +1,14 @@ /* - * linux/drivers/block/ns87415.c Version 1.00 December 7, 1997 + * linux/drivers/ide/ns87415.c Version 1.01 Mar. 18, 2000 * - * Copyright (C) 1997-1998 Mark Lord - * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) + * Copyright (C) 1997-1998 Mark Lord <mlord@pobox.com> + * Copyright (C) 1998 Eddie C. Dost <ecd@skynet.be> + * Copyright (C) 1999-2000 Andre Hedrick <andre@suse.com> * - * Inspired by an earlier effort from David S. Miller (davem@caipfs.rutgers.edu) + * Inspired by an earlier effort from David S. Miller <davem@redhat.com> */ +#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/timer.h> @@ -78,6 +80,7 @@ static void ns87415_selectproc (ide_drive_t *drive) ns87415_prepare_drive (drive, drive->using_dma); } +#ifdef CONFIG_BLK_DEV_IDEDMA static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); @@ -106,6 +109,7 @@ static int ns87415_dmaproc(ide_dma_action_t func, ide_drive_t *drive) return ide_dmaproc(func, drive); /* use standard DMA stuff */ } } +#endif /* CONFIG_BLK_DEV_IDEDMA */ void __init ide_init_ns87415 (ide_hwif_t *hwif) { @@ -179,7 +183,10 @@ void __init ide_init_ns87415 (ide_hwif_t *hwif) else if (!hwif->irq && hwif->mate && hwif->mate->irq) hwif->irq = hwif->mate->irq; /* share IRQ with mate */ +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) hwif->dmaproc = &ns87415_dmaproc; +#endif /* CONFIG_BLK_DEV_IDEDMA */ + hwif->selectproc = &ns87415_selectproc; } diff --git a/drivers/ide/opti621.c b/drivers/ide/opti621.c index cc2aa567c..277f2f490 100644 --- a/drivers/ide/opti621.c +++ b/drivers/ide/opti621.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/opti621.c Version 0.6 Jan 02, 1999 + * linux/drivers/ide/opti621.c Version 0.6 Jan 02, 1999 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) */ diff --git a/drivers/ide/pdc202xx.c b/drivers/ide/pdc202xx.c index 9ec7c8997..b93c6ad1b 100644 --- a/drivers/ide/pdc202xx.c +++ b/drivers/ide/pdc202xx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/pdc202xx.c Version 0.29 Feb. 10, 2000 + * linux/drivers/ide/pdc202xx.c Version 0.30 Mar. 18, 2000 * * Copyright (C) 1998-2000 Andre Hedrick (andre@suse.com) * May be copied or modified under the terms of the GNU General Public License @@ -9,6 +9,9 @@ * Note that BIOS v1.29 is reported to fix the problem. Since this is * safe chipset tuning, including this support is harmless * + * Promise Ultra66 cards with BIOS v1.11 this + * compiled into the kernel if you have more than one card installed. + * * The latest chipset code will support the following :: * Three Ultra33 controllers and 12 drives. * 8 are UDMA supported and 4 are limited to DMA mode 2 multi-word. @@ -16,60 +19,6 @@ * * UNLESS you enable "CONFIG_PDC202XX_BURST" * - * There is only one BIOS in the three contollers. - * - * May 8 20:56:17 Orion kernel: - * Uniform Multi-Platform E-IDE driver Revision: 6.19 - * PDC20246: IDE controller on PCI bus 00 dev a0 - * PDC20246: not 100% native mode: will probe irqs later - * PDC20246: ROM enabled at 0xfebd0000 - * PDC20246: (U)DMA Burst Bit ENABLED Primary PCI Mode Secondary PCI Mode. - * ide0: BM-DMA at 0xef80-0xef87, BIOS settings: hda:DMA, hdb:DMA - * ide1: BM-DMA at 0xef88-0xef8f, BIOS settings: hdc:pio, hdd:pio - * PDC20246: IDE controller on PCI bus 00 dev 98 - * PDC20246: not 100% native mode: will probe irqs later - * PDC20246: ROM enabled at 0xfebc0000 - * PDC20246: (U)DMA Burst Bit ENABLED Primary PCI Mode Secondary PCI Mode. - * ide2: BM-DMA at 0xef40-0xef47, BIOS settings: hde:DMA, hdf:DMA - * ide3: BM-DMA at 0xef48-0xef4f, BIOS settings: hdg:DMA, hdh:DMA - * PDC20246: IDE controller on PCI bus 00 dev 90 - * PDC20246: not 100% native mode: will probe irqs later - * PDC20246: ROM enabled at 0xfebb0000 - * PDC20246: (U)DMA Burst Bit DISABLED Primary PCI Mode Secondary PCI Mode. - * PDC20246: FORCING BURST BIT 0x00 -> 0x01 ACTIVE - * ide4: BM-DMA at 0xef00-0xef07, BIOS settings: hdi:DMA, hdj:pio - * ide5: BM-DMA at 0xef08-0xef0f, BIOS settings: hdk:pio, hdl:pio - * PIIX3: IDE controller on PCI bus 00 dev 39 - * PIIX3: device not capable of full native PCI mode - * - * ide0 at 0xeff0-0xeff7,0xefe6 on irq 19 - * ide1 at 0xefa8-0xefaf,0xebe6 on irq 19 - * ide2 at 0xefa0-0xefa7,0xef7e on irq 18 - * ide3 at 0xef68-0xef6f,0xef66 on irq 18 - * ide4 at 0xef38-0xef3f,0xef62 on irq 17 - * hda: QUANTUM FIREBALL ST6.4A, 6149MB w/81kB Cache, CHS=13328/15/63, UDMA(33) - * hdb: QUANTUM FIREBALL ST3.2A, 3079MB w/81kB Cache, CHS=6256/16/63, UDMA(33) - * hde: Maxtor 72004 AP, 1916MB w/128kB Cache, CHS=3893/16/63, DMA - * hdf: Maxtor 71626 A, 1554MB w/64kB Cache, CHS=3158/16/63, DMA - * hdi: Maxtor 90680D4, 6485MB w/256kB Cache, CHS=13176/16/63, UDMA(33) - * hdj: Maxtor 90680D4, 6485MB w/256kB Cache, CHS=13176/16/63, UDMA(33) - * - * Promise Ultra66 cards with BIOS v1.11 this - * compiled into the kernel if you have more than one card installed. - * - * PDC20262: IDE controller on PCI bus 00 dev a0 - * PDC20262: not 100% native mode: will probe irqs later - * PDC20262: ROM enabled at 0xfebb0000 - * PDC20262: (U)DMA Burst Bit ENABLED Primary PCI Mode Secondary PCI Mode. - * ide0: BM-DMA at 0xef00-0xef07, BIOS settings: hda:pio, hdb:pio - * ide1: BM-DMA at 0xef08-0xef0f, BIOS settings: hdc:pio, hdd:pio - * - * UDMA 4/2 and UDMA 3/1 only differ by the testing bit 13 in word93. - * Chipset timing speeds must be identical - * - * drive_number - * = ((HWIF(drive)->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); - * = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); */ /* @@ -100,7 +49,7 @@ #define PDC202XX_DEBUG_DRIVE_INFO 0 #define PDC202XX_DECODE_REGISTER_INFO 0 -#undef DISPLAY_PDC202XX_TIMINGS +#define DISPLAY_PDC202XX_TIMINGS #if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) #include <linux/stat.h> @@ -111,13 +60,56 @@ extern int (*pdc202xx_display_info)(char *, char **, off_t, int); /* ide-proc.c extern char *ide_media_verbose(ide_drive_t *); static struct pci_dev *bmide_dev; +char *pdc202xx_pio_verbose (u32 drive_pci) +{ + if ((drive_pci & 0x000ff000) == 0x000ff000) return("NOTSET"); + if ((drive_pci & 0x00000401) == 0x00000401) return("PIO 4"); + if ((drive_pci & 0x00000602) == 0x00000602) return("PIO 3"); + if ((drive_pci & 0x00000803) == 0x00000803) return("PIO 2"); + if ((drive_pci & 0x00000C05) == 0x00000C05) return("PIO 1"); + if ((drive_pci & 0x00001309) == 0x00001309) return("PIO 0"); + return("PIO ?"); +} + +char *pdc202xx_dma_verbose (u32 drive_pci) +{ + if ((drive_pci & 0x00036000) == 0x00036000) return("MWDMA 2"); + if ((drive_pci & 0x00046000) == 0x00046000) return("MWDMA 1"); + if ((drive_pci & 0x00056000) == 0x00056000) return("MWDMA 0"); + if ((drive_pci & 0x00056000) == 0x00056000) return("SWDMA 2"); + if ((drive_pci & 0x00068000) == 0x00068000) return("SWDMA 1"); + if ((drive_pci & 0x000BC000) == 0x000BC000) return("SWDMA 0"); + return("PIO---"); +} + +char *pdc202xx_ultra_verbose (u32 drive_pci, u16 slow_cable) +{ + if ((drive_pci & 0x000ff000) == 0x000ff000) + return("NOTSET"); + if ((drive_pci & 0x00012000) == 0x00012000) + return((slow_cable) ? "UDMA 2" : "UDMA 4"); + if ((drive_pci & 0x00024000) == 0x00024000) + return((slow_cable) ? "UDMA 1" : "UDMA 3"); + if ((drive_pci & 0x00036000) == 0x00036000) + return("UDMA 0"); + return(pdc202xx_dma_verbose(drive_pci)); +} + static int pdc202xx_get_info (char *buffer, char **addr, off_t offset, int count) { char *p = buffer; u32 bibma = bmide_dev->resource[4].start; + u32 reg60h = 0, reg64h = 0, reg68h = 0, reg6ch = 0; + u16 reg50h = 0, pmask = (1<<10), smask = (1<<11); u8 c0 = 0, c1 = 0; + pci_read_config_word(bmide_dev, 0x50, ®50h); + pci_read_config_dword(bmide_dev, 0x60, ®60h); + pci_read_config_dword(bmide_dev, 0x64, ®64h); + pci_read_config_dword(bmide_dev, 0x68, ®68h); + pci_read_config_dword(bmide_dev, 0x6c, ®6ch); + /* * at that point bibma+0x2 et bibma+0xa are byte registers * to investigate: @@ -131,6 +123,7 @@ static int pdc202xx_get_info (char *buffer, char **addr, off_t offset, int count break; case PCI_DEVICE_ID_PROMISE_20246: p += sprintf(p, "\n PDC20246 Chipset.\n"); + reg50h |= 0x0c00; break; default: p += sprintf(p, "\n PDC202XX Chipset.\n"); @@ -139,17 +132,18 @@ static int pdc202xx_get_info (char *buffer, char **addr, off_t offset, int count p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n"); p += sprintf(p, " %sabled %sabled\n", - (c0&0x80) ? "dis" : " en", - (c1&0x80) ? "dis" : " en"); + (c0&0x80)?"dis":" en",(c1&0x80)?"dis":" en"); p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n"); p += sprintf(p, "DMA enabled: %s %s %s %s\n", - (c0&0x20) ? "yes" : "no ", (c0&0x40) ? "yes" : "no ", - (c1&0x20) ? "yes" : "no ", (c1&0x40) ? "yes" : "no " ); - - p += sprintf(p, "UDMA\n"); - p += sprintf(p, "DMA\n"); - p += sprintf(p, "PIO\n"); - + (c0&0x20)?"yes":"no ",(c0&0x40)?"yes":"no ",(c1&0x20)?"yes":"no ",(c1&0x40)?"yes":"no "); + p += sprintf(p, "DMA Mode: %s %s %s %s\n", + pdc202xx_ultra_verbose(reg60h, (reg50h & pmask)), + pdc202xx_ultra_verbose(reg64h, (reg50h & pmask)), + pdc202xx_ultra_verbose(reg68h, (reg50h & smask)), + pdc202xx_ultra_verbose(reg6ch, (reg50h & smask))); + p += sprintf(p, " PIO Mode: %s %s %s %s\n", + pdc202xx_pio_verbose(reg60h),pdc202xx_pio_verbose(reg64h), + pdc202xx_pio_verbose(reg68h),pdc202xx_pio_verbose(reg6ch)); return p-buffer; /* => must be less than 4k! */ } #endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */ @@ -268,6 +262,90 @@ static void decode_registers (byte registers, byte value) #endif /* PDC202XX_DECODE_REGISTER_INFO */ +/* 0 1 2 3 4 5 6 7 8 + * 960, 480, 390, 300, 240, 180, 120, 90, 60 + * 180, 150, 120, 90, 60 + * DMA_Speed + * 180, 120, 90, 90, 90, 60, 30 + * 11, 5, 4, 3, 2, 1, 0 + */ +static int config_chipset_for_pio (ide_drive_t *drive, byte pio) +{ + ide_hwif_t *hwif = HWIF(drive); + struct pci_dev *dev = hwif->pci_dev; + byte drive_pci, speed; + byte AP, BP, TA, TB; + + int drive_number = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); + int err; + + switch (drive_number) { + case 0: drive_pci = 0x60; break; + case 1: drive_pci = 0x64; break; + case 2: drive_pci = 0x68; break; + case 3: drive_pci = 0x6c; break; + default: return 1; + } + + pci_read_config_byte(dev, (drive_pci), &AP); + pci_read_config_byte(dev, (drive_pci)|0x01, &BP); + + + if ((AP & 0x0F) || (BP & 0x07)) { + /* clear PIO modes of lower 8421 bits of A Register */ + pci_write_config_byte(dev, (drive_pci), AP & ~0x0F); + pci_read_config_byte(dev, (drive_pci), &AP); + + /* clear PIO modes of lower 421 bits of B Register */ + pci_write_config_byte(dev, (drive_pci)|0x01, BP & ~0x07); + pci_read_config_byte(dev, (drive_pci)|0x01, &BP); + + pci_read_config_byte(dev, (drive_pci), &AP); + pci_read_config_byte(dev, (drive_pci)|0x01, &BP); + } + + pio = (pio == 5) ? 4 : pio; + switch (ide_get_best_pio_mode(drive, 255, pio, NULL)) { + case 4:speed = XFER_PIO_4; TA=0x01; TB=0x04; break; + case 3:speed = XFER_PIO_3; TA=0x02; TB=0x06; break; + case 2:speed = XFER_PIO_2; TA=0x03; TB=0x08; break; + case 1:speed = XFER_PIO_1; TA=0x05; TB=0x0C; break; + case 0: + default:speed = XFER_PIO_0; TA=0x09; TB=0x13; break; + } + pci_write_config_byte(dev, (drive_pci), AP|TA); + pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB); + +#if PDC202XX_DECODE_REGISTER_INFO + pci_read_config_byte(dev, (drive_pci), &AP); + pci_read_config_byte(dev, (drive_pci)|0x01, &BP); + pci_read_config_byte(dev, (drive_pci)|0x02, &CP); + pci_read_config_byte(dev, (drive_pci)|0x03, &DP); + + decode_registers(REG_A, AP); + decode_registers(REG_B, BP); + decode_registers(REG_C, CP); + decode_registers(REG_D, DP); +#endif /* PDC202XX_DECODE_REGISTER_INFO */ + + err = ide_config_drive_speed(drive, speed); + +#if PDC202XX_DEBUG_DRIVE_INFO + printk("%s: %s drive%d 0x%08x ", + drive->name, ide_xfer_verbose(speed), + drive_number, drive_conf); + pci_read_config_dword(dev, drive_pci, &drive_conf); + printk("0x%08x\n", drive_conf); +#endif /* PDC202XX_DEBUG_DRIVE_INFO */ + return err; +} + +static void pdc202xx_tune_drive (ide_drive_t *drive, byte pio) +{ + (void) config_chipset_for_pio(drive, pio); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) { struct hd_driveid *id = drive->id; @@ -476,91 +554,6 @@ chipset_is_set: ide_dma_off_quietly); } -/* 0 1 2 3 4 5 6 7 8 - * 960, 480, 390, 300, 240, 180, 120, 90, 60 - * 180, 150, 120, 90, 60 - * DMA_Speed - * 180, 120, 90, 90, 90, 60, 30 - * 11, 5, 4, 3, 2, 1, 0 - */ - -static int config_chipset_for_pio (ide_drive_t *drive, byte pio) -{ - ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; - byte drive_pci, speed; - byte AP, BP, TA, TB; - - int drive_number = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); - int err; - - switch (drive_number) { - case 0: drive_pci = 0x60; break; - case 1: drive_pci = 0x64; break; - case 2: drive_pci = 0x68; break; - case 3: drive_pci = 0x6c; break; - default: return 1; - } - - pci_read_config_byte(dev, (drive_pci), &AP); - pci_read_config_byte(dev, (drive_pci)|0x01, &BP); - - - if ((AP & 0x0F) || (BP & 0x07)) { - /* clear PIO modes of lower 8421 bits of A Register */ - pci_write_config_byte(dev, (drive_pci), AP & ~0x0F); - pci_read_config_byte(dev, (drive_pci), &AP); - - /* clear PIO modes of lower 421 bits of B Register */ - pci_write_config_byte(dev, (drive_pci)|0x01, BP & ~0x07); - pci_read_config_byte(dev, (drive_pci)|0x01, &BP); - - pci_read_config_byte(dev, (drive_pci), &AP); - pci_read_config_byte(dev, (drive_pci)|0x01, &BP); - } - - pio = (pio == 5) ? 4 : pio; - switch (ide_get_best_pio_mode(drive, 255, pio, NULL)) { - case 4: speed = XFER_PIO_4; TA=0x01; TB=0x04; break; - case 3: speed = XFER_PIO_3; TA=0x02; TB=0x06; break; - case 2: speed = XFER_PIO_2; TA=0x03; TB=0x08; break; - case 1: speed = XFER_PIO_1; TA=0x05; TB=0x0C; break; - case 0: - default: speed = XFER_PIO_0; TA=0x09; TB=0x13; break; - } - pci_write_config_byte(dev, (drive_pci), AP|TA); - pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB); - -#if PDC202XX_DECODE_REGISTER_INFO - pci_read_config_byte(dev, (drive_pci), &AP); - pci_read_config_byte(dev, (drive_pci)|0x01, &BP); - pci_read_config_byte(dev, (drive_pci)|0x02, &CP); - pci_read_config_byte(dev, (drive_pci)|0x03, &DP); - - decode_registers(REG_A, AP); - decode_registers(REG_B, BP); - decode_registers(REG_C, CP); - decode_registers(REG_D, DP); -#endif /* PDC202XX_DECODE_REGISTER_INFO */ - - err = ide_config_drive_speed(drive, speed); - -#if PDC202XX_DEBUG_DRIVE_INFO - printk("%s: %s drive%d 0x%08x ", - drive->name, ide_xfer_verbose(speed), - drive_number, drive_conf); - pci_read_config_dword(dev, drive_pci, &drive_conf); - printk("0x%08x\n", drive_conf); -#endif /* PDC202XX_DEBUG_DRIVE_INFO */ - - return err; -} - -static void pdc202xx_tune_drive (ide_drive_t *drive, byte pio) -{ - (void) config_chipset_for_pio(drive, pio); -} - static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -625,6 +618,7 @@ int pdc202xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name) { @@ -701,11 +695,12 @@ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name) #endif /* CONFIG_PDC202XX_MASTER */ #if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) - pdc202xx_proc = 1; - bmide_dev = dev; - pdc202xx_display_info = &pdc202xx_get_info; + if (!pdc202xx_proc) { + pdc202xx_proc = 1; + bmide_dev = dev; + pdc202xx_display_info = &pdc202xx_get_info; + } #endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */ - return dev->irq; } @@ -722,10 +717,18 @@ void __init ide_init_pdc202xx (ide_hwif_t *hwif) { hwif->tuneproc = &pdc202xx_tune_drive; +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) { hwif->dmaproc = &pdc202xx_dmaproc; + hwif->autodma = 1; } else { hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; + hwif->autodma = 0; } +#else /* !CONFIG_BLK_DEV_IDEDMA */ + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; +#endif /* CONFIG_BLK_DEV_IDEDMA */ } diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c index 93f20566d..fa453e7d5 100644 --- a/drivers/ide/piix.c +++ b/drivers/ide/piix.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/piix.c Version 0.30 Feb. 26, 2000 + * linux/drivers/ide/piix.c Version 0.31 Mar. 18, 2000 * * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer * Copyright (C) 1998-2000 Andre Hedrick (andre@suse.com) @@ -51,31 +51,6 @@ * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, ®4a); * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, ®54); * - * 00:1f.1 IDE interface: Intel Corporation: - * Unknown device 2411 (rev 01) (prog-if 80 [Master]) - * Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- - * ParErr- Stepping- SERR- FastB2B- - * Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- - * <TAbort- <MAbort- >SERR- <PERR- - * Latency: 0 set - * Region 4: I/O ports at ffa0 - * 00: 86 80 11 24 05 00 80 02 01 80 01 01 00 00 00 00 - * 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 20: a1 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 40: 07 a3 03 a3 00 00 00 00 05 00 02 02 00 00 00 00 - * 50: 00 00 00 00 11 04 00 00 00 00 00 00 00 00 00 00 - * 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * f0: 00 00 00 00 00 00 00 00 3a 0f 00 00 00 00 00 00 - * */ #include <linux/config.h> @@ -281,6 +256,7 @@ static void piix_tune_drive (ide_drive_t *drive, byte pio) restore_flags(flags); } +#if defined(CONFIG_BLK_DEV_IDEDMA) && defined(CONFIG_PIIX_TUNING) static int piix_config_drive_for_dma (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -387,13 +363,16 @@ static int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive) /* Other cases are done by generic IDE-DMA code. */ return ide_dmaproc(func, drive); } +#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_PIIX_TUNING) */ unsigned int __init pci_init_piix (struct pci_dev *dev, const char *name) { #if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS) - piix_proc = 1; - bmide_dev = dev; - piix_display_info = &piix_get_info; + if (!piix_proc) { + piix_proc = 1; + bmide_dev = dev; + piix_display_info = &piix_get_info; + } #endif /* DISPLAY_PIIX_TIMINGS && CONFIG_PROC_FS */ return 0; } @@ -427,12 +406,12 @@ void __init ide_init_piix (ide_hwif_t *hwif) if (!hwif->dma_base) return; +#ifndef CONFIG_BLK_DEV_IDEDMA + hwif->autodma = 0; +#else /* CONFIG_BLK_DEV_IDEDMA */ #ifdef CONFIG_PIIX_TUNING hwif->autodma = 1; hwif->dmaproc = &piix_dmaproc; -#else - if (hwif->autodma) - hwif->autodma = 0; - #endif /* CONFIG_PIIX_TUNING */ +#endif /* !CONFIG_BLK_DEV_IDEDMA */ } diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index 0f2330370..41d4277d2 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/q40ide.c -- Q40 I/O port IDE Driver + * linux/drivers/ide/q40ide.c -- Q40 I/O port IDE Driver * * original file created 12 Jul 1997 by Geert Uytterhoeven * diff --git a/drivers/ide/qd6580.c b/drivers/ide/qd6580.c index 31781a9f0..bccf1eb6a 100644 --- a/drivers/ide/qd6580.c +++ b/drivers/ide/qd6580.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/qd6580.c Version 0.02 Feb 09, 1996 + * linux/drivers/ide/qd6580.c Version 0.02 Feb 09, 1996 * * Copyright (C) 1996 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/rapide.c b/drivers/ide/rapide.c index 5905aca41..baa293467 100644 --- a/drivers/ide/rapide.c +++ b/drivers/ide/rapide.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/rapide.c + * linux/drivers/ide/rapide.c * * Copyright (c) 1996-1998 Russell King. * diff --git a/drivers/ide/rz1000.c b/drivers/ide/rz1000.c index 455641c1d..5bd3db7d5 100644 --- a/drivers/ide/rz1000.c +++ b/drivers/ide/rz1000.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/rz1000.c Version 0.05 December 8, 1997 + * linux/drivers/ide/rz1000.c Version 0.05 December 8, 1997 * * Copyright (C) 1995-1998 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c index 942187900..37da5577a 100644 --- a/drivers/ide/sis5513.c +++ b/drivers/ide/sis5513.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/sis5513.c Version 0.09 Feb. 10, 2000 + * linux/drivers/ide/sis5513.c Version 0.10 Mar. 18, 2000 * * Copyright (C) 1999-2000 Andre Hedrick (andre@suse.com) * May be copied or modified under the terms of the GNU General Public License @@ -109,14 +109,14 @@ static __inline__ char * find_udma_mode (byte cycle_time) static int sis_get_info(char *, char **, off_t, int); extern int (*sis_display_info)(char *, char **, off_t, int); /* ide-proc.c */ -struct pci_dev *bmide_dev; +static struct pci_dev *bmide_dev; -static char *cable_type[] = { +static char *cable_type[] __initdata = { "80 pins", "40 pins" }; -static char *recovery_time [] ={ +static char *recovery_time [] __initdata ={ "12 PCICLK", "1 PCICLK", "2 PCICLK", "3 PCICLK", "4 PCICLK", "5 PCICLCK", @@ -127,14 +127,14 @@ static char *recovery_time [] ={ "15 PCICLK", "15 PCICLK" }; -static char *cycle_time [] = { +static char * cycle_time [] __initdata = { "Undefined", "2 CLCK", "3 CLK", "4 CLK", "5 CLK", "6 CLK", "7 CLK", "8 CLK" }; -static char *active_time [] = { +static char * active_time [] __initdata = { "8 PCICLK", "1 PCICLCK", "2 PCICLK", "2 PCICLK", "4 PCICLK", "5 PCICLK", @@ -222,6 +222,123 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count) byte sis_proc = 0; extern char *ide_xfer_verbose (byte xfer_rate); +static void config_drive_art_rwp (ide_drive_t *drive) +{ + ide_hwif_t *hwif = HWIF(drive); + struct pci_dev *dev = hwif->pci_dev; + + int drive_number = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); + byte reg4bh = 0; + byte rw_prefetch = (0x11 << drive_number); + + pci_read_config_byte(dev, 0x4b, ®4bh); + if (drive->media != ide_disk) + return; + + if ((reg4bh & rw_prefetch) != rw_prefetch) + pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch); +} + +static void config_art_rwp_pio (ide_drive_t *drive, byte pio) +{ + ide_hwif_t *hwif = HWIF(drive); + struct pci_dev *dev = hwif->pci_dev; + + byte timing, drive_pci, test1, test2; + + unsigned short eide_pio_timing[6] = {600, 390, 240, 180, 120, 90}; + unsigned short xfer_pio = drive->id->eide_pio_modes; + int drive_number = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); + +#if 0 + config_drive_art_rwp(drive); +#endif + + pio = ide_get_best_pio_mode(drive, 255, pio, NULL); + + if (xfer_pio> 4) + xfer_pio = 0; + + if (drive->id->eide_pio_iordy > 0) { + for (xfer_pio = 5; + xfer_pio>0 && + drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; + xfer_pio--); + } else { + xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : + (drive->id->eide_pio_modes & 2) ? 0x04 : + (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio; + } + + timing = (xfer_pio >= pio) ? xfer_pio : pio; + +/* + * Mode 0 Mode 1 Mode 2 Mode 3 Mode 4 + * Active time 8T (240ns) 6T (180ns) 4T (120ns) 3T (90ns) 3T (90ns) + * 0x41 2:0 bits 000 110 100 011 011 + * Recovery time 12T (360ns) 7T (210ns) 4T (120ns) 3T (90ns) 1T (30ns) + * 0x40 3:0 bits 0000 0111 0100 0011 0001 + * Cycle time 20T (600ns) 13T (390ns) 8T (240ns) 6T (180ns) 4T (120ns) + */ + + switch(drive_number) { + case 0: drive_pci = 0x40; break; + case 1: drive_pci = 0x42; break; + case 2: drive_pci = 0x44; break; + case 3: drive_pci = 0x46; break; + default: return; + } + + pci_read_config_byte(dev, drive_pci, &test1); + pci_read_config_byte(dev, drive_pci|0x01, &test2); + + /* + * Do a blanket clear of active and recovery timings. + */ + + test1 &= ~0x07; + test2 &= ~0x0F; + + switch(timing) { + case 4: test1 |= 0x01; test2 |= 0x03; break; + case 3: test1 |= 0x03; test2 |= 0x03; break; + case 2: test1 |= 0x04; test2 |= 0x04; break; + case 1: test1 |= 0x07; test2 |= 0x06; break; + default: break; + } + + pci_write_config_byte(dev, drive_pci, test1); + pci_write_config_byte(dev, drive_pci|0x01, test2); +} + +static int config_chipset_for_pio (ide_drive_t *drive, byte pio) +{ + int err; + byte speed; + + switch(pio) { + case 4: speed = XFER_PIO_4; break; + case 3: speed = XFER_PIO_3; break; + case 2: speed = XFER_PIO_2; break; + case 1: speed = XFER_PIO_1; break; + default: speed = XFER_PIO_0; break; + } + + config_art_rwp_pio(drive, pio); + err = ide_config_drive_speed(drive, speed); + return err; +} + +#undef SIS5513_TUNEPROC + +#ifdef SIS5513_TUNEPROC +static void sis5513_tune_drive (ide_drive_t *drive, byte pio) +{ + (void) config_chipset_for_pio(drive, pio); +} +#endif /* SIS5513_TUNEPROC */ + +#ifdef CONFIG_BLK_DEV_IDEDMA /* * ((id->hw_config & 0x2000) && (HWIF(drive)->udma_four)) */ @@ -331,84 +448,6 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra) ide_dma_off_quietly); } -static void config_drive_art_rwp (ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; - - byte timing, pio, drive_pci, test1, test2; - - unsigned short eide_pio_timing[6] = {600, 390, 240, 180, 120, 90}; - unsigned short xfer_pio = drive->id->eide_pio_modes; - int drive_number = ((hwif->channel ? 2 : 0) + (drive->select.b.unit & 0x01)); - - if (drive->media == ide_disk) { - struct pci_dev *dev = hwif->pci_dev; - byte reg4bh = 0; - byte rw_prefetch = (0x11 << drive_number); - - pci_read_config_byte(dev, 0x4b, ®4bh); - if ((reg4bh & rw_prefetch) != rw_prefetch) - pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch); - } - - pio = ide_get_best_pio_mode(drive, 255, 5, NULL); - - if (xfer_pio> 4) - xfer_pio = 0; - - if (drive->id->eide_pio_iordy > 0) { - for (xfer_pio = 5; - xfer_pio>0 && - drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; - xfer_pio--); - } else { - xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : - (drive->id->eide_pio_modes & 2) ? 0x04 : - (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio; - } - - timing = (xfer_pio >= pio) ? xfer_pio : pio; - -/* - * Mode 0 Mode 1 Mode 2 Mode 3 Mode 4 - * Active time 8T (240ns) 6T (180ns) 4T (120ns) 3T (90ns) 3T (90ns) - * 0x41 2:0 bits 000 110 100 011 011 - * Recovery time 12T (360ns) 7T (210ns) 4T (120ns) 3T (90ns) 1T (30ns) - * 0x40 3:0 bits 0000 0111 0100 0011 0001 - * Cycle time 20T (600ns) 13T (390ns) 8T (240ns) 6T (180ns) 4T (120ns) - */ - - switch(drive_number) { - case 0: drive_pci = 0x40;break; - case 1: drive_pci = 0x42;break; - case 2: drive_pci = 0x44;break; - case 3: drive_pci = 0x46;break; - default: return; - } - - pci_read_config_byte(dev, drive_pci, &test1); - pci_read_config_byte(dev, drive_pci|0x01, &test2); - - /* - * Do a blanket clear of active and recovery timings. - */ - - test1 &= ~0x07; - test2 &= ~0x0F; - - switch(timing) { - case 4: test1 |= 0x01;test2 |= 0x03;break; - case 3: test1 |= 0x03;test2 |= 0x03;break; - case 2: test1 |= 0x04;test2 |= 0x04;break; - case 1: test1 |= 0x07;test2 |= 0x06;break; - default: break; - } - - pci_write_config_byte(dev, drive_pci, test1); - pci_write_config_byte(dev, drive_pci|0x01, test2); -} - static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -417,9 +456,10 @@ static int config_drive_xfer_rate (ide_drive_t *drive) if (id && (id->capability & 1) && HWIF(drive)->autodma) { /* Consult the list of known "bad" drives */ if (ide_dmaproc(ide_dma_bad_drive, drive)) { - return HWIF(drive)->dmaproc(ide_dma_off, drive); + dma_func = ide_dma_off; + goto fast_ata_pio; } - + dma_func = ide_dma_off_quietly; if (id->field_valid & 4) { if (id->dma_ultra & 0x001F) { /* Force if Capable UltraDMA */ @@ -434,13 +474,25 @@ try_dma_modes: (id->dma_1word & 0x0007)) { /* Force if Capable regular DMA modes */ dma_func = config_chipset_for_dma(drive, 0); + if (dma_func != ide_dma_on) + goto no_dma_set; } } else if ((ide_dmaproc(ide_dma_good_drive, drive)) && (id->eide_dma_time > 150)) { /* Consult the list of known "good" drives */ dma_func = config_chipset_for_dma(drive, 0); + if (dma_func != ide_dma_on) + goto no_dma_set; + } else { + goto fast_ata_pio; } + } else if ((id->capability & 8) || (id->field_valid & 2)) { +fast_ata_pio: + dma_func = ide_dma_off_quietly; +no_dma_set: + (void) config_chipset_for_pio(drive, 5); } + return HWIF(drive)->dmaproc(dma_func, drive); } @@ -452,12 +504,14 @@ int sis5513_dmaproc (ide_dma_action_t func, ide_drive_t *drive) switch (func) { case ide_dma_check: config_drive_art_rwp(drive); + config_art_rwp_pio(drive, 5); return config_drive_xfer_rate(drive); default: break; } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ unsigned int __init pci_init_sis5513 (struct pci_dev *dev, const char *name) { @@ -492,9 +546,11 @@ unsigned int __init pci_init_sis5513 (struct pci_dev *dev, const char *name) pci_write_config_byte(dev, 0x52, reg52h|0x04); } #if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) - sis_proc = 1; - bmide_dev = dev; - sis_display_info = &sis_get_info; + if (!sis_proc) { + sis_proc = 1; + bmide_dev = dev; + sis_display_info = &sis_get_info; + } #endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) */ } return 0; @@ -525,11 +581,16 @@ void __init ide_init_sis5513 (ide_hwif_t *hwif) hwif->irq = hwif->channel ? 15 : 14; +#ifdef SIS5513_TUNEPROC + hwif->tuneproc = &sis5513_tune_drive; +#endif /* SIS5513_TUNEPROC */ + if (!(hwif->dma_base)) return; if (host_dev) { switch(host_dev->device) { +#ifdef CONFIG_BLK_DEV_IDEDMA case PCI_DEVICE_ID_SI_530: case PCI_DEVICE_ID_SI_540: case PCI_DEVICE_ID_SI_620: @@ -540,6 +601,7 @@ void __init ide_init_sis5513 (ide_hwif_t *hwif) hwif->autodma = 1; hwif->dmaproc = &sis5513_dmaproc; break; +#endif /* CONFIG_BLK_DEV_IDEDMA */ default: hwif->autodma = 0; break; diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index 483a98fde..c58c612ed 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/sl82c105.c + * linux/drivers/ide/sl82c105.c * * SL82C105/Winbond 553 IDE driver * diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index fb5e8d1af..e7ee2e977 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/trm290.c Version 1.01 December 5, 1997 + * linux/drivers/ide/trm290.c Version 1.02 Mar. 18, 2000 * * Copyright (c) 1997-1998 Mark Lord * May be copied or modified under the terms of the GNU General Public License @@ -124,6 +124,7 @@ * */ +#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -171,6 +172,7 @@ static void trm290_selectproc (ide_drive_t *drive) trm290_prepare_drive(drive, drive->using_dma); } +#ifdef CONFIG_BLK_DEV_IDEDMA static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); @@ -209,6 +211,7 @@ static int trm290_dmaproc (ide_dma_action_t func, ide_drive_t *drive) trm290_prepare_drive(drive, 0); /* select PIO xfer */ return 1; } +#endif /* CONFIG_BLK_DEV_IDEDMA */ /* * Invoked from ide-dma.c at boot time. @@ -247,7 +250,11 @@ void __init ide_init_trm290 (ide_hwif_t *hwif) else if (!hwif->irq && hwif->mate && hwif->mate->irq) hwif->irq = hwif->mate->irq; /* sharing IRQ with mate */ ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); + +#ifdef CONFIG_BLK_DEV_IDEDMA hwif->dmaproc = &trm290_dmaproc; +#endif /* CONFIG_BLK_DEV_IDEDMA */ + hwif->selectproc = &trm290_selectproc; hwif->autodma = 0; /* play it safe for now */ #if 1 diff --git a/drivers/ide/umc8672.c b/drivers/ide/umc8672.c index 02b581a28..5c1168972 100644 --- a/drivers/ide/umc8672.c +++ b/drivers/ide/umc8672.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/umc8672.c Version 0.05 Jul 31, 1996 + * linux/drivers/ide/umc8672.c Version 0.05 Jul 31, 1996 * * Copyright (C) 1995-1996 Linus Torvalds & author (see below) */ diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c index afa1cc5b6..bf8e27640 100644 --- a/drivers/ide/via82cxxx.c +++ b/drivers/ide/via82cxxx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/via82cxxx.c Version 0.07 Feb. 10, 2000 + * linux/drivers/ide/via82cxxx.c Version 0.08 Mar. 18, 2000 * * Copyright (C) 1998-99 Michel Aubry, Maintainer * Copyright (C) 1999 Jeff Garzik, MVP4 Support @@ -143,14 +143,14 @@ static const struct { #include <linux/stat.h> #include <linux/proc_fs.h> -static char *FIFO_str[] = { +static char *FIFO_str[] __initdata = { " 1 ", "3/4", "1/2", "1/4" }; -static char *control3_str[] = { +static char *control3_str[] __initdata = { "No limitation", "64", "128", @@ -516,6 +516,62 @@ static int via_set_fifoconfig(ide_hwif_t *hwif) #ifdef CONFIG_VIA82CXXX_TUNING +struct chipset_bus_clock_list_entry { + unsigned short bus_speed; + byte xfer_speed; + byte chipset_settings; +}; + +PCI_DEVICE_ID_VIA_82C586_1 +PCI_DEVICE_ID_VIA_82C596 +PCI_DEVICE_ID_VIA_82C686 +PCI_DEVICE_ID_VIA_8231 + +PCI_DEVICE_ID_VIA_82C586_1 TYPE_1 +PCI_DEVICE_ID_VIA_82C596 TYPE_2 +PCI_DEVICE_ID_VIA_82C686 TYPE_2 +PCI_DEVICE_ID_VIA_82C596 TYPE_3 +PCI_DEVICE_ID_VIA_82C686 TYPE_3 +PCI_DEVICE_ID_VIA_8231 TYPE_4 + +struct chipset_bus_clock_list_entry ultra_33_base [] = { +{ TYPE_1,25,0x00,0x00,0x60,0x61,0x62,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_1,33,0x00,0x00,0x60,0x61,0x62,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_1,37,0x00,0x00,0x60,0x61,0x62,0x03,0x21,0x32,0x76,0x76,0xA9 }, +{ TYPE_2,25,0x00,0x00,0xE0,0xE1,0xE2,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_2,33,0x00,0x00,0xE0,0xE1,0xE2,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_2,37,0x00,0x00,0xE1,0xE2,0xE2,0x03,0x31,0x42,0x87,0x87,0xDB }, +{ TYPE_2,41,0x00,0x00,0xE1,0xE2,0xE2,0x03,0x32,0x53,0xA8,0xA8,0xFE }, +{ TYPE_3,25,0x00,0x00,0xE0,0xE1,0xE2,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_3,33,0x00,0x00,0xE0,0xE1,0xE2,0x03,0x20,0x31,0x65,0x65,0xA8 }, +{ TYPE_3,37,0x00,0x00,0xE1,0xE2,0xE2,0x03,0x31,0x42,0x87,0x87,0xDB }, +{ TYPE_3,41,0x00,0x00,0xE1,0xE2,0xE2,0x03,0x32,0x53,0xA8,0xA8,0xFE }, +{ TYPE_4,0,0,0,0,0,0,0,0,0,0,0,0 }, +{ 0,0,0,0,0,0,0,0,0,0,0,0,0 } +}; + +struct chipset_bus_clock_list_entry timing_66_base [] = { + { 37, XFER_PIO_4, 0x21 }, + { 37, XFER_PIO_3, 0x32 }, + { 37, XFER_PIO_2, 0x76 }, + { 37, XFER_PIO_1, 0x76 }, + { 37, XFER_PIO_0, 0xA9 }, + { ANY, XFER_PIO_4, 0x20 }, + { ANY, XFER_PIO_3, 0x31 }, + { ANY, XFER_PIO_2, 0x65 }, + { ANY, XFER_PIO_1, 0x65 }, + { ANY, XFER_PIO_0, 0xA8 }, +}; + +static byte pci_bus_clock_list (byte speed, struct chipset_bus_clock_list_entry * chipset_table) +{ + for ( ; chipset_table->xfer_speed ; chipset_table++) + if (chipset_table->xfer_speed == speed) { + return chipset_table->chipset_settings; + } + return 0x01208585; +} + static int via82cxxx_tune_chipset (ide_drive_t *drive, byte speed) { struct hd_driveid *id = drive->id; @@ -539,7 +595,7 @@ static int via82cxxx_tune_chipset (ide_drive_t *drive, byte speed) case 2: ata2_pci = 0x4a; ata3_pci = 0x52; break; case 3: ata2_pci = 0x4b; ata3_pci = 0x53; break; default: - return err; + return -1; } pci_read_config_byte(dev, ata2_pci, &timing); @@ -575,6 +631,57 @@ static int via82cxxx_tune_chipset (ide_drive_t *drive, byte speed) return(err); } +static void config_chipset_for_pio (ide_drive_t *drive) +{ + unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; + unsigned short xfer_pio = drive->id->eide_pio_modes; + byte timing, speed, pio; + + pio = ide_get_best_pio_mode(drive, 255, 5, NULL); + + if (xfer_pio> 4) + xfer_pio = 0; + + if (drive->id->eide_pio_iordy > 0) { + for (xfer_pio = 5; + xfer_pio>0 && + drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; + xfer_pio--); + } else { + xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : + (drive->id->eide_pio_modes & 2) ? 0x04 : + (drive->id->eide_pio_modes & 1) ? 0x03 : + (drive->id->tPIO & 2) ? 0x02 : + (drive->id->tPIO & 1) ? 0x01 : xfer_pio; + } + + timing = (xfer_pio >= pio) ? xfer_pio : pio; + switch(timing) { + case 4: speed = XFER_PIO_4; break; + case 3: speed = XFER_PIO_3; break; + case 2: speed = XFER_PIO_2; break; + case 1: speed = XFER_PIO_1; break; + default: + speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; + break; + } + (void) via82cxxx_tune_chipset(drive, speed); +} + +static void via82cxxx_tune_drive (ide_drive_t *drive, byte pio) +{ + byte speed; + switch(pio) { + case 4: speed = XFER_PIO_4; break; + case 3: speed = XFER_PIO_3; break; + case 2: speed = XFER_PIO_2; break; + case 1: speed = XFER_PIO_1; break; + default: speed = XFER_PIO_0; break; + } + (void) via82cxxx_tune_chipset(drive, speed); +} + +#ifdef CONFIG_BLK_DEV_IDEDMA static int config_chipset_for_dma (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -617,56 +724,6 @@ static int config_chipset_for_dma (ide_drive_t *drive) return rval; } -static void config_chipset_for_pio (ide_drive_t *drive) -{ - unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90}; - unsigned short xfer_pio = drive->id->eide_pio_modes; - byte timing, speed, pio; - - pio = ide_get_best_pio_mode(drive, 255, 5, NULL); - - if (xfer_pio> 4) - xfer_pio = 0; - - if (drive->id->eide_pio_iordy > 0) { - for (xfer_pio = 5; - xfer_pio>0 && - drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio]; - xfer_pio--); - } else { - xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 : - (drive->id->eide_pio_modes & 2) ? 0x04 : - (drive->id->eide_pio_modes & 1) ? 0x03 : - (drive->id->tPIO & 2) ? 0x02 : - (drive->id->tPIO & 1) ? 0x01 : xfer_pio; - } - - timing = (xfer_pio >= pio) ? xfer_pio : pio; - - switch(timing) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: - speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW; break; - } - (void) via82cxxx_tune_chipset(drive, speed); -} - -static void via82cxxx_tune_drive (ide_drive_t *drive, byte pio) -{ - byte speed; - switch(pio) { - case 4: speed = XFER_PIO_4;break; - case 3: speed = XFER_PIO_3;break; - case 2: speed = XFER_PIO_2;break; - case 1: speed = XFER_PIO_1;break; - default: speed = XFER_PIO_0;break; - } - (void) via82cxxx_tune_chipset(drive, speed); -} - static int config_drive_xfer_rate (ide_drive_t *drive) { struct hd_driveid *id = drive->id; @@ -726,6 +783,7 @@ int via82cxxx_dmaproc (ide_dma_action_t func, ide_drive_t *drive) } return ide_dmaproc(func, drive); /* use standard DMA stuff */ } +#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_VIA82CXXX_TUNING */ unsigned int __init pci_init_via82cxxx (struct pci_dev *dev, const char *name) @@ -745,7 +803,7 @@ unsigned int __init pci_init_via82cxxx (struct pci_dev *dev, const char *name) host_dev = host; printk(ApolloHostChipInfo[i].name); - + printk("\n"); for (j = 0; j < arraysize (ApolloISAChipInfo) && !isa_dev; j++) { if (ApolloISAChipInfo[j].host_id != ApolloHostChipInfo[i].host_id) @@ -777,9 +835,11 @@ unsigned int __init pci_init_via82cxxx (struct pci_dev *dev, const char *name) } #if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) - via_proc = 1; - bmide_dev = dev; - via_display_info = &via_get_info; + if (!via_proc) { + via_proc = 1; + bmide_dev = dev; + via_display_info = &via_get_info; + } #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS*/ return 0; @@ -797,13 +857,15 @@ void __init ide_init_via82cxxx (ide_hwif_t *hwif) #ifdef CONFIG_VIA82CXXX_TUNING hwif->tuneproc = &via82cxxx_tune_drive; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + hwif->autodma = 0; +#ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_base) { hwif->dmaproc = &via82cxxx_dmaproc; - } else { - hwif->autodma = 0; - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; + hwif->autodma = 1; } +#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif /* CONFIG_VIA82CXXX_TUNING */ } |