Skip to content

Commit

Permalink
mb,sb,soc/intel: Drop useless IO trap handlers
Browse files Browse the repository at this point in the history
There are four requirements for the SMI to hit a printk()
this commit now removes.

Build must have DEBUG_SMI=y, otherwise any printk() is a no-op
inside SMM.
ASL must have a TRAP() with argument 0x99 or 0x32 for SMIF value.
Platform needs to have IO Trap #3 enabled at IO 0x800.
The SMI monitor must call io_trap_handler for IO Trap #3.

At the moment, only getac/p470 would meet the above criteria
with TRAP(0x32) in its DSDT _INI method. The ASL ignores any
return value of TRAP() calls made.

A mainboard IO trap handler should have precedence over
a southbridge IO trap handler. At the moment we seem to have
no cases of the latter to support, so remove the latter.

Change-Id: I3a3298c8d9814db8464fbf7444c6e0e6ac6ac008
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70365
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
  • Loading branch information
kmalkki committed Dec 7, 2022
1 parent 3c528f2 commit 2c3ebd8
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 288 deletions.
3 changes: 0 additions & 3 deletions src/cpu/x86/smm/smm_module_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ void io_trap_handler(int smif)
*/
printk(BIOS_DEBUG, "SMI function trap 0x%x: ", smif);

if (southbridge_io_trap_handler(smif))
return;

if (mainboard_io_trap_handler(smif))
return;

Expand Down
1 change: 0 additions & 1 deletion src/include/cpu/x86/smm.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ int apm_control(u8 cmd);
u8 apm_get_apmc(void);

void io_trap_handler(int smif);
int southbridge_io_trap_handler(int smif);
int mainboard_io_trap_handler(int smif);

void southbridge_smi_set_eos(void);
Expand Down
22 changes: 0 additions & 22 deletions src/mainboard/google/cyan/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,6 @@
#define GPIO_SUS7_WAKE_MASK (1 << 12)
#define GPIO_SUS1_WAKE_MASK (1 << 13)

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/*
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
//gnvs->smif = 0;
return 1;
}

static uint8_t mainboard_smi_ec(void)
{
uint8_t cmd = google_chromeec_get_event();
Expand Down
21 changes: 0 additions & 21 deletions src/mainboard/google/glados/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,11 @@
#include <ec/google/chromeec/smm.h>
#include <gpio.h>
#include <soc/iomap.h>
#include <soc/nvs.h>
#include <soc/pm.h>
#include <intelblocks/smihandler.h>
#include "ec.h"
#include <variant/gpio.h>

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
return 1;
}

void mainboard_smi_gpi_handler(const struct gpi_status *sts)
{
if (gpi_status_get(sts, EC_SMI_GPI))
Expand Down
21 changes: 0 additions & 21 deletions src/mainboard/google/jecht/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,8 @@
#include <ec/google/chromeec/ec.h>
#include <southbridge/intel/lynxpoint/lp_gpio.h>
#include <soc/iomap.h>
#include <soc/nvs.h>
#include "onboard.h"

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
return 1;
}

/* gpi_sts is GPIO 47:32 */
void mainboard_smi_gpi(u32 gpi_sts)
{
Expand Down
21 changes: 0 additions & 21 deletions src/mainboard/intel/kblrvp/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,11 @@
#include <cpu/x86/smm.h>
#include <ec/google/chromeec/smm.h>
#include <soc/iomap.h>
#include <soc/nvs.h>
#include <soc/pm.h>
#include <intelblocks/smihandler.h>
#include "ec.h"
#include <variant/gpio.h>

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
return 1;
}

void mainboard_smi_gpi_handler(const struct gpi_status *sts)
{
if (CONFIG(BOARD_INTEL_KBLRVP8))
Expand Down
21 changes: 0 additions & 21 deletions src/mainboard/intel/kunimitsu/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,11 @@
#include <cpu/x86/smm.h>
#include <ec/google/chromeec/smm.h>
#include <soc/iomap.h>
#include <soc/nvs.h>
#include <soc/pm.h>
#include <intelblocks/smihandler.h>
#include "ec.h"
#include "gpio.h"

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
return 1;
}

void mainboard_smi_gpi_handler(const struct gpi_status *sts)
{
if (gpi_status_get(sts, EC_SMI_GPI))
Expand Down
22 changes: 0 additions & 22 deletions src/mainboard/intel/strago/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,6 @@
/* The wake gpio is SUS_GPIO[0]. */
#define WAKE_GPIO_EN SUS_GPIO_EN0

int mainboard_io_trap_handler(int smif)
{
switch (smif) {
case 0x99:
printk(BIOS_DEBUG, "Sample\n");
gnvs->smif = 0;
break;
default:
return 0;
}

/*
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*
* For now, we force the return value to 0 and log all traps to
* see what's going on.
*/
//gnvs->smif = 0;
return 1;
}

static uint8_t mainboard_smi_ec(void)
{
uint8_t cmd = google_chromeec_get_event();
Expand Down
18 changes: 0 additions & 18 deletions src/soc/intel/baytrail/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,6 @@
#include <soc/nvs.h>
#include <soc/device_nvs.h>

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/*
* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void southbridge_smi_set_eos(void)
{
enable_smi(EOS);
Expand Down
18 changes: 0 additions & 18 deletions src/soc/intel/braswell/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,6 @@
#include <soc/gpio.h>
#include <smmstore.h>

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/*
* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void southbridge_smi_set_eos(void)
{
enable_smi(EOS);
Expand Down
17 changes: 0 additions & 17 deletions src/soc/intel/broadwell/pch/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@
#include <drivers/intel/gma/i915_reg.h>
#include <smmstore.h>

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

/**
* @brief Set the EOS bit
*/
Expand Down
18 changes: 0 additions & 18 deletions src/soc/intel/common/block/smm/smitraphandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,6 @@
/* Trapped write data */
#define PCR_PSTH_TRPD 0x1E18

/* Inherited from cpu/x86/smm.h resulting in a different signature */
int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/*
* gnvs->smif:
* - On success, the IO Trap Handler returns 0
* - On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void smihandler_southbridge_mc(
const struct smm_save_state_ops *save_state_ops)
Expand Down
17 changes: 0 additions & 17 deletions src/soc/intel/denverton_ns/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@
#include <soc/pm.h>
#include <soc/nvs.h>

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void southbridge_smi_set_eos(void)
{
enable_smi(EOS);
Expand Down
17 changes: 0 additions & 17 deletions src/southbridge/intel/bd82x6x/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@

#include "pch.h"

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

static void southbridge_gate_memory_reset_real(int offset,
u16 use, u16 io, u16 lvl)
{
Expand Down
17 changes: 0 additions & 17 deletions src/southbridge/intel/i82801gx/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@
/* While we read PMBASE dynamically in case it changed, let's initialize it with a sane value */
u16 pmbase = DEFAULT_PMBASE;

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void southbridge_smi_monitor(void)
{
#define IOTRAP(x) (trap_sts & (1 << x))
Expand Down
17 changes: 0 additions & 17 deletions src/southbridge/intel/i82801ix/smihandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@

#include <soc/nvs.h>

int southbridge_io_trap_handler(int smif)
{
switch (smif) {
case 0x32:
printk(BIOS_DEBUG, "OS Init\n");
/* gnvs->smif:
* On success, the IO Trap Handler returns 0
* On failure, the IO Trap Handler returns a value != 0
*/
gnvs->smif = 0;
return 1; /* IO trap handled */
}

/* Not handled */
return 0;
}

void southbridge_smi_monitor(void)
{
#define IOTRAP(x) (trap_sts & (1 << x))
Expand Down

0 comments on commit 2c3ebd8

Please sign in to comment.