diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 94 |
1 files changed, 59 insertions, 35 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 477afb4a9255..c6600ac965f0 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2563,48 +2563,72 @@ int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, | |||
2563 | } | 2563 | } |
2564 | 2564 | ||
2565 | static const char * const ata_dma_blacklist [] = { | 2565 | static const char * const ata_dma_blacklist [] = { |
2566 | "WDC AC11000H", | 2566 | "WDC AC11000H", NULL, |
2567 | "WDC AC22100H", | 2567 | "WDC AC22100H", NULL, |
2568 | "WDC AC32500H", | 2568 | "WDC AC32500H", NULL, |
2569 | "WDC AC33100H", | 2569 | "WDC AC33100H", NULL, |
2570 | "WDC AC31600H", | 2570 | "WDC AC31600H", NULL, |
2571 | "WDC AC32100H", | 2571 | "WDC AC32100H", "24.09P07", |
2572 | "WDC AC23200L", | 2572 | "WDC AC23200L", "21.10N21", |
2573 | "Compaq CRD-8241B", | 2573 | "Compaq CRD-8241B", NULL, |
2574 | "CRD-8400B", | 2574 | "CRD-8400B", NULL, |
2575 | "CRD-8480B", | 2575 | "CRD-8480B", NULL, |
2576 | "CRD-8482B", | 2576 | "CRD-8482B", NULL, |
2577 | "CRD-84", | 2577 | "CRD-84", NULL, |
2578 | "SanDisk SDP3B", | 2578 | "SanDisk SDP3B", NULL, |
2579 | "SanDisk SDP3B-64", | 2579 | "SanDisk SDP3B-64", NULL, |
2580 | "SANYO CD-ROM CRD", | 2580 | "SANYO CD-ROM CRD", NULL, |
2581 | "HITACHI CDR-8", | 2581 | "HITACHI CDR-8", NULL, |
2582 | "HITACHI CDR-8335", | 2582 | "HITACHI CDR-8335", NULL, |
2583 | "HITACHI CDR-8435", | 2583 | "HITACHI CDR-8435", NULL, |
2584 | "Toshiba CD-ROM XM-6202B", | 2584 | "Toshiba CD-ROM XM-6202B", NULL, |
2585 | "TOSHIBA CD-ROM XM-1702BC", | 2585 | "TOSHIBA CD-ROM XM-1702BC", NULL, |
2586 | "CD-532E-A", | 2586 | "CD-532E-A", NULL, |
2587 | "E-IDE CD-ROM CR-840", | 2587 | "E-IDE CD-ROM CR-840", NULL, |
2588 | "CD-ROM Drive/F5A", | 2588 | "CD-ROM Drive/F5A", NULL, |
2589 | "WPI CDD-820", | 2589 | "WPI CDD-820", NULL, |
2590 | "SAMSUNG CD-ROM SC-148C", | 2590 | "SAMSUNG CD-ROM SC-148C", NULL, |
2591 | "SAMSUNG CD-ROM SC", | 2591 | "SAMSUNG CD-ROM SC", NULL, |
2592 | "SanDisk SDP3B-64", | 2592 | "SanDisk SDP3B-64", NULL, |
2593 | "ATAPI CD-ROM DRIVE 40X MAXIMUM", | 2593 | "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL, |
2594 | "_NEC DV5800A", | 2594 | "_NEC DV5800A", NULL, |
2595 | "SAMSUNG CD-ROM SN-124", "N001" | ||
2595 | }; | 2596 | }; |
2597 | |||
2598 | static int ata_strim(char *s, size_t len) | ||
2599 | { | ||
2600 | len = strnlen(s, len); | ||
2601 | |||
2602 | /* ATAPI specifies that empty space is blank-filled; remove blanks */ | ||
2603 | while ((len > 0) && (s[len - 1] == ' ')) { | ||
2604 | len--; | ||
2605 | s[len] = 0; | ||
2606 | } | ||
2607 | return len; | ||
2608 | } | ||
2596 | 2609 | ||
2597 | static int ata_dma_blacklisted(const struct ata_device *dev) | 2610 | static int ata_dma_blacklisted(const struct ata_device *dev) |
2598 | { | 2611 | { |
2599 | unsigned char model_num[41]; | 2612 | unsigned char model_num[40]; |
2613 | unsigned char model_rev[16]; | ||
2614 | unsigned int nlen, rlen; | ||
2600 | int i; | 2615 | int i; |
2601 | 2616 | ||
2602 | ata_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); | 2617 | ata_id_string(dev->id, model_num, ATA_ID_PROD_OFS, |
2603 | 2618 | sizeof(model_num)); | |
2604 | for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++) | 2619 | ata_id_string(dev->id, model_rev, ATA_ID_FW_REV_OFS, |
2605 | if (!strcmp(ata_dma_blacklist[i], model_num)) | 2620 | sizeof(model_rev)); |
2606 | return 1; | 2621 | nlen = ata_strim(model_num, sizeof(model_num)); |
2622 | rlen = ata_strim(model_rev, sizeof(model_rev)); | ||
2607 | 2623 | ||
2624 | for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i += 2) { | ||
2625 | if (!strncmp(ata_dma_blacklist[i], model_num, nlen)) { | ||
2626 | if (ata_dma_blacklist[i+1] == NULL) | ||
2627 | return 1; | ||
2628 | if (!strncmp(ata_dma_blacklist[i], model_rev, rlen)) | ||
2629 | return 1; | ||
2630 | } | ||
2631 | } | ||
2608 | return 0; | 2632 | return 0; |
2609 | } | 2633 | } |
2610 | 2634 | ||