[PATCH 2/2] PCI/ACPI: Report MSI support to BIOS if not disabled from command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rafael J. Wysocki <rjw@xxxxxxx>

We need to distinguish the situation in which MSI support is disabled
from the command line or through .config from the situation in which
it is disabled, because the hardware or BIOS can't handle it.  In the
former case we should not report MSI support to the BIOS through ACPI
_OSC, but in the latter case we should do that.

Introduce pci_msi_support_enabled() that can be used by
acpi_pci_root_add() to determine whether or not it should report MSI
support to the BIOS through _OSC.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
 drivers/acpi/pci_root.c |    2 +-
 drivers/pci/msi.c       |   12 ++++++++++++
 drivers/pci/pci.c       |    2 +-
 drivers/pci/pci.h       |    2 ++
 include/linux/pci.h     |    3 +++
 5 files changed, 19 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/pci/msi.c
===================================================================
--- linux-2.6.orig/drivers/pci/msi.c
+++ linux-2.6/drivers/pci/msi.c
@@ -24,6 +24,7 @@
 #include "msi.h"
 
 static int pci_msi_enable = 1;
+static bool msi_support_enabled = true;
 
 /* Arch hooks */
 
@@ -855,6 +856,17 @@ void pci_no_msi(void)
 	pci_msi_enable = 0;
 }
 
+void pci_no_msi_support(void)
+{
+	msi_support_enabled = false;
+	pci_no_msi();
+}
+
+bool pci_msi_support_enabled(void)
+{
+	return msi_support_enabled;
+}
+
 /**
  * pci_msi_enabled - is MSI enabled?
  *
Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -3062,7 +3062,7 @@ static int __init pci_setup(char *str)
 			*k++ = 0;
 		if (*str && (str = pcibios_setup(str)) && *str) {
 			if (!strcmp(str, "nomsi")) {
-				pci_no_msi();
+				pci_no_msi_support();
 			} else if (!strcmp(str, "noaer")) {
 				pci_no_aer();
 			} else if (!strcmp(str, "nodomains")) {
Index: linux-2.6/include/linux/pci.h
===================================================================
--- linux-2.6.orig/include/linux/pci.h
+++ linux-2.6/include/linux/pci.h
@@ -446,11 +446,14 @@ static inline bool pci_is_root_bus(struc
 }
 
 #ifdef CONFIG_PCI_MSI
+extern bool pci_msi_support_enabled(void);
+
 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
 {
 	return pci_dev->msi_enabled || pci_dev->msix_enabled;
 }
 #else
+static inline bool pci_msi_support_enabled(void) { return false; }
 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; }
 #endif
 
Index: linux-2.6/drivers/acpi/pci_root.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_root.c
+++ linux-2.6/drivers/acpi/pci_root.c
@@ -567,7 +567,7 @@ static int __devinit acpi_pci_root_add(s
 	if (pcie_aspm_support_enabled())
 		flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
 			OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
-	if (pci_msi_enabled())
+	if (pci_msi_support_enabled())
 		flags |= OSC_MSI_SUPPORT;
 	if (flags != base_flags)
 		acpi_pci_osc_support(root, flags);
Index: linux-2.6/drivers/pci/pci.h
===================================================================
--- linux-2.6.orig/drivers/pci/pci.h
+++ linux-2.6/drivers/pci/pci.h
@@ -140,9 +140,11 @@ extern unsigned int pci_pm_d3_delay;
 
 #ifdef CONFIG_PCI_MSI
 void pci_no_msi(void);
+extern void pci_no_msi_support(void);
 extern void pci_msi_init_pci_dev(struct pci_dev *dev);
 #else
 static inline void pci_no_msi(void) { }
+static inline void pci_no_msi_support(void) { }
 static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
 #endif
 

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux