/** @file
|
* Generic Timer Description Table (GTDT)
|
*
|
* Copyright (c) 2012 - 2014, ARM Limited. All rights reserved.
|
* Copyright (c) 2015 - 2016, Hisilicon Limited. All rights reserved.
|
* Copyright (c) 2015 - 2016, Linaro Limited. All rights reserved.
|
*
|
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
*
|
* Based on the files under ArmPlatformPkg/ArmJunoPkg/AcpiTables/
|
*
|
**/
|
|
#include <IndustryStandard/Acpi.h>
|
#include <Library/AcpiLib.h>
|
#include <Library/PcdLib.h>
|
#include "Hi1616Platform.h"
|
|
#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE
|
#define GTDT_TIMER_LEVEL_TRIGGERED 0
|
#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
|
#define GTDT_TIMER_ACTIVE_HIGH 0
|
#define GTDT_TIMER_ALWAYS_ON_CAPABILITY EFI_ACPI_6_1_GTDT_TIMER_FLAG_ALWAYS_ON_CAPABILITY
|
|
#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ALWAYS_ON_CAPABILITY | GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)
|
|
// Generic watchdog address for SCCL (Super CPU cluster) A and SCCL B on Hi1616.
|
// Watchdogs on socket 1 are not mapped to SPI interrupts so we can't describe
|
// them in GTDT.
|
#define GENERIC_WATCHDOG_CONTROL_BASE_SCCL_A 0x40500000
|
#define GENERIC_WATCHDOG_REFRESH_BASE_SCCL_A 0x40600000
|
#define GENERIC_WATCHDOG_CONTROL_BASE_SCCL_B 0x60500000
|
#define GENERIC_WATCHDOG_REFRESH_BASE_SCCL_B 0x60600000
|
|
#pragma pack (1)
|
|
typedef struct {
|
EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
|
EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Watchdogs[HI1616_WATCHDOG_COUNT];
|
} EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLES;
|
|
#pragma pack ()
|
|
EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = {
|
{
|
ARM_ACPI_HEADER(
|
EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
|
EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLES,
|
EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
|
),
|
0xFFFFFFFFFFFFFFFF, // UINT64 CntControl Base PhysicalAddress
|
0, // UINT32 Reserved
|
FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV
|
GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags
|
FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV
|
GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags
|
FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV
|
GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags
|
FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV
|
GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags
|
0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress
|
HI1616_WATCHDOG_COUNT, // UINT32 PlatformTimerCount
|
sizeof (EFI_ACPI_6_1_GENERIC_TIMER_DESCRIPTION_TABLE) // UINT32 PlatfromTimerOffset
|
},
|
{
|
EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
|
GENERIC_WATCHDOG_REFRESH_BASE_SCCL_A, GENERIC_WATCHDOG_CONTROL_BASE_SCCL_A, 400, 0),
|
EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
|
GENERIC_WATCHDOG_REFRESH_BASE_SCCL_B, GENERIC_WATCHDOG_CONTROL_BASE_SCCL_B, 496, 0)
|
}
|
};
|
|
//
|
// Reference the table being generated to prevent the optimizer from removing the
|
// data structure from the executable
|
//
|
VOID* CONST ReferenceAcpiTable = &Gtdt;
|
|