From patchwork Fri Apr 3 10:03:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 46761 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C4B76216D1 for ; Fri, 3 Apr 2015 10:18:03 +0000 (UTC) Received: by wibgr10 with SMTP id gr10sf23847248wib.2 for ; Fri, 03 Apr 2015 03:18:03 -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=8DMOfbvENTNwfyng2wOHzBYU5rc+3YFBdyeVDnd+FV0=; b=liQfyaBVFt5hXTSi8363U96CdqSSjHw90x1lde9iqDYDLfQDXG0pjbqEtfPejML5qH R7c28skHcFIevJmnuI8EmzxKfkBTPmzeMZ1SNn/7ywfo4Q8xLpHDyJ783WhF9Klh2cgB dbRFNvPVfgP2KB3D4e9vBdawNwgvm7rM5H9jmXjUwrwxHT3F4LysYiFpkXLBH3Mwp2l+ KhZnTTn/GzKKrEJBerUJsGDqNyR2gPUIDxB/MqnCumlGW4Tl7v1oB51R+Cb4ypREMsZ/ ZGBlxtdKT8InYoJsoGQ48QgQLxts6KzzqrqWSfeSTTguvTcFaSZzr9BRD4cdwG2tV1dr 0NeQ== X-Gm-Message-State: ALoCoQmkg7bon9K1m3W/1923BAxlWVrNuQSeYBEbp2BIES2+K/mJdBhDeKpJ7XHmMip2lZQVg8od X-Received: by 10.112.201.232 with SMTP id kd8mr452200lbc.16.1428056283003; Fri, 03 Apr 2015 03:18:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.167 with SMTP id u7ls293551lag.56.gmail; Fri, 03 Apr 2015 03:18:02 -0700 (PDT) X-Received: by 10.112.48.107 with SMTP id k11mr1522913lbn.92.1428056282676; Fri, 03 Apr 2015 03:18:02 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id t2si6360845laj.59.2015.04.03.03.18.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 03:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lajy8 with SMTP id y8so77172547laj.0 for ; Fri, 03 Apr 2015 03:18:02 -0700 (PDT) X-Received: by 10.152.8.161 with SMTP id s1mr1539575laa.41.1428056282400; Fri, 03 Apr 2015 03:18:02 -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.57.201 with SMTP id k9csp1863370lbq; Fri, 3 Apr 2015 03:18:01 -0700 (PDT) X-Received: by 10.55.49.197 with SMTP id x188mr2878286qkx.49.1428056281211; Fri, 03 Apr 2015 03:18:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q34si7727388qkq.49.2015.04.03.03.18.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Apr 2015 03:18:01 -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]:33392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydyfo-0004HL-Ar for patch@linaro.org; Fri, 03 Apr 2015 06:18:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyXW-0007Vk-Hh for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:09:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdyXS-0003E1-3j for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:09:26 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:9506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyXR-00036k-HO for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:09:22 -0400 Received: from 172.24.2.119 (EHLO szxeml425-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CJI43161; Fri, 03 Apr 2015 18:05:55 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml425-hub.china.huawei.com (10.82.67.180) with Microsoft SMTP Server id 14.3.158.1; Fri, 3 Apr 2015 18:05:47 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Fri, 3 Apr 2015 18:03:43 +0800 Message-ID: <1428055432-12120-12-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> References: <1428055432-12120-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, shannon.zhao@linaro.org, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v4 11/20] 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.215.51 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 85e84b1..dd5538b 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -176,6 +176,35 @@ static void acpi_dsdt_add_virtio(Aml *scope, const hwaddr *mmio_addrs, } } +/* 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; +} + /* RSDT */ static void build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) @@ -336,7 +365,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; @@ -373,8 +402,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) build_gtdt(tables_blob, tables->linker, guest_info); /* 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); }