Angel Pons | 89ab250 | 2020-04-03 01:22:28 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 3 | |
| 4 | #include <stdint.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 5 | #include <device/pci_ops.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 6 | #include <device/pci_def.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 7 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Nicolas Reinecke | 30d0aa9 | 2014-10-17 12:08:05 +0200 | [diff] [blame] | 8 | #include <northbridge/intel/sandybridge/raminit_native.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 9 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 10 | #include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h> |
| 11 | #include <device/device.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 12 | |
| 13 | static void hybrid_graphics_init(void) |
| 14 | { |
| 15 | bool peg, igd; |
| 16 | u32 reg32; |
| 17 | |
| 18 | early_hybrid_graphics(&igd, &peg); |
| 19 | |
Evgeny Zinoviev | 384e9ae | 2018-08-30 02:18:48 +0300 | [diff] [blame] | 20 | if (peg && igd) |
| 21 | return; |
| 22 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 23 | /* 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 | } |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 38 | |
Vladimir Serbinenko | fa1d688 | 2014-10-19 02:50:45 +0200 | [diff] [blame] | 39 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
| 40 | { 1, 1, 0 }, /* P0 left dual conn, OC 0 */ |
Nico Rikken | ecea3d4 | 2018-01-30 19:00:45 +0100 | [diff] [blame] | 41 | { 1, 1, 1 }, /* P1 system onboard USB (eSATA), (EHCI debug), OC 1 */ |
Vladimir Serbinenko | fa1d688 | 2014-10-19 02:50:45 +0200 | [diff] [blame] | 42 | { 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 | }; |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 55 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 56 | void mainboard_early_init(int s3resume) |
| 57 | { |
| 58 | hybrid_graphics_init(); |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 59 | } |