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 | |
Kyösti Mälkki | 027f86e | 2022-12-02 15:30:10 +0200 | [diff] [blame^] | 3 | #include <acpi/acpi_gnvs.h> |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <cpu/x86/smm.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 | { |
Kyösti Mälkki | 027f86e | 2022-12-02 15:30:10 +0200 | [diff] [blame^] | 16 | bool usb0_disable = 0, usb1_disable = 0; |
| 17 | |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 18 | /* Tell the EC to Enable USB power for S3 if requested */ |
Kyösti Mälkki | 027f86e | 2022-12-02 15:30:10 +0200 | [diff] [blame^] | 19 | usb_charge_mode_from_gnvs(3, &usb0_disable, &usb1_disable); |
| 20 | if (!usb0_disable || !usb1_disable) |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 21 | ec_mem_write(EC_EC_PSW, ec_mem_read(EC_EC_PSW) | EC_PSW_USB); |
| 22 | |
| 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); |
| 28 | } |
| 29 | } |
| 30 | |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 31 | int mainboard_smi_apmc(u8 apmc) |
| 32 | { |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 33 | switch (apmc) { |
Kyösti Mälkki | d4174b5 | 2020-06-27 14:25:20 +0300 | [diff] [blame] | 34 | case APM_CNT_ACPI_ENABLE: |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 35 | /* Clear all pending events and enable SCI */ |
| 36 | ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE); |
| 37 | break; |
| 38 | |
Kyösti Mälkki | d4174b5 | 2020-06-27 14:25:20 +0300 | [diff] [blame] | 39 | case APM_CNT_ACPI_DISABLE: |
Stefan Reinauer | d7bd4eb | 2013-02-11 11:11:36 -0800 | [diff] [blame] | 40 | /* Clear all pending events and tell the EC that ACPI is disabled */ |
| 41 | ec_write_cmd(EC_CMD_DISABLE_ACPI_MODE); |
| 42 | break; |
| 43 | } |
| 44 | return 0; |
| 45 | } |