Lines Matching full:ap
47 static ssize_t ahci_led_show(struct ata_port *ap, char *buf);
48 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
50 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
58 static int ahci_port_start(struct ata_port *ap);
59 static void ahci_port_stop(struct ata_port *ap);
62 static void ahci_freeze(struct ata_port *ap);
63 static void ahci_thaw(struct ata_port *ap);
64 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep);
65 static void ahci_enable_fbs(struct ata_port *ap);
66 static void ahci_disable_fbs(struct ata_port *ap);
67 static void ahci_pmp_attach(struct ata_port *ap);
68 static void ahci_pmp_detach(struct ata_port *ap);
79 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
216 * @ap: Port to power on
222 static int ahci_rpm_get_port(struct ata_port *ap) in ahci_rpm_get_port() argument
224 return pm_runtime_get_sync(ap->dev); in ahci_rpm_get_port()
229 * @ap: Port to power down
234 static void ahci_rpm_put_port(struct ata_port *ap) in ahci_rpm_put_port() argument
236 pm_runtime_put(ap->dev); in ahci_rpm_put_port()
243 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_caps() local
244 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_caps()
253 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_cap2() local
254 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_cap2()
263 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_version() local
264 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_version()
273 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_port_cmd() local
274 void __iomem *port_mmio = ahci_port_base(ap); in ahci_show_port_cmd()
277 ahci_rpm_get_port(ap); in ahci_show_port_cmd()
279 ahci_rpm_put_port(ap); in ahci_show_port_cmd()
288 struct ata_port *ap = ata_shost_to_port(shost); in ahci_read_em_buffer() local
289 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_read_em_buffer()
297 ahci_rpm_get_port(ap); in ahci_read_em_buffer()
298 spin_lock_irqsave(ap->lock, flags); in ahci_read_em_buffer()
301 if (!(ap->flags & ATA_FLAG_EM) || em_ctl & EM_CTL_XMT || in ahci_read_em_buffer()
303 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
304 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
309 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
310 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
322 ata_port_warn(ap, in ahci_read_em_buffer()
337 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
338 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
348 struct ata_port *ap = ata_shost_to_port(shost); in ahci_store_em_buffer() local
349 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_store_em_buffer()
358 if (!(ap->flags & ATA_FLAG_EM) || in ahci_store_em_buffer()
363 ahci_rpm_get_port(ap); in ahci_store_em_buffer()
364 spin_lock_irqsave(ap->lock, flags); in ahci_store_em_buffer()
368 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
369 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
381 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
382 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
391 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_em_supported() local
392 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_em_supported()
396 ahci_rpm_get_port(ap); in ahci_show_em_supported()
398 ahci_rpm_put_port(ap); in ahci_show_em_supported()
582 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
591 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
601 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
602 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
613 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
614 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
623 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
625 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
636 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
638 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
639 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
649 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
650 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
651 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
667 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
676 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
685 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
687 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
688 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
689 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
713 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
715 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
724 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
732 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
734 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
735 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
753 struct ata_port *ap = link->ap; in ahci_set_lpm() local
754 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
755 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
756 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
785 ata_msleep(ap, 10); in ahci_set_lpm()
807 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
809 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
824 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
826 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
827 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
845 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
847 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
848 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
855 ahci_start_fis_rx(ap); in ahci_start_port()
859 hpriv->start_engine(ap); in ahci_start_port()
862 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
863 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
868 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
887 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
888 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
893 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
896 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
899 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
906 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
966 struct ata_port *ap = link->ap; in ahci_sw_activity() local
967 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
982 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
989 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
995 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1018 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1019 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1024 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1025 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1053 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1056 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1057 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1072 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1073 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1081 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1082 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1094 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1109 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1110 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1115 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1117 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1122 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1129 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1134 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1156 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1162 struct ata_port *ap = link->ap; in ahci_activity_store() local
1163 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1174 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1175 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1181 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1183 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1193 struct ata_port *ap = link->ap; in ahci_activity_show() local
1194 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1203 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1207 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1213 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1233 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1245 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1247 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1248 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1251 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1264 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1273 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1275 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1303 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1305 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1306 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1312 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1320 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1336 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1343 hpriv->start_engine(ap); in ahci_kick_engine()
1348 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1353 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1354 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1375 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1378 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1391 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1392 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1393 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1403 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1413 ahci_disable_fbs(ap); in ahci_do_softreset()
1426 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1434 ata_msleep(ap, 1); in ahci_do_softreset()
1438 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1455 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1459 ahci_enable_fbs(ap); in ahci_do_softreset()
1471 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1491 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1508 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1509 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1542 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1543 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1544 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1551 hpriv->stop_engine(ap); in ahci_do_hardreset()
1561 hpriv->start_engine(ap); in ahci_do_hardreset()
1564 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1581 struct ata_port *ap = link->ap; in ahci_postreset() local
1582 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1624 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1625 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1627 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1635 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1636 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1673 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1675 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1676 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1694 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1697 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1699 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1700 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1701 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1710 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1714 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1715 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1720 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1725 link = &ap->link; in ahci_error_intr()
1727 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1735 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1736 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1767 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1800 ata_port_freeze(ap); in ahci_error_intr()
1803 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1805 ata_port_abort(ap); in ahci_error_intr()
1808 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1811 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1812 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1813 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1814 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1822 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1824 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1828 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1843 sata_async_notification(ap); in ahci_handle_port_interrupt()
1859 sata_async_notification(ap); in ahci_handle_port_interrupt()
1869 if (ap->qc_active) { in ahci_handle_port_interrupt()
1875 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1882 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1888 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1892 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1894 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1900 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1905 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1906 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1914 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1915 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1916 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1928 struct ata_port *ap; in ahci_handle_port_intr() local
1933 ap = host->ports[i]; in ahci_handle_port_intr()
1934 if (ap) { in ahci_handle_port_intr()
1935 ahci_port_intr(ap); in ahci_handle_port_intr()
1995 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
1996 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
1997 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2026 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2048 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2050 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2056 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2058 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2060 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2062 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2067 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2073 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2075 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2077 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2079 hpriv->stop_engine(ap); in ahci_error_handler()
2080 hpriv->start_engine(ap); in ahci_error_handler()
2083 sata_pmp_error_handler(ap); in ahci_error_handler()
2085 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2086 hpriv->stop_engine(ap); in ahci_error_handler()
2092 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2096 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2099 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2101 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2102 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2103 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2110 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2140 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2169 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2179 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2181 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2182 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2183 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2197 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2204 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2208 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2210 hpriv->start_engine(ap); in ahci_enable_fbs()
2213 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2215 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2216 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2217 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2230 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2237 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2239 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2243 hpriv->start_engine(ap); in ahci_disable_fbs()
2246 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2248 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2249 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2256 ahci_enable_fbs(ap); in ahci_pmp_attach()
2268 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2272 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2274 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2275 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2278 ahci_disable_fbs(ap); in ahci_pmp_detach()
2287 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2291 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2293 ahci_rpm_get_port(ap); in ahci_port_resume()
2295 ahci_power_up(ap); in ahci_port_resume()
2296 ahci_start_port(ap); in ahci_port_resume()
2298 if (sata_pmp_attached(ap)) in ahci_port_resume()
2299 ahci_pmp_attach(ap); in ahci_port_resume()
2301 ahci_pmp_detach(ap); in ahci_port_resume()
2308 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2313 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2315 ahci_power_down(ap); in ahci_port_suspend()
2317 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2318 ata_port_freeze(ap); in ahci_port_suspend()
2321 ahci_rpm_put_port(ap); in ahci_port_suspend()
2326 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2328 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2329 struct device *dev = ap->host->dev; in ahci_port_start()
2339 if (ap->host->n_ports > 1) { in ahci_port_start()
2346 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2350 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2351 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2357 ap->port_no); in ahci_port_start()
2361 ap->port_no); in ahci_port_start()
2413 ap->lock = &pp->lock; in ahci_port_start()
2416 ap->private_data = pp; in ahci_port_start()
2419 return ahci_port_resume(ap); in ahci_port_start()
2422 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2425 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2430 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2432 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2438 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2440 ahci_rpm_put_port(ap); in ahci_port_stop()