Skip to contentSkip to conversation

PCI probing status cleanup

PATCH In review Tim Hockin 2 participants 2 messages Jul 10, 2001 PCI

lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 PCI probing status cleanup

Martin et al,

Attached is a tiny patch that clears the master abort bit on bridges when probing PCI devices.

Please let me know if there is any reason this would not be included in the mainline kernel.

Thanks
Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
drivers/pci/pci.c +12 -1
diff -ruN dist-2.4.6/drivers/pci/pci.c cobalt-2.4.6/drivers/pci/pci.c
@@ -1229,8 +1233,19 @@
 		return NULL;
 
 	/* some broken boards return 0 or ~0 if a slot is empty: */
-	if (l == 0xffffffff || l == 0x00000000 || l == 0x0000ffff || l == 0xffff0000)
+	if (l == 0xffffffff || l == 0x00000000 
+	 || l == 0x0000ffff || l == 0xffff0000) {
+		/*
+		 * host/pci and pci/pci bridges will set Received Master Abort
+		 * (bit 13) on failed configuration access (happens when
+		 * searching for devices).  To be safe, clear the status
+		 * register.
+		 */
+		unsigned short st;
+		pci_read_config_word(temp, PCI_STATUS, &st);
+		pci_write_config_word(temp, PCI_STATUS, st);
 		return NULL;
+	}
 
 	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
#1 lore raw
Quoted 5 lines · Tim Hockin
        /* some broken boards return 0 or ~0 if a slot is empty: */
drivers/pci/pci.c +3 -1
-       if (l == 0xffffffff || l == 0x00000000 || l == 0x0000ffff || l == 0xffff0000)
+       if (l == 0xffffffff || l == 0x00000000
+        || l == 0x0000ffff || l == 0xffff0000) {
+               /*

drivers/pci/pci.c line 1248

Quoted 10 lines
drivers/pci/pci.c +9 -0
+                * host/pci and pci/pci bridges will set Received Master Abort
+                * (bit 13) on failed configuration access (happens when
+                * searching for devices).  To be safe, clear the status
+                * register.
+                */
+               unsigned short st;
+               pci_read_config_word(temp, PCI_STATUS, &st);
+               pci_write_config_word(temp, PCI_STATUS, st);
                return NULL;
+       }

ok, though I wonder if we shouldn't just clear status for all PCI devices on boot for paranoia's sake.

Signature · 3 lines
Jeff Garzik      | A recent study has shown that too much soup
Building 1024    | can cause malaise in laboratory mice.
MandrakeSoft     |