From 078178b23bbdf1d2748a7077a84b90a62adc2818 Mon Sep 17 00:00:00 2001 From: Madeeha Javed Date: Thu, 5 Jul 2018 12:53:45 +0500 Subject: [PATCH] DM: Fixes issue #592 NHLT is not detected on audio passthru. When XSDT is created by DM, if audio passthru is enabled for audio device (0:e:0), an entry is added in XSDT that references the NHLT table. With this fix, NHLT appears in the kernel boot log for ACPI and entry can be seen in /sys/firmware/acpi/tables/NHLT. Signed-off-by: Madeeha Javed --- devicemodel/hw/platform/acpi/acpi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/devicemodel/hw/platform/acpi/acpi.c b/devicemodel/hw/platform/acpi/acpi.c index 2e9baca3c..27f7f587a 100644 --- a/devicemodel/hw/platform/acpi/acpi.c +++ b/devicemodel/hw/platform/acpi/acpi.c @@ -114,6 +114,8 @@ struct basl_fio { #define EFPRINTF(...) fprintf(__VA_ARGS__) #define EFFLUSH(x) fflush(x) +static bool acpi_table_is_valid(int num); + static int basl_fwrite_rsdp(FILE *fp, struct vmctx *ctx) { @@ -198,6 +200,10 @@ basl_fwrite_xsdt(FILE *fp, struct vmctx *ctx) EFPRINTF(fp, "[0004]\t\tACPI Table Address 3 : 00000000%08X\n", basl_acpi_base + MCFG_OFFSET); + if (acpi_table_is_valid(NHLT_ENTRY_NO)) + EFPRINTF(fp, "[0004]\t\tACPI Table Address 4 : 00000000%08X\n", + basl_acpi_base + NHLT_OFFSET); + EFFLUSH(fp); return 0; @@ -976,6 +982,12 @@ acpi_table_enable(int num) basl_ftables[num].valid = true; } +static bool +acpi_table_is_valid(int num) +{ + return basl_ftables[num].valid; +} + uint32_t get_acpi_base(void) { @@ -1018,7 +1030,7 @@ acpi_build(struct vmctx *ctx, int ncpu) * copying them into guest memory */ while (!err && (i < ARRAY_SIZE(basl_ftables))) { - if (basl_ftables[i].valid) + if (acpi_table_is_valid(i)) err = basl_compile(ctx, basl_ftables[i].wsect, basl_ftables[i].offset); i++;