blob: f6d98e5f2062684c30f8d049939febe15943c395 [file] [log] [blame]
Hannah Williamsd59f62b2017-05-05 16:39:21 -07001/*
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 Breitenstein60ce6152017-08-08 15:30:41 -070020#include <intelblocks/smihandler.h>
Hannah Williamsd59f62b2017-05-05 16:39:21 -070021#include <soc/pm.h>
Hannah Williamsd59f62b2017-05-05 16:39:21 -070022#include <soc/gpio.h>
23#include <variant/ec.h>
24#include <variant/gpio.h>
25
26void 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
33void 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
46int 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 Sahabebec082017-12-06 12:23:01 -080053
54void mainboard_smi_espi_handler(void)
55{
Naresh G Solanki7b1b2462018-04-02 21:38:57 +053056 if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC))
57 chromeec_smi_process_events();
Shaunak Sahabebec082017-12-06 12:23:01 -080058}