amd/stoneyridge: Check SMI command address before reading

Use the currently programmed address of the SMI command port before
checking the passed command.  This ensures we're reading the right
port in case the port was relocated without our knowledge.

Change-Id: I8a3ca285d3a9afd4a107cd471c202abf03f372ac
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/21744
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Marshall Dawson 2017-09-27 13:32:38 -06:00 committed by Martin Roth
parent eecb794c96
commit 66e62da4c7
3 changed files with 7 additions and 2 deletions

View File

@ -194,6 +194,7 @@ enum smi_lvl {
SMI_LVL_HIGH = 1,
};
uint16_t pm_acpi_smi_cmd_port(void);
void configure_gevent_smi(uint8_t gevent, uint8_t mode, uint8_t level);
void disable_gevent_smi(uint8_t gevent);
void enable_acpi_cmd_smi(void);

View File

@ -74,3 +74,8 @@ void enable_acpi_cmd_smi(void)
{
configure_smi(SMITYPE_SMI_CMD_PORT, SMI_MODE_SMI);
}
uint16_t pm_acpi_smi_cmd_port(void)
{
return pm_read16(PM_ACPI_SMI_CMD);
}

View File

@ -5,7 +5,6 @@
* Subject to the GNU GPL v2, or (at your option) any later version.
*/
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <delay.h>
@ -27,7 +26,7 @@ enum smi_source {
static void sb_apmc_smi_handler(void)
{
u32 reg32;
const uint8_t cmd = inb(APM_CNT);
const uint8_t cmd = inb(pm_acpi_smi_cmd_port());
switch (cmd) {
case APM_CNT_ACPI_ENABLE: