aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/Kconfig6
-rw-r--r--drivers/ata/Makefile3
-rw-r--r--drivers/ata/libata.h17
-rw-r--r--include/linux/libata.h27
4 files changed, 52 insertions, 1 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 48c8fc55391e..3eb6035b61b8 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -41,6 +41,12 @@ config ATA_ACPI
41 You can disable this at kernel boot time by using the 41 You can disable this at kernel boot time by using the
42 option libata.noacpi=1 42 option libata.noacpi=1
43 43
44config SATA_PMP
45 bool "SATA Port Multiplier support"
46 default y
47 help
48 This option adds support for SATA Port Multipliers.
49
44config SATA_AHCI 50config SATA_AHCI
45 tristate "AHCI SATA support" 51 tristate "AHCI SATA support"
46 depends on PCI 52 depends on PCI
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index e6e41b2c731c..1fbc2aa648b7 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -78,6 +78,7 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o
78# Should be last libata driver 78# Should be last libata driver
79obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o 79obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o
80 80
81libata-objs := libata-core.o libata-scsi.o libata-eh.o libata-pmp.o 81libata-objs := libata-core.o libata-scsi.o libata-eh.o
82libata-$(CONFIG_ATA_SFF) += libata-sff.o 82libata-$(CONFIG_ATA_SFF) += libata-sff.o
83libata-$(CONFIG_SATA_PMP) += libata-pmp.o
83libata-$(CONFIG_ATA_ACPI) += libata-acpi.o 84libata-$(CONFIG_ATA_ACPI) += libata-acpi.o
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 42b30e38495d..4aeeabb10a47 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,
203extern void ata_eh_finish(struct ata_port *ap); 203extern void ata_eh_finish(struct ata_port *ap);
204 204
205/* libata-pmp.c */ 205/* libata-pmp.c */
206#ifdef CONFIG_SATA_PMP
206extern int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *val); 207extern int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *val);
207extern int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val); 208extern int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val);
208extern int sata_pmp_attach(struct ata_device *dev); 209extern int sata_pmp_attach(struct ata_device *dev);
210#else /* CONFIG_SATA_PMP */
211static inline int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *val)
212{
213 return -EINVAL;
214}
215
216static inline int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)
217{
218 return -EINVAL;
219}
220
221static inline int sata_pmp_attach(struct ata_device *dev)
222{
223 return -EINVAL;
224}
225#endif /* CONFIG_SATA_PMP */
209 226
210/* libata-sff.c */ 227/* libata-sff.c */
211#ifdef CONFIG_ATA_SFF 228#ifdef CONFIG_ATA_SFF
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1908bf484743..165734a2dd47 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1092,6 +1092,7 @@ extern const struct ata_port_operations sata_port_ops;
1092/* 1092/*
1093 * PMP helpers 1093 * PMP helpers
1094 */ 1094 */
1095#ifdef CONFIG_SATA_PMP
1095static inline bool sata_pmp_supported(struct ata_port *ap) 1096static inline bool sata_pmp_supported(struct ata_port *ap)
1096{ 1097{
1097 return ap->flags & ATA_FLAG_PMP; 1098 return ap->flags & ATA_FLAG_PMP;
@@ -1106,6 +1107,22 @@ static inline int ata_is_host_link(const struct ata_link *link)
1106{ 1107{
1107 return link == &link->ap->link; 1108 return link == &link->ap->link;
1108} 1109}
1110#else /* CONFIG_SATA_PMP */
1111static inline bool sata_pmp_supported(struct ata_port *ap)
1112{
1113 return false;
1114}
1115
1116static inline bool sata_pmp_attached(struct ata_port *ap)
1117{
1118 return false;
1119}
1120
1121static inline int ata_is_host_link(const struct ata_link *link)
1122{
1123 return 1;
1124}
1125#endif /* CONFIG_SATA_PMP */
1109 1126
1110static inline int sata_srst_pmp(struct ata_link *link) 1127static inline int sata_srst_pmp(struct ata_link *link)
1111{ 1128{
@@ -1369,11 +1386,21 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1369/************************************************************************** 1386/**************************************************************************
1370 * PMP - drivers/ata/libata-pmp.c 1387 * PMP - drivers/ata/libata-pmp.c
1371 */ 1388 */
1389#ifdef CONFIG_SATA_PMP
1390
1372extern const struct ata_port_operations sata_pmp_port_ops; 1391extern const struct ata_port_operations sata_pmp_port_ops;
1373 1392
1374extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc); 1393extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
1375extern void sata_pmp_error_handler(struct ata_port *ap); 1394extern void sata_pmp_error_handler(struct ata_port *ap);
1376 1395
1396#else /* CONFIG_SATA_PMP */
1397
1398#define sata_pmp_port_ops sata_port_ops
1399#define sata_pmp_qc_defer_cmd_switch ata_std_qc_defer
1400#define sata_pmp_error_handler ata_std_error_handler
1401
1402#endif /* CONFIG_SATA_PMP */
1403
1377 1404
1378/************************************************************************** 1405/**************************************************************************
1379 * SFF - drivers/ata/libata-sff.c 1406 * SFF - drivers/ata/libata-sff.c