| 1 |
|
| 2 |
|
| 3 |
#include <types.h> |
| 4 |
#include <device/pci_ops.h> |
| 5 |
#include <device/pci_def.h> |
| 6 |
#include <northbridge/intel/sandybridge/sandybridge.h> |
| 7 |
#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h> |
| 8 |
#include <device/device.h> |
| 9 |
|
| 10 |
static void hybrid_graphics_init(void) |
| 11 |
{ |
| 12 |
bool peg, igd; |
| 13 |
u32 reg32; |
| 14 |
|
| 15 |
early_hybrid_graphics(&igd, &peg); |
| 16 |
|
| 17 |
if (peg && igd) |
| 18 |
return; |
| 19 |
|
| 20 |
|
| 21 |
reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); |
| 22 |
reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); |
| 23 |
|
| 24 |
if (peg) |
| 25 |
reg32 |= DEVEN_PEG10; |
| 26 |
|
| 27 |
if (igd) |
| 28 |
reg32 |= DEVEN_IGD; |
| 29 |
else |
| 30 |
|
| 31 |
pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2); |
| 32 |
|
| 33 |
pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32); |
| 34 |
} |
| 35 |
|
| 36 |
void mainboard_early_init(int s3resume) |
| 37 |
{ |
| 38 |
hybrid_graphics_init(); |
| 39 |
} |