]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/libata.h
libata: misc updates to prepare for slave link
[linux-2.6-omap-h63xx.git] / include / linux / libata.h
index 225bfc5bd9ec1eb43b143d059f926918a30c2656..0c7e6f3c28eb7057c1e2a9b31d1696031bcf3570 100644 (file)
@@ -321,6 +321,8 @@ enum {
        ATA_EH_LPM              = (1 << 4),  /* link power management action */
 
        ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE,
+       ATA_EH_ALL_ACTIONS      = ATA_EH_REVALIDATE | ATA_EH_RESET |
+                                 ATA_EH_ENABLE_LINK | ATA_EH_LPM,
 
        /* ata_eh_info->flags */
        ATA_EHI_HOTPLUGGED      = (1 << 0),  /* could have been hotplugged */
@@ -772,8 +774,8 @@ struct ata_port_operations {
        /*
         * Optional features
         */
-       int  (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-       int  (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val);
+       int  (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val);
+       int  (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
        void (*pmp_attach)(struct ata_port *ap);
        void (*pmp_detach)(struct ata_port *ap);
        int  (*enable_pm)(struct ata_port *ap, enum link_pm policy);
@@ -920,8 +922,8 @@ extern int sata_scr_valid(struct ata_link *link);
 extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
 extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
 extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
-extern int ata_link_online(struct ata_link *link);
-extern int ata_link_offline(struct ata_link *link);
+extern bool ata_link_online(struct ata_link *link);
+extern bool ata_link_offline(struct ata_link *link);
 #ifdef CONFIG_PM
 extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
 extern void ata_host_resume(struct ata_host *host);
@@ -1265,34 +1267,17 @@ static inline int ata_link_active(struct ata_link *link)
        return ata_tag_valid(link->active_tag) || link->sactive;
 }
 
-static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
-{
-       if (sata_pmp_attached(ap))
-               return ap->pmp_link;
-       return &ap->link;
-}
-
-static inline struct ata_link *ata_port_next_link(struct ata_link *link)
-{
-       struct ata_port *ap = link->ap;
-
-       if (ata_is_host_link(link)) {
-               if (!sata_pmp_attached(ap))
-                       return NULL;
-               return ap->pmp_link;
-       }
-
-       if (++link < ap->nr_pmp_links + ap->pmp_link)
-               return link;
-       return NULL;
-}
+extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
+                                            struct ata_link *link,
+                                            bool dev_only);
 
-#define __ata_port_for_each_link(lk, ap) \
-       for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk))
+#define __ata_port_for_each_link(link, ap) \
+       for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
+            (link) = __ata_port_next_link((ap), (link), false))
 
 #define ata_port_for_each_link(link, ap) \
-       for ((link) = ata_port_first_link(ap); (link); \
-            (link) = ata_port_next_link(link))
+       for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
+            (link) = __ata_port_next_link((ap), (link), true))
 
 #define ata_link_for_each_dev(dev, link) \
        for ((dev) = (link)->device; \