mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / google / butterfly / smihandler.c
blob7963dac3136bc6ae465123af56cc06c72c52dbc5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi_gnvs.h>
4 #include <console/console.h>
5 #include <cpu/x86/smm.h>
6 #include <southbridge/intel/bd82x6x/pch.h>
7 #include <southbridge/intel/bd82x6x/me.h>
8 #include <northbridge/intel/sandybridge/sandybridge.h>
10 /* Include EC functions */
11 #include <ec/quanta/ene_kb3940q/ec.h>
12 #include "ec.h"
14 void mainboard_smi_sleep(u8 slp_typ)
16 bool usb0_disable = 0, usb1_disable = 0;
18 /* Tell the EC to Enable USB power for S3 if requested */
19 usb_charge_mode_from_gnvs(3, &usb0_disable, &usb1_disable);
20 if (!usb0_disable || !usb1_disable)
21 ec_mem_write(EC_EC_PSW, ec_mem_read(EC_EC_PSW) | EC_PSW_USB);
23 /* Disable wake on USB, LAN & RTC */
24 /* Enable Wake from Keyboard */
25 if ((slp_typ == 4) || (slp_typ == 5)) {
26 printk(BIOS_DEBUG, "Disabling wake on RTC\n");
27 ec_mem_write(EC_EC_PSW, EC_PSW_IKB);
31 int mainboard_smi_apmc(u8 apmc)
33 switch (apmc) {
34 case APM_CNT_ACPI_ENABLE:
35 /* Clear all pending events and enable SCI */
36 ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE);
37 break;
39 case APM_CNT_ACPI_DISABLE:
40 /* Clear all pending events and tell the EC that ACPI is disabled */
41 ec_write_cmd(EC_CMD_DISABLE_ACPI_MODE);
42 break;
44 return 0;