From 3dfd6433ff4d037262a4b8bede022e1d4bac06e3 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: ide/pci/sis5513.c: add missing "else" This patch adds a missing "else" that was missing in commit c77a89cd98d99819f23a4a08e5e17ee1f13f6e4d. Spotted by the Coverity checker. Signed-off-by: Adrian Bunk Cc: Sergei Shtylyov , Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/sis5513.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index c1d280b0639..1680926acf3 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -264,7 +264,7 @@ static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) if (mode >= XFER_MW_DMA_0) { t1 &= ~0x04; /* disable UDMA */ idx = mode - XFER_MW_DMA_0 + 5; - } + } else idx = mode - XFER_PIO_0; t1 |= ini_time_value[clk][idx] << 12; t1 |= act_time_value[clk][idx] << 16; -- cgit v1.2.3 From e9a0765eac3c8df7094fd49f94ae83d80cbe4128 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: cmd64x: always set hwif->chipset for CMD646 hwif->chipset should be set to ide_cmd646 also when DMA base is invalid. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cmd64x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index adee2ef6fd7..69cdbfb86bb 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -506,6 +506,9 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) hwif->set_pio_mode = &cmd64x_set_pio_mode; hwif->set_dma_mode = &cmd64x_set_dma_mode; + if (dev->device == PCI_DEVICE_ID_CMD_646) + hwif->chipset = ide_cmd646; + if (!hwif->dma_base) return; @@ -535,7 +538,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; break; case PCI_DEVICE_ID_CMD_646: - hwif->chipset = ide_cmd646; if (dev->revision == 0x01) { hwif->ide_dma_end = &cmd646_1_ide_dma_end; break; -- cgit v1.2.3 From cf6e854efb3682322351a21e64058ffc13250914 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: ide: fix disabled ports reporting for PCI controllers Report all disabled ports in ide_pci_setup_ports() (prevents the bogus warning when ide_hwif_configure()->ide_match_hwif() fails to find free ide_hwifs[] slots). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/setup-pci.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index fff567bcedb..6903100e3c8 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -526,7 +526,6 @@ out: void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) { 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; @@ -535,13 +534,15 @@ 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 < 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)) + (tmp & e->mask) != e->val)) { + printk(KERN_INFO "%s: IDE port disabled\n", d->name); continue; /* port not enabled */ + } if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) continue; @@ -587,10 +588,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a d->init_hwif(hwif); mate = hwif; - at_least_one_hwif_enabled = 1; } - if (!at_least_one_hwif_enabled) - printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name); } EXPORT_SYMBOL_GPL(ide_pci_setup_ports); -- cgit v1.2.3 From 746f312a5606bbfc616a16f830705ec8cb54ab9a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: rz1000: set serialized flag only if mate interface exists Setting hwif->serialized makes sense only if the mate interface exists. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/rz1000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index dd2583ef1ad..0d76af45db6 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -41,7 +41,8 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) printk(KERN_INFO "%s: disabled chipset read-ahead " "(buggy RZ1000/RZ1001)\n", hwif->name); } else { - hwif->serialized = 1; + if (hwif->mate) + hwif->mate->serialized = hwif->serialized = 1; hwif->drives[0].no_unmask = 1; hwif->drives[1].no_unmask = 1; printk(KERN_INFO "%s: serialized, disabled unmasking " -- cgit v1.2.3 From b515da89c6f4d3c3c2a19358ce0304046c043ea1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: serverworks: remove dead code from svwks_set_dma_mode() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/serverworks.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index a3d880e21d0..2814b47a092 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -158,13 +158,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; - /* 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 */ - - if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 && - drive->media == ide_disk && speed >= XFER_UDMA_0) - BUG(); - pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); pci_read_config_byte(dev, 0x54, &ultra_enable); -- cgit v1.2.3 From 9601a607cceb3632cde6c66fe28a3673dcd20be5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: ide: add hwif_register_devices() helper Add hwif_register_devices() helper to fix code duplication between probe_hwif_init_with_fixup() and ideprobe_init(). Also remove stale comment while at it. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index e294c7415c2..54917485338 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -859,6 +859,7 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) } static int hwif_init(ide_hwif_t *hwif); +static void hwif_register_devices(ide_hwif_t *hwif); int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) { @@ -870,24 +871,9 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif) return -1; } - if (hwif->present) { - u16 unit = 0; - int ret; + if (hwif->present) + hwif_register_devices(hwif); - for (unit = 0; unit < MAX_DRIVES; ++unit) { - ide_drive_t *drive = &hwif->drives[unit]; - /* For now don't attach absent drives, we may - want them on default or a new "empty" class - for hotplug reprobing ? */ - if (drive->present) { - ret = device_register(&drive->gendev); - if (ret < 0) - printk(KERN_WARNING "IDE: %s: " - "device_register error: %d\n", - __FUNCTION__, ret); - } - } - } return 0; } @@ -1379,6 +1365,24 @@ out: return 0; } +static void hwif_register_devices(ide_hwif_t *hwif) +{ + unsigned int i; + + for (i = 0; i < MAX_DRIVES; i++) { + ide_drive_t *drive = &hwif->drives[i]; + + if (drive->present) { + int ret = device_register(&drive->gendev); + + if (ret < 0) + printk(KERN_WARNING "IDE: %s: " + "device_register error: %d\n", + __FUNCTION__, ret); + } + } +} + int ideprobe_init (void) { unsigned int index; @@ -1397,20 +1401,11 @@ int ideprobe_init (void) for (index = 0; index < MAX_HWIFS; ++index) { if (probe[index]) { ide_hwif_t *hwif = &ide_hwifs[index]; - int unit; if (!hwif->present) continue; if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) hwif->chipset = ide_generic; - for (unit = 0; unit < MAX_DRIVES; ++unit) - if (hwif->drives[unit].present) { - int ret = device_register( - &hwif->drives[unit].gendev); - if (ret < 0) - printk(KERN_WARNING "IDE: %s: " - "device_register error: %d\n", - __FUNCTION__, ret); - } + hwif_register_devices(hwif); } } for (index = 0; index < MAX_HWIFS; ++index) -- cgit v1.2.3 From 44a59ad59f4285ce91e61f05e65a3e8fd0943c85 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:29 +0200 Subject: ide: remove unused ->next field from ide_pci_device_t Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/ide.h b/include/linux/ide.h index 19db0a4ae44..fdd09747305 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1278,7 +1278,6 @@ typedef struct ide_pci_device_s { void (*fixup)(ide_hwif_t *); ide_pci_enablebit_t enablebits[2]; unsigned int extra; - struct ide_pci_device_s *next; u32 host_flags; u8 pio_mask; u8 swdma_mask; -- cgit v1.2.3 From 528a572daea90aa41db92683e5a8756acef514c4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: ide: add ->chipset field to ide_pci_device_t Add ->chipset field to ide_pci_device_t and use it in ide_hwif_configure() to set hwif->chipset. Convert cmd64x, cy82c693, rz1000 and trm290 host drivers to use this new ability. While at it define hwif_chipset_t as u8 to save some space in hw_regs_t, ide_hwif_t and ide_pci_device_t instances. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cmd64x.c | 4 +--- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/rz1000.c | 2 +- drivers/ide/pci/trm290.c | 2 +- drivers/ide/setup-pci.c | 2 +- include/linux/ide.h | 7 +++++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 69cdbfb86bb..5c1b897017b 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -506,9 +506,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) hwif->set_pio_mode = &cmd64x_set_pio_mode; hwif->set_dma_mode = &cmd64x_set_dma_mode; - if (dev->device == PCI_DEVICE_ID_CMD_646) - hwif->chipset = ide_cmd646; - if (!hwif->dma_base) return; @@ -575,6 +572,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { .init_chipset = init_chipset_cmd64x, .init_hwif = init_hwif_cmd64x, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, + .chipset = ide_cmd646, .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO5, .mwdma_mask = ATA_MWDMA2, diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index efc20bd97fd..e70ffa90aef 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -428,7 +428,6 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c */ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) { - hwif->chipset = ide_cy82c693; hwif->set_pio_mode = &cy82c693_set_pio_mode; if (hwif->dma_base == 0) @@ -454,6 +453,7 @@ static ide_pci_device_t cy82c693_chipset __devinitdata = { .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, .init_hwif = init_hwif_cy82c693, + .chipset = ide_cy82c693, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO4, diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 0d76af45db6..5f1ad9ef1fe 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -35,7 +35,6 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) u16 reg; struct pci_dev *dev = hwif->pci_dev; - hwif->chipset = ide_rz1000; if (!pci_read_config_word (dev, 0x40, ®) && !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { printk(KERN_INFO "%s: disabled chipset read-ahead " @@ -53,6 +52,7 @@ 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, + .chipset = ide_rz1000, .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE, }; diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 140d486f623..be5d145a94f 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -250,7 +250,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) u8 reg = 0; struct pci_dev *dev = hwif->pci_dev; - hwif->chipset = ide_trm290; cfgbase = pci_resource_start(dev, 4); if ((dev->class & 5) && cfgbase) { hwif->config_data = cfgbase; @@ -323,6 +322,7 @@ 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, + .chipset = ide_trm290, .host_flags = IDE_HFLAG_NO_ATAPI_DMA | #if 0 /* play it safe for now */ IDE_HFLAG_TRUST_BIOS_FOR_DMA | diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 6903100e3c8..30c0741c5e5 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -397,7 +397,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; } - hwif->chipset = ide_pci; + hwif->chipset = d->chipset ? d->chipset : ide_pci; hwif->pci_dev = dev; hwif->cds = (struct ide_pci_device_s *) d; hwif->channel = port; diff --git a/include/linux/ide.h b/include/linux/ide.h index fdd09747305..b676e51d74f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -200,14 +200,16 @@ typedef int (ide_ack_intr_t)(struct hwif_s *); * hwif_chipset_t is used to keep track of the specific hardware * chipset used by each IDE interface, if known. */ -typedef enum { ide_unknown, ide_generic, ide_pci, +enum { ide_unknown, ide_generic, ide_pci, ide_cmd640, ide_dtc2278, ide_ali14xx, ide_qd65xx, ide_umc8672, ide_ht6560b, ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives, ide_pmac, ide_etrax100, ide_acorn, ide_au1xxx, ide_forced -} hwif_chipset_t; +}; + +typedef u8 hwif_chipset_t; /* * Structure to hold all information about the location of this port @@ -1277,6 +1279,7 @@ typedef struct ide_pci_device_s { void (*init_dma)(ide_hwif_t *, unsigned long); void (*fixup)(ide_hwif_t *); ide_pci_enablebit_t enablebits[2]; + hwif_chipset_t chipset; unsigned int extra; u32 host_flags; u8 pio_mask; -- cgit v1.2.3 From 8acf28c090f0e5e049f56b27bdd7cf1fb40c6b98 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: ide: add IDE_HFLAG_FORCE_LEGACY_IRQS host flag Add IDE_HFLAG_FORCE_LEGACY_IRQS host flag to tell ide_pci_setup_ports() to always set hwif->irq to legacy IRQ 14/15 and convert generic IDE PCI and via82cxxx host drivers to use it. While at it: * Add IDE_HFLAGS_UMC define (generic IDE PCI host driver). * Remove no longer needed init_hwif_generic() (generic IDE PCI host driver). * Set d->udma_mask instead of hwif->ultra_mask (via82cxxx host driver). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/generic.c | 27 ++++++--------------------- drivers/ide/pci/via82cxxx.c | 20 +++++++++++--------- drivers/ide/setup-pci.c | 3 ++- include/linux/ide.h | 2 ++ 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 51165832e7f..b377006d416 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c @@ -54,25 +54,13 @@ __setup("all-generic-ide", ide_generic_all_on); module_param_named(all_generic_ide, ide_generic_all, bool, 0444); MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); -static void __devinit init_hwif_generic (ide_hwif_t *hwif) -{ - switch(hwif->pci_dev->device) { - case PCI_DEVICE_ID_UMC_UM8673F: - case PCI_DEVICE_ID_UMC_UM8886A: - case PCI_DEVICE_ID_UMC_UM8886BF: - hwif->irq = hwif->channel ? 15 : 14; - break; - default: - break; - } -} +#define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS) -#define DECLARE_GENERIC_PCI_DEV(name_str, dma_setting) \ +#define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \ { \ .name = name_str, \ - .init_hwif = init_hwif_generic, \ .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ - dma_setting | \ + extra_flags | \ IDE_HFLAG_BOOTABLE, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ @@ -84,7 +72,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { { /* 1 */ .name = "NS87410", - .init_hwif = init_hwif_generic, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_BOOTABLE, @@ -95,16 +82,15 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0), /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0), - /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAG_NO_DMA), - /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAG_NO_DMA), - /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAG_NO_DMA), + /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC), + /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC), + /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC), /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0), /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA), /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA), { /* 10 */ .name = "VIA8237SATA", - .init_hwif = init_hwif_generic, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_OFF_BOARD, .swdma_mask = ATA_SWDMA2, @@ -118,7 +104,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { { /* 14 */ .name = "Revolution", - .init_hwif = init_hwif_generic, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_OFF_BOARD, .swdma_mask = ATA_SWDMA2, diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index c8022a92a0e..27e5b410123 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -428,12 +428,6 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->set_pio_mode = &via_set_pio_mode; hwif->set_dma_mode = &via_set_drive; -#ifdef CONFIG_PPC_CHRP - if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) { - hwif->irq = hwif->channel ? 15 : 14; - } -#endif - for (i = 0; i < 2; i++) { hwif->drives[i].io_32bit = 1; hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; @@ -442,8 +436,6 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) if (!hwif->dma_base) return; - hwif->ultra_mask = vdev->via_config->udma_mask; - if (hwif->cbl != ATA_CBL_PATA40_SHORT) hwif->cbl = via82cxxx_cable_detect(hwif); } @@ -479,8 +471,10 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { + ide_pci_device_t *d = &via82cxxx_chipsets[id->driver_data]; struct pci_dev *isa = NULL; struct via_isa_bridge *via_config; + /* * Find the ISA bridge and check we know what it is. */ @@ -490,7 +484,15 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); return -ENODEV; } - return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); + +#ifdef CONFIG_PPC_CHRP + if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) + d->host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; +#endif + + d->udma_mask = via_config->udma_mask; + + return ide_setup_pci_device(dev, d); } static const struct pci_device_id via_pci_tbl[] = { diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 30c0741c5e5..4fa813b96e7 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -563,7 +563,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) ide_hwif_setup_dma(dev, d, hwif); - if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0) + if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || + (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) hwif->irq = port ? 15 : 14; hwif->host_flags = d->host_flags; diff --git a/include/linux/ide.h b/include/linux/ide.h index b676e51d74f..ff9d293f9ae 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1263,6 +1263,8 @@ enum { IDE_HFLAG_SERIALIZE = (1 << 20), /* use legacy IRQs */ IDE_HFLAG_LEGACY_IRQS = (1 << 21), + /* force use of legacy IRQs */ + IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.2.3 From 272a370900e5d2ae84662338397bb7b2375ff5cf Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: ide: add IDE_HFLAG_RQSIZE_256 host flag Add IDE_HFLAG_RQSIZE_256 host flag to tell ide_pci_setup_ports() to set hwif->rqsize to 256 sectors. Convert pdc202xx_old host driver to use it. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/pdc202xx_old.c | 18 ++++++------------ drivers/ide/setup-pci.c | 3 +++ include/linux/ide.h | 2 ++ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 29306121dc4..d0efe17d831 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -302,13 +302,6 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) { - struct pci_dev *dev = hwif->pci_dev; - - /* PDC20265 has problems with large LBA48 requests */ - if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) || - (dev->device == PCI_DEVICE_ID_PROMISE_20265)) - hwif->rqsize = 256; - hwif->set_pio_mode = &pdc202xx_set_pio_mode; hwif->set_dma_mode = &pdc202xx_set_mode; @@ -382,7 +375,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, } } -#define DECLARE_PDC2026X_DEV(name_str, udma) \ +#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ { \ .name = name_str, \ .init_chipset = init_chipset_pdc202xx, \ @@ -390,6 +383,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, .init_dma = init_dma_pdc202xx, \ .extra = 48, \ .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \ + extra_flags | \ IDE_HFLAG_OFF_BOARD, \ .pio_mask = ATA_PIO4, \ .mwdma_mask = ATA_MWDMA2, \ @@ -410,10 +404,10 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .udma_mask = ATA_UDMA2, }, - /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4), - /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4), - /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5), - /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5), + /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0), + /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0), + /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), + /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256), }; /** diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 4fa813b96e7..a1d7efc9eaa 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -582,6 +582,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; + if (d->host_flags & IDE_HFLAG_RQSIZE_256) + hwif->rqsize = 256; + 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 ff9d293f9ae..c5b52dd16a8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1265,6 +1265,8 @@ enum { IDE_HFLAG_LEGACY_IRQS = (1 << 21), /* force use of legacy IRQs */ IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), + /* limit LBA48 requests to 256 sectors */ + IDE_HFLAG_RQSIZE_256 = (1 << 23), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.2.3 From caea7602f309cbd55ba609800fd3c3e5d19ab684 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: ide: add IDE_HFLAG_{IO_32BIT,UNMASK_IRQS} host flags Add IDE_HFLAG_{IO_32BIT,UNMASK_IRQS} host flag to tell ide_pci_setup_ports() to set drive->{io_32bit,unmask} for both drives on the interface. Convert amd74xx, sl82c105 and via82cxxx host drivers to use these new host flags. While at it: * Add IDE_HFLAGS_AMD define (amd74xx host driver). * Add IDE_HFLAGS_VIA define (via82cxxx host driver). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/amd74xx.c | 25 ++++++++++--------------- drivers/ide/pci/sl82c105.c | 12 ++++-------- drivers/ide/pci/via82cxxx.c | 31 ++++++++++++++----------------- drivers/ide/setup-pci.c | 10 ++++++++++ include/linux/ide.h | 4 ++++ 5 files changed, 42 insertions(+), 40 deletions(-) diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 7cafefbf6c1..f6aa1d7f3fc 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -242,19 +242,12 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) { - int i; - if (hwif->irq == 0) /* 0 is bogus but will do for now */ hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); hwif->set_pio_mode = &amd_set_pio_mode; hwif->set_dma_mode = &amd_set_drive; - for (i = 0; i < 2; i++) { - hwif->drives[i].io_32bit = 1; - hwif->drives[i].unmask = 1; - } - if (!hwif->dma_base) return; @@ -270,16 +263,21 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) } } +#define IDE_HFLAGS_AMD \ + (IDE_HFLAG_PIO_NO_BLACKLIST | \ + IDE_HFLAG_PIO_NO_DOWNGRADE | \ + IDE_HFLAG_POST_SET_MODE | \ + IDE_HFLAG_IO_32BIT | \ + IDE_HFLAG_UNMASK_IRQS | \ + IDE_HFLAG_BOOTABLE) + #define DECLARE_AMD_DEV(name_str) \ { \ .name = name_str, \ .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ - .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ - IDE_HFLAG_PIO_NO_DOWNGRADE | \ - IDE_HFLAG_POST_SET_MODE | \ - IDE_HFLAG_BOOTABLE, \ + .host_flags = IDE_HFLAGS_AMD, \ .pio_mask = ATA_PIO5, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ @@ -291,10 +289,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .init_chipset = init_chipset_amd74xx, \ .init_hwif = init_hwif_amd74xx, \ .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ - .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ - IDE_HFLAG_PIO_NO_DOWNGRADE | \ - IDE_HFLAG_POST_SET_MODE | \ - IDE_HFLAG_BOOTABLE, \ + .host_flags = IDE_HFLAGS_AMD, \ .pio_mask = ATA_PIO5, \ .swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 0dce459b126..7b5f7b6d3e0 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -361,13 +361,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) hwif->selectproc = &sl82c105_selectproc; hwif->resetproc = &sl82c105_resetproc; - /* - * We support 32-bit I/O on this interface, and - * it doesn't have problems with interrupts. - */ - hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1; - hwif->drives[0].unmask = hwif->drives[1].unmask = 1; - if (!hwif->dma_base) return; @@ -399,7 +392,10 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = { .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, - .host_flags = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE, + .host_flags = IDE_HFLAG_IO_32BIT | + IDE_HFLAG_UNMASK_IRQS | + IDE_HFLAG_NO_AUTODMA | + IDE_HFLAG_BOOTABLE, .pio_mask = ATA_PIO5, }; diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 27e5b410123..14979f4df36 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -422,17 +422,9 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) { - struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); - int i; - hwif->set_pio_mode = &via_set_pio_mode; hwif->set_dma_mode = &via_set_drive; - for (i = 0; i < 2; i++) { - hwif->drives[i].io_32bit = 1; - hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; - } - if (!hwif->dma_base) return; @@ -440,17 +432,20 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->cbl = via82cxxx_cable_detect(hwif); } +#define IDE_HFLAGS_VIA \ + (IDE_HFLAG_PIO_NO_BLACKLIST | \ + IDE_HFLAG_PIO_NO_DOWNGRADE | \ + IDE_HFLAG_POST_SET_MODE | \ + IDE_HFLAG_IO_32BIT | \ + IDE_HFLAG_BOOTABLE) + static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { { /* 0 */ .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | - IDE_HFLAG_PIO_NO_DOWNGRADE | - IDE_HFLAG_POST_SET_MODE | - IDE_HFLAG_NO_AUTODMA | - IDE_HFLAG_BOOTABLE, + .host_flags = IDE_HFLAGS_VIA | IDE_HFLAG_NO_AUTODMA, .pio_mask = ATA_PIO5, .swdma_mask = ATA_SWDMA2, .mwdma_mask = ATA_MWDMA2, @@ -459,10 +454,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, - .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | - IDE_HFLAG_PIO_NO_DOWNGRADE | - IDE_HFLAG_POST_SET_MODE | - IDE_HFLAG_BOOTABLE, + .host_flags = IDE_HFLAGS_VIA, .pio_mask = ATA_PIO5, .swdma_mask = ATA_SWDMA2, .mwdma_mask = ATA_MWDMA2, @@ -485,6 +477,11 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i return -ENODEV; } + if (via_config->flags & VIA_NO_UNMASK) + d->host_flags &= ~IDE_HFLAG_UNMASK_IRQS; + else + d->host_flags |= IDE_HFLAG_UNMASK_IRQS; + #ifdef CONFIG_PPC_CHRP if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) d->host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index a1d7efc9eaa..d62b225f569 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -573,6 +573,16 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) hwif->mate->serialized = hwif->serialized = 1; + if (d->host_flags & IDE_HFLAG_IO_32BIT) { + hwif->drives[0].io_32bit = 1; + hwif->drives[1].io_32bit = 1; + } + + if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) { + hwif->drives[0].unmask = 1; + hwif->drives[1].unmask = 1; + } + if (hwif->dma_base) { hwif->swdma_mask = d->swdma_mask; hwif->mwdma_mask = d->mwdma_mask; diff --git a/include/linux/ide.h b/include/linux/ide.h index c5b52dd16a8..258a15cc274 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1267,6 +1267,10 @@ enum { IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), /* limit LBA48 requests to 256 sectors */ IDE_HFLAG_RQSIZE_256 = (1 << 23), + /* use 32-bit I/O ops */ + IDE_HFLAG_IO_32BIT = (1 << 24), + /* unmask IRQs */ + IDE_HFLAG_UNMASK_IRQS = (1 << 25), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.2.3 From cad221aa82c6f434c1d78bee1d485b5b69c626f8 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: alim15x3: fix CD_ROM DMA and PIO FIFO settings setup * Setup CD_ROM DMA and PIO FIFO settings in init_chipset_ali15x3() instead of ata66_ali15x3(). The latter is called from init_hwif_common_ali15x3() only if DMA base exists (which insists m5529_revision > 0x20). This changes makes CD_ROM DMA / PIO FIFO bits being set only once and also when "idex=ata66" kernel parameter is used. * While at it move also chip_is_1543c_e setup from ata66_ali15x3() to init_chipset_ali15x3() and check if isa_dev exists before accessing it. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 60 ++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 8ee2b48d105..1ab769b31e6 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/alim15x3.c Version 0.27 Aug 27 2007 + * linux/drivers/ide/pci/alim15x3.c Version 0.28 Sep 15 2007 * * Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer @@ -492,6 +492,13 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c * clear bit 7 */ pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); + /* + * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 + */ + if (m5229_revision >= 0x20 && isa_dev) { + pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); + chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; + } goto out; } @@ -537,7 +544,30 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); } } + out: + /* + * CD_ROM DMA on (m5229, 0x53, bit0) + * Enable this bit even if we want to use PIO. + * PIO FIFO off (m5229, 0x53, bit1) + * The hardware will use 0x54h and 0x55h to control PIO FIFO. + * (Not on later devices it seems) + * + * 0x53 changes meaning on later revs - we must no touch + * bit 1 on them. Need to check if 0x20 is the right break. + */ + if (m5229_revision >= 0x20) { + pci_read_config_byte(dev, 0x53, &tmpbyte); + + if (m5229_revision <= 0x20) + tmpbyte = (tmpbyte & (~0x02)) | 0x01; + else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) + tmpbyte |= 0x03; + else + tmpbyte |= 0x01; + + pci_write_config_byte(dev, 0x53, tmpbyte); + } pci_dev_put(north); pci_dev_put(isa_dev); local_irq_restore(flags); @@ -616,36 +646,8 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) if ((tmpbyte & (1 << hwif->channel)) == 0) cbl = ATA_CBL_PATA80; } - } else { - /* - * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010 - */ - pci_read_config_byte(isa_dev, 0x5e, &tmpbyte); - chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0; } - /* - * CD_ROM DMA on (m5229, 0x53, bit0) - * Enable this bit even if we want to use PIO - * PIO FIFO off (m5229, 0x53, bit1) - * The hardware will use 0x54h and 0x55h to control PIO FIFO - * (Not on later devices it seems) - * - * 0x53 changes meaning on later revs - we must no touch - * bit 1 on them. Need to check if 0x20 is the right break - */ - - pci_read_config_byte(dev, 0x53, &tmpbyte); - - if(m5229_revision <= 0x20) - tmpbyte = (tmpbyte & (~0x02)) | 0x01; - else if (m5229_revision == 0xc7 || m5229_revision == 0xc8) - tmpbyte |= 0x03; - else - tmpbyte |= 0x01; - - pci_write_config_byte(dev, 0x53, tmpbyte); - local_irq_restore(flags); return cbl; -- cgit v1.2.3 From 283283070f2607ed759563613c044f96f1546834 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:30 +0200 Subject: alim15x3: use ->host_flags and ->udma_mask fields from ide_pci_device_t * Make a local copy of ali15x3_chipset in alim15x3_init_one() and set ->host_flags / ->udma_mask according to the controller capabilities. * Cleanup init_hwif_common_ali15x3(). * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 49 ++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 1ab769b31e6..fe816fd6766 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/alim15x3.c Version 0.28 Sep 15 2007 + * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007 * * Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer @@ -666,31 +666,9 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) hwif->set_dma_mode = &ali_set_dma_mode; hwif->udma_filter = &ali_udma_filter; - /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ - if (m5229_revision <= 0xC4) - hwif->host_flags |= IDE_HFLAG_NO_LBA48_DMA; - if (hwif->dma_base == 0) return; - /* - * check in ->init_dma guarantees m5229_revision >= 0x20 here - */ - - if (m5229_revision == 0x20) - hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; - - if (m5229_revision <= 0x20) - hwif->ultra_mask = 0x00; /* no udma */ - else if (m5229_revision < 0xC2) - hwif->ultra_mask = ATA_UDMA2; - else if (m5229_revision == 0xC2 || m5229_revision == 0xC3) - hwif->ultra_mask = ATA_UDMA4; - else if (m5229_revision == 0xC4) - hwif->ultra_mask = ATA_UDMA5; - else - hwif->ultra_mask = ATA_UDMA6; - hwif->dma_setup = &ali15x3_dma_setup; if (hwif->cbl != ATA_CBL_PATA40_SHORT) @@ -794,15 +772,34 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev { }, }; - ide_pci_device_t *d = &ali15x3_chipset; + ide_pci_device_t d = ali15x3_chipset; + u8 rev = dev->revision; if (pci_dev_present(ati_rs100)) printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); + /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ + if (rev <= 0xC4) + d.host_flags |= IDE_HFLAG_NO_LBA48_DMA; + + if (rev >= 0x20) { + if (rev == 0x20) + d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; + + if (rev < 0xC2) + d.udma_mask = ATA_UDMA2; + else if (rev == 0xC2 || rev == 0xC3) + d.udma_mask = ATA_UDMA4; + else if (rev == 0xC4) + d.udma_mask = ATA_UDMA5; + else + d.udma_mask = ATA_UDMA6; + } + #if defined(CONFIG_SPARC64) - d->init_hwif = init_hwif_common_ali15x3; + d.init_hwif = init_hwif_common_ali15x3; #endif /* CONFIG_SPARC64 */ - return ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, &d); } -- cgit v1.2.3 From b1e03865434ef559222b69ba36ebe4fd9437aa86 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: aec62xx: remove aec62xx_dma_lost_irq() * Remove aec62xx_dma_lost_irq() (generic ide_dma_lost_irq() will be used now). * Bump driver version. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index b3dc12a70d5..58fc670f913 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/aec62xx.c Version 0.26 Sep 1, 2007 + * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007 * * Copyright (C) 1999-2002 Andre Hedrick * Copyright (C) 2007 MontaVista Software, Inc. @@ -141,19 +141,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio) drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); } -static void aec62xx_dma_lost_irq (ide_drive_t *drive) -{ - switch (HWIF(drive)->pci_dev->device) { - case PCI_DEVICE_ID_ARTOP_ATP860: - case PCI_DEVICE_ID_ARTOP_ATP860R: - case PCI_DEVICE_ID_ARTOP_ATP865: - case PCI_DEVICE_ID_ARTOP_ATP865R: - printk(" AEC62XX time out "); - default: - break; - } -} - static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) { int bus_speed = system_bus_clock(); @@ -195,8 +182,6 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) if (hwif->dma_base == 0) return; - hwif->dma_lost_irq = &aec62xx_dma_lost_irq; - if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) return; -- cgit v1.2.3 From 438c470261036db25bfae15235ba99812e3dc763 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: siimage: separate PATA and SATA methods * Split off sil_sata_udma_filter() from sil_udma_filter() and rename sil_udma_filter() to sil_pata_udma_filter(). * Rename siimage_busproc() to sil_sata_busproc(). * Rename siimage_reset_poll() to sil_sata_reset_poll() and in init_hwif_siimage() set ->reset_poll method only for SATA controllers. * Rename siimage_pre_reset() to sil_sata_pre_reset(), in init_hwif_siimage() set ->pre_reset method only for SATA controllers and remove redundant is_sata() call. * Add CONFIG_BLK_DEV_IDE_SATA #ifdef/#endif to pdev_is_sata() so compiler will know to throw out unused SATA code for CONFIG_BLK_DEV_IDE_SATA=n case (830 bytes saved on x86-32). * Bump driver version. Some minor cleanups while at it: * Convert sil_{pata,sata}_udma_filter() to use ATA_UDMA* defines. * In siimage_mmio_ide_dma_test_irq() move 'base' variable under 'if (SATA_ERROR_REG)' block. * Simplify sil_sata_reset_poll() a bit. * Cache is_sata() result in init_hwif_siimage() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/siimage.c | 79 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 689786df1ed..463bfda8426 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/siimage.c Version 1.17 Oct 18 2007 + * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 * * Copyright (C) 2001-2002 Andre Hedrick * Copyright (C) 2003 Red Hat @@ -57,8 +57,8 @@ static int pdev_is_sata(struct pci_dev *pdev) { - switch(pdev->device) - { +#ifdef CONFIG_BLK_DEV_IDE_SATA + switch(pdev->device) { case PCI_DEVICE_ID_SII_3112: case PCI_DEVICE_ID_SII_1210SA: return 1; @@ -66,9 +66,10 @@ static int pdev_is_sata(struct pci_dev *pdev) return 0; } BUG(); +#endif return 0; } - + /** * is_sata - check if hwif is SATA * @hwif: interface to check @@ -136,7 +137,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) * SI3112 SATA controller life is a bit simpler. */ -static u8 sil_udma_filter(ide_drive_t *drive) +static u8 sil_pata_udma_filter(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; unsigned long base = (unsigned long) hwif->hwif_data; @@ -147,23 +148,23 @@ static u8 sil_udma_filter(ide_drive_t *drive) else pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); - if (is_sata(hwif)) { - mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f; - goto out; - } - if ((scsc & 0x30) == 0x10) /* 133 */ - mask = 0x7f; + mask = ATA_UDMA6; else if ((scsc & 0x30) == 0x20) /* 2xPCI */ - mask = 0x7f; + mask = ATA_UDMA6; else if ((scsc & 0x30) == 0x00) /* 100 */ - mask = 0x3f; + mask = ATA_UDMA5; else /* Disabled ? */ BUG(); -out: + return mask; } +static u8 sil_sata_udma_filter(ide_drive_t *drive) +{ + return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6; +} + /** * sil_set_pio_mode - set host controller for PIO mode * @drive: drive @@ -340,10 +341,11 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); - unsigned long base = (unsigned long)hwif->hwif_data; unsigned long addr = siimage_selreg(hwif, 0x1); if (SATA_ERROR_REG) { + unsigned long base = (unsigned long)hwif->hwif_data; + u32 ext_stat = readl((void __iomem *)(base + 0x10)); u8 watchdog = 0; if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { @@ -376,7 +378,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) } /** - * siimage_busproc - bus isolation ioctl + * sil_sata_busproc - bus isolation IOCTL * @drive: drive to isolate/restore * @state: bus state to set * @@ -384,8 +386,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) * SATA controller the work required is quite limited, we * just have to clean up the statistics */ - -static int siimage_busproc (ide_drive_t * drive, int state) + +static int sil_sata_busproc(ide_drive_t * drive, int state) { ide_hwif_t *hwif = HWIF(drive); u32 stat_config = 0; @@ -417,14 +419,14 @@ static int siimage_busproc (ide_drive_t * drive, int state) } /** - * siimage_reset_poll - wait for sata reset + * sil_sata_reset_poll - wait for SATA reset * @drive: drive we are resetting * * Poll the SATA phy and see whether it has come back from the dead * yet. */ - -static int siimage_reset_poll (ide_drive_t *drive) + +static int sil_sata_reset_poll(ide_drive_t *drive) { if (SATA_STATUS_REG) { ide_hwif_t *hwif = HWIF(drive); @@ -436,27 +438,22 @@ static int siimage_reset_poll (ide_drive_t *drive) HWGROUP(drive)->polling = 0; return ide_started; } - return 0; - } else { - return 0; } + + return 0; } /** - * siimage_pre_reset - reset hook + * sil_sata_pre_reset - reset hook * @drive: IDE device being reset * * For the SATA devices we need to handle recalibration/geometry * differently */ - -static void siimage_pre_reset (ide_drive_t *drive) -{ - if (drive->media != ide_disk) - return; - if (is_sata(HWIF(drive))) - { +static void sil_sata_pre_reset(ide_drive_t *drive) +{ + if (drive->media == ide_disk) { drive->special.b.set_geometry = 0; drive->special.b.recalibrate = 0; } @@ -502,7 +499,6 @@ static void siimage_reset (ide_drive_t *drive) drive->failures++; } } - } /** @@ -864,28 +860,31 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif) static void __devinit init_hwif_siimage(ide_hwif_t *hwif) { + u8 sata = is_sata(hwif); + hwif->resetproc = &siimage_reset; hwif->set_pio_mode = &sil_set_pio_mode; hwif->set_dma_mode = &sil_set_dma_mode; - hwif->reset_poll = &siimage_reset_poll; - hwif->pre_reset = &siimage_pre_reset; - hwif->udma_filter = &sil_udma_filter; - if(is_sata(hwif)) { + if (sata) { static int first = 1; - hwif->busproc = &siimage_busproc; + hwif->busproc = &sil_sata_busproc; + hwif->reset_poll = &sil_sata_reset_poll; + hwif->pre_reset = &sil_sata_pre_reset; + hwif->udma_filter = &sil_sata_udma_filter; if (first) { printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); first = 0; } - } + } else + hwif->udma_filter = &sil_pata_udma_filter; if (hwif->dma_base == 0) return; - if (is_sata(hwif)) + if (sata) hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; if (hwif->cbl != ATA_CBL_PATA40_SHORT) -- cgit v1.2.3 From fd9bb53942a7ca3398a63f2c238afd8fbed3ec0e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: ide: add ->fixup method to ide_hwif_t * Add ->fixup method to ide_hwif_t. * Set hwif->fixup in ide_pci_setup_ports() to d->fixup. * Use hwif->fixup in probe_hwif(). * Use probe_hwif_init() instead of probe_hwif_init_with_fixup() in ide_setup_pci_device(). * Add 'fixup' argument to ide_register_hw() and use it to set hwif->fixup, update all ide_register_hw() users accordingly. * Convert ide-cs/delkin_cb host drivers to use ide_register_hw(). * Restore hwif->fixup in ide_hwif_restore(). * Remove ide_register_hw_with_fixup(), probe_hwif_init_with_fixup() and 'fixup' argument from probe_hwif(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/bast-ide.c | 2 +- drivers/ide/arm/ide_arm.c | 2 +- drivers/ide/cris/ide-cris.c | 2 +- drivers/ide/h8300/ide-h8300.c | 2 +- drivers/ide/ide-pnp.c | 2 +- drivers/ide/ide-probe.c | 17 ++++++----------- drivers/ide/ide.c | 23 +++++++++-------------- drivers/ide/legacy/buddha.c | 4 ++-- drivers/ide/legacy/falconide.c | 2 +- drivers/ide/legacy/gayle.c | 2 +- drivers/ide/legacy/ide-cs.c | 2 +- drivers/ide/legacy/macide.c | 6 +++--- drivers/ide/legacy/q40ide.c | 2 +- drivers/ide/pci/delkin_cb.c | 2 +- drivers/ide/setup-pci.c | 6 ++++-- drivers/macintosh/mediabay.c | 2 +- include/linux/ide.h | 11 ++++------- 17 files changed, 39 insertions(+), 50 deletions(-) diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index f7449d04114..48db6167bb9 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c @@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq, hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); hw.irq = irq; - ide_register_hw(&hw, 0, hwif); + ide_register_hw(&hw, NULL, 0, hwif); return 0; } diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c index bce2bec8141..8957cbadf5c 100644 --- a/drivers/ide/arm/ide_arm.c +++ b/drivers/ide/arm/ide_arm.c @@ -31,5 +31,5 @@ void __init ide_arm_init(void) memset(&hw, 0, sizeof(hw)); ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); hw.irq = IDE_ARM_IRQ; - ide_register_hw(&hw, 1, NULL); + ide_register_hw(&hw, NULL, 1, NULL); } diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 9a96a10ba9d..ff20377b4c8 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -782,7 +782,7 @@ init_e100_ide (void) ide_offsets, 0, 0, cris_ide_ack_intr, ide_default_irq(0)); - ide_register_hw(&hw, 1, &hwif); + ide_register_hw(&hw, NULL, 1, &hwif); hwif->mmio = 1; hwif->chipset = ide_etrax100; hwif->set_pio_mode = &cris_set_pio_mode; diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 6d26ad7360d..37b9174a7ed 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c @@ -101,7 +101,7 @@ void __init h8300_ide_init(void) hw_setup(&hw); /* register if */ - idx = ide_register_hw(&hw, 1, &hwif); + idx = ide_register_hw(&hw, NULL, 1, &hwif); if (idx == -1) { printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); return; diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 2b8009c50e9..2afaa87022e 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -42,7 +42,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id hw.irq = pnp_irq(dev, 0); hw.dma = NO_DMA; - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); if (index != -1) { printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 54917485338..c6ba439b143 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); * This routine only knows how to look for drive units 0 and 1 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. */ -static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) +static void probe_hwif(ide_hwif_t *hwif) { unsigned long flags; unsigned int irqd; @@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) return; } - if (fixup) - fixup(hwif); + if (hwif->fixup) + hwif->fixup(hwif); for (unit = 0; unit < MAX_DRIVES; ++unit) { ide_drive_t *drive = &hwif->drives[unit]; @@ -861,9 +861,9 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) static int hwif_init(ide_hwif_t *hwif); static void hwif_register_devices(ide_hwif_t *hwif); -int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) +int probe_hwif_init(ide_hwif_t *hwif) { - probe_hwif(hwif, fixup); + probe_hwif(hwif); if (!hwif_init(hwif)) { printk(KERN_INFO "%s: failed to initialize IDE interface\n", @@ -877,11 +877,6 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif) return 0; } -int probe_hwif_init(ide_hwif_t *hwif) -{ - return probe_hwif_init_with_fixup(hwif, NULL); -} - EXPORT_SYMBOL(probe_hwif_init); #if MAX_HWIFS > 1 @@ -1394,7 +1389,7 @@ int ideprobe_init (void) for (index = 0; index < MAX_HWIFS; ++index) if (probe[index]) - probe_hwif(&ide_hwifs[index], NULL); + probe_hwif(&ide_hwifs[index]); for (index = 0; index < MAX_HWIFS; ++index) if (probe[index]) hwif_init(&ide_hwifs[index]); diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 961e6c89728..35f24b9b821 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -391,6 +391,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) hwif->cds = tmp_hwif->cds; #endif + hwif->fixup = tmp_hwif->fixup; + hwif->set_pio_mode = tmp_hwif->set_pio_mode; hwif->set_dma_mode = tmp_hwif->set_dma_mode; hwif->mdma_filter = tmp_hwif->mdma_filter; @@ -660,11 +662,11 @@ void ide_setup_ports ( hw_regs_t *hw, } /** - * ide_register_hw_with_fixup - register IDE interface + * ide_register_hw - register IDE interface * @hw: hardware registers + * @fixup: fixup function * @initializing: set while initializing built-in drivers * @hwifp: pointer to returned hwif - * @fixup: fixup function * * Register an IDE interface, specifying exactly the registers etc. * Set init=1 iff calling before probes have taken place. @@ -672,9 +674,8 @@ void ide_setup_ports ( hw_regs_t *hw, * Returns -1 on error. */ -int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, - ide_hwif_t **hwifp, - void(*fixup)(ide_hwif_t *hwif)) +int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), + int initializing, ide_hwif_t **hwifp) { int index, retry = 1; ide_hwif_t *hwif; @@ -710,11 +711,12 @@ found: memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); hwif->irq = hw->irq; hwif->noprobe = 0; + hwif->fixup = fixup; hwif->chipset = hw->chipset; hwif->gendev.parent = hw->dev; if (!initializing) { - probe_hwif_init_with_fixup(hwif, fixup); + probe_hwif_init(hwif); ide_proc_register_port(hwif); } @@ -724,13 +726,6 @@ found: return (initializing || hwif->present) ? index : -1; } -EXPORT_SYMBOL(ide_register_hw_with_fixup); - -int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp) -{ - return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL); -} - EXPORT_SYMBOL(ide_register_hw); /* @@ -1046,7 +1041,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device ide_init_hwif_ports(&hw, (unsigned long) args[0], (unsigned long) args[1], NULL); hw.irq = args[2]; - if (ide_register_hw(&hw, 0, NULL) == -1) + if (ide_register_hw(&hw, NULL, 0, NULL) == -1) return -EIO; return 0; } diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index 101aee1711c..4a0be251a05 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c @@ -212,8 +212,8 @@ fail_base2: // xsurf_iops, IRQ_AMIGA_PORTS); } - - index = ide_register_hw(&hw, 1, &hwif); + + index = ide_register_hw(&hw, NULL, 1, &hwif); if (index != -1) { hwif->mmio = 1; printk("ide%d: ", index); diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index f0829b83e97..7d7936f1b90 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c @@ -72,7 +72,7 @@ void __init falconide_init(void) 0, 0, NULL, // falconide_iops, IRQ_MFP_IDE); - index = ide_register_hw(&hw, 1, NULL); + index = ide_register_hw(&hw, NULL, 1, NULL); if (index != -1) printk("ide%d: Falcon IDE interface\n", index); diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 0830a021bbb..53331ee1e95 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c @@ -165,7 +165,7 @@ found: // &gayle_iops, IRQ_AMIGA_PORTS); - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); if (index != -1) { hwif->mmio = 1; switch (i) { diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index e8e360c2619..03715c05866 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq hw.irq = irq; hw.chipset = ide_pci; hw.dev = &handle->dev; - return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); + return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL); } /*====================================================================== diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index b557c45a5a9..e87cd2f1643 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c @@ -93,21 +93,21 @@ void macide_init(void) 0, 0, macide_ack_intr, // quadra_ide_iops, IRQ_NUBUS_F); - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); break; case MAC_IDE_PB: ide_setup_ports(&hw, IDE_BASE, macide_offsets, 0, 0, macide_ack_intr, // macide_pb_iops, IRQ_NUBUS_C); - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); break; case MAC_IDE_BABOON: ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 0, 0, NULL, // macide_baboon_iops, IRQ_BABOON_1); - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); if (index == -1) break; if (macintosh_config->ident == MAC_MODEL_PB190) { diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index e628a983ce3..a530d6de194 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c @@ -142,7 +142,7 @@ void q40ide_init(void) 0, NULL, // m68kide_iops, q40ide_default_irq(pcide_bases[i])); - index = ide_register_hw(&hw, 1, &hwif); + index = ide_register_hw(&hw, NULL, 1, &hwif); // **FIXME** if (index != -1) hwif->mmio = 1; diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 46f4a888c03..83829081640 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c @@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) hw.irq = dev->irq; hw.chipset = ide_pci; /* this enables IRQ sharing */ - rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); + rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif); if (rc < 0) { printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); pci_disable_device(dev); diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d62b225f569..4e9de204311 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -567,6 +567,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) hwif->irq = port ? 15 : 14; + hwif->fixup = d->fixup; + hwif->host_flags = d->host_flags; hwif->pio_mask = d->pio_mask; @@ -692,9 +694,9 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) mate = &ide_hwifs[index_list.b.high]; if (hwif) - probe_hwif_init_with_fixup(hwif, d->fixup); + probe_hwif_init(hwif); if (mate) - probe_hwif_init_with_fixup(mate, d->fixup); + probe_hwif_init(mate); if (hwif) ide_proc_register_port(hwif); diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2bba65..48d647abea4 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -563,7 +563,7 @@ static void media_bay_step(int i) ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); hw.irq = bay->cd_irq; hw.chipset = ide_pmac; - bay->cd_index = ide_register_hw(&hw, 0, NULL); + bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL); pmu_resume(); } if (bay->cd_index == -1) { diff --git a/include/linux/ide.h b/include/linux/ide.h index 258a15cc274..831b9cc2f1d 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -223,12 +223,8 @@ typedef struct hw_regs_s { struct device *dev; } hw_regs_t; -/* - * Register new hardware with ide - */ -int ide_register_hw(hw_regs_t *, int, struct hwif_s **); -int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **, - void (*)(struct hwif_s *)); +int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, + struct hwif_s **); /* * Set up hw_regs_t structure before calling ide_register_hw (optional) @@ -727,6 +723,8 @@ typedef struct hwif_s { u8 (*mdma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *); + void (*fixup)(struct hwif_s *); + void (*ata_input_data)(ide_drive_t *, void *, u32); void (*ata_output_data)(ide_drive_t *, void *, u32); @@ -1380,7 +1378,6 @@ void ide_unregister_region(struct gendisk *); void ide_undecoded_slave(ide_hwif_t *); -int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); extern int probe_hwif_init(ide_hwif_t *); static inline void *ide_get_hwifdata (ide_hwif_t * hwif) -- cgit v1.2.3 From 8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: ide: add ide_device_add() * Add ide_device_add() helper and convert host drivers to use it instead of open-coded variants. * Make ide_pci_setup_ports() and do_ide_setup_pci_device() take 'u8 *idx' argument instead of 'ata_index_t *index'. * Remove no longer needed ata_index_t. * Unexport probe_hwif_init() and make it static. * Unexport ide_proc_register_port(). There should be no functionality changes caused by this patch (sgiioc4.c: ide_proc_register_port() requires hwif->present to be set and it won't be set if probe_hwif_init() fails). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/icside.c | 13 ++++---- drivers/ide/arm/rapide.c | 8 +++-- drivers/ide/ide-probe.c | 23 ++++++++++++-- drivers/ide/ide-proc.c | 2 -- drivers/ide/ide.c | 7 ++-- drivers/ide/legacy/ali14xx.c | 7 ++-- drivers/ide/legacy/dtc2278.c | 7 ++-- drivers/ide/legacy/ht6560b.c | 7 ++-- drivers/ide/legacy/ide_platform.c | 6 ++-- drivers/ide/legacy/qd65xx.c | 21 ++++++------ drivers/ide/legacy/umc8672.c | 9 ++---- drivers/ide/mips/au1xxx-ide.c | 5 +-- drivers/ide/mips/swarm.c | 5 +-- drivers/ide/pci/cs5520.c | 22 ++----------- drivers/ide/pci/sgiioc4.c | 8 ++--- drivers/ide/ppc/pmac.c | 6 ++-- drivers/ide/setup-pci.c | 67 ++++++++------------------------------- include/linux/ide.h | 7 ++-- 18 files changed, 92 insertions(+), 138 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 3af33fbf1f8..6298932c058 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -500,6 +500,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) { ide_hwif_t *hwif; void __iomem *base; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); if (!base) @@ -523,9 +524,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) state->hwif[0] = hwif; - probe_hwif_init(hwif); + idx[0] = hwif->index; - ide_proc_register_port(hwif); + ide_device_add(idx); return 0; } @@ -537,6 +538,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) void __iomem *ioc_base, *easi_base; unsigned int sel = 0; int ret; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); if (!ioc_base) { @@ -608,11 +610,10 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) icside_dma_init(mate); } - probe_hwif_init(hwif); - probe_hwif_init(mate); + idx[0] = hwif->index; + idx[1] = mate->index; - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 83811af1161..6d2fe21cd72 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c @@ -58,6 +58,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) ide_hwif_t *hwif; void __iomem *base; int ret; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ret = ecard_request_resources(ec); if (ret) @@ -74,8 +75,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) hwif->hwif_data = base; hwif->gendev.parent = &ec->dev; hwif->noprobe = 0; - probe_hwif_init(hwif); - ide_proc_register_port(hwif); + + idx[0] = hwif->index; + + ide_device_add(idx); + ecard_set_drvdata(ec, hwif); goto out; } diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index c6ba439b143..d5146c57e5b 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -861,7 +861,7 @@ static void probe_hwif(ide_hwif_t *hwif) static int hwif_init(ide_hwif_t *hwif); static void hwif_register_devices(ide_hwif_t *hwif); -int probe_hwif_init(ide_hwif_t *hwif) +static int probe_hwif_init(ide_hwif_t *hwif) { probe_hwif(hwif); @@ -877,8 +877,6 @@ int probe_hwif_init(ide_hwif_t *hwif) return 0; } -EXPORT_SYMBOL(probe_hwif_init); - #if MAX_HWIFS > 1 /* * save_match() is used to simplify logic in init_irq() below. @@ -1410,3 +1408,22 @@ int ideprobe_init (void) } EXPORT_SYMBOL_GPL(ideprobe_init); + +int ide_device_add(u8 idx[4]) +{ + int i, rc = 0; + + for (i = 0; i < 4; i++) { + if (idx[i] != 0xff) + rc |= probe_hwif_init(&ide_hwifs[idx[i]]); + } + + for (i = 0; i < 4; i++) { + if (idx[i] != 0xff) + ide_proc_register_port(&ide_hwifs[idx[i]]); + } + + return rc; +} + +EXPORT_SYMBOL_GPL(ide_device_add); diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index fc1d8ae6a80..a4007d30da5 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif) create_proc_ide_drives(hwif); } -EXPORT_SYMBOL_GPL(ide_proc_register_port); - #ifdef CONFIG_BLK_DEV_IDEPCI void ide_pci_create_host_proc(const char *name, get_info_t *get_info) { diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 35f24b9b821..15741367eb3 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -715,9 +715,10 @@ found: hwif->chipset = hw->chipset; hwif->gendev.parent = hw->dev; - if (!initializing) { - probe_hwif_init(hwif); - ide_proc_register_port(hwif); + if (initializing == 0) { + u8 idx[4] = { index, 0xff, 0xff, 0xff }; + + ide_device_add(idx); } if (hwifp) diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 2f0ef9b4403..0973c85e49b 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -193,6 +193,7 @@ static int __init initRegisters (void) { static int __init ali14xx_probe(void) { ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", basePort, regOn); @@ -217,11 +218,7 @@ static int __init ali14xx_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index f1652125486..12a7182b4ad 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -94,6 +94,7 @@ static int __init dtc2278_probe(void) { unsigned long flags; ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; hwif = &ide_hwifs[0]; mate = &ide_hwifs[1]; @@ -134,11 +135,7 @@ static int __init dtc2278_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 2e5a9cc5c0f..7f0d433cb9d 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); int __init ht6560b_init(void) { ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; int t; if (probe_ht6560b == 0) @@ -359,11 +360,7 @@ int __init ht6560b_init(void) mate->drives[0].drive_data = t; mate->drives[1].drive_data = t; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index b992b2b91fe..9a153915f3c 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -83,6 +83,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) struct resource *res_base, *res_alt, *res_irq; ide_hwif_t *hwif; struct pata_platform_info *pdata; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret = 0; int mmio = 0; @@ -130,10 +131,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) hwif->gendev.parent = &pdev->dev; hwif->noprobe = 0; - probe_hwif_init(hwif); + idx[0] = hwif->index; + + ide_device_add(idx); platform_set_drvdata(pdev, hwif); - ide_proc_register_port(hwif); return 0; diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 0c81d2d0b94..85104bc79a1 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -389,6 +389,7 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) static int __init qd_probe(int base) { ide_hwif_t *hwif; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 config; u8 unit; @@ -419,9 +420,9 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6500_set_pio_mode; - probe_hwif_init(hwif); + idx[0] = unit; - ide_proc_register_port(hwif); + ide_device_add(idx); return 1; } @@ -453,11 +454,11 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(hwif); + idx[0] = unit; - qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); + ide_device_add(idx); - ide_proc_register_port(hwif); + qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); return 1; } else { @@ -474,19 +475,17 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(hwif); - qd_setup(mate, base, config | (control << 8), QD6580_DEF_DATA2, QD6580_DEF_DATA2); mate->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(mate); + idx[0] = 0; + idx[1] = 1; - qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); + ide_device_add(idx); - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); return 0; /* no other qd65xx possible */ } diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 1151c92dd53..79577b91687 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c @@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) static int __init umc8672_probe(void) { - unsigned long flags; ide_hwif_t *hwif, *mate; + unsigned long flags; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; if (!request_region(0x108, 2, "umc8672")) { printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); @@ -158,11 +159,7 @@ static int __init umc8672_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 2f322d7e881..be43024a359 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -603,6 +603,7 @@ static int au_ide_probe(struct device *dev) struct resource *res; hw_regs_t *hw; int ret = 0; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) char *mode = "MWDMA2"; @@ -717,9 +718,9 @@ static int au_ide_probe(struct device *dev) dbdma_init_done = 1; #endif - probe_hwif_init(hwif); + idx[0] = hwif->index; - ide_proc_register_port(hwif); + ide_device_add(idx); dev_set_drvdata(dev, hwif); diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index c2e29571b00..6ccc51d77e8 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c @@ -71,6 +71,7 @@ static int __devinit swarm_ide_probe(struct device *dev) u8 __iomem *base; phys_t offset, size; int i; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; if (!SIBYTE_HAVE_IDE) return -ENODEV; @@ -128,9 +129,9 @@ static int __devinit swarm_ide_probe(struct device *dev) memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->irq = hwif->hw.irq; - probe_hwif_init(hwif); + idx[0] = hwif->index; - ide_proc_register_port(hwif); + ide_device_add(idx); dev_set_drvdata(dev, hwif); diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index aa98e817d38..a9e1cafee69 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -154,9 +154,8 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = { static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_hwif_t *hwif = NULL, *mate = NULL; - ata_index_t index; ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ide_setup_pci_noise(dev, d); @@ -172,29 +171,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic return -ENODEV; } - index.all = 0xf0f0; - /* * Now the chipset is configured we can let the core * do all the device setup for us */ - ide_pci_setup_ports(dev, d, 14, &index); - - if ((index.b.low & 0xf0) != 0xf0) - hwif = &ide_hwifs[index.b.low]; - if ((index.b.high & 0xf0) != 0xf0) - mate = &ide_hwifs[index.b.high]; - - if (hwif) - probe_hwif_init(hwif); - if (mate) - probe_hwif_init(mate); + ide_pci_setup_ports(dev, d, 14, &idx[0]); - if (hwif) - ide_proc_register_port(hwif); - if (mate) - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 5af74ea1d46..f6d4b4136a8 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -614,6 +614,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) void __iomem *virt_base; ide_hwif_t *hwif; int h; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; /* * Find an empty HWIF; if none available, return -ENOMEM. @@ -679,11 +680,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) ide_init_sgiioc4(hwif); - if (probe_hwif_init(hwif)) - return -EIO; + idx[0] = hwif->index; - /* Create /proc/ide entries */ - ide_proc_register_port(hwif); + if (ide_device_add(idx)) + return -EIO; return 0; } diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index c5547935676..959afe47c37 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1039,6 +1039,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) { struct device_node *np = pmif->node; const int *bidp; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; pmif->cable_80 = 0; pmif->broken_dma = pmif->broken_dma_warn = 0; @@ -1163,10 +1164,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) pmac_ide_setup_dma(pmif, hwif); #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ - /* We probe the hwif now */ - probe_hwif_init(hwif); + idx[0] = hwif->index; - ide_proc_register_port(hwif); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 4e9de204311..252cb8c5931 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -512,7 +512,7 @@ out: * @dev: PCI device * @d: IDE pci device info * @pciirq: IRQ line - * @index: ata index to update + * @idx: ATA index table to update * * Scan the interfaces attached to this device and do any * necessary per port setup. Attach the devices and ask the @@ -522,15 +522,13 @@ out: * but is also used directly as a helper function by some controllers * where the chipset setup is not the default PCI IDE one. */ - -void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) + +void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, u8 *idx) { int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; ide_hwif_t *hwif, *mate = NULL; u8 tmp; - index->all = 0xf0f0; - /* * Set up the IDE ports */ @@ -550,11 +548,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a /* setup proper ancestral information */ hwif->gendev.parent = &dev->dev; - if (hwif->channel) { - index->b.high = hwif->index; - } else { - index->b.low = hwif->index; - } + *(idx + port) = hwif->index; if (d->init_iops) @@ -620,9 +614,8 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); * for all other chipsets, we just assume both interfaces are enabled. */ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, - ata_index_t *index, u8 noisy) + u8 *idx, u8 noisy) { - static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } }; int tried_config = 0; int pciirq, ret; @@ -672,37 +665,21 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, /* FIXME: silent failure can happen */ - *index = ata_index; - ide_pci_setup_ports(dev, d, pciirq, index); + ide_pci_setup_ports(dev, d, pciirq, idx); out: return ret; } int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) { - ide_hwif_t *hwif = NULL, *mate = NULL; - ata_index_t index_list; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret; - ret = do_ide_setup_pci_device(dev, d, &index_list, 1); - if (ret < 0) - goto out; + ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); - if ((index_list.b.low & 0xf0) != 0xf0) - hwif = &ide_hwifs[index_list.b.low]; - if ((index_list.b.high & 0xf0) != 0xf0) - mate = &ide_hwifs[index_list.b.high]; + if (ret >= 0) + ide_device_add(idx); - if (hwif) - probe_hwif_init(hwif); - if (mate) - probe_hwif_init(mate); - - if (hwif) - ide_proc_register_port(hwif); - if (mate) - ide_proc_register_port(mate); -out: return ret; } @@ -712,11 +689,11 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, ide_pci_device_t *d) { struct pci_dev *pdev[] = { dev1, dev2 }; - ata_index_t index_list[2]; int ret, i; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; for (i = 0; i < 2; i++) { - ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); + ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i); /* * FIXME: Mom, mom, they stole me the helper function to undo * do_ide_setup_pci_device() on the first device! @@ -725,25 +702,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, goto out; } - for (i = 0; i < 2; i++) { - u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; - int j; - - for (j = 0; j < 2; j++) { - if ((idx[j] & 0xf0) != 0xf0) - probe_hwif_init(ide_hwifs + idx[j]); - } - } - - for (i = 0; i < 2; i++) { - u8 idx[2] = { index_list[i].b.low, index_list[i].b.high }; - int j; - - for (j = 0; j < 2; j++) { - if ((idx[j] & 0xf0) != 0xf0) - ide_proc_register_port(ide_hwifs + idx[j]); - } - } + ide_device_add(idx); out: return ret; } diff --git a/include/linux/ide.h b/include/linux/ide.h index 831b9cc2f1d..7212fe41772 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -361,7 +361,6 @@ typedef union { * ATA DATA Register Special. * ATA NSECTOR Count Register(). * ATAPI Byte Count Register. - * Channel index ordering pairs. */ typedef union { unsigned all :16; @@ -376,7 +375,7 @@ typedef union { #error "Please fix " #endif } b; -} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; +} ata_nsector_t, ata_data_t, atapi_bcount_t; /* * ATA-IDE Select Register, aka Device-Head @@ -1200,7 +1199,7 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o #define ide_pci_register_driver(d) pci_register_driver(d) #endif -void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); +void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, u8 *); extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); extern void default_hwif_iops(ide_hwif_t *); @@ -1378,7 +1377,7 @@ void ide_unregister_region(struct gendisk *); void ide_undecoded_slave(ide_hwif_t *); -extern int probe_hwif_init(ide_hwif_t *); +int ide_device_add(u8 idx[4]); static inline void *ide_get_hwifdata (ide_hwif_t * hwif) { -- cgit v1.2.3 From baa8f3e94bc7a7ba3650d80b67d54c3e08365dee Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: ide: add ide_find_port() helper * Add ide_find_port() helper. * Convert icside, rapide and ide_platform host drivers to use it. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/icside.c | 24 +----------------------- drivers/ide/arm/rapide.c | 25 +++++-------------------- drivers/ide/ide.c | 24 ++++++++++++++++++++++++ drivers/ide/legacy/ide_platform.c | 25 ++++++------------------- include/linux/ide.h | 2 ++ 5 files changed, 38 insertions(+), 62 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 6298932c058..fda3f870d7c 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -438,35 +438,13 @@ static void icside_dma_init(ide_hwif_t *hwif) #define icside_dma_init(hwif) (0) #endif -static ide_hwif_t *icside_find_hwif(unsigned long dataport) -{ - ide_hwif_t *hwif; - int index; - - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = &ide_hwifs[index]; - if (hwif->io_ports[IDE_DATA_OFFSET] == dataport) - goto found; - } - - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = &ide_hwifs[index]; - if (!hwif->io_ports[IDE_DATA_OFFSET]) - goto found; - } - - hwif = NULL; -found: - return hwif; -} - static ide_hwif_t * icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) { unsigned long port = (unsigned long)base + info->dataoffset; ide_hwif_t *hwif; - hwif = icside_find_hwif(port); + hwif = ide_find_port(port); if (hwif) { int i; diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 6d2fe21cd72..96cd3f5b9ad 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c @@ -13,31 +13,16 @@ #include -/* - * Something like this really should be in generic code, but isn't. - */ static ide_hwif_t * rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) { unsigned long port = (unsigned long)base; - ide_hwif_t *hwif; - int index, i; - - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = ide_hwifs + index; - if (hwif->io_ports[IDE_DATA_OFFSET] == port) - goto found; - } + ide_hwif_t *hwif = ide_find_port(port); + int i; - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = ide_hwifs + index; - if (hwif->io_ports[IDE_DATA_OFFSET] == 0) - goto found; - } - - return NULL; + if (hwif == NULL) + goto out; - found: for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hwif->hw.io_ports[i] = port; hwif->io_ports[i] = port; @@ -48,7 +33,7 @@ rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int hwif->hw.irq = hwif->irq = irq; hwif->mmio = 1; default_hwif_mmiops(hwif); - +out: return hwif; } diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 15741367eb3..ce6644f41b2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -265,6 +265,30 @@ static int ide_system_bus_speed(void) return system_bus_speed; } +ide_hwif_t * ide_find_port(unsigned long base) +{ + ide_hwif_t *hwif; + int i; + + for (i = 0; i < MAX_HWIFS; i++) { + hwif = &ide_hwifs[i]; + if (hwif->io_ports[IDE_DATA_OFFSET] == base) + goto found; + } + + for (i = 0; i < MAX_HWIFS; i++) { + hwif = &ide_hwifs[i]; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } + + hwif = NULL; +found: + return hwif; +} + +EXPORT_SYMBOL_GPL(ide_find_port); + static struct resource* hwif_request_region(ide_hwif_t *hwif, unsigned long addr, int num) { diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 9a153915f3c..d1e76fa7869 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -33,24 +33,11 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, int mmio) { unsigned long port = (unsigned long)base; - ide_hwif_t *hwif; - int index, i; - - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = ide_hwifs + index; - if (hwif->io_ports[IDE_DATA_OFFSET] == port) - goto found; - } - - for (index = 0; index < MAX_HWIFS; ++index) { - hwif = ide_hwifs + index; - if (hwif->io_ports[IDE_DATA_OFFSET] == 0) - goto found; - } + ide_hwif_t *hwif = ide_find_port(port); + int i; - return NULL; - -found: + if (hwif == NULL) + goto out; hwif->hw.io_ports[IDE_DATA_OFFSET] = port; @@ -73,8 +60,8 @@ found: } hwif_prop.hwif = hwif; - hwif_prop.index = index; - + hwif_prop.index = hwif->index; +out: return hwif; } diff --git a/include/linux/ide.h b/include/linux/ide.h index 7212fe41772..9e1cf757b91 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -223,6 +223,8 @@ typedef struct hw_regs_s { struct device *dev; } hw_regs_t; +struct hwif_s * ide_find_port(unsigned long); + int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, struct hwif_s **); -- cgit v1.2.3 From f9b93097375761930c52b3a20acd374a8d012fbc Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: ide: remove redundant comments from ide.h There is better documentation for these functions in drivers/ide/. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/include/linux/ide.h b/include/linux/ide.h index 9e1cf757b91..17a946b5f55 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -228,9 +228,6 @@ struct hwif_s * ide_find_port(unsigned long); int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, struct hwif_s **); -/* - * Set up hw_regs_t structure before calling ide_register_hw (optional) - */ void ide_setup_ports( hw_regs_t *hw, unsigned long base, int *offsets, @@ -1031,36 +1028,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int uptodate, int nr_sectors); -/* - * This is used on exit from the driver to designate the next irq handler - * and also to start the safety timer. - */ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); -/* - * This is used on exit from the driver to designate the next irq handler - * and start the safety time safely and atomically from the IRQ handler - * with respect to the command issue (which it also does) - */ extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); -/* - * ide_error() takes action based on the error returned by the controller. - * The caller should return immediately after invoking this. - * - * (drive, msg, status) - */ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); ide_startstop_t __ide_abort(ide_drive_t *, struct request *); -/* - * Abort a running command on the controller triggering the abort - * from a host side, non error situation - * (drive, msg) - */ extern ide_startstop_t ide_abort(ide_drive_t *, const char *); extern void ide_fix_driveid(struct hd_driveid *); @@ -1076,15 +1053,8 @@ extern void ide_fixstring(u8 *, const int, const int); int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); -/* - * Start a reset operation for an IDE interface. - * The caller should return immediately after invoking this. - */ extern ide_startstop_t ide_do_reset (ide_drive_t *); -/* - * This function is intended to be used prior to invoking ide_do_drive_cmd(). - */ extern void ide_init_drive_cmd (struct request *rq); /* @@ -1099,13 +1069,6 @@ typedef enum { extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); -/* - * Clean up after success/failure of an explicit drive cmd. - * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). - * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK). - * - * (ide_drive_t *drive, u8 stat, u8 err) - */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); /* @@ -1178,10 +1141,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); -/* - * ide_stall_queue() can be used by a drive to give excess bandwidth back - * to the hwgroup by sleeping for timeout jiffies. - */ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); extern int ide_spin_wait_hwgroup(ide_drive_t *); -- cgit v1.2.3 From 847ddd2bbe15c6e452606503b5d073826aaaddb7 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:32 +0200 Subject: ide: add CONFIG_IDE_ARCH_OBSOLETE_INIT Add CONFIG_IDE_ARCH_OBSOLETE_INIT to drivers/ide/Kconfig and use it instead of defining IDE_ARCH_OBSOLETE_INIT in . Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 3 +++ drivers/ide/setup-pci.c | 2 +- include/asm-alpha/ide.h | 1 - include/asm-arm/ide.h | 1 - include/asm-blackfin/ide.h | 1 - include/asm-ia64/ide.h | 1 - include/asm-m32r/ide.h | 1 - include/asm-mips/mach-generic/ide.h | 1 - include/asm-parisc/ide.h | 1 - include/asm-powerpc/ide.h | 1 - include/asm-sh64/ide.h | 1 - include/asm-sparc/ide.h | 1 - include/asm-sparc64/ide.h | 1 - include/asm-x86/ide.h | 1 - include/linux/ide.h | 8 ++------ 15 files changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 6d9fd92763f..6eaece96524 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -1056,6 +1056,9 @@ endif config BLK_DEV_IDEDMA def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA +config IDE_ARCH_OBSOLETE_INIT + def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC + endif config BLK_DEV_HD_ONLY diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 252cb8c5931..875167e11cd 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -388,7 +388,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, if (hwif->io_ports[IDE_DATA_OFFSET] != base || hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { memset(&hwif->hw, 0, sizeof(hwif->hw)); -#ifndef IDE_ARCH_OBSOLETE_INIT +#ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT ide_std_init_ports(&hwif->hw, base, (ctl | 2)); hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; #else diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h index 2a5cc0b367a..b7bf68d0407 100644 --- a/include/asm-alpha/ide.h +++ b/include/asm-alpha/ide.h @@ -40,7 +40,6 @@ static inline unsigned long ide_default_io_base(int index) } } -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_PCI diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index 4f68c8a5a19..f348fcf3150 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h @@ -18,7 +18,6 @@ #endif #if !defined(CONFIG_ARCH_L7200) -# define IDE_ARCH_OBSOLETE_INIT # ifdef CONFIG_ARCH_CLPS7500 # define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ # else diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h index 41b2db46a16..121e272581d 100644 --- a/include/asm-blackfin/ide.h +++ b/include/asm-blackfin/ide.h @@ -20,7 +20,6 @@ #define MAX_HWIFS 1 /* Legacy ... BLK_DEV_IDECS */ -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h index e928675de35..1ccf2380932 100644 --- a/include/asm-ia64/ide.h +++ b/include/asm-ia64/ide.h @@ -46,7 +46,6 @@ static inline unsigned long ide_default_io_base(int index) } } -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_PCI diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h index 4672a49e876..5d2044e529a 100644 --- a/include/asm-m32r/ide.h +++ b/include/asm-m32r/ide.h @@ -65,7 +65,6 @@ static __inline__ unsigned long ide_default_io_base(int index) } } -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h index a77128362a7..4ec2b930dfb 100644 --- a/include/asm-mips/mach-generic/ide.h +++ b/include/asm-mips/mach-generic/ide.h @@ -98,7 +98,6 @@ static __inline__ unsigned long ide_default_io_base(int index) } } -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h index b27bf7aeb25..be8760fbc8e 100644 --- a/include/asm-parisc/ide.h +++ b/include/asm-parisc/ide.h @@ -17,7 +17,6 @@ #define MAX_HWIFS 2 #endif -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h index 1644e44c875..e61dad73353 100644 --- a/include/asm-powerpc/ide.h +++ b/include/asm-powerpc/ide.h @@ -74,7 +74,6 @@ static __inline__ unsigned long ide_default_io_base(int index) #endif /* __powerpc64__ */ -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #endif /* __KERNEL__ */ diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h index c9d84d5f772..b6e31e8b941 100644 --- a/include/asm-sh64/ide.h +++ b/include/asm-sh64/ide.h @@ -19,7 +19,6 @@ /* Without this, the initialisation of PCI IDE cards end up calling * ide_init_hwif_ports, which won't work. */ #ifdef CONFIG_BLK_DEV_IDEPCI -#define IDE_ARCH_OBSOLETE_INIT 1 #define ide_default_io_ctl(base) (0) #endif diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h index a6d735a1310..404022765fc 100644 --- a/include/asm-sparc/ide.h +++ b/include/asm-sparc/ide.h @@ -18,7 +18,6 @@ #undef MAX_HWIFS #define MAX_HWIFS 2 -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define __ide_insl(data_reg, buffer, wcount) \ diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index 55149cf933c..ac7eb210b94 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h @@ -24,7 +24,6 @@ # endif #endif -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #define __ide_insl(data_reg, buffer, wcount) \ diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h index e7817a3d657..42130adf9c7 100644 --- a/include/asm-x86/ide.h +++ b/include/asm-x86/ide.h @@ -62,7 +62,6 @@ static __inline__ unsigned long ide_default_io_base(int index) } } -#define IDE_ARCH_OBSOLETE_INIT #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ #ifdef CONFIG_BLK_DEV_IDEPCI diff --git a/include/linux/ide.h b/include/linux/ide.h index 17a946b5f55..39b76aaaa12 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -265,11 +265,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw, # define ide_init_default_irq(base) (0) #endif -/* - * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. - * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in . - */ -#ifdef IDE_ARCH_OBSOLETE_INIT +#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long io_addr, unsigned long ctl_addr, @@ -299,7 +295,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw, if (io_addr || ctl_addr) printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); } -#endif /* IDE_ARCH_OBSOLETE_INIT */ +#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ /* Currently only m68k, apus and m8xx need it */ #ifndef IDE_ARCH_ACK_INTR -- cgit v1.2.3 From 8f173b5bf460a85791c131e774dc992f8cd578c1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:32 +0200 Subject: ide: fix ide_register_hw() to check hwif->io_ports[] hwif->hw.io_ports[] and hwif->io_ports[] should be the same but "4drives" support and scc_pata host driver set only hwif->io_ports[]. To compensate for this check hwif->io_ports[] instead of hwif->hw.io_ports[] in ide_register_hw() (instead of fixing "4drives" and scc_pata because hwif->hw is to be removed). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index ce6644f41b2..9284f64bc2e 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -707,7 +707,7 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), do { for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; - if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) + if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) goto found; } for (index = 0; index < MAX_HWIFS; ++index) { @@ -715,7 +715,7 @@ int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *), if (hwif->hold) continue; if ((!hwif->present && !hwif->mate && !initializing) || - (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) + (!hwif->io_ports[IDE_DATA_OFFSET] && initializing)) goto found; } for (index = 0; index < MAX_HWIFS; index++) -- cgit v1.2.3 From 86f3a492bb09eee5745b93af35f2212179c251fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:32 +0200 Subject: icside: use ec->dma directly * hwif->hwif_data contains pointer to struct expansion_card so use ec->dma directly instead of caching it in hwif->hw.dma. * Remove no longer needed hw_regs_t.dma and NO_DMA define. Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/icside.c | 20 ++++++++++---------- drivers/ide/h8300/ide-h8300.c | 1 - drivers/ide/ide-pnp.c | 1 - drivers/ide/ide.c | 1 - drivers/ide/legacy/ide_platform.c | 1 - drivers/ide/legacy/q40ide.c | 3 +-- include/linux/ide.h | 5 ----- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index fda3f870d7c..22fc46d6344 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -316,27 +316,29 @@ static int icside_dma_end(ide_drive_t *drive) drive->waiting_for_dma = 0; - disable_dma(hwif->hw.dma); + disable_dma(state->dev->dma); /* Teardown mappings after DMA has completed. */ dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); - return get_dma_residue(hwif->hw.dma) != 0; + return get_dma_residue(state->dev->dma) != 0; } static void icside_dma_start(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); + struct icside_state *state = hwif->hwif_data; /* We can not enable DMA on both channels simultaneously. */ - BUG_ON(dma_channel_active(hwif->hw.dma)); - enable_dma(hwif->hw.dma); + BUG_ON(dma_channel_active(state->dev->dma)); + enable_dma(state->dev->dma); } static int icside_dma_setup(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); + struct icside_state *state = hwif->hwif_data; struct request *rq = hwif->hwgroup->rq; unsigned int dma_mode; @@ -348,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive) /* * We can not enable DMA on both channels. */ - BUG_ON(dma_channel_active(hwif->hw.dma)); + BUG_ON(dma_channel_active(state->dev->dma)); icside_build_sglist(drive, rq); @@ -365,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive) /* * Select the correct timing for this drive. */ - set_dma_speed(hwif->hw.dma, drive->drive_data); + set_dma_speed(state->dev->dma, drive->drive_data); /* * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents); - set_dma_mode(hwif->hw.dma, dma_mode); + set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents); + set_dma_mode(state->dev->dma, dma_mode); drive->waiting_for_dma = 1; @@ -572,7 +574,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) hwif->serialized = 1; hwif->config_data = (unsigned long)ioc_base; hwif->select_data = sel; - hwif->hw.dma = ec->dma; mate->maskproc = icside_maskproc; mate->channel = 1; @@ -581,7 +582,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) mate->serialized = 1; mate->config_data = (unsigned long)ioc_base; mate->select_data = sel | 1; - mate->hw.dma = ec->dma; if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { icside_dma_init(hwif); diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 37b9174a7ed..4a49b5c59ac 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c @@ -68,7 +68,6 @@ static inline void hw_setup(hw_regs_t *hw) hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; - hw->dma = NO_DMA; hw->chipset = ide_generic; } diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 2afaa87022e..e245521af7b 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -40,7 +40,6 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ide_std_init_ports(&hw, pnp_port_start(dev, 0), pnp_port_start(dev, 1)); hw.irq = pnp_irq(dev, 0); - hw.dma = NO_DMA; index = ide_register_hw(&hw, NULL, 1, &hwif); diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 9284f64bc2e..4a668d51965 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -678,7 +678,6 @@ void ide_setup_ports ( hw_regs_t *hw, } } hw->irq = irq; - hw->dma = NO_DMA; hw->ack_intr = ack_intr; /* * hw->iops = iops; diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index d1e76fa7869..1bc9a57b619 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -51,7 +51,6 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); hwif->hw.irq = hwif->irq = irq; - hwif->hw.dma = NO_DMA; hwif->chipset = hwif->hw.chipset = ide_generic; if (mmio) { diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index a530d6de194..44cdb745a6f 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c @@ -89,9 +89,8 @@ void q40_ide_setup_ports ( hw_regs_t *hw, else hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); } - + hw->irq = irq; - hw->dma = NO_DMA; hw->ack_intr = ack_intr; /* * hw->iops = iops; diff --git a/include/linux/ide.h b/include/linux/ide.h index 39b76aaaa12..9686cb47eee 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -192,10 +192,6 @@ typedef unsigned char byte; /* used everywhere */ struct hwif_s; typedef int (ide_ack_intr_t)(struct hwif_s *); -#ifndef NO_DMA -#define NO_DMA 255 -#endif - /* * hwif_chipset_t is used to keep track of the specific hardware * chipset used by each IDE interface, if known. @@ -217,7 +213,6 @@ typedef u8 hwif_chipset_t; typedef struct hw_regs_s { unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ int irq; /* our irq number */ - int dma; /* our dma entry */ ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ hwif_chipset_t chipset; struct device *dev; -- cgit v1.2.3 From 18e181fe13b7340194d09e6dd7f571a5f96f0367 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:32 +0200 Subject: ide: add hwif->ack_intr hook * Add hwif->ack_intr hook and use it instead of hwif->hw.ack_intr. * Add missing brackets to cris-v32 and powerpc ide_ack_intr() macros. Cc: Roman Zippel Cc: Geert Uytterhoeven Cc: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide.c | 1 + drivers/ide/ppc/mpc8xx.c | 4 ++-- include/asm-cris/arch-v32/ide.h | 2 +- include/asm-m68k/ide.h | 2 +- include/asm-powerpc/ide.h | 2 +- include/linux/ide.h | 2 ++ 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 4a668d51965..b7e872e29f9 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -737,6 +737,7 @@ found: hwif->fixup = fixup; hwif->chipset = hw->chipset; hwif->gendev.parent = hw->dev; + hwif->ack_intr = hw->ack_intr; if (initializing == 0) { u8 idx[4] = { index, 0xff, 0xff, 0xff }; diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index df2e92034f5..5f0da35ab5a 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -316,8 +316,8 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; + ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; - hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive */ @@ -402,8 +402,8 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; + ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; - hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive */ diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h index 6590f657500..11296170d05 100644 --- a/include/asm-cris/arch-v32/ide.h +++ b/include/asm-cris/arch-v32/ide.h @@ -54,7 +54,7 @@ static inline unsigned long ide_default_io_base(int index) #define SUPPORT_VLB_SYNC 0 #define IDE_ARCH_ACK_INTR -#define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif) +#define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif)) #endif /* __KERNEL__ */ diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index f9ffb2cbbae..909c6dfd385 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h @@ -137,7 +137,7 @@ ide_get_lock(irq_handler_t handler, void *data) #endif /* CONFIG_BLK_DEV_FALCON_IDE */ #define IDE_ARCH_ACK_INTR -#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) +#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) #endif /* __KERNEL__ */ #endif /* _M68K_IDE_H */ diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h index e61dad73353..fd7f5a430f0 100644 --- a/include/asm-powerpc/ide.h +++ b/include/asm-powerpc/ide.h @@ -69,7 +69,7 @@ static __inline__ unsigned long ide_default_io_base(int index) #ifdef CONFIG_BLK_DEV_MPC8xx_IDE #define IDE_ARCH_ACK_INTR 1 -#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) +#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) #endif #endif /* __powerpc64__ */ diff --git a/include/linux/ide.h b/include/linux/ide.h index 9686cb47eee..1e6bf04160d 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -683,6 +683,8 @@ typedef struct hwif_s { struct pci_dev *pci_dev; /* for pci chipsets */ struct ide_pci_device_s *cds; /* chipset device struct */ + ide_ack_intr_t *ack_intr; + void (*rw_disk)(ide_drive_t *, struct request *); #if 0 -- cgit v1.2.3 From 9239b333939dd1e5b1a9f033a1c136273d58efe8 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:33 +0200 Subject: ide: remove write-only hwif->hw Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/icside.c | 5 ----- drivers/ide/arm/rapide.c | 4 +--- drivers/ide/ide.c | 15 ++++++++------- drivers/ide/legacy/ide_platform.c | 11 +++++------ drivers/ide/mips/au1xxx-ide.c | 10 +++++----- drivers/ide/mips/swarm.c | 9 +++------ drivers/ide/pci/sgiioc4.c | 8 +++++--- drivers/ide/pci/siimage.c | 11 +++-------- drivers/ide/ppc/pmac.c | 6 ++++-- drivers/ide/setup-pci.c | 11 ++++++----- include/linux/ide.h | 1 - 11 files changed, 40 insertions(+), 51 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 22fc46d6344..410a0d13e35 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -450,8 +450,6 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e if (hwif) { int i; - memset(&hwif->hw, 0, sizeof(hw_regs_t)); - /* * Ensure we're using MMIO */ @@ -459,13 +457,10 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e hwif->mmio = 1; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hwif->hw.io_ports[i] = port; hwif->io_ports[i] = port; port += 1 << info->stepping; } - hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; - hwif->hw.irq = ec->irq; hwif->irq = ec->irq; hwif->noprobe = 0; hwif->chipset = ide_acorn; diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index 96cd3f5b9ad..0775a3afef4 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c @@ -24,13 +24,11 @@ rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int goto out; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hwif->hw.io_ports[i] = port; hwif->io_ports[i] = port; port += sz; } - hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; - hwif->hw.irq = hwif->irq = irq; + hwif->irq = irq; hwif->mmio = 1; default_hwif_mmiops(hwif); out: diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b7e872e29f9..674a65c1a13 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -168,7 +168,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); - memcpy(&hwif->hw, &hw, sizeof(hw)); memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; @@ -214,7 +213,7 @@ static void __init init_ide_data (void) init_hwif_data(hwif, index); init_hwif_default(hwif, index); #if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) - hwif->irq = hwif->hw.irq = + hwif->irq = ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); #endif } @@ -730,8 +729,7 @@ found: } if (hwif->present) return -1; - memcpy(&hwif->hw, hw, sizeof(*hw)); - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); + memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); hwif->irq = hw->irq; hwif->noprobe = 0; hwif->fixup = fixup; @@ -1417,6 +1415,9 @@ static int __init ide_setup(char *s) "reset", "minus6", "ata66", "minus8", "minus9", "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", "dtc2278", "umc8672", "ali14xx", NULL }; + + hw_regs_t hwregs; + hw = s[3] - '0'; hwif = &ide_hwifs[hw]; i = match_parm(&s[4], ide_words, vals, 3); @@ -1526,9 +1527,9 @@ static int __init ide_setup(char *s) case 2: /* base,ctl */ vals[2] = 0; /* default irq = probe for it */ case 3: /* base,ctl,irq */ - hwif->hw.irq = vals[2]; - ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq); - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); + memset(&hwregs, 0, sizeof(hwregs)); + ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq); + memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports)); hwif->irq = vals[2]; hwif->noprobe = 0; hwif->chipset = ide_forced; diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 1bc9a57b619..7bb79f53dac 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -39,19 +39,18 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, if (hwif == NULL) goto out; - hwif->hw.io_ports[IDE_DATA_OFFSET] = port; + hwif->io_ports[IDE_DATA_OFFSET] = port; port += (1 << pdata->ioport_shift); for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; i++, port += (1 << pdata->ioport_shift)) - hwif->hw.io_ports[i] = port; + hwif->io_ports[i] = port; - hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; + hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); - hwif->hw.irq = hwif->irq = irq; + hwif->irq = irq; - hwif->chipset = hwif->hw.chipset = ide_generic; + hwif->chipset = ide_generic; if (mmio) { hwif->mmio = 1; diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index be43024a359..97af57a714c 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -601,9 +601,9 @@ static int au_ide_probe(struct device *dev) _auide_hwif *ahwif = &auide_hwif; ide_hwif_t *hwif; struct resource *res; - hw_regs_t *hw; int ret = 0; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; + hw_regs_t hw; #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) char *mode = "MWDMA2"; @@ -645,12 +645,12 @@ static int au_ide_probe(struct device *dev) /* FIXME: This might possibly break PCMCIA IDE devices */ hwif = &ide_hwifs[pdev->id]; - hw = &hwif->hw; - hwif->irq = hw->irq = ahwif->irq; + hwif->irq = ahwif->irq; hwif->chipset = ide_au1xxx; - auide_setup_ports(hw, ahwif); - memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); + memset(&hw, 0, sizeof(hw)); + auide_setup_ports(&hw, ahwif); + memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index 6ccc51d77e8..521edd41b57 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c @@ -120,14 +120,11 @@ static int __devinit swarm_ide_probe(struct device *dev) hwif->noprobe = 0; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) - hwif->hw.io_ports[i] = + hwif->io_ports[i] = (unsigned long)(base + ((0x1f0 + i) << 5)); - hwif->hw.io_ports[IDE_CONTROL_OFFSET] = + hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)(base + (0x3f6 << 5)); - hwif->hw.irq = K_INT_GB_IDE; - - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); - hwif->irq = hwif->hw.irq; + hwif->irq = K_INT_GB_IDE; idx[0] = hwif->index; diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index f6d4b4136a8..de820aa58cd 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -655,10 +655,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) } if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { + hw_regs_t hw; + /* Initialize the IO registers */ - sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport); - memcpy(hwif->io_ports, hwif->hw.io_ports, - sizeof (hwif->io_ports)); + memset(&hw, 0, sizeof(hw)); + sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport); + memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; } diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 463bfda8426..732043b4deb 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -754,16 +754,11 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; } - hw.irq = hwif->pci_dev->irq; + memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); - memcpy(&hwif->hw, &hw, sizeof(hw)); - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); + hwif->irq = dev->irq; - hwif->irq = hw.irq; - - base = (unsigned long) addr; - - hwif->dma_base = base + (ch ? 0x08 : 0x00); + hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00); hwif->mmio = 1; } diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 959afe47c37..816b5311dad 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1040,6 +1040,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) struct device_node *np = pmif->node; const int *bidp; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; + hw_regs_t hw; pmif->cable_80 = 0; pmif->broken_dma = pmif->broken_dma_warn = 0; @@ -1125,8 +1126,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) /* Tell common code _not_ to mess with resources */ hwif->mmio = 1; hwif->hwif_data = pmif; - pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq); - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); + memset(&hw, 0, sizeof(hw)); + pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq); + memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); hwif->chipset = ide_pmac; hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; hwif->hold = pmif->mediabay; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 875167e11cd..71be6999f96 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -387,14 +387,15 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, return NULL; /* no room in ide_hwifs[] */ if (hwif->io_ports[IDE_DATA_OFFSET] != base || hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { - memset(&hwif->hw, 0, sizeof(hwif->hw)); + hw_regs_t hw; + + memset(&hw, 0, sizeof(hw)); #ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT - ide_std_init_ports(&hwif->hw, base, (ctl | 2)); - hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; + ide_std_init_ports(&hw, base, ctl | 2); #else - ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); + ide_init_hwif_ports(&hw, base, ctl | 2, NULL); #endif - memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); + memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; } hwif->chipset = d->chipset ? d->chipset : ide_pci; diff --git a/include/linux/ide.h b/include/linux/ide.h index 1e6bf04160d..ff1024eadbd 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -659,7 +659,6 @@ typedef struct hwif_s { unsigned long sata_scr[SATA_NR_PORTS]; unsigned long sata_misc[SATA_NR_PORTS]; - hw_regs_t hw; /* Hardware info */ ide_drive_t drives[MAX_DRIVES]; /* drive info */ u8 major; /* our major number */ -- cgit v1.2.3 From a05e2faa0e2c0157bcdace5d966ceebd37c10da4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:33 +0200 Subject: au1xxx-ide: set ->autotune and ->no_io_32bit also for the slave device Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/mips/au1xxx-ide.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 97af57a714c..1de58566e5b 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -707,8 +707,10 @@ static int au_ide_probe(struct device *dev) hwif->config_data = 0; /* no chipset-specific code */ hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ + hwif->drives[1].autotune = 1; #endif - hwif->drives[0].no_io_32bit = 1; + hwif->drives[0].no_io_32bit = 1; + hwif->drives[1].no_io_32bit = 1; auide_hwif.hwif = hwif; hwif->hwif_data = &auide_hwif; -- cgit v1.2.3 From 691da768a36584bd93ccaca248b261588c44f2da Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:33 +0200 Subject: dtc2278: set ->pio_mask also for the second port Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/dtc2278.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 12a7182b4ad..253a20fc806 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -130,6 +130,7 @@ static int __init dtc2278_probe(void) mate->serialized = 1; mate->chipset = ide_dtc2278; + mate->pio_mask = ATA_PIO4; mate->drives[0].no_unmask = 1; mate->drives[1].no_unmask = 1; mate->mate = hwif; -- cgit v1.2.3 From 6157332edabdf77ccae2a033b53bbc9ae1d70ede Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:33 +0200 Subject: via82cxxx: keep local ide_pci_device_t copy * Keep local ide_pci_device_t copy in via_init_one(). * Adjust ide_pci_device_t copy according to id->driver_data in via_init_one() and remove no longer needed second via82cxxx_chipsets[] entry. * via82cxxx_chipsets[] -> via82cxxx_chipset. * Remove IDE_HFLAGS_VIA define. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 62 ++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 14979f4df36..0860b90f155 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -1,6 +1,6 @@ /* * - * Version 3.49 + * Version 3.50 * * VIA IDE driver for Linux. Supported southbridges: * @@ -432,40 +432,29 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->cbl = via82cxxx_cable_detect(hwif); } -#define IDE_HFLAGS_VIA \ - (IDE_HFLAG_PIO_NO_BLACKLIST | \ - IDE_HFLAG_PIO_NO_DOWNGRADE | \ - IDE_HFLAG_POST_SET_MODE | \ - IDE_HFLAG_IO_32BIT | \ - IDE_HFLAG_BOOTABLE) - -static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { - { /* 0 */ - .name = "VP_IDE", - .init_chipset = init_chipset_via82cxxx, - .init_hwif = init_hwif_via82cxxx, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .host_flags = IDE_HFLAGS_VIA | IDE_HFLAG_NO_AUTODMA, - .pio_mask = ATA_PIO5, - .swdma_mask = ATA_SWDMA2, - .mwdma_mask = ATA_MWDMA2, - },{ /* 1 */ - .name = "VP_IDE", - .init_chipset = init_chipset_via82cxxx, - .init_hwif = init_hwif_via82cxxx, - .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, - .host_flags = IDE_HFLAGS_VIA, - .pio_mask = ATA_PIO5, - .swdma_mask = ATA_SWDMA2, - .mwdma_mask = ATA_MWDMA2, - } +static ide_pci_device_t via82cxxx_chipset __devinitdata = { + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | + IDE_HFLAG_PIO_NO_DOWNGRADE | + IDE_HFLAG_POST_SET_MODE | + IDE_HFLAG_IO_32BIT | + IDE_HFLAG_BOOTABLE, + .pio_mask = ATA_PIO5, + .swdma_mask = ATA_SWDMA2, + .mwdma_mask = ATA_MWDMA2, }; static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &via82cxxx_chipsets[id->driver_data]; struct pci_dev *isa = NULL; struct via_isa_bridge *via_config; + u8 idx = id->driver_data; + ide_pci_device_t d; + + d = via82cxxx_chipset; /* * Find the ISA bridge and check we know what it is. @@ -477,19 +466,22 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i return -ENODEV; } - if (via_config->flags & VIA_NO_UNMASK) - d->host_flags &= ~IDE_HFLAG_UNMASK_IRQS; + if (idx == 0) + d.host_flags |= IDE_HFLAG_NO_AUTODMA; else - d->host_flags |= IDE_HFLAG_UNMASK_IRQS; + d.enablebits[1].reg = d.enablebits[0].reg = 0; + + if ((via_config->flags & VIA_NO_UNMASK) == 0) + d.host_flags |= IDE_HFLAG_UNMASK_IRQS; #ifdef CONFIG_PPC_CHRP if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) - d->host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; + d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; #endif - d->udma_mask = via_config->udma_mask; + d.udma_mask = via_config->udma_mask; - return ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, &d); } static const struct pci_device_id via_pci_tbl[] = { -- cgit v1.2.3 From 039788e1532368eeca1071a873c14e03920cdf38 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:34 +0200 Subject: ide: replace ide_pci_device_t by struct ide_port_info * Rename struct ide_pci_device_s to struct ide_port_info. * Remove ide_pci_device_t typedef. While at it: * Fix __ide_pci_register_driver() comment. * Fix aec62xx_init_one() comment. * Remove unused 'cds' field from ide_hwgroup_t. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 8 ++--- drivers/ide/pci/alim15x3.c | 4 +-- drivers/ide/pci/amd74xx.c | 4 +-- drivers/ide/pci/atiixp.c | 3 +- drivers/ide/pci/cmd64x.c | 4 +-- drivers/ide/pci/cs5520.c | 4 +-- drivers/ide/pci/cs5530.c | 2 +- drivers/ide/pci/cs5535.c | 2 +- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/generic.c | 4 +-- drivers/ide/pci/hpt34x.c | 4 +-- drivers/ide/pci/hpt366.c | 4 +-- drivers/ide/pci/it8213.c | 2 +- drivers/ide/pci/it821x.c | 2 +- drivers/ide/pci/jmicron.c | 2 +- drivers/ide/pci/ns87415.c | 2 +- drivers/ide/pci/opti621.c | 2 +- drivers/ide/pci/pdc202xx_new.c | 4 +-- drivers/ide/pci/pdc202xx_old.c | 4 +-- drivers/ide/pci/piix.c | 6 ++-- drivers/ide/pci/rz1000.c | 2 +- drivers/ide/pci/sc1200.c | 2 +- drivers/ide/pci/scc_pata.c | 11 +++--- drivers/ide/pci/serverworks.c | 4 +-- drivers/ide/pci/siimage.c | 2 +- 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/pci/trm290.c | 2 +- drivers/ide/pci/via82cxxx.c | 4 +-- drivers/ide/setup-pci.c | 82 ++++++++++++++++++++---------------------- include/linux/ide.h | 18 +++++----- 34 files changed, 97 insertions(+), 109 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 58fc670f913..b2dd8ce06b9 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -194,7 +194,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) } } -static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { +static struct ide_port_info aec62xx_chipsets[] __devinitdata = { { /* 0 */ .name = "AEC6210", .init_chipset = init_chipset_aec62xx, @@ -253,12 +253,12 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { * finds a device matching our IDE device tables. * * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] - * chips, pass a local copy of 'struct pci_device_id' down the call chain. + * chips, pass a local copy of 'struct ide_port_info' down the call chain. */ - + static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t d; + struct ide_port_info d; u8 idx = id->driver_data; d = aec62xx_chipsets[idx]; diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index fe816fd6766..db6b567c1ad 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -746,7 +746,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static ide_pci_device_t ali15x3_chipset __devinitdata = { +static struct ide_port_info ali15x3_chipset __devinitdata = { .name = "ALI15X3", .init_chipset = init_chipset_ali15x3, .init_hwif = init_hwif_ali15x3, @@ -772,7 +772,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev { }, }; - ide_pci_device_t d = ali15x3_chipset; + struct ide_port_info d = ali15x3_chipset; u8 rev = dev->revision; if (pci_dev_present(ati_rs100)) diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index f6aa1d7f3fc..8ef7a5183ff 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -77,7 +77,7 @@ static struct amd_ide_chip { }; static struct amd_ide_chip *amd_config; -static ide_pci_device_t *amd_chipset; +static struct ide_port_info *amd_chipset; static unsigned int amd_80w; static unsigned int amd_clock; @@ -295,7 +295,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .mwdma_mask = ATA_MWDMA2, \ } -static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { +static struct ide_port_info amd74xx_chipsets[] __devinitdata = { /* 0 */ DECLARE_AMD_DEV("AMD7401"), /* 1 */ DECLARE_AMD_DEV("AMD7409"), /* 2 */ DECLARE_AMD_DEV("AMD7411"), diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 30784305307..05972ff47cb 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -189,8 +189,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) hwif->dma_host_off = &atiixp_dma_host_off; } - -static ide_pci_device_t atiixp_pci_info[] __devinitdata = { +static struct ide_port_info atiixp_pci_info[] __devinitdata = { { /* 0 */ .name = "ATIIXP", .init_hwif = init_hwif_atiixp, diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 5c1b897017b..ae01319ed13 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -548,7 +548,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) } } -static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { +static struct ide_port_info cmd64x_chipsets[] __devinitdata = { { /* 0 */ .name = "CMD643", .init_chipset = init_chipset_cmd64x, @@ -591,7 +591,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t d; + struct ide_port_info d; u8 idx = id->driver_data; d = cmd64x_chipsets[idx]; diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index a9e1cafee69..71da68bcd11 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -141,7 +141,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static ide_pci_device_t cyrix_chipsets[] __devinitdata = { +static struct ide_port_info cyrix_chipsets[] __devinitdata = { /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), /* 1 */ DECLARE_CS_DEV("Cyrix 5520") }; @@ -154,7 +154,7 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = { static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; + struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ide_setup_pci_noise(dev, d); diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index ba0c6eba024..c08416a1e73 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -261,7 +261,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) hwif->udma_filter = cs5530_udma_filter; } -static ide_pci_device_t cs5530_chipset __devinitdata = { +static struct ide_port_info cs5530_chipset __devinitdata = { .name = "CS5530", .init_chipset = init_chipset_cs5530, .init_hwif = init_hwif_cs5530, diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 5ac82ffa5c0..c94bd06667b 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -186,7 +186,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) hwif->cbl = cs5535_cable_detect(hwif->pci_dev); } -static ide_pci_device_t cs5535_chipset __devinitdata = { +static struct ide_port_info cs5535_chipset __devinitdata = { .name = "CS5535", .init_hwif = init_hwif_cs5535, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index e70ffa90aef..c1adc1ba854 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -448,7 +448,7 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) } } -static ide_pci_device_t cy82c693_chipset __devinitdata = { +static struct ide_port_info cy82c693_chipset __devinitdata = { .name = "CY82C693", .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index b377006d416..2d869aecfb8 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c @@ -67,7 +67,7 @@ MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE st .udma_mask = ATA_UDMA6, \ } -static ide_pci_device_t generic_chipsets[] __devinitdata = { +static struct ide_port_info generic_chipsets[] __devinitdata = { /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), { /* 1 */ @@ -123,7 +123,7 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &generic_chipsets[id->driver_data]; + struct ide_port_info *d = &generic_chipsets[id->driver_data]; int ret = -ENODEV; /* Don't use the generic entry unless instructed to do so */ diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 67af1a7dde3..18eaf6b7915 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -129,7 +129,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) hwif->set_dma_mode = &hpt34x_set_mode; } -static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { +static struct ide_port_info hpt34x_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT343", .init_chipset = init_chipset_hpt34x, @@ -158,7 +158,7 @@ static ide_pci_device_t hpt34x_chipsets[] __devinitdata = { static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d; + struct ide_port_info *d; u16 pcicmd = 0; pci_read_config_word(dev, PCI_COMMAND, &pcicmd); diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 18f5b7ddaee..d95ec7d7119 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1425,7 +1425,7 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) return 0; } -static ide_pci_device_t hpt366_chipsets[] __devinitdata = { +static struct ide_port_info hpt366_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT36x", .init_chipset = init_chipset_hpt366, @@ -1510,7 +1510,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic { struct hpt_info *info = NULL; struct pci_dev *dev2 = NULL; - ide_pci_device_t d; + struct ide_port_info d; u8 idx = id->driver_data; u8 rev = dev->revision; diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index dfbe605120c..52e403f42d5 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -193,7 +193,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static ide_pci_device_t it8213_chipsets[] __devinitdata = { +static struct ide_port_info it8213_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8213"), }; diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index ec45b724720..06bd5762e0a 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -638,7 +638,7 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha .pio_mask = ATA_PIO4, \ } -static ide_pci_device_t it821x_chipsets[] __devinitdata = { +static struct ide_port_info it821x_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8212"), }; diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 2eeff670d9a..f7fcc3b2ddb 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -118,7 +118,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) hwif->cbl = ata66_jmicron(hwif); } -static ide_pci_device_t jmicron_chipset __devinitdata = { +static struct ide_port_info jmicron_chipset __devinitdata = { .name = "JMB", .init_hwif = init_hwif_jmicron, .host_flags = IDE_HFLAG_BOOTABLE, diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index d21b5892382..f80be320cb9 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c @@ -260,7 +260,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) hwif->ide_dma_end = &ns87415_ide_dma_end; } -static ide_pci_device_t ns87415_chipset __devinitdata = { +static struct ide_port_info ns87415_chipset __devinitdata = { .name = "NS87415", #ifdef CONFIG_SUPERIO .init_iops = init_iops_ns87415, diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 3573ffeaaa3..6152738c1ee 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -331,7 +331,7 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) hwif->set_pio_mode = &opti621_set_pio_mode; } -static ide_pci_device_t opti621_chipsets[] __devinitdata = { +static struct ide_port_info opti621_chipsets[] __devinitdata = { { /* 0 */ .name = "OPTI621", .init_hwif = init_hwif_opti621, diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index d1e7823454f..4dc2a8a3e4a 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -513,7 +513,7 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) .udma_mask = udma, \ } -static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { +static struct ide_port_info pdcnew_chipsets[] __devinitdata = { /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), @@ -534,7 +534,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d; + struct ide_port_info *d; struct pci_dev *bridge = dev->bus->self; u8 idx = id->driver_data; diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index d0efe17d831..9aacc2f2876 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -390,7 +390,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, .udma_mask = udma, \ } -static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { +static struct ide_port_info pdc202xx_chipsets[] __devinitdata = { { /* 0 */ .name = "PDC20246", .init_chipset = init_chipset_pdc202xx, @@ -421,7 +421,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d; + struct ide_port_info *d; u8 idx = id->driver_data; d = &pdc202xx_chipsets[idx]; diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index ec0c6e96a21..450d3d52bd1 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -396,7 +396,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif) .udma_mask = udma, \ } -static ide_pci_device_t piix_pci_info[] __devinitdata = { +static struct ide_port_info piix_pci_info[] __devinitdata = { /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ @@ -449,9 +449,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = { static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &piix_pci_info[id->driver_data]; - - return ide_setup_pci_device(dev, d); + return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); } /** diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 5f1ad9ef1fe..190af15bc83 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -49,7 +49,7 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) } } -static ide_pci_device_t rz1000_chipset __devinitdata = { +static struct ide_port_info rz1000_chipset __devinitdata = { .name = "RZ100x", .init_hwif = init_hwif_rz1000, .chipset = ide_rz1000, diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index b2423e03bf3..bebe18a7aed 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -372,7 +372,7 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) hwif->ide_dma_end = &sc1200_ide_dma_end; } -static ide_pci_device_t sc1200_chipset __devinitdata = { +static struct ide_port_info sc1200_chipset __devinitdata = { .name = "SC1200", .init_hwif = init_hwif_sc1200, .host_flags = IDE_HFLAG_SERIALIZE | diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index ae9b50331d2..cb1bfe54b49 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -538,12 +538,13 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) /** * init_setup_scc - set up an SCC PATA Controller * @dev: PCI device - * @d: IDE PCI device + * @d: IDE port info * * Perform the initial set up for this device. */ -static int __devinit init_setup_scc(struct pci_dev *dev, ide_pci_device_t *d) +static int __devinit init_setup_scc(struct pci_dev *dev, + struct ide_port_info *d) { unsigned long ctl_base; unsigned long dma_base; @@ -702,7 +703,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static ide_pci_device_t scc_chipsets[] __devinitdata = { +static struct ide_port_info scc_chipsets[] __devinitdata = { /* 0 */ DECLARE_SCC_DEV("sccIDE"), }; @@ -717,9 +718,7 @@ static ide_pci_device_t scc_chipsets[] __devinitdata = { static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &scc_chipsets[id->driver_data]; - - return init_setup_scc(dev, d); + return init_setup_scc(dev, &scc_chipsets[id->driver_data]); } /** diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 2814b47a092..be54f4fcb04 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -366,7 +366,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) } } -static ide_pci_device_t serverworks_chipsets[] __devinitdata = { +static struct ide_port_info serverworks_chipsets[] __devinitdata = { { /* 0 */ .name = "SvrWks OSB4", .init_chipset = init_chipset_svwks, @@ -423,7 +423,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t d; + struct ide_port_info d; u8 idx = id->driver_data; d = serverworks_chipsets[idx]; diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 732043b4deb..f066bc5bc07 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -905,7 +905,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static ide_pci_device_t siimage_chipsets[] __devinitdata = { +static struct ide_port_info siimage_chipsets[] __devinitdata = { /* 0 */ DECLARE_SII_DEV("SiI680"), /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 1680926acf3..8223e0e8e3f 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -579,7 +579,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) hwif->cbl = ata66_sis5513(hwif); } -static ide_pci_device_t sis5513_chipset __devinitdata = { +static struct ide_port_info sis5513_chipset __devinitdata = { .name = "SIS5513", .init_chipset = init_chipset_sis5513, .init_hwif = init_hwif_sis5513, diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 7b5f7b6d3e0..8d12888eb38 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -387,7 +387,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) hwif->serialized = hwif->mate->serialized = 1; } -static ide_pci_device_t sl82c105_chipset __devinitdata = { +static struct ide_port_info sl82c105_chipset __devinitdata = { .name = "W82C105", .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 4f22dffdf8e..9352d0c8d05 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -146,7 +146,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; } -static ide_pci_device_t slc90e66_chipset __devinitdata = { +static struct ide_port_info slc90e66_chipset __devinitdata = { .name = "SLC90E66", .init_hwif = init_hwif_slc90e66, .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 631506e9b5d..6e41ccb9f0a 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c @@ -218,7 +218,7 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, return err; } -static ide_pci_device_t tc86c001_chipset __devinitdata = { +static struct ide_port_info tc86c001_chipset __devinitdata = { .name = "TC86C001", .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 30b52f62699..0755893a3d0 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -102,7 +102,7 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) hwif->set_dma_mode = &triflex_set_mode; } -static ide_pci_device_t triflex_device __devinitdata = { +static struct ide_port_info triflex_device __devinitdata = { .name = "TRIFLEX", .init_hwif = init_hwif_triflex, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index be5d145a94f..ed19f0a3444 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -319,7 +319,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) #endif } -static ide_pci_device_t trm290_chipset __devinitdata = { +static struct ide_port_info trm290_chipset __devinitdata = { .name = "TRM290", .init_hwif = init_hwif_trm290, .chipset = ide_trm290, diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 0860b90f155..69a2a2c177e 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -432,7 +432,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->cbl = via82cxxx_cable_detect(hwif); } -static ide_pci_device_t via82cxxx_chipset __devinitdata = { +static struct ide_port_info via82cxxx_chipset __devinitdata = { .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, @@ -452,7 +452,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i struct pci_dev *isa = NULL; struct via_isa_bridge *via_config; u8 idx = id->driver_data; - ide_pci_device_t d; + struct ide_port_info d; d = via82cxxx_chipset; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 71be6999f96..3517eb0eddb 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -147,15 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) #ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_get_or_set_dma_base - setup BMIBA - * @d: IDE pci device data - * @hwif: Interface + * @d: IDE port info + * @hwif: IDE interface * * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. * Where a device has a partner that is already in DMA mode we check * and enforce IDE simplex rules. */ -static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif) +static unsigned long ide_get_or_set_dma_base(struct ide_port_info *d, ide_hwif_t *hwif) { unsigned long dma_base = 0; struct pci_dev *dev = hwif->pci_dev; @@ -225,7 +225,7 @@ static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hw } #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ -void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) +void ide_setup_pci_noise(struct pci_dev *dev, struct ide_port_info *d) { printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", d->name, pci_name(dev)); @@ -237,15 +237,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); /** * ide_pci_enable - do PCI enables * @dev: PCI device - * @d: IDE pci device data + * @d: IDE port info * * Enable the IDE PCI device. We attempt to enable the device in full * but if that fails then we only need BAR4 so we will enable that. * * Returns zero on success or an error code */ - -static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) + +static int ide_pci_enable(struct pci_dev *dev, struct ide_port_info *d) { int ret; @@ -260,9 +260,9 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) } /* - * assume all devices can do 32-bit dma for now. we can add a - * dma mask field to the ide_pci_device_t if we need it (or let - * lower level driver set the dma mask) + * assume all devices can do 32-bit DMA for now, we can add + * a DMA mask field to the struct ide_port_info if we need it + * (or let lower level driver set the DMA mask) */ ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); if (ret < 0) { @@ -284,13 +284,13 @@ out: /** * ide_pci_configure - configure an unconfigured device * @dev: PCI device - * @d: IDE pci device data + * @d: IDE port info * * Enable and configure the PCI device we have been passed. * Returns zero on success or an error code. */ - -static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) + +static int ide_pci_configure(struct pci_dev *dev, struct ide_port_info *d) { u16 pcicmd = 0; /* @@ -318,15 +318,15 @@ static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) /** * ide_pci_check_iomem - check a register is I/O - * @dev: pci device - * @d: ide_pci_device - * @bar: bar number + * @dev: PCI device + * @d: IDE port info + * @bar: BAR number * * Checks if a BAR is configured and points to MMIO space. If so * print an error and return an error code. Otherwise return 0 */ - -static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) + +static int ide_pci_check_iomem(struct pci_dev *dev, struct ide_port_info *d, int bar) { ulong flags = pci_resource_flags(dev, bar); @@ -348,7 +348,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar /** * ide_hwif_configure - configure an IDE interface * @dev: PCI device holding interface - * @d: IDE pci data + * @d: IDE port info * @mate: Paired interface if any * * Perform the initial set up for the hardware interface structure. This @@ -357,8 +357,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar * * Returns the new hardware interface structure, or NULL on a failure */ - -static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) + +static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) { unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; @@ -400,7 +400,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, } hwif->chipset = d->chipset ? d->chipset : ide_pci; hwif->pci_dev = dev; - hwif->cds = (struct ide_pci_device_s *) d; + hwif->cds = d; hwif->channel = port; if (!hwif->irq) @@ -415,21 +415,17 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, /** * ide_hwif_setup_dma - configure DMA interface * @dev: PCI device - * @d: IDE pci data - * @hwif: Hardware interface we are configuring + * @d: IDE port info + * @hwif: IDE interface * * Set up the DMA base for the interface. Enable the master bits as * necessary and attempt to bring the device DMA into a ready to use * state */ - -#ifndef CONFIG_BLK_DEV_IDEDMA_PCI -static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) -{ -} -#else -static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif) + +static void ide_hwif_setup_dma(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *hwif) { +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI u16 pcicmd; pci_read_config_word(dev, PCI_COMMAND, &pcicmd); @@ -461,13 +457,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi "(BIOS)\n", hwif->name, d->name); } } -} #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ +} /** * ide_setup_pci_controller - set up IDE PCI * @dev: PCI device - * @d: IDE PCI data + * @d: IDE port info * @noisy: verbose flag * @config: returned as 1 if we configured the hardware * @@ -475,8 +471,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi * up the PCI side of the device, checks that the device is enabled * and enables it if need be */ - -static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) + +static int ide_setup_pci_controller(struct pci_dev *dev, struct ide_port_info *d, int noisy, int *config) { int ret; u16 pcicmd; @@ -511,7 +507,7 @@ out: /** * ide_pci_setup_ports - configure ports/devices on PCI IDE * @dev: PCI device - * @d: IDE pci device info + * @d: IDE port info * @pciirq: IRQ line * @idx: ATA index table to update * @@ -524,7 +520,7 @@ out: * where the chipset setup is not the default PCI IDE one. */ -void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, u8 *idx) +void ide_pci_setup_ports(struct pci_dev *dev, struct ide_port_info *d, int pciirq, u8 *idx) { int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; ide_hwif_t *hwif, *mate = NULL; @@ -611,10 +607,11 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); * * One thing that is not standardized is the location of the * primary/secondary interface "enable/disable" bits. For chipsets that - * we "know" about, this information is in the ide_pci_device_t struct; + * we "know" about, this information is in the struct ide_port_info; * for all other chipsets, we just assume both interfaces are enabled. */ -static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, +static int do_ide_setup_pci_device(struct pci_dev *dev, + struct ide_port_info *d, u8 *idx, u8 noisy) { int tried_config = 0; @@ -671,7 +668,7 @@ out: return ret; } -int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) +int ide_setup_pci_device(struct pci_dev *dev, struct ide_port_info *d) { u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret; @@ -687,7 +684,7 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) EXPORT_SYMBOL_GPL(ide_setup_pci_device); int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, - ide_pci_device_t *d) + struct ide_port_info *d) { struct pci_dev *pdev[] = { dev1, dev2 }; int ret, i; @@ -728,9 +725,6 @@ static LIST_HEAD(ide_pci_drivers); * hands the controllers off to the core PCI code to do the rest of * the work. * - * The driver_data of the driver table must point to an ide_pci_device_t - * describing the interface. - * * Returns are the same as for pci_register_driver */ diff --git a/include/linux/ide.h b/include/linux/ide.h index ff1024eadbd..eaebd4fcb85 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -644,7 +644,7 @@ typedef struct ide_drive_s { ((1<> (c)) & 1) -struct ide_pci_device_s; +struct ide_port_info; typedef struct hwif_s { struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ @@ -680,7 +680,7 @@ typedef struct hwif_s { hwif_chipset_t chipset; /* sub-module for tuning.. */ struct pci_dev *pci_dev; /* for pci chipsets */ - struct ide_pci_device_s *cds; /* chipset device struct */ + struct ide_port_info *cds; /* chipset device struct */ ide_ack_intr_t *ack_intr; @@ -831,8 +831,6 @@ typedef struct hwgroup_s { /* for pci chipsets */ struct pci_dev *pci_dev; - /* chipset device struct */ - struct ide_pci_device_s *cds; /* current request */ struct request *rq; @@ -1152,8 +1150,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o #define ide_pci_register_driver(d) pci_register_driver(d) #endif -void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, u8 *); -extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); +void ide_pci_setup_ports(struct pci_dev *, struct ide_port_info *, int, u8 *); +void ide_setup_pci_noise(struct pci_dev *, struct ide_port_info *); extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); @@ -1229,7 +1227,7 @@ enum { # define IDE_HFLAG_OFF_BOARD 0 #endif -typedef struct ide_pci_device_s { +struct ide_port_info { char *name; unsigned int (*init_chipset)(struct pci_dev *, const char *); void (*init_iops)(ide_hwif_t *); @@ -1244,10 +1242,10 @@ typedef struct ide_pci_device_s { u8 swdma_mask; u8 mwdma_mask; u8 udma_mask; -} ide_pci_device_t; +}; -extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); -extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); +int ide_setup_pci_device(struct pci_dev *, struct ide_port_info *); +int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, struct ide_port_info *); void ide_map_sg(ide_drive_t *, struct request *); void ide_init_sg_cmd(ide_drive_t *, struct request *); -- cgit v1.2.3 From 8562043606430185cad26d085d46adcc7ad67fd1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:34 +0200 Subject: ide: constify struct ide_port_info Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 2 +- drivers/ide/pci/alim15x3.c | 2 +- drivers/ide/pci/amd74xx.c | 4 ++-- drivers/ide/pci/atiixp.c | 2 +- drivers/ide/pci/cmd64x.c | 2 +- drivers/ide/pci/cs5520.c | 4 ++-- drivers/ide/pci/cs5530.c | 2 +- drivers/ide/pci/cs5535.c | 2 +- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/generic.c | 4 ++-- drivers/ide/pci/hpt34x.c | 4 ++-- drivers/ide/pci/hpt366.c | 2 +- drivers/ide/pci/it8213.c | 2 +- drivers/ide/pci/it821x.c | 2 +- drivers/ide/pci/jmicron.c | 2 +- drivers/ide/pci/ns87415.c | 2 +- drivers/ide/pci/opti621.c | 2 +- drivers/ide/pci/pdc202xx_new.c | 4 ++-- drivers/ide/pci/pdc202xx_old.c | 4 ++-- drivers/ide/pci/piix.c | 2 +- drivers/ide/pci/rz1000.c | 2 +- drivers/ide/pci/sc1200.c | 2 +- drivers/ide/pci/scc_pata.c | 4 ++-- drivers/ide/pci/serverworks.c | 2 +- drivers/ide/pci/siimage.c | 2 +- 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/pci/trm290.c | 2 +- drivers/ide/pci/via82cxxx.c | 2 +- drivers/ide/setup-pci.c | 28 ++++++++++++++-------------- include/linux/ide.h | 10 +++++----- 34 files changed, 58 insertions(+), 58 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index b2dd8ce06b9..19ec421f7b9 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -194,7 +194,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) } } -static struct ide_port_info aec62xx_chipsets[] __devinitdata = { +static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { { /* 0 */ .name = "AEC6210", .init_chipset = init_chipset_aec62xx, diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index db6b567c1ad..a607dd31a64 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -746,7 +746,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static struct ide_port_info ali15x3_chipset __devinitdata = { +static const struct ide_port_info ali15x3_chipset __devinitdata = { .name = "ALI15X3", .init_chipset = init_chipset_ali15x3, .init_hwif = init_hwif_ali15x3, diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 8ef7a5183ff..8d4125ec252 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -77,7 +77,7 @@ static struct amd_ide_chip { }; static struct amd_ide_chip *amd_config; -static struct ide_port_info *amd_chipset; +static const struct ide_port_info *amd_chipset; static unsigned int amd_80w; static unsigned int amd_clock; @@ -295,7 +295,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .mwdma_mask = ATA_MWDMA2, \ } -static struct ide_port_info amd74xx_chipsets[] __devinitdata = { +static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { /* 0 */ DECLARE_AMD_DEV("AMD7401"), /* 1 */ DECLARE_AMD_DEV("AMD7409"), /* 2 */ DECLARE_AMD_DEV("AMD7411"), diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 05972ff47cb..ef8e0164ef7 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -189,7 +189,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) hwif->dma_host_off = &atiixp_dma_host_off; } -static struct ide_port_info atiixp_pci_info[] __devinitdata = { +static const struct ide_port_info atiixp_pci_info[] __devinitdata = { { /* 0 */ .name = "ATIIXP", .init_hwif = init_hwif_atiixp, diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index ae01319ed13..ea0143ef5fe 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -548,7 +548,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) } } -static struct ide_port_info cmd64x_chipsets[] __devinitdata = { +static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { { /* 0 */ .name = "CMD643", .init_chipset = init_chipset_cmd64x, diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 71da68bcd11..0466462fd21 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -141,7 +141,7 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static struct ide_port_info cyrix_chipsets[] __devinitdata = { +static const struct ide_port_info cyrix_chipsets[] __devinitdata = { /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), /* 1 */ DECLARE_CS_DEV("Cyrix 5520") }; @@ -154,7 +154,7 @@ static struct ide_port_info cyrix_chipsets[] __devinitdata = { static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; + const struct ide_port_info *d = &cyrix_chipsets[id->driver_data]; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; ide_setup_pci_noise(dev, d); diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index c08416a1e73..49fef84642e 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -261,7 +261,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) hwif->udma_filter = cs5530_udma_filter; } -static struct ide_port_info cs5530_chipset __devinitdata = { +static const struct ide_port_info cs5530_chipset __devinitdata = { .name = "CS5530", .init_chipset = init_chipset_cs5530, .init_hwif = init_hwif_cs5530, diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index c94bd06667b..9094916e378 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -186,7 +186,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) hwif->cbl = cs5535_cable_detect(hwif->pci_dev); } -static struct ide_port_info cs5535_chipset __devinitdata = { +static const struct ide_port_info cs5535_chipset __devinitdata = { .name = "CS5535", .init_hwif = init_hwif_cs5535, .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE | diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index c1adc1ba854..3ef4fc10fe2 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -448,7 +448,7 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) } } -static struct ide_port_info cy82c693_chipset __devinitdata = { +static const struct ide_port_info cy82c693_chipset __devinitdata = { .name = "CY82C693", .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 2d869aecfb8..f44d70852c3 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c @@ -67,7 +67,7 @@ MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE st .udma_mask = ATA_UDMA6, \ } -static struct ide_port_info generic_chipsets[] __devinitdata = { +static const struct ide_port_info generic_chipsets[] __devinitdata = { /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0), { /* 1 */ @@ -123,7 +123,7 @@ static struct ide_port_info generic_chipsets[] __devinitdata = { static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info *d = &generic_chipsets[id->driver_data]; + const struct ide_port_info *d = &generic_chipsets[id->driver_data]; int ret = -ENODEV; /* Don't use the generic entry unless instructed to do so */ diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 18eaf6b7915..ae6307fae4f 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -129,7 +129,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) hwif->set_dma_mode = &hpt34x_set_mode; } -static struct ide_port_info hpt34x_chipsets[] __devinitdata = { +static const struct ide_port_info hpt34x_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT343", .init_chipset = init_chipset_hpt34x, @@ -158,7 +158,7 @@ static struct ide_port_info hpt34x_chipsets[] __devinitdata = { static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info *d; + const struct ide_port_info *d; u16 pcicmd = 0; pci_read_config_word(dev, PCI_COMMAND, &pcicmd); diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index d95ec7d7119..612b795241b 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1425,7 +1425,7 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) return 0; } -static struct ide_port_info hpt366_chipsets[] __devinitdata = { +static const struct ide_port_info hpt366_chipsets[] __devinitdata = { { /* 0 */ .name = "HPT36x", .init_chipset = init_chipset_hpt366, diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 52e403f42d5..90b52ed37bf 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -193,7 +193,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static struct ide_port_info it8213_chipsets[] __devinitdata = { +static const struct ide_port_info it8213_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8213"), }; diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 06bd5762e0a..1a7ddd12e65 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -638,7 +638,7 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha .pio_mask = ATA_PIO4, \ } -static struct ide_port_info it821x_chipsets[] __devinitdata = { +static const struct ide_port_info it821x_chipsets[] __devinitdata = { /* 0 */ DECLARE_ITE_DEV("IT8212"), }; diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index f7fcc3b2ddb..bdf64d99770 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -118,7 +118,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) hwif->cbl = ata66_jmicron(hwif); } -static struct ide_port_info jmicron_chipset __devinitdata = { +static const struct ide_port_info jmicron_chipset __devinitdata = { .name = "JMB", .init_hwif = init_hwif_jmicron, .host_flags = IDE_HFLAG_BOOTABLE, diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index f80be320cb9..d4df4642dbb 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c @@ -260,7 +260,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) hwif->ide_dma_end = &ns87415_ide_dma_end; } -static struct ide_port_info ns87415_chipset __devinitdata = { +static const struct ide_port_info ns87415_chipset __devinitdata = { .name = "NS87415", #ifdef CONFIG_SUPERIO .init_iops = init_iops_ns87415, diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 6152738c1ee..8d28f335611 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -331,7 +331,7 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) hwif->set_pio_mode = &opti621_set_pio_mode; } -static struct ide_port_info opti621_chipsets[] __devinitdata = { +static const struct ide_port_info opti621_chipsets[] __devinitdata = { { /* 0 */ .name = "OPTI621", .init_hwif = init_hwif_opti621, diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 4dc2a8a3e4a..4234efeba60 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -513,7 +513,7 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) .udma_mask = udma, \ } -static struct ide_port_info pdcnew_chipsets[] __devinitdata = { +static const struct ide_port_info pdcnew_chipsets[] __devinitdata = { /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5), /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6), /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5), @@ -534,7 +534,7 @@ static struct ide_port_info pdcnew_chipsets[] __devinitdata = { static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info *d; + const struct ide_port_info *d; struct pci_dev *bridge = dev->bus->self; u8 idx = id->driver_data; diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 9aacc2f2876..e09742e2ba5 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -390,7 +390,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, .udma_mask = udma, \ } -static struct ide_port_info pdc202xx_chipsets[] __devinitdata = { +static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = { { /* 0 */ .name = "PDC20246", .init_chipset = init_chipset_pdc202xx, @@ -421,7 +421,7 @@ static struct ide_port_info pdc202xx_chipsets[] __devinitdata = { static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - struct ide_port_info *d; + const struct ide_port_info *d; u8 idx = id->driver_data; d = &pdc202xx_chipsets[idx]; diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 450d3d52bd1..9329d4a810e 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -396,7 +396,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif) .udma_mask = udma, \ } -static struct ide_port_info piix_pci_info[] __devinitdata = { +static const struct ide_port_info piix_pci_info[] __devinitdata = { /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 190af15bc83..6b10ae260fa 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -49,7 +49,7 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) } } -static struct ide_port_info rz1000_chipset __devinitdata = { +static const struct ide_port_info rz1000_chipset __devinitdata = { .name = "RZ100x", .init_hwif = init_hwif_rz1000, .chipset = ide_rz1000, diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index bebe18a7aed..d2c8b5524f2 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -372,7 +372,7 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) hwif->ide_dma_end = &sc1200_ide_dma_end; } -static struct ide_port_info sc1200_chipset __devinitdata = { +static const struct ide_port_info sc1200_chipset __devinitdata = { .name = "SC1200", .init_hwif = init_hwif_sc1200, .host_flags = IDE_HFLAG_SERIALIZE | diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index cb1bfe54b49..ebb7132b9b8 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c @@ -544,7 +544,7 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name) */ static int __devinit init_setup_scc(struct pci_dev *dev, - struct ide_port_info *d) + const struct ide_port_info *d) { unsigned long ctl_base; unsigned long dma_base; @@ -703,7 +703,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) .pio_mask = ATA_PIO4, \ } -static struct ide_port_info scc_chipsets[] __devinitdata = { +static const struct ide_port_info scc_chipsets[] __devinitdata = { /* 0 */ DECLARE_SCC_DEV("sccIDE"), }; diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index be54f4fcb04..a7280311357 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -366,7 +366,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) } } -static struct ide_port_info serverworks_chipsets[] __devinitdata = { +static const struct ide_port_info serverworks_chipsets[] __devinitdata = { { /* 0 */ .name = "SvrWks OSB4", .init_chipset = init_chipset_svwks, diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index f066bc5bc07..dc915cb22be 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -905,7 +905,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) .udma_mask = ATA_UDMA6, \ } -static struct ide_port_info siimage_chipsets[] __devinitdata = { +static const struct ide_port_info siimage_chipsets[] __devinitdata = { /* 0 */ DECLARE_SII_DEV("SiI680"), /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 8223e0e8e3f..6b7bb53acef 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -579,7 +579,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) hwif->cbl = ata66_sis5513(hwif); } -static struct ide_port_info sis5513_chipset __devinitdata = { +static const struct ide_port_info sis5513_chipset __devinitdata = { .name = "SIS5513", .init_chipset = init_chipset_sis5513, .init_hwif = init_hwif_sis5513, diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 8d12888eb38..147d783f752 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -387,7 +387,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) hwif->serialized = hwif->mate->serialized = 1; } -static struct ide_port_info sl82c105_chipset __devinitdata = { +static const struct ide_port_info sl82c105_chipset __devinitdata = { .name = "W82C105", .init_chipset = init_chipset_sl82c105, .init_hwif = init_hwif_sl82c105, diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 9352d0c8d05..c457bf4289c 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -146,7 +146,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; } -static struct ide_port_info slc90e66_chipset __devinitdata = { +static const struct ide_port_info slc90e66_chipset __devinitdata = { .name = "SLC90E66", .init_hwif = init_hwif_slc90e66, .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 6e41ccb9f0a..a66ebd14664 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c @@ -218,7 +218,7 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, return err; } -static struct ide_port_info tc86c001_chipset __devinitdata = { +static const struct ide_port_info tc86c001_chipset __devinitdata = { .name = "TC86C001", .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 0755893a3d0..a227c41d23a 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -102,7 +102,7 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif) hwif->set_dma_mode = &triflex_set_mode; } -static struct ide_port_info triflex_device __devinitdata = { +static const struct ide_port_info triflex_device __devinitdata = { .name = "TRIFLEX", .init_hwif = init_hwif_triflex, .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index ed19f0a3444..5011ba22e36 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -319,7 +319,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) #endif } -static struct ide_port_info trm290_chipset __devinitdata = { +static const struct ide_port_info trm290_chipset __devinitdata = { .name = "TRM290", .init_hwif = init_hwif_trm290, .chipset = ide_trm290, diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 69a2a2c177e..a0d3c16b68e 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -432,7 +432,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->cbl = via82cxxx_cable_detect(hwif); } -static struct ide_port_info via82cxxx_chipset __devinitdata = { +static const struct ide_port_info via82cxxx_chipset __devinitdata = { .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, .init_hwif = init_hwif_via82cxxx, diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 3517eb0eddb..727544c205b 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -155,7 +155,7 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) * and enforce IDE simplex rules. */ -static unsigned long ide_get_or_set_dma_base(struct ide_port_info *d, ide_hwif_t *hwif) +static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif) { unsigned long dma_base = 0; struct pci_dev *dev = hwif->pci_dev; @@ -225,7 +225,7 @@ static unsigned long ide_get_or_set_dma_base(struct ide_port_info *d, ide_hwif_t } #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ -void ide_setup_pci_noise(struct pci_dev *dev, struct ide_port_info *d) +void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) { printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", d->name, pci_name(dev)); @@ -245,7 +245,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); * Returns zero on success or an error code */ -static int ide_pci_enable(struct pci_dev *dev, struct ide_port_info *d) +static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) { int ret; @@ -290,7 +290,7 @@ out: * Returns zero on success or an error code. */ -static int ide_pci_configure(struct pci_dev *dev, struct ide_port_info *d) +static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) { u16 pcicmd = 0; /* @@ -326,7 +326,7 @@ static int ide_pci_configure(struct pci_dev *dev, struct ide_port_info *d) * print an error and return an error code. Otherwise return 0 */ -static int ide_pci_check_iomem(struct pci_dev *dev, struct ide_port_info *d, int bar) +static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar) { ulong flags = pci_resource_flags(dev, bar); @@ -358,7 +358,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, struct ide_port_info *d, int * Returns the new hardware interface structure, or NULL on a failure */ -static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) +static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) { unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; @@ -423,7 +423,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, struct ide_port_info * state */ -static void ide_hwif_setup_dma(struct pci_dev *dev, struct ide_port_info *d, ide_hwif_t *hwif) +static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif) { #ifdef CONFIG_BLK_DEV_IDEDMA_PCI u16 pcicmd; @@ -472,7 +472,7 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, struct ide_port_info *d, ide * and enables it if need be */ -static int ide_setup_pci_controller(struct pci_dev *dev, struct ide_port_info *d, int noisy, int *config) +static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config) { int ret; u16 pcicmd; @@ -520,7 +520,7 @@ out: * where the chipset setup is not the default PCI IDE one. */ -void ide_pci_setup_ports(struct pci_dev *dev, struct ide_port_info *d, int pciirq, u8 *idx) +void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) { int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; ide_hwif_t *hwif, *mate = NULL; @@ -531,8 +531,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, struct ide_port_info *d, int pciir */ for (port = 0; port < channels; ++port) { - ide_pci_enablebit_t *e = &(d->enablebits[port]); - + const ide_pci_enablebit_t *e = &(d->enablebits[port]); + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) { printk(KERN_INFO "%s: IDE port disabled\n", d->name); @@ -611,7 +611,7 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports); * for all other chipsets, we just assume both interfaces are enabled. */ static int do_ide_setup_pci_device(struct pci_dev *dev, - struct ide_port_info *d, + const struct ide_port_info *d, u8 *idx, u8 noisy) { int tried_config = 0; @@ -668,7 +668,7 @@ out: return ret; } -int ide_setup_pci_device(struct pci_dev *dev, struct ide_port_info *d) +int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) { u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret; @@ -684,7 +684,7 @@ int ide_setup_pci_device(struct pci_dev *dev, struct ide_port_info *d) EXPORT_SYMBOL_GPL(ide_setup_pci_device); int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, - struct ide_port_info *d) + const struct ide_port_info *d) { struct pci_dev *pdev[] = { dev1, dev2 }; int ret, i; diff --git a/include/linux/ide.h b/include/linux/ide.h index eaebd4fcb85..2e4b8dd03cf 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -680,7 +680,7 @@ typedef struct hwif_s { hwif_chipset_t chipset; /* sub-module for tuning.. */ struct pci_dev *pci_dev; /* for pci chipsets */ - struct ide_port_info *cds; /* chipset device struct */ + const struct ide_port_info *cds; /* chipset device struct */ ide_ack_intr_t *ack_intr; @@ -1150,8 +1150,8 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o #define ide_pci_register_driver(d) pci_register_driver(d) #endif -void ide_pci_setup_ports(struct pci_dev *, struct ide_port_info *, int, u8 *); -void ide_setup_pci_noise(struct pci_dev *, struct ide_port_info *); +void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); +void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); @@ -1244,8 +1244,8 @@ struct ide_port_info { u8 udma_mask; }; -int ide_setup_pci_device(struct pci_dev *, struct ide_port_info *); -int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, struct ide_port_info *); +int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); +int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); void ide_map_sg(ide_drive_t *, struct request *); void ide_init_sg_cmd(ide_drive_t *, struct request *); -- cgit v1.2.3 From 2047e15be4247efd430d067aae5bd24c11d99999 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: ali14xx: fix deadlock on error handling Stop abusing ide_lock lock by switching to a private locking. Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/ali14xx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 0973c85e49b..10311ecc674 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -102,6 +102,8 @@ static void outReg (u8 data, u8 reg) outb_p(data, dataPort); } +static DEFINE_SPINLOCK(ali14xx_lock); + /* * Set PIO mode for the specified drive. * This function computes timing parameters @@ -129,14 +131,14 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio) /* stuff timing parameters into controller registers */ driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&ali14xx_lock, flags); outb_p(regOn, basePort); outReg(param1, regTab[driveNum].reg1); outReg(param2, regTab[driveNum].reg2); outReg(param3, regTab[driveNum].reg3); outReg(param4, regTab[driveNum].reg4); outb_p(regOff, basePort); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&ali14xx_lock, flags); } /* -- cgit v1.2.3 From a34a8751f312bd4674d48d63556efa8f0e3a1021 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: dtc2278: fix deadlock on error handling Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/dtc2278.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 253a20fc806..acd72836877 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -67,18 +67,20 @@ static void sub22 (char b, char c) } } +static DEFINE_SPINLOCK(dtc2278_lock); + static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) { unsigned long flags; if (pio >= 3) { - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&dtc2278_lock, flags); /* * This enables PIO mode4 (3?) on the first interface */ sub22(1,0xc3); sub22(0,0xa0); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&dtc2278_lock, flags); } else { /* we don't know how to set it back again.. */ } -- cgit v1.2.3 From f949820de30b6fd0eb958f7eea87dac190de1cec Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: qd65xx: fix deadlock on error handling Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. Cc: Sergei Shtylyov Cc: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/qd65xx.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 85104bc79a1..ffd9c0556d1 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -89,13 +89,15 @@ static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ +static DEFINE_SPINLOCK(qd65xx_lock); + static void qd_write_reg (u8 content, unsigned long reg) { unsigned long flags; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&qd65xx_lock, flags); outb(content,reg); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&qd65xx_lock, flags); } static u8 __init qd_read_reg (unsigned long reg) @@ -103,9 +105,9 @@ static u8 __init qd_read_reg (unsigned long reg) unsigned long flags; u8 read; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&qd65xx_lock, flags); read = inb(reg); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&qd65xx_lock, flags); return read; } @@ -301,16 +303,15 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) static int __init qd_testreg(int port) { - u8 savereg; - u8 readreg; unsigned long flags; + u8 savereg, readreg; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&qd65xx_lock, flags); savereg = inb_p(port); outb_p(QD_TESTVAL, port); /* safe value */ readreg = inb_p(port); outb(savereg, port); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&qd65xx_lock, flags); if (savereg == QD_TESTVAL) { printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); -- cgit v1.2.3 From e65dde715c4241d6b17d86fa4ada2f78668274d9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: opti621: fix deadlock on error handling * Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/opti621.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 8d28f335611..8953d9c3926 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/opti621.c Version 0.8 Aug 27, 2007 + * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) */ @@ -133,6 +133,8 @@ static int reg_base; #define PIO_NOT_EXIST 254 #define PIO_DONT_KNOW 255 +static DEFINE_SPINLOCK(opti621_lock); + /* there are stored pio numbers from other calls of opti621_set_pio_mode */ static void compute_pios(ide_drive_t *drive, const u8 pio) /* Store values into drive->drive_data @@ -278,7 +280,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) second.recovery_time, drdy); #endif - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&opti621_lock, flags); reg_base = hwif->io_ports[IDE_DATA_OFFSET]; @@ -317,7 +319,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) /* and read prefetch for both drives */ write_reg(misc, MISC_REG); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&opti621_lock, flags); } /* -- cgit v1.2.3 From a482958bf60c434dc12ea0491938c8853d9774fb Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: slc90e66: fix deadlock on error handling * Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. * Bump driver version. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/slc90e66.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index c457bf4289c..eb4445b229e 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007 + * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007 * * Copyright (C) 2000-2002 Andre Hedrick * Copyright (C) 2006-2007 MontaVista Software, Inc. @@ -21,6 +21,8 @@ #include +static DEFINE_SPINLOCK(slc90e66_lock); + static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) { ide_hwif_t *hwif = HWIF(drive); @@ -40,7 +42,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) { 2, 1 }, { 2, 3 }, }; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&slc90e66_lock, flags); pci_read_config_word(dev, master_port, &master_data); if (pio > 1) @@ -71,7 +73,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) pci_write_config_word(dev, master_port, master_data); if (is_slave) pci_write_config_byte(dev, slave_port, slave_data); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&slc90e66_lock, flags); } static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) -- cgit v1.2.3 From 5bbcf9242d4d15027cbee9618fca4b88b7327c28 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: cmd640: fix deadlock on error handling Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. cmd640 is a bit special cause we still need to leave ide_lock for ->set_pio_mode with 'pio' argument == 8/9 (prefetch disable/enable). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cmd640.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index f369645e4d1..0e9275d7459 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -185,6 +185,8 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */ #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ +static DEFINE_SPINLOCK(cmd640_lock); + /* * These are initialized to point at the devices we control */ @@ -258,12 +260,12 @@ static u8 get_cmd640_reg_vlb (u16 reg) static u8 get_cmd640_reg(u16 reg) { - u8 b; unsigned long flags; + u8 b; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); b = __get_cmd640_reg(reg); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return b; } @@ -271,9 +273,9 @@ static void put_cmd640_reg(u16 reg, u8 val) { unsigned long flags; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); __put_cmd640_reg(reg,val); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); } static int __init match_pci_cmd640_device (void) @@ -351,7 +353,7 @@ static int __init secondary_port_responding (void) { unsigned long flags; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ udelay(100); @@ -359,11 +361,11 @@ static int __init secondary_port_responding (void) outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ udelay(100); if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 0; /* nothing responded */ } } - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 1; /* success */ } @@ -440,11 +442,11 @@ static void __init setup_device_ptrs (void) static void set_prefetch_mode (unsigned int index, int mode) { ide_drive_t *drive = cmd_drives[index]; + unsigned long flags; int reg = prefetch_regs[index]; u8 b; - unsigned long flags; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); b = __get_cmd640_reg(reg); if (mode) { /* want prefetch on? */ #if CMD640_PREFETCH_MASKS @@ -460,7 +462,7 @@ static void set_prefetch_mode (unsigned int index, int mode) b |= prefetch_masks[index]; /* disable prefetch */ } __put_cmd640_reg(reg, b); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); } /* @@ -561,7 +563,7 @@ static void program_drive_counts (unsigned int index) /* * Now that everything is ready, program the new timings */ - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); /* * Program the address_setup clocks into ARTTIM reg, * and then the active/recovery counts into the DRWTIM reg @@ -570,7 +572,7 @@ static void program_drive_counts (unsigned int index) setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; __put_cmd640_reg(arttim_regs[index], setup_count); __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); } /* @@ -630,6 +632,7 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) { + unsigned long flags; unsigned int index = 0, cycle_time; u8 b; @@ -652,7 +655,12 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) case 8: /* set prefetch off */ case 9: /* set prefetch on */ + /* + * take ide_lock for drive->[no_]unmask/[no_]io_32bit + */ + spin_lock_irqsave(&ide_lock, flags); set_prefetch_mode(index, pio & 1); + spin_unlock_irqrestore(&ide_lock, flags); printk("%s: %sabled cmd640 prefetch\n", drive->name, (pio & 1) ? "en" : "dis"); return; } @@ -670,20 +678,20 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) static int pci_conf1(void) { - u32 tmp; unsigned long flags; + u32 tmp; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); outb(0x01, 0xCFB); tmp = inl(0xCF8); outl(0x80000000, 0xCF8); if (inl(0xCF8) == 0x80000000) { outl(tmp, 0xCF8); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 1; } outl(tmp, 0xCF8); - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 0; } @@ -691,15 +699,15 @@ static int pci_conf2(void) { unsigned long flags; - spin_lock_irqsave(&ide_lock, flags); + spin_lock_irqsave(&cmd640_lock, flags); outb(0x00, 0xCFB); outb(0x00, 0xCF8); outb(0x00, 0xCFA); if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 1; } - spin_unlock_irqrestore(&ide_lock, flags); + spin_unlock_irqrestore(&cmd640_lock, flags); return 0; } -- cgit v1.2.3 From 69e88d2a754fcaf7ef8ca465586b811cf40dc479 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:35 +0200 Subject: ht6560b: fix deadlock on error handling Stop abusing ide_lock lock (switch to a private locking). Fixes same issue as fixed by Alan Cox in atiixp host driver with commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627. ht6560b is a bit special cause we still need to leave ide_lock for ->set_pio_mode with 'pio' argument == 8/9 (prefetch disable/enable). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/ht6560b.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 7f0d433cb9d..4a93adbab1d 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -247,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio) } } +static DEFINE_SPINLOCK(ht6560b_lock); + /* * Enable/Disable so called prefetch mode */ @@ -254,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) { unsigned long flags; int t = HT_PREFETCH_MODE << 8; - - spin_lock_irqsave(&ide_lock, flags); - + + spin_lock_irqsave(&ht6560b_lock, flags); + /* * Prefetch mode and unmask irq seems to conflict */ @@ -268,9 +270,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) drive->drive_data &= ~t; /* disable prefetch mode */ drive->no_unmask = 0; } - - spin_unlock_irqrestore(&ide_lock, flags); - + + spin_unlock_irqrestore(&ht6560b_lock, flags); + #ifdef DEBUG printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); #endif @@ -284,19 +286,22 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) switch (pio) { case 8: /* set prefetch off */ case 9: /* set prefetch on */ + /* + * take ide_lock for drive->[no_]unmask + */ + spin_lock_irqsave(&ide_lock, flags); ht_set_prefetch(drive, pio & 1); + spin_unlock_irqrestore(&ide_lock, flags); return; } - + timing = ht_pio2timings(drive, pio); - - spin_lock_irqsave(&ide_lock, flags); - + + spin_lock_irqsave(&ht6560b_lock, flags); drive->drive_data &= 0xff00; drive->drive_data |= timing; - - spin_unlock_irqrestore(&ide_lock, flags); - + spin_unlock_irqrestore(&ht6560b_lock, flags); + #ifdef DEBUG printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); #endif -- cgit v1.2.3 From d393aa0326436efd3cb800916b08cdac4dd1091a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: ide: take ide_lock for prefetch disable/enable in do_special() Take ide_lock for prefetch disable/enable in do_special(), then cleanup cmd640 and ht6560b host drivers. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 15 ++++++++++++++- drivers/ide/legacy/ht6560b.c | 5 ----- drivers/ide/pci/cmd640.c | 6 ------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 32eaa3f8051..e2eb408a8a1 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -800,7 +800,20 @@ static ide_startstop_t do_special (ide_drive_t *drive) s->b.set_tune = 0; if (set_pio_mode_abuse(drive->hwif, req_pio)) { - if (hwif->set_pio_mode) + + if (hwif->set_pio_mode == NULL) + return ide_stopped; + + /* + * take ide_lock for drive->[no_]unmask/[no_]io_32bit + */ + if (req_pio == 8 || req_pio == 9) { + unsigned long flags; + + spin_lock_irqsave(&ide_lock, flags); + hwif->set_pio_mode(drive, req_pio); + spin_unlock_irqrestore(&ide_lock, flags); + } else hwif->set_pio_mode(drive, req_pio); } else { int keep_dma = drive->using_dma; diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 4a93adbab1d..a4245d13f11 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -286,12 +286,7 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) switch (pio) { case 8: /* set prefetch off */ case 9: /* set prefetch on */ - /* - * take ide_lock for drive->[no_]unmask - */ - spin_lock_irqsave(&ide_lock, flags); ht_set_prefetch(drive, pio & 1); - spin_unlock_irqrestore(&ide_lock, flags); return; } diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 0e9275d7459..4aa48104e0c 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -632,7 +632,6 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) { - unsigned long flags; unsigned int index = 0, cycle_time; u8 b; @@ -655,12 +654,7 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio) case 8: /* set prefetch off */ case 9: /* set prefetch on */ - /* - * take ide_lock for drive->[no_]unmask/[no_]io_32bit - */ - spin_lock_irqsave(&ide_lock, flags); set_prefetch_mode(index, pio & 1); - spin_unlock_irqrestore(&ide_lock, flags); printk("%s: %sabled cmd640 prefetch\n", drive->name, (pio & 1) ? "en" : "dis"); return; } -- cgit v1.2.3 From ae6855c0d544739c833c42f4529465cc515d9a3e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: cs5530: remove needless ide_lock taking Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cs5530.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 49fef84642e..599408952bd 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/cs5530.c Version 0.76 Aug 3 2007 + * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007 * * Copyright (C) 2000 Andre Hedrick * Copyright (C) 2000 Mark Lord @@ -146,7 +146,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) { struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; - unsigned long flags; if (pci_resource_start(dev, 4) == 0) return -EFAULT; @@ -171,9 +170,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch goto out; } - spin_lock_irqsave(&ide_lock, flags); - /* all CPUs (there should only be one CPU with this chipset) */ - /* * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 @@ -224,8 +220,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch pci_write_config_byte(master_0, 0x42, 0x00); pci_write_config_byte(master_0, 0x43, 0xc1); - spin_unlock_irqrestore(&ide_lock, flags); - out: pci_dev_put(master_0); pci_dev_put(cs5530_0); -- cgit v1.2.3 From bde07e5eab1351109007bf375349f295977e7f53 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: ide: enhance ide_setup_pci_noise() * Print PCI device Vendor ID, Device ID and revision in ide_setup_pci_noise(). * Remove no longer needed PCI device revision printing from ide_setup_pci_controller(). Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/setup-pci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 727544c205b..02d14bf85ab 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -227,8 +227,9 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_ void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) { - printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", - d->name, pci_name(dev)); + printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at " + " PCI slot %s\n", d->name, dev->vendor, dev->device, + dev->revision, pci_name(dev)); } EXPORT_SYMBOL_GPL(ide_setup_pci_noise); @@ -497,9 +498,6 @@ static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_i printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); } - if (noisy) - printk(KERN_INFO "%s: chipset revision %d\n", - d->name, dev->revision); out: return ret; } -- cgit v1.2.3 From bbc615b16d64643a3d22ab4890fde1a685e86d83 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: ide: use __ide_end_request() in ide_end_dequeued_request() * Remove dead code for handling IDE TCQ from ide_end_dequeued_request(). * Add 'dequeue' parameter to __ide_end_request(). * Use __ide_end_request() in ide_end_dequeued_request(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e2eb408a8a1..c89f0d3058e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -55,7 +55,7 @@ #include static int __ide_end_request(ide_drive_t *drive, struct request *rq, - int uptodate, unsigned int nr_bytes) + int uptodate, unsigned int nr_bytes, int dequeue) { int ret = 1; @@ -80,9 +80,11 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { add_disk_randomness(rq->rq_disk); - if (!list_empty(&rq->queuelist)) - blkdev_dequeue_request(rq); - HWGROUP(drive)->rq = NULL; + if (dequeue) { + if (!list_empty(&rq->queuelist)) + blkdev_dequeue_request(rq); + HWGROUP(drive)->rq = NULL; + } end_that_request_last(rq, uptodate); ret = 0; } @@ -122,7 +124,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) nr_bytes = rq->hard_cur_sectors << 9; } - ret = __ide_end_request(drive, rq, uptodate, nr_bytes); + ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1); spin_unlock_irqrestore(&ide_lock, flags); return ret; @@ -255,39 +257,13 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int uptodate, int nr_sectors) { unsigned long flags; - int ret = 1; + int ret; spin_lock_irqsave(&ide_lock, flags); - BUG_ON(!blk_rq_started(rq)); - - /* - * if failfast is set on a request, override number of sectors and - * complete the whole request right now - */ - if (blk_noretry_request(rq) && end_io_error(uptodate)) - nr_sectors = rq->hard_nr_sectors; - - if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors) - rq->errors = -EIO; - - /* - * decide whether to reenable DMA -- 3 is a random magic for now, - * if we DMA timeout more than 3 times, just stay in PIO - */ - if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) { - drive->state = 0; - HWGROUP(drive)->hwif->ide_dma_on(drive); - } - - if (!end_that_request_first(rq, uptodate, nr_sectors)) { - add_disk_randomness(rq->rq_disk); - if (blk_rq_tagged(rq)) - blk_queue_end_tag(drive->queue, rq); - end_that_request_last(rq, uptodate); - ret = 0; - } + ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); spin_unlock_irqrestore(&ide_lock, flags); + return ret; } EXPORT_SYMBOL_GPL(ide_end_dequeued_request); -- cgit v1.2.3 From 8a455134091a2ed8012365fcdf5692b80c9bb192 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: ide: remove dead code from ide_driveid_update() * Remove dead code from ide_driveid_update(). While at it: * Remove useless comment. * s/HWIF(drive)/drive->hwif/ Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-iops.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index d4d790f91f9..95168833d06 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -693,35 +693,16 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive) } #endif /* CONFIG_BLK_DEV_IDEDMA */ -/* - * Update the - */ -int ide_driveid_update (ide_drive_t *drive) +int ide_driveid_update(ide_drive_t *drive) { - ide_hwif_t *hwif = HWIF(drive); + ide_hwif_t *hwif = drive->hwif; struct hd_driveid *id; -#if 0 - id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC); - if (!id) - return 0; - - taskfile_lib_get_identify(drive, (char *)&id); + unsigned long timeout, flags; - ide_fix_driveid(id); - if (id) { - drive->id->dma_ultra = id->dma_ultra; - drive->id->dma_mword = id->dma_mword; - drive->id->dma_1word = id->dma_1word; - /* anything more ? */ - kfree(id); - } - return 1; -#else /* * Re-read drive->id for possible DMA mode * change (copied from ide-probe.c) */ - unsigned long timeout, flags; SELECT_MASK(drive, 1); if (IDE_CONTROL_REG) @@ -763,7 +744,6 @@ int ide_driveid_update (ide_drive_t *drive) } return 1; -#endif } int ide_config_drive_speed(ide_drive_t *drive, u8 speed) -- cgit v1.2.3 From 52c8136137bc98103249fa195aaacaf84a970d51 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:36 +0200 Subject: ide: remove stale comments from ide-taskfile.c Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 2a3c8d49834..24c6c3f5e20 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -8,23 +8,6 @@ * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz * * The big the bad and the ugly. - * - * Problems to be fixed because of BH interface or the lack therefore. - * - * Fill me in stupid !!! - * - * HOST: - * General refers to the Controller and Driver "pair". - * DATA HANDLER: - * Under the context of Linux it generally refers to an interrupt handler. - * However, it correctly describes the 'HOST' - * DATA BLOCK: - * The amount of data needed to be transfered as predefined in the - * setup of the device. - * STORAGE ATOMIC: - * The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as - * small as a single sector or as large as the entire command block - * request. */ #include @@ -695,9 +678,6 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, return ide_do_drive_cmd(drive, &rq, ide_wait); } -/* - * FIXME : this needs to map into at taskfile. - */ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { int err = 0; @@ -761,9 +741,6 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf) return ide_do_drive_cmd(drive, &rq, ide_wait); } -/* - * FIXME : this needs to map into at taskfile. - */ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { void __user *p = (void __user *)arg; -- cgit v1.2.3 From a02bfd3ce9342453441202028df44dc58f90e225 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: ide: PCI BMDMA initialization fixes (take 2) * Set hwif->dma_base only if allocation of extra ports succeeds. While at it: * Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma() to ide_setup_dma(). * Rename 'dma_base' argument to 'base' in ide_setup_dma() (to make the code obey 80-columns limit and increase its readability). * Remove stale ide_setup_dma() comment. v2: * Change to allocate hwif->dmatable_cpu before reserving I/O ports missed teardown code (spotted by Sergei). On the second thought this change is actually unnecessary so revert it in v2. * Make ide_release_dma_engine() void and remove needless comment. Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 80b4f17f394..428f7a8a00b 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -901,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive) EXPORT_SYMBOL(ide_dma_timeout); -/* - * Needed for allowing full modular support of ide-driver - */ -static int ide_release_dma_engine(ide_hwif_t *hwif) +static void ide_release_dma_engine(ide_hwif_t *hwif) { if (hwif->dmatable_cpu) { pci_free_consistent(hwif->pci_dev, @@ -913,7 +910,6 @@ static int ide_release_dma_engine(ide_hwif_t *hwif) hwif->dmatable_dma); hwif->dmatable_cpu = NULL; } - return 1; } static int ide_release_iomio_dma(ide_hwif_t *hwif) @@ -956,12 +952,6 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in { printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); - hwif->dma_base = base; - - if(hwif->mate) - hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; - else - hwif->dma_master = base; return 0; } @@ -975,8 +965,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port return 1; } - hwif->dma_base = base; - if (hwif->cds->extra) { hwif->extra_base = base + (hwif->channel ? 8 : 16); @@ -991,10 +979,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port } } - if(hwif->mate) - hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base; - else - hwif->dma_master = base; return 0; } @@ -1006,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por return ide_iomio_dma(hwif, base, ports); } -/* - * This can be called for a dynamically installed interface. Don't __init it - */ -void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports) +void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports) { - if (ide_dma_iobase(hwif, dma_base, num_ports)) + if (ide_dma_iobase(hwif, base, num_ports)) return; if (ide_allocate_dma_engine(hwif)) { @@ -1019,6 +1000,13 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p return; } + hwif->dma_base = base; + + if (hwif->mate) + hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base; + else + hwif->dma_master = base; + if (!(hwif->dma_command)) hwif->dma_command = hwif->dma_base; if (!(hwif->dma_vendor1)) -- cgit v1.2.3 From c196567a81af6988d1a71b43dd21c47e1ff46f6e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: qd65xx: remove pointless qd_{read,write}_reg() (take 2) These functions are atomic so locking is pointless (noticed by Sergei). v2: We can now just use local_irq_save/restore() in qd_testreg() (noticed by Jeff). Cc: Sergei Shtylyov Acked-by: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/qd65xx.c | 46 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index ffd9c0556d1..912e73853fa 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -89,28 +89,6 @@ static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ -static DEFINE_SPINLOCK(qd65xx_lock); - -static void qd_write_reg (u8 content, unsigned long reg) -{ - unsigned long flags; - - spin_lock_irqsave(&qd65xx_lock, flags); - outb(content,reg); - spin_unlock_irqrestore(&qd65xx_lock, flags); -} - -static u8 __init qd_read_reg (unsigned long reg) -{ - unsigned long flags; - u8 read; - - spin_lock_irqsave(&qd65xx_lock, flags); - read = inb(reg); - spin_unlock_irqrestore(&qd65xx_lock, flags); - return read; -} - /* * qd_select: * @@ -123,7 +101,7 @@ static void qd_select (ide_drive_t *drive) (QD_TIMREG(drive) & 0x02); if (timings[index] != QD_TIMING(drive)) - qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); + outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); } /* @@ -286,7 +264,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) } if (!HWIF(drive)->channel && drive->media != ide_disk) { - qd_write_reg(0x5f, QD_CONTROL_PORT); + outb(0x5f, QD_CONTROL_PORT); printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " "and post-write buffer on %s.\n", drive->name, HWIF(drive)->name); @@ -306,12 +284,12 @@ static int __init qd_testreg(int port) unsigned long flags; u8 savereg, readreg; - spin_lock_irqsave(&qd65xx_lock, flags); + local_irq_save(flags); savereg = inb_p(port); outb_p(QD_TESTVAL, port); /* safe value */ readreg = inb_p(port); outb(savereg, port); - spin_unlock_irqrestore(&qd65xx_lock, flags); + local_irq_restore(flags); if (savereg == QD_TESTVAL) { printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); @@ -365,13 +343,13 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) if (set_pio_mode == (void *)qd6500_set_pio_mode) { // will do it for both - qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { - qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); - qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); + outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); } else { - qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); } } else { printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); @@ -394,7 +372,7 @@ static int __init qd_probe(int base) u8 config; u8 unit; - config = qd_read_reg(QD_CONFIG_PORT); + config = inb(QD_CONFIG_PORT); if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) return 1; @@ -438,7 +416,7 @@ static int __init qd_probe(int base) /* qd6580 found */ - control = qd_read_reg(QD_CONTROL_PORT); + control = inb(QD_CONTROL_PORT); printk(KERN_NOTICE "qd6580 at %#x\n", base); printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", @@ -459,7 +437,7 @@ static int __init qd_probe(int base) ide_device_add(idx); - qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); + outb(QD_DEF_CONTR, QD_CONTROL_PORT); return 1; } else { @@ -486,7 +464,7 @@ static int __init qd_probe(int base) ide_device_add(idx); - qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); + outb(QD_DEF_CONTR, QD_CONTROL_PORT); return 0; /* no other qd65xx possible */ } -- cgit v1.2.3 From d3bad45f0232e273cce9237d66c98aafe12c0b0e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: dtc2278: note on docs Signed-off-by: Alan Cox Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/dtc2278.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index acd72836877..24a845d45bd 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -83,6 +83,8 @@ static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) spin_unlock_irqrestore(&dtc2278_lock, flags); } else { /* we don't know how to set it back again.. */ + /* Actually we do - there is a data sheet available for the + Winbond but does anyone actually care */ } /* -- cgit v1.2.3 From dd35b7bb86c1ae6adddf68db71481144941246d1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: ide: check ->dma_setup() return value in flagged_taskfile() Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 24c6c3f5e20..6812f478878 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -837,9 +837,11 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) case TASKFILE_OUT_DMA: case TASKFILE_IN_DMAQ: case TASKFILE_IN_DMA: - hwif->dma_setup(drive); - hwif->dma_exec_cmd(drive, taskfile->command); - hwif->dma_start(drive); + if (!hwif->dma_setup(drive)) { + hwif->dma_exec_cmd(drive, taskfile->command); + hwif->dma_start(drive); + return ide_started; + } break; default: @@ -853,7 +855,8 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) return task->prehandler(drive, task->rq); } ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); + return ide_started; } - return ide_started; + return ide_stopped; } -- cgit v1.2.3 From eda5b359dc8372424eed94f5a3e27c2deb4e76cf Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: ide: check drive->using_dma in flagged_taskfile() Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 6812f478878..73ef6bf5fbc 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -837,6 +837,9 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) case TASKFILE_OUT_DMA: case TASKFILE_IN_DMAQ: case TASKFILE_IN_DMA: + if (!drive->using_dma) + break; + if (!hwif->dma_setup(drive)) { hwif->dma_exec_cmd(drive, taskfile->command); hwif->dma_start(drive); -- cgit v1.2.3 From 892470b26c3f24c0955bd1bd120a5397b8caeb53 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: ide: fix ->data_phase in taskfile_load_raw() It should be TASKFILE_NO_DATA, not TASKFILE_IN. Luckily ATM ->data_phase is unused if ->command_type == IDE_DRIVE_TASK_NO_DATA but this may change in the future. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 1d5f6823101..89df48fdc69 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive, memset(&args, 0, sizeof(ide_task_t)); args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.data_phase = TASKFILE_IN; + args.data_phase = TASKFILE_NO_DATA; args.handler = &task_no_data_intr; /* convert gtf to IDE Taskfile */ -- cgit v1.2.3 From 43e7c0c4bfdf750d956b4b5a617395d859f20353 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:37 +0200 Subject: ide-disk: add get_smart_data() helper Merge get_smart_values() and get_smart_thresholds() into get_smart_data() helper. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 2722d9165b6..00123d99527 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -593,28 +593,12 @@ static int smart_enable(ide_drive_t *drive) return ide_raw_taskfile(drive, &args, NULL); } -static int get_smart_values(ide_drive_t *drive, u8 *buf) +static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) { ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); - args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_VALUES; - args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; - args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; - args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; - args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; - args.command_type = IDE_DRIVE_TASK_IN; - args.data_phase = TASKFILE_IN; - args.handler = &task_in_intr; - (void) smart_enable(drive); - return ide_raw_taskfile(drive, &args, buf); -} - -static int get_smart_thresholds(ide_drive_t *drive, u8 *buf) -{ - ide_task_t args; - memset(&args, 0, sizeof(ide_task_t)); - args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_THRESHOLDS; + args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd; args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; @@ -656,7 +640,7 @@ static int proc_idedisk_read_smart_thresholds ide_drive_t *drive = (ide_drive_t *)data; int len = 0, i = 0; - if (!get_smart_thresholds(drive, page)) { + if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) { unsigned short *val = (unsigned short *) page; char *out = ((char *)val) + (SECTOR_WORDS * 4); page = out; @@ -675,7 +659,7 @@ static int proc_idedisk_read_smart_values ide_drive_t *drive = (ide_drive_t *)data; int len = 0, i = 0; - if (!get_smart_values(drive, page)) { + if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) { unsigned short *val = (unsigned short *) page; char *out = ((char *)val) + (SECTOR_WORDS * 4); page = out; -- cgit v1.2.3 From 276d789e1794560d7ce53a7f2687415e2a80bb8a Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Sat, 20 Oct 2007 00:32:38 +0200 Subject: ide: remove inclusion of non-existent io_trace.h Signed-off-by: Robert P. J. Day Cc: gadio@netvision.net.il Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-tape.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 1fa57947bca..e5a86a962b2 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -621,7 +621,6 @@ typedef struct os_dat_s { */ #define USE_IOTRACE 0 #if USE_IOTRACE -#include #define IO_IDETAPE_FIFO 500 #endif -- cgit v1.2.3