diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 48c8fc55391ec15dc23d51fb94e882a63eb9d9b1..3eb6035b61b8433ac5e8361907b8fc6865bf44db 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -41,6 +41,12 @@ config ATA_ACPI You can disable this at kernel boot time by using the option libata.noacpi=1 +config SATA_PMP + bool "SATA Port Multiplier support" + default y + help + This option adds support for SATA Port Multipliers. + config SATA_AHCI tristate "AHCI SATA support" depends on PCI diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index e6e41b2c731cd0cb83638c0d3f2e2cf72f74ae94..1fbc2aa648b739955f1bb746c2ba0703039e4bb7 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o # Should be last libata driver obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o -libata-objs := libata-core.o libata-scsi.o libata-eh.o libata-pmp.o +libata-objs := libata-core.o libata-scsi.o libata-eh.o libata-$(CONFIG_ATA_SFF) += libata-sff.o +libata-$(CONFIG_SATA_PMP) += libata-pmp.o libata-$(CONFIG_ATA_ACPI) += libata-acpi.o diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 42b30e38495daa84484d8421d9415aa4609150ba..4aeeabb10a478c26cdf094d12ff7bd72cd14ac65 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -203,9 +203,26 @@ extern int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, extern void ata_eh_finish(struct ata_port *ap); /* libata-pmp.c */ +#ifdef CONFIG_SATA_PMP extern int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *val); extern int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val); extern int sata_pmp_attach(struct ata_device *dev); +#else /* CONFIG_SATA_PMP */ +static inline int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *val) +{ + return -EINVAL; +} + +static inline int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val) +{ + return -EINVAL; +} + +static inline int sata_pmp_attach(struct ata_device *dev) +{ + return -EINVAL; +} +#endif /* CONFIG_SATA_PMP */ /* libata-sff.c */ #ifdef CONFIG_ATA_SFF diff --git a/include/linux/libata.h b/include/linux/libata.h index 1908bf48474316c8f8c99e915a4cb12f9f840189..165734a2dd47318af7864ce187f613cfbead6ffb 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1092,6 +1092,7 @@ extern const struct ata_port_operations sata_port_ops; /* * PMP helpers */ +#ifdef CONFIG_SATA_PMP static inline bool sata_pmp_supported(struct ata_port *ap) { return ap->flags & ATA_FLAG_PMP; @@ -1106,6 +1107,22 @@ 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) { @@ -1369,11 +1386,21 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) /************************************************************************** * 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