Angel Pons | 2712398 | 2020-04-05 13:22:30 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 2 | |
| 3 | #include <cpu/x86/smm.h> |
Furquan Shaikh | 4854761 | 2017-10-16 23:02:00 -0700 | [diff] [blame] | 4 | #include <ec/google/chromeec/ec.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 5 | #include <ec/google/chromeec/smm.h> |
Furquan Shaikh | 4854761 | 2017-10-16 23:02:00 -0700 | [diff] [blame] | 6 | #include <elog.h> |
Furquan Shaikh | 3178bdc | 2017-05-27 17:52:32 -0700 | [diff] [blame] | 7 | #include <gpio.h> |
| 8 | #include <soc/gpio.h> |
Kyösti Mälkki | 89d7fd8 | 2019-08-13 07:57:34 +0300 | [diff] [blame] | 9 | #include <intelblocks/smihandler.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 10 | |
Shelley Chen | 528448e | 2018-05-30 20:13:24 -0700 | [diff] [blame] | 11 | #include <baseboard/variants.h> |
Furquan Shaikh | 3178bdc | 2017-05-27 17:52:32 -0700 | [diff] [blame] | 12 | #include <variant/gpio.h> |
Furquan Shaikh | 76c392d | 2017-04-13 14:15:56 -0700 | [diff] [blame] | 13 | #include <variant/ec.h> |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 14 | |
| 15 | void mainboard_smi_espi_handler(void) |
| 16 | { |
| 17 | chromeec_smi_process_events(); |
| 18 | } |
| 19 | |
Shelley Chen | 528448e | 2018-05-30 20:13:24 -0700 | [diff] [blame] | 20 | void __weak variant_smi_sleep(u8 slp_typ) {} |
| 21 | |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 22 | void mainboard_smi_sleep(u8 slp_typ) |
| 23 | { |
Furquan Shaikh | 6985c90 | 2018-10-06 12:03:23 -0700 | [diff] [blame] | 24 | const struct google_chromeec_event_info *info; |
| 25 | |
| 26 | info = variant_get_event_info(); |
| 27 | |
Shelley Chen | 528448e | 2018-05-30 20:13:24 -0700 | [diff] [blame] | 28 | variant_smi_sleep(slp_typ); |
Furquan Shaikh | 6985c90 | 2018-10-06 12:03:23 -0700 | [diff] [blame] | 29 | chromeec_smi_sleep(slp_typ, info->s3_wake_events, info->s5_wake_events); |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | int mainboard_smi_apmc(u8 apmc) |
| 33 | { |
Furquan Shaikh | 6985c90 | 2018-10-06 12:03:23 -0700 | [diff] [blame] | 34 | const struct google_chromeec_event_info *info; |
| 35 | |
| 36 | info = variant_get_event_info(); |
| 37 | |
| 38 | chromeec_smi_apmc(apmc, info->sci_events, info->smi_events); |
| 39 | |
Furquan Shaikh | 06cd903 | 2016-12-14 12:10:21 -0800 | [diff] [blame] | 40 | return 0; |
| 41 | } |
Furquan Shaikh | 4854761 | 2017-10-16 23:02:00 -0700 | [diff] [blame] | 42 | |
| 43 | void elog_gsmi_cb_mainboard_log_wake_source(void) |
| 44 | { |
Furquan Shaikh | 6985c90 | 2018-10-06 12:03:23 -0700 | [diff] [blame] | 45 | const struct google_chromeec_event_info *info; |
| 46 | |
| 47 | info = variant_get_event_info(); |
| 48 | |
| 49 | google_chromeec_log_events(info->log_events | info->s0ix_wake_events); |
Furquan Shaikh | 4854761 | 2017-10-16 23:02:00 -0700 | [diff] [blame] | 50 | } |