From patchwork Thu May 7 09:29:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48092 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 800F020553 for ; Thu, 7 May 2015 09:35:50 +0000 (UTC) Received: by lamp14 with SMTP id p14sf11749778lam.3 for ; Thu, 07 May 2015 02:35:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=No8H8A1A1TPwE1wAI3zoAIRDIBG9Z1yyZX6Afp9/qAY=; b=cwO4y+buV8A5aPdJF3xZDXm0AB6Gw06fbhmKAqpR4cAyy0WYAQKhu/Hfcuj6p71efN UHaG8bLR6QRuGQCkjz1cHSERtwyIus3WlV2Lt7XHqEkoHC/GK2SjhBnpoGrzkCS5DA47 /yHk9/kD/q98MhyGShIbTuZn3Wrc6Kl9U69z+iNMfFZnTV8KOA9zXhY8aV3Vm2euyTKz qssjkzCv5FPV57TzhQcIdRNImeWYm9Inbeb1tfTIp+1gUvsPwKQCeLGYpSX5T2EDm+Qf 5x9uzBAg8wHZg8UNFXf9PGZAiTaBfuxhIYU06bIwrvKexQkG0s5Qc0l4BE3ZgpaXLmuA 2Hgg== X-Gm-Message-State: ALoCoQnKPiNoo1Ws1TUA4VHrLm3viLYvObtN7DON3/i+B+e4Ltr5dvSk3VOJX7AMONWLicsnJbwh X-Received: by 10.112.13.200 with SMTP id j8mr1751068lbc.14.1430991349105; Thu, 07 May 2015 02:35:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.37 with SMTP id p5ls175484lah.9.gmail; Thu, 07 May 2015 02:35:49 -0700 (PDT) X-Received: by 10.112.166.37 with SMTP id zd5mr2272241lbb.75.1430991348988; Thu, 07 May 2015 02:35:48 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id r5si946483lbp.16.2015.05.07.02.35.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 02:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcga7 with SMTP id ga7so26736783lbc.1 for ; Thu, 07 May 2015 02:35:48 -0700 (PDT) X-Received: by 10.152.2.227 with SMTP id 3mr2282340lax.73.1430991348557; Thu, 07 May 2015 02:35:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp3329778lbt; Thu, 7 May 2015 02:35:47 -0700 (PDT) X-Received: by 10.55.49.147 with SMTP id x141mr6207079qkx.23.1430991346976; Thu, 07 May 2015 02:35:46 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 145si1440079qhu.43.2015.05.07.02.35.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 02:35:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIDZ-00046c-Kv for patch@linaro.org; Thu, 07 May 2015 05:35:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAJ-0007pq-CM for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqIAG-0001tw-3x for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:23 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:42295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAF-0001t6-C0 for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:20 -0400 Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CNI17465; Thu, 07 May 2015 17:32:04 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Thu, 7 May 2015 17:31:27 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 7 May 2015 17:29:12 +0800 Message-ID: <1430990964-10528-11-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> References: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v6 10/22] hw/arm/virt-acpi-build: Generate RSDT table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao RSDT points to other tables FADT, MADT, GTDT. This code is shared with x86. Here we still use RSDT as UEFI puts ACPI tables below 4G address space, and UEFI ignore the RSDT or XSDT. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/acpi/aml-build.c | 24 ++++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 3 +++ hw/i386/acpi-build.c | 24 ------------------------ include/hw/acpi/aml-build.h | 2 ++ 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index babe4d6..b99bb13 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1004,3 +1004,27 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) g_array_free(tables->table_data, true); g_array_free(tables->tcpalog, mfre); } + +/* Build rsdt table */ +void +build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) +{ + AcpiRsdtDescriptorRev1 *rsdt; + size_t rsdt_len; + int i; + const int table_data_len = (sizeof(uint32_t) * table_offsets->len); + + rsdt_len = sizeof(*rsdt) + table_data_len; + rsdt = acpi_data_push(table_data, rsdt_len); + memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); + for (i = 0; i < table_offsets->len; ++i) { + /* rsdt->table_offset_entry to be filled by Guest linker */ + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_TABLE_FILE, + ACPI_BUILD_TABLE_FILE, + table_data, &rsdt->table_offset_entry[i], + sizeof(uint32_t)); + } + build_header(linker, table_data, + (void *)rsdt, "RSDT", rsdt_len, 1); +} diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index efdd8dd..401e634 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -320,6 +320,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_gtdt(tables_blob, tables->linker, guest_info); + /* RSDT is pointed to by RSDP */ + build_rsdt(tables_blob, tables->linker, table_offsets); + /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2d6e5a2..b753f08 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1193,30 +1193,6 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc) misc->dsdt_size, 1); } -/* Build final rsdt table */ -static void -build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) -{ - AcpiRsdtDescriptorRev1 *rsdt; - size_t rsdt_len; - int i; - - rsdt_len = sizeof(*rsdt) + sizeof(uint32_t) * table_offsets->len; - rsdt = acpi_data_push(table_data, rsdt_len); - memcpy(rsdt->table_offset_entry, table_offsets->data, - sizeof(uint32_t) * table_offsets->len); - for (i = 0; i < table_offsets->len; ++i) { - /* rsdt->table_offset_entry to be filled by Guest linker */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, - ACPI_BUILD_TABLE_FILE, - table_data, &rsdt->table_offset_entry[i], - sizeof(uint32_t)); - } - build_header(linker, table_data, - (void *)rsdt, "RSDT", rsdt_len, 1); -} - static GArray * build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) { diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 5b60744..d1b9fe7 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -268,5 +268,7 @@ unsigned acpi_data_len(GArray *table); void acpi_add_table(GArray *table_offsets, GArray *table_data); void acpi_build_tables_init(AcpiBuildTables *tables); void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); +void +build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets); #endif