From patchwork Sun Sep 13 15:06:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 53537 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id C25282056A for ; Sun, 13 Sep 2015 15:07:38 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf38032044lbc.1 for ; Sun, 13 Sep 2015 08:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references: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=XBVwHysRvBMDTeaw+vZD0Ah/6r5XeEHGs3j/htPsc4w=; b=LeuCbNTLJ8mr0Kz8D6bwT1ovjXn2w95eKM9tU4HFj6OwZGjzTq0vvkZPPDQAEJYwPb 84A7dn47hEKyrV5GUqWQF0Z8+cS1ivmt4pGVDGxbqhT/LG5t97kn2apXrd0lv4vOn2Av RKc3GxYHGV6j1Qd5gZ7fzfuo+3NCyuelapjX9pEhIi/FoBrJVuYhh7ZCVU9P9VU1Fmjb i5d388GZQ558yBWwoYzaeLqNEhx0RGgJhHGgkvErTkuTLQyz9hMLjhMHvahAyDAfDxAe retIE9ZvoBnO7uloeV+PKr2a6gTY06OWbTG6iWO9c6wBHngzIKgkBWLhdjPGPBwAqzlP oWLA== X-Gm-Message-State: ALoCoQlMsYZtpOjNf9hPAlaWmwESR6lDK6k/9ye/mThERgMiErzwFrbDHIIlj9IXyZph6w5xctIa X-Received: by 10.152.120.233 with SMTP id lf9mr2093320lab.2.1442156857146; Sun, 13 Sep 2015 08:07:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.228 with SMTP id n4ls219037lah.92.gmail; Sun, 13 Sep 2015 08:07:37 -0700 (PDT) X-Received: by 10.152.163.98 with SMTP id yh2mr8899088lab.5.1442156856998; Sun, 13 Sep 2015 08:07:36 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id o7si6731527lbw.36.2015.09.13.08.07.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2015 08:07:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lahg1 with SMTP id g1so43260285lah.1 for ; Sun, 13 Sep 2015 08:07:36 -0700 (PDT) X-Received: by 10.152.18.133 with SMTP id w5mr8919850lad.72.1442156856903; Sun, 13 Sep 2015 08:07:36 -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.59.35 with SMTP id w3csp757937lbq; Sun, 13 Sep 2015 08:07:35 -0700 (PDT) X-Received: by 10.107.151.81 with SMTP id z78mr17825329iod.63.1442156855889; Sun, 13 Sep 2015 08:07:35 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j23si6336401ioi.43.2015.09.13.08.07.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Sep 2015 08:07:35 -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]:36153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb8sP-0003P7-EE for patch@linaro.org; Sun, 13 Sep 2015 11:07:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb8rc-0002Wx-Hq for qemu-devel@nongnu.org; Sun, 13 Sep 2015 11:06:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zb8rZ-0003iZ-AH for qemu-devel@nongnu.org; Sun, 13 Sep 2015 11:06:44 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zb8rZ-0003iQ-4K for qemu-devel@nongnu.org; Sun, 13 Sep 2015 11:06:41 -0400 Received: by wicge5 with SMTP id ge5so113006597wic.0 for ; Sun, 13 Sep 2015 08:06:40 -0700 (PDT) X-Received: by 10.180.109.200 with SMTP id hu8mr16685899wib.86.1442156800490; Sun, 13 Sep 2015 08:06:40 -0700 (PDT) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by smtp.gmail.com with ESMTPSA id nf15sm9458673wic.22.2015.09.13.08.06.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 Sep 2015 08:06:39 -0700 (PDT) From: Leif Lindholm To: qemu-devel@nongnu.org Date: Sun, 13 Sep 2015 16:06:33 +0100 Message-Id: <1442156793-30708-3-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442156793-30708-1-git-send-email-leif.lindholm@linaro.org> References: <1442156793-30708-1-git-send-email-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.173 Cc: peter.maydell@linaro.org, drjones@redhat.com, shannon.zhao@linaro.org, imammedo@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 2/2] hw/arm/virt-acpi-build: Add DBG2 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: leif.lindholm@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.49 as permitted sender) smtp.mailfrom=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 Add a DBG2 table, describing the pl011 UART. Signed-off-by: Leif Lindholm Reviewed-by: Andrew Jones --- hw/arm/virt-acpi-build.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 9088248..0ea7023 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -352,6 +352,61 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) } static void +build_dbg2(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) +{ + AcpiDebugPort2Header *dbg2; + AcpiDebugPort2Device *dev; + struct AcpiGenericAddress *addr; + uint32_t *addr_size; + char *name; + const MemMapEntry *uart_memmap = &guest_info->memmap[VIRT_UART]; + int table_size, dev_size, namepath_length; + const char namepath[] = "."; + + namepath_length = strlen(namepath) + 1; + dev_size = sizeof(*dev) + sizeof(*addr) * 1 + sizeof(uint32_t) * 1 + + namepath_length; + table_size = dev_size + sizeof(AcpiDebugPort2Header); + + dbg2 = acpi_data_push(table_data, table_size); + dev = (void *)dbg2 + sizeof(*dbg2); + addr = (void *)dev + sizeof(*dev); + addr_size = (void *)addr + sizeof(*addr); + name = (void *)addr_size + sizeof(*addr_size); + + dbg2->devices_offset = sizeof(*dbg2); + dbg2->devices_count = 1; + + /* First (only) debug device */ + dev->revision = 0; + dev->length = cpu_to_le16(dev_size); + dev->address_count = 1; + dev->namepath_length = cpu_to_le16(namepath_length); + dev->namepath_offset = cpu_to_le16((void *)name - (void *)dev); + dev->oem_data_length = 0; + dev->oem_data_offset = 0; + dev->port_type = cpu_to_le16(0x8000); /* Serial */ + dev->port_subtype = cpu_to_le16(0x3); /* ARM PL011 UART */ + dev->base_address_offset = cpu_to_le16((void *)addr - (void *)dev); + dev->address_size_offset = cpu_to_le16((void *)addr_size - (void *)dev); + + /* First (only) address */ + addr->space_id = AML_SYSTEM_MEMORY; + addr->bit_width = 8; + addr->bit_offset = 0; + addr->access_width = 1; + addr->address = cpu_to_le64(uart_memmap->base); + + /* Size of first (only) address */ + *addr_size = cpu_to_le32(sizeof(*addr)); + + /* Namespace String for first (only) device */ + strcpy(name, namepath); + + build_header(linker, table_data, (void *)dbg2, "DBG2", table_size, 0); +} + +static void build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) { AcpiSerialPortConsoleRedirection *spcr; @@ -577,7 +632,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) dsdt = tables_blob->len; build_dsdt(tables_blob, tables->linker, guest_info); - /* FADT MADT GTDT MCFG SPCR pointed to by RSDT */ + /* FADT MADT GTDT MCFG DBG2 SPCR pointed to by RSDT */ acpi_add_table(table_offsets, tables_blob); build_fadt(tables_blob, tables->linker, dsdt); @@ -591,6 +646,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) build_mcfg(tables_blob, tables->linker, guest_info); acpi_add_table(table_offsets, tables_blob); + build_dbg2(tables_blob, tables->linker, guest_info); + + acpi_add_table(table_offsets, tables_blob); build_spcr(tables_blob, tables->linker, guest_info); /* RSDT is pointed to by RSDP */