diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 35 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 380 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 8 | ||||
-rw-r--r-- | drivers/ata/libata.h | 1 |
4 files changed, 420 insertions, 4 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7278295f94d2..9a5b6658c65e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -950,6 +950,41 @@ and is between 256 and 4096 characters. It is defined in the file | |||
950 | when set. | 950 | when set. |
951 | Format: <int> | 951 | Format: <int> |
952 | 952 | ||
953 | libata.force= [LIBATA] Force configurations. The format is comma | ||
954 | separated list of "[ID:]VAL" where ID is | ||
955 | PORT[:DEVICE]. PORT and DEVICE are decimal numbers | ||
956 | matching port, link or device. Basically, it matches | ||
957 | the ATA ID string printed on console by libata. If | ||
958 | the whole ID part is omitted, the last PORT and DEVICE | ||
959 | values are used. If ID hasn't been specified yet, the | ||
960 | configuration applies to all ports, links and devices. | ||
961 | |||
962 | If only DEVICE is omitted, the parameter applies to | ||
963 | the port and all links and devices behind it. DEVICE | ||
964 | number of 0 either selects the first device or the | ||
965 | first fan-out link behind PMP device. It does not | ||
966 | select the host link. DEVICE number of 15 selects the | ||
967 | host link and device attached to it. | ||
968 | |||
969 | The VAL specifies the configuration to force. As long | ||
970 | as there's no ambiguity shortcut notation is allowed. | ||
971 | For example, both 1.5 and 1.5G would work for 1.5Gbps. | ||
972 | The following configurations can be forced. | ||
973 | |||
974 | * Cable type: 40c, 80c, short40c, unk, ign or sata. | ||
975 | Any ID with matching PORT is used. | ||
976 | |||
977 | * SATA link speed limit: 1.5Gbps or 3.0Gbps. | ||
978 | |||
979 | * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7]. | ||
980 | udma[/][16,25,33,44,66,100,133] notation is also | ||
981 | allowed. | ||
982 | |||
983 | * [no]ncq: Turn on or off NCQ. | ||
984 | |||
985 | If there are multiple matching configurations changing | ||
986 | the same attribute, the last one is used. | ||
987 | |||
953 | load_ramdisk= [RAM] List of ramdisks to load from floppy | 988 | load_ramdisk= [RAM] List of ramdisks to load from floppy |
954 | See Documentation/ramdisk.txt. | 989 | See Documentation/ramdisk.txt. |
955 | 990 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index def3682f416a..60d1bb556973 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -87,6 +87,28 @@ static struct workqueue_struct *ata_wq; | |||
87 | 87 | ||
88 | struct workqueue_struct *ata_aux_wq; | 88 | struct workqueue_struct *ata_aux_wq; |
89 | 89 | ||
90 | struct ata_force_param { | ||
91 | const char *name; | ||
92 | unsigned int cbl; | ||
93 | int spd_limit; | ||
94 | unsigned long xfer_mask; | ||
95 | unsigned int horkage_on; | ||
96 | unsigned int horkage_off; | ||
97 | }; | ||
98 | |||
99 | struct ata_force_ent { | ||
100 | int port; | ||
101 | int device; | ||
102 | struct ata_force_param param; | ||
103 | }; | ||
104 | |||
105 | static struct ata_force_ent *ata_force_tbl; | ||
106 | static int ata_force_tbl_size; | ||
107 | |||
108 | static char ata_force_param_buf[PAGE_SIZE] __initdata; | ||
109 | module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0444); | ||
110 | MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); | ||
111 | |||
90 | int atapi_enabled = 1; | 112 | int atapi_enabled = 1; |
91 | module_param(atapi_enabled, int, 0444); | 113 | module_param(atapi_enabled, int, 0444); |
92 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); | 114 | MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); |
@@ -130,6 +152,179 @@ MODULE_VERSION(DRV_VERSION); | |||
130 | 152 | ||
131 | 153 | ||
132 | /** | 154 | /** |
155 | * ata_force_cbl - force cable type according to libata.force | ||
156 | * @link: ATA link of interest | ||
157 | * | ||
158 | * Force cable type according to libata.force and whine about it. | ||
159 | * The last entry which has matching port number is used, so it | ||
160 | * can be specified as part of device force parameters. For | ||
161 | * example, both "a:40c,1.00:udma4" and "1.00:40c,udma4" have the | ||
162 | * same effect. | ||
163 | * | ||
164 | * LOCKING: | ||
165 | * EH context. | ||
166 | */ | ||
167 | void ata_force_cbl(struct ata_port *ap) | ||
168 | { | ||
169 | int i; | ||
170 | |||
171 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { | ||
172 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | ||
173 | |||
174 | if (fe->port != -1 && fe->port != ap->print_id) | ||
175 | continue; | ||
176 | |||
177 | if (fe->param.cbl == ATA_CBL_NONE) | ||
178 | continue; | ||
179 | |||
180 | ap->cbl = fe->param.cbl; | ||
181 | ata_port_printk(ap, KERN_NOTICE, | ||
182 | "FORCE: cable set to %s\n", fe->param.name); | ||
183 | return; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * ata_force_spd_limit - force SATA spd limit according to libata.force | ||
189 | * @link: ATA link of interest | ||
190 | * | ||
191 | * Force SATA spd limit according to libata.force and whine about | ||
192 | * it. When only the port part is specified (e.g. 1:), the limit | ||
193 | * applies to all links connected to both the host link and all | ||
194 | * fan-out ports connected via PMP. If the device part is | ||
195 | * specified as 0 (e.g. 1.00:), it specifies the first fan-out | ||
196 | * link not the host link. Device number 15 always points to the | ||
197 | * host link whether PMP is attached or not. | ||
198 | * | ||
199 | * LOCKING: | ||
200 | * EH context. | ||
201 | */ | ||
202 | static void ata_force_spd_limit(struct ata_link *link) | ||
203 | { | ||
204 | int linkno, i; | ||
205 | |||
206 | if (ata_is_host_link(link)) | ||
207 | linkno = 15; | ||
208 | else | ||
209 | linkno = link->pmp; | ||
210 | |||
211 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { | ||
212 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | ||
213 | |||
214 | if (fe->port != -1 && fe->port != link->ap->print_id) | ||
215 | continue; | ||
216 | |||
217 | if (fe->device != -1 && fe->device != linkno) | ||
218 | continue; | ||
219 | |||
220 | if (!fe->param.spd_limit) | ||
221 | continue; | ||
222 | |||
223 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | ||
224 | ata_link_printk(link, KERN_NOTICE, | ||
225 | "FORCE: PHY spd limit set to %s\n", fe->param.name); | ||
226 | return; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * ata_force_xfermask - force xfermask according to libata.force | ||
232 | * @dev: ATA device of interest | ||
233 | * | ||
234 | * Force xfer_mask according to libata.force and whine about it. | ||
235 | * For consistency with link selection, device number 15 selects | ||
236 | * the first device connected to the host link. | ||
237 | * | ||
238 | * LOCKING: | ||
239 | * EH context. | ||
240 | */ | ||
241 | static void ata_force_xfermask(struct ata_device *dev) | ||
242 | { | ||
243 | int devno = dev->link->pmp + dev->devno; | ||
244 | int alt_devno = devno; | ||
245 | int i; | ||
246 | |||
247 | /* allow n.15 for the first device attached to host port */ | ||
248 | if (ata_is_host_link(dev->link) && devno == 0) | ||
249 | alt_devno = 15; | ||
250 | |||
251 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { | ||
252 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | ||
253 | unsigned long pio_mask, mwdma_mask, udma_mask; | ||
254 | |||
255 | if (fe->port != -1 && fe->port != dev->link->ap->print_id) | ||
256 | continue; | ||
257 | |||
258 | if (fe->device != -1 && fe->device != devno && | ||
259 | fe->device != alt_devno) | ||
260 | continue; | ||
261 | |||
262 | if (!fe->param.xfer_mask) | ||
263 | continue; | ||
264 | |||
265 | ata_unpack_xfermask(fe->param.xfer_mask, | ||
266 | &pio_mask, &mwdma_mask, &udma_mask); | ||
267 | if (udma_mask) | ||
268 | dev->udma_mask = udma_mask; | ||
269 | else if (mwdma_mask) { | ||
270 | dev->udma_mask = 0; | ||
271 | dev->mwdma_mask = mwdma_mask; | ||
272 | } else { | ||
273 | dev->udma_mask = 0; | ||
274 | dev->mwdma_mask = 0; | ||
275 | dev->pio_mask = pio_mask; | ||
276 | } | ||
277 | |||
278 | ata_dev_printk(dev, KERN_NOTICE, | ||
279 | "FORCE: xfer_mask set to %s\n", fe->param.name); | ||
280 | return; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * ata_force_horkage - force horkage according to libata.force | ||
286 | * @dev: ATA device of interest | ||
287 | * | ||
288 | * Force horkage according to libata.force and whine about it. | ||
289 | * For consistency with link selection, device number 15 selects | ||
290 | * the first device connected to the host link. | ||
291 | * | ||
292 | * LOCKING: | ||
293 | * EH context. | ||
294 | */ | ||
295 | static void ata_force_horkage(struct ata_device *dev) | ||
296 | { | ||
297 | int devno = dev->link->pmp + dev->devno; | ||
298 | int alt_devno = devno; | ||
299 | int i; | ||
300 | |||
301 | /* allow n.15 for the first device attached to host port */ | ||
302 | if (ata_is_host_link(dev->link) && devno == 0) | ||
303 | alt_devno = 15; | ||
304 | |||
305 | for (i = 0; i < ata_force_tbl_size; i++) { | ||
306 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | ||
307 | |||
308 | if (fe->port != -1 && fe->port != dev->link->ap->print_id) | ||
309 | continue; | ||
310 | |||
311 | if (fe->device != -1 && fe->device != devno && | ||
312 | fe->device != alt_devno) | ||
313 | continue; | ||
314 | |||
315 | if (!(~dev->horkage & fe->param.horkage_on) && | ||
316 | !(dev->horkage & fe->param.horkage_off)) | ||
317 | continue; | ||
318 | |||
319 | dev->horkage |= fe->param.horkage_on; | ||
320 | dev->horkage &= ~fe->param.horkage_off; | ||
321 | |||
322 | ata_dev_printk(dev, KERN_NOTICE, | ||
323 | "FORCE: horkage modified (%s)\n", fe->param.name); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /** | ||
133 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure | 328 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure |
134 | * @tf: Taskfile to convert | 329 | * @tf: Taskfile to convert |
135 | * @pmp: Port multiplier port | 330 | * @pmp: Port multiplier port |
@@ -2067,6 +2262,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2067 | 2262 | ||
2068 | /* set horkage */ | 2263 | /* set horkage */ |
2069 | dev->horkage |= ata_dev_blacklisted(dev); | 2264 | dev->horkage |= ata_dev_blacklisted(dev); |
2265 | ata_force_horkage(dev); | ||
2070 | 2266 | ||
2071 | /* let ACPI work its magic */ | 2267 | /* let ACPI work its magic */ |
2072 | rc = ata_acpi_on_devcfg(dev); | 2268 | rc = ata_acpi_on_devcfg(dev); |
@@ -3150,6 +3346,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3150 | mode_mask = ATA_DMA_MASK_CFA; | 3346 | mode_mask = ATA_DMA_MASK_CFA; |
3151 | 3347 | ||
3152 | ata_dev_xfermask(dev); | 3348 | ata_dev_xfermask(dev); |
3349 | ata_force_xfermask(dev); | ||
3153 | 3350 | ||
3154 | pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); | 3351 | pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); |
3155 | dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); | 3352 | dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); |
@@ -6497,7 +6694,8 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) | |||
6497 | */ | 6694 | */ |
6498 | int sata_link_init_spd(struct ata_link *link) | 6695 | int sata_link_init_spd(struct ata_link *link) |
6499 | { | 6696 | { |
6500 | u32 scontrol, spd; | 6697 | u32 scontrol; |
6698 | u8 spd; | ||
6501 | int rc; | 6699 | int rc; |
6502 | 6700 | ||
6503 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); | 6701 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); |
@@ -6508,6 +6706,8 @@ int sata_link_init_spd(struct ata_link *link) | |||
6508 | if (spd) | 6706 | if (spd) |
6509 | link->hw_sata_spd_limit &= (1 << spd) - 1; | 6707 | link->hw_sata_spd_limit &= (1 << spd) - 1; |
6510 | 6708 | ||
6709 | ata_force_spd_limit(link); | ||
6710 | |||
6511 | link->sata_spd_limit = link->hw_sata_spd_limit; | 6711 | link->sata_spd_limit = link->hw_sata_spd_limit; |
6512 | 6712 | ||
6513 | return 0; | 6713 | return 0; |
@@ -7218,10 +7418,187 @@ int ata_pci_device_resume(struct pci_dev *pdev) | |||
7218 | 7418 | ||
7219 | #endif /* CONFIG_PCI */ | 7419 | #endif /* CONFIG_PCI */ |
7220 | 7420 | ||
7421 | static int __init ata_parse_force_one(char **cur, | ||
7422 | struct ata_force_ent *force_ent, | ||
7423 | const char **reason) | ||
7424 | { | ||
7425 | /* FIXME: Currently, there's no way to tag init const data and | ||
7426 | * using __initdata causes build failure on some versions of | ||
7427 | * gcc. Once __initdataconst is implemented, add const to the | ||
7428 | * following structure. | ||
7429 | */ | ||
7430 | static struct ata_force_param force_tbl[] __initdata = { | ||
7431 | { "40c", .cbl = ATA_CBL_PATA40 }, | ||
7432 | { "80c", .cbl = ATA_CBL_PATA80 }, | ||
7433 | { "short40c", .cbl = ATA_CBL_PATA40_SHORT }, | ||
7434 | { "unk", .cbl = ATA_CBL_PATA_UNK }, | ||
7435 | { "ign", .cbl = ATA_CBL_PATA_IGN }, | ||
7436 | { "sata", .cbl = ATA_CBL_SATA }, | ||
7437 | { "1.5Gbps", .spd_limit = 1 }, | ||
7438 | { "3.0Gbps", .spd_limit = 2 }, | ||
7439 | { "noncq", .horkage_on = ATA_HORKAGE_NONCQ }, | ||
7440 | { "ncq", .horkage_off = ATA_HORKAGE_NONCQ }, | ||
7441 | { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) }, | ||
7442 | { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) }, | ||
7443 | { "pio2", .xfer_mask = 1 << (ATA_SHIFT_PIO + 2) }, | ||
7444 | { "pio3", .xfer_mask = 1 << (ATA_SHIFT_PIO + 3) }, | ||
7445 | { "pio4", .xfer_mask = 1 << (ATA_SHIFT_PIO + 4) }, | ||
7446 | { "pio5", .xfer_mask = 1 << (ATA_SHIFT_PIO + 5) }, | ||
7447 | { "pio6", .xfer_mask = 1 << (ATA_SHIFT_PIO + 6) }, | ||
7448 | { "mwdma0", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 0) }, | ||
7449 | { "mwdma1", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 1) }, | ||
7450 | { "mwdma2", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 2) }, | ||
7451 | { "mwdma3", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 3) }, | ||
7452 | { "mwdma4", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 4) }, | ||
7453 | { "udma0", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) }, | ||
7454 | { "udma16", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) }, | ||
7455 | { "udma/16", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) }, | ||
7456 | { "udma1", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) }, | ||
7457 | { "udma25", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) }, | ||
7458 | { "udma/25", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) }, | ||
7459 | { "udma2", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) }, | ||
7460 | { "udma33", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) }, | ||
7461 | { "udma/33", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) }, | ||
7462 | { "udma3", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) }, | ||
7463 | { "udma44", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) }, | ||
7464 | { "udma/44", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) }, | ||
7465 | { "udma4", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) }, | ||
7466 | { "udma66", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) }, | ||
7467 | { "udma/66", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) }, | ||
7468 | { "udma5", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) }, | ||
7469 | { "udma100", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) }, | ||
7470 | { "udma/100", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) }, | ||
7471 | { "udma6", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | ||
7472 | { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | ||
7473 | { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | ||
7474 | { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, | ||
7475 | }; | ||
7476 | char *start = *cur, *p = *cur; | ||
7477 | char *id, *val, *endp; | ||
7478 | const struct ata_force_param *match_fp = NULL; | ||
7479 | int nr_matches = 0, i; | ||
7480 | |||
7481 | /* find where this param ends and update *cur */ | ||
7482 | while (*p != '\0' && *p != ',') | ||
7483 | p++; | ||
7484 | |||
7485 | if (*p == '\0') | ||
7486 | *cur = p; | ||
7487 | else | ||
7488 | *cur = p + 1; | ||
7489 | |||
7490 | *p = '\0'; | ||
7491 | |||
7492 | /* parse */ | ||
7493 | p = strchr(start, ':'); | ||
7494 | if (!p) { | ||
7495 | val = strstrip(start); | ||
7496 | goto parse_val; | ||
7497 | } | ||
7498 | *p = '\0'; | ||
7499 | |||
7500 | id = strstrip(start); | ||
7501 | val = strstrip(p + 1); | ||
7502 | |||
7503 | /* parse id */ | ||
7504 | p = strchr(id, '.'); | ||
7505 | if (p) { | ||
7506 | *p++ = '\0'; | ||
7507 | force_ent->device = simple_strtoul(p, &endp, 10); | ||
7508 | if (p == endp || *endp != '\0') { | ||
7509 | *reason = "invalid device"; | ||
7510 | return -EINVAL; | ||
7511 | } | ||
7512 | } | ||
7513 | |||
7514 | force_ent->port = simple_strtoul(id, &endp, 10); | ||
7515 | if (p == endp || *endp != '\0') { | ||
7516 | *reason = "invalid port/link"; | ||
7517 | return -EINVAL; | ||
7518 | } | ||
7519 | |||
7520 | parse_val: | ||
7521 | /* parse val, allow shortcuts so that both 1.5 and 1.5Gbps work */ | ||
7522 | for (i = 0; i < ARRAY_SIZE(force_tbl); i++) { | ||
7523 | const struct ata_force_param *fp = &force_tbl[i]; | ||
7524 | |||
7525 | if (strncasecmp(val, fp->name, strlen(val))) | ||
7526 | continue; | ||
7527 | |||
7528 | nr_matches++; | ||
7529 | match_fp = fp; | ||
7530 | |||
7531 | if (strcasecmp(val, fp->name) == 0) { | ||
7532 | nr_matches = 1; | ||
7533 | break; | ||
7534 | } | ||
7535 | } | ||
7536 | |||
7537 | if (!nr_matches) { | ||
7538 | *reason = "unknown value"; | ||
7539 | return -EINVAL; | ||
7540 | } | ||
7541 | if (nr_matches > 1) { | ||
7542 | *reason = "ambigious value"; | ||
7543 | return -EINVAL; | ||
7544 | } | ||
7545 | |||
7546 | force_ent->param = *match_fp; | ||
7547 | |||
7548 | return 0; | ||
7549 | } | ||
7550 | |||
7551 | static void __init ata_parse_force_param(void) | ||
7552 | { | ||
7553 | int idx = 0, size = 1; | ||
7554 | int last_port = -1, last_device = -1; | ||
7555 | char *p, *cur, *next; | ||
7556 | |||
7557 | /* calculate maximum number of params and allocate force_tbl */ | ||
7558 | for (p = ata_force_param_buf; *p; p++) | ||
7559 | if (*p == ',') | ||
7560 | size++; | ||
7561 | |||
7562 | ata_force_tbl = kzalloc(sizeof(ata_force_tbl[0]) * size, GFP_KERNEL); | ||
7563 | if (!ata_force_tbl) { | ||
7564 | printk(KERN_WARNING "ata: failed to extend force table, " | ||
7565 | "libata.force ignored\n"); | ||
7566 | return; | ||
7567 | } | ||
7568 | |||
7569 | /* parse and populate the table */ | ||
7570 | for (cur = ata_force_param_buf; *cur != '\0'; cur = next) { | ||
7571 | const char *reason = ""; | ||
7572 | struct ata_force_ent te = { .port = -1, .device = -1 }; | ||
7573 | |||
7574 | next = cur; | ||
7575 | if (ata_parse_force_one(&next, &te, &reason)) { | ||
7576 | printk(KERN_WARNING "ata: failed to parse force " | ||
7577 | "parameter \"%s\" (%s)\n", | ||
7578 | cur, reason); | ||
7579 | continue; | ||
7580 | } | ||
7581 | |||
7582 | if (te.port == -1) { | ||
7583 | te.port = last_port; | ||
7584 | te.device = last_device; | ||
7585 | } | ||
7586 | |||
7587 | ata_force_tbl[idx++] = te; | ||
7588 | |||
7589 | last_port = te.port; | ||
7590 | last_device = te.device; | ||
7591 | } | ||
7592 | |||
7593 | ata_force_tbl_size = idx; | ||
7594 | } | ||
7221 | 7595 | ||
7222 | static int __init ata_init(void) | 7596 | static int __init ata_init(void) |
7223 | { | 7597 | { |
7224 | ata_probe_timeout *= HZ; | 7598 | ata_probe_timeout *= HZ; |
7599 | |||
7600 | ata_parse_force_param(); | ||
7601 | |||
7225 | ata_wq = create_workqueue("ata"); | 7602 | ata_wq = create_workqueue("ata"); |
7226 | if (!ata_wq) | 7603 | if (!ata_wq) |
7227 | return -ENOMEM; | 7604 | return -ENOMEM; |
@@ -7238,6 +7615,7 @@ static int __init ata_init(void) | |||
7238 | 7615 | ||
7239 | static void __exit ata_exit(void) | 7616 | static void __exit ata_exit(void) |
7240 | { | 7617 | { |
7618 | kfree(ata_force_tbl); | ||
7241 | destroy_workqueue(ata_wq); | 7619 | destroy_workqueue(ata_wq); |
7242 | destroy_workqueue(ata_aux_wq); | 7620 | destroy_workqueue(ata_aux_wq); |
7243 | } | 7621 | } |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 4e31071acc02..698ce2cea52c 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2393,9 +2393,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2393 | } | 2393 | } |
2394 | 2394 | ||
2395 | /* PDIAG- should have been released, ask cable type if post-reset */ | 2395 | /* PDIAG- should have been released, ask cable type if post-reset */ |
2396 | if (ata_is_host_link(link) && ap->ops->cable_detect && | 2396 | if ((ehc->i.flags & ATA_EHI_DID_RESET) && ata_is_host_link(link)) { |
2397 | (ehc->i.flags & ATA_EHI_DID_RESET)) | 2397 | if (ap->ops->cable_detect) |
2398 | ap->cbl = ap->ops->cable_detect(ap); | 2398 | ap->cbl = ap->ops->cable_detect(ap); |
2399 | ata_force_cbl(ap); | ||
2400 | } | ||
2399 | 2401 | ||
2400 | /* Configure new devices forward such that user doesn't see | 2402 | /* Configure new devices forward such that user doesn't see |
2401 | * device detection messages backwards. | 2403 | * device detection messages backwards. |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 409ffb9af163..6036dedfe377 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -61,6 +61,7 @@ extern int atapi_passthru16; | |||
61 | extern int libata_fua; | 61 | extern int libata_fua; |
62 | extern int libata_noacpi; | 62 | extern int libata_noacpi; |
63 | extern int libata_allow_tpm; | 63 | extern int libata_allow_tpm; |
64 | extern void ata_force_cbl(struct ata_port *ap); | ||
64 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); | 65 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
65 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 66 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
66 | u64 block, u32 n_block, unsigned int tf_flags, | 67 | u64 block, u32 n_block, unsigned int tf_flags, |