Commit b189346c authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] ide: ide-generic, allow for capture of other unsupported devices

The ide-generic driver gives you DMA at bios tuned speed so can actually run a
lot of unsupported devices quite well.  It has a pci table so that it doesn't
grab disks owned by other drivers but no way to override this.  The patch adds
an option ide-generic-all which makes the driver grab everything going that is
IDE class.

The diff is messy because I put the special case as case 0 to make the if
conditional and long term maintenance easier.

This has been in Fedora for some time.
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Acked-by: default avatarBartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 68ad9910
...@@ -39,6 +39,17 @@ ...@@ -39,6 +39,17 @@
#include <asm/io.h> #include <asm/io.h>
static int ide_generic_all; /* Set to claim all devices */
static int __init ide_generic_all_on(char *unused)
{
ide_generic_all = 1;
printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n");
return 1;
}
__setup("all-generic-ide", ide_generic_all_on);
static void __devinit init_hwif_generic (ide_hwif_t *hwif) static void __devinit init_hwif_generic (ide_hwif_t *hwif)
{ {
switch(hwif->pci_dev->device) { switch(hwif->pci_dev->device) {
...@@ -78,79 +89,85 @@ static void __devinit init_hwif_generic (ide_hwif_t *hwif) ...@@ -78,79 +89,85 @@ static void __devinit init_hwif_generic (ide_hwif_t *hwif)
static ide_pci_device_t generic_chipsets[] __devinitdata = { static ide_pci_device_t generic_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
.name = "Unknown",
.init_hwif = init_hwif_generic,
.channels = 2,
.autodma = AUTODMA,
.bootable = ON_BOARD,
},{ /* 1 */
.name = "NS87410", .name = "NS87410",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 1 */ },{ /* 2 */
.name = "SAMURAI", .name = "SAMURAI",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 2 */ },{ /* 3 */
.name = "HT6565", .name = "HT6565",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 3 */ },{ /* 4 */
.name = "UM8673F", .name = "UM8673F",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NODMA, .autodma = NODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 4 */ },{ /* 5 */
.name = "UM8886A", .name = "UM8886A",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NODMA, .autodma = NODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 5 */ },{ /* 6 */
.name = "UM8886BF", .name = "UM8886BF",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NODMA, .autodma = NODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 6 */ },{ /* 7 */
.name = "HINT_IDE", .name = "HINT_IDE",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 7 */ },{ /* 8 */
.name = "VIA_IDE", .name = "VIA_IDE",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 8 */ },{ /* 9 */
.name = "OPTI621V", .name = "OPTI621V",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 9 */ },{ /* 10 */
.name = "VIA8237SATA", .name = "VIA8237SATA",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.bootable = OFF_BOARD, .bootable = OFF_BOARD,
},{ /* 10 */ },{ /* 11 */
.name = "Piccolo0102", .name = "Piccolo0102",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 11 */ },{ /* 12 */
.name = "Piccolo0103", .name = "Piccolo0103",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.bootable = ON_BOARD, .bootable = ON_BOARD,
},{ /* 12 */ },{ /* 13 */
.name = "Piccolo0105", .name = "Piccolo0105",
.init_hwif = init_hwif_generic, .init_hwif = init_hwif_generic,
.channels = 2, .channels = 2,
...@@ -174,6 +191,10 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi ...@@ -174,6 +191,10 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
u16 command; u16 command;
int ret = -ENODEV; int ret = -ENODEV;
/* Don't use the generic entry unless instructed to do so */
if (id->driver_data == 0 && ide_generic_all == 0)
goto out;
if (dev->vendor == PCI_VENDOR_ID_UMC && if (dev->vendor == PCI_VENDOR_ID_UMC &&
dev->device == PCI_DEVICE_ID_UMC_UM8886A && dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
(!(PCI_FUNC(dev->devfn) & 1))) (!(PCI_FUNC(dev->devfn) & 1)))
...@@ -195,21 +216,23 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi ...@@ -195,21 +216,23 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
} }
static struct pci_device_id generic_pci_tbl[] = { static struct pci_device_id generic_pci_tbl[] = {
{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
{ PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
{ PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
{ PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
{ PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
{ PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6}, { PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7},
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7}, { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8},
{ PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8}, { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9},
#ifdef CONFIG_BLK_DEV_IDE_SATA #ifdef CONFIG_BLK_DEV_IDE_SATA
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9}, { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10},
#endif #endif
{ PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10}, { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11},
{ PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11}, { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12},
{ PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13},
/* Must come last. If you add entries adjust this table appropriately and the init_one code */
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0},
{ 0, }, { 0, },
}; };
MODULE_DEVICE_TABLE(pci, generic_pci_tbl); MODULE_DEVICE_TABLE(pci, generic_pci_tbl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment