coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <stdint.h>
7 #include <option.h>
8 #include <ec/lenovo/pmh7/pmh7.h>
9 #include <device/pci_ops.h>
10 
12 {
21 }
22 
24 {
25  u8 enable_peg = get_uint_option("enable_dual_graphics", 0);
26 
27  bool power_en = pmh7_dgpu_power_state();
28 
29  if (enable_peg != power_en)
30  pmh7_dgpu_power_enable(!power_en);
31 
32  if (!enable_peg) {
33  // Hide disabled dGPU device
35  }
36 }
37 
38 void mb_get_spd_map(struct spd_info *spdi)
39 {
40  spdi->addresses[0] = 0x50;
41  spdi->addresses[2] = 0x51;
42 }
43 
45  /* Length, Enable, OCn#, Location */
46  { 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* USB3 */
47  { 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* USB3 */
48  { 0x0110, 1, 1, USB_PORT_BACK_PANEL }, /* USB2 charge */
49  { 0x0040, 1, USB_OC_PIN_SKIP, USB_PORT_BACK_PANEL },
50  { 0x0080, 1, USB_OC_PIN_SKIP, USB_PORT_DOCK },
51  { 0x0080, 1, 2, USB_PORT_BACK_PANEL }, /* USB2 */
52  { 0x0040, 1, 3, USB_PORT_BACK_PANEL },
53  { 0x0040, 1, 3, USB_PORT_BACK_PANEL },
54  { 0x0040, 1, 4, USB_PORT_BACK_PANEL },
55  { 0x0110, 1, 4, USB_PORT_BACK_PANEL }, /* WWAN */
56  { 0x0040, 1, 5, USB_PORT_INTERNAL }, /* WLAN */
57  { 0x0040, 1, 5, USB_PORT_BACK_PANEL }, /* webcam */
58  { 0x0080, 1, 6, USB_PORT_BACK_PANEL },
59  { 0x0040, 1, 6, USB_PORT_BACK_PANEL },
60 };
61 
63  { 1, 0 },
64  { 1, 0 },
65  { 1, USB_OC_PIN_SKIP },
66  { 1, USB_OC_PIN_SKIP },
67  { 1, 1 },
68  { 1, 1 }, /* WWAN */
69 };
#define PIRQH
Definition: irq.h:101
#define PIRQC
Definition: irq.h:96
#define PIRQA
Definition: irq.h:94
#define PIRQD
Definition: irq.h:97
#define PIRQB
Definition: irq.h:95
#define PIRQF
Definition: irq.h:99
#define PIRQE
Definition: irq.h:98
#define PIRQG
Definition: irq.h:100
#define DEVEN_D1F0EN
Definition: host_bridge.h:21
#define DEVEN
Definition: host_bridge.h:16
static __always_inline void pci_and_config32(const struct device *dev, u16 reg, u32 andmask)
Definition: pci_ops.h:158
const struct usb3_port_config mainboard_usb3_ports[MAX_USB3_PORTS]
Definition: romstage.c:45
void mainboard_config_rcba(void)
Definition: romstage.c:7
void mb_get_spd_map(struct spd_info *spdi)
Definition: romstage.c:19
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS]
Definition: romstage.c:27
void mb_late_romstage_setup(void)
Definition: romstage.c:23
unsigned int get_uint_option(const char *name, const unsigned int fallback)
Definition: option.c:116
bool pmh7_dgpu_power_state(void)
Definition: pmh7.c:69
void pmh7_dgpu_power_enable(int onoff)
Definition: pmh7.c:54
#define USB_OC_PIN_SKIP
Definition: pei_data.h:27
#define MAX_USB3_PORTS
Definition: pei_data.h:26
@ USB_PORT_BACK_PANEL
Definition: pei_data.h:30
@ USB_PORT_DOCK
Definition: pei_data.h:32
@ USB_PORT_INTERNAL
Definition: pei_data.h:35
#define MAX_USB2_PORTS
Definition: pei_data.h:25
#define D20IR
Definition: rcba.h:96
#define D31IR
Definition: rcba.h:87
#define D26IR
Definition: rcba.h:92
#define D28IR
Definition: rcba.h:90
#define D22IR
Definition: rcba.h:95
#define D25IR
Definition: rcba.h:93
#define DIR_ROUTE(a, b, c, d)
Definition: rcba.h:116
#define D29IR
Definition: rcba.h:89
#define D27IR
Definition: rcba.h:91
@ HOST_BRIDGE
Definition: reg_access.h:23
#define RCBA16(x)
Definition: rcba.h:13
uint8_t u8
Definition: stdint.h:45
Definition: spd.h:11
uint8_t addresses[4]
Definition: raminit.h:11