[edk2-devel] [PATCH v1 3/4] DynamicTablesPkg: Set the Access size for the SPCR table

Joey Gouly joey.gouly at arm.com
Thu Apr 15 12:17:19 UTC 2021


The SPCR 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 SPCR generator to setup the AccessSize
field in the Generic Address Structure (GAS) for the UART in
the SPCR table with information provided by the platform.

Signed-off-by: Joey Gouly <joey.gouly at arm.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 22 +++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 24bb5c014607b0746c4a8bb8bd260510fbdff08b..fecfd6bbabd63698f5f45f6bfbd494f25cf0faeb 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -1,7 +1,7 @@
 /** @file
   SPCR 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
 
@@ -313,6 +313,26 @@ BuildSpcrTableEx (
   // Update the base address
   AcpiSpcr.BaseAddress.Address = SerialPortInfo->BaseAddress;
 
+  // Set the access size
+  if (SerialPortInfo->AccessSize >= EFI_ACPI_6_3_QWORD) {
+    Status = EFI_INVALID_PARAMETER;
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: SPCR: 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
+    AcpiSpcr.BaseAddress.AccessSize = EFI_ACPI_6_3_DWORD;
+  } else {
+    AcpiSpcr.BaseAddress.AccessSize = SerialPortInfo->AccessSize;
+  }
+
   // Update the UART interrupt
   AcpiSpcr.GlobalSystemInterrupt = SerialPortInfo->Interrupt;
 
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74128): https://edk2.groups.io/g/devel/message/74128
Mute This Topic: https://groups.io/mt/82115120/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list