blob: 9af899398f26dda04ef1920bdefb6c63e86d82af [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{
Julius Wernercd49cce2019-03-05 16:53:33 -080028 if (CONFIG(EC_GOOGLE_CHROMEEC))
Hannah Williamsd59f62b2017-05-05 16:39:21 -070029 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
Julius Wernercd49cce2019-03-05 16:53:33 -080041 if (CONFIG(EC_GOOGLE_CHROMEEC))
Hannah Williamsd59f62b2017-05-05 16:39:21 -070042 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{
Julius Wernercd49cce2019-03-05 16:53:33 -080048 if (CONFIG(EC_GOOGLE_CHROMEEC))
Hannah Williamsd59f62b2017-05-05 16:39:21 -070049 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{
Julius Wernercd49cce2019-03-05 16:53:33 -080056 if (CONFIG(EC_GOOGLE_CHROMEEC))
Naresh G Solanki7b1b2462018-04-02 21:38:57 +053057 chromeec_smi_process_events();
Shaunak Sahabebec082017-12-06 12:23:01 -080058}