• Home
  • Raw
  • Download

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_init(struct device *dev, struct ata_port *ap, in ahci_port_init() argument
1206 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_init()
1212 rc = ahci_deinit_port(ap, &emsg); in ahci_port_init()
1232 ap->pflags |= ATA_PFLAG_EXTERNAL; in ahci_port_init()
1244 struct ata_port *ap = host->ports[i]; in ahci_init_controller() local
1246 port_mmio = ahci_port_base(ap); in ahci_init_controller()
1247 if (ata_port_is_dummy(ap)) in ahci_init_controller()
1250 ahci_port_init(host->dev, ap, i, mmio, port_mmio); in ahci_init_controller()
1263 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; in ahci_dev_config()
1272 unsigned int ahci_dev_classify(struct ata_port *ap) in ahci_dev_classify() argument
1274 void __iomem *port_mmio = ahci_port_base(ap); in ahci_dev_classify()
1302 int ahci_kick_engine(struct ata_port *ap) in ahci_kick_engine() argument
1304 void __iomem *port_mmio = ahci_port_base(ap); in ahci_kick_engine()
1305 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_kick_engine()
1311 rc = hpriv->stop_engine(ap); in ahci_kick_engine()
1319 if (!busy && !sata_pmp_attached(ap)) { in ahci_kick_engine()
1335 tmp = ata_wait_register(ap, port_mmio + PORT_CMD, in ahci_kick_engine()
1342 hpriv->start_engine(ap); in ahci_kick_engine()
1347 static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, in ahci_exec_polled_cmd() argument
1352 struct ahci_port_priv *pp = ap->private_data; in ahci_exec_polled_cmd()
1353 void __iomem *port_mmio = ahci_port_base(ap); in ahci_exec_polled_cmd()
1374 tmp = ata_wait_register(ap, port_mmio + PORT_CMD_ISSUE, in ahci_exec_polled_cmd()
1377 ahci_kick_engine(ap); in ahci_exec_polled_cmd()
1390 struct ata_port *ap = link->ap; in ahci_do_softreset() local
1391 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_softreset()
1392 struct ahci_port_priv *pp = ap->private_data; in ahci_do_softreset()
1402 rc = ahci_kick_engine(ap); in ahci_do_softreset()
1412 ahci_disable_fbs(ap); in ahci_do_softreset()
1425 if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, in ahci_do_softreset()
1433 ata_msleep(ap, 1); in ahci_do_softreset()
1437 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); in ahci_do_softreset()
1454 *class = ahci_dev_classify(ap); in ahci_do_softreset()
1458 ahci_enable_fbs(ap); in ahci_do_softreset()
1470 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_check_ready()
1490 void __iomem *port_mmio = ahci_port_base(link->ap); in ahci_bad_pmp_check_ready()
1507 struct ata_port *ap = link->ap; in ahci_pmp_retry_softreset() local
1508 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_retry_softreset()
1541 struct ata_port *ap = link->ap; in ahci_do_hardreset() local
1542 struct ahci_port_priv *pp = ap->private_data; in ahci_do_hardreset()
1543 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_do_hardreset()
1550 hpriv->stop_engine(ap); in ahci_do_hardreset()
1560 hpriv->start_engine(ap); in ahci_do_hardreset()
1563 *class = ahci_dev_classify(ap); in ahci_do_hardreset()
1580 struct ata_port *ap = link->ap; in ahci_postreset() local
1581 void __iomem *port_mmio = ahci_port_base(ap); in ahci_postreset()
1623 struct ata_port *ap = qc->ap; in ahci_pmp_qc_defer() local
1624 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_qc_defer()
1626 if (!sata_pmp_attached(ap) || pp->fbs_enabled) in ahci_pmp_qc_defer()
1634 struct ata_port *ap = qc->ap; in ahci_qc_prep() local
1635 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_prep()
1672 static void ahci_fbs_dec_intr(struct ata_port *ap) in ahci_fbs_dec_intr() argument
1674 struct ahci_port_priv *pp = ap->private_data; in ahci_fbs_dec_intr()
1675 void __iomem *port_mmio = ahci_port_base(ap); in ahci_fbs_dec_intr()
1693 dev_err(ap->host->dev, "failed to clear device error\n"); in ahci_fbs_dec_intr()
1696 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) in ahci_error_intr() argument
1698 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_intr()
1699 struct ahci_port_priv *pp = ap->private_data; in ahci_error_intr()
1700 struct ata_eh_info *host_ehi = &ap->link.eh_info; in ahci_error_intr()
1709 void __iomem *port_mmio = ahci_port_base(ap); in ahci_error_intr()
1713 if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) { in ahci_error_intr()
1714 link = &ap->pmp_link[pmp]; in ahci_error_intr()
1719 ata_for_each_link(link, ap, EDGE) in ahci_error_intr()
1724 link = &ap->link; in ahci_error_intr()
1726 active_qc = ata_qc_from_tag(ap, link->active_tag); in ahci_error_intr()
1734 ahci_scr_read(&ap->link, SCR_ERROR, &serror); in ahci_error_intr()
1735 ahci_scr_write(&ap->link, SCR_ERROR, serror); in ahci_error_intr()
1766 if (sata_pmp_attached(ap) && (irq_stat & PORT_IRQ_BAD_PMP)) { in ahci_error_intr()
1799 ata_port_freeze(ap); in ahci_error_intr()
1802 ahci_fbs_dec_intr(ap); in ahci_error_intr()
1804 ata_port_abort(ap); in ahci_error_intr()
1807 static void ahci_handle_port_interrupt(struct ata_port *ap, in ahci_handle_port_interrupt() argument
1810 struct ata_eh_info *ehi = &ap->link.eh_info; in ahci_handle_port_interrupt()
1811 struct ahci_port_priv *pp = ap->private_data; in ahci_handle_port_interrupt()
1812 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_handle_port_interrupt()
1813 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); in ahci_handle_port_interrupt()
1821 if (sata_lpm_ignore_phy_events(&ap->link)) { in ahci_handle_port_interrupt()
1823 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); in ahci_handle_port_interrupt()
1827 ahci_error_intr(ap, status); in ahci_handle_port_interrupt()
1842 sata_async_notification(ap); in ahci_handle_port_interrupt()
1858 sata_async_notification(ap); in ahci_handle_port_interrupt()
1868 if (ap->qc_active) { in ahci_handle_port_interrupt()
1874 if (ap->qc_active && pp->active_link->sactive) in ahci_handle_port_interrupt()
1881 rc = ata_qc_complete_multiple(ap, qc_active); in ahci_handle_port_interrupt()
1887 ata_port_freeze(ap); in ahci_handle_port_interrupt()
1891 static void ahci_port_intr(struct ata_port *ap) in ahci_port_intr() argument
1893 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_intr()
1899 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_port_intr()
1904 struct ata_port *ap = dev_instance; in ahci_multi_irqs_intr_hard() local
1905 void __iomem *port_mmio = ahci_port_base(ap); in ahci_multi_irqs_intr_hard()
1913 spin_lock(ap->lock); in ahci_multi_irqs_intr_hard()
1914 ahci_handle_port_interrupt(ap, port_mmio, status); in ahci_multi_irqs_intr_hard()
1915 spin_unlock(ap->lock); in ahci_multi_irqs_intr_hard()
1927 struct ata_port *ap; in ahci_handle_port_intr() local
1932 ap = host->ports[i]; in ahci_handle_port_intr()
1933 if (ap) { in ahci_handle_port_intr()
1934 ahci_port_intr(ap); in ahci_handle_port_intr()
1994 struct ata_port *ap = qc->ap; in ahci_qc_issue() local
1995 void __iomem *port_mmio = ahci_port_base(ap); in ahci_qc_issue()
1996 struct ahci_port_priv *pp = ap->private_data; in ahci_qc_issue()
2025 struct ahci_port_priv *pp = qc->ap->private_data; in ahci_qc_fill_rtf()
2047 static void ahci_freeze(struct ata_port *ap) in ahci_freeze() argument
2049 void __iomem *port_mmio = ahci_port_base(ap); in ahci_freeze()
2055 static void ahci_thaw(struct ata_port *ap) in ahci_thaw() argument
2057 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_thaw()
2059 void __iomem *port_mmio = ahci_port_base(ap); in ahci_thaw()
2061 struct ahci_port_priv *pp = ap->private_data; in ahci_thaw()
2066 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); in ahci_thaw()
2072 void ahci_error_handler(struct ata_port *ap) in ahci_error_handler() argument
2074 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_error_handler()
2076 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { in ahci_error_handler()
2078 hpriv->stop_engine(ap); in ahci_error_handler()
2079 hpriv->start_engine(ap); in ahci_error_handler()
2082 sata_pmp_error_handler(ap); in ahci_error_handler()
2084 if (!ata_dev_enabled(ap->link.device)) in ahci_error_handler()
2085 hpriv->stop_engine(ap); in ahci_error_handler()
2091 struct ata_port *ap = qc->ap; in ahci_post_internal_cmd() local
2095 ahci_kick_engine(ap); in ahci_post_internal_cmd()
2098 static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) in ahci_set_aggressive_devslp() argument
2100 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_set_aggressive_devslp()
2101 void __iomem *port_mmio = ahci_port_base(ap); in ahci_set_aggressive_devslp()
2102 struct ata_device *dev = ap->link.device; in ahci_set_aggressive_devslp()
2109 dev_info(ap->host->dev, "port does not support device sleep\n"); in ahci_set_aggressive_devslp()
2139 rc = hpriv->stop_engine(ap); in ahci_set_aggressive_devslp()
2168 hpriv->start_engine(ap); in ahci_set_aggressive_devslp()
2178 static void ahci_enable_fbs(struct ata_port *ap) in ahci_enable_fbs() argument
2180 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_enable_fbs()
2181 struct ahci_port_priv *pp = ap->private_data; in ahci_enable_fbs()
2182 void __iomem *port_mmio = ahci_port_base(ap); in ahci_enable_fbs()
2196 rc = hpriv->stop_engine(ap); in ahci_enable_fbs()
2203 dev_info(ap->host->dev, "FBS is enabled\n"); in ahci_enable_fbs()
2207 dev_err(ap->host->dev, "Failed to enable FBS\n"); in ahci_enable_fbs()
2209 hpriv->start_engine(ap); in ahci_enable_fbs()
2212 static void ahci_disable_fbs(struct ata_port *ap) in ahci_disable_fbs() argument
2214 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_disable_fbs()
2215 struct ahci_port_priv *pp = ap->private_data; in ahci_disable_fbs()
2216 void __iomem *port_mmio = ahci_port_base(ap); in ahci_disable_fbs()
2229 rc = hpriv->stop_engine(ap); in ahci_disable_fbs()
2236 dev_err(ap->host->dev, "Failed to disable FBS\n"); in ahci_disable_fbs()
2238 dev_info(ap->host->dev, "FBS is disabled\n"); in ahci_disable_fbs()
2242 hpriv->start_engine(ap); in ahci_disable_fbs()
2245 static void ahci_pmp_attach(struct ata_port *ap) in ahci_pmp_attach() argument
2247 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_attach()
2248 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_attach()
2255 ahci_enable_fbs(ap); in ahci_pmp_attach()
2267 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_attach()
2271 static void ahci_pmp_detach(struct ata_port *ap) in ahci_pmp_detach() argument
2273 void __iomem *port_mmio = ahci_port_base(ap); in ahci_pmp_detach()
2274 struct ahci_port_priv *pp = ap->private_data; in ahci_pmp_detach()
2277 ahci_disable_fbs(ap); in ahci_pmp_detach()
2286 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ahci_pmp_detach()
2290 int ahci_port_resume(struct ata_port *ap) in ahci_port_resume() argument
2292 ahci_rpm_get_port(ap); in ahci_port_resume()
2294 ahci_power_up(ap); in ahci_port_resume()
2295 ahci_start_port(ap); in ahci_port_resume()
2297 if (sata_pmp_attached(ap)) in ahci_port_resume()
2298 ahci_pmp_attach(ap); in ahci_port_resume()
2300 ahci_pmp_detach(ap); in ahci_port_resume()
2307 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) in ahci_port_suspend() argument
2312 rc = ahci_deinit_port(ap, &emsg); in ahci_port_suspend()
2314 ahci_power_down(ap); in ahci_port_suspend()
2316 ata_port_err(ap, "%s (%d)\n", emsg, rc); in ahci_port_suspend()
2317 ata_port_freeze(ap); in ahci_port_suspend()
2320 ahci_rpm_put_port(ap); in ahci_port_suspend()
2325 static int ahci_port_start(struct ata_port *ap) in ahci_port_start() argument
2327 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_start()
2328 struct device *dev = ap->host->dev; in ahci_port_start()
2338 if (ap->host->n_ports > 1) { in ahci_port_start()
2345 "%s%d", dev_driver_string(dev), ap->port_no); in ahci_port_start()
2349 if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { in ahci_port_start()
2350 void __iomem *port_mmio = ahci_port_base(ap); in ahci_port_start()
2356 ap->port_no); in ahci_port_start()
2360 ap->port_no); in ahci_port_start()
2412 ap->lock = &pp->lock; in ahci_port_start()
2415 ap->private_data = pp; in ahci_port_start()
2418 return ahci_port_resume(ap); in ahci_port_start()
2421 static void ahci_port_stop(struct ata_port *ap) in ahci_port_stop() argument
2424 struct ahci_host_priv *hpriv = ap->host->private_data; in ahci_port_stop()
2429 rc = ahci_deinit_port(ap, &emsg); in ahci_port_stop()
2431 ata_port_warn(ap, "%s (%d)\n", emsg, rc); in ahci_port_stop()
2437 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); in ahci_port_stop()
2439 ahci_rpm_put_port(ap); in ahci_port_stop()