coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smihandler.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <baseboard/variant.h>
4 #include <console/console.h>
5 #include <cpu/x86/smm.h>
7 #include <gpio.h>
8 #include <soc/iomap.h>
9 #include <soc/nvs.h>
10 #include <soc/pm.h>
11 #include <intelblocks/smihandler.h>
12 #include "ec.h"
13 #include <variant/gpio.h>
14 
16 {
17  switch (smif) {
18  case 0x99:
19  printk(BIOS_DEBUG, "Sample\n");
20  gnvs->smif = 0;
21  break;
22  default:
23  return 0;
24  }
25 
26  /* On success, the IO Trap Handler returns 0
27  * On failure, the IO Trap Handler returns a value != 0
28  *
29  * For now, we force the return value to 0 and log all traps to
30  * see what's going on.
31  */
32  return 1;
33 }
34 
35 void mainboard_smi_gpi_handler(const struct gpi_status *sts)
36 {
37  if (gpi_status_get(sts, EC_SMI_GPI))
39 }
40 
42 {
43 }
44 
45 void mainboard_smi_sleep(u8 slp_typ)
46 {
47  if (CONFIG(EC_GOOGLE_CHROMEEC))
50 
52 }
53 
55 {
56  if (CONFIG(EC_GOOGLE_CHROMEEC))
59  return 0;
60 }
#define printk(level,...)
Definition: stdlib.h:16
void __weak mainboard_smi_sleep(u8 slp_typ)
Definition: smihandler.c:210
int __weak mainboard_smi_apmc(u8 data)
Definition: smihandler.c:209
int __weak mainboard_io_trap_handler(int smif)
Definition: smihandler.c:206
@ CONFIG
Definition: dsi_common.h:201
void chromeec_smi_sleep(int slp_type, uint64_t s3_mask, uint64_t s5_mask)
Definition: smihandler.c:48
void chromeec_smi_process_events(void)
Definition: smihandler.c:29
void chromeec_smi_apmc(int apmc, uint64_t sci_mask, uint64_t smi_mask)
Definition: smihandler.c:89
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define MAINBOARD_EC_S5_WAKE_EVENTS
Definition: ec.h:32
#define MAINBOARD_EC_SCI_EVENTS
Definition: ec.h:12
#define MAINBOARD_EC_SMI_EVENTS
Definition: ec.h:28
#define EC_SMI_GPI
Definition: ec.h:10
#define MAINBOARD_EC_S3_WAKE_EVENTS
Definition: ec.h:37
void mainboard_smi_gpi_handler(const struct gpi_status *sts)
Definition: smihandler.c:16
__weak void mainboard_gpio_smi_sleep(void)
Definition: smihandler.c:41
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
struct global_nvs * gnvs
int gpi_status_get(const struct gpi_status *sts, gpio_t pad)
Definition: gpio.c:733
uint8_t u8
Definition: stdint.h:45
u8 smif
Definition: nvs.h:11