Angel Pons | af4ecc2 | 2020-04-05 13:21:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 3 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame^] | 4 | #include <acpi/acpi.h> |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 5 | #include <console/console.h> |
| 6 | #include <cpu/x86/smm.h> |
| 7 | #include <soc/pm.h> |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 8 | #include <ec/google/chromeec/ec.h> |
| 9 | #include <soc/gpio.h> |
| 10 | #include <soc/iomap.h> |
| 11 | #include <soc/nvs.h> |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 12 | #include "onboard.h" |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 13 | |
| 14 | int mainboard_io_trap_handler(int smif) |
| 15 | { |
| 16 | switch (smif) { |
| 17 | case 0x99: |
| 18 | printk(BIOS_DEBUG, "Sample\n"); |
| 19 | smm_get_gnvs()->smif = 0; |
| 20 | break; |
| 21 | default: |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | /* On success, the IO Trap Handler returns 0 |
| 26 | * On failure, the IO Trap Handler returns a value != 0 |
| 27 | * |
| 28 | * For now, we force the return value to 0 and log all traps to |
| 29 | * see what's going on. |
| 30 | */ |
| 31 | return 1; |
| 32 | } |
| 33 | |
| 34 | /* gpi_sts is GPIO 47:32 */ |
| 35 | void mainboard_smi_gpi(u32 gpi_sts) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | void mainboard_smi_sleep(u8 slp_typ) |
| 40 | { |
| 41 | /* Disable USB charging if required */ |
| 42 | switch (slp_typ) { |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 43 | case ACPI_S3: |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 44 | set_power_led(LED_BLINK); |
| 45 | |
| 46 | /* Enable DCP mode */ |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 47 | if (CONFIG(BOARD_GOOGLE_TIDUS)) { |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 48 | set_gpio(GPIO_USB_CTL_1, 0); |
| 49 | } |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 50 | break; |
Aaron Durbin | 30b0c7a | 2016-07-13 13:01:13 -0500 | [diff] [blame] | 51 | case ACPI_S5: |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 52 | set_power_led(LED_OFF); |
Patrick Georgi | 04746fc | 2015-06-05 18:53:43 +0200 | [diff] [blame] | 53 | break; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | int mainboard_smi_apmc(u8 apmc) |
| 58 | { |
| 59 | switch (apmc) { |
| 60 | case APM_CNT_ACPI_ENABLE: |
| 61 | break; |
| 62 | case APM_CNT_ACPI_DISABLE: |
| 63 | break; |
| 64 | } |
| 65 | return 0; |
| 66 | } |