diff options
| author | Tejun Heo <htejun@gmail.com> | 2006-05-31 05:28:14 -0400 |
|---|---|---|
| committer | Tejun Heo <htejun@gmail.com> | 2006-05-31 05:28:14 -0400 |
| commit | ccc4672aff1861a9c80ed9e8ec11dc304b31d307 (patch) | |
| tree | d8828f303749444177337b68cfe3d0abe56f78ee | |
| parent | 720ba12620ee09dce269adf4ad50958adac7bb54 (diff) | |
[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>
| -rw-r--r-- | drivers/scsi/ata_piix.c | 87 |
1 files changed, 32 insertions, 55 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 54c2e52373fd..521b718763f6 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
| @@ -146,11 +146,10 @@ struct piix_map_db { | |||
| 146 | 146 | ||
| 147 | static int piix_init_one (struct pci_dev *pdev, | 147 | static int piix_init_one (struct pci_dev *pdev, |
| 148 | const struct pci_device_id *ent); | 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 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); | 149 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); |
| 153 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); | 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 | static unsigned int in_module_init = 1; | 154 | static unsigned int in_module_init = 1; |
| 156 | 155 | ||
| @@ -237,8 +236,6 @@ static const struct ata_port_operations piix_pata_ops = { | |||
| 237 | .exec_command = ata_exec_command, | 236 | .exec_command = ata_exec_command, |
| 238 | .dev_select = ata_std_dev_select, | 237 | .dev_select = ata_std_dev_select, |
| 239 | 238 | ||
| 240 | .probe_reset = piix_pata_probe_reset, | ||
| 241 | |||
| 242 | .bmdma_setup = ata_bmdma_setup, | 239 | .bmdma_setup = ata_bmdma_setup, |
| 243 | .bmdma_start = ata_bmdma_start, | 240 | .bmdma_start = ata_bmdma_start, |
| 244 | .bmdma_stop = ata_bmdma_stop, | 241 | .bmdma_stop = ata_bmdma_stop, |
| @@ -249,7 +246,7 @@ static const struct ata_port_operations piix_pata_ops = { | |||
| 249 | 246 | ||
| 250 | .freeze = ata_bmdma_freeze, | 247 | .freeze = ata_bmdma_freeze, |
| 251 | .thaw = ata_bmdma_thaw, | 248 | .thaw = ata_bmdma_thaw, |
| 252 | .error_handler = ata_bmdma_error_handler, | 249 | .error_handler = piix_pata_error_handler, |
| 253 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 250 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
| 254 | 251 | ||
| 255 | .irq_handler = ata_interrupt, | 252 | .irq_handler = ata_interrupt, |
| @@ -269,8 +266,6 @@ static const struct ata_port_operations piix_sata_ops = { | |||
| 269 | .exec_command = ata_exec_command, | 266 | .exec_command = ata_exec_command, |
| 270 | .dev_select = ata_std_dev_select, | 267 | .dev_select = ata_std_dev_select, |
| 271 | 268 | ||
| 272 | .probe_reset = piix_sata_probe_reset, | ||
| 273 | |||
| 274 | .bmdma_setup = ata_bmdma_setup, | 269 | .bmdma_setup = ata_bmdma_setup, |
| 275 | .bmdma_start = ata_bmdma_start, | 270 | .bmdma_start = ata_bmdma_start, |
| 276 | .bmdma_stop = ata_bmdma_stop, | 271 | .bmdma_stop = ata_bmdma_stop, |
| @@ -281,7 +276,7 @@ static const struct ata_port_operations piix_sata_ops = { | |||
| 281 | 276 | ||
| 282 | .freeze = ata_bmdma_freeze, | 277 | .freeze = ata_bmdma_freeze, |
| 283 | .thaw = ata_bmdma_thaw, | 278 | .thaw = ata_bmdma_thaw, |
| 284 | .error_handler = ata_bmdma_error_handler, | 279 | .error_handler = piix_sata_error_handler, |
| 285 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 280 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
| 286 | 281 | ||
| 287 | .irq_handler = ata_interrupt, | 282 | .irq_handler = ata_interrupt, |
| @@ -466,59 +461,51 @@ cbl40: | |||
| 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 | * @ap: Target port | 465 | * @ap: Target port |
| 471 | * | 466 | * |
| 472 | * Probeinit including cable detection. | 467 | * Prereset including cable detection. |
| 473 | * | ||
| 474 | * LOCKING: | ||
| 475 | * None (inherited from caller). | ||
| 476 | */ | ||
| 477 | static void piix_pata_probeinit(struct ata_port *ap) | ||
| 478 | { | ||
| 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 | * | 468 | * |
| 490 | * LOCKING: | 469 | * LOCKING: |
| 491 | * None (inherited from caller). | 470 | * None (inherited from caller). |
| 492 | */ | 471 | */ |
| 493 | static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes) | 472 | static int piix_pata_prereset(struct ata_port *ap) |
| 494 | { | 473 | { |
| 495 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 474 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
| 496 | 475 | ||
| 497 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { | 476 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { |
| 498 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); | 477 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); |
| 478 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | ||
| 499 | return 0; | 479 | return 0; |
| 500 | } | 480 | } |
| 501 | 481 | ||
| 502 | return ata_drive_probe_reset(ap, piix_pata_probeinit, | 482 | piix_pata_cbl_detect(ap); |
| 503 | ata_std_softreset, NULL, | 483 | |
| 504 | ata_std_postreset, classes); | 484 | return ata_std_prereset(ap); |
| 485 | } | ||
| 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); | ||
| 505 | } | 491 | } |
| 506 | 492 | ||
| 507 | /** | 493 | /** |
| 508 | * piix_sata_probe - Probe PCI device for present SATA devices | 494 | * piix_sata_prereset - prereset for SATA host controller |
| 509 | * @ap: Port associated with the PCI device we wish to probe | 495 | * @ap: Target port |
| 510 | * | 496 | * |
| 511 | * Reads and configures SATA PCI device's PCI config register | 497 | * Reads and configures SATA PCI device's PCI config register |
| 512 | * Port Configuration and Status (PCS) to determine port and | 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 | * LOCKING: | 502 | * LOCKING: |
| 516 | * None (inherited from caller). | 503 | * None (inherited from caller). |
| 517 | * | 504 | * |
| 518 | * RETURNS: | 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 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 510 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
| 524 | const unsigned int *map = ap->host_set->private_data; | 511 | const unsigned int *map = ap->host_set->private_data; |
| @@ -560,29 +547,19 @@ static unsigned int piix_sata_probe (struct ata_port *ap) | |||
| 560 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", | 547 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", |
| 561 | ap->id, pcs, present_mask); | 548 | ap->id, pcs, present_mask); |
| 562 | 549 | ||
| 563 | return present_mask; | 550 | if (!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)) { | ||
| 579 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); | 551 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); |
| 552 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | ||
| 580 | return 0; | 553 | return 0; |
| 581 | } | 554 | } |
| 582 | 555 | ||
| 583 | return ata_drive_probe_reset(ap, ata_std_probeinit, | 556 | return ata_std_prereset(ap); |
| 584 | ata_std_softreset, NULL, | 557 | } |
| 585 | ata_std_postreset, classes); | 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 | /** |
