]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
DynamicTablesPkg: Set the Access size for the SPCR table
authorJoey Gouly <joey.gouly@arm.com>
Thu, 15 Apr 2021 12:17:19 +0000 (13:17 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 19 Apr 2021 13:28:26 +0000 (13:28 +0000)
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@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c

index 24bb5c014607b0746c4a8bb8bd260510fbdff08b..fecfd6bbabd63698f5f45f6bfbd494f25cf0faeb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SPCR Table Generator\r
 \r
-  Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -313,6 +313,26 @@ BuildSpcrTableEx (
   // Update the base address\r
   AcpiSpcr.BaseAddress.Address = SerialPortInfo->BaseAddress;\r
 \r
+  // Set the access size\r
+  if (SerialPortInfo->AccessSize >= EFI_ACPI_6_3_QWORD) {\r
+    Status = EFI_INVALID_PARAMETER;\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
+      "ERROR: SPCR: Access size must be <= 3 (DWORD). Status = %r\n",\r
+      Status\r
+      ));\r
+    goto error_handler;\r
+  } else if (SerialPortInfo->AccessSize == EFI_ACPI_6_3_UNDEFINED) {\r
+    // 0 Undefined (legacy reasons)\r
+    // Default to DWORD access size as the access\r
+    // size field was introduced at a later date\r
+    // and some ConfigurationManager implementations\r
+    // may not be providing this field data\r
+    AcpiSpcr.BaseAddress.AccessSize = EFI_ACPI_6_3_DWORD;\r
+  } else {\r
+    AcpiSpcr.BaseAddress.AccessSize = SerialPortInfo->AccessSize;\r
+  }\r
+\r
   // Update the UART interrupt\r
   AcpiSpcr.GlobalSystemInterrupt = SerialPortInfo->Interrupt;\r
 \r