blob: 23bd683f2dd776f4e4188cfc9f83b2ce99bfa340 [file] [log] [blame]
Angel Pons54c54722020-04-05 13:20:54 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -08002
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -08003#include <console/console.h>
4#include <cpu/x86/smm.h>
Kyösti Mälkki661ad462020-12-29 06:26:21 +02005#include <soc/nvs.h>
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -08006#include <southbridge/intel/bd82x6x/pch.h>
7#include <southbridge/intel/bd82x6x/me.h>
8#include <northbridge/intel/sandybridge/sandybridge.h>
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -08009
10/* Include EC functions */
11#include <ec/quanta/ene_kb3940q/ec.h>
12#include "ec.h"
13
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080014void mainboard_smi_sleep(u8 slp_typ)
15{
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080016 /* Tell the EC to Enable USB power for S3 if requested */
Kyösti Mälkki239abaf2020-06-28 12:12:01 +030017 if (gnvs->s3u0 != 0 || gnvs->s3u1 != 0)
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080018 ec_mem_write(EC_EC_PSW, ec_mem_read(EC_EC_PSW) | EC_PSW_USB);
19
20 /* Disable wake on USB, LAN & RTC */
21 /* Enable Wake from Keyboard */
22 if ((slp_typ == 4) || (slp_typ == 5)) {
23 printk(BIOS_DEBUG, "Disabling wake on RTC\n");
24 ec_mem_write(EC_EC_PSW, EC_PSW_IKB);
25 }
26}
27
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080028int mainboard_smi_apmc(u8 apmc)
29{
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080030 switch (apmc) {
Kyösti Mälkkid4174b52020-06-27 14:25:20 +030031 case APM_CNT_ACPI_ENABLE:
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080032 /* Clear all pending events and enable SCI */
33 ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE);
34 break;
35
Kyösti Mälkkid4174b52020-06-27 14:25:20 +030036 case APM_CNT_ACPI_DISABLE:
Stefan Reinauerd7bd4eb2013-02-11 11:11:36 -080037 /* Clear all pending events and tell the EC that ACPI is disabled */
38 ec_write_cmd(EC_CMD_DISABLE_ACPI_MODE);
39 break;
40 }
41 return 0;
42}