Lines Matching refs:dev
36 static void ata_acpi_clear_gtf(struct ata_device *dev) in ata_acpi_clear_gtf() argument
38 kfree(dev->gtf_cache); in ata_acpi_clear_gtf()
39 dev->gtf_cache = NULL; in ata_acpi_clear_gtf()
46 struct ata_device *dev; member
60 acpi_handle ata_dev_acpi_handle(struct ata_device *dev) in ata_dev_acpi_handle() argument
62 return dev->flags & ATA_DFLAG_ACPI_DISABLED ? in ata_dev_acpi_handle()
63 NULL : ACPI_HANDLE(&dev->tdev); in ata_dev_acpi_handle()
67 static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) in ata_acpi_detach_device() argument
69 if (dev) in ata_acpi_detach_device()
70 dev->flags |= ATA_DFLAG_DETACH; in ata_acpi_detach_device()
100 static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, in ata_acpi_handle_hotplug() argument
124 ata_acpi_detach_device(ap, dev); in ata_acpi_handle_hotplug()
137 struct ata_device *dev = ata_hotplug_data(adev->hp).dev; in ata_acpi_dev_notify_dock() local
138 ata_acpi_handle_hotplug(dev->link->ap, dev, event); in ata_acpi_dev_notify_dock()
148 static void ata_acpi_uevent(struct ata_port *ap, struct ata_device *dev, in ata_acpi_uevent() argument
155 if (dev) { in ata_acpi_uevent()
156 if (dev->sdev) in ata_acpi_uevent()
157 kobj = &dev->sdev->sdev_gendev.kobj; in ata_acpi_uevent()
159 kobj = &ap->dev->kobj; in ata_acpi_uevent()
174 struct ata_device *dev = ata_hotplug_data(adev->hp).dev; in ata_acpi_dev_uevent() local
175 ata_acpi_uevent(dev->link->ap, dev, event); in ata_acpi_dev_uevent()
181 struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); in ata_acpi_bind_port()
206 void ata_acpi_bind_dev(struct ata_device *dev) in ata_acpi_bind_dev() argument
208 struct ata_port *ap = dev->link->ap; in ata_acpi_bind_dev()
210 struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); in ata_acpi_bind_dev()
227 adr = SATA_ADR(ap->port_no, dev->link->pmp); in ata_acpi_bind_dev()
230 adr = dev->devno; in ata_acpi_bind_dev()
234 acpi_preset_companion(&dev->tdev, parent, adr); in ata_acpi_bind_dev()
235 adev = ACPI_COMPANION(&dev->tdev); in ata_acpi_bind_dev()
243 context->data.dev = dev; in ata_acpi_bind_dev()
403 static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) in ata_dev_get_GTF() argument
411 if (dev->gtf_cache) { in ata_dev_get_GTF()
412 out_obj = dev->gtf_cache; in ata_dev_get_GTF()
421 status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_GTF", NULL, in ata_dev_get_GTF()
423 out_obj = dev->gtf_cache = output.pointer; in ata_dev_get_GTF()
427 ata_dev_warn(dev, "_GTF evaluation failed (AE 0x%x)\n", in ata_dev_get_GTF()
435 ata_dev_dbg(dev, "Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n", in ata_dev_get_GTF()
443 ata_dev_warn(dev, "_GTF unexpected object type 0x%x\n", in ata_dev_get_GTF()
450 ata_dev_warn(dev, "unexpected _GTF length (%d)\n", in ata_dev_get_GTF()
460 ata_dev_dbg(dev, "returning gtf=%p, gtf_count=%d\n", in ata_dev_get_GTF()
466 ata_acpi_clear_gtf(dev); in ata_dev_get_GTF()
483 unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev, in ata_acpi_gtm_xfermask() argument
492 unit = dev->devno; in ata_acpi_gtm_xfermask()
525 struct ata_device *dev; in ata_acpi_cbl_80wire() local
527 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_acpi_cbl_80wire()
530 xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); in ata_acpi_cbl_80wire()
541 static void ata_acpi_gtf_to_tf(struct ata_device *dev, in ata_acpi_gtf_to_tf() argument
545 ata_tf_init(dev, tf); in ata_acpi_gtf_to_tf()
558 static int ata_acpi_filter_tf(struct ata_device *dev, in ata_acpi_filter_tf() argument
562 if (dev->gtf_filter & ATA_ACPI_FILTER_SETXFER) { in ata_acpi_filter_tf()
571 if (dev->gtf_filter & ATA_ACPI_FILTER_LOCK) { in ata_acpi_filter_tf()
596 if (dev->gtf_filter & ATA_ACPI_FILTER_DIPM && in ata_acpi_filter_tf()
601 if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_OFFSET && in ata_acpi_filter_tf()
607 if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_AA && in ata_acpi_filter_tf()
638 static int ata_acpi_run_tf(struct ata_device *dev, in ata_acpi_run_tf() argument
653 ata_acpi_gtf_to_tf(dev, gtf, &tf); in ata_acpi_run_tf()
655 ata_acpi_gtf_to_tf(dev, prev_gtf, &ptf); in ata_acpi_run_tf()
661 if (!ata_acpi_filter_tf(dev, &tf, pptf)) { in ata_acpi_run_tf()
663 err_mask = ata_exec_internal(dev, &rtf, NULL, in ata_acpi_run_tf()
668 ata_dev_dbg(dev, in ata_acpi_run_tf()
677 ata_dev_info(dev, in ata_acpi_run_tf()
687 ata_dev_err(dev, in ata_acpi_run_tf()
697 ata_dev_info(dev, in ata_acpi_run_tf()
721 static int ata_acpi_exec_tfs(struct ata_device *dev, int *nr_executed) in ata_acpi_exec_tfs() argument
727 rc = ata_dev_get_GTF(dev, >f); in ata_acpi_exec_tfs()
734 rc = ata_acpi_run_tf(dev, gtf, pgtf); in ata_acpi_exec_tfs()
743 ata_acpi_clear_gtf(dev); in ata_acpi_exec_tfs()
766 static int ata_acpi_push_id(struct ata_device *dev) in ata_acpi_push_id() argument
768 struct ata_port *ap = dev->link->ap; in ata_acpi_push_id()
773 ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n", in ata_acpi_push_id()
774 __func__, dev->devno, ap->port_no); in ata_acpi_push_id()
781 in_params[0].buffer.length = sizeof(dev->id[0]) * ATA_ID_WORDS; in ata_acpi_push_id()
782 in_params[0].buffer.pointer = (u8 *)dev->id; in ata_acpi_push_id()
786 swap_buf_le16(dev->id, ATA_ID_WORDS); in ata_acpi_push_id()
787 status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_SDD", &input, in ata_acpi_push_id()
789 swap_buf_le16(dev->id, ATA_ID_WORDS); in ata_acpi_push_id()
795 ata_dev_warn(dev, "ACPI _SDD failed (AE 0x%x)\n", status); in ata_acpi_push_id()
815 struct ata_device *dev; in ata_acpi_on_resume() local
827 ata_for_each_dev(dev, &ap->link, ALL) { in ata_acpi_on_resume()
828 ata_acpi_clear_gtf(dev); in ata_acpi_on_resume()
829 if (ata_dev_enabled(dev) && in ata_acpi_on_resume()
830 ata_dev_acpi_handle(dev) && in ata_acpi_on_resume()
831 ata_dev_get_GTF(dev, NULL) >= 0) in ata_acpi_on_resume()
832 dev->flags |= ATA_DFLAG_ACPI_PENDING; in ata_acpi_on_resume()
839 ata_for_each_dev(dev, &ap->link, ALL) { in ata_acpi_on_resume()
840 ata_acpi_clear_gtf(dev); in ata_acpi_on_resume()
841 if (ata_dev_enabled(dev)) in ata_acpi_on_resume()
842 dev->flags |= ATA_DFLAG_ACPI_PENDING; in ata_acpi_on_resume()
847 static int ata_acpi_choose_suspend_state(struct ata_device *dev, bool runtime) in ata_acpi_choose_suspend_state() argument
857 if (dev->class == ATA_DEV_ATAPI && in ata_acpi_choose_suspend_state()
858 !(zpodd_dev_enabled(dev) && zpodd_zpready(dev))) in ata_acpi_choose_suspend_state()
862 return acpi_pm_device_sleep_state(&dev->tdev, NULL, d_max_in); in ata_acpi_choose_suspend_state()
868 struct ata_device *dev; in sata_acpi_set_state() local
872 ata_for_each_dev(dev, &ap->link, ENABLED) { in sata_acpi_set_state()
873 handle = ata_dev_acpi_handle(dev); in sata_acpi_set_state()
878 acpi_state = ata_acpi_choose_suspend_state(dev, runtime); in sata_acpi_set_state()
881 if (runtime && zpodd_dev_enabled(dev) && in sata_acpi_set_state()
883 zpodd_enable_run_wake(dev); in sata_acpi_set_state()
886 if (runtime && zpodd_dev_enabled(dev)) in sata_acpi_set_state()
887 zpodd_disable_run_wake(dev); in sata_acpi_set_state()
896 struct ata_device *dev; in pata_acpi_set_state() local
908 ata_for_each_dev(dev, &ap->link, ENABLED) { in pata_acpi_set_state()
909 acpi_handle dev_handle = ata_dev_acpi_handle(dev); in pata_acpi_set_state()
951 int ata_acpi_on_devcfg(struct ata_device *dev) in ata_acpi_on_devcfg() argument
953 struct ata_port *ap = dev->link->ap; in ata_acpi_on_devcfg()
959 if (!ata_dev_acpi_handle(dev)) in ata_acpi_on_devcfg()
963 if (!(dev->flags & ATA_DFLAG_ACPI_PENDING) && in ata_acpi_on_devcfg()
969 rc = ata_acpi_push_id(dev); in ata_acpi_on_devcfg()
975 rc = ata_acpi_exec_tfs(dev, &nr_executed); in ata_acpi_on_devcfg()
979 dev->flags &= ~ATA_DFLAG_ACPI_PENDING; in ata_acpi_on_devcfg()
983 rc = ata_dev_reread_id(dev, 0); in ata_acpi_on_devcfg()
985 ata_dev_err(dev, in ata_acpi_on_devcfg()
999 if (!(dev->flags & ATA_DFLAG_ACPI_FAILED)) { in ata_acpi_on_devcfg()
1000 dev->flags |= ATA_DFLAG_ACPI_FAILED; in ata_acpi_on_devcfg()
1004 dev->flags |= ATA_DFLAG_ACPI_DISABLED; in ata_acpi_on_devcfg()
1005 ata_dev_warn(dev, "ACPI: failed the second time, disabled\n"); in ata_acpi_on_devcfg()
1025 void ata_acpi_on_disable(struct ata_device *dev) in ata_acpi_on_disable() argument
1027 ata_acpi_clear_gtf(dev); in ata_acpi_on_disable()