From 861e76a8ab7ba64a74c567fa8c4d1d38c4dfdd24 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 18 Nov 2005 22:08:29 +0100 Subject: [PATCH] via82cxxx IDE: remove /proc/via entry This entry adds needless complication to the driver as it requires the use of global variables to be passed into via_get_info(), making things quite ugly when we try and make this driver support multiple controllers simultaneously. This patch removes /proc/via for simplicity. On 10/13/05, Daniel Drake wrote: > Per Bart's suggestion, I've created a user-space app which shows identical > data (and doesn't even rely on the via82cxxx IDE driver). > > http://www.reactivated.net/software/viaideinfo/ > > So, I think we should be clear to drop /proc/ide/via now. Signed-off-by: Daniel Drake Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 188 -------------------------------------------- 1 file changed, 188 deletions(-) diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a4d099c937ff7..2fbc215988abe 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -105,181 +105,6 @@ static unsigned int via_80w; static unsigned int via_clock; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; -/* - * VIA /proc entry. - */ - -#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) - -#include -#include - -static u8 via_proc = 0; -static unsigned long via_base; -static struct pci_dev *bmide_dev, *isa_dev; - -static char *via_control3[] = { "No limit", "64", "128", "192" }; - -#define via_print(format, arg...) p += sprintf(p, format "\n" , ## arg) -#define via_print_drive(name, format, arg...)\ - p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n"); - - -/** - * via_get_info - generate via /proc file - * @buffer: buffer for data - * @addr: set to start of data to use - * @offset: current file offset - * @count: size of read - * - * Fills in buffer with the debugging/configuration information for - * the VIA chipset tuning and attached drives - */ - -static int via_get_info(char *buffer, char **addr, off_t offset, int count) -{ - int speed[4], cycle[4], setup[4], active[4], recover[4], den[4], - uen[4], udma[4], umul[4], active8b[4], recover8b[4]; - struct pci_dev *dev = bmide_dev; - unsigned int v, u, i; - int len; - u16 c, w; - u8 t, x; - char *p = buffer; - - via_print("----------VIA BusMastering IDE Configuration" - "----------------"); - - via_print("Driver Version: 3.38"); - via_print("South Bridge: VIA %s", - via_config->name); - - pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t); - pci_read_config_byte(dev, PCI_REVISION_ID, &x); - via_print("Revision: ISA %#x IDE %#x", t, x); - via_print("Highest DMA rate: %s", - via_dma[via_config->flags & VIA_UDMA]); - - via_print("BM-DMA base: %#lx", via_base); - via_print("PCI clock: %d.%dMHz", - via_clock / 1000, via_clock / 100 % 10); - - pci_read_config_byte(dev, VIA_MISC_1, &t); - via_print("Master Read Cycle IRDY: %dws", - (t & 64) >> 6); - via_print("Master Write Cycle IRDY: %dws", - (t & 32) >> 5); - via_print("BM IDE Status Register Read Retry: %s", - (t & 8) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_MISC_3, &t); - via_print("Max DRDY Pulse Width: %s%s", - via_control3[(t & 0x03)], (t & 0x03) ? " PCI clocks" : ""); - - via_print("-----------------------Primary IDE" - "-------Secondary IDE------"); - via_print("Read DMA FIFO flush: %10s%20s", - (t & 0x80) ? "yes" : "no", (t & 0x40) ? "yes" : "no"); - via_print("End Sector FIFO flush: %10s%20s", - (t & 0x20) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_IDE_CONFIG, &t); - via_print("Prefetch Buffer: %10s%20s", - (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no"); - via_print("Post Write Buffer: %10s%20s", - (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_IDE_ENABLE, &t); - via_print("Enabled: %10s%20s", - (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no"); - - c = inb(via_base + 0x02) | (inb(via_base + 0x0a) << 8); - via_print("Simplex only: %10s%20s", - (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no"); - - via_print("Cable Type: %10s%20s", - (via_80w & 1) ? "80w" : "40w", (via_80w & 2) ? "80w" : "40w"); - - via_print("-------------------drive0----drive1" - "----drive2----drive3-----"); - - pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); - pci_read_config_dword(dev, VIA_DRIVE_TIMING, &v); - pci_read_config_word(dev, VIA_8BIT_TIMING, &w); - - if (via_config->flags & VIA_UDMA) - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - else u = 0; - - for (i = 0; i < 4; i++) { - - setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1; - recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1; - active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1; - active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1; - recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1; - udma[i] = ((u >> ((3 - i) << 3)) & 0x7) + 2; - umul[i] = ((u >> (((3 - i) & 2) << 3)) & 0x8) ? 1 : 2; - uen[i] = ((u >> ((3 - i) << 3)) & 0x20); - den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2)); - - speed[i] = 2 * via_clock / (active[i] + recover[i]); - cycle[i] = 1000000 * (active[i] + recover[i]) / via_clock; - - if (!uen[i] || !den[i]) - continue; - - switch (via_config->flags & VIA_UDMA) { - - case VIA_UDMA_33: - speed[i] = 2 * via_clock / udma[i]; - cycle[i] = 1000000 * udma[i] / via_clock; - break; - - case VIA_UDMA_66: - speed[i] = 4 * via_clock / (udma[i] * umul[i]); - cycle[i] = 500000 * (udma[i] * umul[i]) / via_clock; - break; - - case VIA_UDMA_100: - speed[i] = 6 * via_clock / udma[i]; - cycle[i] = 333333 * udma[i] / via_clock; - break; - - case VIA_UDMA_133: - speed[i] = 8 * via_clock / udma[i]; - cycle[i] = 250000 * udma[i] / via_clock; - break; - } - } - - via_print_drive("Transfer Mode: ", "%10s", - den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO"); - - via_print_drive("Address Setup: ", "%8dns", - 1000000 * setup[i] / via_clock); - via_print_drive("Cmd Active: ", "%8dns", - 1000000 * active8b[i] / via_clock); - via_print_drive("Cmd Recovery: ", "%8dns", - 1000000 * recover8b[i] / via_clock); - via_print_drive("Data Active: ", "%8dns", - 1000000 * active[i] / via_clock); - via_print_drive("Data Recovery: ", "%8dns", - 1000000 * recover[i] / via_clock); - via_print_drive("Cycle Time: ", "%8dns", - cycle[i]); - via_print_drive("Transfer Rate: ", "%4d.%dMB/s", - speed[i] / 1000, speed[i] / 100 % 10); - - /* hoping it is less than 4K... */ - len = (p - buffer) - offset; - *addr = buffer + offset; - - return len > count ? count : len; -} - -#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ - /** * via_set_speed - write timing registers * @dev: PCI device @@ -560,19 +385,6 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const via_dma[via_config->flags & VIA_UDMA], pci_name(dev)); - /* - * Setup /proc/ide/via entry. - */ - -#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) - if (!via_proc) { - via_base = pci_resource_start(dev, 4); - bmide_dev = dev; - isa_dev = isa; - ide_pci_create_host_proc("via", via_get_info); - via_proc = 1; - } -#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ return 0; } -- cgit 1.2.3-korg From 7462cbff7d4c2dc0d182613fb4e801efb29b90ac Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 18 Nov 2005 22:09:45 +0100 Subject: [PATCH] via82cxxx IDE: support multiple controllers Support multiple controllers in the via82cxxx IDE driver. Cable detection and ISA bridge finding have been moved into their own functions. Signed-off-by: Daniel Drake Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 195 ++++++++++++++++++++++++++------------------ 1 file changed, 117 insertions(+), 78 deletions(-) diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 2fbc215988abe..cee2c374cd2f7 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -100,11 +100,15 @@ static struct via_isa_bridge { { NULL } }; -static struct via_isa_bridge *via_config; -static unsigned int via_80w; static unsigned int via_clock; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; +struct via82cxxx_dev +{ + struct via_isa_bridge *via_config; + unsigned int via_80w; +}; + /** * via_set_speed - write timing registers * @dev: PCI device @@ -114,11 +118,13 @@ static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" } * via_set_speed writes timing values to the chipset registers */ -static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) +static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) { + struct pci_dev *dev = hwif->pci_dev; + struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); u8 t; - if (~via_config->flags & VIA_BAD_AST) { + if (~vdev->via_config->flags & VIA_BAD_AST) { pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); @@ -130,7 +136,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); - switch (via_config->flags & VIA_UDMA) { + switch (vdev->via_config->flags & VIA_UDMA) { case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; @@ -154,6 +160,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) static int via_set_drive(ide_drive_t *drive, u8 speed) { ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); + struct via82cxxx_dev *vdev = ide_get_hwifdata(drive->hwif); struct ide_timing t, p; unsigned int T, UT; @@ -162,7 +169,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) T = 1000000000 / via_clock; - switch (via_config->flags & VIA_UDMA) { + switch (vdev->via_config->flags & VIA_UDMA) { case VIA_UDMA_33: UT = T; break; case VIA_UDMA_66: UT = T/2; break; case VIA_UDMA_100: UT = T/3; break; @@ -177,7 +184,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); } - via_set_speed(HWIF(drive)->pci_dev, drive->dn, &t); + via_set_speed(HWIF(drive), drive->dn, &t); if (!drive->init_speed) drive->init_speed = speed; @@ -215,20 +222,41 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) static int via82cxxx_ide_dma_check (ide_drive_t *drive) { - u16 w80 = HWIF(drive)->udma_four; + ide_hwif_t *hwif = HWIF(drive); + struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); + u16 w80 = hwif->udma_four; u16 speed = ide_find_best_mode(drive, XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | - (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); + (vdev->via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); via_set_drive(drive, speed); if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) - return HWIF(drive)->ide_dma_on(drive); - return HWIF(drive)->ide_dma_off_quietly(drive); + return hwif->ide_dma_on(drive); + return hwif->ide_dma_off_quietly(drive); +} + +static struct via_isa_bridge *via_config_find(struct pci_dev **isa) +{ + struct via_isa_bridge *via_config; + u8 t; + + for (via_config = via_isa_bridges; via_config->id; via_config++) + if ((*isa = pci_find_device(PCI_VENDOR_ID_VIA + + !!(via_config->flags & VIA_BAD_ID), + via_config->id, NULL))) { + + pci_read_config_byte(*isa, PCI_REVISION_ID, &t); + if (t >= via_config->rev_min && + t <= via_config->rev_max) + break; + } + + return via_config; } /** @@ -243,82 +271,28 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) { struct pci_dev *isa = NULL; + struct via_isa_bridge *via_config; u8 t, v; unsigned int u; - int i; /* * Find the ISA bridge to see how good the IDE is. */ - - for (via_config = via_isa_bridges; via_config->id; via_config++) - if ((isa = pci_find_device(PCI_VENDOR_ID_VIA + - !!(via_config->flags & VIA_BAD_ID), - via_config->id, NULL))) { - - pci_read_config_byte(isa, PCI_REVISION_ID, &t); - if (t >= via_config->rev_min && - t <= via_config->rev_max) - break; - } - + via_config = via_config_find(&isa); if (!via_config->id) { printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); return -ENODEV; } /* - * Check 80-wire cable presence and setup Clk66. + * Setup or disable Clk66 if appropriate */ - switch (via_config->flags & VIA_UDMA) { - - case VIA_UDMA_66: - /* Enable Clk66 */ - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); - for (i = 24; i >= 0; i -= 8) - if (((u >> (i & 16)) & 8) && - ((u >> i) & 0x20) && - (((u >> i) & 7) < 2)) { - /* - * 2x PCI clock and - * UDMA w/ < 3T/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - case VIA_UDMA_100: - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - for (i = 24; i >= 0; i -= 8) - if (((u >> i) & 0x10) || - (((u >> i) & 0x20) && - (((u >> i) & 7) < 4))) { - /* BIOS 80-wire bit or - * UDMA w/ < 60ns/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - case VIA_UDMA_133: - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - for (i = 24; i >= 0; i -= 8) - if (((u >> i) & 0x10) || - (((u >> i) & 0x20) && - (((u >> i) & 7) < 6))) { - /* BIOS 80-wire bit or - * UDMA w/ < 60ns/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - } - - /* Disable Clk66 */ - if (via_config->flags & VIA_BAD_CLK66) { + if ((via_config->flags & VIA_UDMA) == VIA_UDMA_66) { + /* Enable Clk66 */ + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); + } else if (via_config->flags & VIA_BAD_CLK66) { /* Would cause trouble on 596a and 686 */ pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); @@ -388,10 +362,75 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const return 0; } +/* + * Check and handle 80-wire cable presence + */ +static void __devinit via_cable_detect(struct pci_dev *dev, struct via82cxxx_dev *vdev) +{ + unsigned int u; + int i; + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + + switch (vdev->via_config->flags & VIA_UDMA) { + + case VIA_UDMA_66: + for (i = 24; i >= 0; i -= 8) + if (((u >> (i & 16)) & 8) && + ((u >> i) & 0x20) && + (((u >> i) & 7) < 2)) { + /* + * 2x PCI clock and + * UDMA w/ < 3T/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + case VIA_UDMA_100: + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || + (((u >> i) & 0x20) && + (((u >> i) & 7) < 4))) { + /* BIOS 80-wire bit or + * UDMA w/ < 60ns/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + case VIA_UDMA_133: + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || + (((u >> i) & 0x20) && + (((u >> i) & 7) < 6))) { + /* BIOS 80-wire bit or + * UDMA w/ < 60ns/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + } +} + static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) { + struct via82cxxx_dev *vdev = kmalloc(sizeof(struct via82cxxx_dev), + GFP_KERNEL); + struct pci_dev *isa = NULL; int i; + if (vdev == NULL) { + printk(KERN_ERR "VP_IDE: out of memory :(\n"); + return; + } + + memset(vdev, 0, sizeof(struct via82cxxx_dev)); + ide_set_hwifdata(hwif, vdev); + + vdev->via_config = via_config_find(&isa); + via_cable_detect(hwif->pci_dev, vdev); + hwif->autodma = 0; hwif->tuneproc = &via82cxxx_tune_drive; @@ -406,7 +445,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) for (i = 0; i < 2; i++) { hwif->drives[i].io_32bit = 1; - hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1; + hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; hwif->drives[i].autotune = 1; hwif->drives[i].dn = hwif->channel * 2 + i; } @@ -420,7 +459,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->swdma_mask = 0x07; if (!hwif->udma_four) - hwif->udma_four = (via_80w >> hwif->channel) & 1; + hwif->udma_four = (vdev->via_80w >> hwif->channel) & 1; hwif->ide_dma_check = &via82cxxx_ide_dma_check; if (!noautodma) hwif->autodma = 1; -- cgit 1.2.3-korg From 4ef3b8f4a5c056d5f784725974a530d1a7b4a811 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Fri, 18 Nov 2005 22:15:40 +0100 Subject: [PATCH] ide: remove ide_driver_t.owner field The structure ide_driver_t have a .owner field which is a duplicate of .gendriver.owner field (.gen_driver is a struct device_driver). This patch removes ide_driver_t's owner field. Signed-off-by: Laurent Riffard Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/scsi/ide-scsi.c | 2 +- include/linux/ide.h | 4 +++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c2f47923d174b..421b62d900afc 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -3328,8 +3328,8 @@ static ide_proc_entry_t idecd_proc[] = { #endif static ide_driver_t ide_cdrom_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-cdrom", .bus = &ide_bus_type, .probe = ide_cd_probe, diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e827b39e4b3c7..1a45f75dc9b2e 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1089,8 +1089,8 @@ static void ide_device_shutdown(struct device *dev) } static ide_driver_t idedisk_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-disk", .bus = &ide_bus_type, .probe = ide_disk_probe, diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f615ab759962d..94c147b79a497 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1925,8 +1925,8 @@ static ide_proc_entry_t idefloppy_proc[] = { static int ide_floppy_probe(struct device *); static ide_driver_t idefloppy_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-floppy", .bus = &ide_bus_type, .probe = ide_floppy_probe, diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0ac7eb8f40d53..2069dd693c9f4 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -4748,8 +4748,8 @@ static ide_proc_entry_t idetape_proc[] = { static int ide_tape_probe(struct device *); static ide_driver_t idetape_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-tape", .bus = &ide_bus_type, .probe = ide_tape_probe, diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index e1960d69fb90d..4cb1f3ed91003 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -784,8 +784,8 @@ static ide_proc_entry_t idescsi_proc[] = { #endif static ide_driver_t idescsi_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-scsi", .bus = &ide_bus_type, .probe = ide_scsi_probe, diff --git a/include/linux/ide.h b/include/linux/ide.h index ac8b25fa65065..e99019057ba61 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1089,9 +1089,11 @@ enum { /* * Subdrivers support. + * + * The gendriver.owner field should be set to the module owner of this driver. + * The gendriver.name field should be set to the name of this driver */ typedef struct ide_driver_s { - struct module *owner; const char *version; u8 media; unsigned supports_dsc_overlap : 1; -- cgit 1.2.3-korg From cc3f7ca51abb68b6ba0da719f56e33efcc2f450b Mon Sep 17 00:00:00 2001 From: Hanna Linder Date: Fri, 18 Nov 2005 22:19:15 +0100 Subject: [PATCH] alim15x3: replace pci_find_device() with pci_dev_present() From: Hanna Linder The dev returned from pci_find_device() was not used so it can be replaced with pci_dev_present(). Compile tested. Signed-off-by: Hanna Linder Signed-off-by: Maximilian Attems Signed-off-by: Domen Puncer Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 6cf49394a80f3..ecaab54149871 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -876,9 +876,14 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) { + static struct pci_device_id ati_rs100[] = { + { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) }, + { }, + }; + ide_pci_device_t *d = &ali15x3_chipset; - if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL)) + if (pci_dev_present(ati_rs100)) printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); #if defined(CONFIG_SPARC64) -- cgit 1.2.3-korg From 2fefef1828ded4df17cfb51481b9e0782d2b3ce2 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 18 Nov 2005 22:22:21 +0100 Subject: [PATCH] alim15x3: use KERN_WARNING Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index ecaab54149871..cf84350efc550 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -884,7 +884,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev ide_pci_device_t *d = &ali15x3_chipset; if (pci_dev_present(ati_rs100)) - printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); + printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); #if defined(CONFIG_SPARC64) d->init_hwif = init_hwif_common_ali15x3; -- cgit 1.2.3-korg From fba51bae8c3797034f497ed68f4ed120a903f941 Mon Sep 17 00:00:00 2001 From: Thibaut VARENE Date: Fri, 18 Nov 2005 22:37:37 +0100 Subject: [PATCH] pmac IDE: don't release empty interfaces From: Thibaut VARENE Cleaning up the hwif without knowing its previous state in pmac.c is a big and potentially dangerous job, and there seems to be no generic code interface that would provide either a way to properly release an hwif or to clean it up. Fixes OOPS for empty PMAC interface and add-on PCI controller. Acked-by: Benjamin Herrenschmidt Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ppc/pmac.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 136911a86e84f..16b28357885b3 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1401,20 +1401,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) /* We probe the hwif now */ probe_hwif_init(hwif); - /* The code IDE code will have set hwif->present if we have devices attached, - * if we don't, the discard the interface except if we are on a media bay slot - */ - if (!hwif->present && !pmif->mediabay) { - printk(KERN_INFO "ide%d: Bus empty, interface released.\n", - hwif->index); - default_hwif_iops(hwif); - for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i) - hwif->io_ports[i] = 0; - hwif->chipset = ide_unknown; - hwif->noprobe = 1; - return -ENODEV; - } - return 0; } -- cgit 1.2.3-korg From ec0fb4bd31e1ef60aa26798f594265a9ad061f21 Mon Sep 17 00:00:00 2001 From: Thibaut VARENE Date: Fri, 18 Nov 2005 22:51:48 +0100 Subject: [PATCH] aec62xxx: remove all dead (#if0'd) code Signed-off-by: Thibaut VARENE Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 52cadc005d728..a21b1e11eef4e 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -65,23 +65,6 @@ static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { #define BUSCLOCK(D) \ ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) -#if 0 - if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { - (void) pci_read_config_byte(dev, 0x54, &art); - p += sprintf(p, "DMA Mode: %s(%s)", - (c0&0x20)?((art&0x03)?"UDMA":" DMA"):" PIO", - (art&0x02)?"2":(art&0x01)?"1":"0"); - p += sprintf(p, " %s(%s)", - (c0&0x40)?((art&0x0c)?"UDMA":" DMA"):" PIO", - (art&0x08)?"2":(art&0x04)?"1":"0"); - p += sprintf(p, " %s(%s)", - (c1&0x20)?((art&0x30)?"UDMA":" DMA"):" PIO", - (art&0x20)?"2":(art&0x10)?"1":"0"); - p += sprintf(p, " %s(%s)\n", - (c1&0x40)?((art&0xc0)?"UDMA":" DMA"):" PIO", - (art&0x80)?"2":(art&0x40)?"1":"0"); - } else { -#endif /* * TO DO: active tuning and correction of cards without a bios. @@ -112,13 +95,9 @@ static u8 aec62xx_ratemask (ide_drive_t *drive) switch(hwif->pci_dev->device) { case PCI_DEVICE_ID_ARTOP_ATP865: case PCI_DEVICE_ID_ARTOP_ATP865R: -#if 0 - mode = (hwif->INB(hwif->dma_master) & 0x10) ? 4 : 3; -#else mode = (hwif->INB(((hwif->channel) ? hwif->mate->dma_status : hwif->dma_status)) & 0x10) ? 4 : 3; -#endif break; case PCI_DEVICE_ID_ARTOP_ATP860: case PCI_DEVICE_ID_ARTOP_ATP860R: @@ -263,35 +242,9 @@ static int aec62xx_irq_timeout (ide_drive_t *drive) case PCI_DEVICE_ID_ARTOP_ATP865: case PCI_DEVICE_ID_ARTOP_ATP865R: printk(" AEC62XX time out "); -#if 0 - { - int i = 0; - u8 reg49h = 0; - pci_read_config_byte(HWIF(drive)->pci_dev, 0x49, ®49h); - for (i=0;i<256;i++) - pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h|0x10); - pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h & ~0x10); - } - return 0; -#endif default: break; } -#if 0 - { - ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; - u8 tmp1 = 0, tmp2 = 0, mode6 = 0; - - pci_read_config_byte(dev, 0x44, &tmp1); - pci_read_config_byte(dev, 0x45, &tmp2); - printk(" AEC6280 r44=%x r45=%x ",tmp1,tmp2); - mode6 = HWIF(drive)->INB(((hwif->channel) ? - hwif->mate->dma_status : - hwif->dma_status)); - printk(" AEC6280 133=%x ", (mode6 & 0x10)); - } -#endif return 0; } -- cgit 1.2.3-korg From bf4c796df61c5b3772709bf0fd62296e0ae662d7 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 18 Nov 2005 22:55:47 +0100 Subject: [PATCH] siimage: docs urls Signed-off-by: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/siimage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 022d244f2eb09..f1ca154dd52ca 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -6,7 +6,13 @@ * * May be copied or modified under the terms of the GNU General Public License * - * Documentation available under NDA only + * Documentation for CMD680: + * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2 + * + * Documentation for SiI 3112: + * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2 + * + * Errata and other documentation only available under NDA. * * * FAQ Items: -- cgit 1.2.3-korg From 1e39dead2bfa8023bcdee4f1e5e6c933aff24e20 Mon Sep 17 00:00:00 2001 From: Amit Gud Date: Fri, 18 Nov 2005 23:03:19 +0100 Subject: [PATCH] cs5520: fix return value of cs5520_init_one() From: Amit Gud Patch follows from the suggestions by AC and Felipe W Damasio for fixing the return codes from IDE drivers. [ bart: fix coding style while at it ] Signed-off-by: Amit Gud Signed-off-by: Domen Puncer Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cs5520.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 7dc24682d197d..ea3c52cc8ac1c 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -222,10 +222,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic /* We must not grab the entire device, it has 'ISA' space in its BARS too and we will freak out other bits of the kernel */ - if(pci_enable_device_bars(dev, 1<<2)) - { + if (pci_enable_device_bars(dev, 1<<2)) { printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); - return 1; + return -ENODEV; } pci_set_master(dev); if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { -- cgit 1.2.3-korg From c37ea218cb43c67bf1578f5e535fcc3a751018ef Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 18 Nov 2005 23:11:24 +0100 Subject: [PATCH] ide: make comment match reality Signed-off-by: Ralf Baechle Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/setup-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d4f2111d43641..7ebf992e8c2f4 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -787,7 +787,7 @@ static int pre_init = 1; /* Before first ordered IDE scan */ static LIST_HEAD(ide_pci_drivers); /* - * __ide_register_pci_driver - attach IDE driver + * __ide_pci_register_driver - attach IDE driver * @driver: pci driver * @module: owner module of the driver * -- cgit 1.2.3-korg From 6593178dd46d64a5bcb0402a4f3acd95b0687abd Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 18 Nov 2005 23:13:33 +0100 Subject: [PATCH] ide: fix ide_toggle_bounce() to not try to bounce if we have an IOMMU The following patch fixes a crash caused by attempting to bounce buffer when an IDE CD-ROM is used on a machine with an IO-MMU. [At least, this patch fixes things so I can use my IDE CD-ROM behind an ns87415 on a HP PA-RISC workstation.] Signed-off-by: James Bottomley Signed-off-by: Kyle McMartin Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index b09a6537c7a8a..41d46dbe6c24c 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ - if (on && drive->media == ide_disk) { - if (!PCI_DMA_BUS_IS_PHYS) - addr = BLK_BOUNCE_ANY; - else if (HWIF(drive)->pci_dev) + if (!PCI_DMA_BUS_IS_PHYS) { + addr = BLK_BOUNCE_ANY; + } else if (on && drive->media == ide_disk) { + if (HWIF(drive)->pci_dev) addr = HWIF(drive)->pci_dev->dma_mask; } -- cgit 1.2.3-korg