diff mbox series

[Linaro-uefi,linaro-uefi,v1,11/32] Hisilicon D05: add dbg2 table

Message ID 1505829398-52214-12-git-send-email-heyi.guo@linaro.org
State New
Headers show
Series Update D03/D05 binary for edk update and fix some error. | expand

Commit Message

gary guo Sept. 19, 2017, 1:56 p.m. UTC
From: Chenhui Sun <sunchenhui@huawei.com>

Change-Id: Icf98e5cbf43c837e634fb37407da179d060be692
Signed-off-by: Chenhui Sun <sunchenhui@huawei.com>
---
 .../Hi1616/D05AcpiTables/AcpiTablesHi1616.inf      |  2 +
 Chips/Hisilicon/Hi1616/D05AcpiTables/Dbg2.aslc     | 86 ++++++++++++++++++++++
 Platforms/Hisilicon/D05/D05.dsc                    |  2 +
 3 files changed, 90 insertions(+)
 create mode 100644 Chips/Hisilicon/Hi1616/D05AcpiTables/Dbg2.aslc
diff mbox series

Patch

diff --git a/Chips/Hisilicon/Hi1616/D05AcpiTables/AcpiTablesHi1616.inf b/Chips/Hisilicon/Hi1616/D05AcpiTables/AcpiTablesHi1616.inf
index 5e8f14d..9876a50 100644
--- a/Chips/Hisilicon/Hi1616/D05AcpiTables/AcpiTablesHi1616.inf
+++ b/Chips/Hisilicon/Hi1616/D05AcpiTables/AcpiTablesHi1616.inf
@@ -36,6 +36,7 @@ 
   D05Slit.aslc
   D05Srat.aslc
   D05Spcr.aslc
+  Dbg2.aslc
 
 [Packages]
   ArmPkg/ArmPkg.dec
@@ -55,5 +56,6 @@ 
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
 
diff --git a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dbg2.aslc b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dbg2.aslc
new file mode 100644
index 0000000..fb55a07
--- /dev/null
+++ b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dbg2.aslc
@@ -0,0 +1,86 @@ 
+/*
+ * Copyright (c) 2017 Linaro Limited
+ * Copyright (c) 2017 Hisilicon Limited
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the BSD License which accompanies
+ * this distribution, and is available at
+ * http://opensource.org/licenses/bsd-license.php
+ *
+*/
+
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/DebugPort2Table.h>
+#include <Library/AcpiLib.h>
+#include <Library/PcdLib.h>
+#include "Hi1616Platform.h"
+
+#define NUMBER_DEBUG_DEVICE_INFO    1
+#define NUMBER_OF_GENERIC_ADDRESS   1
+#define NAMESPACE_STRING_SIZE       8
+#define UART_LENGTH                 0x1000
+
+#pragma pack(1)
+
+typedef struct {
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT DdiHeader;
+  EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE Address[NUMBER_OF_GENERIC_ADDRESS];
+  UINT32 AddressSize[NUMBER_OF_GENERIC_ADDRESS];
+  CHAR8  NamespaceString[NAMESPACE_STRING_SIZE];
+} EFI_ACPI_DBG2_DDI_STRUCT;
+
+typedef struct {
+  EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Desc;
+  EFI_ACPI_DBG2_DDI_STRUCT Ddi[NUMBER_DEBUG_DEVICE_INFO];
+} EFI_ACPI_DEBUG_PORT_2_TABLE;
+
+#pragma pack()
+
+EFI_ACPI_DEBUG_PORT_2_TABLE Dbg2 = {
+  {
+    ARM_ACPI_HEADER(
+      EFI_ACPI_6_1_DEBUG_PORT_2_TABLE_SIGNATURE,
+      EFI_ACPI_DEBUG_PORT_2_TABLE,
+      EFI_ACPI_DEBUG_PORT_2_TABLE_REVISION
+      ),
+    OFFSET_OF(EFI_ACPI_DEBUG_PORT_2_TABLE, Ddi),
+    NUMBER_DEBUG_DEVICE_INFO
+  },
+  {
+    {
+      {
+        EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
+        sizeof(EFI_ACPI_DBG2_DDI_STRUCT),
+        NUMBER_OF_GENERIC_ADDRESS,
+        NAMESPACE_STRING_SIZE,
+        OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, NamespaceString),
+        0,  //OemDataLength
+        0,  //OemDataOffset
+        EFI_ACPI_DBG2_PORT_TYPE_SERIAL,
+        EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550,
+        {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE},
+        OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, Address),
+        OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, AddressSize),
+      },
+      {
+        {
+          EFI_ACPI_6_1_SYSTEM_MEMORY,
+          32,
+          0,
+          EFI_ACPI_6_1_BYTE,
+          FixedPcdGet64 (PcdSerialDbgRegisterBase)
+        }
+      },
+      {
+        UART_LENGTH
+      },
+      "COM1"
+    }
+  }
+};
+
+//
+// Reference the table being generated to prevent the optimizer from removing the
+// data structure from the executable
+//
+VOID* CONST ReferenceAcpiTable = &Dbg2;
diff --git a/Platforms/Hisilicon/D05/D05.dsc b/Platforms/Hisilicon/D05/D05.dsc
index ffa1897..8191459 100644
--- a/Platforms/Hisilicon/D05/D05.dsc
+++ b/Platforms/Hisilicon/D05/D05.dsc
@@ -179,6 +179,8 @@ 
   # use the TTY terminal type (which has a working backspace)
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
 
+  ## Serial Debug UART
+  gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0xD00C0000
 
   gHisiTokenSpaceGuid.PcdM3SmmuBaseAddress|0xa0040000
   gHisiTokenSpaceGuid.PcdPcieSmmuBaseAddress|0xb0040000