From: Anthony PERARD Subject: [PATCH V3] hvmloader: Enable SCI in QEMU if is not. Date: Thu, 28 Jul 2011 14:35:26 +0100 Message-ID: <1311860126-13383-1-git-send-email-anthony.perard@citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Devel , Keir Fraser Cc: Ian Campbell , Anthony PERARD , Tobias Geiger List-Id: xen-devel@lists.xenproject.org When booting a Windows guest, the OS report an issue with the ACPI (in a BSOD). The exact issue is "SCI_EN never becomes set in PM1 Control Register." (quoted from WinDbg help). So this patch enables the flags SCI_EN if it is not yet enabled. Reported-by: Tobias Geiger Signed-off-by: Anthony PERARD --- tools/firmware/hvmloader/hvmloader.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index f8553bb..0637ac0 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -28,6 +28,7 @@ #include "apic_regs.h" #include #include +#include #define ROM_INCLUDE_VGABIOS #define ROM_INCLUDE_ETHERBOOT @@ -381,6 +382,22 @@ static const struct bios_config *detect_bios(void) return NULL; } +#define SCI_EN (1 << 0) +#define SMI_CMD_IOPORT 0xb2 +#define PIIX4_ACPI_ENABLE 0xf1 + +static void enable_sci(void) +{ + int pm1a_cnt_val = 0; + + pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1); + if (!(pm1a_cnt_val & SCI_EN)) { + outb(SMI_CMD_IOPORT, PIIX4_ACPI_ENABLE); + } + pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1); + BUG_ON(!(pm1a_cnt_val & SCI_EN)); +} + int main(void) { const struct bios_config *bios; @@ -479,6 +496,7 @@ int main(void) printf("Loading ACPI ...\n"); bios->acpi_build_tables(); } + enable_sci(); hypercall_hvm_op(HVMOP_set_param, &p); } -- Anthony PERARD