dm: check SCI_EN bit of pm1_control before trigger SCI

Followed ACPI spec 4.8.2.5, if SCI_EN is set, the interrupt will be
routed to SCI interrupt logic. If SCI_EN is not set, the interrupt
will be routed to SMI interrupt logic.

ACRN does not support SMI for now, so check SCI_EN before trigger
SCI.

Tracked-On: #2560
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Yuan Liu 2019-02-28 15:35:13 +08:00 committed by Eddie Dong
parent 566e8824da
commit 35dfadc98e
1 changed files with 20 additions and 13 deletions

View File

@ -137,11 +137,31 @@ static uint16_t pm1_enable, pm1_status;
#define PM1_SLPBTN_EN 0x0200
#define PM1_RTC_EN 0x0400
/*
* Power Management 1 Control Register
*
* This is mostly unimplemented except that we wish to handle writes that
* set SPL_EN to handle S5 (soft power off).
*/
static uint16_t pm1_control;
#define PM1_SCI_EN 0x0001
#define PM1_SLP_TYP 0x1c00
#define PM1_SLP_EN 0x2000
#define PM1_ALWAYS_ZERO 0xc003
static void
sci_update(struct vmctx *ctx)
{
int need_sci;
/*
* Followed ACPI spec, should trigger SMI if SCI_EN is zero.
* Return directly due to ACRN do not support SMI so far.
*/
if (!(pm1_control & PM1_SCI_EN))
return;
/* See if the SCI should be active or not. */
need_sci = 0;
if ((pm1_enable & PM1_TMR_EN) && (pm1_status & PM1_TMR_STS))
@ -251,19 +271,6 @@ input_event0_handler(int fd, enum ev_type type, void *arg)
power_button_press_emulation(arg);
}
/*
* Power Management 1 Control Register
*
* This is mostly unimplemented except that we wish to handle writes that
* set SPL_EN to handle S5 (soft power off).
*/
static uint16_t pm1_control;
#define PM1_SCI_EN 0x0001
#define PM1_SLP_TYP 0x1c00
#define PM1_SLP_EN 0x2000
#define PM1_ALWAYS_ZERO 0xc003
static int
pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
uint32_t *eax, void *arg)