Author: stuge Date: Sat Jun 4 17:40:12 2011 New Revision: 6620 URL: https://tracker.coreboot.org/trac/coreboot/changeset/6620
Log: vt8237r: Simplify bootblock init to work around nested if() romcc problem
During the hackathon in Prague we discovered that romcc has a problem compiling the previous nested if() statements correctly. This patch makes the code a little simpler, and indeed works around the romcc issue.
Signed-off-by: Peter Stuge peter@stuge.se Acked-by: Peter Stuge peter@stuge.se
Modified: trunk/src/southbridge/via/vt8237r/bootblock.c
Modified: trunk/src/southbridge/via/vt8237r/bootblock.c ============================================================================== --- trunk/src/southbridge/via/vt8237r/bootblock.c Fri Jun 3 21:59:52 2011 (r6619) +++ trunk/src/southbridge/via/vt8237r/bootblock.c Sat Jun 4 17:40:12 2011 (r6620) @@ -33,20 +33,23 @@ dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT8237R_LPC), 0);
- if (dev == PCI_DEV_INVALID) { - /* Power management controller */ - dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_VT8237S_LPC), 0); - - if (dev == PCI_DEV_INVALID) { - /* Power management controller */ - dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_VT8237A_LPC), 0); - - if (dev == PCI_DEV_INVALID) - return; - } - } + if (dev != PCI_DEV_INVALID) + goto found;
+ /* Power management controller */ + dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, + PCI_DEVICE_ID_VIA_VT8237S_LPC), 0); + + if (dev != PCI_DEV_INVALID) + goto found; + + /* Power management controller */ + dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA, + PCI_DEVICE_ID_VIA_VT8237A_LPC), 0); + + if (dev == PCI_DEV_INVALID) + return; + +found: pci_write_config8(dev, 0x41, 0x7f); }