Lines Matching full:ap
63 static ssize_t ahci_led_show(struct ata_port *ap, char *buf);
64 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
66 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
74 static int ahci_port_start(struct ata_port *ap);
75 static void ahci_port_stop(struct ata_port *ap);
78 static void ahci_freeze(struct ata_port *ap);
79 static void ahci_thaw(struct ata_port *ap);
80 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep);
81 static void ahci_enable_fbs(struct ata_port *ap);
82 static void ahci_disable_fbs(struct ata_port *ap);
83 static void ahci_pmp_attach(struct ata_port *ap);
84 static void ahci_pmp_detach(struct ata_port *ap);
95 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
231 * @ap: Port to power on
237 static int ahci_rpm_get_port(struct ata_port *ap) in ahci_rpm_get_port() argument
239 return pm_runtime_get_sync(ap->dev); in ahci_rpm_get_port()
244 * @ap: Port to power down
249 static void ahci_rpm_put_port(struct ata_port *ap) in ahci_rpm_put_port() argument
251 pm_runtime_put(ap->dev); in ahci_rpm_put_port()
258 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_caps() local
259 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_caps()
268 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_cap2() local
269 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_cap2()
278 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_version() local
279 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_version()
288 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_port_cmd() local
289 void __iomem *port_mmio = ahci_port_base(ap); in ahci_show_port_cmd()
292 ahci_rpm_get_port(ap); in ahci_show_port_cmd()
294 ahci_rpm_put_port(ap); in ahci_show_port_cmd()
303 struct ata_port *ap = ata_shost_to_port(shost); in ahci_read_em_buffer() local
304 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_read_em_buffer()
312 ahci_rpm_get_port(ap); in ahci_read_em_buffer()
313 spin_lock_irqsave(ap->lock, flags); in ahci_read_em_buffer()
316 if (!(ap->flags & ATA_FLAG_EM) || em_ctl & EM_CTL_XMT || in ahci_read_em_buffer()
318 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
319 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
324 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
325 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
337 ata_port_warn(ap, in ahci_read_em_buffer()
352 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
353 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
363 struct ata_port *ap = ata_shost_to_port(shost); in ahci_store_em_buffer() local
364 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_store_em_buffer()
373 if (!(ap->flags & ATA_FLAG_EM) || in ahci_store_em_buffer()
378 ahci_rpm_get_port(ap); in ahci_store_em_buffer()
379 spin_lock_irqsave(ap->lock, flags); in ahci_store_em_buffer()
383 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
384 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
396 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
397 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
406 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_em_supported() local
407 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_em_supported()
411 ahci_rpm_get_port(ap); in ahci_show_em_supported()
413 ahci_rpm_put_port(ap); in ahci_show_em_supported()
592 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
601 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
611 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
612 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
623 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
624 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
633 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
635 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
646 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
648 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
649 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
659 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
660 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
661 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
677 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
686 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
695 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
697 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
698 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
699 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
723 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
725 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
734 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
742 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
744 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
745 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
763 struct ata_port *ap = link->ap; in ahci_set_lpm() local
764 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
765 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
766 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
795 ata_msleep(ap, 10); in ahci_set_lpm()
817 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
819 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
834 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
836 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
837 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
855 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
857 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
858 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
865 ahci_start_fis_rx(ap); in ahci_start_port()
869 hpriv->start_engine(ap); in ahci_start_port()
872 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
873 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
878 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
897 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
898 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
903 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
906 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
909 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
916 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
976 struct ata_port *ap = link->ap; in ahci_sw_activity() local
977 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
992 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
999 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
1005 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1028 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1029 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1034 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1035 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1063 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1066 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1067 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1082 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1083 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1091 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1092 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1104 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1119 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1120 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1125 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1127 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1132 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1139 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1144 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1166 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1172 struct ata_port *ap = link->ap; in ahci_activity_store() local
1173 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1184 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1185 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1191 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1193 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1203 struct ata_port *ap = link->ap; in ahci_activity_show() local
1204 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1213 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1217 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1223 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1243 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1255 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1257 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1258 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1261 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1274 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1283 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1285 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1313 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1315 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1316 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1322 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1330 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1346 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1353 hpriv->start_engine(ap); in ahci_kick_engine()
1358 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1363 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1364 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1385 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1388 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1401 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1402 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1403 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1413 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1423 ahci_disable_fbs(ap); in ahci_do_softreset()
1436 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1444 ata_msleep(ap, 1); in ahci_do_softreset()
1448 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1465 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1469 ahci_enable_fbs(ap); in ahci_do_softreset()
1481 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1501 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1518 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1519 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1552 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1553 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1554 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1561 hpriv->stop_engine(ap); in ahci_do_hardreset()
1571 hpriv->start_engine(ap); in ahci_do_hardreset()
1574 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1591 struct ata_port *ap = link->ap; in ahci_postreset() local
1592 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1634 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1635 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1637 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1645 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1646 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1683 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1685 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1686 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1704 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1707 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1709 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1710 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1711 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1720 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1724 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1725 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1730 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1735 link = &ap->link; in ahci_error_intr()
1737 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1745 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1746 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1777 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1810 ata_port_freeze(ap); in ahci_error_intr()
1813 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1815 ata_port_abort(ap); in ahci_error_intr()
1818 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1821 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1822 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1823 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1824 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1832 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1834 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1838 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1853 sata_async_notification(ap); in ahci_handle_port_interrupt()
1869 sata_async_notification(ap); in ahci_handle_port_interrupt()
1879 if (ap->qc_active) { in ahci_handle_port_interrupt()
1885 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1892 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1898 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1902 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1904 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1910 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1915 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1916 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1924 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1925 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1926 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1938 struct ata_port *ap; in ahci_handle_port_intr() local
1943 ap = host->ports[i]; in ahci_handle_port_intr()
1944 if (ap) { in ahci_handle_port_intr()
1945 ahci_port_intr(ap); in ahci_handle_port_intr()
2005 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
2006 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
2007 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2036 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2058 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2060 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2066 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2068 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2070 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2072 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2077 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2083 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2085 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2087 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2089 hpriv->stop_engine(ap); in ahci_error_handler()
2090 hpriv->start_engine(ap); in ahci_error_handler()
2093 sata_pmp_error_handler(ap); in ahci_error_handler()
2095 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2096 hpriv->stop_engine(ap); in ahci_error_handler()
2102 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2106 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2109 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2111 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2112 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2113 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2120 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2150 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2179 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2189 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2191 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2192 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2193 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2207 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2214 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2218 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2220 hpriv->start_engine(ap); in ahci_enable_fbs()
2223 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2225 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2226 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2227 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2240 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2247 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2249 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2253 hpriv->start_engine(ap); in ahci_disable_fbs()
2256 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2258 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2259 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2266 ahci_enable_fbs(ap); in ahci_pmp_attach()
2278 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2282 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2284 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2285 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2288 ahci_disable_fbs(ap); in ahci_pmp_detach()
2297 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2301 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2303 ahci_rpm_get_port(ap); in ahci_port_resume()
2305 ahci_power_up(ap); in ahci_port_resume()
2306 ahci_start_port(ap); in ahci_port_resume()
2308 if (sata_pmp_attached(ap)) in ahci_port_resume()
2309 ahci_pmp_attach(ap); in ahci_port_resume()
2311 ahci_pmp_detach(ap); in ahci_port_resume()
2318 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2323 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2325 ahci_power_down(ap); in ahci_port_suspend()
2327 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2328 ata_port_freeze(ap); in ahci_port_suspend()
2331 ahci_rpm_put_port(ap); in ahci_port_suspend()
2336 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2338 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2339 struct device *dev = ap->host->dev; in ahci_port_start()
2349 if (ap->host->n_ports > 1) { in ahci_port_start()
2356 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2360 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2361 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2367 ap->port_no); in ahci_port_start()
2371 ap->port_no); in ahci_port_start()
2424 ap->lock = &pp->lock; in ahci_port_start()
2427 ap->private_data = pp; in ahci_port_start()
2430 return ahci_port_resume(ap); in ahci_port_start()
2433 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2436 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2441 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2443 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2449 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2451 ahci_rpm_put_port(ap); in ahci_port_stop()