From patchwork Fri May 29 13:10:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49185 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EBDB8218E7 for ; Fri, 29 May 2015 13:18:09 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf6228474wib.2 for ; Fri, 29 May 2015 06:18:08 -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 :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=iRvd+nFIGo2LzGQbZLHzykOW53L77bfmySb+GYsRl9E=; b=J6yOAK99gqLCEbZJug2dfDE2fMk+Zvtd4wv0M2f4sHKH+9ArP8UTgJyAojtD/h7uUh g4eul3f2m3ZOzvE4XdZZcddS0164WOtAHjdNpFIdfrRLA5wXyG1SksVzkeBSvjTcfFGp In+ji//wrBMVvsYWKGcdjs2696qVsR3NYj5A3+rYxLLFdVOcwO5gXfPFlaCGN6wfoBAd NNduCMZAOWv+5R5w+PY21dD6LUcWUNNOREU7MQw0uDyGsfCZzVyNtNr6bG3wyaxYmJe6 tit6WdFZTANw36rtvYdoP9Nnlknh4J9LKC/Sq0caATy29i8CcU1nR5zXHCZFMcLSCXtb WCqw== X-Gm-Message-State: ALoCoQna5Pdw8bZMmkAVgwiVIrSutuX/qhlWfVW/85EqNixoxExyKd+ZEP9sK8EKFE3J+G7Pw+C1 X-Received: by 10.152.203.233 with SMTP id kt9mr7317383lac.7.1432905488863; Fri, 29 May 2015 06:18:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.193 with SMTP id 1ls347975law.41.gmail; Fri, 29 May 2015 06:18:08 -0700 (PDT) X-Received: by 10.152.6.105 with SMTP id z9mr7731879laz.98.1432905488708; Fri, 29 May 2015 06:18:08 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id bc7si4656953lbc.144.2015.05.29.06.18.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 06:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbqq2 with SMTP id qq2so48228898lbb.3 for ; Fri, 29 May 2015 06:18:08 -0700 (PDT) X-Received: by 10.152.29.34 with SMTP id g2mr7895658lah.73.1432905488433; Fri, 29 May 2015 06:18:08 -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 hn6csp325844lbb; Fri, 29 May 2015 06:18:07 -0700 (PDT) X-Received: by 10.55.21.41 with SMTP id f41mr15765299qkh.0.1432905486920; Fri, 29 May 2015 06:18:06 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f1si5575806qcs.18.2015.05.29.06.18.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 May 2015 06:18:06 -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]:35810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyKAn-0007Nn-OL for patch@linaro.org; Fri, 29 May 2015 09:18:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3v-0003sz-RM for qemu-devel@nongnu.org; Fri, 29 May 2015 09:11:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyK3s-0003Xv-Ld for qemu-devel@nongnu.org; Fri, 29 May 2015 09:10:59 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3s-0003US-Ed for qemu-devel@nongnu.org; Fri, 29 May 2015 09:10:56 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YyK3i-0005nc-JN for qemu-devel@nongnu.org; Fri, 29 May 2015 14:10:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 29 May 2015 14:10:32 +0100 Message-Id: <1432905045-22138-27-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> References: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 26/39] 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: peter.maydell@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.177 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 Message-id: 1432522520-8068-13-git-send-email-zhaoshenglong@huawei.com Signed-off-by: Peter Maydell --- 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 95c84d6..f8c1dd8 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) @@ -285,7 +314,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; @@ -322,8 +351,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); }