payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / lenovo / t530 / early_init.c
blob498341001513c6ad8b3bdf42bae798098c223255
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <stdint.h>
4 #include <device/pci_ops.h>
5 #include <device/pci_def.h>
6 #include <northbridge/intel/sandybridge/raminit_native.h>
7 #include <southbridge/intel/bd82x6x/pch.h>
8 #include <northbridge/intel/sandybridge/sandybridge.h>
9 #include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
10 #include <device/device.h>
12 static void hybrid_graphics_init(void)
14 bool peg, igd;
15 u32 reg32;
17 early_hybrid_graphics(&igd, &peg);
19 if (peg && igd)
20 return;
22 /* Hide disabled devices */
23 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
24 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
26 if (peg)
27 reg32 |= DEVEN_PEG10;
29 if (igd)
30 reg32 |= DEVEN_IGD;
31 else
32 /* Disable IGD VGA decode, no GTT or GFX stolen */
33 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
35 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
38 void mainboard_early_init(int s3resume)
40 hybrid_graphics_init();