diff options
author | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2015-09-07 03:06:31 -0700 |
---|---|---|
committer | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2015-09-07 23:51:25 +0000 |
commit | 9647094672eb2ea31c6192de92028614164b9d9c (patch) | |
tree | 620b443ba6719e62712627829b7d1b258a29735a /src/northbridge/intel/sandybridge/gma.c | |
parent | 8ac492999a57aa112fbcc063c6e0689d2c5d4776 (diff) |
intel/sandybridge: Do not guard native VGA init by #ifdefs
We don't build-test with native VGA init, so if the code is broken by
a commit, we won't see it when it's guarded by #ifdefs. This has
already happened in the past. Instead of gurading entire files, use
the IS_ENABLED() macro, and return early. This at least enables us to
build-test the code to some extent, while linker garbage collection
will removed unused parts.
BONUS: Indenting some blocks also makes the difference between
framebuffer init and textmode init clearer.
Change-Id: I334cdee214872f967ae090170d61a0e4951c6b35
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-on: http://review.coreboot.org/11586
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/northbridge/intel/sandybridge/gma.c')
-rw-r--r-- | src/northbridge/intel/sandybridge/gma.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/northbridge/intel/sandybridge/gma.c b/src/northbridge/intel/sandybridge/gma.c index c465694383..d1779db8da 100644 --- a/src/northbridge/intel/sandybridge/gma.c +++ b/src/northbridge/intel/sandybridge/gma.c @@ -577,29 +577,29 @@ static void gma_func0_init(struct device *dev) /* Init graphics power management */ gma_pm_init_pre_vbios(dev); -#if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT - /* PCI Init, will run VBIOS */ - pci_dev_init(dev); -#endif + if (!IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) + /* PCI Init, will run VBIOS */ + pci_dev_init(dev); /* Post VBIOS init */ gma_pm_init_post_vbios(dev); -#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT - /* This should probably run before post VBIOS init. */ - printk(BIOS_SPEW, "Initializing VGA without OPROM.\n"); - u8 *mmiobase; - u32 iobase, physbase, graphics_base; - struct northbridge_intel_sandybridge_config *conf = dev->chip_info; - iobase = dev->resource_list[2].base; - mmiobase = res2mmio(&dev->resource_list[0], 0, 0); - physbase = pci_read_config32(dev, 0x5c) & ~0xf; - graphics_base = dev->resource_list[1].base; - - int lightup_ok = i915lightup_sandy(&conf->gfx, physbase, iobase, mmiobase, graphics_base); - if (lightup_ok) - gfx_set_init_done(1); -#endif + if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { + /* This should probably run before post VBIOS init. */ + printk(BIOS_SPEW, "Initializing VGA without OPROM.\n"); + u8 *mmiobase; + u32 iobase, physbase, graphics_base; + struct northbridge_intel_sandybridge_config *conf = dev->chip_info; + iobase = dev->resource_list[2].base; + mmiobase = res2mmio(&dev->resource_list[0], 0, 0); + physbase = pci_read_config32(dev, 0x5c) & ~0xf; + graphics_base = dev->resource_list[1].base; + + int lightup_ok = i915lightup_sandy(&conf->gfx, physbase, iobase, + mmiobase, graphics_base); + if (lightup_ok) + gfx_set_init_done(1); + } } static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device) |