tech-kern archive

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

Patch to make PCI_CONF_MODE work (it might not?)



Hi,

I think code for PCI_CONF_MODE apparently bitrotted (for x86 at least)
pci_mode_detect always runs and overrides global pci_mode value,
So we cannot define it globally like this.

I may be misreading the code.

This may work:

diff --git a/sys/arch/x86/pci/pci_machdep.c b/sys/arch/x86/pci/pci_machdep.c
index be634d6..8fddac2 100644
--- a/sys/arch/x86/pci/pci_machdep.c
+++ b/sys/arch/x86/pci/pci_machdep.c
@@ -151,15 +151,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.73 2015/11/26 16:27:05 jakllsch Ex
 
 #include "opt_pci_conf_mode.h"
 
-#ifdef PCI_CONF_MODE
-#if (PCI_CONF_MODE == 1) || (PCI_CONF_MODE == 2)
-static int pci_mode = PCI_CONF_MODE;
-#else
-#error Invalid PCI configuration mode.
-#endif
-#else
 static int pci_mode = -1;
-#endif
 
 struct pci_conf_lock {
 	uint32_t cl_cpuno;	/* 0: unlocked
@@ -700,6 +692,14 @@ pci_mode_detect(void)
 	pcireg_t idreg;
 	extern char cpu_brand_string[];
 
+#ifdef PCI_CONF_MODE
+#if (PCI_CONF_MODE == 1) || (PCI_CONF_MODE == 2)
+	return (pci_mode = PCI_CONF_MODE);
+#else
+#error Invalid PCI configuration mode.
+#endif
+#endif
+
 	if (pci_mode != -1)
 		return pci_mode;
 



Home | Main Index | Thread Index | Old Index