nb/i945/gma.c: use IS_ENABLED instead of #if, #endif

Change-Id: Ib58126e1c9001ed679e161d6d06241fac762bdb3
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/17049
Tested-by: build bot (Jenkins)
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Arthur Heymans 2016-10-18 02:15:44 +02:00 committed by Martin Roth
parent fe517f635b
commit 9c5fc62f96
1 changed files with 76 additions and 74 deletions

View File

@ -46,8 +46,6 @@
#define BASE_FREQUENCY 100000
#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
static int gtt_setup(void *mmiobase)
{
unsigned long PGETBL_save;
@ -218,19 +216,21 @@ static int intel_gma_init_lvds(struct northbridge_intel_i945_config *conf,
BASE_FREQUENCY * (5 * (pixel_m1 + 2) + (pixel_m2 + 2)) /
(pixel_n + 2) / (pixel_p1 * pixel_p2));
#if !IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)
write32(pmmio + PF_WIN_SZ(0), vactive | (hactive << 16));
write32(pmmio + PF_WIN_POS(0), 0);
write32(pmmio + PF_CTL(0),PF_ENABLE | PF_FILTER_MED_3x3);
write32(pmmio + PFIT_CONTROL, PFIT_ENABLE | (1 << PFIT_PIPE_SHIFT) | HORIZ_AUTO_SCALE | VERT_AUTO_SCALE);
#else
if (IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)) {
/* Disable panel fitter (we're in native resolution). */
write32(pmmio + PF_CTL(0), 0);
write32(pmmio + PF_WIN_SZ(0), 0);
write32(pmmio + PF_WIN_POS(0), 0);
write32(pmmio + PFIT_PGM_RATIOS, 0);
write32(pmmio + PFIT_CONTROL, 0);
#endif
} else {
write32(pmmio + PF_WIN_SZ(0), vactive | (hactive << 16));
write32(pmmio + PF_WIN_POS(0), 0);
write32(pmmio + PF_CTL(0), PF_ENABLE | PF_FILTER_MED_3x3);
write32(pmmio + PFIT_CONTROL, PFIT_ENABLE
| (1 << PFIT_PIPE_SHIFT) | HORIZ_AUTO_SCALE
| VERT_AUTO_SCALE);
}
mdelay(1);
@ -279,11 +279,13 @@ static int intel_gma_init_lvds(struct northbridge_intel_i945_config *conf,
((vactive + bottom_border + vfront_porch + vsync - 1) << 16)
| (vactive + bottom_border + vfront_porch - 1));
#if !IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)
if (IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)) {
write32(pmmio + PIPESRC(1), ((hactive - 1) << 16)
| (vactive - 1));
} else {
write32(pmmio + PIPESRC(1), (639 << 16) | 399);
#else
write32(pmmio + PIPESRC(1), ((hactive - 1) << 16) | (vactive - 1));
#endif
}
mdelay(1);
write32(pmmio + DSPSIZE(0), (hactive - 1) | ((vactive - 1) << 16));
@ -368,21 +370,21 @@ static int intel_gma_init_lvds(struct northbridge_intel_i945_config *conf,
else
printk(BIOS_ERR, "ERROR: GTT is still Disabled!!!\n");
#if !IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)
vga_misc_write(0x67);
write32(pmmio + DSPCNTR(0), DISPPLANE_SEL_PIPE_B);
write32(pmmio + VGACNTRL, 0x02c4008e | VGA_PIPE_B_SELECT);
vga_textmode_init();
#else
if (IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE)) {
printk(BIOS_SPEW, "memset %p to 0x00 for %d bytes\n",
(void *)pgfx, hactive * vactive * 4);
memset((void *)pgfx, 0x00, hactive * vactive * 4);
set_vbe_mode_info_valid(&edid, pgfx);
#endif
} else {
vga_misc_write(0x67);
write32(pmmio + DSPCNTR(0), DISPPLANE_SEL_PIPE_B);
write32(pmmio + VGACNTRL, 0x02c4008e
| VGA_PIPE_B_SELECT);
vga_textmode_init();
}
return 0;
}
@ -575,7 +577,6 @@ static int probe_edid(u8 *pmmio, u8 slave)
return 1;
}
#endif
static void gma_func0_init(struct device *dev)
{
@ -593,13 +594,12 @@ static void gma_func0_init(struct device *dev)
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER
| PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
#if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
/* PCI Init, will run VBIOS */
pci_dev_init(dev);
#endif
}
#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
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");
void *mmiobase;
@ -619,10 +619,12 @@ static void gma_func0_init(struct device *dev)
/* probe if VGA is connected and alway run */
/* VGA init if no LVDS is connected */
if (!probe_edid(mmiobase, 3) || probe_edid(mmiobase, 2))
err = intel_gma_init_vga(conf, pci_read_config32(dev, 0x5c) & ~0xf,
err = intel_gma_init_vga(conf,
pci_read_config32(dev, 0x5c) & ~0xf,
iobase, mmiobase, graphics_base);
else
err = intel_gma_init_lvds(conf, pci_read_config32(dev, 0x5c) & ~0xf,
err = intel_gma_init_lvds(conf,
pci_read_config32(dev, 0x5c) & ~0xf,
iobase, mmiobase, graphics_base);
if (err == 0)
gfx_set_init_done(1);
@ -635,7 +637,7 @@ static void gma_func0_init(struct device *dev)
generate_fake_intel_oprom(&conf->gfx, dev,
"$VBT LAKEPORT-G");
}
#endif
}
}
/* This doesn't reclaim stolen UMA memory, but IGD could still