Commit ccc4672aff1861a9c80ed9e8ec11dc304b31d307
1 parent
720ba12620
Exists in
master
and in
7 other branches
[PATCH] ata_piix: convert ata_piix to new probing mechanism
Convert ata_piix to new probing mechanism. Automatic hotplug is not supported due to hardware limitation (no PHY event interrupt), but warm plugging works. Signed-off-by: Tejun Heo <htejun@gmail.com>
Showing 1 changed file with 32 additions and 55 deletions Side-by-side Diff
drivers/scsi/ata_piix.c
... | ... | @@ -146,11 +146,10 @@ |
146 | 146 | |
147 | 147 | static int piix_init_one (struct pci_dev *pdev, |
148 | 148 | const struct pci_device_id *ent); |
149 | - | |
150 | -static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes); | |
151 | -static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes); | |
152 | 149 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); |
153 | 150 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); |
151 | +static void piix_pata_error_handler(struct ata_port *ap); | |
152 | +static void piix_sata_error_handler(struct ata_port *ap); | |
154 | 153 | |
155 | 154 | static unsigned int in_module_init = 1; |
156 | 155 | |
... | ... | @@ -237,8 +236,6 @@ |
237 | 236 | .exec_command = ata_exec_command, |
238 | 237 | .dev_select = ata_std_dev_select, |
239 | 238 | |
240 | - .probe_reset = piix_pata_probe_reset, | |
241 | - | |
242 | 239 | .bmdma_setup = ata_bmdma_setup, |
243 | 240 | .bmdma_start = ata_bmdma_start, |
244 | 241 | .bmdma_stop = ata_bmdma_stop, |
... | ... | @@ -249,7 +246,7 @@ |
249 | 246 | |
250 | 247 | .freeze = ata_bmdma_freeze, |
251 | 248 | .thaw = ata_bmdma_thaw, |
252 | - .error_handler = ata_bmdma_error_handler, | |
249 | + .error_handler = piix_pata_error_handler, | |
253 | 250 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
254 | 251 | |
255 | 252 | .irq_handler = ata_interrupt, |
... | ... | @@ -269,8 +266,6 @@ |
269 | 266 | .exec_command = ata_exec_command, |
270 | 267 | .dev_select = ata_std_dev_select, |
271 | 268 | |
272 | - .probe_reset = piix_sata_probe_reset, | |
273 | - | |
274 | 269 | .bmdma_setup = ata_bmdma_setup, |
275 | 270 | .bmdma_start = ata_bmdma_start, |
276 | 271 | .bmdma_stop = ata_bmdma_stop, |
... | ... | @@ -281,7 +276,7 @@ |
281 | 276 | |
282 | 277 | .freeze = ata_bmdma_freeze, |
283 | 278 | .thaw = ata_bmdma_thaw, |
284 | - .error_handler = ata_bmdma_error_handler, | |
279 | + .error_handler = piix_sata_error_handler, | |
285 | 280 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
286 | 281 | |
287 | 282 | .irq_handler = ata_interrupt, |
288 | 283 | |
289 | 284 | |
290 | 285 | |
291 | 286 | |
292 | 287 | |
293 | 288 | |
294 | 289 | |
295 | 290 | |
296 | 291 | |
297 | 292 | |
... | ... | @@ -466,59 +461,51 @@ |
466 | 461 | } |
467 | 462 | |
468 | 463 | /** |
469 | - * piix_pata_probeinit - probeinit for PATA host controller | |
464 | + * piix_pata_prereset - prereset for PATA host controller | |
470 | 465 | * @ap: Target port |
471 | 466 | * |
472 | - * Probeinit including cable detection. | |
467 | + * Prereset including cable detection. | |
473 | 468 | * |
474 | 469 | * LOCKING: |
475 | 470 | * None (inherited from caller). |
476 | 471 | */ |
477 | -static void piix_pata_probeinit(struct ata_port *ap) | |
472 | +static int piix_pata_prereset(struct ata_port *ap) | |
478 | 473 | { |
479 | - piix_pata_cbl_detect(ap); | |
480 | - ata_std_probeinit(ap); | |
481 | -} | |
482 | - | |
483 | -/** | |
484 | - * piix_pata_probe_reset - Perform reset on PATA port and classify | |
485 | - * @ap: Port to reset | |
486 | - * @classes: Resulting classes of attached devices | |
487 | - * | |
488 | - * Reset PATA phy and classify attached devices. | |
489 | - * | |
490 | - * LOCKING: | |
491 | - * None (inherited from caller). | |
492 | - */ | |
493 | -static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes) | |
494 | -{ | |
495 | 474 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
496 | 475 | |
497 | 476 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { |
498 | 477 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); |
478 | + ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | |
499 | 479 | return 0; |
500 | 480 | } |
501 | 481 | |
502 | - return ata_drive_probe_reset(ap, piix_pata_probeinit, | |
503 | - ata_std_softreset, NULL, | |
504 | - ata_std_postreset, classes); | |
482 | + piix_pata_cbl_detect(ap); | |
483 | + | |
484 | + return ata_std_prereset(ap); | |
505 | 485 | } |
506 | 486 | |
487 | +static void piix_pata_error_handler(struct ata_port *ap) | |
488 | +{ | |
489 | + ata_bmdma_drive_eh(ap, piix_pata_prereset, ata_std_softreset, NULL, | |
490 | + ata_std_postreset); | |
491 | +} | |
492 | + | |
507 | 493 | /** |
508 | - * piix_sata_probe - Probe PCI device for present SATA devices | |
509 | - * @ap: Port associated with the PCI device we wish to probe | |
494 | + * piix_sata_prereset - prereset for SATA host controller | |
495 | + * @ap: Target port | |
510 | 496 | * |
511 | 497 | * Reads and configures SATA PCI device's PCI config register |
512 | 498 | * Port Configuration and Status (PCS) to determine port and |
513 | - * device availability. | |
499 | + * device availability. Return -ENODEV to skip reset if no | |
500 | + * device is present. | |
514 | 501 | * |
515 | 502 | * LOCKING: |
516 | 503 | * None (inherited from caller). |
517 | 504 | * |
518 | 505 | * RETURNS: |
519 | - * Mask of avaliable devices on the port. | |
506 | + * 0 if device is present, -ENODEV otherwise. | |
520 | 507 | */ |
521 | -static unsigned int piix_sata_probe (struct ata_port *ap) | |
508 | +static int piix_sata_prereset(struct ata_port *ap) | |
522 | 509 | { |
523 | 510 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
524 | 511 | const unsigned int *map = ap->host_set->private_data; |
525 | 512 | |
526 | 513 | |
... | ... | @@ -560,29 +547,19 @@ |
560 | 547 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", |
561 | 548 | ap->id, pcs, present_mask); |
562 | 549 | |
563 | - return present_mask; | |
564 | -} | |
565 | - | |
566 | -/** | |
567 | - * piix_sata_probe_reset - Perform reset on SATA port and classify | |
568 | - * @ap: Port to reset | |
569 | - * @classes: Resulting classes of attached devices | |
570 | - * | |
571 | - * Reset SATA phy and classify attached devices. | |
572 | - * | |
573 | - * LOCKING: | |
574 | - * None (inherited from caller). | |
575 | - */ | |
576 | -static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes) | |
577 | -{ | |
578 | - if (!piix_sata_probe(ap)) { | |
550 | + if (!present_mask) { | |
579 | 551 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); |
552 | + ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | |
580 | 553 | return 0; |
581 | 554 | } |
582 | 555 | |
583 | - return ata_drive_probe_reset(ap, ata_std_probeinit, | |
584 | - ata_std_softreset, NULL, | |
585 | - ata_std_postreset, classes); | |
556 | + return ata_std_prereset(ap); | |
557 | +} | |
558 | + | |
559 | +static void piix_sata_error_handler(struct ata_port *ap) | |
560 | +{ | |
561 | + ata_bmdma_drive_eh(ap, piix_sata_prereset, ata_std_softreset, NULL, | |
562 | + ata_std_postreset); | |
586 | 563 | } |
587 | 564 | |
588 | 565 | /** |