19ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz/*
29ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz * PIO blacklist.  Some drives incorrectly report their maximal PIO mode,
39ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz * at least in respect to CMD640.  Here we keep info on some known drives.
49ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *
59ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz * Changes to the ide_pio_blacklist[] should be made with EXTREME CAUTION
69ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz * to avoid breaking the fragile cmd640.c support.
79ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz */
89ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
99ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz#include <linux/string.h>
1061eae5bb06496a6633ba000a1d7546b494e00081Rashika Kheria#include <linux/ide.h>
119ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
129ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewiczstatic struct ide_pio_info {
139ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	const char	*name;
149ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	int		pio;
159ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz} ide_pio_blacklist [] = {
169ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Conner Peripherals 540MB - CFS540A", 3 },
179ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
189ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2700",  3 },
199ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2540",  3 },
209ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2420",  3 },
219ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2340",  3 },
229ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2250",  0 },
239ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2200",  0 },
249ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC21200", 4 },
259ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2120",  0 },
269ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC2850",  3 },
279ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC1270",  3 },
289ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC1170",  1 },
299ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC1210",  1 },
309ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC280",   0 },
319ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC31000", 3 },
329ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "WDC AC31200", 3 },
339ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
349ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7131 AT", 1 },
359ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7171 AT", 1 },
369ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7213 AT", 1 },
379ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7245 AT", 1 },
389ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7345 AT", 1 },
399ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7546 AT", 3 },
409ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "Maxtor 7540 AV", 3 },
419ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
429ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "SAMSUNG SHD-3121A", 1 },
439ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "SAMSUNG SHD-3122A", 1 },
449ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "SAMSUNG SHD-3172A", 1 },
459ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
469ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST5660A",  3 },
479ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3660A",  3 },
489ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3630A",  3 },
499ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3655A",  3 },
509ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3391A",  3 },
519ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3390A",  1 },
529ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3600A",  1 },
539ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3290A",  0 },
549ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3144A",  0 },
559ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "ST3491A",  1 }, /* reports 3, should be 1 or 2 (depending on drive)
569ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz			      according to Seagate's FIND-ATA program */
579ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
589ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM ELS127A", 0 },
599ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM ELS170A", 0 },
609ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LPS240A", 0 },
619ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LPS210A", 3 },
629ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LPS270A", 3 },
639ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LPS365A", 3 },
649ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LPS540A", 3 },
659ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LIGHTNING 540A", 3 },
669ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM LIGHTNING 730A", 3 },
679ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
689ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM FIREBALL_540", 3 }, /* Older Quantum Fireballs don't work */
699ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM FIREBALL_640", 3 },
709ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM FIREBALL_1080", 3 },
719ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ "QUANTUM FIREBALL_1280", 3 },
729ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	{ NULL, 0 }
739ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz};
749ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
759ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz/**
769ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	ide_scan_pio_blacklist 	-	check for a blacklisted drive
779ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	@model: Drive model string
789ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *
799ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	This routine searches the ide_pio_blacklist for an entry
809ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	matching the start/whole of the supplied model name.
819ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *
829ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	Returns -1 if no match found.
839ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz *	Otherwise returns the recommended PIO mode from ide_pio_blacklist[].
849ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz */
859ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
869ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewiczint ide_scan_pio_blacklist(char *model)
879ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz{
889ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	struct ide_pio_info *p;
899ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz
909ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	for (p = ide_pio_blacklist; p->name != NULL; p++) {
919ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz		if (strncmp(p->name, model, strlen(p->name)) == 0)
929ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz			return p->pio;
939ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	}
949ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz	return -1;
959ad540937554a3779c5fe7af13aa390b1d2aeb3eBartlomiej Zolnierkiewicz}
96