blob: c49a297e7ed43d48006137f1db7fbf221a77d027 [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Zaolina823f9b2014-05-06 21:31:45 +02003
4#include <stdint.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02005#include <device/pci_ops.h>
Zaolina823f9b2014-05-06 21:31:45 +02006#include <device/pci_def.h>
Zaolina823f9b2014-05-06 21:31:45 +02007#include <northbridge/intel/sandybridge/sandybridge.h>
Nicolas Reinecke30d0aa92014-10-17 12:08:05 +02008#include <northbridge/intel/sandybridge/raminit_native.h>
Zaolina823f9b2014-05-06 21:31:45 +02009#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020010#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
11#include <device/device.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020012
13static void hybrid_graphics_init(void)
14{
15 bool peg, igd;
16 u32 reg32;
17
18 early_hybrid_graphics(&igd, &peg);
19
Evgeny Zinoviev384e9ae2018-08-30 02:18:48 +030020 if (peg && igd)
21 return;
22
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020023 /* Hide disabled devices */
24 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
25 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
26
27 if (peg)
28 reg32 |= DEVEN_PEG10;
29
30 if (igd)
31 reg32 |= DEVEN_IGD;
32 else
33 /* Disable IGD VGA decode, no GTT or GFX stolen */
34 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
35
36 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
37}
Zaolina823f9b2014-05-06 21:31:45 +020038
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +020039const struct southbridge_usb_port mainboard_usb_ports[] = {
40 { 1, 1, 0 }, /* P0 left dual conn, OC 0 */
Nico Rikkenecea3d42018-01-30 19:00:45 +010041 { 1, 1, 1 }, /* P1 system onboard USB (eSATA), (EHCI debug), OC 1 */
Vladimir Serbinenkofa1d6882014-10-19 02:50:45 +020042 { 1, 2, -1 }, /* P2: wimax / WLAN */
43 { 1, 1, -1 }, /* P3: WWAN, no OC */
44 { 1, 1, -1 }, /* P4: smartcard, no OC */
45 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
46 { 0, 2, -1 }, /* P6: empty */
47 { 0, 2, -1 }, /* P7: to touch panel, no OC */
48 { 1, 1, 4 }, /* P8: left dual conn, OC4 */
49 { 1, 4, 5 }, /* P9: to system subcard back right, (EHCI debug), OC 5 */
50 { 1, 1, -1 }, /* P10: fingerprint reader, no OC */
51 { 1, 2, -1 }, /* P11: bluetooth, no OC. */
52 { 1, 1, -1 }, /* P12: docking, no OC */
53 { 1, 1, -1 }, /* P13: CAMERA (LCD), no OC */
54};
Zaolina823f9b2014-05-06 21:31:45 +020055
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020056void mainboard_early_init(int s3resume)
57{
58 hybrid_graphics_init();
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010059}