|
|
1.1 root 1: #ifndef _IDE_MODES_H
2: #define _IDE_MODES_H
3: /*
4: * linux/drivers/block/ide_modes.h
5: *
6: * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
7: */
8:
9: /*
10: * Shared data/functions for determining best PIO mode for an IDE drive.
11: * Most of this stuff originally lived in cmd640.c, and changes to the
12: * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid
13: * breaking the fragile cmd640.c support.
14: */
15:
16: #if defined(CONFIG_BLK_DEV_CMD640) || defined(CONFIG_IDE_CHIPSETS)
17:
18: #ifndef _IDE_C
19:
20: int ide_scan_pio_blacklist (char *model);
21: unsigned int ide_get_best_pio_mode (ide_drive_t *drive);
22:
23: #else /* _IDE_C */
24:
25: /*
26: * Black list. Some drives incorrectly report their maximal PIO mode,
27: * at least in respect to CMD640. Here we keep info on some known drives.
28: */
29: static struct ide_pio_info {
30: const char *name;
31: int pio;
32: } ide_pio_blacklist [] = {
33: /* { "Conner Peripherals 1275MB - CFS1275A", 4 }, */
34:
35: { "WDC AC2700", 3 },
36: { "WDC AC2540", 3 },
37: { "WDC AC2420", 3 },
38: { "WDC AC2340", 3 },
39: { "WDC AC2250", 0 },
40: { "WDC AC2200", 0 },
41: { "WDC AC2120", 0 },
42: { "WDC AC2850", 3 },
43: { "WDC AC1270", 3 },
44: { "WDC AC1170", 3 },
45: { "WDC AC1210", 1 },
46: { "WDC AC280", 0 },
47: /* { "WDC AC21000", 4 }, */
48: { "WDC AC31000", 3 },
49: /* { "WDC AC21200", 4 }, */
50: { "WDC AC31200", 3 },
51: /* { "WDC AC31600", 4 }, */
52:
53: { "Maxtor 7131 AT", 1 },
54: { "Maxtor 7171 AT", 1 },
55: { "Maxtor 7213 AT", 1 },
56: { "Maxtor 7245 AT", 1 },
57: { "Maxtor 7345 AT", 1 },
58: { "Maxtor 7546 AT", 3 },
59: { "Maxtor 7540 AV", 3 },
60:
61: { "SAMSUNG SHD-3121A", 1 },
62: { "SAMSUNG SHD-3122A", 1 },
63: { "SAMSUNG SHD-3172A", 1 },
64:
65: /* { "ST51080A", 4 },
66: * { "ST51270A", 4 },
67: * { "ST31220A", 4 },
68: * { "ST31640A", 4 },
69: * { "ST32140A", 4 },
70: * { "ST3780A", 4 },
71: */
72: { "ST5660A", 3 },
73: { "ST3660A", 3 },
74: { "ST3630A", 3 },
75: { "ST3655A", 3 },
76: { "ST3391A", 3 },
77: { "ST3390A", 1 },
78: { "ST3600A", 1 },
79: { "ST3290A", 0 },
80: { "ST3144A", 0 },
81:
82: { "QUANTUM ELS127A", 0 },
83: { "QUANTUM ELS170A", 0 },
84: { "QUANTUM LPS240A", 0 },
85: { "QUANTUM LPS210A", 3 },
86: { "QUANTUM LPS270A", 3 },
87: { "QUANTUM LPS365A", 3 },
88: { "QUANTUM LPS540A", 3 },
89: { "QUANTUM FIREBALL", 3 }, /* For models 540/640/1080/1280 */
90: /* 1080A works fine in mode4 with triton */
91: { NULL, 0 }
92: };
93:
94: /*
95: * This routine searches the ide_pio_blacklist for an entry
96: * matching the start/whole of the supplied model name.
97: *
98: * Returns -1 if no match found.
99: * Otherwise returns the recommended PIO mode from ide_pio_blacklist[].
100: */
101: int ide_scan_pio_blacklist (char *model)
102: {
103: struct ide_pio_info *p;
104:
105: for (p = ide_pio_blacklist; p->name != NULL; p++) {
106: if (strncmp(p->name, model, strlen(p->name)) == 0)
107: return p->pio;
108: }
109: return -1;
110: }
111:
112: /*
113: * This routine returns the recommended PIO mode for a given drive,
114: * based on the drive->id information and the ide_pio_blacklist[].
115: * This is used by most chipset support modules when "auto-tuning".
116: */
117: unsigned int ide_get_best_pio_mode (ide_drive_t *drive)
118: {
119: unsigned int pio = 0;
120: struct hd_driveid *id = drive->id;
121:
122: if (id != NULL) {
123: if (HWIF(drive)->chipset != ide_cmd640 && !strcmp("QUANTUM FIREBALL1080A", id->model))
124: pio = 4;
125: else
126: pio = ide_scan_pio_blacklist(id->model);
127: if (pio == -1) {
128: pio = (id->tPIO < 2) ? id->tPIO : 2;
129: if (id->field_valid & 2) {
130: byte modes = id->eide_pio_modes;
131: if (modes & 4) pio = 5;
132: else if (modes & 2) pio = 4;
133: else if (modes & 1) pio = 3;
134: }
135: }
136: }
137: return pio;
138: }
139:
140: #endif /* _IDE_C */
141: #endif /* defined(CONFIG_BLK_DEV_CMD640) || defined(CONFIG_IDE_CHIPSETS) */
142: #endif /* _IDE_MODES_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.