From 979e5efd49af439957f83b96a5761f5b5ccce9bb Mon Sep 17 00:00:00 2001 From: Nils Faerber Date: Tue, 11 Jan 2011 15:53:00 +0100 Subject: [PATCH] Apply Support PMP Disable Link Scanning Through Kernel Config patch --- drivers/ata/Kconfig | 8 ++++++++ drivers/ata/libata-pmp.c | 11 +++++++++++ include/linux/libata.h | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 36e2319264b..05c460fc20c 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -59,6 +59,14 @@ config SATA_PMP comment "Controllers with non-SFF native interface" +config SATA_PMP_DELAY_LINK_ENUMERATION + bool "SATA PMP Delay Link Enumeration" + default n + help + This option delays the enumeration of PMP links until + specifically requested by application or driver + (for use with libatardx) + config SATA_AHCI tristate "AHCI SATA support" depends on PCI diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 3120596d4af..a001ab8425f 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c @@ -13,6 +13,11 @@ #include "libata.h" #include "libata-transport.h" +/** +* Set to 1 to allow enumeration of devices behind PMP links +*/ +unsigned int sata_pmp_allow_link_enumeration_flag = 0; + const struct ata_port_operations sata_pmp_port_ops = { .inherits = &sata_port_ops, .pmp_prereset = ata_std_prereset, @@ -955,6 +960,11 @@ static int sata_pmp_eh_recover(struct ata_port *ap) if (rc) goto pmp_fail; + if( sata_pmp_is_link_enumeration_allowed() == 0 ) { + ata_port_printk(ap, KERN_WARNING, "skipping pmp link enumeration based on kernel configuration"); + return 0; + } + /* PHY event notification can disturb reset and other recovery * operations. Turn it off. */ @@ -1098,6 +1108,7 @@ void sata_pmp_error_handler(struct ata_port *ap) ata_eh_finish(ap); } +EXPORT_SYMBOL_GPL(sata_pmp_allow_link_enumeration_flag); EXPORT_SYMBOL_GPL(sata_pmp_port_ops); EXPORT_SYMBOL_GPL(sata_pmp_qc_defer_cmd_switch); EXPORT_SYMBOL_GPL(sata_pmp_error_handler); diff --git a/include/linux/libata.h b/include/linux/libata.h index d947b123166..86ca277a68b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1739,4 +1739,24 @@ static inline u8 ata_wait_idle(struct ata_port *ap) } #endif /* CONFIG_ATA_SFF */ +#ifdef CONFIG_SATA_PMP_DELAY_LINK_ENUMERATION +extern unsigned int sata_pmp_allow_link_enumeration_flag; +static inline void sata_pmp_allow_link_enumeration( unsigned int allow ) +{ + sata_pmp_allow_link_enumeration_flag = allow; +} +static inline unsigned int sata_pmp_is_link_enumeration_allowed( void ) +{ + return sata_pmp_allow_link_enumeration_flag; +} +#else +static inline void sata_pmp_allow_link_enumeration( unsigned int allow ) +{ + printk(KERN_WARNING "sata_pmp_allow_link_enumeration ignored - not included in kernel"); +} +static inline unsigned int sata_pmp_is_link_enumeration_allowed( void ) +{ + return 1; +} +#endif /* SATA_PMP_DELAY_LINK_ENUMERATION */ #endif /* __LINUX_LIBATA_H__ */ -- 2.39.2