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()
581 static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg) in ahci_scr_offset() argument
590 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_scr_offset()
600 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_read()
601 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_read()
612 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_scr_write()
613 int offset = ahci_scr_offset(link->ap, sc_reg); in ahci_scr_write()
622 void ahci_start_engine(struct ata_port *ap) in ahci_start_engine() argument
624 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_engine()
635 int ahci_stop_engine(struct ata_port *ap) in ahci_stop_engine() argument
637 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_engine()
638 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_stop_engine()
648 (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && in ahci_stop_engine()
649 ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { in ahci_stop_engine()
650 dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); in ahci_stop_engine()
666 dev_err(ap->host->dev, "AHCI controller unavailable!\n"); in ahci_stop_engine()
675 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_stop_engine()
684 void ahci_start_fis_rx(struct ata_port *ap) in ahci_start_fis_rx() argument
686 void __iomem *port_mmio = ahci_port_base(ap); in ahci_start_fis_rx()
687 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_fis_rx()
688 struct ahci_port_priv *pp = ap->private_data; in ahci_start_fis_rx()
712 static int ahci_stop_fis_rx(struct ata_port *ap) in ahci_stop_fis_rx() argument
714 void __iomem *port_mmio = ahci_port_base(ap); in ahci_stop_fis_rx()
723 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, PORT_CMD_FIS_ON, in ahci_stop_fis_rx()
731 static void ahci_power_up(struct ata_port *ap) in ahci_power_up() argument
733 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_up()
734 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_up()
752 struct ata_port *ap = link->ap; in ahci_set_lpm() local
753 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_lpm()
754 struct ahci_port_priv *pp = ap->private_data; in ahci_set_lpm()
755 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_lpm()
784 ata_msleep(ap, 10); in ahci_set_lpm()
806 ahci_set_aggressive_devslp(ap, true); in ahci_set_lpm()
808 ahci_set_aggressive_devslp(ap, false); in ahci_set_lpm()
823 static void ahci_power_down(struct ata_port *ap) in ahci_power_down() argument
825 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_power_down()
826 void __iomem *port_mmio = ahci_port_base(ap); in ahci_power_down()
844 static void ahci_start_port(struct ata_port *ap) in ahci_start_port() argument
846 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_start_port()
847 struct ahci_port_priv *pp = ap->private_data; in ahci_start_port()
854 ahci_start_fis_rx(ap); in ahci_start_port()
858 hpriv->start_engine(ap); in ahci_start_port()
861 if (ap->flags & ATA_FLAG_EM) { in ahci_start_port()
862 ata_for_each_link(link, ap, EDGE) { in ahci_start_port()
867 rc = ap->ops->transmit_led_message(ap, in ahci_start_port()
886 if (ap->flags & ATA_FLAG_SW_ACTIVITY) in ahci_start_port()
887 ata_for_each_link(link, ap, EDGE) in ahci_start_port()
892 static int ahci_deinit_port(struct ata_port *ap, const char **emsg) in ahci_deinit_port() argument
895 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_deinit_port()
898 rc = hpriv->stop_engine(ap); in ahci_deinit_port()
905 rc = ahci_stop_fis_rx(ap); in ahci_deinit_port()
965 struct ata_port *ap = link->ap; in ahci_sw_activity() local
966 struct ahci_port_priv *pp = ap->private_data; in ahci_sw_activity()
981 struct ata_port *ap = link->ap; in ahci_sw_activity_blink() local
988 led_message |= ap->port_no | (link->pmp << 8); in ahci_sw_activity_blink()
994 spin_lock_irqsave(ap->lock, flags); in ahci_sw_activity_blink()
1017 spin_unlock_irqrestore(ap->lock, flags); in ahci_sw_activity_blink()
1018 ap->ops->transmit_led_message(ap, led_message, 4); in ahci_sw_activity_blink()
1023 struct ata_port *ap = link->ap; in ahci_init_sw_activity() local
1024 struct ahci_port_priv *pp = ap->private_data; in ahci_init_sw_activity()
1052 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, in ahci_transmit_led_message() argument
1055 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_transmit_led_message()
1056 struct ahci_port_priv *pp = ap->private_data; in ahci_transmit_led_message()
1071 ahci_rpm_get_port(ap); in ahci_transmit_led_message()
1072 spin_lock_irqsave(ap->lock, flags); in ahci_transmit_led_message()
1080 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1081 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1093 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); in ahci_transmit_led_message()
1108 spin_unlock_irqrestore(ap->lock, flags); in ahci_transmit_led_message()
1109 ahci_rpm_put_port(ap); in ahci_transmit_led_message()
1114 static ssize_t ahci_led_show(struct ata_port *ap, char *buf) in ahci_led_show() argument
1116 struct ahci_port_priv *pp = ap->private_data; in ahci_led_show()
1121 ata_for_each_link(link, ap, EDGE) { in ahci_led_show()
1128 static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, in ahci_led_store() argument
1133 struct ahci_port_priv *pp = ap->private_data; in ahci_led_store()
1155 return ap->ops->transmit_led_message(ap, state, size); in ahci_led_store()
1161 struct ata_port *ap = link->ap; in ahci_activity_store() local
1162 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_store()
1173 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1174 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1180 port_led_state |= (ap->port_no | (link->pmp << 8)); in ahci_activity_store()
1182 ap->ops->transmit_led_message(ap, port_led_state, 4); in ahci_activity_store()
1192 struct ata_port *ap = link->ap; in ahci_activity_show() local
1193 struct ahci_port_priv *pp = ap->private_data; in ahci_activity_show()
1202 static void ahci_port_clear_pending_irq(struct ata_port *ap) in ahci_port_clear_pending_irq() argument
1204 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_clear_pending_irq()
1205 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_clear_pending_irq()
1210 dev_dbg(ap->host->dev, "PORT_SCR_ERR 0x%x\n", tmp); in ahci_port_clear_pending_irq()
1215 dev_dbg(ap->host->dev, "PORT_IRQ_STAT 0x%x\n", tmp); in ahci_port_clear_pending_irq()
1219 writel(1 << ap->port_no, hpriv->mmio + HOST_IRQ_STAT); in ahci_port_clear_pending_irq()
1222 static void ahci_port_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1226 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1232 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1236 ahci_port_clear_pending_irq(ap); in ahci_port_init()
1241 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1253 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1255 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1256 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1259 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1272 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1281 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1283 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1311 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1313 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1314 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1320 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1328 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1344 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1351 hpriv->start_engine(ap); in ahci_kick_engine()
1356 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1361 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1362 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1383 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1386 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1399 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1400 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1401 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1411 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1421 ahci_disable_fbs(ap); in ahci_do_softreset()
1434 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1442 ata_msleep(ap, 1); in ahci_do_softreset()
1446 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1463 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1467 ahci_enable_fbs(ap); in ahci_do_softreset()
1479 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1499 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1516 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1517 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1550 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1551 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1552 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1559 hpriv->stop_engine(ap); in ahci_do_hardreset()
1566 ahci_port_clear_pending_irq(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()
1922 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1923 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1924 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1934 struct ata_port *ap; in ahci_handle_port_intr() local
1939 ap = host->ports[i]; in ahci_handle_port_intr()
1940 if (ap) { in ahci_handle_port_intr()
1941 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()