]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
DynamicTablesPkg: Set the Access size for the DBG2 table
[mirror_edk2.git] / DynamicTablesPkg / Library / Acpi / Arm / AcpiDbg2LibArm / Dbg2Generator.c
index d902bbc8463921624f1a6333e8d6bd84c6cb38f2..a7508d4a8834fd2038946a62de39e9cd0894bf79 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   DBG2 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
@@ -420,6 +420,28 @@ BuildDbg2TableEx (
   AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.Address =\r
     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: DBG2: 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
+    AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.AccessSize =\r
+      EFI_ACPI_6_3_DWORD;\r
+  } else {\r
+    AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].BaseAddressRegister.AccessSize =\r
+      SerialPortInfo->AccessSize;\r
+  }\r
+\r
   // Update the serial port subtype\r
   AcpiDbg2.Dbg2DeviceInfo[INDEX_DBG_PORT0].Dbg2Device.PortSubtype =\r
     SerialPortInfo->PortSubtype;\r