Lines Matching refs: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);
240 static int ahci_rpm_get_port(struct ata_port *ap) in ahci_rpm_get_port() argument
242 return pm_runtime_get_sync(ap->dev); in ahci_rpm_get_port()
252 static void ahci_rpm_put_port(struct ata_port *ap) in ahci_rpm_put_port() argument
254 pm_runtime_put(ap->dev); in ahci_rpm_put_port()
261 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_caps() local
262 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_caps()
271 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_cap2() local
272 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_cap2()
281 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_host_version() local
282 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_host_version()
291 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_port_cmd() local
292 void __iomem *port_mmio = ahci_port_base(ap); in ahci_show_port_cmd()
295 ahci_rpm_get_port(ap); in ahci_show_port_cmd()
297 ahci_rpm_put_port(ap); in ahci_show_port_cmd()
306 struct ata_port *ap = ata_shost_to_port(shost); in ahci_read_em_buffer() local
307 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_read_em_buffer()
315 ahci_rpm_get_port(ap); in ahci_read_em_buffer()
316 spin_lock_irqsave(ap->lock, flags); in ahci_read_em_buffer()
319 if (!(ap->flags & ATA_FLAG_EM) || em_ctl & EM_CTL_XMT || in ahci_read_em_buffer()
321 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
322 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
327 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
328 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
340 ata_port_warn(ap, in ahci_read_em_buffer()
355 spin_unlock_irqrestore(ap->lock, flags); in ahci_read_em_buffer()
356 ahci_rpm_put_port(ap); in ahci_read_em_buffer()
366 struct ata_port *ap = ata_shost_to_port(shost); in ahci_store_em_buffer() local
367 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_store_em_buffer()
376 if (!(ap->flags & ATA_FLAG_EM) || in ahci_store_em_buffer()
381 ahci_rpm_get_port(ap); in ahci_store_em_buffer()
382 spin_lock_irqsave(ap->lock, flags); in ahci_store_em_buffer()
386 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
387 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
399 spin_unlock_irqrestore(ap->lock, flags); in ahci_store_em_buffer()
400 ahci_rpm_put_port(ap); in ahci_store_em_buffer()
409 struct ata_port *ap = ata_shost_to_port(shost); in ahci_show_em_supported() local
410 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_show_em_supported()
414 ahci_rpm_get_port(ap); in ahci_show_em_supported()
416 ahci_rpm_put_port(ap); in ahci_show_em_supported()
600 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
609 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
619 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
620 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
631 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
632 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
641 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
643 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
654 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
656 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
657 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
667 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
668 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
669 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
685 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
694 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
703 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
705 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
706 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
707 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
731 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
733 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
742 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
750 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
752 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
753 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
771 struct ata_port *ap = link->ap; in ahci_set_lpm() local
772 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
773 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
774 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
803 ata_msleep(ap, 10); in ahci_set_lpm()
825 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
827 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
842 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
844 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
845 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
863 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
865 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
866 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
873 ahci_start_fis_rx(ap); in ahci_start_port()
877 hpriv->start_engine(ap); in ahci_start_port()
880 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
881 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
886 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
905 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
906 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
911 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
914 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
917 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
924 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
984 struct ata_port *ap = link->ap; in ahci_sw_activity() local
985 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
1000 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
1007 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
1013 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1036 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1037 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1042 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1043 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1071 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1074 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1075 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1090 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1091 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1099 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1100 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1112 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1127 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1128 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1133 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1135 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1140 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1147 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1152 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1174 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1180 struct ata_port *ap = link->ap; in ahci_activity_store() local
1181 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1192 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()
1199 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1201 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1211 struct ata_port *ap = link->ap; in ahci_activity_show() local
1212 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1221 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1225 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1231 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1251 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1263 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1265 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1266 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1269 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1282 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1291 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1293 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1321 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1323 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1324 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1330 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1338 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1354 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1361 hpriv->start_engine(ap); in ahci_kick_engine()
1366 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1371 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1372 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1393 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1396 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1409 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1410 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1411 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1421 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1431 ahci_disable_fbs(ap); in ahci_do_softreset()
1444 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1452 ata_msleep(ap, 1); in ahci_do_softreset()
1456 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1473 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1477 ahci_enable_fbs(ap); in ahci_do_softreset()
1489 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1509 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1526 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1527 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1560 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1561 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1562 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1569 hpriv->stop_engine(ap); in ahci_do_hardreset()
1579 hpriv->start_engine(ap); in ahci_do_hardreset()
1582 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1599 struct ata_port *ap = link->ap; in ahci_postreset() local
1600 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1642 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1643 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1645 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1653 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1654 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1691 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1693 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1694 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1712 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1715 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1717 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1718 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1719 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1728 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1732 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1733 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1738 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1743 link = &ap->link; in ahci_error_intr()
1745 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1753 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1754 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1785 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1818 ata_port_freeze(ap); in ahci_error_intr()
1821 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1823 ata_port_abort(ap); in ahci_error_intr()
1826 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1829 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1830 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1831 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1832 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1840 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1842 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1846 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1861 sata_async_notification(ap); in ahci_handle_port_interrupt()
1877 sata_async_notification(ap); in ahci_handle_port_interrupt()
1887 if (ap->qc_active) { in ahci_handle_port_interrupt()
1893 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1900 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1906 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1910 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1912 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1918 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1923 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1924 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1932 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1933 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1934 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1946 struct ata_port *ap; in ahci_handle_port_intr() local
1951 ap = host->ports[i]; in ahci_handle_port_intr()
1952 if (ap) { in ahci_handle_port_intr()
1953 ahci_port_intr(ap); in ahci_handle_port_intr()
2013 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
2014 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
2015 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2044 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2066 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2068 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2074 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2076 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2078 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2080 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2085 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2091 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2093 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2095 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2097 hpriv->stop_engine(ap); in ahci_error_handler()
2098 hpriv->start_engine(ap); in ahci_error_handler()
2101 sata_pmp_error_handler(ap); in ahci_error_handler()
2103 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2104 hpriv->stop_engine(ap); in ahci_error_handler()
2110 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2114 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2117 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2119 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2120 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2121 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2128 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2158 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2187 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2197 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2199 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2200 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2201 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2215 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2222 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2226 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2228 hpriv->start_engine(ap); in ahci_enable_fbs()
2231 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2233 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2234 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2235 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2248 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2255 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2257 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2261 hpriv->start_engine(ap); in ahci_disable_fbs()
2264 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2266 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2267 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2274 ahci_enable_fbs(ap); in ahci_pmp_attach()
2286 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2290 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2292 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2293 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2296 ahci_disable_fbs(ap); in ahci_pmp_detach()
2305 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2309 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2311 ahci_rpm_get_port(ap); in ahci_port_resume()
2313 ahci_power_up(ap); in ahci_port_resume()
2314 ahci_start_port(ap); in ahci_port_resume()
2316 if (sata_pmp_attached(ap)) in ahci_port_resume()
2317 ahci_pmp_attach(ap); in ahci_port_resume()
2319 ahci_pmp_detach(ap); in ahci_port_resume()
2326 static void ahci_handle_s2idle(struct ata_port *ap) in ahci_handle_s2idle() argument
2328 void __iomem *port_mmio = ahci_port_base(ap); in ahci_handle_s2idle()
2335 ata_msleep(ap, devslp_idle_timeout); in ahci_handle_s2idle()
2338 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2343 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2345 ahci_power_down(ap); in ahci_port_suspend()
2347 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2348 ata_port_freeze(ap); in ahci_port_suspend()
2351 if (acpi_storage_d3(ap->host->dev)) in ahci_port_suspend()
2352 ahci_handle_s2idle(ap); in ahci_port_suspend()
2354 ahci_rpm_put_port(ap); in ahci_port_suspend()
2359 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2361 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2362 struct device *dev = ap->host->dev; in ahci_port_start()
2372 if (ap->host->n_ports > 1) { in ahci_port_start()
2379 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2383 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2384 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2390 ap->port_no); in ahci_port_start()
2394 ap->port_no); in ahci_port_start()
2446 ap->lock = &pp->lock; in ahci_port_start()
2449 ap->private_data = pp; in ahci_port_start()
2452 return ahci_port_resume(ap); in ahci_port_start()
2455 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2458 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2463 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2465 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2471 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2473 ahci_rpm_put_port(ap); in ahci_port_stop()