]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/libata.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / include / linux / libata.h
index 2b5a0b77e179a72a64b0a800ba9955e39cca71ab..07ed56f7a767bfda737db92a1b21318cb2a4f033 100644 (file)
@@ -443,8 +443,9 @@ enum link_pm {
        MAX_PERFORMANCE,
        MEDIUM_POWER,
 };
-extern struct class_device_attribute class_device_attr_link_power_management_policy;
+extern struct device_attribute dev_attr_link_power_management_policy;
 
+#ifdef CONFIG_ATA_SFF
 struct ata_ioports {
        void __iomem            *cmd_addr;
        void __iomem            *data_addr;
@@ -462,6 +463,7 @@ struct ata_ioports {
        void __iomem            *bmdma_addr;
        void __iomem            *scr_addr;
 };
+#endif /* CONFIG_ATA_SFF */
 
 struct ata_host {
        spinlock_t              lock;
@@ -648,7 +650,9 @@ struct ata_port {
        struct ata_prd          *prd;    /* our SG list */
        dma_addr_t              prd_dma; /* and its DMA mapping */
 
+#ifdef CONFIG_ATA_SFF
        struct ata_ioports      ioaddr; /* ATA cmd/ctl/dma register blocks */
+#endif /* CONFIG_ATA_SFF */
 
        u8                      ctl;    /* cache of ATA control register */
        u8                      last_ctl;       /* Cache last written value */
@@ -715,6 +719,7 @@ struct ata_port_operations {
        int  (*check_atapi_dma)(struct ata_queued_cmd *qc);
        void (*qc_prep)(struct ata_queued_cmd *qc);
        unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
+       bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
 
        /*
         * Configuration and exception handling
@@ -759,6 +764,7 @@ struct ata_port_operations {
        void (*port_stop)(struct ata_port *ap);
        void (*host_stop)(struct ata_host *host);
 
+#ifdef CONFIG_ATA_SFF
        /*
         * SFF / taskfile oriented ops
         */
@@ -778,6 +784,7 @@ struct ata_port_operations {
        void (*bmdma_start)(struct ata_queued_cmd *qc);
        void (*bmdma_stop)(struct ata_queued_cmd *qc);
        u8   (*bmdma_status)(struct ata_port *ap);
+#endif /* CONFIG_ATA_SFF */
 
        /*
         * Obsolete
@@ -910,7 +917,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
 extern int ata_xfer_mode2shift(unsigned long xfer_mode);
 extern const char *ata_mode_string(unsigned long xfer_mask);
 extern unsigned long ata_id_xfermask(const u16 *id);
-extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
 extern int ata_port_start(struct ata_port *ap);
 extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
 extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
@@ -923,8 +929,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
 extern void ata_id_c_string(const u16 *id, unsigned char *s,
                            unsigned int ofs, unsigned int len);
 extern void ata_qc_complete(struct ata_queued_cmd *qc);
-extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active,
-                                   void (*finish_qc)(struct ata_queued_cmd *));
+extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
                              void (*done)(struct scsi_cmnd *));
 extern int ata_std_bios_param(struct scsi_device *sdev,
@@ -1021,12 +1026,6 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
 }
 #endif
 
-/*
- * PMP - drivers/ata/libata-pmp.c
- */
-extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
-extern void sata_pmp_error_handler(struct ata_port *ap);
-
 /*
  * EH - drivers/ata/libata-eh.c
  */
@@ -1070,7 +1069,6 @@ extern void ata_std_error_handler(struct ata_port *ap);
  */
 extern const struct ata_port_operations ata_base_port_ops;
 extern const struct ata_port_operations sata_port_ops;
-extern const struct ata_port_operations sata_pmp_port_ops;
 
 #define ATA_BASE_SHT(drv_name)                                 \
        .module                 = THIS_MODULE,                  \
@@ -1091,6 +1089,48 @@ extern const struct ata_port_operations sata_pmp_port_ops;
        ATA_BASE_SHT(drv_name),                                 \
        .change_queue_depth     = ata_scsi_change_queue_depth
 
+/*
+ * PMP helpers
+ */
+#ifdef CONFIG_SATA_PMP
+static inline bool sata_pmp_supported(struct ata_port *ap)
+{
+       return ap->flags & ATA_FLAG_PMP;
+}
+
+static inline bool sata_pmp_attached(struct ata_port *ap)
+{
+       return ap->nr_pmp_links != 0;
+}
+
+static inline int ata_is_host_link(const struct ata_link *link)
+{
+       return link == &link->ap->link;
+}
+#else /* CONFIG_SATA_PMP */
+static inline bool sata_pmp_supported(struct ata_port *ap)
+{
+       return false;
+}
+
+static inline bool sata_pmp_attached(struct ata_port *ap)
+{
+       return false;
+}
+
+static inline int ata_is_host_link(const struct ata_link *link)
+{
+       return 1;
+}
+#endif /* CONFIG_SATA_PMP */
+
+static inline int sata_srst_pmp(struct ata_link *link)
+{
+       if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
+               return SATA_PMP_CTRL_PORT;
+       return link->pmp;
+}
+
 /*
  * printk helpers
  */
@@ -1098,7 +1138,7 @@ extern const struct ata_port_operations sata_pmp_port_ops;
        printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
 
 #define ata_link_printk(link, lv, fmt, args...) do { \
-       if ((link)->ap->nr_pmp_links) \
+       if (sata_pmp_attached((link)->ap)) \
                printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                       (link)->pmp , ##args); \
        else \
@@ -1184,11 +1224,6 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
 /*
  * link helpers
  */
-static inline int ata_is_host_link(const struct ata_link *link)
-{
-       return link == &link->ap->link;
-}
-
 static inline int ata_link_max_devices(const struct ata_link *link)
 {
        if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
@@ -1203,7 +1238,7 @@ static inline int ata_link_active(struct ata_link *link)
 
 static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
 {
-       if (ap->nr_pmp_links)
+       if (sata_pmp_attached(ap))
                return ap->pmp_link;
        return &ap->link;
 }
@@ -1212,8 +1247,8 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
 {
        struct ata_port *ap = link->ap;
 
-       if (link == &ap->link) {
-               if (!ap->nr_pmp_links)
+       if (ata_is_host_link(link)) {
+               if (!sata_pmp_attached(ap))
                        return NULL;
                return ap->pmp_link;
        }
@@ -1347,9 +1382,31 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
        return *(struct ata_port **)&host->hostdata[0];
 }
 
+
+/**************************************************************************
+ * PMP - drivers/ata/libata-pmp.c
+ */
+#ifdef CONFIG_SATA_PMP
+
+extern const struct ata_port_operations sata_pmp_port_ops;
+
+extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
+extern void sata_pmp_error_handler(struct ata_port *ap);
+
+#else /* CONFIG_SATA_PMP */
+
+#define sata_pmp_port_ops              sata_port_ops
+#define sata_pmp_qc_defer_cmd_switch   ata_std_qc_defer
+#define sata_pmp_error_handler         ata_std_error_handler
+
+#endif /* CONFIG_SATA_PMP */
+
+
 /**************************************************************************
  * SFF - drivers/ata/libata-sff.c
  */
+#ifdef CONFIG_ATA_SFF
+
 extern const struct ata_port_operations ata_sff_port_ops;
 extern const struct ata_port_operations ata_bmdma_port_ops;
 
@@ -1385,6 +1442,7 @@ extern void ata_sff_irq_clear(struct ata_port *ap);
 extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
                            u8 status, int in_wq);
 extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
+extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
 extern unsigned int ata_sff_host_intr(struct ata_port *ap,
                                      struct ata_queued_cmd *qc);
 extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
@@ -1489,5 +1547,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
 
        return status;
 }
+#endif /* CONFIG_ATA_SFF */
 
 #endif /* __LINUX_LIBATA_H__ */