Home | History | Annotate | Download | only in Pv660AcpiTables
      1 /** @file
      2 *  Debug Port Table 2 (DBG2)
      3 *
      4 *  Copyright (c) 2012 - 2014, Linaro Limited. All rights reserved.
      5 *  Copyright (c) 2015, Hisilicon Limited. All rights reserved.
      6 *  Copyright (c) 2015, Linaro Limited. All rights reserved.
      7 *
      8 *  This program and the accompanying materials
      9 *  are licensed and made available under the terms and conditions of the BSD License
     10 *  which accompanies this distribution.  The full text of the license may be found at
     11 *  http://opensource.org/licenses/bsd-license.php
     12 *
     13 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 *
     16 *  Based on the files under ArmPlatformPkg/ArmJunoPkg/AcpiTables/
     17 *
     18 **/
     19 
     20 #include "Pv660Platform.h"
     21 
     22 #include <Library/AcpiLib.h>
     23 #include <Library/PcdLib.h>
     24 #include <IndustryStandard/Acpi.h>
     25 #include <IndustryStandard/DebugPort2Table.h>
     26 
     27 #define NUMBER_DEBUG_DEVICE_INFO    1
     28 #define NUMBER_OF_GENERIC_ADDRESS   1
     29 #define NAMESPACE_STRING_SIZE       8
     30 
     31 #pragma pack(1)
     32 
     33 typedef struct {
     34   EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT DdiHeader;
     35   EFI_ACPI_6_0_GENERIC_ADDRESS_STRUCTURE Address[NUMBER_OF_GENERIC_ADDRESS];
     36   UINT32 AddressSize[NUMBER_OF_GENERIC_ADDRESS];
     37   CHAR8  NamespaceString[NAMESPACE_STRING_SIZE];
     38 } EFI_ACPI_DBG2_DDI_STRUCT;
     39 
     40 typedef struct {
     41   EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Desc;
     42   EFI_ACPI_DBG2_DDI_STRUCT Ddi[NUMBER_DEBUG_DEVICE_INFO];
     43 } EFI_ACPI_DEBUG_PORT_2_TABLE;
     44 
     45 #pragma pack()
     46 
     47 EFI_ACPI_DEBUG_PORT_2_TABLE Dbg2 = {
     48   {
     49     ARM_ACPI_HEADER(
     50       EFI_ACPI_5_1_DEBUG_PORT_2_TABLE_SIGNATURE,
     51       EFI_ACPI_DEBUG_PORT_2_TABLE,
     52       EFI_ACPI_DEBUG_PORT_2_TABLE_REVISION
     53       ),
     54     OFFSET_OF(EFI_ACPI_DEBUG_PORT_2_TABLE, Ddi),
     55     NUMBER_DEBUG_DEVICE_INFO
     56   },
     57   {
     58     {
     59       {
     60         EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
     61         sizeof(EFI_ACPI_DBG2_DDI_STRUCT),
     62         NUMBER_OF_GENERIC_ADDRESS,
     63         NAMESPACE_STRING_SIZE,
     64         OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, NamespaceString),
     65         0,  //OemDataLength
     66         0,  //OemDataOffset
     67         EFI_ACPI_DBG2_PORT_TYPE_SERIAL,
     68         EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550,
     69         {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE},
     70         OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, Address),
     71         OFFSET_OF(EFI_ACPI_DBG2_DDI_STRUCT, AddressSize),
     72       },
     73       {
     74         {
     75           EFI_ACPI_6_0_SYSTEM_MEMORY,
     76           32,
     77           0,
     78           EFI_ACPI_6_0_BYTE,
     79           FixedPcdGet64(PcdSerialRegisterBase)
     80         }
     81       },
     82       {
     83         0x1000
     84       },
     85       "COM0"
     86     }
     87   }
     88 };
     89 
     90 //
     91 // Reference the table being generated to prevent the optimizer from removing the
     92 // data structure from the executable
     93 //
     94 VOID* CONST ReferenceAcpiTable = &Dbg2;
     95