2020-04-03 01:22:13 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-10-15 14:43:55 +02:00
|
|
|
|
|
|
|
#include <console/console.h>
|
|
|
|
#include <cpu/x86/smm.h>
|
|
|
|
#include <ec/google/chromeec/smm.h>
|
|
|
|
#include <soc/iomap.h>
|
|
|
|
#include <soc/nvs.h>
|
|
|
|
#include <soc/pm.h>
|
2019-08-13 06:57:34 +02:00
|
|
|
#include <intelblocks/smihandler.h>
|
2016-10-15 14:43:55 +02:00
|
|
|
#include "ec.h"
|
2016-11-28 10:23:12 +01:00
|
|
|
#include <variant/gpio.h>
|
2016-10-15 14:43:55 +02:00
|
|
|
|
|
|
|
int mainboard_io_trap_handler(int smif)
|
|
|
|
{
|
|
|
|
switch (smif) {
|
|
|
|
case 0x99:
|
|
|
|
printk(BIOS_DEBUG, "Sample\n");
|
2020-06-28 11:12:01 +02:00
|
|
|
gnvs->smif = 0;
|
2016-10-15 14:43:55 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* On success, the IO Trap Handler returns 0
|
|
|
|
* On failure, the IO Trap Handler returns a value != 0
|
|
|
|
*
|
|
|
|
* For now, we force the return value to 0 and log all traps to
|
|
|
|
* see what's going on.
|
|
|
|
*/
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mainboard_smi_gpi_handler(const struct gpi_status *sts)
|
|
|
|
{
|
2019-03-06 01:53:33 +01:00
|
|
|
if (CONFIG(BOARD_INTEL_KBLRVP8))
|
2018-01-22 15:53:16 +01:00
|
|
|
return;
|
|
|
|
|
2019-03-06 01:53:33 +01:00
|
|
|
if (CONFIG(EC_GOOGLE_CHROMEEC))
|
2016-10-15 14:43:55 +02:00
|
|
|
if (gpi_status_get(sts, EC_SMI_GPI))
|
|
|
|
chromeec_smi_process_events();
|
|
|
|
}
|
|
|
|
|
|
|
|
void mainboard_smi_sleep(u8 slp_typ)
|
|
|
|
{
|
2019-03-06 01:53:33 +01:00
|
|
|
if (CONFIG(EC_GOOGLE_CHROMEEC))
|
|
|
|
if (CONFIG(EC_GOOGLE_CHROMEEC))
|
2016-10-15 14:43:55 +02:00
|
|
|
chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS,
|
|
|
|
MAINBOARD_EC_S5_WAKE_EVENTS);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mainboard_smi_apmc(u8 apmc)
|
|
|
|
{
|
2019-03-06 01:53:33 +01:00
|
|
|
if (CONFIG(EC_GOOGLE_CHROMEEC))
|
2016-10-15 14:43:55 +02:00
|
|
|
chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS,
|
|
|
|
MAINBOARD_EC_SMI_EVENTS);
|
|
|
|
return 0;
|
|
|
|
}
|