aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r--drivers/ata/libata-acpi.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index d14a48e75f1b..03a0acff6cfa 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -34,6 +34,13 @@ struct taskfile_array {
34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ 34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
35}; 35};
36 36
37/*
38 * Helper - belongs in the PCI layer somewhere eventually
39 */
40static int is_pci_dev(struct device *dev)
41{
42 return (dev->bus == &pci_bus_type);
43}
37 44
38/** 45/**
39 * sata_get_dev_handle - finds acpi_handle and PCI device.function 46 * sata_get_dev_handle - finds acpi_handle and PCI device.function
@@ -53,6 +60,9 @@ static int sata_get_dev_handle(struct device *dev, acpi_handle *handle,
53 struct pci_dev *pci_dev; 60 struct pci_dev *pci_dev;
54 acpi_integer addr; 61 acpi_integer addr;
55 62
63 if (!is_pci_dev(dev))
64 return -ENODEV;
65
56 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ 66 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */
57 /* Please refer to the ACPI spec for the syntax of _ADR. */ 67 /* Please refer to the ACPI spec for the syntax of _ADR. */
58 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 68 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
@@ -84,7 +94,12 @@ static int pata_get_dev_handle(struct device *dev, acpi_handle *handle,
84 acpi_status status; 94 acpi_status status;
85 struct acpi_device_info *dinfo = NULL; 95 struct acpi_device_info *dinfo = NULL;
86 int ret = -ENODEV; 96 int ret = -ENODEV;
87 struct pci_dev *pdev = to_pci_dev(dev); 97 struct pci_dev *pdev;
98
99 if (!is_pci_dev(dev))
100 return -ENODEV;
101
102 pdev = to_pci_dev(dev);
88 103
89 bus = pdev->bus->number; 104 bus = pdev->bus->number;
90 devnum = PCI_SLOT(pdev->devfn); 105 devnum = PCI_SLOT(pdev->devfn);
@@ -290,7 +305,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
290 *gtf_address = 0UL; 305 *gtf_address = 0UL;
291 *obj_loc = 0UL; 306 *obj_loc = 0UL;
292 307
293 if (noacpi) 308 if (libata_noacpi)
294 return 0; 309 return 0;
295 310
296 if (ata_msg_probe(ap)) 311 if (ata_msg_probe(ap))
@@ -516,7 +531,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
516 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 531 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
517 __FUNCTION__, ap->port_no); 532 __FUNCTION__, ap->port_no);
518 533
519 if (noacpi || !(ap->cbl == ATA_CBL_SATA)) 534 if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA))
520 return 0; 535 return 0;
521 536
522 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) 537 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED))
@@ -559,7 +574,14 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
559 unsigned long gtf_address; 574 unsigned long gtf_address;
560 unsigned long obj_loc; 575 unsigned long obj_loc;
561 576
562 if (noacpi) 577 if (libata_noacpi)
578 return 0;
579 /*
580 * TBD - implement PATA support. For now,
581 * we should not run GTF on PATA devices since some
582 * PATA require execution of GTM/STM before GTF.
583 */
584 if (!(ap->cbl == ATA_CBL_SATA))
563 return 0; 585 return 0;
564 586
565 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { 587 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) {
@@ -614,7 +636,7 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix)
614 struct acpi_object_list input; 636 struct acpi_object_list input;
615 union acpi_object in_params[1]; 637 union acpi_object in_params[1];
616 638
617 if (noacpi) 639 if (libata_noacpi)
618 return 0; 640 return 0;
619 641
620 if (ata_msg_probe(ap)) 642 if (ata_msg_probe(ap))