[edk2-devel] [PATCH v3 edk2-platforms 8/8] SbsaQemu: AcpiTables: Add DBG2 Table

Tanmay Jagdale tanmay.jagdale at linaro.org
Tue Aug 25 13:39:58 UTC 2020


Signed-off-by: Tanmay Jagdale <tanmay.jagdale at linaro.org>
---
 Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf |  1 +
 Silicon/Qemu/SbsaQemu/AcpiTables/Dbg2.aslc      | 67 ++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
index 57d717fefafc..7216a53304df 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
@@ -16,6 +16,7 @@ [Defines]
   VERSION_STRING                 = 1.0
 
 [Sources]
+  Dbg2.aslc
   Dsdt.asl
   Fadt.aslc
   Gtdt.aslc
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dbg2.aslc b/Silicon/Qemu/SbsaQemu/AcpiTables/Dbg2.aslc
new file mode 100644
index 000000000000..c9e3ca77ab53
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dbg2.aslc
@@ -0,0 +1,67 @@
+/** @file
+*  Debug Port Table (DBG2)
+*
+*  Copyright (c) 2020 Linaro Ltd. All rights reserved.
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+*
+**/
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/DebugPort2Table.h>
+#include <IndustryStandard/SbsaQemuAcpi.h>
+#include <Library/AcpiLib.h>
+#include <Library/PcdLib.h>
+
+#pragma pack(1)
+
+#define SBSAQEMU_UART_STR { '\\', '_', 'S', 'B', '.', 'C', 'O', 'M', '0', 0x00 }
+
+typedef struct {
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
+  EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE        BaseAddressRegister;
+  UINT32                                        AddressSize;
+  UINT8                                         NameSpaceString[10];
+} DBG2_DEBUG_DEVICE_INFORMATION;
+
+typedef struct {
+  EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE       Description;
+  DBG2_DEBUG_DEVICE_INFORMATION                 Dbg2DeviceInfo;
+} DBG2_TABLE;
+
+
+STATIC DBG2_TABLE Dbg2 = {
+  {
+    SBSAQEMU_ACPI_HEADER (
+      EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
+      DBG2_TABLE,
+      EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
+    ),
+    OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo),
+    1                                      /* NumberOfDebugPorts */
+  },
+  {
+    {
+      EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
+      sizeof (DBG2_DEBUG_DEVICE_INFORMATION),
+      1,                                   /* NumberofGenericAddressRegisters */
+      10,                                  /* NameSpaceStringLength */
+      OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString),
+      0,                                   /* OemDataLength */
+      0,                                   /* OemDataOffset */
+      EFI_ACPI_DBG2_PORT_TYPE_SERIAL,
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART,
+      {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE},
+      OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister),
+      OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize)
+    },
+    ARM_GAS32 (SBSAQEMU_UART0_BASE),         /* BaseAddressRegister */
+    0x1000,                                  /* AddressSize */
+    SBSAQEMU_UART_STR,                       /* NameSpaceString */
+  }
+};
+
+#pragma pack()
+
+// Reference the table being generated to prevent the optimizer from removing
+// the data structure from the executable
+VOID* CONST ReferenceAcpiTable = &Dbg2;
-- 
2.28.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64619): https://edk2.groups.io/g/devel/message/64619
Mute This Topic: https://groups.io/mt/76406701/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