Angel Pons | 54c5472 | 2020-04-05 13:20:54 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 2 | |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 3 | #include <console/console.h> |
| 4 | #include <cpu/x86/smm.h> |
Kyösti Mälkki | 661ad46 | 2020-12-29 06:26:21 +0200 | [diff] [blame] | 5 | #include <soc/nvs.h> |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 6 | #include <southbridge/intel/bd82x6x/pch.h> |
| 7 | #include <southbridge/intel/bd82x6x/me.h> |
| 8 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 9 | |
| 10 | /* Include EC functions */ |
| 11 | #include <ec/quanta/ene_kb3940q/ec.h> |
| 12 | #include "ec.h" |
| 13 | |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 14 | void mainboard_smi_sleep(u8 slp_typ) |
| 15 | { |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 16 | /* Tell the EC to Enable USB power for S3 if requested */ |
Kyösti Mälkki | 239abaf | 2020-06-28 12:12:01 +0300 | [diff] [blame] | 17 | if (gnvs->s3u0 != 0 || gnvs->s3u1 != 0) |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 18 | 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 Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 28 | int mainboard_smi_apmc(u8 apmc) |
| 29 | { |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 30 | switch (apmc) { |
Kyösti Mälkki | d4174b5 | 2020-06-27 14:25:20 +0300 | [diff] [blame] | 31 | case APM_CNT_ACPI_ENABLE: |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 32 | /* Clear all pending events and enable SCI */ |
| 33 | ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE); |
| 34 | break; |
| 35 | |
Kyösti Mälkki | d4174b5 | 2020-06-27 14:25:20 +0300 | [diff] [blame] | 36 | case APM_CNT_ACPI_DISABLE: |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 37 | /* 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 | } |