ChangeSet 1.1267.48.4, 2004/04/07 16:23:31-07:00, dlsy@snoqualmie.dp.intel.com

[PATCH] PCI Hotplug: SHPC & PCI-E hot-plug fixes

This patch contains the pciehp_msi_quirk for chipset fix with
CONFIG_HOTPLUG removed, fixes for interpretation of 0/1 for MRL
to match pcihpview and bus speed definition etc.


 drivers/hotplug/pci_hotplug.h |    2 +-
 drivers/hotplug/pciehp_ctrl.c |    6 +++---
 drivers/hotplug/shpchp_ctrl.c |   10 +++++-----
 drivers/hotplug/shpchp_hpc.c  |   14 +++++++-------
 drivers/pci/pci.c             |    1 +
 drivers/pci/quirks.c          |    9 +++++++++
 include/linux/pci.h           |    2 ++
 7 files changed, 28 insertions(+), 16 deletions(-)


diff -Nru a/drivers/hotplug/pci_hotplug.h b/drivers/hotplug/pci_hotplug.h
--- a/drivers/hotplug/pci_hotplug.h	Wed Apr 28 15:20:48 2004
+++ b/drivers/hotplug/pci_hotplug.h	Wed Apr 28 15:20:48 2004
@@ -43,7 +43,7 @@
 	PCI_SPEED_100MHz_PCIX_266	= 0x0a,
 	PCI_SPEED_133MHz_PCIX_266	= 0x0b,
 	PCI_SPEED_66MHz_PCIX_533	= 0x11,
-	PCI_SPEED_100MHz_PCIX_533	= 0X12,
+	PCI_SPEED_100MHz_PCIX_533	= 0x12,
 	PCI_SPEED_133MHz_PCIX_533	= 0x13,
 	PCI_SPEED_UNKNOWN		= 0xff,
 };
diff -Nru a/drivers/hotplug/pciehp_ctrl.c b/drivers/hotplug/pciehp_ctrl.c
--- a/drivers/hotplug/pciehp_ctrl.c	Wed Apr 28 15:20:48 2004
+++ b/drivers/hotplug/pciehp_ctrl.c	Wed Apr 28 15:20:48 2004
@@ -134,7 +134,7 @@
 	p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save));
 	p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
 
-	if (!getstatus) {
+	if (getstatus) {
 		/*
 		 * Switch opened
 		 */
@@ -1710,7 +1710,7 @@
 	}
 
 	rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
-	if (rc || !getstatus) {
+	if (rc || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
 		return (0);
@@ -1797,7 +1797,7 @@
 	}
 
 	ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
-	if (ret || !getstatus) {
+	if (ret || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
 		return (0);
diff -Nru a/drivers/hotplug/shpchp_ctrl.c b/drivers/hotplug/shpchp_ctrl.c
--- a/drivers/hotplug/shpchp_ctrl.c	Wed Apr 28 15:20:48 2004
+++ b/drivers/hotplug/shpchp_ctrl.c	Wed Apr 28 15:20:48 2004
@@ -138,7 +138,7 @@
 	p_slot->hpc_ops->get_adapter_status(p_slot, &(func->presence_save));
 	p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
 
-	if (!getstatus) {
+	if (getstatus) {
 		/*
 		 * Switch opened
 		 */
@@ -1224,7 +1224,7 @@
 					up(&ctrl->crit_sect);
 				}
 			} else {
-				if ((bus_speed > 0x4) || (max_bus_speed > 0x4))  {
+				if (bus_speed > 0x4)  {
 					err("%s: speed of bus %x and adapter %x mismatch\n", __FUNCTION__, bus_speed, adapter_speed);
 					return WRONG_BUS_FREQUENCY;
 				}
@@ -1307,7 +1307,7 @@
 					up(&ctrl->crit_sect);
 				}
 			} else {
-				if ((bus_speed > 0x2) || (max_bus_speed > 0x2))  {
+				if (bus_speed > 0x2) {
 					err("%s: speed of bus %x and adapter %x mismatch\n", __FUNCTION__, bus_speed, adapter_speed);
 					return WRONG_BUS_FREQUENCY;
 				}
@@ -2123,7 +2123,7 @@
 		return (0);
 	}
 	rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
-	if (rc || !getstatus) {
+	if (rc || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
 		return (0);
@@ -2208,7 +2208,7 @@
 		return (0);
 	}
 	ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
-	if (ret || !getstatus) {
+	if (ret || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
 		return (0);
diff -Nru a/drivers/hotplug/shpchp_hpc.c b/drivers/hotplug/shpchp_hpc.c
--- a/drivers/hotplug/shpchp_hpc.c	Wed Apr 28 15:20:48 2004
+++ b/drivers/hotplug/shpchp_hpc.c	Wed Apr 28 15:20:48 2004
@@ -103,12 +103,12 @@
 #define PCIX_66MHZ_ECC		0x5
 #define PCIX_100MHZ_ECC		0x6
 #define PCIX_133MHZ_ECC		0x7
-#define PCIX_66MHZ_266		0x8
-#define PCIX_100MHZ_266		0x9
-#define PCIX_133MHZ_266		0x0a
-#define PCIX_66MHZ_533		0x0b
-#define PCIX_100MHZ_533		0x0c
-#define PCIX_133MHZ_533		0x0d
+#define PCIX_66MHZ_266		0x9
+#define PCIX_100MHZ_266		0x0a
+#define PCIX_133MHZ_266		0x0b
+#define PCIX_66MHZ_533		0x11
+#define PCIX_100MHZ_533		0x12
+#define PCIX_133MHZ_533		0x13
 
 /* Slot Configuration */
 #define SLOT_NUM		0x0000001F
@@ -463,7 +463,7 @@
 	slot_reg = readl(php_ctlr->creg + SLOT1 + 4*(slot->hp_slot));
 	slot_status = (u16)slot_reg;
 
-	*status = ((slot_status & 0x0100) == 0) ? 1 : 0;
+	*status = ((slot_status & 0x0100) == 0) ? 0 : 1;	/* 0 -> close; 1 -> open */
 
 	DBG_LEAVE_ROUTINE 
 	return 0;
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c	Wed Apr 28 15:20:48 2004
+++ b/drivers/pci/pci.c	Wed Apr 28 15:20:48 2004
@@ -2214,6 +2214,7 @@
 
 EXPORT_SYMBOL(isa_dma_bridge_buggy);
 EXPORT_SYMBOL(pci_pci_problems);
+EXPORT_SYMBOL(pciehp_msi_quirk);
 
 /* Pool allocator */
 
diff -Nru a/drivers/pci/quirks.c b/drivers/pci/quirks.c
--- a/drivers/pci/quirks.c	Wed Apr 28 15:20:48 2004
+++ b/drivers/pci/quirks.c	Wed Apr 28 15:20:48 2004
@@ -719,6 +719,13 @@
 	}
 }
 
+int pciehp_msi_quirk;
+
+static void __devinit quirk_pciehp_msi(struct pci_dev *pdev)
+{
+	pciehp_msi_quirk = 1;
+}
+
 /*
  *  The main table of quirks.
  */
@@ -808,6 +815,8 @@
 	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801DB_0,	asus_hides_smbus_lpc },
 	{ PCI_FIXUP_HEADER,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82801BA_0,	asus_hides_smbus_lpc },
 
+	{ PCI_FIXUP_FINAL,	PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_SMCH,  quirk_pciehp_msi },
+	
 	{ 0 }
 };
 
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Wed Apr 28 15:20:48 2004
+++ b/include/linux/pci.h	Wed Apr 28 15:20:48 2004
@@ -833,5 +833,7 @@
 #define PCIPCI_VSFX		16
 #define PCIPCI_ALIMAGIK		32
 
+extern int pciehp_msi_quirk;
+
 #endif /* __KERNEL__ */
 #endif /* LINUX_PCI_H */
