]>
Commit | Line | Data |
---|---|---|
3399d5be OM |
1 | /** @file\r |
2 | * Generic Timer Description Table (GTDT)\r | |
3 | *\r | |
4 | * Copyright (c) 2012 - 2014, ARM Limited. All rights reserved.\r | |
5 | *\r | |
6 | * This program and the accompanying materials\r | |
7 | * are licensed and made available under the terms and conditions of the BSD License\r | |
8 | * which accompanies this distribution. The full text of the license may be found at\r | |
9 | * http://opensource.org/licenses/bsd-license.php\r | |
10 | *\r | |
11 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | *\r | |
14 | **/\r | |
15 | \r | |
16 | #include "ArmPlatform.h"\r | |
17 | #include <Library/AcpiLib.h>\r | |
18 | #include <Library/PcdLib.h>\r | |
19 | #include <IndustryStandard/Acpi.h>\r | |
20 | \r | |
21 | #define GTDT_GLOBAL_FLAGS_MAPPED EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_MEMORY_MAPPED_BLOCK_PRESENT\r | |
22 | #define GTDT_GLOBAL_FLAGS_NOT_MAPPED 0\r | |
23 | #define GTDT_GLOBAL_FLAGS_EDGE EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_INTERRUPT_MODE\r | |
24 | #define GTDT_GLOBAL_FLAGS_LEVEL 0\r | |
25 | \r | |
26 | // Note: We could have a build flag that switches between memory mapped/non-memory mapped timer\r | |
27 | #ifdef SYSTEM_TIMER_BASE_ADDRESS\r | |
28 | #define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL)\r | |
29 | #else\r | |
30 | #define GTDT_GLOBAL_FLAGS (GTDT_GLOBAL_FLAGS_NOT_MAPPED | GTDT_GLOBAL_FLAGS_LEVEL)\r | |
31 | #define SYSTEM_TIMER_BASE_ADDRESS 0\r | |
32 | #endif\r | |
33 | \r | |
34 | #define GTDT_TIMER_EDGE_TRIGGERED (1 << EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE)\r | |
35 | #define GTDT_TIMER_LEVEL_TRIGGERED (0 << EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE)\r | |
36 | #define GTDT_TIMER_ACTIVE_LOW (1 << EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY)\r | |
37 | #define GTDT_TIMER_ACTIVE_HIGH (0 << EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY)\r | |
38 | \r | |
39 | #define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)\r | |
40 | \r | |
41 | EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = {\r | |
42 | ARM_ACPI_HEADER(\r | |
43 | EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,\r | |
44 | EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE,\r | |
45 | EFI_ACPI_5_0_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION\r | |
46 | ),\r | |
47 | SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress\r | |
48 | GTDT_GLOBAL_FLAGS, // UINT32 GlobalFlags\r | |
49 | FixedPcdGet32 (PcdArmArchTimerSecIntrNum), // UINT32 SecurePL1TimerGSIV\r | |
50 | GTDT_GTIMER_FLAGS, // UINT32 SecurePL1TimerFlags\r | |
51 | FixedPcdGet32 (PcdArmArchTimerIntrNum), // UINT32 NonSecurePL1TimerGSIV\r | |
52 | GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL1TimerFlags\r | |
53 | FixedPcdGet32 (PcdArmArchTimerVirtIntrNum), // UINT32 VirtualTimerGSIV\r | |
54 | GTDT_GTIMER_FLAGS, // UINT32 VirtualTimerFlags\r | |
55 | FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV\r | |
56 | GTDT_GTIMER_FLAGS // UINT32 NonSecurePL2TimerFlags\r | |
57 | };\r | |
58 | \r | |
59 | \r | |
60 | VOID*\r | |
61 | ReferenceAcpiTable (\r | |
62 | VOID\r | |
63 | )\r | |
64 | {\r | |
65 | //\r | |
66 | // Reference the table being generated to prevent the optimizer from removing the\r | |
67 | // data structure from the exeutable\r | |
68 | //\r | |
69 | return (VOID*)&Gtdt;\r | |
70 | }\r |