Commit 2724a14b authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] fix duplication of DMA {black,white}list in icside.c

Always compile ide-dma.c if CONFIG_BLK_DEV_IDEDMA=y, mark PCI specific code
with CONFIG_BLK_DEV_IDEDMA_PCI for now (it should migrate to ide_pcidma.c
over a time).  This fixes a small bug - in_drive_list() from icside.c used
!strstr() instead of strstr() so it was missing two entries from a blacklist.
parent 7de2696d
...@@ -20,7 +20,7 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o ...@@ -20,7 +20,7 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o
# Core IDE code - must come before legacy # Core IDE code - must come before legacy
ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
ide-core-$(CONFIG_BLK_DEV_IDEDMA_PCI) += ide-dma.o ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o
ide-core-$(CONFIG_PROC_FS) += ide-proc.o ide-core-$(CONFIG_PROC_FS) += ide-proc.o
ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
......
...@@ -330,72 +330,6 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode) ...@@ -330,72 +330,6 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode)
return on; return on;
} }
/*
* The following is a sick duplication from ide-dma.c ;(
*
* This should be defined in one place only.
*/
struct drive_list_entry {
const char * id_model;
const char * id_firmware;
};
static const struct drive_list_entry drive_whitelist [] = {
{ "Micropolis 2112A", "ALL" },
{ "CONNER CTMA 4000", "ALL" },
{ "CONNER CTT8000-A", "ALL" },
{ "ST34342A", "ALL" },
{ NULL, NULL }
};
static struct drive_list_entry drive_blacklist [] = {
{ "WDC AC11000H", "ALL" },
{ "WDC AC22100H", "ALL" },
{ "WDC AC32500H", "ALL" },
{ "WDC AC33100H", "ALL" },
{ "WDC AC31600H", "ALL" },
{ "WDC AC32100H", "24.09P07" },
{ "WDC AC23200L", "21.10N21" },
{ "Compaq CRD-8241B", "ALL" },
{ "CRD-8400B", "ALL" },
{ "CRD-8480B", "ALL" },
{ "CRD-8480C", "ALL" },
{ "CRD-8482B", "ALL" },
{ "CRD-84", "ALL" },
{ "SanDisk SDP3B", "ALL" },
{ "SanDisk SDP3B-64", "ALL" },
{ "SANYO CD-ROM CRD", "ALL" },
{ "HITACHI CDR-8", "ALL" },
{ "HITACHI CDR-8335", "ALL" },
{ "HITACHI CDR-8435", "ALL" },
{ "Toshiba CD-ROM XM-6202B", "ALL" },
{ "CD-532E-A", "ALL" },
{ "E-IDE CD-ROM CR-840", "ALL" },
{ "CD-ROM Drive/F5A", "ALL" },
{ "RICOH CD-R/RW MP7083A", "ALL" },
{ "WPI CDD-820", "ALL" },
{ "SAMSUNG CD-ROM SC-148C", "ALL" },
{ "SAMSUNG CD-ROM SC-148F", "ALL" },
{ "SAMSUNG CD-ROM SC", "ALL" },
{ "SanDisk SDP3B-64", "ALL" },
{ "SAMSUNG CD-ROM SN-124", "ALL" },
{ "PLEXTOR CD-R PX-W8432T", "ALL" },
{ "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" },
{ "_NEC DV5800A", "ALL" },
{ NULL, NULL }
};
static int
in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
{
for ( ; drive_table->id_model ; drive_table++)
if ((!strcmp(drive_table->id_model, id->model)) &&
((!strstr(drive_table->id_firmware, id->fw_rev)) ||
(!strcmp(drive_table->id_firmware, "ALL"))))
return 1;
return 0;
}
static int icside_dma_host_off(ide_drive_t *drive) static int icside_dma_host_off(ide_drive_t *drive)
{ {
return 0; return 0;
...@@ -437,11 +371,8 @@ static int icside_dma_check(ide_drive_t *drive) ...@@ -437,11 +371,8 @@ static int icside_dma_check(ide_drive_t *drive)
/* /*
* Consult the list of known "bad" drives * Consult the list of known "bad" drives
*/ */
if (in_drive_list(id, drive_blacklist)) { if (__ide_dma_bad_drive(drive))
printk("%s: Disabling DMA for %s (blacklisted)\n",
drive->name, id->model);
goto out; goto out;
}
/* /*
* Enable DMA on any drive that has multiword DMA * Enable DMA on any drive that has multiword DMA
...@@ -454,7 +385,7 @@ static int icside_dma_check(ide_drive_t *drive) ...@@ -454,7 +385,7 @@ static int icside_dma_check(ide_drive_t *drive)
/* /*
* Consult the list of known "good" drives * Consult the list of known "good" drives
*/ */
if (in_drive_list(id, drive_whitelist)) { if (__ide_dma_good_drive(drive)) {
if (id->eide_dma_time > 150) if (id->eide_dma_time > 150)
goto out; goto out;
xfer_mode = XFER_MW_DMA_1; xfer_mode = XFER_MW_DMA_1;
......
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
#include <asm/irq.h> #include <asm/irq.h>
struct drive_list_entry { struct drive_list_entry {
char * id_model; const char *id_model;
char * id_firmware; const char *id_firmware;
}; };
struct drive_list_entry drive_whitelist [] = { static const struct drive_list_entry drive_whitelist [] = {
{ "Micropolis 2112A" , "ALL" }, { "Micropolis 2112A" , "ALL" },
{ "CONNER CTMA 4000" , "ALL" }, { "CONNER CTMA 4000" , "ALL" },
...@@ -103,7 +103,7 @@ struct drive_list_entry drive_whitelist [] = { ...@@ -103,7 +103,7 @@ struct drive_list_entry drive_whitelist [] = {
{ 0 , 0 } { 0 , 0 }
}; };
struct drive_list_entry drive_blacklist [] = { static const struct drive_list_entry drive_blacklist [] = {
{ "WDC AC11000H" , "ALL" }, { "WDC AC11000H" , "ALL" },
{ "WDC AC22100H" , "ALL" }, { "WDC AC22100H" , "ALL" },
...@@ -151,7 +151,7 @@ struct drive_list_entry drive_blacklist [] = { ...@@ -151,7 +151,7 @@ struct drive_list_entry drive_blacklist [] = {
* Returns 1 if the drive is found in the table. * Returns 1 if the drive is found in the table.
*/ */
static int in_drive_list(struct hd_driveid *id, struct drive_list_entry * drive_table) static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
{ {
for ( ; drive_table->id_model ; drive_table++) for ( ; drive_table->id_model ; drive_table++)
if ((!strcmp(drive_table->id_model, id->model)) && if ((!strcmp(drive_table->id_model, id->model)) &&
...@@ -161,6 +161,7 @@ static int in_drive_list(struct hd_driveid *id, struct drive_list_entry * drive_ ...@@ -161,6 +161,7 @@ static int in_drive_list(struct hd_driveid *id, struct drive_list_entry * drive_
return 0; return 0;
} }
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
/** /**
* ide_dma_intr - IDE DMA interrupt handler * ide_dma_intr - IDE DMA interrupt handler
* @drive: the drive the interrupt is for * @drive: the drive the interrupt is for
...@@ -764,6 +765,7 @@ int __ide_dma_test_irq (ide_drive_t *drive) ...@@ -764,6 +765,7 @@ int __ide_dma_test_irq (ide_drive_t *drive)
} }
EXPORT_SYMBOL(__ide_dma_test_irq); EXPORT_SYMBOL(__ide_dma_test_irq);
#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
int __ide_dma_bad_drive (ide_drive_t *drive) int __ide_dma_bad_drive (ide_drive_t *drive)
{ {
...@@ -771,8 +773,9 @@ int __ide_dma_bad_drive (ide_drive_t *drive) ...@@ -771,8 +773,9 @@ int __ide_dma_bad_drive (ide_drive_t *drive)
int blacklist = in_drive_list(id, drive_blacklist); int blacklist = in_drive_list(id, drive_blacklist);
if (blacklist) { if (blacklist) {
printk(KERN_WARNING "%s: Disabling (U)DMA for %s\n", drive->name, id->model); printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
return(blacklist); drive->name, id->model);
return blacklist;
} }
return 0; return 0;
} }
...@@ -787,6 +790,7 @@ int __ide_dma_good_drive (ide_drive_t *drive) ...@@ -787,6 +790,7 @@ int __ide_dma_good_drive (ide_drive_t *drive)
EXPORT_SYMBOL(__ide_dma_good_drive); EXPORT_SYMBOL(__ide_dma_good_drive);
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
/* /*
* Used for HOST FIFO counters for VDMA * Used for HOST FIFO counters for VDMA
* PIO over DMA, effective ATA-Bridge operator. * PIO over DMA, effective ATA-Bridge operator.
...@@ -1104,3 +1108,4 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p ...@@ -1104,3 +1108,4 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
} }
EXPORT_SYMBOL_GPL(ide_setup_dma); EXPORT_SYMBOL_GPL(ide_setup_dma);
#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
...@@ -1597,6 +1597,10 @@ extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_de ...@@ -1597,6 +1597,10 @@ extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_de
#define BAD_DMA_DRIVE 0 #define BAD_DMA_DRIVE 0
#define GOOD_DMA_DRIVE 1 #define GOOD_DMA_DRIVE 1
#ifdef CONFIG_BLK_DEV_IDEDMA
int __ide_dma_bad_drive(ide_drive_t *);
int __ide_dma_good_drive(ide_drive_t *);
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
extern int ide_build_sglist(ide_drive_t *, struct request *); extern int ide_build_sglist(ide_drive_t *, struct request *);
extern int ide_raw_build_sglist(ide_drive_t *, struct request *); extern int ide_raw_build_sglist(ide_drive_t *, struct request *);
...@@ -1618,8 +1622,6 @@ extern int __ide_dma_write(ide_drive_t *); ...@@ -1618,8 +1622,6 @@ extern int __ide_dma_write(ide_drive_t *);
extern int __ide_dma_begin(ide_drive_t *); extern int __ide_dma_begin(ide_drive_t *);
extern int __ide_dma_end(ide_drive_t *); extern int __ide_dma_end(ide_drive_t *);
extern int __ide_dma_test_irq(ide_drive_t *); extern int __ide_dma_test_irq(ide_drive_t *);
extern int __ide_dma_bad_drive(ide_drive_t *);
extern int __ide_dma_good_drive(ide_drive_t *);
extern int __ide_dma_count(ide_drive_t *); extern int __ide_dma_count(ide_drive_t *);
extern int __ide_dma_verbose(ide_drive_t *); extern int __ide_dma_verbose(ide_drive_t *);
extern int __ide_dma_lostirq(ide_drive_t *); extern int __ide_dma_lostirq(ide_drive_t *);
...@@ -1637,6 +1639,8 @@ extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive); ...@@ -1637,6 +1639,8 @@ extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive);
static inline void ide_release_dma(ide_hwif_t *drive) {;} static inline void ide_release_dma(ide_hwif_t *drive) {;}
#endif #endif
#endif /* CONFIG_BLK_DEV_IDEDMA */
extern int ide_hwif_request_regions(ide_hwif_t *hwif); extern int ide_hwif_request_regions(ide_hwif_t *hwif);
extern void ide_hwif_release_regions(ide_hwif_t* hwif); extern void ide_hwif_release_regions(ide_hwif_t* hwif);
extern void ide_unregister (unsigned int index); extern void ide_unregister (unsigned int index);
......
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