From nobody Mon Feb 9 02:51:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634631103; cv=none; d=zohomail.com; s=zohoarc; b=YU3HfckdHrrCBsz9vNea9eY/RLKOP+BxDghnNxFpP1TAfqQlGusJ1Z8U4VpttHqRzLPkxCxDHCwWdZR2NwC0GYCbVmSAjigeK/E5bGR9H1G5qh4ikCyXVdaidCCe9ushr5VQznQMllTWzW6nT7m8PbftK3wavANwGjccI/IxNPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634631103; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zKLTd6OOu3MagQZJmRM543Uno1fF5cqdFuW3oUqOJug=; b=ibRkuiYCLb4tx0TN72Yika3rQq2ZmWyOcHIurTkeFxrILlSts6YTEr/q65l92ZQRiC/YWEoY92pHyd0tYQObV7VuFbXTctURUyijKrvNe4XGTBkfyVKZDvim8i3EfU29xvJ/e9b6xbfsxzygsvrIwnJ/yaGISNrk9oNtFl4b7uY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634631103613475.6885459732648; Tue, 19 Oct 2021 01:11:43 -0700 (PDT) Received: from localhost ([::1]:38224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mckDl-0003zC-AT for importer@patchew.org; Tue, 19 Oct 2021 04:11:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mck4R-0002sh-Az for qemu-devel@nongnu.org; Tue, 19 Oct 2021 04:02:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mck4K-00020O-Vr for qemu-devel@nongnu.org; Tue, 19 Oct 2021 04:02:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-anT-YokJMX2nJmJx3VJ33g-1; Tue, 19 Oct 2021 04:01:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6F0218125C0; Tue, 19 Oct 2021 08:01:51 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.39.193.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EA545DAA5; Tue, 19 Oct 2021 08:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634630516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zKLTd6OOu3MagQZJmRM543Uno1fF5cqdFuW3oUqOJug=; b=LiFcPTTH8fFcjr+Vd22FQWhRf/Px8YmV4tkB+HthzgdAmt7dl9fymDeqQJ2zCdC0OmmNl4 MBNaIyPiIH8pET7WD3ELpHslepL1bfc2PVpLrBv04yPVyNyRyt8mri7dMYGSh/u77jdhy8 YgKjK9jlwp+MFYyKR8H8LiTCkmMNQ+8= X-MC-Unique: anT-YokJMX2nJmJx3VJ33g-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, mst@redhat.com, imammedo@redhat.com, richard.henderson@linaro.org, philmd@redhat.com, peter.maydell@linaro.org, shannon.zhaosl@gmail.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org, ardb@kernel.org, drjones@redhat.com Subject: [PATCH v5 2/3] hw/arm/virt_acpi_build: Generate DBG2 table Date: Tue, 19 Oct 2021 10:00:36 +0200 Message-Id: <20211019080037.930641-3-eric.auger@redhat.com> In-Reply-To: <20211019080037.930641-1-eric.auger@redhat.com> References: <20211019080037.930641-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eric.auger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gshan@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634631104818100001 Content-Type: text/plain; charset="utf-8" ARM SBBR specification mandates DBG2 table (Debug Port Table 2) since v1.0 (ARM DEN0044F 8.3.1.7 DBG2). The DBG2 table allows to describe one or more debug ports. Generate an DBG2 table featuring a single debug port, the PL011. The DBG2 specification can be found at "Microsoft Debug Port Table 2 (DBG2)" https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debu= g-port-table?redirectedfrom=3DMSDN Signed-off-by: Eric Auger Acked-by: Michael S. Tsirkin Reviewed-by: Andrew Jones Reviewed-by: Igor Mammedov --- hw/arm/virt-acpi-build.c | 63 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 6cec97352b..dd17a48c00 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -616,6 +616,64 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) acpi_table_end(linker, &table); } =20 +/* Debug Port Table 2 (DBG2) */ +static void +build_dbg2(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +{ + AcpiTable table =3D { .sig =3D "DBG2", .rev =3D 0, .oem_id =3D vms->oe= m_id, + .oem_table_id =3D vms->oem_table_id }; + int dbg2devicelength; + const char name[] =3D "COM0"; + const int namespace_length =3D sizeof(name); + + acpi_table_begin(&table, table_data); + + dbg2devicelength =3D 22 + /* BaseAddressRegister[] offset */ + 12 + /* BaseAddressRegister[] */ + 4 + /* AddressSize[] */ + namespace_length /* NamespaceString[] */; + + /* OffsetDbgDeviceInfo */ + build_append_int_noprefix(table_data, 44, 4); + /* NumberDbgDeviceInfo */ + build_append_int_noprefix(table_data, 1, 4); + + /* Table 2. Debug Device Information structure format */ + build_append_int_noprefix(table_data, 0, 1); /* Revision */ + build_append_int_noprefix(table_data, dbg2devicelength, 2); /* Length = */ + /* NumberofGenericAddressRegisters */ + build_append_int_noprefix(table_data, 1, 1); + /* NameSpaceStringLength */ + build_append_int_noprefix(table_data, namespace_length, 2); + build_append_int_noprefix(table_data, 38, 2); /* NameSpaceStringOffset= */ + build_append_int_noprefix(table_data, 0, 2); /* OemDataLength */ + /* OemDataOffset (0 means no OEM data) */ + build_append_int_noprefix(table_data, 0, 2); + + /* Port Type */ + build_append_int_noprefix(table_data, 0x8000 /* Serial */, 2); + /* Port Subtype */ + build_append_int_noprefix(table_data, 0x3 /* ARM PL011 UART */, 2); + build_append_int_noprefix(table_data, 0, 2); /* Reserved */ + /* BaseAddressRegisterOffset */ + build_append_int_noprefix(table_data, 22, 2); + /* AddressSizeOffset */ + build_append_int_noprefix(table_data, 34, 2); + + /* BaseAddressRegister[] */ + build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 8, 0, 1, + vms->memmap[VIRT_UART].base); + + /* AddressSize[] */ + build_append_int_noprefix(table_data, + vms->memmap[VIRT_UART].size, 4); + + /* NamespaceString[] */ + g_array_append_vals(table_data, name, namespace_length); + + acpi_table_end(linker, &table); +}; + /* * ACPI spec, Revision 5.1 Errata A * 5.2.12 Multiple APIC Description Table (MADT) @@ -875,7 +933,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) dsdt =3D tables_blob->len; build_dsdt(tables_blob, tables->linker, vms); =20 - /* FADT MADT GTDT MCFG SPCR pointed to by RSDT */ + /* FADT MADT GTDT MCFG SPCR DBG2 pointed to by RSDT */ acpi_add_table(table_offsets, tables_blob); build_fadt_rev5(tables_blob, tables->linker, vms, dsdt); =20 @@ -898,6 +956,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) acpi_add_table(table_offsets, tables_blob); build_spcr(tables_blob, tables->linker, vms); =20 + acpi_add_table(table_offsets, tables_blob); + build_dbg2(tables_blob, tables->linker, vms); + if (vms->ras) { build_ghes_error_table(tables->hardware_errors, tables->linker); acpi_add_table(table_offsets, tables_blob); --=20 2.26.3