From patchwork Thu May 21 02:28:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48833 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B00EE2121F for ; Thu, 21 May 2015 02:38:36 +0000 (UTC) Received: by laat2 with SMTP id t2sf22694149laa.2 for ; Wed, 20 May 2015 19:38:35 -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:content-transfer-encoding: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=RpZyL17AT4xiX+Ad38O96C89gLUkMkV9VAAujUiqLhI=; b=YdVrrDN1K0q/rrWAW6oEPdFqMam4i5zlLZW79/bUNgsayn2fexczUxVSH5m/G+7HCG xrekYBYr7/8on8e4f9CYoxs19uvJoY50qnQ+9LeIsTfykjK8edwlzlUncDfQ1bHvJXzl mb9ZlPakCmolHg4u8zBP8ErJPZ1+2qbRCk7iMOe9NCughu+/5ynFsZ7TqEVWlJlfLpdu 15tc+j51yzqIgHqolkBXftOZBuQe04PY/OtErODNBs74gbJm8JIGaLXUZ4iK9x3fTEbd N5sZmFHvoqa+19wkepA+97dwXKrvEbojDDhzsPpohar16Pt5KZCdesN4w/ct9REWqLqH KOvg== X-Gm-Message-State: ALoCoQlZXZvfl9/aZP8z3zyRqx155lcp5t2/+igC9XlXz8jBdVxMgOnmDEY/bjbSsO2a6eVKYlpC X-Received: by 10.152.184.73 with SMTP id es9mr467994lac.4.1432175915655; Wed, 20 May 2015 19:38:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.245.43 with SMTP id xl11ls289802lac.21.gmail; Wed, 20 May 2015 19:38:35 -0700 (PDT) X-Received: by 10.112.143.165 with SMTP id sf5mr344904lbb.44.1432175915545; Wed, 20 May 2015 19:38:35 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id x10si12325848lbo.118.2015.05.20.19.38.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 19:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbzk7 with SMTP id zk7so8018844lbb.0 for ; Wed, 20 May 2015 19:38:35 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr336671lbc.86.1432175915426; Wed, 20 May 2015 19:38:35 -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.108.230 with SMTP id hn6csp230924lbb; Wed, 20 May 2015 19:38:34 -0700 (PDT) X-Received: by 10.55.17.89 with SMTP id b86mr1009541qkh.6.1432175913617; Wed, 20 May 2015 19:38:33 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 61si5882129qgg.18.2015.05.20.19.38.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 May 2015 19:38:33 -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]:54634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGNU-0006Ir-MT for patch@linaro.org; Wed, 20 May 2015 22:38:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGIx-0006DH-Kn for qemu-devel@nongnu.org; Wed, 20 May 2015 22:33:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvGIt-0006in-Gl for qemu-devel@nongnu.org; Wed, 20 May 2015 22:33:51 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:2854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGIs-0006gz-SW for qemu-devel@nongnu.org; Wed, 20 May 2015 22:33:47 -0400 Received: from 172.24.2.119 (EHLO szxeml434-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLR49620; Thu, 21 May 2015 10:30:23 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.158.1; Thu, 21 May 2015 10:30:13 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 21 May 2015 10:28:39 +0800 Message-ID: <1432175331-12548-13-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432175331-12548-1-git-send-email-zhaoshenglong@huawei.com> References: <1432175331-12548-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: 119.145.14.65 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v8 12/24] hw/arm/virt-acpi-build: Generate RSDP 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.174 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 RSDP points to RSDT which in turn points to other tables. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Reviewed-by: Alex Bennée --- hw/arm/virt-acpi-build.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index f46820a..9c836ef 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -151,6 +151,35 @@ static void acpi_dsdt_add_virtio(Aml *scope, } } +/* RSDP */ +static GArray * +build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) +{ + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); + + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, + true /* fseg memory */); + + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); + memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id)); + rsdp->length = cpu_to_le32(sizeof(*rsdp)); + rsdp->revision = 0x02; + + /* Point to RSDT */ + rsdp->rsdt_physical_address = cpu_to_le32(rsdt); + /* Address to be filled by Guest linker */ + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, + ACPI_BUILD_TABLE_FILE, + rsdp_table, &rsdp->rsdt_physical_address, + sizeof rsdp->rsdt_physical_address); + rsdp->checksum = 0; + /* Checksum to be filled by Guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); + + return rsdp_table; +} + /* GTDT */ static void build_gtdt(GArray *table_data, GArray *linker) @@ -283,7 +312,7 @@ static void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) { GArray *table_offsets; - unsigned dsdt; + unsigned dsdt, rsdt; VirtAcpiCpuInfo cpuinfo; GArray *tables_blob = tables->table_data; @@ -320,8 +349,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) build_gtdt(tables_blob, tables->linker); /* RSDT is pointed to by RSDP */ + rsdt = tables_blob->len; build_rsdt(tables_blob, tables->linker, table_offsets); + /* RSDP is in FSEG memory, so allocate it separately */ + build_rsdp(tables->rsdp, tables->linker, rsdt); + /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); }