Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 2 | |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 3 | #include <cpu/x86/smm.h> |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 4 | #include <ec/google/chromeec/smm.h> |
| 5 | #include <soc/iomap.h> |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 6 | #include <soc/pm.h> |
Kyösti Mälkki | 89d7fd8 | 2019-08-13 07:57:34 +0300 | [diff] [blame] | 7 | #include <intelblocks/smihandler.h> |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 8 | #include "ec.h" |
Barnali Sarkar | a5b1041 | 2016-11-28 14:53:12 +0530 | [diff] [blame] | 9 | #include <variant/gpio.h> |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 10 | |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 11 | void mainboard_smi_gpi_handler(const struct gpi_status *sts) |
| 12 | { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 13 | if (CONFIG(BOARD_INTEL_KBLRVP8)) |
V Sowmya | 6b78b73 | 2018-01-22 20:23:16 +0530 | [diff] [blame] | 14 | return; |
| 15 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 16 | if (CONFIG(EC_GOOGLE_CHROMEEC)) |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 17 | if (gpi_status_get(sts, EC_SMI_GPI)) |
| 18 | chromeec_smi_process_events(); |
| 19 | } |
| 20 | |
| 21 | void mainboard_smi_sleep(u8 slp_typ) |
| 22 | { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 23 | if (CONFIG(EC_GOOGLE_CHROMEEC)) |
Kyösti Mälkki | 47af801 | 2023-04-29 08:14:30 +0300 | [diff] [blame] | 24 | chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS, |
| 25 | MAINBOARD_EC_S5_WAKE_EVENTS); |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | int mainboard_smi_apmc(u8 apmc) |
| 29 | { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 30 | if (CONFIG(EC_GOOGLE_CHROMEEC)) |
Naresh G Solanki | ab5d690 | 2016-10-15 18:13:55 +0530 | [diff] [blame] | 31 | chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, |
| 32 | MAINBOARD_EC_SMI_EVENTS); |
| 33 | return 0; |
| 34 | } |