public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Joey Gouly" <joey.gouly@arm.com>
To: <devel@edk2.groups.io>
Cc: <joey.gouly@arm.com>, <ray.ni@intel.com>, <sami.mujawar@arm.com>,
	<nd@arm.com>
Subject: [PATCH v1 4/4] DynamicTablesPkg: Set the Access size for the DBG2 table
Date: Thu, 15 Apr 2021 13:17:20 +0100	[thread overview]
Message-ID: <20210415121720.11553-5-joey.gouly@arm.com> (raw)
In-Reply-To: <20210415121720.11553-1-joey.gouly@arm.com>

The DBG2 table generator set the access size for the UART to
DWORD (4 bytes) by default. However, according to Section B
Generic UART, Arm Base System Architecture 1.0, Platform
Design Document, a Generic UART can have BYTE, WORD or DWORD
access sizes. To address this an AccessSize field has been
introduced in CM_ARM_SERIAL_PORT_INFO object.

This patch updates the DBG2 generator to setup the AccessSize
field in the Generic Address Structure (GAS) for the UART in
the DBG2 table with information provided by the platform.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index d902bbc8463921624f1a6333e8d6bd84c6cb38f2..a7508d4a8834fd2038946a62de39e9cd0894bf79 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -1,7 +1,7 @@
 /** @file
   DBG2 Table Generator
 
-  Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -420,6 +420,28 @@ BuildDbg2TableEx (
   AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.Address =
     SerialPortInfo->BaseAddress;
 
+  // Set the access size
+  if (SerialPortInfo->AccessSize >= EFI_ACPI_6_3_QWORD) {
+    Status = EFI_INVALID_PARAMETER;
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: DBG2: Access size must be <= 3 (DWORD). Status = %r\n",
+      Status
+      ));
+    goto error_handler;
+  } else if (SerialPortInfo->AccessSize == EFI_ACPI_6_3_UNDEFINED) {
+    // 0 Undefined (legacy reasons)
+    // Default to DWORD access size as the access
+    // size field was introduced at a later date
+    // and some ConfigurationManager implementations
+    // may not be providing this field data
+    AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.AccessSize =
+      EFI_ACPI_6_3_DWORD;
+  } else {
+    AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.AccessSize =
+      SerialPortInfo->AccessSize;
+  }
+
   // Update the serial port subtype
   AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].Dbg2Device.PortSubtype =
     SerialPortInfo->PortSubtype;
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


  parent reply	other threads:[~2021-04-15 12:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 12:17 [PATCH v1 0/4] DynamicTablesPkg: Add access size parameter for serial ports Joey Gouly
2021-04-15 12:17 ` [PATCH v1 1/4] ShellPkg: Rename Address Size to Access size Joey Gouly
2021-04-15 12:28   ` Sami Mujawar
     [not found]   ` <167607D852D7D23D.10637@groups.io>
2021-04-16 11:43     ` [edk2-devel] " Sami Mujawar
2021-04-19  3:17       ` Gao, Zhichao
2021-04-15 12:17 ` [PATCH v1 2/4] DynamicTablesPkg: Add access size to CM_ARM_SERIAL_PORT_INFO Joey Gouly
2021-04-16 11:51   ` Sami Mujawar
2021-04-15 12:17 ` [PATCH v1 3/4] DynamicTablesPkg: Set the Access size for the SPCR table Joey Gouly
2021-04-16 11:51   ` Sami Mujawar
2021-04-15 12:17 ` Joey Gouly [this message]
2021-04-16 11:52   ` [PATCH v1 4/4] DynamicTablesPkg: Set the Access size for the DBG2 table Sami Mujawar
2021-04-19 14:37 ` [PATCH v1 0/4] DynamicTablesPkg: Add access size parameter for serial ports Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210415121720.11553-5-joey.gouly@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox