intel/common/block/smm: Update smihandler to handle gpi

Updating the common smihandler to handler gpi events which
originally were going to be left to each soc to handle. After
some more analysis the gpi handler can also be commonized.

Change-Id: I6273fe846587137938bbcffa3a92736b91982574
Signed-off-by: Brandon Breitenstein <brandon.breitenstein@intel.com>
Reviewed-on: https://review.coreboot.org/20917
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Brandon Breitenstein 2017-08-08 15:30:41 -07:00 committed by Aaron Durbin
parent 6d5873d7f2
commit 60ce6152fd
6 changed files with 44 additions and 21 deletions

View File

@ -18,8 +18,8 @@
#include <baseboard/variants.h> #include <baseboard/variants.h>
#include <cpu/x86/smm.h> #include <cpu/x86/smm.h>
#include <ec/google/chromeec/smm.h> #include <ec/google/chromeec/smm.h>
#include <intelblocks/smihandler.h>
#include <soc/pm.h> #include <soc/pm.h>
#include <soc/smm.h>
#include <soc/gpio.h> #include <soc/gpio.h>
#include <variant/ec.h> #include <variant/ec.h>
#include <variant/gpio.h> #include <variant/gpio.h>

View File

@ -17,8 +17,8 @@
#include <baseboard/variants.h> #include <baseboard/variants.h>
#include <cpu/x86/smm.h> #include <cpu/x86/smm.h>
#include <ec/google/chromeec/smm.h> #include <ec/google/chromeec/smm.h>
#include <intelblocks/smihandler.h>
#include <soc/pm.h> #include <soc/pm.h>
#include <soc/smm.h>
#include <soc/gpio.h> #include <soc/gpio.h>
#include <variant/ec.h> #include <variant/ec.h>
#include <variant/gpio.h> #include <variant/gpio.h>

View File

@ -30,7 +30,4 @@
void southbridge_smm_clear_state(void); void southbridge_smm_clear_state(void);
void southbridge_smm_enable_smi(void); void southbridge_smm_enable_smi(void);
/* Mainboard handler for GPI SMIs*/
void mainboard_smi_gpi_handler(const struct gpi_status *sts);
#endif #endif

View File

@ -34,26 +34,11 @@ const struct smm_save_state_ops *get_smm_save_state_ops(void)
return &em64t100_smm_ops; return &em64t100_smm_ops;
} }
void __attribute__((weak))
mainboard_smi_gpi_handler(const struct gpi_status *sts) { }
static void southbridge_smi_gpi(
const struct smm_save_state_ops *save_state_ops)
{
struct gpi_status smi_sts;
gpi_clear_get_smi_status(&smi_sts);
mainboard_smi_gpi_handler(&smi_sts);
/* Clear again after mainboard handler */
gpi_clear_get_smi_status(&smi_sts);
}
const smi_handler_t southbridge_smi[32] = { const smi_handler_t southbridge_smi[32] = {
[SLP_SMI_STS] = smihandler_southbridge_sleep, [SLP_SMI_STS] = smihandler_southbridge_sleep,
[APM_SMI_STS] = smihandler_southbridge_apmc, [APM_SMI_STS] = smihandler_southbridge_apmc,
[FAKE_PM1_SMI_STS] = smihandler_southbridge_pm1, [FAKE_PM1_SMI_STS] = smihandler_southbridge_pm1,
[GPIO_SMI_STS] = southbridge_smi_gpi, [GPIO_SMI_STS] = smihandler_southbridge_gpi,
[TCO_SMI_STS] = smihandler_southbridge_tco, [TCO_SMI_STS] = smihandler_southbridge_tco,
[PERIODIC_SMI_STS] = smihandler_southbridge_periodic, [PERIODIC_SMI_STS] = smihandler_southbridge_periodic,
}; };

View File

@ -108,6 +108,21 @@ void smihandler_southbridge_tco(
void smihandler_southbridge_periodic( void smihandler_southbridge_periodic(
const struct smm_save_state_ops *save_state_ops); 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);
/* /*
* This function returns a 1 or 0 depending on whether disable_busmaster * This function returns a 1 or 0 depending on whether disable_busmaster
* needs to be done for the specified device on S5 entry * needs to be done for the specified device on S5 entry
@ -122,6 +137,9 @@ struct global_nvs_t *smm_get_gnvs(void);
/* Mainboard handler for GPI SMIs */ /* Mainboard handler for GPI SMIs */
void mainboard_smi_gpi_handler(const struct gpi_status *sts); 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 em64t100_smm_ops;
extern const struct smm_save_state_ops em64t101_smm_ops; extern const struct smm_save_state_ops em64t101_smm_ops;

View File

@ -356,6 +356,29 @@ void smihandler_southbridge_periodic(
printk(BIOS_DEBUG, "Periodic SMI.\n"); printk(BIOS_DEBUG, "Periodic SMI.\n");
} }
void __attribute__((weak))
mainboard_smi_gpi_handler(const struct gpi_status *sts) { }
void smihandler_southbridge_gpi(
const struct smm_save_state_ops *save_state_ops)
{
struct gpi_status smi_sts;
gpi_clear_get_smi_status(&smi_sts);
mainboard_smi_gpi_handler(&smi_sts);
/* Clear again after mainboard handler */
gpi_clear_get_smi_status(&smi_sts);
}
void __attribute__((weak)) mainboard_smi_espi_handler(void) { }
void smihandler_southbridge_espi(
const struct smm_save_state_ops *save_state_ops)
{
mainboard_smi_espi_handler();
}
void southbridge_smi_handler(void) void southbridge_smi_handler(void)
{ {
int i; int i;