[coreboot] r821 - coreboot-v3/arch/x86

svn at coreboot.org svn at coreboot.org
Mon Aug 25 07:12:01 CEST 2008


Author: rminnich
Date: 2008-08-25 07:11:59 +0200 (Mon, 25 Aug 2008)
New Revision: 821

Modified:
   coreboot-v3/arch/x86/pci_ops_conf1.c
Log:
Fix a simply bug in the find device function. 

Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
Acked-by: Ronald G. Minnich <rminnich at gmail.com>



Modified: coreboot-v3/arch/x86/pci_ops_conf1.c
===================================================================
--- coreboot-v3/arch/x86/pci_ops_conf1.c	2008-08-24 19:55:45 UTC (rev 820)
+++ coreboot-v3/arch/x86/pci_ops_conf1.c	2008-08-25 05:11:59 UTC (rev 821)
@@ -119,7 +119,8 @@
 	u8 hdr;
 	int bdf = bus << 16;
 
-	/* skip over all the function sin a device -- multifunction devices always have one vendor */
+	/* skip over all the functions in a device -- 
+	 * multifunction devices always have one vendor */
 	for (devfn = 0; devfn < 0x100; devfn += 8) {
 		u32 confaddr = bdf | (devfn << 8);
 		val = pci_conf1_read_config32(confaddr, PCI_VENDOR_ID);
@@ -127,7 +128,6 @@
 		if (val == 0xffffffff || val == 0x00000000 ||
 		    val == 0x0000ffff || val == 0xffff0000)
 			continue;
-
 		if (val == ((did << 16) | vid)) {
 			*busdevfn = confaddr;
 			return 1;
@@ -135,10 +135,16 @@
 
 		hdr = pci_conf1_read_config8(confaddr, PCI_HEADER_TYPE);
 		hdr &= 0x7F;
-
 		if (hdr == PCI_HEADER_TYPE_BRIDGE || hdr == PCI_HEADER_TYPE_CARDBUS) {
 			unsigned int busses;
 			busses = pci_conf1_read_config32(confaddr, PCI_PRIMARY_BUS);
+			/* We should never see a value of 0.
+			 * this can happen if we run this before 
+			 * things are set up (which we have to be able to do 
+			 * in stage 0 
+			 */
+			if (! busses)
+				continue;
 			if (pci_conf1_find_on_bus((busses >> 8) & 0xFF, vid, did, busdevfn))
 				return 1;
 		}





More information about the coreboot mailing list