]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: Serial debug port initialisation
authorSami Mujawar <sami.mujawar@arm.com>
Tue, 9 Jul 2019 15:18:27 +0000 (16:18 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 29 Mar 2020 16:53:35 +0000 (16:53 +0000)
The ARM DCC serial port subtype is an option that is
supported by the DBG2 generator. However, the serial
port initialisation should only be done for PL011/SBSA
compatible UARTs.

Add check to conditionally initialise the serial port.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c

index 346ab5b22f5402bf87c385558f68f080d1b454ed..51c843d25f75388104694855ce133b3d61860196 100644 (file)
@@ -175,7 +175,7 @@ GET_OBJECT_LIST (
   CM_ARM_SERIAL_PORT_INFO\r
   );\r
 \r
-/** Initialize the PL011 UART with the parameters obtained from\r
+/** Initialize the PL011/SBSA UART with the parameters obtained from\r
     the Configuration Manager.\r
 \r
   @param [in]  SerialPortInfo Pointer to the Serial Port Information.\r
@@ -353,15 +353,22 @@ BuildDbg2Table (
   AcpiDbg2.Dbg2DeviceInfo[DBG_PORT_INDEX_PORT1].Dbg2Device.PortSubtype =\r
     SerialPortInfo->PortSubtype;\r
 \r
-  // Initialize the serial port\r
-  Status = SetupDebugUart (SerialPortInfo);\r
-  if (EFI_ERROR (Status)) {\r
-    DEBUG ((\r
-      DEBUG_ERROR,\r
-      "ERROR: DBG2: Failed to configure debug serial port. Status = %r\n",\r
-      Status\r
-      ));\r
-    goto error_handler;\r
+  if ((SerialPortInfo->PortSubtype ==\r
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART)           ||\r
+      (SerialPortInfo->PortSubtype ==\r
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART_2X) ||\r
+      (SerialPortInfo->PortSubtype ==\r
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART)) {\r
+    // Initialize the serial port\r
+    Status = SetupDebugUart (SerialPortInfo);\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "ERROR: DBG2: Failed to configure debug serial port. Status = %r\n",\r
+        Status\r
+        ));\r
+      goto error_handler;\r
+    }\r
   }\r
 \r
   *Table = (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2;\r