lkml.org 
[lkml]   [1998]   [Mar]   [19]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 19 Mar 1998 14:17:55 +0100
FromMartin Mares <>
SubjectRe: PCI scan is broken
Hi,

> When a PCI device header type field bit 7 is set, the device is a multi-
> function device and all the functions must be scanned as well. I see that
> the pci.c code does attempt to do that, apparently, but it doesn't seem
> to work.

   It seems there is a minor bug in the PCI scanning code in 2.1 causing
it to fail when different functions of a single device have different
header types. Please try the following patch:

--- drivers/pci/pci.c.mj	Thu Mar 19 14:09:37 1998
+++ drivers/pci/pci.c	Thu Mar 19 14:14:32 1998
@@ -108,7 +108,7 @@
 __initfunc(unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp))
 {
 	unsigned int devfn, l, max, class;
-	unsigned char cmd, irq, tmp, hdr_type = 0;
+	unsigned char cmd, irq, tmp, hdr_type, is_multi = 0;
 	struct pci_dev *dev;
 	struct pci_bus *child;
 	int reg;
@@ -119,12 +119,13 @@
 
 	max = bus->secondary;
 	for (devfn = 0; devfn < 0xff; ++devfn) {
-		if (PCI_FUNC(devfn) == 0) {
-			pcibios_read_config_byte(bus->number, devfn, PCI_HEADER_TYPE, &hdr_type);
-		} else if (!(hdr_type & 0x80)) {
+		if (PCI_FUNC(devfn) && !is_multi) {
 			/* not a multi-function device */
 			continue;
 		}
+		pcibios_read_config_byte(bus->number, devfn, PCI_HEADER_TYPE, &hdr_type);
+		if (!PCI_FUNC(devfn))
+			is_multi = hdr_type & 0x80;
 
 		pcibios_read_config_dword(bus->number, devfn, PCI_VENDOR_ID, &l);
 		/* some broken boards return 0 if a slot is empty: */
				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"Black holes are where God divided by zero."

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.251 / U:0.220 seconds]
©2003-2008 Jasper Spaans