hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
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
/** @file
*  Generic Timer Description Table (GTDT)
*
*  Copyright (c) 2018, Linaro Limited. All rights reserved.
*  Copyright (c) 2012 - 2016, ARM Limited. All rights reserved.
*
*  SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
 
#include <IndustryStandard/Acpi.h>
#include <Library/AcpiLib.h>
#include <Library/PcdLib.h>
 
#include "AcpiTables.h"
 
#define RPI_GTDT_GLOBAL_FLAGS           0
#define RPI_GTDT_GTIMER_FLAGS           EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
 
#pragma pack (1)
 
typedef struct {
  EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
} EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES;
 
#pragma pack ()
 
EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt = {
  {
    ACPI_HEADER(
      EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
      EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES,
      EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
    ),
    RPI_SYSTEM_TIMER_BASE_ADDRESS,                // UINT64  PhysicalAddress
    0,                                            // UINT32  Reserved
    FixedPcdGet32 (PcdArmArchTimerSecIntrNum),    // UINT32  SecurePL1TimerGSIV
    RPI_GTDT_GTIMER_FLAGS,                        // UINT32  SecurePL1TimerFlags
    FixedPcdGet32 (PcdArmArchTimerIntrNum),       // UINT32  NonSecurePL1TimerGSIV
    RPI_GTDT_GTIMER_FLAGS,                        // UINT32  NonSecurePL1TimerFlags
    FixedPcdGet32 (PcdArmArchTimerVirtIntrNum),   // UINT32  VirtualTimerGSIV
    RPI_GTDT_GTIMER_FLAGS,                        // UINT32  VirtualTimerFlags
    FixedPcdGet32 (PcdArmArchTimerHypIntrNum),    // UINT32  NonSecurePL2TimerGSIV
    RPI_GTDT_GTIMER_FLAGS,                        // UINT32  NonSecurePL2TimerFlags
    0xFFFFFFFFFFFFFFFF,                           // UINT64  CntReadBasePhysicalAddress
    0,                                            // UINT32  PlatformTimerCount
    0                                             // UINT32 PlatfromTimerOffset
  },
};
 
//
// Reference the table being generated to prevent the optimizer
// from removing the data structure from the executable
//
VOID* CONST ReferenceAcpiTable = &Gtdt;