payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / intel / kunimitsu / smihandler.c
blob14a3f8f9cacfa1b2159ec872e12339c2a8db0fce
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <cpu/x86/smm.h>
5 #include <ec/google/chromeec/smm.h>
6 #include <soc/iomap.h>
7 #include <soc/nvs.h>
8 #include <soc/pm.h>
9 #include <intelblocks/smihandler.h>
10 #include "ec.h"
11 #include "gpio.h"
13 int mainboard_io_trap_handler(int smif)
15 switch (smif) {
16 case 0x99:
17 printk(BIOS_DEBUG, "Sample\n");
18 gnvs->smif = 0;
19 break;
20 default:
21 return 0;
24 /* On success, the IO Trap Handler returns 0
25 * On failure, the IO Trap Handler returns a value != 0
27 * For now, we force the return value to 0 and log all traps to
28 * see what's going on.
30 return 1;
33 void mainboard_smi_gpi_handler(const struct gpi_status *sts)
35 if (gpi_status_get(sts, EC_SMI_GPI))
36 chromeec_smi_process_events();
39 void mainboard_smi_sleep(u8 slp_typ)
41 if (CONFIG(EC_GOOGLE_CHROMEEC))
42 chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS,
43 MAINBOARD_EC_S5_WAKE_EVENTS);
46 int mainboard_smi_apmc(u8 apmc)
48 if (CONFIG(EC_GOOGLE_CHROMEEC))
49 chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS,
50 MAINBOARD_EC_SMI_EVENTS);
51 return 0;