Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / ide / pci / generic.c
index 06af59f..f82e821 100644 (file)
 
 #include <asm/io.h>
 
-#include "generic.h"
-
 static int ide_generic_all;            /* Set to claim all devices */
 
+#ifndef MODULE
 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);
+#endif
 
-static unsigned int __init init_chipset_generic (struct pci_dev *dev, const char *name)
-{
-       return 0;
-}
-
-static void __init init_hwif_generic (ide_hwif_t *hwif)
+static void __devinit init_hwif_generic (ide_hwif_t *hwif)
 {
        switch(hwif->pci_dev->device) {
                case PCI_DEVICE_ID_UMC_UM8673F:
@@ -94,6 +88,101 @@ static void __init init_hwif_generic (ide_hwif_t *hwif)
        return 0;
 #endif 
 
+static ide_pci_device_t generic_chipsets[] __devinitdata = {
+       {       /* 0 */
+               .name           = "Unknown",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 1 */
+               .name           = "NS87410",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .enablebits     = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
+               .bootable       = ON_BOARD,
+        },{    /* 2 */
+               .name           = "SAMURAI",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 3 */
+               .name           = "HT6565",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 4 */
+               .name           = "UM8673F",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 5 */
+               .name           = "UM8886A",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 6 */
+               .name           = "UM8886BF",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 7 */
+               .name           = "HINT_IDE",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 8 */
+               .name           = "VIA_IDE",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NOAUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 9 */
+               .name           = "OPTI621V",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NOAUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 10 */
+               .name           = "VIA8237SATA",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = OFF_BOARD,
+       },{     /* 11 */
+               .name           = "Piccolo0102",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NOAUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 12 */
+               .name           = "Piccolo0103",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NOAUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 13 */
+               .name           = "Piccolo0105",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = NOAUTODMA,
+               .bootable       = ON_BOARD,
+       },{     /* 14 */
+               .name           = "Revolution",
+               .init_hwif      = init_hwif_generic,
+               .channels       = 2,
+               .autodma        = AUTODMA,
+               .bootable       = OFF_BOARD,
+       }
+};
+
 /**
  *     generic_init_one        -       called when a PIIX is found
  *     @dev: the generic device
@@ -107,34 +196,30 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
 {
        ide_pci_device_t *d = &generic_chipsets[id->driver_data];
        u16 command;
-       
+       int ret = -ENODEV;
+
        /* Don't use the generic entry unless instructed to do so */
-       if (id->driver_data == 0)
-               if(ide_generic_all == 0)
-                       return -ENODEV;
+       if (id->driver_data == 0 && ide_generic_all == 0)
+                       goto out;
 
        if (dev->vendor == PCI_VENDOR_ID_UMC &&
            dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
            (!(PCI_FUNC(dev->devfn) & 1)))
-               return -EAGAIN; /* UM8886A/BF pair */
+               goto out; /* UM8886A/BF pair */
 
        if (dev->vendor == PCI_VENDOR_ID_OPTI &&
            dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
            (!(PCI_FUNC(dev->devfn) & 1)))
-               return -EAGAIN;
+               goto out;
 
        pci_read_config_word(dev, PCI_COMMAND, &command);
-       if(!(command & PCI_COMMAND_IO)) {
+       if (!(command & PCI_COMMAND_IO)) {
                printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
-               return -ENODEV; 
+               goto out;
        }
-       ide_setup_pci_device(dev, d);
-       return 0;
-}
-
-static void __devexit generic_remove_one(struct pci_dev *dev)
-{
-       ide_pci_remove_hwifs(dev);
+       ret = ide_setup_pci_device(dev, d);
+out:
+       return ret;
 }
 
 static struct pci_device_id generic_pci_tbl[] = {
@@ -153,6 +238,7 @@ static struct pci_device_id generic_pci_tbl[] = {
        { 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, 12},
        { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2,   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13},
+       { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION,          PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14},
        /* 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, },
@@ -163,7 +249,6 @@ static struct pci_driver driver = {
        .name           = "PCI_IDE",
        .id_table       = generic_pci_tbl,
        .probe          = generic_init_one,
-       .remove         = __devexit_p(generic_remove_one),
 };
 
 static int generic_ide_init(void)
@@ -173,14 +258,6 @@ static int generic_ide_init(void)
 
 module_init(generic_ide_init);
 
-static void generic_ide_exit(void)
-{
-       return ide_pci_unregister_driver(&driver);
-}
-
-module_exit(generic_ide_exit);
-
-
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for generic PCI IDE");
 MODULE_LICENSE("GPL");