Hannah Williams | d59f62b | 2017-05-05 16:39:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2017 Intel Corp. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <arch/acpi.h> |
| 17 | #include <baseboard/variants.h> |
| 18 | #include <cpu/x86/smm.h> |
| 19 | #include <ec/google/chromeec/smm.h> |
Brandon Breitenstein | 60ce615 | 2017-08-08 15:30:41 -0700 | [diff] [blame] | 20 | #include <intelblocks/smihandler.h> |
Hannah Williams | d59f62b | 2017-05-05 16:39:21 -0700 | [diff] [blame] | 21 | #include <soc/pm.h> |
Hannah Williams | d59f62b | 2017-05-05 16:39:21 -0700 | [diff] [blame] | 22 | #include <soc/gpio.h> |
| 23 | #include <variant/ec.h> |
| 24 | #include <variant/gpio.h> |
| 25 | |
| 26 | void mainboard_smi_gpi_handler(const struct gpi_status *sts) |
| 27 | { |
| 28 | if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)) |
| 29 | if (gpi_status_get(sts, EC_SMI_GPI)) |
| 30 | chromeec_smi_process_events(); |
| 31 | } |
| 32 | |
| 33 | void mainboard_smi_sleep(u8 slp_typ) |
| 34 | { |
| 35 | const struct pad_config *pads; |
| 36 | size_t num; |
| 37 | |
| 38 | pads = variant_sleep_gpio_table(&num); |
| 39 | gpio_configure_pads(pads, num); |
| 40 | |
| 41 | if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)) |
| 42 | chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS, |
| 43 | MAINBOARD_EC_S5_WAKE_EVENTS); |
| 44 | } |
| 45 | |
| 46 | int mainboard_smi_apmc(u8 apmc) |
| 47 | { |
| 48 | if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)) |
| 49 | chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, |
| 50 | MAINBOARD_EC_SMI_EVENTS); |
| 51 | return 0; |
| 52 | } |
Shaunak Saha | bebec08 | 2017-12-06 12:23:01 -0800 | [diff] [blame] | 53 | |
| 54 | void mainboard_smi_espi_handler(void) |
| 55 | { |
Naresh G Solanki | 7b1b246 | 2018-04-02 21:38:57 +0530 | [diff] [blame] | 56 | if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)) |
| 57 | chromeec_smi_process_events(); |
Shaunak Saha | bebec08 | 2017-12-06 12:23:01 -0800 | [diff] [blame] | 58 | } |