PATCH: allow ide-generic users to ask it to capture unknown devices
Most of this patch is neccessary noise to make the generic entry "id 0" so that the code is clean and won't need touching each time an identifier is aded.
drivers/ide/pci/generic.c +32 -15
@@ -41,6 +41,17 @@#include "generic.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 unsigned int __init init_chipset_generic (struct pci_dev *dev,const char *name) {return 0 ;
@@ -96,6 +107,11 @@ {ide_pci_device_t *d = &generic_chipsets[id->driver_data];u16 command; + +/* Don't use the generic entry unless instructed to do so */ +if (id->driver_data ==0 ) +if (ide_generic_all ==0 ) +return 1 ; if (dev->vendor == PCI_VENDOR_ID_UMC && dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
@@ -108,8 +124,7 @@return 1 ;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 1 ; }
@@ -118,21 +133,23 @@ }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_PCTECH ,PCI_DEVICE_ID_PCTECH_SAMURAI_IDE ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,1 }, - {PCI_VENDOR_ID_HOLTEK ,PCI_DEVICE_ID_HOLTEK_6565 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,2 }, - {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_UM8886A ,PCI_ANY_ID ,PCI_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EVICE_ID_OPTI_82C558 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,9 }, #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 - {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_1 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,11 }, - {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 ,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 }, +/* 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 , }, };MODULE_DEVICE_TABLE (pci, generic_pci_tbl);
drivers/ide/pci/generic.h +19 -12
@@ -10,6 +10,13 @@static ide_pci_device_t generic_chipsets[]__devinitdata = { {/* 0 */ + .name ="Unknown" , + .init_chipset = init_chipset_generic, + .init_hwif = init_hwif_generic, + .channels =2 , + .autodma =AUTODMA , + .bootable =ON_BOARD , + },{/* 1 */ .name ="NS87410" , .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic,
@@ -17,84 +24,84 @@ .autodma = AUTODMA, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .bootable = ON_BOARD, - },{ /* 1 */ + },{ /* 2 */ .name = "SAMURAI", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 2 */ + },{ /* 3 */ .name = "HT6565", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 3 */ + },{ /* 4 */ .name = "UM8673F", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 4 */ + },{ /* 5 */ .name = "UM8886A", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 5 */ + },{ /* 6 */ .name = "UM8886BF", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 6 */ + },{ /* 7 */ .name = "HINT_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 7 */ + },{ /* 8 */ .name = "VIA_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 8 */ + },{ /* 9 */ .name = "OPTI621V", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 9 */ + },{ /* 10 */ .name = "VIA8237SATA", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, - },{ /* 10 */ + },{ /* 11 */ .name = "Piccolo0102", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 11 */ + },{ /* 12 */ .name = "Piccolo0103", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 12 */ + },{ /* 13 */ .name = "Piccolo0105", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic,
ide-generic is drivers/ide/ide-generic
please don't use this name wrt to pci/generic.c
Quoted 3 lines · Alan Cox
Most of this patch is neccessary noise to make the generic entry "id 0" so that the code is clean and won't need touching each time an identifier is aded.
Why can't generic entry be just added at id 14 in generic_chipsets table?
What is the exact purpose of this patch?
AFAICS this option allows users to use generic code for unknown/unsupported devices which can result in unpredictable results (hangs, data corruptions).
[ I don't want any bugreports from users of this option. ]
Quoted 196 lines
diff --exclude-from
/usr/src/exclude-u --new-file --recursivelinux.vanilla-2.6.10rc1/drivers/ide/pci/generic.clinux-2.6.10rc1/drivers/ide/pci/generic.cdrivers/ide/pci/generic.c +32
-15@@ -41,6 +41,17 @@#include "generic.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 unsigned int __init init_chipset_generic (struct pci_dev *dev,const char *name) {return 0 ;@@ -96,6 +107,11 @@ {ide_pci_device_t *d = &generic_chipsets[id->driver_data];u16 command; + +/* Don't use the generic entry unless instructed to do so */ +if (id->driver_data ==0 ) +if (ide_generic_all ==0 ) +return 1 ; if (dev->vendor == PCI_VENDOR_ID_UMC && dev->device == PCI_DEVICE_ID_UMC_UM8886A &&@@ -108,8 +124,7 @@return 1 ;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 1 ; }@@ -118,21 +133,23 @@ }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_PCTECH ,PCI_DEVICE_ID_PCTECH_SAMURAI_IDE ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,1 }, - {PCI_VENDOR_ID_HOLTEK ,PCI_DEVICE_ID_HOLTEK_6565 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,2 }, - {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_UM8886A ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,4 }, - {PCI_VENDOR_ID_UMC ,PCI_DEVICE_ID_UMC_UM8886BF ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,5 }, - {PCI_VENDOR_ID_HINT ,PCI_DEVICE_ID_HINT_VXPROII_IDE ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,6 }, - {PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_82C561 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,7 }, - {PCI_VENDOR_ID_OPTI ,PCI_DEVICE_ID_OPTI_82C558 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,8 }, + {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 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ICCOLO_2 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,12 }, + {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 }, +/* 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 , }, };MODULE_DEVICE_TABLE (pci, generic_pci_tbl);diff --exclude-from
/usr/src/exclude-u --new-file --recursivelinux.vanilla-2.6.10rc1/drivers/ide/pci/generic.hlinux-2.6.10rc1/drivers/ide/pci/generic.hdrivers/ide/pci/generic.h +19
-12@@ -10,6 +10,13 @@static ide_pci_device_t generic_chipsets[]__devinitdata = { {/* 0 */ + .name ="Unknown" , + .init_chipset = init_chipset_generic, + .init_hwif = init_hwif_generic, + .channels =2 , + .autodma =AUTODMA , + .bootable =ON_BOARD , + },{/* 1 */ .name ="NS87410" , .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic,@@ -17,84 +24,84 @@ .autodma = AUTODMA, .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, .bootable = ON_BOARD, - },{ /* 1 */ + },{ /* 2 */ .name = "SAMURAI", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 2 */ + },{ /* 3 */ .name = "HT6565", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 3 */ + },{ /* 4 */ .name = "UM8673F", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 4 */ + },{ /* 5 */ .name = "UM8886A", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 5 */ + },{ /* 6 */ .name = "UM8886BF", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NODMA, .bootable = ON_BOARD, - },{ /* 6 */ + },{ /* 7 */ .name = "HINT_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD, - },{ /* 7 */ + },{ /* 8 */ .name = "VIA_IDE", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 8 */ + },{ /* 9 */ .name = "OPTI621V", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 9 */ + },{ /* 10 */ .name = "VIA8237SATA", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = AUTODMA, .bootable = OFF_BOARD, - },{ /* 10 */ + },{ /* 11 */ .name = "Piccolo0102", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 11 */ + },{ /* 12 */ .name = "Piccolo0103", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic, .channels = 2, .autodma = NOAUTODMA, .bootable = ON_BOARD, - },{ /* 12 */ + },{ /* 13 */ .name = "Piccolo0105", .init_chipset = init_chipset_generic, .init_hwif = init_hwif_generic,
Quoted 1 line · Bartlomiej Zolnierkiewicz
Why can't generic entry be just added at id 14 in
generic_chipsetstable?
Because when someone adds an entry they'll break the driver.
Quoted 4 lines
What is the exact purpose of this patch?
AFAICS this option allows users to use generic code for unknown/unsupported devices which can result in unpredictable results (hangs, data corruptions).
Correct but they must force it on by hand. It generates a printk to tell the user and so its obvious in any bug reports..
Quoted 4 lines · Alan Cox
Quoted 1 line · Bartlomiej Zolnierkiewicz
Why can't generic entry be just added at id 14 in
generic_chipsetstable?Because when someone adds an entry they'll break the driver.
Please be specific, what will break?
Quoted 7 lines
Quoted 4 lines
What is the exact purpose of this patch?
AFAICS this option allows users to use generic code for unknown/unsupported devices which can result in unpredictable results (hangs, data corruptions).
Correct but they must force it on by hand. It generates a printk to tell the user and so its obvious in any bug reports..
99% of IDE bugreports don't contain full dmesg...
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Quoted 1 line
Because when someone adds an entry they'll break the driver.
Please be specific, what will break?
The entry is currently last. Someone seeing the comment it must be last is likely to also leave it last in the table and thus the hardcoded 14 would
need to become 15. Making it "0" took away the cause.
Quoted 4 lines
Quoted 2 lines
Correct but they must force it on by hand. It generates a printk to tell the user and so its obvious in any bug reports..
99% of IDE bugreports don't contain full dmesg...
At the moment it prints it quite early. If I move the printk down I can change it so that at the point it grabs the hwif (ie right in the IDE logs)
it says "blah blah grabbing Unknown device (0x1111, 0x2222)"
Would that be preferable ?