mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / lenovo / t430 / early_init.c
blobed1f59b8883d78f4a265c514fa6dfea616c71154
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/pci_ops.h>
4 #include <device/pci_def.h>
5 #include <ec/lenovo/pmh7/pmh7.h>
6 #include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
7 #include <northbridge/intel/sandybridge/sandybridge.h>
9 static void hybrid_graphics_init(void)
11 bool peg, igd;
12 u32 reg32;
14 early_hybrid_graphics(&igd, &peg);
16 if (peg && igd)
17 return;
19 /* Hide disabled devices */
20 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
21 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
23 if (peg)
24 reg32 |= DEVEN_PEG10;
26 if (igd)
27 reg32 |= DEVEN_IGD;
28 else
29 /* Disable IGD VGA decode, no GTT or GFX stolen */
30 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
32 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
35 void mainboard_early_init(int s3resume)
37 hybrid_graphics_init();