summaryrefslogtreecommitdiff
path: root/Silicon/Hisilicon/Pv660/Pv660AcpiTables/Dbg2.aslc
blob: 3a8313adfd721fd6e1ceab8de09c2818a2ddb7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/** @file
*  Debug Port Table 2 (DBG2)
*
*  Copyright (c) 2012 - 2014, Linaro Limited. All rights reserved.
*  Copyright (c) 2015, Hisilicon Limited. All rights reserved.
*  Copyright (c) 2015, Linaro Limited. All rights reserved.
*
*  This program and the accompanying materials
*  are licensed and made available under the terms and conditions of the BSD License
*  which accompanies this distribution.  The full text of the license may be found at
*  http://opensource.org/licenses/bsd-license.php
*
*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*
*  Based on the files under ArmPlatformPkg/ArmJunoPkg/AcpiTables/
*
**/

#include "Pv660Platform.h"

#include <Library/AcpiLib.h>
#include <Library/PcdLib.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/DebugPort2Table.h>

#define NUMBER_DEBUG_DEVICE_INFO    1
#define NUMBER_OF_GENERIC_ADDRESS   1
#define NAMESPACE_STRING_SIZE       8

#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(PcdSerialRegisterBase)
        }
      },
      {
        0x1000
      },
      "COM0"
    }
  }
};

//
// Reference the table being generated to prevent the optimizer from removing the
// data structure from the executable
//
VOID* CONST ReferenceAcpiTable = &Dbg2;