aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/acpi-build.c
diff options
context:
space:
mode:
authorGabriel L. Somlo <gsomlo@gmail.com>2013-12-22 10:34:56 -0500
committerMichael S. Tsirkin <mst@redhat.com>2014-01-26 13:06:48 +0200
commit15bce1b7c55c69f47e13c9eb2a4b80f41da26581 (patch)
treefc8ac6ec8bfd998fee2803cd04b31c46e78bda97 /hw/i386/acpi-build.c
parent3e16d14fd93ca6059134ba6b4f65c1c3e4cd3a18 (diff)
Add DSDT node for AppleSMC
AppleSMC (-device isa-applesmc) is required to boot OS X guests. OS X expects a SMC node to be present in the ACPI DSDT. This patch adds a SMC node to the DSDT, and dynamically patches the return value of SMC._STA to either 0x0B if the chip is present, or otherwise to 0x00, before booting the guest. Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/acpi-build.c')
-rw-r--r--hw/i386/acpi-build.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 48312f5a83..30bfcd2b4a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -36,6 +36,7 @@
#include "hw/nvram/fw_cfg.h"
#include "bios-linker-loader.h"
#include "hw/loader.h"
+#include "hw/isa/isa.h"
/* Supported chipsets: */
#include "hw/acpi/piix4.h"
@@ -80,6 +81,7 @@ typedef struct AcpiMiscInfo {
static void acpi_get_dsdt(AcpiMiscInfo *info)
{
+ unsigned short applesmc_sta_val, *applesmc_sta_off;
Object *piix = piix4_pm_find();
Object *lpc = ich9_lpc_find();
assert(!!piix != !!lpc);
@@ -87,11 +89,18 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
if (piix) {
info->dsdt_code = AcpiDsdtAmlCode;
info->dsdt_size = sizeof AcpiDsdtAmlCode;
+ applesmc_sta_off = piix_dsdt_applesmc_sta;
}
if (lpc) {
info->dsdt_code = Q35AcpiDsdtAmlCode;
info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
+ applesmc_sta_off = q35_dsdt_applesmc_sta;
}
+
+ /* Patch in appropriate value for AppleSMC _STA */
+ applesmc_sta_val = applesmc_find() ? 0x0b : 0x00;
+ *(uint16_t *)(info->dsdt_code + *applesmc_sta_off) =
+ cpu_to_le16(applesmc_sta_val);
}
static