From patchwork Thu Jul 19 05:49:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 171890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 949E72C0102 for ; Thu, 19 Jul 2012 15:49:18 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Srjbw-0004JI-L4 for incoming@patchwork.ozlabs.org; Thu, 19 Jul 2012 05:49:16 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Srjbv-0004JD-3d for fwts-devel@lists.ubuntu.com; Thu, 19 Jul 2012 05:49:15 +0000 Received: from [12.232.236.2] (helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Srjbu-0007Wh-Ko for fwts-devel@lists.ubuntu.com; Thu, 19 Jul 2012 05:49:15 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] lib: fwts_acpi_tables: Force fixup on XSDT and RSDT when loading from .dat files Date: Wed, 18 Jul 2012 22:49:08 -0700 Message-Id: <1342676948-21368-2-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342676948-21368-1-git-send-email-colin.king@canonical.com> References: <1342676948-21368-1-git-send-email-colin.king@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King When loading raw ACPI tables from .dat files we have no idea where the original .dat tables were in memory, so this means that loading in the XSDT and RSDT is problematic because these contain references to the original tables in memory but we have no clue how these match up with the raw data. Since fwts has to fake the addresses of the loaded ACPI tables these don't match those in the loaded XSDT and RSDT which leads to the ACPICA core getting confused. The best strategy is to therefore not load the XSDT and RSDT and rely on the fwts table fix up stage to notice we haven't loaded the XSDT and RSDT and let this create these tables based on the tables we have loaded from the raw .dat data, leading us to having sane XSDT and RSDT that correctly reference the loaded ACPI tables even if they are at faked addresses. Signed-off-by: Colin Ian King Acked-by: Ivan Hu Acked-by: Keng-Yu Lin --- src/lib/src/fwts_acpi_tables.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index 4db5844..f388cdd 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -503,9 +503,24 @@ static int fwts_acpi_load_tables_from_file(fwts_framework *fw) name[4] = '\0'; } - fwts_acpi_add_table(name, table, - (uint64_t)fwts_fake_physical_addr(length), length, - FWTS_ACPI_TABLE_FROM_FILE); + if (!strncmp(name, "XSDT", 4) || !strncmp(name, "RSDT", 4)) { + /* + * For XSDT and RSDT we don't bother loading at this point. + * These tables point to the other tables, however, we can't + * figure out which table each pointer references because + * we are loading in raw table data and we don't know where + * these were located in the original machine. So the best + * way forward is to ignore these tables and instead leave + * the fix up stage fwts_acpi_load_tables_fixup() to magically + * create faked XSDT and RSDT entries based on the tables + * we've loaded from file. + */ + fwts_low_free(table); + } else { + fwts_acpi_add_table(name, table, + (uint64_t)fwts_fake_physical_addr(length), length, + FWTS_ACPI_TABLE_FROM_FILE); + } } close(fd); } else