diff options
Diffstat (limited to 'src/mainboard/lenovo/t520/romstage.c')
-rw-r--r-- | src/mainboard/lenovo/t520/romstage.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mainboard/lenovo/t520/romstage.c b/src/mainboard/lenovo/t520/romstage.c index f84bc0de6b..b5ea17cbac 100644 --- a/src/mainboard/lenovo/t520/romstage.c +++ b/src/mainboard/lenovo/t520/romstage.c @@ -35,6 +35,32 @@ #include <arch/cpu.h> #include <cpu/x86/msr.h> #include <cbfs.h> +#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h> +#include <device/device.h> +#include <device/pci.h> + +static void hybrid_graphics_init(void) +{ + bool peg, igd; + u32 reg32; + + early_hybrid_graphics(&igd, &peg); + + /* Hide disabled devices */ + reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); + reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); + + if (peg) + reg32 |= DEVEN_PEG10; + + if (igd) + reg32 |= DEVEN_IGD; + else + /* Disable IGD VGA decode, no GTT or GFX stolen */ + pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2); + + pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32); +} void pch_enable_lpc(void) { @@ -79,7 +105,9 @@ void mainboard_get_spd(spd_raw_data *spd, bool id_only) { read_spd (&spd[2], 0x51, id_only); } -void mainboard_early_init(int s3resume) { +void mainboard_early_init(int s3resume) +{ + hybrid_graphics_init(); } void mainboard_config_superio(void) |