coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mainboard.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/pci_ops.h>
6 #include <acpi/acpi.h>
8 #include <ec/quanta/it8518/ec.h>
9 
10 #include "ec.h"
11 #include "onboard.h"
12 
14 {
15  /* Stout EC needs to be put back in ACPI mode */
17 }
18 
19 static void mainboard_init(struct device *dev)
20 {
21  struct device *ethernet_dev = NULL;
22 
23  /* Initialize the Embedded Controller */
24  stout_ec_init();
25 
26  /*
27  * Battery life time - LAN PCIe should enter ASPM L1 to save
28  * power when LAN connection is idle.
29  * enable CLKREQ: LAN pci config space 0x81h=01
30  */
31  ethernet_dev = dev_find_device(STOUT_NIC_VENDOR_ID,
32  STOUT_NIC_DEVICE_ID, dev);
33 
34  if (ethernet_dev != NULL)
35  pci_write_config8(ethernet_dev, 0x81, 0x01);
36 }
37 
38 // mainboard_enable is executed as first thing after
39 // enumerate_buses().
40 
41 static void mainboard_enable(struct device *dev)
42 {
43  dev->ops->init = mainboard_init;
45 }
46 
49 };
struct chip_operations mainboard_ops
Definition: mainboard.c:19
struct device * dev_find_device(u16 vendor, u16 device, struct device *from)
Find a device of a given vendor and type.
Definition: device_util.c:42
void install_intel_vga_int15_handler(int active_lfp_, int pfit_, int display_, int panel_type_)
Definition: int15.c:101
@ GMA_INT15_BOOT_DISPLAY_DEFAULT
Definition: int15.h:6
@ GMA_INT15_ACTIVE_LFP_INT_LVDS
Definition: int15.h:25
@ GMA_INT15_PANEL_FIT_DEFAULT
Definition: int15.h:17
void ec_write_cmd(u8 cmd)
Definition: ec.c:79
#define EC_CMD_NOTIFY_ACPI_ENTER
Definition: ec.h:45
void mainboard_suspend_resume(void)
Definition: mainboard.c:10
static void mainboard_init(struct device *dev)
Definition: mainboard.c:19
static void mainboard_enable(struct device *dev)
Definition: mainboard.c:41
#define STOUT_NIC_VENDOR_ID
Definition: onboard.h:6
#define STOUT_NIC_DEVICE_ID
Definition: onboard.h:7
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
void stout_ec_init(void)
Definition: ec.c:12
#define NULL
Definition: stddef.h:19
void(* enable_dev)(struct device *dev)
Definition: device.h:24
void(* init)(struct device *dev)
Definition: device.h:42
Definition: device.h:107
struct device_operations * ops
Definition: device.h:143