1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * PIO blacklist.  Some drives incorrectly report their maximal PIO mode,
4  * at least in respect to CMD640.  Here we keep info on some known drives.
5  *
6  * Changes to the ide_pio_blacklist[] should be made with EXTREME CAUTION
7  * to avoid breaking the fragile cmd640.c support.
8  */
9 
10 #include <linux/string.h>
11 #include <linux/ide.h>
12 
13 static struct ide_pio_info {
14 	const char	*name;
15 	int		pio;
16 } ide_pio_blacklist [] = {
17 	{ "Conner Peripherals 540MB - CFS540A", 3 },
18 
19 	{ "WDC AC2700",  3 },
20 	{ "WDC AC2540",  3 },
21 	{ "WDC AC2420",  3 },
22 	{ "WDC AC2340",  3 },
23 	{ "WDC AC2250",  0 },
24 	{ "WDC AC2200",  0 },
25 	{ "WDC AC21200", 4 },
26 	{ "WDC AC2120",  0 },
27 	{ "WDC AC2850",  3 },
28 	{ "WDC AC1270",  3 },
29 	{ "WDC AC1170",  1 },
30 	{ "WDC AC1210",  1 },
31 	{ "WDC AC280",   0 },
32 	{ "WDC AC31000", 3 },
33 	{ "WDC AC31200", 3 },
34 
35 	{ "Maxtor 7131 AT", 1 },
36 	{ "Maxtor 7171 AT", 1 },
37 	{ "Maxtor 7213 AT", 1 },
38 	{ "Maxtor 7245 AT", 1 },
39 	{ "Maxtor 7345 AT", 1 },
40 	{ "Maxtor 7546 AT", 3 },
41 	{ "Maxtor 7540 AV", 3 },
42 
43 	{ "SAMSUNG SHD-3121A", 1 },
44 	{ "SAMSUNG SHD-3122A", 1 },
45 	{ "SAMSUNG SHD-3172A", 1 },
46 
47 	{ "ST5660A",  3 },
48 	{ "ST3660A",  3 },
49 	{ "ST3630A",  3 },
50 	{ "ST3655A",  3 },
51 	{ "ST3391A",  3 },
52 	{ "ST3390A",  1 },
53 	{ "ST3600A",  1 },
54 	{ "ST3290A",  0 },
55 	{ "ST3144A",  0 },
56 	{ "ST3491A",  1 }, /* reports 3, should be 1 or 2 (depending on drive)
57 			      according to Seagate's FIND-ATA program */
58 
59 	{ "QUANTUM ELS127A", 0 },
60 	{ "QUANTUM ELS170A", 0 },
61 	{ "QUANTUM LPS240A", 0 },
62 	{ "QUANTUM LPS210A", 3 },
63 	{ "QUANTUM LPS270A", 3 },
64 	{ "QUANTUM LPS365A", 3 },
65 	{ "QUANTUM LPS540A", 3 },
66 	{ "QUANTUM LIGHTNING 540A", 3 },
67 	{ "QUANTUM LIGHTNING 730A", 3 },
68 
69 	{ "QUANTUM FIREBALL_540", 3 }, /* Older Quantum Fireballs don't work */
70 	{ "QUANTUM FIREBALL_640", 3 },
71 	{ "QUANTUM FIREBALL_1080", 3 },
72 	{ "QUANTUM FIREBALL_1280", 3 },
73 	{ NULL, 0 }
74 };
75 
76 /**
77  *	ide_scan_pio_blacklist 	-	check for a blacklisted drive
78  *	@model: Drive model string
79  *
80  *	This routine searches the ide_pio_blacklist for an entry
81  *	matching the start/whole of the supplied model name.
82  *
83  *	Returns -1 if no match found.
84  *	Otherwise returns the recommended PIO mode from ide_pio_blacklist[].
85  */
86 
ide_scan_pio_blacklist(char * model)87 int ide_scan_pio_blacklist(char *model)
88 {
89 	struct ide_pio_info *p;
90 
91 	for (p = ide_pio_blacklist; p->name != NULL; p++) {
92 		if (strncmp(p->name, model, strlen(p->name)) == 0)
93 			return p->pio;
94 	}
95 	return -1;
96 }
97