From f644d47af3834b603d909c212287d0c21ec3ebbb Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Fri, 20 Jul 2007 01:11:53 +0200 Subject: [PATCH 01/23] scc_pata: Use inline function for eieio Move to using inline function variant of eieio instead of inline assmebly. Signed-off-by: Kumar Gala Cc: kou.ishizaki@toshiba.co.jp Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/scc_pata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 7b87488e3da..a96333c74bf 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -165,9 +165,9 @@ scc_ide_outbsync(ide_drive_t * drive, u8 addr, unsigned long port) ide_hwif_t *hwif = HWIF(drive); out_be32((void*)port, addr); - __asm__ __volatile__("eieio":::"memory"); + eieio(); in_be32((void*)(hwif->dma_base + 0x01c)); - __asm__ __volatile__("eieio":::"memory"); + eieio(); } static void From 4ae41ff887224b39c3c3c673a918193e90be558f Mon Sep 17 00:00:00 2001 From: Kou Ishizaki Date: Fri, 20 Jul 2007 01:11:53 +0200 Subject: [PATCH 02/23] scc_pata.c: Workaround for errata A308 (take 2) Workaround for errata A308: turn down the UDMA mode and retry the DMA command when the data lost condition is detected. take2: udma_filter() hook is used to limit ATAPI UDMA mode. Signed-off-by: Kou Ishizaki Signed-off-by: Akira Iguchi Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/scc_pata.c | 67 ++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index a96333c74bf..fd4b1a24eca 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -401,6 +401,33 @@ static int scc_ide_dma_end(ide_drive_t * drive) ide_hwif_t *hwif = HWIF(drive); unsigned long intsts_port = hwif->dma_base + 0x014; u32 reg; + int dma_stat, data_loss = 0; + static int retry = 0; + + /* errata A308 workaround: Step5 (check data loss) */ + /* We don't check non ide_disk because it is limited to UDMA4 */ + if (!(in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && + drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { + reg = in_be32((void __iomem *)intsts_port); + if (!(reg & INTSTS_ACTEINT)) { + printk(KERN_WARNING "%s: operation failed (transfer data loss)\n", + drive->name); + data_loss = 1; + if (retry++) { + struct request *rq = HWGROUP(drive)->rq; + int unit; + /* ERROR_RESET and drive->crc_count are needed + * to reduce DMA transfer mode in retry process. + */ + if (rq) + rq->errors |= ERROR_RESET; + for (unit = 0; unit < MAX_DRIVES; unit++) { + ide_drive_t *drive = &hwif->drives[unit]; + drive->crc_count++; + } + } + } + } while (1) { reg = in_be32((void __iomem *)intsts_port); @@ -469,27 +496,25 @@ static int scc_ide_dma_end(ide_drive_t * drive) break; } - return __ide_dma_end(drive); + dma_stat = __ide_dma_end(drive); + if (data_loss) + dma_stat |= 2; /* emulate DMA error (to retry command) */ + return dma_stat; } /* returns 1 if dma irq issued, 0 otherwise */ static int scc_dma_test_irq(ide_drive_t *drive) { - ide_hwif_t *hwif = HWIF(drive); - u8 dma_stat = hwif->INB(hwif->dma_status); + ide_hwif_t *hwif = HWIF(drive); + u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); - /* return 1 if INTR asserted */ - if ((dma_stat & 4) == 4) + /* SCC errata A252,A308 workaround: Step4 */ + if ((in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && + (int_stat & INTSTS_INTRQ)) return 1; - /* Workaround for PTERADD: emulate DMA_INTR when - * - IDE_STATUS[ERR] = 1 - * - INT_STATUS[INTRQ] = 1 - * - DMA_STATUS[IORACTA] = 1 - */ - if (in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT && - in_be32((void __iomem *)(hwif->dma_base + 0x014)) & INTSTS_INTRQ && - dma_stat & 1) + /* SCC errata A308 workaround: Step5 (polling IOIRQS) */ + if (int_stat & INTSTS_IOIRQS) return 1; if (!drive->waiting_for_dma) @@ -498,6 +523,21 @@ static int scc_dma_test_irq(ide_drive_t *drive) return 0; } +static u8 scc_udma_filter(ide_drive_t *drive) +{ + ide_hwif_t *hwif = drive->hwif; + u8 mask = hwif->ultra_mask; + + /* errata A308 workaround: limit non ide_disk drive to UDMA4 */ + if ((drive->media != ide_disk) && (mask & 0xE0)) { + printk(KERN_INFO "%s: limit %s to UDMA4\n", + SCC_PATA_NAME, drive->name); + mask = 0x1F; + } + + return mask; +} + /** * setup_mmio_scc - map CTRL/BMID region * @dev: PCI device we are configuring @@ -702,6 +742,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) hwif->tuneproc = scc_tuneproc; hwif->ide_dma_check = scc_config_drive_for_dma; hwif->ide_dma_test_irq = scc_dma_test_irq; + hwif->udma_filter = scc_udma_filter; hwif->drives[0].autotune = IDE_TUNE_AUTO; hwif->drives[1].autotune = IDE_TUNE_AUTO; From 363f7e428dcf9f90d726481029f7b4a0ed6d55ce Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Fri, 20 Jul 2007 01:11:53 +0200 Subject: [PATCH 03/23] PCMCIA: Add another MemoryCard to ide-cs/pata_pcmcia One card submitted by user. Signed-off-by: Marcin Juszkiewicz Cc: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ata/pata_pcmcia.c | 1 + drivers/ide/legacy/ide-cs.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index a56257c98fe..6da23feed03 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -382,6 +382,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674), diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 2f3977f195b..4cdb519f983 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -386,6 +386,7 @@ static struct pcmcia_device_id ide_ids[] = { PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674), From c82d72f5c521434c36b9550b3ac6601eb8167687 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 20 Jul 2007 01:11:54 +0200 Subject: [PATCH 04/23] IDE: Remove references to dead ETRAX-related variables. The two CONFIG variables CONFIG_ETRAX_IDE_CSE1_16_RESET CONFIG_ETRAX_IDE_CSP0_8_RESET appear to have been dead since way back in 2.5.xx days: http://www.linuxhq.com/kernel/v2.5/75/arch/cris/drivers/Kconfig Signed-off-by: Robert P. J. Day Cc: Michael Starvik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/cris/ide-cris.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 886091bc7db..e8cd86e8643 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -414,12 +414,6 @@ cris_ide_reset(unsigned val) #ifdef CONFIG_ETRAX_IDE_G27_RESET REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val); #endif -#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET - REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, val); -#endif -#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET - REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, val); -#endif #ifdef CONFIG_ETRAX_IDE_PB7_RESET port_pb_dir_shadow = port_pb_dir_shadow | IO_STATE(R_PORT_PB_DIR, dir7, output); From 9702b5d5c26be12d376e1baf2a8e5b82e6c06b66 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 20 Jul 2007 01:11:54 +0200 Subject: [PATCH 05/23] ide: Stop mapping ROMs Various old IDE drivers go mapping ROM devices for no apparent reason and without using the ROM mapping API we now have. They don't actually use the ROM they map and the new libata drivers are happy without it being mapped so rather than port them lets just junk it for the next -rc1. Signed-off-by: Alan Cox Acked-by: Sergei Shtylyov Cc: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 6 ------ drivers/ide/pci/hpt34x.c | 11 ++--------- drivers/ide/pci/hpt366.c | 8 -------- drivers/ide/pci/pdc202xx_new.c | 7 ------- drivers/ide/pci/pdc202xx_old.c | 8 -------- 5 files changed, 2 insertions(+), 38 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index e5d09367627..6d18fef558b 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -174,12 +174,6 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch { int bus_speed = system_bus_clock(); - if (dev->resource[PCI_ROM_RESOURCE].start) { - pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); - } - if (bus_speed <= 33) pci_set_drvdata(dev, (void *) aec6xxx_33_base); else diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 2c24c3de884..64f19743b12 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -120,17 +120,10 @@ static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const cha pci_write_config_byte(dev, HPT34X_PCI_INIT_REG, 0x00); pci_read_config_word(dev, PCI_COMMAND, &cmd); - if (cmd & PCI_COMMAND_MEMORY) { - if (pci_resource_start(dev, PCI_ROM_RESOURCE)) { - pci_write_config_dword(dev, PCI_ROM_ADDRESS, - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n", - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); - } + if (cmd & PCI_COMMAND_MEMORY) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); - } else { + else pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); - } /* * Since 20-23 can be assigned and are R/W, we correct them. diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index e9b07a97c34..81853d740ae 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -994,14 +994,6 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha */ *info = *(struct hpt_info *)pci_get_drvdata(dev); - /* - * FIXME: Not portable. Also, why do we enable the ROM in the first place? - * We don't seem to be using it. - */ - if (dev->resource[PCI_ROM_RESOURCE].start) - pci_write_config_dword(dev, PCI_ROM_ADDRESS, - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); pci_write_config_byte(dev, PCI_MIN_GNT, 0x08); diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index ee5020df005..06c5e93d37a 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -378,13 +378,6 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha int f, r; u8 pll_ctl0, pll_ctl1; - if (dev->resource[PCI_ROM_RESOURCE].start) { - pci_write_config_dword(dev, PCI_ROM_ADDRESS, - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); - } - #ifdef CONFIG_PPC_PMAC apple_kiwi_init(dev); #endif diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 41ac4a94959..25cebfe18dd 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -316,14 +316,6 @@ static void pdc202xx_reset (ide_drive_t *drive) static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) { - /* This doesn't appear needed */ - if (dev->resource[PCI_ROM_RESOURCE].start) { - pci_write_config_dword(dev, PCI_ROM_ADDRESS, - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); - } - return dev->irq; } From 485efc6cf507eae2b8e83b56e179c8fa3980641a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:54 +0200 Subject: [PATCH 06/23] atiixp: PIO mode setup fixes * Split off exisiting atiixp_tuneproc() into atiixp_tune_pio() and then add setting device PIO mode to atiixp_tuneproc(). * Add missing ide_get_best_pio_mode() call to atiixp_tuneproc() so "pio" == 255 (autotune) is handled correctly and "pio" values > 4 && < 255 are filtered to PIO4 (previously "pio" == 5 could result in wrong timings being used and "pio" values > 4 && < 255 in an OOPS). * Handle PIO modes early in atiixp_speedproc() so save_mdma_mode[] doesn't get cleared. * In atiixp_dma_check(): - fix max_mode argument for ide_get_best_pio_mode() - don't call atiixp_dma_2_pio() so PIO1 doesn't get remapped to PIO0 - use atiixp_tuneproc() instead of atiixp_speedproc() * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/atiixp.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 2761510309b..bfdf086f452 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -1,9 +1,8 @@ /* - * linux/drivers/ide/pci/atiixp.c Version 0.01-bart2 Feb. 26, 2004 + * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 * * Copyright (C) 2003 ATI Inc. - * Copyright (C) 2004 Bartlomiej Zolnierkiewicz - * + * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz */ #include @@ -123,14 +122,14 @@ static void atiixp_dma_host_off(ide_drive_t *drive) } /** - * atiixp_tune_drive - tune a drive attached to a ATIIXP + * atiixp_tune_pio - tune a drive attached to a ATIIXP * @drive: drive to tune * @pio: desired PIO mode * * Set the interface PIO mode. */ -static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) +static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) { struct pci_dev *dev = drive->hwif->pci_dev; unsigned long flags; @@ -154,6 +153,13 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) spin_unlock_irqrestore(&atiixp_lock, flags); } +static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) +{ + pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + atiixp_tune_pio(drive, pio); + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); +} + /** * atiixp_tune_chipset - tune a ATIIXP interface * @drive: IDE drive to tune @@ -175,6 +181,11 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) speed = ide_rate_filter(drive, xferspeed); + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { + atiixp_tune_pio(drive, speed - XFER_PIO_0); + return ide_config_drive_speed(drive, speed); + } + spin_lock_irqsave(&atiixp_lock, flags); save_mdma_mode[drive->dn] = 0; @@ -201,7 +212,7 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) else pio = speed - XFER_PIO_0; - atiixp_tuneproc(drive, pio); + atiixp_tune_pio(drive, pio); return ide_config_drive_speed(drive, speed); } @@ -216,18 +227,13 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) static int atiixp_dma_check(ide_drive_t *drive) { - u8 tspeed, speed; - drive->init_speed = 0; if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) { - tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); - speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; - atiixp_speedproc(drive, speed); - } + if (ide_use_fast_pio(drive)) + atiixp_tuneproc(drive, 255); return -1; } From 328dcbb63657ebbb2dd26982fa9e1fa9e04b6fa2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:54 +0200 Subject: [PATCH 07/23] siimage: PIO mode setup fixes (take 2) * Add sil_tuneproc() wrapper for siimage_tuneproc() which also sets PIO mode on the device. * Add missing ide_get_best_pio_mode() call to sil_tuneproc() so "pio" == 255 (autotune) is handled correctly (previously PIO0 was used) and "pio" values > 4 && < 255 are filtered to PIO4 (instead of PIO0). * Add code limiting maximum PIO mode according to the pair device capabilities to sil_tuneproc(). * Convert users of config_siimage_chipset_for_pio() to use sil_tune_pio() and sil_tuneproc(). This fixes PIO fallback in siimage_config_drive_for_dma() to use max PIO mode available instead of PIO4 (config_siimage_chipset_for_pio() used wrong arguments for ide_get_best_pio_mode() and as a results always tried to set PIO4). * Remove no longer needed siimage_taskfile_timing() and config_siimage_chipset_for_pio(). * Enable ->autotune unconditionally and remove PIO tuning for UDMA/MDMA modes from siimage_speedproc() * Bump driver version. v2: * Fix issues noticed by Sergei: - correct pair device check - trim only taskfile PIO to the slowest of the master/slave - enable ->autotune unconditionally and remove PIO tuning for UDMA/MDMA modes from siimage_speedproc() - add TODO item for IORDY bugs - minor cleanups Reviewed-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/siimage.c | 137 +++++++++++--------------------------- 1 file changed, 39 insertions(+), 98 deletions(-) diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 1c3e3548789..5304fc5c616 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -1,9 +1,10 @@ /* - * linux/drivers/ide/pci/siimage.c Version 1.12 Mar 10 2007 + * linux/drivers/ide/pci/siimage.c Version 1.15 Jun 29 2007 * * Copyright (C) 2001-2002 Andre Hedrick * Copyright (C) 2003 Red Hat * Copyright (C) 2007 MontaVista Software, Inc. + * Copyright (C) 2007 Bartlomiej Zolnierkiewicz * * May be copied or modified under the terms of the GNU General Public License * @@ -31,6 +32,10 @@ * unplugging/replugging the virtual CD interface when the DRAC is reset. * This often causes drivers/ide/siimage to panic but is ok with the rather * smarter code in libata. + * + * TODO: + * - IORDY fixes + * - VDMA support */ #include @@ -160,82 +165,45 @@ out: } /** - * siimage_taskfile_timing - turn timing data to a mode - * @hwif: interface to query - * - * Read the timing data for the interface and return the - * mode that is being used. - */ - -static byte siimage_taskfile_timing (ide_hwif_t *hwif) -{ - u16 timing = 0x328a; - unsigned long addr = siimage_selreg(hwif, 2); - - if (hwif->mmio) - timing = hwif->INW(addr); - else - pci_read_config_word(hwif->pci_dev, addr, &timing); - - switch (timing) { - case 0x10c1: return 4; - case 0x10c3: return 3; - case 0x1104: - case 0x1281: return 2; - case 0x2283: return 1; - case 0x328a: - default: return 0; - } -} - -/** - * simmage_tuneproc - tune a drive + * sil_tune_pio - tune a drive * @drive: drive to tune - * @mode_wanted: the target operating mode + * @pio: the desired PIO mode * * Load the timing settings for this device mode into the * controller. If we are in PIO mode 3 or 4 turn on IORDY * monitoring (bit 9). The TF timing is bits 31:16 */ - -static void siimage_tuneproc (ide_drive_t *drive, byte mode_wanted) + +static void sil_tune_pio(ide_drive_t *drive, u8 pio) { + const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; + const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; + ide_hwif_t *hwif = HWIF(drive); + ide_drive_t *pair = &hwif->drives[drive->dn ^ 1]; u32 speedt = 0; u16 speedp = 0; unsigned long addr = siimage_seldev(drive, 0x04); unsigned long tfaddr = siimage_selreg(hwif, 0x02); - - /* cheat for now and use the docs */ - switch (mode_wanted) { - case 4: - speedp = 0x10c1; - speedt = 0x10c1; - break; - case 3: - speedp = 0x10c3; - speedt = 0x10c3; - break; - case 2: - speedp = 0x1104; - speedt = 0x1281; - break; - case 1: - speedp = 0x2283; - speedt = 0x2283; - break; - case 0: - default: - speedp = 0x328a; - speedt = 0x328a; - break; + u8 tf_pio = pio; + + /* trim *taskfile* PIO to the slowest of the master/slave */ + if (pair->present) { + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); + + if (pair_pio < tf_pio) + tf_pio = pair_pio; } + /* cheat for now and use the docs */ + speedp = data_speed[pio]; + speedt = tf_speed[tf_pio]; + if (hwif->mmio) { hwif->OUTW(speedp, addr); hwif->OUTW(speedt, tfaddr); /* Now set up IORDY */ - if(mode_wanted == 3 || mode_wanted == 4) + if (pio > 2) hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); else hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); @@ -245,42 +213,17 @@ static void siimage_tuneproc (ide_drive_t *drive, byte mode_wanted) pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); speedp &= ~0x200; /* Set IORDY for mode 3 or 4 */ - if(mode_wanted == 3 || mode_wanted == 4) + if (pio > 2) speedp |= 0x200; pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); } } -/** - * config_siimage_chipset_for_pio - set drive timings - * @drive: drive to tune - * @speed we want - * - * Compute the best pio mode we can for a given device. Also honour - * the timings for the driver when dealing with mixed devices. Some - * of this is ugly but its all wrapped up here - * - * The SI680 can also do VDMA - we need to start using that - * - * FIXME: we use the BIOS channel timings to avoid driving the task - * files too fast at the disk. We need to compute the master/slave - * drive PIO mode properly so that we can up the speed on a hotplug - * system. - */ - -static void config_siimage_chipset_for_pio (ide_drive_t *drive, byte set_speed) +static void sil_tuneproc(ide_drive_t *drive, u8 pio) { - u8 channel_timings = siimage_taskfile_timing(HWIF(drive)); - u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); - - /* WARNING PIO timing mess is going to happen b/w devices, argh */ - if ((channel_timings != set_pio) && (set_pio > channel_timings)) - set_pio = channel_timings; - - siimage_tuneproc(drive, set_pio); - speed = XFER_PIO_0 + set_pio; - if (set_speed) - (void) ide_config_drive_speed(drive, speed); + pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + sil_tune_pio(drive, pio); + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } /** @@ -335,7 +278,7 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed) case XFER_PIO_2: case XFER_PIO_1: case XFER_PIO_0: - siimage_tuneproc(drive, (speed - XFER_PIO_0)); + sil_tune_pio(drive, speed - XFER_PIO_0); mode |= ((unit) ? 0x10 : 0x01); break; case XFER_MW_DMA_2: @@ -343,7 +286,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed) case XFER_MW_DMA_0: multi = dma[speed - XFER_MW_DMA_0]; mode |= ((unit) ? 0x20 : 0x02); - config_siimage_chipset_for_pio(drive, 0); break; case XFER_UDMA_6: case XFER_UDMA_5: @@ -356,7 +298,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed) ultra |= ((scsc) ? (ultra6[speed - XFER_UDMA_0]) : (ultra5[speed - XFER_UDMA_0])); mode |= ((unit) ? 0x30 : 0x03); - config_siimage_chipset_for_pio(drive, 0); break; default: return 1; @@ -390,7 +331,7 @@ static int siimage_config_drive_for_dma (ide_drive_t *drive) return 0; if (ide_use_fast_pio(drive)) - config_siimage_chipset_for_pio(drive, 1); + sil_tuneproc(drive, 255); return -1; } @@ -961,7 +902,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) hwif->resetproc = &siimage_reset; hwif->speedproc = &siimage_tune_chipset; - hwif->tuneproc = &siimage_tuneproc; + hwif->tuneproc = &sil_tuneproc; hwif->reset_poll = &siimage_reset_poll; hwif->pre_reset = &siimage_pre_reset; hwif->udma_filter = &sil_udma_filter; @@ -976,11 +917,11 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) first = 0; } } - if (!hwif->dma_base) { - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; + + hwif->drives[0].autotune = hwif->drives[1].autotune = 1; + + if (hwif->dma_base == 0) return; - } hwif->ultra_mask = 0x7f; hwif->mwdma_mask = 0x07; From 342cdb6d4739cee430efc3eafcacd1605db66036 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:55 +0200 Subject: [PATCH 08/23] ide: make ide_get_best_pio_mode() print info if overriding PIO mode * Print info about overriding PIO mode in ide_get_best_pio_mode(). * Remove info about overriding PIO mode from cmd64{0,x} host drivers. * Remove no longer needed ide_pio_data_t.overridden field. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 10 +++++++--- drivers/ide/pci/cmd640.c | 7 +++---- drivers/ide/pci/cmd64x.c | 5 ++--- include/linux/ide.h | 1 - 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 074bb32a4a4..d45bbad9ffe 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -277,7 +277,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p } else if (!drive->id) { pio_mode = 0; } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { - overridden = 1; + printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); use_iordy = (pio_mode > 2); } else { pio_mode = id->tPIO; @@ -303,12 +303,17 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p } } + if (overridden) + printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n", + drive->name); + /* * Conservative "downgrade" for all pre-ATA2 drives */ if (pio_mode && pio_mode < 4) { pio_mode--; - overridden = 1; + printk(KERN_INFO "%s: applying conservative " + "PIO \"downgrade\"\n", drive->name); if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) cycle_time = 0; /* use standard timing */ } @@ -321,7 +326,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p d->pio_mode = pio_mode; d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; d->use_iordy = use_iordy; - d->overridden = overridden; } return pio_mode; } diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index dc43f009aca..dff21597e64 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -665,13 +665,12 @@ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d); cmd640_set_mode (index, d.pio_mode, d.cycle_time); - printk ("%s: selected cmd640 PIO mode%d (%dns)%s", + printk("%s: selected cmd640 PIO mode%d (%dns)", drive->name, d.pio_mode, - d.cycle_time, - d.overridden ? " (overriding vendor mode)" : ""); + d.cycle_time); + display_clocks(index); - return; } #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 1e89dd6e5bb..5171e94facd 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -227,9 +227,8 @@ static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); - cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)%s\n", - drive->name, mode_wanted, pio_mode, pio.cycle_time, - pio.overridden ? " (overriding vendor mode)" : ""); + cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", + drive->name, mode_wanted, pio_mode, pio.cycle_time); program_cycle_times(drive, pio.cycle_time, ide_pio_timings[pio_mode].active_time); diff --git a/include/linux/ide.h b/include/linux/ide.h index 19ab2580405..83a117d673c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1375,7 +1375,6 @@ typedef struct ide_pio_timings_s { typedef struct ide_pio_data_s { u8 pio_mode; u8 use_iordy; - u8 overridden; unsigned int cycle_time; } ide_pio_data_t; From 2229833c1365346b64357a9263fa724f74f5e376 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:55 +0200 Subject: [PATCH 09/23] ide: add ide_dev_has_iordy() helper (take 4) * Add ide_dev_has_iordy() helper and use it sl82c105 host driver. * Remove no longer needed ide_pio_data_t.use_iordy field. v2/v3: * Fix issues noticed by Sergei: - correct patch description - fix comment in ide_get_best_pio_mode() v4: * Fix "ata_" prefix (Noticed by Jeff). Acked-by: Sergei Shtylyov Cc: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 7 +------ drivers/ide/pci/sl82c105.c | 10 +++++++--- include/linux/ide.h | 6 +++++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index d45bbad9ffe..d5cc96bb429 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -267,18 +267,15 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p { int pio_mode; int cycle_time = 0; - int use_iordy = 0; struct hd_driveid* id = drive->id; int overridden = 0; if (mode_wanted != 255) { pio_mode = mode_wanted; - use_iordy = (pio_mode > 2); } else if (!drive->id) { pio_mode = 0; } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); - use_iordy = (pio_mode > 2); } else { pio_mode = id->tPIO; if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ @@ -286,8 +283,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p overridden = 1; } if (id->field_valid & 2) { /* drive implements ATA2? */ - if (id->capability & 8) { /* drive supports use_iordy? */ - use_iordy = 1; + if (id->capability & 8) { /* IORDY supported? */ cycle_time = id->eide_pio_iordy; if (id->eide_pio_modes & 7) { overridden = 0; @@ -325,7 +321,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p if (d) { d->pio_mode = pio_mode; d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; - d->use_iordy = use_iordy; } return pio_mode; } diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index a7323d278c4..f2156ee7e2b 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -52,9 +52,10 @@ * Convert a PIO mode and cycle time to the required on/off times * for the interface. This has protection against runaway timings. */ -static unsigned int get_pio_timings(ide_pio_data_t *p) +static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) { unsigned int cmd_on, cmd_off; + u8 iordy = 0; cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; @@ -65,7 +66,10 @@ static unsigned int get_pio_timings(ide_pio_data_t *p) if (cmd_off == 0) cmd_off = 1; - return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); + if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id)) + iordy = 0x40; + + return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; } /* @@ -82,7 +86,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) pio = ide_get_best_pio_mode(drive, pio, 5, &p); - drv_ctrl = get_pio_timings(&p); + drv_ctrl = get_pio_timings(drive, &p); /* * Store the PIO timings so that we can restore them diff --git a/include/linux/ide.h b/include/linux/ide.h index 83a117d673c..349c22a1fbc 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1363,6 +1363,11 @@ extern void ide_toggle_bounce(ide_drive_t *drive, int on); extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); int ide_use_fast_pio(ide_drive_t *); +static inline int ide_dev_has_iordy(struct hd_driveid *id) +{ + return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; +} + u8 ide_dump_status(ide_drive_t *, const char *, u8); typedef struct ide_pio_timings_s { @@ -1374,7 +1379,6 @@ typedef struct ide_pio_timings_s { typedef struct ide_pio_data_s { u8 pio_mode; - u8 use_iordy; unsigned int cycle_time; } ide_pio_data_t; From a5d8c5c834d3cabf4b7b477c3f6ee923c25026fc Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:55 +0200 Subject: [PATCH 10/23] ide: add ide_pci_device_t.host_flags (take 2) * Rename ide_pci_device_t.flags to ide_pci_device_t.host_flags and IDEPCI_FLAG_ISA_PORTS flag to IDE_HFLAG_ISA_PORTS. * Add IDE_HFLAG_SINGLE flag for single channel devices. * Convert core code and all IDE PCI drivers to use IDE_HFLAG_SINGLE and remove no longer needed ide_pci_device_t.channels field. v2: * Fix issues noticed by Sergei: - correct code alignment in scc_pata.c - s/IDE_HFLAG_SINGLE/~IDE_HFLAG_SINGLE/ in serverworks.c Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 5 ----- drivers/ide/pci/alim15x3.c | 1 - drivers/ide/pci/amd74xx.c | 2 -- drivers/ide/pci/atiixp.c | 3 +-- drivers/ide/pci/cmd64x.c | 4 ---- drivers/ide/pci/cs5520.c | 3 +-- drivers/ide/pci/cs5530.c | 1 - drivers/ide/pci/cs5535.c | 2 +- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/generic.c | 15 --------------- drivers/ide/pci/hpt34x.c | 1 - drivers/ide/pci/hpt366.c | 8 +------- drivers/ide/pci/it8213.c | 2 +- drivers/ide/pci/it821x.c | 1 - drivers/ide/pci/jmicron.c | 1 - drivers/ide/pci/ns87415.c | 1 - drivers/ide/pci/opti621.c | 2 -- drivers/ide/pci/pdc202xx_new.c | 7 ------- drivers/ide/pci/pdc202xx_old.c | 5 ----- drivers/ide/pci/piix.c | 4 +--- drivers/ide/pci/rz1000.c | 1 - drivers/ide/pci/sc1200.c | 1 - drivers/ide/pci/scc_pata.c | 2 +- drivers/ide/pci/serverworks.c | 16 ++++++++-------- drivers/ide/pci/sgiioc4.c | 2 +- drivers/ide/pci/siimage.c | 1 - drivers/ide/pci/sis5513.c | 1 - drivers/ide/pci/sl82c105.c | 1 - drivers/ide/pci/slc90e66.c | 1 - drivers/ide/pci/tc86c001.c | 4 ++-- drivers/ide/pci/triflex.c | 1 - drivers/ide/pci/trm290.c | 1 - drivers/ide/pci/via82cxxx.c | 2 -- drivers/ide/setup-pci.c | 9 +++------ include/linux/ide.h | 6 +++--- 35 files changed, 25 insertions(+), 94 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 6d18fef558b..f8ac91c22e6 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -265,7 +265,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, .init_hwif = init_hwif_aec62xx, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, @@ -275,7 +274,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, .init_hwif = init_hwif_aec62xx, - .channels = 2, .autodma = NOAUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x1f, /* udma0-4 */ @@ -284,7 +282,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_setup = init_setup_aec62xx, .init_chipset = init_chipset_aec62xx, .init_hwif = init_hwif_aec62xx, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = NEVER_BOARD, @@ -294,7 +291,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_setup = init_setup_aec6x80, .init_chipset = init_chipset_aec62xx, .init_hwif = init_hwif_aec62xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x3f, /* udma0-5 */ @@ -303,7 +299,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_setup = init_setup_aec6x80, .init_chipset = init_chipset_aec62xx, .init_hwif = init_hwif_aec62xx, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index ba0fb92b041..1012da6e8a4 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -817,7 +817,6 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { .init_chipset = init_chipset_ali15x3, .init_hwif = init_hwif_ali15x3, .init_dma = init_dma_ali15x3, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 8d30b99a54d..9c3ea90aeb8 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -448,7 +448,6 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .name = name_str, \ .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ - .channels = 2, \ .autodma = AUTODMA, \ .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ .bootable = ON_BOARD, \ @@ -459,7 +458,6 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .name = name_str, \ .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ - .channels = 2, \ .autodma = AUTODMA, \ .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ .bootable = ON_BOARD, \ diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index bfdf086f452..078adbe250d 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -291,17 +291,16 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = { { /* 0 */ .name = "ATIIXP", .init_hwif = init_hwif_atiixp, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, .bootable = ON_BOARD, },{ /* 1 */ .name = "SB600_PATA", .init_hwif = init_hwif_atiixp, - .channels = 1, .autodma = AUTODMA, .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, }, }; diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 5171e94facd..8150a023dd7 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -617,7 +617,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .init_setup = init_setup_cmd64x, .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, @@ -627,7 +626,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .init_setup = init_setup_cmd646, .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, @@ -637,7 +635,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .init_setup = init_setup_cmd64x, .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, @@ -647,7 +644,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .init_setup = init_setup_cmd64x, .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 3b88a3a5611..5539a25eae9 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -194,10 +194,9 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) .name = name_str, \ .init_setup_dma = cs5520_init_setup_dma, \ .init_hwif = init_hwif_cs5520, \ - .channels = 2, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ - .flags = IDEPCI_FLAG_ISA_PORTS, \ + .host_flags = IDE_HFLAG_ISA_PORTS, \ } static ide_pci_device_t cyrix_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index b5c00d15a70..643d66cc672 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -341,7 +341,6 @@ static ide_pci_device_t cs5530_chipset __devinitdata = { .name = "CS5530", .init_chipset = init_chipset_cs5530, .init_hwif = init_hwif_cs5530, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 10f61f38243..50397937214 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -228,9 +228,9 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) static ide_pci_device_t cs5535_chipset __devinitdata = { .name = "CS5535", .init_hwif = init_hwif_cs5535, - .channels = 1, .autodma = AUTODMA, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, }; static int __devinit cs5535_init_one(struct pci_dev *dev, diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 103b9db9785..995b7256361 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -483,9 +483,9 @@ static ide_pci_device_t cy82c693_chipset __devinitdata = { .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, .init_hwif = init_hwif_cy82c693, - .channels = 1, .autodma = AUTODMA, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, }; static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 0d51a11e81d..48caa468b76 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c @@ -95,92 +95,77 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { { /* 0 */ .name = "Unknown", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 1 */ .name = "NS87410", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .bootable = ON_BOARD, },{ /* 2 */ .name = "SAMURAI", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 3 */ .name = "HT6565", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 4 */ .name = "UM8673F", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, },{ /* 5 */ .name = "UM8886A", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, },{ /* 6 */ .name = "UM8886BF", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, },{ /* 7 */ .name = "HINT_IDE", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 8 */ .name = "VIA_IDE", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 9 */ .name = "OPTI621V", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 10 */ .name = "VIA8237SATA", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, },{ /* 11 */ .name = "Piccolo0102", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 12 */ .name = "Piccolo0103", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 13 */ .name = "Piccolo0105", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, },{ /* 14 */ .name = "Revolution", .init_hwif = init_hwif_generic, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, } diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 64f19743b12..6d2ef0ee0f2 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -175,7 +175,6 @@ static ide_pci_device_t hpt34x_chipset __devinitdata = { .name = "HPT34X", .init_chipset = init_chipset_hpt34x, .init_hwif = init_hwif_hpt34x, - .channels = 2, .autodma = NOAUTODMA, .bootable = NEVER_BOARD, .extra = 16 diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 81853d740ae..182346a04f3 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1483,7 +1483,7 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) * to both functions -- really stupid design decision... :-( * Bit 4 is for the primary channel, bit 5 for the secondary. */ - d->channels = 1; + d->host_flags |= IDE_HFLAG_SINGLE; d->enablebits[0].mask = d->enablebits[0].val = 0x10; d->udma_mask = HPT366_ALLOW_ATA66_3 ? @@ -1546,7 +1546,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .bootable = OFF_BOARD, @@ -1557,7 +1556,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, @@ -1569,7 +1567,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, @@ -1581,7 +1578,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, @@ -1593,7 +1589,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, /* 4 */ .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = 0x3f, @@ -1605,7 +1600,6 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .init_chipset = init_chipset_hpt366, .init_hwif = init_hwif_hpt366, .init_dma = init_dma_hpt366, - .channels = 2, /* 4 */ .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index ff48c23e571..684b0ec79f4 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -272,10 +272,10 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) { \ .name = name_str, \ .init_hwif = init_hwif_it8213, \ - .channels = 1, \ .autodma = AUTODMA, \ .enablebits = {{0x41,0x80,0x80}}, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_SINGLE, \ } static ide_pci_device_t it8213_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 8197b653ba1..faccb2d4af4 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -718,7 +718,6 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha .name = name_str, \ .init_chipset = init_chipset_it821x, \ .init_hwif = init_hwif_it821x, \ - .channels = 2, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ .fixup = it821x_fixups \ diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index a6008f63e71..0edb9cd4585 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -177,7 +177,6 @@ fallback: { \ .name = name_str, \ .init_hwif = init_hwif_jmicron, \ - .channels = 2, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index b310c4f5107..09941f37d63 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c @@ -281,7 +281,6 @@ static ide_pci_device_t ns87415_chipset __devinitdata = { .init_iops = init_iops_ns87415, #endif .init_hwif = init_hwif_ns87415, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index aede7eee924..78d7adf2d0b 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -350,14 +350,12 @@ static ide_pci_device_t opti621_chipsets[] __devinitdata = { { /* 0 */ .name = "OPTI621", .init_hwif = init_hwif_opti621, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .bootable = ON_BOARD, },{ /* 1 */ .name = "OPTI621X", .init_hwif = init_hwif_opti621, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 06c5e93d37a..f8508d9cccd 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -566,7 +566,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x3f, /* udma0-5 */ @@ -575,7 +574,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x7f, /* udma0-6*/ @@ -584,7 +582,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdc20270, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x3f, /* udma0-5 */ @@ -593,7 +590,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x7f, /* udma0-6*/ @@ -602,7 +598,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x7f, /* udma0-6*/ @@ -611,7 +606,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdc20276, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x7f, /* udma0-6*/ @@ -620,7 +614,6 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_setup = init_setup_pdcnew, .init_chipset = init_chipset_pdcnew, .init_hwif = init_hwif_pdc202new, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .udma_mask = 0x7f, /* udma0-6*/ diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 25cebfe18dd..eb4e4a61d06 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -441,7 +441,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .init_chipset = init_chipset_pdc202xx, .init_hwif = init_hwif_pdc202xx, .init_dma = init_dma_pdc202xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 16, @@ -452,7 +451,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .init_chipset = init_chipset_pdc202xx, .init_hwif = init_hwif_pdc202xx, .init_dma = init_dma_pdc202xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, @@ -463,7 +461,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .init_chipset = init_chipset_pdc202xx, .init_hwif = init_hwif_pdc202xx, .init_dma = init_dma_pdc202xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, @@ -474,7 +471,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .init_chipset = init_chipset_pdc202xx, .init_hwif = init_hwif_pdc202xx, .init_dma = init_dma_pdc202xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, @@ -485,7 +481,6 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .init_chipset = init_chipset_pdc202xx, .init_hwif = init_hwif_pdc202xx, .init_dma = init_dma_pdc202xx, - .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 1372c35be03..a4f88d25b16 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -495,7 +495,6 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif) .name = name_str, \ .init_chipset = init_chipset_piix, \ .init_hwif = init_hwif_piix, \ - .channels = 2, \ .autodma = AUTODMA, \ .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ .bootable = ON_BOARD, \ @@ -514,11 +513,10 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = { */ .name = "MPIIX", .init_hwif = init_hwif_piix, - .channels = 2, .autodma = NODMA, .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, .bootable = ON_BOARD, - .flags = IDEPCI_FLAG_ISA_PORTS + .host_flags = IDE_HFLAG_ISA_PORTS, }, /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */ diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index f8c95469014..10e1ae7a4a0 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -52,7 +52,6 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) static ide_pci_device_t rz1000_chipset __devinitdata = { .name = "RZ100x", .init_hwif = init_hwif_rz1000, - .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 523363c9379..7dbc44cc722 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -471,7 +471,6 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) static ide_pci_device_t sc1200_chipset __devinitdata = { .name = "SC1200", .init_hwif = init_hwif_sc1200, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index fd4b1a24eca..a1954d1c287 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -772,9 +772,9 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) .init_setup = init_setup_scc, \ .init_iops = init_iops_scc, \ .init_hwif = init_hwif_scc, \ - .channels = 1, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_SINGLE, \ } static ide_pci_device_t scc_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index ed04e0c8dd4..809deb92bc1 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -441,9 +441,12 @@ static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) d->bootable = ON_BOARD; } - d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || - dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && - (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2; + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || + dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && + (!(PCI_FUNC(dev->devfn) & 1))) + d->host_flags |= IDE_HFLAG_SINGLE; + else + d->host_flags &= ~IDE_HFLAG_SINGLE; return ide_setup_pci_device(dev, d); } @@ -454,7 +457,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 1 */ @@ -462,7 +464,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 2 */ @@ -470,7 +471,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, },{ /* 3 */ @@ -478,17 +478,17 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .channels = 1, /* 2 */ .autodma = AUTODMA, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, },{ /* 4 */ .name = "SvrWks HT1000", .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .channels = 1, /* 2 */ .autodma = AUTODMA, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, } }; diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index d396b2929ed..ed983b56b4e 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -724,10 +724,10 @@ static ide_pci_device_t sgiioc4_chipset __devinitdata = { .name = "SGIIOC4", .init_hwif = ide_init_sgiioc4, .init_dma = ide_dma_sgiioc4, - .channels = 1, .autodma = AUTODMA, /* SGI IOC4 doesn't have enablebits. */ .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_SINGLE, }; int diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 5304fc5c616..47b9b94afe0 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -957,7 +957,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .init_iops = init_iops_siimage, \ .init_hwif = init_hwif_siimage, \ .fixup = siimage_fixup, \ - .channels = 2, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ } diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 756a9b6eb46..bbc50208757 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -878,7 +878,6 @@ static ide_pci_device_t sis5513_chipset __devinitdata = { .name = "SIS5513", .init_chipset = init_chipset_sis5513, .init_hwif = init_hwif_sis5513, - .channels = 2, .autodma = NOAUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index f2156ee7e2b..f4637d29aaf 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -453,7 +453,6 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = { .name = "W82C105", .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, - .channels = 2, .autodma = NOAUTODMA, .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 575dbbd8b48..115bcaefc8e 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -214,7 +214,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) static ide_pci_device_t slc90e66_chipset __devinitdata = { .name = "SLC90E66", .init_hwif = init_hwif_slc90e66, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 8de1f8e2249..1d40b0820f5 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c @@ -248,9 +248,9 @@ static ide_pci_device_t tc86c001_chipset __devinitdata = { .name = "TC86C001", .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, - .channels = 1, .autodma = AUTODMA, - .bootable = OFF_BOARD + .bootable = OFF_BOARD, + .host_flags = IDE_HFLAG_SINGLE, }; static int __devinit tc86c001_init_one(struct pci_dev *dev, diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 35e8c612638..801314fe352 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -129,7 +129,6 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) static ide_pci_device_t triflex_device __devinitdata = { .name = "TRIFLEX", .init_hwif = init_hwif_triflex, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, .bootable = ON_BOARD, diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index cbb1b11119a..dc4f4e298e0 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -327,7 +327,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) static ide_pci_device_t trm290_chipset __devinitdata = { .name = "TRM290", .init_hwif = init_hwif_trm290, - .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, }; diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 27e92fb9f95..bfc9b67f8c9 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -498,7 +498,6 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, - .channels = 2, .autodma = NOAUTODMA, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .bootable = ON_BOARD @@ -506,7 +505,6 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, - .channels = 2, .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, .bootable = ON_BOARD, diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index c88d33225cf..bfe1f4e5959 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -407,7 +407,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; - if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { + if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { /* Possibly we should fail if these checks report true */ ide_pci_check_iomem(dev, d, 2*port); ide_pci_check_iomem(dev, d, 2*port+1); @@ -571,7 +571,7 @@ out: void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) { - int port; + int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; int at_least_one_hwif_enabled = 0; ide_hwif_t *hwif, *mate = NULL; u8 tmp; @@ -582,16 +582,13 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a * Set up the IDE ports */ - for (port = 0; port <= 1; ++port) { + for (port = 0; port < channels; ++port) { ide_pci_enablebit_t *e = &(d->enablebits[port]); if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) continue; /* port not enabled */ - if (d->channels <= port) - break; - if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) continue; diff --git a/include/linux/ide.h b/include/linux/ide.h index 349c22a1fbc..498dc57627f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1244,7 +1244,8 @@ typedef struct ide_pci_enablebit_s { enum { /* Uses ISA control ports not PCI ones. */ - IDEPCI_FLAG_ISA_PORTS = (1 << 0), + IDE_HFLAG_ISA_PORTS = (1 << 0), + IDE_HFLAG_SINGLE = (1 << 1), }; typedef struct ide_pci_device_s { @@ -1256,13 +1257,12 @@ typedef struct ide_pci_device_s { void (*init_hwif)(ide_hwif_t *); void (*init_dma)(ide_hwif_t *, unsigned long); void (*fixup)(ide_hwif_t *); - u8 channels; u8 autodma; ide_pci_enablebit_t enablebits[2]; u8 bootable; unsigned int extra; struct ide_pci_device_s *next; - u8 flags; + u8 host_flags; u8 udma_mask; } ide_pci_device_t; From 1880a8d7f2d0587e657e3292166003636067b7ea Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:56 +0200 Subject: [PATCH 11/23] serverworks: always tune PIO * Always set ->autotune so PIO gets correctly auto-tuned (previously ->autotune was only set when ->dma_base wasn't available, however ->ide_dma_check()/->speedproc() was always trying to tune PIO when tuning DMA). * Move code responsible for programming chipset for PIO mode from svwks_tune_chipset() to svwks_tune_pio(). Don't tune PIO when tuning DMA (this is no longer needed since ->autotune is always set now). * Handle PIO modes early in svwks_tune_chipset() so DMA configuration registers don't get cleared when programming PIO mode. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/serverworks.c | 76 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 809deb92bc1..011245246b1 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/serverworks.c Version 0.20 Jun 3 2007 + * linux/drivers/ide/pci/serverworks.c Version 0.21 Jun 16 2007 * * Copyright (C) 1998-2000 Michel Aubry * Copyright (C) 1998-2000 Andrzej Krzysztofowicz @@ -123,23 +123,45 @@ static u8 svwks_csb_check (struct pci_dev *dev) } return 0; } + +static void svwks_tune_pio(ide_drive_t *drive, const u8 pio) +{ + static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; + static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; + + struct pci_dev *dev = drive->hwif->pci_dev; + + pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); + + if (svwks_csb_check(dev)) { + u16 csb_pio = 0; + + pci_read_config_word(dev, 0x4a, &csb_pio); + + csb_pio &= ~(0x0f << (4 * drive->dn)); + csb_pio |= (pio << (4 * drive->dn)); + + pci_write_config_word(dev, 0x4a, csb_pio); + } +} + static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) { static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; - static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; - static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; u8 speed = ide_rate_filter(drive, xferspeed); - u8 pio = ide_get_best_pio_mode(drive, 255, 4, NULL); u8 unit = (drive->select.b.unit & 0x01); - u8 csb5 = svwks_csb_check(dev); - u8 ultra_enable = 0, ultra_timing = 0; - u8 dma_timing = 0, pio_timing = 0; - u16 csb5_pio = 0; + + u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; + + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { + svwks_tune_pio(drive, speed - XFER_PIO_0); + return ide_config_drive_speed(drive, speed); + } /* If we are about to put a disk into UDMA mode we screwed up. Our code assumes we never _ever_ do this on an OSB4 */ @@ -149,31 +171,15 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) BUG(); pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); - pci_read_config_word(dev, 0x4A, &csb5_pio); pci_read_config_byte(dev, 0x54, &ultra_enable); ultra_timing &= ~(0x0F << (4*unit)); ultra_enable &= ~(0x01 << drive->dn); - csb5_pio &= ~(0x0F << (4*drive->dn)); switch(speed) { - case XFER_PIO_4: - case XFER_PIO_3: - case XFER_PIO_2: - case XFER_PIO_1: - case XFER_PIO_0: - pio_timing |= pio_modes[speed - XFER_PIO_0]; - csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn)); - break; - case XFER_MW_DMA_2: case XFER_MW_DMA_1: case XFER_MW_DMA_0: - /* - * TODO: always setup PIO mode so this won't be needed - */ - pio_timing |= pio_modes[pio]; - csb5_pio |= (pio << (4*drive->dn)); dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; break; @@ -183,11 +189,6 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) case XFER_UDMA_2: case XFER_UDMA_1: case XFER_UDMA_0: - /* - * TODO: always setup PIO mode so this won't be needed - */ - pio_timing |= pio_modes[pio]; - csb5_pio |= (pio << (4*drive->dn)); dma_timing |= dma_modes[2]; ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit)); ultra_enable |= (0x01 << drive->dn); @@ -195,10 +196,6 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) break; } - pci_write_config_byte(dev, drive_pci[drive->dn], pio_timing); - if (csb5) - pci_write_config_word(dev, 0x4A, csb5_pio); - pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); pci_write_config_byte(dev, 0x54, ultra_enable); @@ -209,7 +206,8 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) static void svwks_tune_drive (ide_drive_t *drive, u8 pio) { pio = ide_get_best_pio_mode(drive, pio, 4, NULL); - (void)svwks_tune_chipset(drive, XFER_PIO_0 + pio); + svwks_tune_pio(drive, pio); + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } static int svwks_config_drive_xfer_rate (ide_drive_t *drive) @@ -407,11 +405,11 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) hwif->autodma = 0; - if (!hwif->dma_base) { - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + + if (!hwif->dma_base) return; - } hwif->ide_dma_check = &svwks_config_drive_xfer_rate; if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { @@ -424,8 +422,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) dma_stat = inb(hwif->dma_status); hwif->drives[0].autodma = (dma_stat & 0x20); hwif->drives[1].autodma = (dma_stat & 0x40); - hwif->drives[0].autotune = (!(dma_stat & 0x20)); - hwif->drives[1].autotune = (!(dma_stat & 0x40)); } static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) From 1c164acf50146d8a82caed642951390e073620f1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:56 +0200 Subject: [PATCH 12/23] serverworks: fix DMA The driver used to depend on BIOS settings for deciding whether it is OK to use DMA. However it seems that BIOS doesn't always handle all cases correctly so just let IDE core to decide about this. It should be a safe thing to do now, after the driver went through heavy bugfixing. Thanks for bugreport and testing the patch goes out to Sven Niedner. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/serverworks.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 011245246b1..abc3cd58aaa 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/serverworks.c Version 0.21 Jun 16 2007 + * linux/drivers/ide/pci/serverworks.c Version 0.22 Jun 27 2007 * * Copyright (C) 1998-2000 Michel Aubry * Copyright (C) 1998-2000 Andrzej Krzysztofowicz @@ -387,8 +387,6 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif) static void __devinit init_hwif_svwks (ide_hwif_t *hwif) { - u8 dma_stat = 0; - if (!hwif->irq) hwif->irq = hwif->channel ? 15 : 14; @@ -419,9 +417,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) if (!noautodma) hwif->autodma = 1; - dma_stat = inb(hwif->dma_status); - hwif->drives[0].autodma = (dma_stat & 0x20); - hwif->drives[1].autodma = (dma_stat & 0x40); + hwif->drives[0].autodma = hwif->drives[1].autodma = 1; } static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) From 8987d21ba6a426b0685257866ce366055930b57f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:56 +0200 Subject: [PATCH 13/23] ide: ide_start_power_step() fix WRT disabling DMA * Do the same thing as probe_hwif() and always disable DMA so chipset DMA enabled bit gets cleared (if the drive doesn't support DMA ide_set_dma() won't try to tune it anyway). * Add TODO comment about respecting ->using_dma setting. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index f9de7984441..484c50e7144 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -224,11 +224,12 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * * we could be smarter and check for current xfer_speed * in struct drive etc... */ - if ((drive->id->capability & 1) == 0) - break; if (drive->hwif->ide_dma_check == NULL) break; drive->hwif->dma_off_quietly(drive); + /* + * TODO: respect ->using_dma setting + */ ide_set_dma(drive); break; } From 31c4df441cce6b9ec541e7f722f50bfbc617dd76 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:56 +0200 Subject: [PATCH 14/23] sc1200: remove stale Power Management code * Nowadays core IDE code handles restoring of PIO and DMA modes (ide-io.c:ide_start_power_step() etc) so remove open-coded version from sc1200_resume(). There should be no change in behavior because settings done by sc1200_resume() were always overridden by generic_ide_resume() and ide_{start,stop}_power_step(). * Bump driver version. Cc: Mark Lord Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/sc1200.c | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 7dbc44cc722..9ac8889f8ad 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/sc1200.c Version 0.94 Mar 10 2007 + * linux/drivers/ide/pci/sc1200.c Version 0.95 Jun 16 2007 * * Copyright (C) 2000-2002 Mark Lord * Copyright (C) 2007 Bartlomiej Zolnierkiewicz @@ -390,7 +390,7 @@ static int sc1200_resume (struct pci_dev *dev) // loop over all interfaces that are part of this pci device: // while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { - unsigned int basereg, r, d, format; + unsigned int basereg, r; sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; // @@ -402,41 +402,6 @@ static int sc1200_resume (struct pci_dev *dev) pci_write_config_dword(hwif->pci_dev, basereg + (r<<2), ss->regs[r]); } } - // - // Re-program drive PIO modes - // - pci_read_config_dword(hwif->pci_dev, basereg+4, &format); - format = (format >> 31) & 1; - if (format) - format += sc1200_get_pci_clock(); - for (d = 0; d < 2; ++d) { - ide_drive_t *drive = &(hwif->drives[d]); - if (drive->present) { - unsigned int pio, timings; - pci_read_config_dword(hwif->pci_dev, basereg+(drive->select.b.unit << 3), &timings); - for (pio = 0; pio <= 4; ++pio) { - if (sc1200_pio_timings[format][pio] == timings) - break; - } - if (pio > 4) - pio = 255; /* autotune */ - (void)sc1200_tuneproc(drive, pio); - } - } - // - // Re-program drive DMA modes - // - for (d = 0; d < MAX_DRIVES; ++d) { - ide_drive_t *drive = &(hwif->drives[d]); - if (drive->present && !__ide_dma_bad_drive(drive)) { - int enable_dma = drive->using_dma; - hwif->dma_off_quietly(drive); - if (sc1200_config_dma(drive)) - enable_dma = 0; - if (enable_dma) - hwif->dma_host_on(drive); - } - } } return 0; } From 7dd00083b1160b560fa2a0a486799b57baa5d035 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:56 +0200 Subject: [PATCH 15/23] ide: add ide_pio_cycle_time() helper (take 2) * Add ide_pio_cycle_time() helper. * Use it in ali14xx/ht6560b/qd65xx/cmd64{0,x}/sl82c105 and pmac host drivers (previously cycle time given by the device was only used for "pio" == 255). * Remove no longer needed ide_pio_data_t.cycle_time field. v2: * Fix "ata_" prefix (Noticed by Jeff). Acked-by: Sergei Shtylyov Cc: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 40 +++++++++++++++++++++++++----------- drivers/ide/legacy/ali14xx.c | 5 ++--- drivers/ide/legacy/ht6560b.c | 10 +++++---- drivers/ide/legacy/qd65xx.c | 20 +++++++++--------- drivers/ide/pci/cmd640.c | 12 +++++------ drivers/ide/pci/cmd64x.c | 10 +++++---- drivers/ide/pci/sl82c105.c | 16 +++++++-------- drivers/ide/ppc/pmac.c | 15 +++++++------- include/linux/ide.h | 2 +- 9 files changed, 74 insertions(+), 56 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index d5cc96bb429..6e85bee0bef 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -249,6 +249,29 @@ static int ide_scan_pio_blacklist (char *model) return -1; } +unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio) +{ + struct hd_driveid *id = drive->id; + int cycle_time = 0; + + if (id->field_valid & 2) { + if (id->capability & 8) + cycle_time = id->eide_pio_iordy; + else + cycle_time = id->eide_pio; + } + + /* conservative "downgrade" for all pre-ATA2 drives */ + if (pio < 3) { + if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time) + cycle_time = 0; /* use standard timing */ + } + + return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time; +} + +EXPORT_SYMBOL_GPL(ide_pio_cycle_time); + /** * ide_get_best_pio_mode - get PIO mode from drive * @drive: drive to consider @@ -266,7 +289,6 @@ static int ide_scan_pio_blacklist (char *model) u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) { int pio_mode; - int cycle_time = 0; struct hd_driveid* id = drive->id; int overridden = 0; @@ -284,7 +306,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p } if (id->field_valid & 2) { /* drive implements ATA2? */ if (id->capability & 8) { /* IORDY supported? */ - cycle_time = id->eide_pio_iordy; if (id->eide_pio_modes & 7) { overridden = 0; if (id->eide_pio_modes & 4) @@ -294,8 +315,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p else pio_mode = 3; } - } else { - cycle_time = id->eide_pio; } } @@ -310,18 +329,15 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p pio_mode--; printk(KERN_INFO "%s: applying conservative " "PIO \"downgrade\"\n", drive->name); - if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) - cycle_time = 0; /* use standard timing */ } } - if (pio_mode > max_mode) { + + if (pio_mode > max_mode) pio_mode = max_mode; - cycle_time = 0; - } - if (d) { + + if (d) d->pio_mode = pio_mode; - d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; - } + return pio_mode; } diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index df17ed68c0b..30aeb8750c0 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -115,13 +115,12 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio) int time1, time2; u8 param1, param2, param3, param4; unsigned long flags; - ide_pio_data_t d; int bus_speed = system_bus_clock(); - pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d); + pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, NULL); /* calculate timing, according to PIO mode */ - time1 = d.cycle_time; + time1 = ide_pio_cycle_time(drive, pio); time2 = ide_pio_timings[pio].active_time; param3 = param1 = (time2 * bus_speed + 999) / 1000; param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index c8f353b1296..85d16812d90 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -203,19 +203,21 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio) { int active_time, recovery_time; int active_cycles, recovery_cycles; - ide_pio_data_t d; int bus_speed = system_bus_clock(); if (pio) { - pio = ide_get_best_pio_mode(drive, pio, 5, &d); - + unsigned int cycle_time; + + pio = ide_get_best_pio_mode(drive, pio, 5, NULL); + cycle_time = ide_pio_cycle_time(drive, pio); + /* * Just like opti621.c we try to calculate the * actual cycle time for recovery and activity * according system bus speed. */ active_time = ide_pio_timings[pio].active_time; - recovery_time = d.cycle_time + recovery_time = cycle_time - active_time - ide_pio_timings[pio].setup_time; /* diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 7783745dd16..233905b08e9 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -252,38 +252,38 @@ static void qd6500_tune_drive (ide_drive_t *drive, u8 pio) static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) { - ide_pio_data_t d; int base = HWIF(drive)->select_data; + unsigned int cycle_time; int active_time = 175; int recovery_time = 415; /* worst case values from the dos driver */ if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { - pio = ide_get_best_pio_mode(drive, pio, 4, &d); + pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + cycle_time = ide_pio_cycle_time(drive, pio); switch (pio) { case 0: break; case 3: - if (d.cycle_time >= 110) { + if (cycle_time >= 110) { active_time = 86; - recovery_time = d.cycle_time - 102; + recovery_time = cycle_time - 102; } else printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); break; case 4: - if (d.cycle_time >= 69) { + if (cycle_time >= 69) { active_time = 70; - recovery_time = d.cycle_time - 61; + recovery_time = cycle_time - 61; } else printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); break; default: - if (d.cycle_time >= 180) { + if (cycle_time >= 180) { active_time = 110; - recovery_time = d.cycle_time - 120; + recovery_time = cycle_time - 120; } else { active_time = ide_pio_timings[pio].active_time; - recovery_time = d.cycle_time - -active_time; + recovery_time = cycle_time - active_time; } } printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index dff21597e64..9f67ffc4342 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -633,9 +633,8 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle */ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) { + unsigned int index = 0, cycle_time; u8 b; - ide_pio_data_t d; - unsigned int index = 0; while (drive != cmd_drives[index]) { if (++index > 3) { @@ -662,13 +661,12 @@ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) return; } - (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d); - cmd640_set_mode (index, d.pio_mode, d.cycle_time); + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); + cycle_time = ide_pio_cycle_time(drive, mode_wanted); + cmd640_set_mode(index, mode_wanted, cycle_time); printk("%s: selected cmd640 PIO mode%d (%dns)", - drive->name, - d.pio_mode, - d.cycle_time); + drive->name, mode_wanted, cycle_time); display_clocks(index); } diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 8150a023dd7..c383f6dc67d 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -221,16 +221,18 @@ static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) { ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; - ide_pio_data_t pio; + unsigned int cycle_time; u8 pio_mode, setup_count, arttim = 0; static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; - pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); + + pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); + cycle_time = ide_pio_cycle_time(drive, pio_mode); cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", - drive->name, mode_wanted, pio_mode, pio.cycle_time); + drive->name, mode_wanted, pio_mode, cycle_time); - program_cycle_times(drive, pio.cycle_time, + program_cycle_times(drive, cycle_time, ide_pio_timings[pio_mode].active_time); setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index f4637d29aaf..cc5f69b7514 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -52,13 +52,13 @@ * Convert a PIO mode and cycle time to the required on/off times * for the interface. This has protection against runaway timings. */ -static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) +static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) { unsigned int cmd_on, cmd_off; u8 iordy = 0; - cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; - cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; + cmd_on = (ide_pio_timings[pio].active_time + 29) / 30; + cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; if (cmd_on == 0) cmd_on = 1; @@ -66,7 +66,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) if (cmd_off == 0) cmd_off = 1; - if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id)) + if (pio > 2 || ide_dev_has_iordy(drive->id)) iordy = 0x40; return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; @@ -79,14 +79,13 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) { struct pci_dev *dev = HWIF(drive)->pci_dev; int reg = 0x44 + drive->dn * 4; - ide_pio_data_t p; u16 drv_ctrl; DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); - pio = ide_get_best_pio_mode(drive, pio, 5, &p); + pio = ide_get_best_pio_mode(drive, pio, 5, NULL); - drv_ctrl = get_pio_timings(drive, &p); + drv_ctrl = get_pio_timings(drive, pio); /* * Store the PIO timings so that we can restore them @@ -105,7 +104,8 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) } printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, - ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl); + ide_xfer_verbose(pio + XFER_PIO_0), + ide_pio_cycle_time(drive, pio), drv_ctrl); return pio; } diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index e46f4720654..669330521fc 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -615,24 +615,25 @@ out: static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) { - ide_pio_data_t d; u32 *timings; unsigned accessTicks, recTicks; unsigned accessTime, recTime; pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; - + unsigned int cycle_time; + if (pmif == NULL) return; /* which drive is it ? */ timings = &pmif->timings[drive->select.b.unit & 0x01]; - pio = ide_get_best_pio_mode(drive, pio, 4, &d); + pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + cycle_time = ide_pio_cycle_time(drive, pio); switch (pmif->kind) { case controller_sh_ata6: { /* 133Mhz cell */ - u32 tr = kauai_lookup_timing(shasta_pio_timings, d.cycle_time); + u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); if (tr == 0) return; *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; @@ -641,7 +642,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) case controller_un_ata6: case controller_k2_ata6: { /* 100Mhz cell */ - u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time); + u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); if (tr == 0) return; *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; @@ -649,7 +650,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) } case controller_kl_ata4: /* 66Mhz cell */ - recTime = d.cycle_time - ide_pio_timings[pio].active_time + recTime = cycle_time - ide_pio_timings[pio].active_time - ide_pio_timings[pio].setup_time; recTime = max(recTime, 150U); accessTime = ide_pio_timings[pio].active_time; @@ -665,7 +666,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) default: { /* 33Mhz cell */ int ebit = 0; - recTime = d.cycle_time - ide_pio_timings[pio].active_time + recTime = cycle_time - ide_pio_timings[pio].active_time - ide_pio_timings[pio].setup_time; recTime = max(recTime, 150U); accessTime = ide_pio_timings[pio].active_time; diff --git a/include/linux/ide.h b/include/linux/ide.h index 498dc57627f..0afa52c14ff 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1379,9 +1379,9 @@ typedef struct ide_pio_timings_s { typedef struct ide_pio_data_s { u8 pio_mode; - unsigned int cycle_time; } ide_pio_data_t; +unsigned int ide_pio_cycle_time(ide_drive_t *, u8); extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); extern const ide_pio_timings_t ide_pio_timings[6]; From e5fa4b2968ff0f32b5ecfa082fd6db50b731055e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:57 +0200 Subject: [PATCH 16/23] ide: ide_find_best_pio_mode() fixes (take 2) * Check IORDY bit for PIO modes > 2. * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead. v2: * Fix PIO number being returned incorrectly instead of PIO mode (Noticed by Sergei). Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-timing.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h index e6cb8593b5b..9b5afebafbf 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timing.h @@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_drive_t *drive) struct hd_driveid *id = drive->id; short best = 0; - if (id->field_valid & 2) { /* EIDE PIO modes */ - + /* EIDE PIO modes */ + if ((id->field_valid & 2) && (id->capability & 8)) { if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best; } - - return (drive->id->tPIO == 2) ? XFER_PIO_2 : - (drive->id->tPIO == 1) ? XFER_PIO_1 : - (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW; + + return XFER_PIO_0 + min_t(u8, id->tPIO, 2); } static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) From 2134758d2a5429325cee4d4ce8959af5314eeba1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:58 +0200 Subject: [PATCH 17/23] ide: drop "PIO data" argument from ide_get_best_pio_mode() * Drop no longer needed "PIO data" argument from ide_get_best_pio_mode() and convert all users accordingly. * Remove no longer needed ide_pio_data_t. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 6 +----- drivers/ide/legacy/ali14xx.c | 2 +- drivers/ide/legacy/dtc2278.c | 2 +- drivers/ide/legacy/ht6560b.c | 2 +- drivers/ide/legacy/qd65xx.c | 2 +- drivers/ide/legacy/umc8672.c | 2 +- drivers/ide/mips/au1xxx-ide.c | 2 +- drivers/ide/pci/aec62xx.c | 2 +- drivers/ide/pci/alim15x3.c | 3 +-- drivers/ide/pci/atiixp.c | 2 +- drivers/ide/pci/cmd640.c | 2 +- drivers/ide/pci/cmd64x.c | 2 +- drivers/ide/pci/cs5520.c | 2 +- drivers/ide/pci/cs5530.c | 2 +- drivers/ide/pci/cs5535.c | 6 +++--- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/hpt34x.c | 2 +- drivers/ide/pci/hpt366.c | 2 +- drivers/ide/pci/it8213.c | 4 ++-- drivers/ide/pci/it821x.c | 4 ++-- drivers/ide/pci/jmicron.c | 2 +- drivers/ide/pci/opti621.c | 4 ++-- drivers/ide/pci/pdc202xx_new.c | 2 +- drivers/ide/pci/pdc202xx_old.c | 2 +- drivers/ide/pci/piix.c | 2 +- drivers/ide/pci/sc1200.c | 2 +- drivers/ide/pci/scc_pata.c | 2 +- drivers/ide/pci/serverworks.c | 2 +- drivers/ide/pci/siimage.c | 4 ++-- drivers/ide/pci/sis5513.c | 2 +- drivers/ide/pci/sl82c105.c | 2 +- drivers/ide/pci/slc90e66.c | 2 +- drivers/ide/pci/tc86c001.c | 2 +- drivers/ide/pci/triflex.c | 2 +- drivers/ide/ppc/mpc8xx.c | 3 +-- drivers/ide/ppc/pmac.c | 2 +- include/linux/ide.h | 6 +----- 37 files changed, 43 insertions(+), 53 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 6e85bee0bef..df29868209f 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -277,7 +277,6 @@ EXPORT_SYMBOL_GPL(ide_pio_cycle_time); * @drive: drive to consider * @mode_wanted: preferred mode * @max_mode: highest allowed mode - * @d: PIO data * * This routine returns the recommended PIO settings for a given drive, * based on the drive->id information and the ide_pio_blacklist[]. @@ -286,7 +285,7 @@ EXPORT_SYMBOL_GPL(ide_pio_cycle_time); * This is used by most chipset support modules when "auto-tuning". */ -u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) +u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) { int pio_mode; struct hd_driveid* id = drive->id; @@ -335,9 +334,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p if (pio_mode > max_mode) pio_mode = max_mode; - if (d) - d->pio_mode = pio_mode; - return pio_mode; } diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 30aeb8750c0..d5c7a57b71c 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -117,7 +117,7 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio) unsigned long flags; int bus_speed = system_bus_clock(); - pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, NULL); + pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO); /* calculate timing, according to PIO mode */ time1 = ide_pio_cycle_time(drive, pio); diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 36a3f0ac616..8c4c27e5dc1 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -71,7 +71,7 @@ static void tune_dtc2278 (ide_drive_t *drive, u8 pio) { unsigned long flags; - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); if (pio >= 3) { spin_lock_irqsave(&ide_lock, flags); diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 85d16812d90..82ed37df956 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -208,7 +208,7 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio) if (pio) { unsigned int cycle_time; - pio = ide_get_best_pio_mode(drive, pio, 5, NULL); + pio = ide_get_best_pio_mode(drive, pio, 5); cycle_time = ide_pio_cycle_time(drive, pio); /* diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 233905b08e9..39145102b34 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -258,7 +258,7 @@ static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) int recovery_time = 415; /* worst case values from the dos driver */ if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); cycle_time = ide_pio_cycle_time(drive, pio); switch (pio) { diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index ddc403a0bd8..caeebd41081 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c @@ -110,7 +110,7 @@ static void tune_umc (ide_drive_t *drive, u8 pio) unsigned long flags; ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", drive->name, pio, pio_to_umc[pio]); spin_lock_irqsave(&ide_lock, flags); diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 2e7013a2a7f..b0d13c34d31 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -106,7 +106,7 @@ static void auide_tune_drive(ide_drive_t *drive, byte pio) u8 speed; /* get the best pio mode for the drive */ - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", drive->name, pio); diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index f8ac91c22e6..8396d711f23 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -142,7 +142,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed) static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0); } diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 1012da6e8a4..a0c43a91b0f 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -295,7 +295,6 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) { - ide_pio_data_t d; ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; int s_time, a_time, c_time; @@ -307,7 +306,7 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) u8 cd_dma_fifo = 0; int unit = drive->select.b.unit & 1; - pio = ide_get_best_pio_mode(drive, pio, 5, &d); + pio = ide_get_best_pio_mode(drive, pio, 5); s_time = ide_pio_timings[pio].setup_time; a_time = ide_pio_timings[pio].active_time; if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 078adbe250d..a4740e4776f 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -155,7 +155,7 @@ static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); atiixp_tune_pio(drive, pio); (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 9f67ffc4342..335482981a9 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -661,7 +661,7 @@ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) return; } - mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5); cycle_time = ide_pio_cycle_time(drive, mode_wanted); cmd640_set_mode(index, mode_wanted, cycle_time); diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index c383f6dc67d..9cf969b61bf 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -226,7 +226,7 @@ static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; - pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); + pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5); cycle_time = ide_pio_cycle_time(drive, pio_mode); cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 5539a25eae9..ee10e48d7ce 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -126,7 +126,7 @@ static int cs5520_tune_chipset(ide_drive_t *drive, u8 xferspeed) static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); cs5520_tune_chipset(drive, (XFER_PIO_0 + pio)); } diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 643d66cc672..a75c14a9318 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -82,7 +82,7 @@ static void cs5530_tunepio(ide_drive_t *drive, u8 pio) static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) cs5530_tunepio(drive, pio); diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 50397937214..0bff4005292 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -89,7 +89,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed) pioa = speed - XFER_PIO_0; piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), - 255, 4, NULL); + 255, 4); cmd = pioa < piob ? pioa : piob; /* Write the speed of the current drive */ @@ -159,7 +159,7 @@ static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed) /* cs5535 max pio is pio 4, best_pio will check the blacklist. i think we don't need to rate_filter the incoming xferspeed since we know we're only going to choose pio */ - xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4, NULL); + xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4); ide_config_drive_speed(drive, modes[xferspeed]); cs5535_set_speed(drive, xferspeed); } @@ -174,7 +174,7 @@ static int cs5535_dma_check(ide_drive_t *drive) return 0; if (ide_use_fast_pio(drive)) { - speed = ide_get_best_pio_mode(drive, 255, 4, NULL); + speed = ide_get_best_pio_mode(drive, 255, 4); cs5535_set_drive(drive, speed); } diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 995b7256361..cb7c18187e3 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -330,7 +330,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio) #endif /* CY82C693_DEBUG_LOGS */ /* first let's calc the pio modes */ - pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO, NULL); + pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO); #if CY82C693_DEBUG_INFO printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 6d2ef0ee0f2..2e4591303f4 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -80,7 +80,7 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 5, NULL); + pio = ide_get_best_pio_mode(drive, pio, 5); (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); } diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 182346a04f3..0a3fe9471eb 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -652,7 +652,7 @@ static int hpt3xx_tune_chipset(ide_drive_t *drive, u8 speed) static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 684b0ec79f4..d8425a2499b 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -82,7 +82,7 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio) { 2, 1 }, { 2, 3 }, }; - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); spin_lock_irqsave(&tune_lock, flags); pci_read_config_word(dev, master_port, &master_data); @@ -214,7 +214,7 @@ static int it8213_config_drive_for_dma (ide_drive_t *drive) if (ide_tune_dma(drive)) return 0; - pio = ide_get_best_pio_mode(drive, 255, 4, NULL); + pio = ide_get_best_pio_mode(drive, 255, 4); it8213_tune_chipset(drive, XFER_PIO_0 + pio); return -1; diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index faccb2d4af4..790233db017 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -255,7 +255,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio) * on the cable. */ if (pair) { - u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); /* trim PIO to the slowest of the master/slave */ if (pair_pio < set_pio) set_pio = pair_pio; @@ -276,7 +276,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio) static void it821x_tuneproc(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); (void)it821x_tunepio(drive, pio); } diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 0edb9cd4585..57d3d4186b3 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -97,7 +97,7 @@ static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted) static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) { - u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); + u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5); if (set_speed) (void) ide_config_drive_speed(drive, speed); } diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 78d7adf2d0b..1802ad0927e 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -147,12 +147,12 @@ static void compute_pios(ide_drive_t *drive, u8 pio) int d; ide_hwif_t *hwif = HWIF(drive); - drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO, NULL); + drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO); for (d = 0; d < 2; ++d) { drive = &hwif->drives[d]; if (drive->present) { if (drive->drive_data == PIO_DONT_KNOW) - drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO, NULL); + drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO); #ifdef OPTI621_DEBUG printk("%s: Selected PIO mode %d\n", drive->name, drive->drive_data); diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index f8508d9cccd..a8a01b4ab60 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -219,7 +219,7 @@ static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed) static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index eb4e4a61d06..3a6882d4aa6 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -145,7 +145,7 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed) static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index a4f88d25b16..41a3612c610 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -219,7 +219,7 @@ static void piix_tune_pio (ide_drive_t *drive, u8 pio) */ static void piix_tune_drive (ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); piix_tune_pio(drive, pio); (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 9ac8889f8ad..98e1a2bd950 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -304,7 +304,7 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "au return; } - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index a1954d1c287..2c76355b92e 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -210,7 +210,7 @@ static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted) unsigned char speed = XFER_PIO_0; int offset; - mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4, NULL); + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4); switch (mode_wanted) { case 4: speed = XFER_PIO_4; diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index abc3cd58aaa..1fe29d9e68f 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -205,7 +205,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) static void svwks_tune_drive (ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); svwks_tune_pio(drive, pio); (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 47b9b94afe0..63a8a93d63d 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -189,7 +189,7 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio) /* trim *taskfile* PIO to the slowest of the master/slave */ if (pair->present) { - u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); if (pair_pio < tf_pio) tf_pio = pair_pio; @@ -221,7 +221,7 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio) static void sil_tuneproc(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); sil_tune_pio(drive, pio); (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index bbc50208757..3c4693695ca 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -521,7 +521,7 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio) static int sis5513_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); config_art_rwp_pio(drive, pio); return ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index cc5f69b7514..4e8f32e643a 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -83,7 +83,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); - pio = ide_get_best_pio_mode(drive, pio, 5, NULL); + pio = ide_get_best_pio_mode(drive, pio, 5); drv_ctrl = get_pio_timings(drive, pio); diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 115bcaefc8e..562747fbee3 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -103,7 +103,7 @@ static void slc90e66_tune_pio (ide_drive_t *drive, u8 pio) static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); slc90e66_tune_pio(drive, pio); (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 1d40b0820f5..2479a19f009 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c @@ -47,7 +47,7 @@ static int tc86c001_tune_chipset(ide_drive_t *drive, u8 speed) static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio) { - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio); } diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 801314fe352..f8fef905bac 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -96,7 +96,7 @@ static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed) static void triflex_tune_drive(ide_drive_t *drive, u8 pio) { - int use_pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + int use_pio = ide_get_best_pio_mode(drive, pio, 4); (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); } diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index 82de2d781f2..f3789c0e6cc 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -431,13 +431,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, static void m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) { - ide_pio_data_t d; #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) volatile pcmconf8xx_t *pcmp; ulong timing, mask, reg; #endif - pio = ide_get_best_pio_mode(drive, pio, 4, &d); + pio = ide_get_best_pio_mode(drive, pio, 4); #if 1 printk("%s[%d] %s: best PIO mode: %d\n", diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 669330521fc..debaa8823f5 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -627,7 +627,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) /* which drive is it ? */ timings = &pmif->timings[drive->select.b.unit & 0x01]; - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + pio = ide_get_best_pio_mode(drive, pio, 4); cycle_time = ide_pio_cycle_time(drive, pio); switch (pmif->kind) { diff --git a/include/linux/ide.h b/include/linux/ide.h index 0afa52c14ff..14a87f619d1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1377,12 +1377,8 @@ typedef struct ide_pio_timings_s { /* active + recovery (+ setup for some chips) */ } ide_pio_timings_t; -typedef struct ide_pio_data_s { - u8 pio_mode; -} ide_pio_data_t; - unsigned int ide_pio_cycle_time(ide_drive_t *, u8); -extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); +u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); extern const ide_pio_timings_t ide_pio_timings[6]; From 6a824c92db4d606c324272c4eed366fb71672440 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:58 +0200 Subject: [PATCH 18/23] ide: remove ide_find_best_pio_mode() * Add ->host_flags to ide_hwif_t to store ide_pci_device_t.host_flags, assign it in setup-pci.c:ide_pci_setup_ports(). * Add IDE_HFLAG_PIO_NO_{BLACKLIST,DOWNGRADE} to ide_pci_device_t.host_flags and teach ide_get_best_pio_mode() about them. Also remove needless !drive->id check while at it (drive->id is always present). * Convert amd74xx, via82cxxx and ide-timing.h to use ide_get_best_pio_mode() and then remove no longer needed ide_find_best_pio_mode(). There should be no functionality changes caused by this patch. Acked-by: Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 13 +++++++------ drivers/ide/ide-timing.h | 18 ++---------------- drivers/ide/ide.c | 2 ++ drivers/ide/pci/amd74xx.c | 20 ++++++++++++-------- drivers/ide/pci/via82cxxx.c | 22 +++++++++++++--------- drivers/ide/setup-pci.c | 2 ++ include/linux/ide.h | 7 +++++++ 7 files changed, 45 insertions(+), 39 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index df29868209f..92a6c7bcf52 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -291,11 +291,11 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) struct hd_driveid* id = drive->id; int overridden = 0; - if (mode_wanted != 255) { - pio_mode = mode_wanted; - } else if (!drive->id) { - pio_mode = 0; - } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { + if (mode_wanted != 255) + return min_t(u8, mode_wanted, max_mode); + + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && + (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); } else { pio_mode = id->tPIO; @@ -324,7 +324,8 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) /* * Conservative "downgrade" for all pre-ATA2 drives */ - if (pio_mode && pio_mode < 4) { + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 && + pio_mode && pio_mode < 4) { pio_mode--; printk(KERN_INFO "%s: applying conservative " "PIO \"downgrade\"\n", drive->name); diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h index 9b5afebafbf..daffbb9797e 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timing.h @@ -106,21 +106,6 @@ static struct ide_timing ide_timing[] = { #define XFER_EPIO 0x01 #define XFER_PIO 0x00 -static short ide_find_best_pio_mode(ide_drive_t *drive) -{ - struct hd_driveid *id = drive->id; - short best = 0; - - /* EIDE PIO modes */ - if ((id->field_valid & 2) && (id->capability & 8)) { - if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : - (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : - (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best; - } - - return XFER_PIO_0 + min_t(u8, id->tPIO, 2); -} - static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) { q->setup = EZ(t->setup * 1000, T); @@ -210,7 +195,8 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing */ if ((speed & XFER_MODE) != XFER_PIO) { - ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT); + u8 pio = ide_get_best_pio_mode(drive, 255, 5); + ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT); ide_timing_merge(&p, t, t, IDE_TIMING_ALL); } diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 077fb674a96..b442b341d52 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -455,6 +455,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) hwif->straight8 = tmp_hwif->straight8; hwif->bus_state = tmp_hwif->bus_state; + hwif->host_flags = tmp_hwif->host_flags; + hwif->atapi_dma = tmp_hwif->atapi_dma; hwif->ultra_mask = tmp_hwif->ultra_mask; hwif->mwdma_mask = tmp_hwif->mwdma_mask; diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 9c3ea90aeb8..5ed1d485fc7 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -1,5 +1,5 @@ /* - * Version 2.20 + * Version 2.21 * * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 * IDE driver for Linux. @@ -272,10 +272,8 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed) static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) { - if (pio == 255) { - amd_set_drive(drive, ide_find_best_pio_mode(drive)); - return; - } + if (pio == 255) + pio = ide_get_best_pio_mode(drive, 255, 5); amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); } @@ -284,12 +282,14 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive) { u8 speed = ide_max_dma_mode(drive); - if (speed == 0) - speed = ide_find_best_pio_mode(drive); + if (speed == 0) { + amd74xx_tune_drive(drive, 255); + return -1; + } amd_set_drive(drive, speed); - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + if (drive->autodma) return 0; return -1; @@ -451,6 +451,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .autodma = AUTODMA, \ .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ } #define DECLARE_NV_DEV(name_str) \ @@ -461,6 +463,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .autodma = AUTODMA, \ .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ } static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index bfc9b67f8c9..b107ee3588f 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -1,6 +1,6 @@ /* * - * Version 3.45 + * Version 3.46 * * VIA IDE driver for Linux. Supported southbridges: * @@ -203,10 +203,8 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) { - if (pio == 255) { - via_set_drive(drive, ide_find_best_pio_mode(drive)); - return; - } + if (pio == 255) + pio = ide_get_best_pio_mode(drive, 255, 5); via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); } @@ -223,12 +221,14 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) { u8 speed = ide_max_dma_mode(drive); - if (speed == 0) - speed = ide_find_best_pio_mode(drive); + if (speed == 0) { + via82cxxx_tune_drive(drive, 255); + return -1; + } via_set_drive(drive, speed); - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + if (drive->autodma) return 0; return -1; @@ -500,7 +500,9 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .init_hwif = init_hwif_via82cxxx, .autodma = NOAUTODMA, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD + .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST + | IDE_HFLAG_PIO_NO_DOWNGRADE, },{ /* 1 */ .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, @@ -508,6 +510,8 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST + | IDE_HFLAG_PIO_NO_DOWNGRADE, } }; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index bfe1f4e5959..e9f3267456e 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -613,6 +613,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a else ide_hwif_setup_dma(dev, d, hwif); bypass_legacy_dma: + hwif->host_flags = d->host_flags; + if (d->init_hwif) /* Call chipset-specific routine * for each enabled hwif diff --git a/include/linux/ide.h b/include/linux/ide.h index 14a87f619d1..9f72f6e0c95 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -681,6 +681,8 @@ typedef struct hwif_s { u8 straight8; /* Alan's straight 8 check */ u8 bus_state; /* power state of the IDE bus */ + u8 host_flags; + u8 atapi_dma; /* host supports atapi_dma */ u8 ultra_mask; u8 mwdma_mask; @@ -1245,7 +1247,12 @@ typedef struct ide_pci_enablebit_s { enum { /* Uses ISA control ports not PCI ones. */ IDE_HFLAG_ISA_PORTS = (1 << 0), + /* single port device */ IDE_HFLAG_SINGLE = (1 << 1), + /* don't use legacy PIO blacklist */ + IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), + /* don't use conservative PIO "downgrade" */ + IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), }; typedef struct ide_pci_device_s { From 4099d14322149c7a467e4997b87be4ba8eb78697 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:59 +0200 Subject: [PATCH 19/23] ide: add PIO masks * Add ATA_PIO[0-6] defines to . * Add ->pio_mask field to ide_pci_device_t and ide_hwif_t. * Add PIO masks to host drivers. change ACK-ed by Jeff Garzik . Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/cris/ide-cris.c | 1 + drivers/ide/ide.c | 2 ++ drivers/ide/legacy/ali14xx.c | 2 ++ drivers/ide/legacy/dtc2278.c | 1 + drivers/ide/legacy/ht6560b.c | 2 ++ drivers/ide/legacy/qd65xx.c | 1 + drivers/ide/legacy/umc8672.c | 2 ++ drivers/ide/mips/au1xxx-ide.c | 2 ++ drivers/ide/pci/aec62xx.c | 5 +++++ drivers/ide/pci/alim15x3.c | 1 + drivers/ide/pci/amd74xx.c | 2 ++ drivers/ide/pci/atiixp.c | 2 ++ drivers/ide/pci/cmd640.c | 2 ++ drivers/ide/pci/cmd64x.c | 4 ++++ drivers/ide/pci/cs5520.c | 1 + drivers/ide/pci/cs5530.c | 1 + drivers/ide/pci/cs5535.c | 1 + drivers/ide/pci/cy82c693.c | 1 + drivers/ide/pci/hpt34x.c | 3 ++- drivers/ide/pci/hpt366.c | 18 ++++++++++++------ drivers/ide/pci/it8213.c | 1 + drivers/ide/pci/it821x.c | 3 ++- drivers/ide/pci/jmicron.c | 1 + drivers/ide/pci/opti621.c | 2 ++ drivers/ide/pci/pdc202xx_new.c | 7 +++++++ drivers/ide/pci/pdc202xx_old.c | 5 +++++ drivers/ide/pci/piix.c | 2 ++ drivers/ide/pci/sc1200.c | 1 + drivers/ide/pci/scc_pata.c | 1 + drivers/ide/pci/serverworks.c | 5 +++++ drivers/ide/pci/sgiioc4.c | 1 + drivers/ide/pci/siimage.c | 1 + drivers/ide/pci/sis5513.c | 1 + drivers/ide/pci/sl82c105.c | 1 + drivers/ide/pci/slc90e66.c | 1 + drivers/ide/pci/tc86c001.c | 1 + drivers/ide/pci/triflex.c | 1 + drivers/ide/pci/via82cxxx.c | 2 ++ drivers/ide/ppc/mpc8xx.c | 2 ++ drivers/ide/ppc/pmac.c | 1 + drivers/ide/setup-pci.c | 1 + include/linux/ata.h | 9 +++++++++ include/linux/ide.h | 3 +++ 43 files changed, 99 insertions(+), 8 deletions(-) diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index e8cd86e8643..9361154ba5c 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -814,6 +814,7 @@ init_e100_ide (void) hwif->dma_host_on = &cris_dma_on; hwif->dma_off_quietly = &cris_dma_off; hwif->cbl = ATA_CBL_PATA40; + hwif->pio_mask = ATA_PIO4, hwif->ultra_mask = cris_ultra_mask; hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ hwif->autodma = 1; diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b442b341d52..f3ea5ea41fd 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -457,6 +457,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) hwif->host_flags = tmp_hwif->host_flags; + hwif->pio_mask = tmp_hwif->pio_mask; + hwif->atapi_dma = tmp_hwif->atapi_dma; hwif->ultra_mask = tmp_hwif->ultra_mask; hwif->mwdma_mask = tmp_hwif->mwdma_mask; diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index d5c7a57b71c..9b9c4761cb7 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -211,10 +211,12 @@ static int __init ali14xx_probe(void) mate = &ide_hwifs[1]; hwif->chipset = ide_ali14xx; + hwif->pio_mask = ATA_PIO4; hwif->tuneproc = &ali14xx_tune_drive; hwif->mate = mate; mate->chipset = ide_ali14xx; + mate->pio_mask = ATA_PIO4; mate->tuneproc = &ali14xx_tune_drive; mate->mate = hwif; mate->channel = 1; diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 8c4c27e5dc1..6c01d951d07 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -123,6 +123,7 @@ static int __init dtc2278_probe(void) hwif->serialized = 1; hwif->chipset = ide_dtc2278; + hwif->pio_mask = ATA_PIO4; hwif->tuneproc = &tune_dtc2278; hwif->drives[0].no_unmask = 1; hwif->drives[1].no_unmask = 1; diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 82ed37df956..bfaa2025173 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -333,12 +333,14 @@ int __init ht6560b_init(void) hwif->chipset = ide_ht6560b; hwif->selectproc = &ht6560b_selectproc; + hwif->pio_mask = ATA_PIO5; hwif->tuneproc = &tune_ht6560b; hwif->serialized = 1; /* is this needed? */ hwif->mate = mate; mate->chipset = ide_ht6560b; mate->selectproc = &ht6560b_selectproc; + mate->pio_mask = ATA_PIO5; mate->tuneproc = &tune_ht6560b; mate->serialized = 1; /* is this needed? */ mate->mate = hwif; diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 39145102b34..8b87a424094 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -346,6 +346,7 @@ static void __init qd_setup(ide_hwif_t *hwif, int base, int config, hwif->drives[1].drive_data = data1; hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1; + hwif->pio_mask = ATA_PIO4; hwif->tuneproc = tuneproc; probe_hwif_init(hwif); } diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index caeebd41081..d2862e638bc 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c @@ -149,10 +149,12 @@ static int __init umc8672_probe(void) mate = &ide_hwifs[1]; hwif->chipset = ide_umc8672; + hwif->pio_mask = ATA_PIO4; hwif->tuneproc = &tune_umc; hwif->mate = mate; mate->chipset = ide_umc8672; + mate->pio_mask = ATA_PIO4; mate->tuneproc = &tune_umc; mate->mate = hwif; mate->channel = 1; diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index b0d13c34d31..2ba6a054b86 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -692,6 +692,8 @@ static int au_ide_probe(struct device *dev) hwif->swdma_mask = 0x0; #endif + hwif->pio_mask = ATA_PIO4; + hwif->noprobe = 0; hwif->drives[0].unmask = 1; hwif->drives[1].unmask = 1; diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 8396d711f23..74432830abf 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -268,6 +268,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x07, /* udma0-2 */ },{ /* 1 */ .name = "AEC6260", @@ -276,6 +277,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_hwif = init_hwif_aec62xx, .autodma = NOAUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x1f, /* udma0-4 */ },{ /* 2 */ .name = "AEC6260R", @@ -285,6 +287,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = NEVER_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "AEC6280", @@ -293,6 +296,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .init_hwif = init_hwif_aec62xx, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ },{ /* 4 */ .name = "AEC6280R", @@ -302,6 +306,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ } }; diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index a0c43a91b0f..5511c86733d 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -818,6 +818,7 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { .init_dma = init_dma_ali15x3, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, }; /** diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 5ed1d485fc7..06c15a6a3e7 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -453,6 +453,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .bootable = ON_BOARD, \ .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ | IDE_HFLAG_PIO_NO_DOWNGRADE, \ + .pio_mask = ATA_PIO5, \ } #define DECLARE_NV_DEV(name_str) \ @@ -465,6 +466,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .bootable = ON_BOARD, \ .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ | IDE_HFLAG_PIO_NO_DOWNGRADE, \ + .pio_mask = ATA_PIO5, \ } static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index a4740e4776f..1725aa402d9 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -294,6 +294,7 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, },{ /* 1 */ .name = "SB600_PATA", .init_hwif = init_hwif_atiixp, @@ -301,6 +302,7 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = { .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, }, }; diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 335482981a9..9689494efa2 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -766,6 +766,7 @@ int __init ide_probe_for_cmd640x (void) cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); cmd_hwif0->chipset = ide_cmd640; #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED + cmd_hwif0->pio_mask = ATA_PIO5; cmd_hwif0->tuneproc = &cmd640_tune_drive; #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ @@ -821,6 +822,7 @@ int __init ide_probe_for_cmd640x (void) cmd_hwif1->mate = cmd_hwif0; cmd_hwif1->channel = 1; #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED + cmd_hwif1->pio_mask = ATA_PIO5; cmd_hwif1->tuneproc = &cmd640_tune_drive; #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ } diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 9cf969b61bf..19633c5aba1 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -622,6 +622,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, .udma_mask = 0x00, /* no udma */ },{ /* 1 */ .name = "CMD646", @@ -631,6 +632,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, .udma_mask = 0x07, /* udma0-2 */ },{ /* 2 */ .name = "CMD648", @@ -640,6 +642,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "CMD649", @@ -649,6 +652,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, .udma_mask = 0x3f, /* udma0-5 */ } }; diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index ee10e48d7ce..bccedf9b8b2 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -197,6 +197,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) .autodma = AUTODMA, \ .bootable = ON_BOARD, \ .host_flags = IDE_HFLAG_ISA_PORTS, \ + .pio_mask = ATA_PIO4, \ } static ide_pci_device_t cyrix_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index a75c14a9318..acaf71fd4c0 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -343,6 +343,7 @@ static ide_pci_device_t cs5530_chipset __devinitdata = { .init_hwif = init_hwif_cs5530, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, }; static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 0bff4005292..ce44e38390a 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -231,6 +231,7 @@ static ide_pci_device_t cs5535_chipset __devinitdata = { .autodma = AUTODMA, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, }; static int __devinit cs5535_init_one(struct pci_dev *dev, diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index cb7c18187e3..daa36fcbc8e 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -486,6 +486,7 @@ static ide_pci_device_t cy82c693_chipset __devinitdata = { .autodma = AUTODMA, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, }; static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 2e4591303f4..19778c5fe71 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -177,7 +177,8 @@ static ide_pci_device_t hpt34x_chipset __devinitdata = { .init_hwif = init_hwif_hpt34x, .autodma = NOAUTODMA, .bootable = NEVER_BOARD, - .extra = 16 + .extra = 16, + .pio_mask = ATA_PIO5, }; static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 0a3fe9471eb..2cd74c345a6 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1549,7 +1549,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, },{ /* 1 */ .name = "HPT372A", .init_setup = init_setup_hpt372a, @@ -1560,7 +1561,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, },{ /* 2 */ .name = "HPT302", .init_setup = init_setup_hpt302, @@ -1571,7 +1573,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, },{ /* 3 */ .name = "HPT371", .init_setup = init_setup_hpt371, @@ -1582,7 +1585,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, },{ /* 4 */ .name = "HPT374", .init_setup = init_setup_hpt374, @@ -1593,7 +1597,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = 0x3f, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, },{ /* 5 */ .name = "HPT372N", .init_setup = init_setup_hpt372n, @@ -1604,7 +1609,8 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = { .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, .bootable = OFF_BOARD, - .extra = 240 + .extra = 240, + .pio_mask = ATA_PIO4, } }; diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index d8425a2499b..95dbed7e602 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -276,6 +276,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) .enablebits = {{0x41,0x80,0x80}}, \ .bootable = ON_BOARD, \ .host_flags = IDE_HFLAG_SINGLE, \ + .pio_mask = ATA_PIO4, \ } static ide_pci_device_t it8213_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 790233db017..9286c99e2ff 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -720,7 +720,8 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha .init_hwif = init_hwif_it821x, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ - .fixup = it821x_fixups \ + .fixup = it821x_fixups, \ + .pio_mask = ATA_PIO4, \ } static ide_pci_device_t it821x_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 57d3d4186b3..d7ce9dd8de1 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -180,6 +180,7 @@ fallback: .autodma = AUTODMA, \ .bootable = ON_BOARD, \ .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ + .pio_mask = ATA_PIO5, \ } static ide_pci_device_t jmicron_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 1802ad0927e..3a2bb272351 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -353,12 +353,14 @@ static ide_pci_device_t opti621_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO3, },{ /* 1 */ .name = "OPTI621X", .init_hwif = init_hwif_opti621, .autodma = AUTODMA, .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO3, } }; diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index a8a01b4ab60..8a66a2871b3 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -568,6 +568,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ },{ /* 1 */ .name = "PDC20269", @@ -576,6 +577,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x7f, /* udma0-6*/ },{ /* 2 */ .name = "PDC20270", @@ -584,6 +586,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ },{ /* 3 */ .name = "PDC20271", @@ -592,6 +595,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x7f, /* udma0-6*/ },{ /* 4 */ .name = "PDC20275", @@ -600,6 +604,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x7f, /* udma0-6*/ },{ /* 5 */ .name = "PDC20276", @@ -608,6 +613,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x7f, /* udma0-6*/ },{ /* 6 */ .name = "PDC20277", @@ -616,6 +622,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { .init_hwif = init_hwif_pdc202new, .autodma = AUTODMA, .bootable = OFF_BOARD, + .pio_mask = ATA_PIO4, .udma_mask = 0x7f, /* udma0-6*/ } }; diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 3a6882d4aa6..fbcb0bb9c95 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -444,6 +444,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 16, + .pio_mask = ATA_PIO4, .udma_mask = 0x07, /* udma0-2 */ },{ /* 1 */ .name = "PDC20262", @@ -454,6 +455,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .pio_mask = ATA_PIO4, .udma_mask = 0x1f, /* udma0-4 */ },{ /* 2 */ .name = "PDC20263", @@ -464,6 +466,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .pio_mask = ATA_PIO4, .udma_mask = 0x1f, /* udma0-4 */ },{ /* 3 */ .name = "PDC20265", @@ -474,6 +477,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ },{ /* 4 */ .name = "PDC20267", @@ -484,6 +488,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .pio_mask = ATA_PIO4, .udma_mask = 0x3f, /* udma0-5 */ } }; diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 41a3612c610..4f69cd067e5 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -498,6 +498,7 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif) .autodma = AUTODMA, \ .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ .bootable = ON_BOARD, \ + .pio_mask = ATA_PIO4, \ .udma_mask = udma, \ } @@ -517,6 +518,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = { .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_ISA_PORTS, + .pio_mask = ATA_PIO4, }, /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */ diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 98e1a2bd950..9bdc9694d50 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -438,6 +438,7 @@ static ide_pci_device_t sc1200_chipset __devinitdata = { .init_hwif = init_hwif_sc1200, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, }; static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 2c76355b92e..f668d235e6b 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -775,6 +775,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) .autodma = AUTODMA, \ .bootable = ON_BOARD, \ .host_flags = IDE_HFLAG_SINGLE, \ + .pio_mask = ATA_PIO4, \ } static ide_pci_device_t scc_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 1fe29d9e68f..9fead2e7d4c 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -451,6 +451,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_hwif = init_hwif_svwks, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, },{ /* 1 */ .name = "SvrWks CSB5", .init_setup = init_setup_svwks, @@ -458,6 +459,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_hwif = init_hwif_svwks, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, },{ /* 2 */ .name = "SvrWks CSB6", .init_setup = init_setup_csb6, @@ -465,6 +467,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .init_hwif = init_hwif_svwks, .autodma = AUTODMA, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, },{ /* 3 */ .name = "SvrWks CSB6", .init_setup = init_setup_csb6, @@ -473,6 +476,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, },{ /* 4 */ .name = "SvrWks HT1000", .init_setup = init_setup_svwks, @@ -481,6 +485,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = ON_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, } }; diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index ed983b56b4e..57145767c3d 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -586,6 +586,7 @@ ide_init_sgiioc4(ide_hwif_t * hwif) hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ hwif->mwdma_mask = 0x2; /* Multimode-2 DMA */ hwif->swdma_mask = 0x2; + hwif->pio_mask = 0x00; hwif->tuneproc = NULL; /* Sets timing for PIO mode */ hwif->speedproc = NULL; /* Sets timing for DMA &/or PIO modes */ hwif->selectproc = NULL;/* Use the default routine to select drive */ diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 63a8a93d63d..50f6d172ef7 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -959,6 +959,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .fixup = siimage_fixup, \ .autodma = AUTODMA, \ .bootable = ON_BOARD, \ + .pio_mask = ATA_PIO4, \ } static ide_pci_device_t siimage_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 3c4693695ca..63fbb79e817 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -881,6 +881,7 @@ static ide_pci_device_t sis5513_chipset __devinitdata = { .autodma = NOAUTODMA, .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, }; static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 4e8f32e643a..0947cab0059 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -456,6 +456,7 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = { .autodma = NOAUTODMA, .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO5, }; static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 562747fbee3..8e655f2db5c 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -217,6 +217,7 @@ static ide_pci_device_t slc90e66_chipset __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, }; static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 2479a19f009..ec79bacc30c 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c @@ -251,6 +251,7 @@ static ide_pci_device_t tc86c001_chipset __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, }; static int __devinit tc86c001_init_one(struct pci_dev *dev, diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index f8fef905bac..024bbfae042 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -132,6 +132,7 @@ static ide_pci_device_t triflex_device __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, .bootable = ON_BOARD, + .pio_mask = ATA_PIO4, }; static int __devinit triflex_init_one(struct pci_dev *dev, diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index b107ee3588f..581316f9581 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -503,6 +503,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .bootable = ON_BOARD, .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | IDE_HFLAG_PIO_NO_DOWNGRADE, + .pio_mask = ATA_PIO5, },{ /* 1 */ .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, @@ -512,6 +513,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .bootable = ON_BOARD, .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | IDE_HFLAG_PIO_NO_DOWNGRADE, + .pio_mask = ATA_PIO5, } }; diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index f3789c0e6cc..8859fe2f5ac 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -316,6 +316,7 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, } /* register routine to tune PIO mode */ + ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; @@ -402,6 +403,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, } /* register routine to tune PIO mode */ + ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index debaa8823f5..33630ad3e79 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1248,6 +1248,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; hwif->drives[0].unmask = 1; hwif->drives[1].unmask = 1; + hwif->pio_mask = ATA_PIO4; hwif->tuneproc = pmac_ide_tuneproc; if (pmif->kind == controller_un_ata6 || pmif->kind == controller_k2_ata6 diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index e9f3267456e..f9e455cc809 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -614,6 +614,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a ide_hwif_setup_dma(dev, d, hwif); bypass_legacy_dma: hwif->host_flags = d->host_flags; + hwif->pio_mask = d->pio_mask; if (d->init_hwif) /* Call chipset-specific routine diff --git a/include/linux/ata.h b/include/linux/ata.h index b5a20162af3..23a22df039d 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -64,6 +64,15 @@ enum { ATA_ID_PROD_LEN = 40, ATA_PCI_CTL_OFS = 2, + + ATA_PIO0 = (1 << 0), + ATA_PIO1 = ATA_PIO0 | (1 << 1), + ATA_PIO2 = ATA_PIO1 | (1 << 2), + ATA_PIO3 = ATA_PIO2 | (1 << 3), + ATA_PIO4 = ATA_PIO3 | (1 << 4), + ATA_PIO5 = ATA_PIO4 | (1 << 5), + ATA_PIO6 = ATA_PIO5 | (1 << 6), + ATA_UDMA0 = (1 << 0), ATA_UDMA1 = ATA_UDMA0 | (1 << 1), ATA_UDMA2 = ATA_UDMA1 | (1 << 2), diff --git a/include/linux/ide.h b/include/linux/ide.h index 9f72f6e0c95..5f5daad8bc5 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -683,6 +683,8 @@ typedef struct hwif_s { u8 host_flags; + u8 pio_mask; + u8 atapi_dma; /* host supports atapi_dma */ u8 ultra_mask; u8 mwdma_mask; @@ -1270,6 +1272,7 @@ typedef struct ide_pci_device_s { unsigned int extra; struct ide_pci_device_s *next; u8 host_flags; + u8 pio_mask; u8 udma_mask; } ide_pci_device_t; From d281e9ad87f79fd01ce1fc2d2f258e2ee765bc5a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:59 +0200 Subject: [PATCH 20/23] ide-cris: handle PIO auto-tuning in tune_cris_ide() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/cris/ide-cris.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 9361154ba5c..fbfea46a34f 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -684,6 +684,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio) { int setup, strobe, hold; + pio = ide_get_best_pio_mode(drive, pio, 4); + switch(pio) { case 0: From 74565073cbf6b3c1746ee623e97b2ba0fcd3fbb6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:59 +0200 Subject: [PATCH 21/23] ide: remove stale changelog/comments/TODO from ide.c Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide.c | 78 ----------------------------------------------- 1 file changed, 78 deletions(-) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index f3ea5ea41fd..c438cc31423 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -16,10 +16,6 @@ * (usually 14 & 15). * There can be up to two drives per interface, as per the ATA-2 spec. * - * Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64 - * Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64 - * Tertiary: ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64 - * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64 * ... * * From hd.c: @@ -47,80 +43,6 @@ * This was a rewrite of just about everything from hd.c, though some original * code is still sprinkled about. Think of it as a major evolution, with * inspiration from lots of linux users, esp. hamish@zot.apana.org.au - * - * Version 1.0 ALPHA initial code, primary i/f working okay - * Version 1.3 BETA dual i/f on shared irq tested & working! - * Version 1.4 BETA added auto probing for irq(s) - * Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms, - * ... - * Version 5.50 allow values as small as 20 for idebus= - * Version 5.51 force non io_32bit in drive_cmd_intr() - * change delay_10ms() to delay_50ms() to fix problems - * Version 5.52 fix incorrect invalidation of removable devices - * add "hdx=slow" command line option - * Version 5.60 start to modularize the driver; the disk and ATAPI - * drivers can be compiled as loadable modules. - * move IDE probe code to ide-probe.c - * move IDE disk code to ide-disk.c - * add support for generic IDE device subdrivers - * add m68k code from Geert Uytterhoeven - * probe all interfaces by default - * add ioctl to (re)probe an interface - * Version 6.00 use per device request queues - * attempt to optimize shared hwgroup performance - * add ioctl to manually adjust bandwidth algorithms - * add kerneld support for the probe module - * fix bug in ide_error() - * fix bug in the first ide_get_lock() call for Atari - * don't flush leftover data for ATAPI devices - * Version 6.01 clear hwgroup->active while the hwgroup sleeps - * support HDIO_GETGEO for floppies - * Version 6.02 fix ide_ack_intr() call - * check partition table on floppies - * Version 6.03 handle bad status bit sequencing in ide_wait_stat() - * Version 6.10 deleted old entries from this list of updates - * replaced triton.c with ide-dma.c generic PCI DMA - * added support for BIOS-enabled UltraDMA - * rename all "promise" things to "pdc4030" - * fix EZ-DRIVE handling on small disks - * Version 6.11 fix probe error in ide_scan_devices() - * fix ancient "jiffies" polling bugs - * mask all hwgroup interrupts on each irq entry - * Version 6.12 integrate ioctl and proc interfaces - * fix parsing of "idex=" command line parameter - * Version 6.13 add support for ide4/ide5 courtesy rjones@orchestream.com - * Version 6.14 fixed IRQ sharing among PCI devices - * Version 6.15 added SMP awareness to IDE drivers - * Version 6.16 fixed various bugs; even more SMP friendly - * Version 6.17 fix for newest EZ-Drive problem - * Version 6.18 default unpartitioned-disk translation now "BIOS LBA" - * Version 6.19 Re-design for a UNIFORM driver for all platforms, - * model based on suggestions from Russell King and - * Geert Uytterhoeven - * Promise DC4030VL now supported. - * add support for ide6/ide7 - * delay_50ms() changed to ide_delay_50ms() and exported. - * Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection. - * Added hdx=flash to allow for second flash disk - * detection w/o the hang loop. - * Added support for ide8/ide9 - * Added idex=ata66 for the quirky chipsets that are - * ATA-66 compliant, but have yet to determine a method - * of verification of the 80c cable presence. - * Specifically Promise's PDC20262 chipset. - * Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old - * hat that clarified original low level driver design. - * Version 6.30 Added SMP support; fixed multmode issues. -ml - * Version 6.31 Debug Share INTR's and request queue streaming - * Native ATA-100 support - * Prep for Cascades Project - * Version 7.00alpha First named revision of ide rearrange - * - * Some additional driver compile-time options are in ./include/linux/ide.h - * - * To do, in likely order of completion: - * - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f - * */ #define REVISION "Revision: 7.00alpha2" From 4bf9fdf7f21f118e2c5052ec8e46faf00eb5a4ea Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:59 +0200 Subject: [PATCH 22/23] ide: remove stale changelog from setup-pci.c Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/setup-pci.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index f9e455cc809..30e596c0f12 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -5,12 +5,6 @@ * * Copyright (c) 1995-1998 Mark Lord * May be copied or modified under the terms of the GNU General Public License - * - * Recent Changes - * Split the set up function into multiple functions - * Use pci_set_master - * Fix misreporting of I/O v MMIO problems - * Initial fixups for simplex devices */ /* From 89636af25d75d8672aea05d258be357d0dc4bd70 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:59 +0200 Subject: [PATCH 23/23] ide: add support for SCSI ioctls to ide-floppy Now that ide-floppy supports SG_IO we can add support for SCSI ioctls (except deprecated SCSI_IOCTL_SEND_COMMAND and legacy CDROM_SEND_PACKET ones - we can add them later iff really needed). While at it remove handling of CDROMEJECT and CDROMCLOSETRAY ioctls from generic_ide_ioctl(): - This prevents ide-{disk,tape,scsi} device drivers from obtaining REQ_TYPE_BLOCK_PC type requests which are currently unsupported by these drivers and which are potentially harmful (as reported by Andrew). - There is no functionality loss since aforementioned ioctls will now be handled by idefloppy_ioctl()->scsi_cmd_ioctl() (for devices using ide-floppy driver) and by idecd_ioctl->cdrom_ioctl()->scsi_cmd_ioctl() (for devices using ide-cd driver). Cc: Jens Axboe Cc: FUJITA Tomonori Cc: James Bottomley Cc: Jeff Garzik Cc: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 18 +++++++++++++++++- drivers/ide/ide.c | 4 ---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index a21f585b1ca..ae8e1a64b8a 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -99,6 +99,8 @@ #include #include +#include + #include #include #include @@ -2099,7 +2101,21 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: return idefloppy_get_format_progress(drive, argp); } - return generic_ide_ioctl(drive, file, bdev, cmd, arg); + + /* + * skip SCSI_IOCTL_SEND_COMMAND (deprecated) + * and CDROM_SEND_PACKET (legacy) ioctls + */ + if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) + err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, + bdev->bd_disk, cmd, argp); + else + err = -ENOTTY; + + if (err == -ENOTTY) + err = generic_ide_ioctl(drive, file, bdev, cmd, arg); + + return err; } static int idefloppy_media_changed(struct gendisk *disk) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index c438cc31423..5e88a060df0 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -1097,10 +1097,6 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device return 0; } - case CDROMEJECT: - case CDROMCLOSETRAY: - return scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p); - case HDIO_GET_BUSSTATE: if (!capable(CAP_SYS_ADMIN)) return -EACCES;