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);
215 * @ap: Port to power on
221 static int ahci_rpm_get_port(struct ata_port *ap) in ahci_rpm_get_port() argument
223 return pm_runtime_get_sync(ap->dev); in ahci_rpm_get_port()
228 * @ap: Port to power down
233 static void ahci_rpm_put_port(struct ata_port *ap) in ahci_rpm_put_port() argument
235 pm_runtime_put(ap->dev); in ahci_rpm_put_port()
242 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_caps() local
243 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_caps()
252 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_cap2() local
253 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_cap2()
262 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_version() local
263 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_version()
272 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_port_cmd() local
273 void __iomem *port_mmio = ahci_port_base(ap); in ahci_show_port_cmd()
276 ahci_rpm_get_port(ap); in ahci_show_port_cmd()
278 ahci_rpm_put_port(ap); in ahci_show_port_cmd()
287 struct ata_port *ap = ata_shost_to_port(shost); in ahci_read_em_buffer() local
288 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_read_em_buffer()
296 ahci_rpm_get_port(ap); in ahci_read_em_buffer()
297 spin_lock_irqsave(ap->lock, flags); in ahci_read_em_buffer()
300 if (!(ap->flags & ATA_FLAG_EM) || em_ctl & EM_CTL_XMT || in ahci_read_em_buffer()
302 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
303 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
308 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
309 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
321 ata_port_warn(ap, in ahci_read_em_buffer()
336 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
337 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
347 struct ata_port *ap = ata_shost_to_port(shost); in ahci_store_em_buffer() local
348 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_store_em_buffer()
357 if (!(ap->flags & ATA_FLAG_EM) || in ahci_store_em_buffer()
362 ahci_rpm_get_port(ap); in ahci_store_em_buffer()
363 spin_lock_irqsave(ap->lock, flags); in ahci_store_em_buffer()
367 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
368 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
380 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
381 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
390 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_em_supported() local
391 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_em_supported()
395 ahci_rpm_get_port(ap); in ahci_show_em_supported()
397 ahci_rpm_put_port(ap); in ahci_show_em_supported()
576 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
585 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
595 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
596 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
607 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
608 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
617 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
619 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
630 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
632 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
633 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
643 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
644 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
645 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
661 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
670 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
679 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
681 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
682 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
683 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
707 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
709 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
718 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
726 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
728 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
729 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
747 struct ata_port *ap = link->ap; in ahci_set_lpm() local
748 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
749 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
750 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
779 ata_msleep(ap, 10); in ahci_set_lpm()
801 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
803 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
818 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
820 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
821 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
839 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
841 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
842 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
849 ahci_start_fis_rx(ap); in ahci_start_port()
853 hpriv->start_engine(ap); in ahci_start_port()
856 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
857 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
862 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
881 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
882 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
887 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
890 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
893 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
900 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
960 struct ata_port *ap = link->ap; in ahci_sw_activity() local
961 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
976 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
983 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
989 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1012 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1013 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1018 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1019 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1047 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1050 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1051 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1066 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1067 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1075 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1076 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1088 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1103 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1104 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1109 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1111 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1116 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1123 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1128 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1150 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1156 struct ata_port *ap = link->ap; in ahci_activity_store() local
1157 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1168 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1169 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1175 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1177 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1187 struct ata_port *ap = link->ap; in ahci_activity_show() local
1188 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1197 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1201 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1207 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1227 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1239 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1241 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1242 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1245 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1258 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1267 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1269 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1297 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1299 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1300 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1306 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1314 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1330 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1337 hpriv->start_engine(ap); in ahci_kick_engine()
1342 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1347 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1348 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1369 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1372 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1385 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1386 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1387 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1397 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1407 ahci_disable_fbs(ap); in ahci_do_softreset()
1420 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1428 ata_msleep(ap, 1); in ahci_do_softreset()
1432 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1449 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1453 ahci_enable_fbs(ap); in ahci_do_softreset()
1465 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1485 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1502 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1503 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1536 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1537 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1538 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1545 hpriv->stop_engine(ap); in ahci_do_hardreset()
1555 hpriv->start_engine(ap); in ahci_do_hardreset()
1558 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1575 struct ata_port *ap = link->ap; in ahci_postreset() local
1576 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1618 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1619 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1621 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1629 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1630 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1667 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1669 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1670 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1688 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1691 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1693 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1694 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1695 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1704 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1708 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1709 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1714 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1719 link = &ap->link; in ahci_error_intr()
1721 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1729 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1730 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1761 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1794 ata_port_freeze(ap); in ahci_error_intr()
1797 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1799 ata_port_abort(ap); in ahci_error_intr()
1802 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1805 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1806 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1807 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1808 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1816 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1818 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1822 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1837 sata_async_notification(ap); in ahci_handle_port_interrupt()
1853 sata_async_notification(ap); in ahci_handle_port_interrupt()
1863 if (ap->qc_active) { in ahci_handle_port_interrupt()
1869 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1876 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1882 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1886 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1888 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1894 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1899 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1900 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1908 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1909 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1910 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1922 struct ata_port *ap; in ahci_handle_port_intr() local
1927 ap = host->ports[i]; in ahci_handle_port_intr()
1928 if (ap) { in ahci_handle_port_intr()
1929 ahci_port_intr(ap); in ahci_handle_port_intr()
1989 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
1990 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
1991 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2020 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2042 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2044 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2050 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2052 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2054 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2056 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2061 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2067 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2069 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2071 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2073 hpriv->stop_engine(ap); in ahci_error_handler()
2074 hpriv->start_engine(ap); in ahci_error_handler()
2077 sata_pmp_error_handler(ap); in ahci_error_handler()
2079 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2080 hpriv->stop_engine(ap); in ahci_error_handler()
2086 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2090 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2093 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2095 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2096 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2097 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2104 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2134 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2163 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2173 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2175 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2176 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2177 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2191 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2198 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2202 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2204 hpriv->start_engine(ap); in ahci_enable_fbs()
2207 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2209 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2210 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2211 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2224 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2231 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2233 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2237 hpriv->start_engine(ap); in ahci_disable_fbs()
2240 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2242 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2243 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2250 ahci_enable_fbs(ap); in ahci_pmp_attach()
2262 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2266 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2268 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2269 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2272 ahci_disable_fbs(ap); in ahci_pmp_detach()
2281 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2285 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2287 ahci_rpm_get_port(ap); in ahci_port_resume()
2289 ahci_power_up(ap); in ahci_port_resume()
2290 ahci_start_port(ap); in ahci_port_resume()
2292 if (sata_pmp_attached(ap)) in ahci_port_resume()
2293 ahci_pmp_attach(ap); in ahci_port_resume()
2295 ahci_pmp_detach(ap); in ahci_port_resume()
2302 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2307 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2309 ahci_power_down(ap); in ahci_port_suspend()
2311 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2312 ata_port_freeze(ap); in ahci_port_suspend()
2315 ahci_rpm_put_port(ap); in ahci_port_suspend()
2320 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2322 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2323 struct device *dev = ap->host->dev; in ahci_port_start()
2333 if (ap->host->n_ports > 1) { in ahci_port_start()
2340 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2344 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2345 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2351 ap->port_no); in ahci_port_start()
2355 ap->port_no); in ahci_port_start()
2407 ap->lock = &pp->lock; in ahci_port_start()
2410 ap->private_data = pp; in ahci_port_start()
2413 return ahci_port_resume(ap); in ahci_port_start()
2416 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2419 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2424 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2426 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2432 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2434 ahci_rpm_put_port(ap); in ahci_port_stop()