2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H
16 #define SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H
18 #include <device/device.h>
25 * The register value is used with get_reg and set_reg
34 struct smm_save_state_ops
{
35 /* return io_misc_info from SMM Save State Area */
36 uint32_t (*get_io_misc_info
)(void *state
);
38 /* return value of the requested register from
41 uint64_t (*get_reg
)(void *state
, enum smm_reg reg
);
43 void (*set_reg
)(void *state
, enum smm_reg reg
, uint64_t val
);
46 typedef void (*smi_handler_t
)(const struct smm_save_state_ops
*save_state_ops
);
49 * SOC SMI Handler has to provide this structure which has methods to access
50 * the SOC specific SMM Save State Area
52 const struct smm_save_state_ops
*get_smm_save_state_ops(void);
55 * southbridge_smi should be defined inside SOC specific code and should have
56 * handlers for any SMI events that need to be handled. Default handlers
57 * for some SMI events are provided in soc/intel/common/block/smm/smihandler.c
59 extern const smi_handler_t southbridge_smi
[32];
61 #define SMI_HANDLER_SCI_EN(__bit) (1 << (__bit))
64 * This function should be implemented in SOC specific code to handle
65 * the SMI event on SLP_EN. The default functionality is provided in
66 * soc/intel/common/block/smm/smihandler.c
68 void smihandler_southbridge_sleep(
69 const struct smm_save_state_ops
*save_state_ops
);
72 * This function should be implemented in SOC specific code to handle
73 * SMI_APM event. The default functionality is provided in
74 * soc/intel/common/block/smm/smihandler.c
76 void smihandler_southbridge_apmc(
77 const struct smm_save_state_ops
*save_state_ops
);
80 * This function should be implemented in SOC specific code to handle
81 * SMI_PM1 event. The default functionality is provided in
82 * soc/intel/common/block/smm/smihandler.c
84 void smihandler_southbridge_pm1(
85 const struct smm_save_state_ops
*save_state_ops
);
88 * This function should be implemented in SOC specific code to handle
89 * SMI_GPE0 event. The default functionality is provided in
90 * soc/intel/common/block/smm/smihandler.c
92 void smihandler_southbridge_gpe0(
93 const struct smm_save_state_ops
*save_state_ops
);
96 * This function should be implemented in SOC specific code to handle
97 * MC event. The default functionality is provided in
98 * soc/intel/common/block/smm/smihandler.c
100 void smihandler_southbridge_mc(
101 const struct smm_save_state_ops
*save_state_ops
);
104 * This function should be implemented in SOC specific code to handle
105 * minitor event. The default functionality is provided in
106 * soc/intel/common/block/smm/smihandler.c
108 void smihandler_southbridge_monitor(
109 const struct smm_save_state_ops
*save_state_ops
);
111 * This function should be implemented in SOC specific code to handle
112 * SMI_TCO event. The default functionality is provided in
113 * soc/intel/common/block/smm/smihandler.c
115 void smihandler_southbridge_tco(
116 const struct smm_save_state_ops
*save_state_ops
);
119 * This function should be implemented in SOC specific code to handle
120 * SMI PERIODIC_STS event. The default functionality is provided in
121 * soc/intel/common/block/smm/smihandler.c
123 void smihandler_southbridge_periodic(
124 const struct smm_save_state_ops
*save_state_ops
);
127 * This function should be implemented in SOC specific code to handle
128 * SMI GPIO_STS event. The default functionality is provided in
129 * soc/intel/common/block/smm/smihandler.c
131 void smihandler_southbridge_gpi(
132 const struct smm_save_state_ops
*save_state_ops
);
135 * This function should be implemented in SOC specific code to handle
136 * SMI ESPI_STS event. The default functionality is provided in
137 * soc/intel/common/block/smm/smihandler.c
139 void smihandler_southbridge_espi(
140 const struct smm_save_state_ops
*save_state_ops
);
143 * Returns gnvs pointer within SMM context
145 struct global_nvs_t
*smm_get_gnvs(void);
149 /* Specific SOC SMI handler during ramstage finalize phase */
150 void smihandler_soc_at_finalize(void);
153 * This function returns a 1 or 0 depending on whether disable_busmaster
154 * needs to be done for the specified device on S5 entry
156 int smihandler_soc_disable_busmaster(pci_devfn_t dev
);
158 /* Mainboard overrides. */
160 /* Mainboard handler for GPI SMIs */
161 void mainboard_smi_gpi_handler(const struct gpi_status
*sts
);
163 /* Mainboard handler for ESPI EMIs */
164 void mainboard_smi_espi_handler(void);
166 extern const struct smm_save_state_ops em64t100_smm_ops
;
168 extern const struct smm_save_state_ops em64t101_smm_ops
;