summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/common/block/include/intelblocks/smihandler.h
blob: d5a80ee4c6245f2de30fe4d5769d41ce21a4bb8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */

#ifndef SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H
#define SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H

#include <device/device.h>
#include <stdint.h>

struct gpi_status;
struct global_nvs_t;

/*
 * The register value is used with get_reg and set_reg
 */
enum smm_reg {
	RAX,
	RBX,
	RCX,
	RDX,
};

struct smm_save_state_ops {
	/* return io_misc_info from SMM Save State Area */
	uint32_t (*get_io_misc_info)(void *state);

	/* return value of the requested register from
	 * SMM Save State Area
	 */
	uint64_t (*get_reg)(void *state, enum smm_reg reg);

	void (*set_reg)(void *state, enum smm_reg reg, uint64_t val);
};

typedef void (*smi_handler_t)(const struct smm_save_state_ops *save_state_ops);

/*
 * SOC SMI Handler has to provide this structure which has methods to access
 * the SOC specific SMM Save State Area
 */
const struct smm_save_state_ops *get_smm_save_state_ops(void);

/*
 * southbridge_smi should be defined inside SOC specific code and should have
 * handlers for any SMI events that need to be handled. Default handlers
 * for some SMI events are provided in soc/intel/common/block/smm/smihandler.c
 */
extern const smi_handler_t southbridge_smi[32];

#define SMI_HANDLER_SCI_EN(__bit)	(1 << (__bit))

/*
 * This function should be implemented in SOC specific code to handle
 * the SMI event on SLP_EN. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_sleep(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI_APM event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_apmc(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI_PM1 event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_pm1(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI_GPE0 event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_gpe0(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * MC event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_mc(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * minitor event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_monitor(
	const struct smm_save_state_ops *save_state_ops);
/*
 * This function should be implemented in SOC specific code to handle
 * SMI_TCO event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_tco(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI PERIODIC_STS event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_periodic(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI GPIO_STS event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_gpi(
	const struct smm_save_state_ops *save_state_ops);

/*
 * This function should be implemented in SOC specific code to handle
 * SMI ESPI_STS event. The default functionality is provided in
 * soc/intel/common/block/smm/smihandler.c
 */
void smihandler_southbridge_espi(
	const struct smm_save_state_ops *save_state_ops);

/*
 * Returns gnvs pointer within SMM context
 */
struct global_nvs_t *smm_get_gnvs(void);

/* SoC overrides. */

/* Specific SOC SMI handler during ramstage finalize phase */
void smihandler_soc_at_finalize(void);

/*
 * This function returns a 1 or 0 depending on whether disable_busmaster
 * needs to be done for the specified device on S5 entry
 */
int smihandler_soc_disable_busmaster(pci_devfn_t dev);

/* Mainboard overrides. */

/* Mainboard handler for GPI SMIs */
void mainboard_smi_gpi_handler(const struct gpi_status *sts);

/* Mainboard handler for ESPI EMIs */
void mainboard_smi_espi_handler(void);

extern const struct smm_save_state_ops em64t100_smm_ops;

extern const struct smm_save_state_ops em64t101_smm_ops;
#endif