Lines Matching full:ap
48 static ssize_t ahci_led_show(struct ata_port *ap, char *buf);
49 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
51 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
59 static int ahci_port_start(struct ata_port *ap);
60 static void ahci_port_stop(struct ata_port *ap);
63 static void ahci_freeze(struct ata_port *ap);
64 static void ahci_thaw(struct ata_port *ap);
65 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep);
66 static void ahci_enable_fbs(struct ata_port *ap);
67 static void ahci_disable_fbs(struct ata_port *ap);
68 static void ahci_pmp_attach(struct ata_port *ap);
69 static void ahci_pmp_detach(struct ata_port *ap);
80 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
235 * @ap: Port to power on
241 static int ahci_rpm_get_port(struct ata_port *ap) in ahci_rpm_get_port() argument
243 return pm_runtime_get_sync(ap->dev); in ahci_rpm_get_port()
248 * @ap: Port to power down
253 static void ahci_rpm_put_port(struct ata_port *ap) in ahci_rpm_put_port() argument
255 pm_runtime_put(ap->dev); in ahci_rpm_put_port()
262 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_caps() local
263 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_caps()
272 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_cap2() local
273 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_cap2()
282 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_version() local
283 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_version()
292 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_port_cmd() local
293 void __iomem *port_mmio = ahci_port_base(ap); in ahci_show_port_cmd()
296 ahci_rpm_get_port(ap); in ahci_show_port_cmd()
298 ahci_rpm_put_port(ap); in ahci_show_port_cmd()
307 struct ata_port *ap = ata_shost_to_port(shost); in ahci_read_em_buffer() local
308 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_read_em_buffer()
316 ahci_rpm_get_port(ap); in ahci_read_em_buffer()
317 spin_lock_irqsave(ap->lock, flags); in ahci_read_em_buffer()
320 if (!(ap->flags & ATA_FLAG_EM) || em_ctl & EM_CTL_XMT || in ahci_read_em_buffer()
322 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
323 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
328 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
329 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
341 ata_port_warn(ap, in ahci_read_em_buffer()
356 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
357 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
367 struct ata_port *ap = ata_shost_to_port(shost); in ahci_store_em_buffer() local
368 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_store_em_buffer()
377 if (!(ap->flags & ATA_FLAG_EM) || in ahci_store_em_buffer()
382 ahci_rpm_get_port(ap); in ahci_store_em_buffer()
383 spin_lock_irqsave(ap->lock, flags); in ahci_store_em_buffer()
387 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
388 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
400 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
401 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
410 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_em_supported() local
411 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_em_supported()
415 ahci_rpm_get_port(ap); in ahci_show_em_supported()
417 ahci_rpm_put_port(ap); in ahci_show_em_supported()
637 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
646 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
656 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
657 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
668 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
669 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
678 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
680 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
691 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
693 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
694 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
704 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
705 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
706 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
722 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
731 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
740 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
742 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
743 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
744 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
768 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
770 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
779 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
787 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
789 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
790 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
808 struct ata_port *ap = link->ap; in ahci_set_lpm() local
809 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
810 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
811 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
840 ata_msleep(ap, 10); in ahci_set_lpm()
862 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
864 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
879 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
881 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
882 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
900 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
902 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
903 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
910 ahci_start_fis_rx(ap); in ahci_start_port()
914 hpriv->start_engine(ap); in ahci_start_port()
917 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
918 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
923 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
942 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
943 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
948 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
951 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
954 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
961 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
1021 struct ata_port *ap = link->ap; in ahci_sw_activity() local
1022 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
1037 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
1044 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
1050 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1073 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1074 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1079 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1080 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1108 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1111 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1112 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1127 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1128 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1136 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1137 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1149 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1164 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1165 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1170 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1172 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1177 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1184 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1189 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1211 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1217 struct ata_port *ap = link->ap; in ahci_activity_store() local
1218 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1229 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1230 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1236 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1238 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1248 struct ata_port *ap = link->ap; in ahci_activity_show() local
1249 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1258 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1262 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1268 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1288 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1300 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1302 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1303 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1306 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1319 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1328 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1330 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1340 return ata_port_classify(ap, &tf); in ahci_dev_classify()
1358 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1360 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1361 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1367 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1375 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1391 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1398 hpriv->start_engine(ap); in ahci_kick_engine()
1403 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1408 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1409 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1430 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1433 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1446 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1447 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1448 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1456 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1466 ahci_disable_fbs(ap); in ahci_do_softreset()
1479 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1487 ata_msleep(ap, 1); in ahci_do_softreset()
1491 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1508 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1512 ahci_enable_fbs(ap); in ahci_do_softreset()
1523 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1541 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1558 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1559 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1590 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1591 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1592 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1597 hpriv->stop_engine(ap); in ahci_do_hardreset()
1607 hpriv->start_engine(ap); in ahci_do_hardreset()
1610 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1626 struct ata_port *ap = link->ap; in ahci_postreset() local
1627 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1667 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1668 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1670 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1678 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1679 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1716 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1718 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1719 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1736 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1739 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1741 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1742 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1743 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1752 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1756 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1757 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1762 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1767 link = &ap->link; in ahci_error_intr()
1769 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1777 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1778 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1809 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1842 ata_port_freeze(ap); in ahci_error_intr()
1845 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1847 ata_port_abort(ap); in ahci_error_intr()
1850 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1853 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1854 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1855 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1856 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1864 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1866 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1870 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1885 sata_async_notification(ap); in ahci_handle_port_interrupt()
1901 sata_async_notification(ap); in ahci_handle_port_interrupt()
1911 if (ap->qc_active) { in ahci_handle_port_interrupt()
1917 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1924 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1930 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1934 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1936 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1942 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1947 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1948 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1954 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1955 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1956 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1966 struct ata_port *ap; in ahci_handle_port_intr() local
1971 ap = host->ports[i]; in ahci_handle_port_intr()
1972 if (ap) { in ahci_handle_port_intr()
1973 ahci_port_intr(ap); in ahci_handle_port_intr()
2027 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
2028 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
2029 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2058 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2080 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2082 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2088 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2090 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2092 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2094 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2099 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2105 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2107 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2109 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2111 hpriv->stop_engine(ap); in ahci_error_handler()
2112 hpriv->start_engine(ap); in ahci_error_handler()
2115 sata_pmp_error_handler(ap); in ahci_error_handler()
2117 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2118 hpriv->stop_engine(ap); in ahci_error_handler()
2124 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2128 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2131 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2133 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2134 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2135 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2142 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2172 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2201 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2211 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2213 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2214 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2215 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2229 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2236 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2240 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2242 hpriv->start_engine(ap); in ahci_enable_fbs()
2245 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2247 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2248 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2249 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2262 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2269 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2271 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2275 hpriv->start_engine(ap); in ahci_disable_fbs()
2278 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2280 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2281 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2288 ahci_enable_fbs(ap); in ahci_pmp_attach()
2300 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2304 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2306 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2307 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2310 ahci_disable_fbs(ap); in ahci_pmp_detach()
2319 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2323 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2325 ahci_rpm_get_port(ap); in ahci_port_resume()
2327 ahci_power_up(ap); in ahci_port_resume()
2328 ahci_start_port(ap); in ahci_port_resume()
2330 if (sata_pmp_attached(ap)) in ahci_port_resume()
2331 ahci_pmp_attach(ap); in ahci_port_resume()
2333 ahci_pmp_detach(ap); in ahci_port_resume()
2340 static void ahci_handle_s2idle(struct ata_port *ap) in ahci_handle_s2idle() argument
2342 void __iomem *port_mmio = ahci_port_base(ap); in ahci_handle_s2idle()
2349 ata_msleep(ap, devslp_idle_timeout); in ahci_handle_s2idle()
2352 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2357 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2359 ahci_power_down(ap); in ahci_port_suspend()
2361 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2362 ata_port_freeze(ap); in ahci_port_suspend()
2365 if (acpi_storage_d3(ap->host->dev)) in ahci_port_suspend()
2366 ahci_handle_s2idle(ap); in ahci_port_suspend()
2368 ahci_rpm_put_port(ap); in ahci_port_suspend()
2373 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2375 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2376 struct device *dev = ap->host->dev; in ahci_port_start()
2386 if (ap->host->n_ports > 1) { in ahci_port_start()
2393 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2397 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2398 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2404 ap->port_no); in ahci_port_start()
2408 ap->port_no); in ahci_port_start()
2460 ap->lock = &pp->lock; in ahci_port_start()
2463 ap->private_data = pp; in ahci_port_start()
2466 return ahci_port_resume(ap); in ahci_port_start()
2469 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2472 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2477 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2479 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2485 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2487 ahci_rpm_put_port(ap); in ahci_port_stop()