| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H |
| 4 | #define SOC_INTEL_COMMON_BLOCK_SMI_HANDLER_H |
| 5 | |
| 6 | #include <device/device.h> |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | struct gpi_status; |
| 10 | struct global_nvs; |
| 11 | |
| 12 | /* |
| 13 | * The register value is used with get_reg and set_reg |
| 14 | */ |
| 15 | enum smm_reg { |
| 16 | RAX, |
| 17 | RBX, |
| 18 | RCX, |
| 19 | RDX, |
| 20 | }; |
| 21 | |
| 22 | struct smm_save_state_ops { |
| 23 | /* return io_misc_info from SMM Save State Area */ |
| 24 | uint32_t (*get_io_misc_info)(void *state); |
| 25 | |
| 26 | /* return value of the requested register from |
| 27 | * SMM Save State Area |
| 28 | */ |
| 29 | uint64_t (*get_reg)(void *state, enum smm_reg reg); |
| 30 | |
| 31 | void (*set_reg)(void *state, enum smm_reg reg, uint64_t val); |
| 32 | }; |
| 33 | |
| 34 | typedef void (*smi_handler_t)(const struct smm_save_state_ops *save_state_ops); |
| 35 | |
| 36 | /* |
| 37 | * SOC SMI Handler has to provide this structure which has methods to access |
| 38 | * the SOC specific SMM Save State Area |
| 39 | */ |
| 40 | const struct smm_save_state_ops *get_smm_save_state_ops(void); |
| 41 | |
| 42 | /* |
| 43 | * southbridge_smi should be defined inside SOC specific code and should have |
| 44 | * handlers for any SMI events that need to be handled. Default handlers |
| 45 | * for some SMI events are provided in soc/intel/common/block/smm/smihandler.c |
| 46 | */ |
| 47 | extern const smi_handler_t southbridge_smi[32]; |
| 48 | |
| 49 | /* |
| 50 | * This function should be implemented in SOC specific code to handle |
| 51 | * the SMI event on SLP_EN. The default functionality is provided in |
| 52 | * soc/intel/common/block/smm/smihandler.c |
| 53 | */ |
| 54 | void smihandler_southbridge_sleep( |
| 55 | const struct smm_save_state_ops *save_state_ops); |
| 56 | |
| 57 | /* |
| 58 | * This function should be implemented in SOC specific code to handle |
| 59 | * SMI_APM event. The default functionality is provided in |
| 60 | * soc/intel/common/block/smm/smihandler.c |
| 61 | */ |
| 62 | void smihandler_southbridge_apmc( |
| 63 | const struct smm_save_state_ops *save_state_ops); |
| 64 | |
| 65 | /* |
| 66 | * This function should be implemented in SOC specific code to handle |
| 67 | * SMI_PM1 event. The default functionality is provided in |
| 68 | * soc/intel/common/block/smm/smihandler.c |
| 69 | */ |
| 70 | void smihandler_southbridge_pm1( |
| 71 | const struct smm_save_state_ops *save_state_ops); |
| 72 | |
| 73 | /* |
| 74 | * This function should be implemented in SOC specific code to handle |
| 75 | * SMI_GPE0 event. The default functionality is provided in |
| 76 | * soc/intel/common/block/smm/smihandler.c |
| 77 | */ |
| 78 | void smihandler_southbridge_gpe0( |
| 79 | const struct smm_save_state_ops *save_state_ops); |
| 80 | |
| 81 | /* |
| 82 | * This function should be implemented in SOC specific code to handle |
| 83 | * MC event. The default functionality is provided in |
| 84 | * soc/intel/common/block/smm/smihandler.c |
| 85 | */ |
| 86 | void smihandler_southbridge_mc( |
| 87 | const struct smm_save_state_ops *save_state_ops); |
| 88 | |
| 89 | /* |
| 90 | * This function should be implemented in SOC specific code to handle |
| 91 | * minitor event. The default functionality is provided in |
| 92 | * soc/intel/common/block/smm/smihandler.c |
| 93 | */ |
| 94 | void smihandler_southbridge_monitor( |
| 95 | const struct smm_save_state_ops *save_state_ops); |
| 96 | /* |
| 97 | * This function should be implemented in SOC specific code to handle |
| 98 | * SMI_TCO event. The default functionality is provided in |
| 99 | * soc/intel/common/block/smm/smihandler.c |
| 100 | */ |
| 101 | void smihandler_southbridge_tco( |
| 102 | const struct smm_save_state_ops *save_state_ops); |
| 103 | |
| 104 | /* |
| 105 | * This function should be implemented in SOC specific code to handle |
| 106 | * SMI PERIODIC_STS event. The default functionality is provided in |
| 107 | * soc/intel/common/block/smm/smihandler.c |
| 108 | */ |
| 109 | void smihandler_southbridge_periodic( |
| 110 | const struct smm_save_state_ops *save_state_ops); |
| 111 | |
| 112 | /* |
| 113 | * This function should be implemented in SOC specific code to handle |
| 114 | * SMI GPIO_STS event. The default functionality is provided in |
| 115 | * soc/intel/common/block/smm/smihandler.c |
| 116 | */ |
| 117 | void smihandler_southbridge_gpi( |
| 118 | const struct smm_save_state_ops *save_state_ops); |
| 119 | |
| 120 | /* |
| 121 | * This function should be implemented in SOC specific code to handle |
| 122 | * SMI ESPI_STS event. The default functionality is provided in |
| 123 | * soc/intel/common/block/smm/smihandler.c |
| 124 | */ |
| 125 | void smihandler_southbridge_espi( |
| 126 | const struct smm_save_state_ops *save_state_ops); |
| 127 | |
| 128 | /* SoC overrides. */ |
| 129 | |
| 130 | /* Specific SOC SMI handler during ramstage finalize phase */ |
| 131 | void smihandler_soc_at_finalize(void); |
| 132 | |
| 133 | /* |
| 134 | * This function returns a 1 or 0 depending on whether disable_busmaster |
| 135 | * needs to be done for the specified device on S5 entry |
| 136 | */ |
| 137 | int smihandler_soc_disable_busmaster(pci_devfn_t dev); |
| 138 | |
| 139 | /* Mainboard overrides. */ |
| 140 | |
| 141 | /* Mainboard handler for GPI SMIs */ |
| 142 | void mainboard_smi_gpi_handler(const struct gpi_status *sts); |
| 143 | |
| 144 | /* Mainboard handler for ESPI EMIs */ |
| 145 | void mainboard_smi_espi_handler(void); |
| 146 | |
| 147 | extern const struct smm_save_state_ops em64t100_smm_ops; |
| 148 | |
| 149 | extern const struct smm_save_state_ops em64t101_smm_ops; |
| 150 | #endif |