]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/ArmJunoPkg/AcpiTables/Madt.aslc
ArmPlatformPkg/ArmJunoPkg/AcpiTables: Updated with new ACPI 5.1 Tables & Definitions
[mirror_edk2.git] / ArmPlatformPkg / ArmJunoPkg / AcpiTables / Madt.aslc
1 /** @file
2 * Multiple APIC Description Table (MADT)
3 *
4 * Copyright (c) 2012 - 2015, ARM Limited. All rights reserved.
5 *
6 * This program and the accompanying materials
7 * are licensed and made available under the terms and conditions of the BSD License
8 * which accompanies this distribution. The full text of the license may be found at
9 * http://opensource.org/licenses/bsd-license.php
10 *
11 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 *
14 **/
15
16 #include "ArmPlatform.h"
17 #include <Library/AcpiLib.h>
18 #include <Library/ArmLib.h>
19 #include <Library/PcdLib.h>
20 #include <IndustryStandard/Acpi.h>
21
22 //
23 // Multiple APIC Description Table
24 //
25 #ifdef ARM_JUNO_ACPI_5_0
26 #pragma pack (1)
27
28 typedef struct {
29 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
30 EFI_ACPI_5_0_GIC_STRUCTURE GicInterfaces[FixedPcdGet32 (PcdCoreCount)];
31 EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
32 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
33
34 #pragma pack ()
35
36 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
37 {
38 ARM_ACPI_HEADER (
39 EFI_ACPI_1_0_APIC_SIGNATURE,
40 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE,
41 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
42 ),
43 //
44 // MADT specific fields
45 //
46 0, // LocalApicAddress
47 0, // Flags
48 },
49 {
50 // Format: EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase)
51 // Note: The GIC Structure of the primary CPU must be the first entry (see note in 5.2.12.14 GIC Structure of
52 // ACPI v5.0).
53 // On Juno we can change the primary CPU changing the SCC register. It is not currently supported in the
54 // Trusted Firmware. When supported, we will need to code to dynamically change the ordering.
55 // For now we leave CPU2 (A53-0) at the first position.
56 // The cores from a same cluster are kept together. It is not an ACPI requirement but in case the OSPM uses
57 // the ACPI ARM Parking protocol, it might want to wake up the cores in the order of this table.
58 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(2, 0, EFI_ACPI_5_0_GIC_ENABLED, 50, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-0
59 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(3, 1, EFI_ACPI_5_0_GIC_ENABLED, 54, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-1
60 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(4, 2, EFI_ACPI_5_0_GIC_ENABLED, 58, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-2
61 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(5, 3, EFI_ACPI_5_0_GIC_ENABLED, 62, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A53-3
62 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(0, 4, EFI_ACPI_5_0_GIC_ENABLED, 34, FixedPcdGet32 (PcdGicInterruptInterfaceBase)), // A57-0
63 EFI_ACPI_5_0_GIC_STRUCTURE_INIT(1, 5, EFI_ACPI_5_0_GIC_ENABLED, 38, FixedPcdGet32 (PcdGicInterruptInterfaceBase)) // A57-1
64 },
65 EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet32 (PcdGicDistributorBase), 0)
66 };
67 #else
68 #pragma pack (1)
69
70 typedef struct {
71 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
72 EFI_ACPI_5_1_GIC_STRUCTURE GicInterfaces[FixedPcdGet32 (PcdCoreCount)];
73 EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE GicDistributor;
74 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
75
76 #pragma pack ()
77
78 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
79 {
80 ARM_ACPI_HEADER (
81 EFI_ACPI_1_0_APIC_SIGNATURE,
82 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE,
83 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
84 ),
85 //
86 // MADT specific fields
87 //
88 0, // LocalApicAddress
89 0, // Flags
90 },
91 {
92 // Format: EFI_ACPI_5_1_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Flags, PmuIrq, GicBase, GicVBase, GicHBase,
93 // GsivId, GicRBase, Mpidr)
94 // Note: The GIC Structure of the primary CPU must be the first entry (see note in 5.2.12.14 GICC Structure of
95 // ACPI v5.1).
96 // On Juno we can change the primary CPU changing the SCC register. It is not currently supported in the
97 // Trusted Firmware. When supported, we will need to code to dynamically change the ordering.
98 // For now we leave CPU2 (A53-0) at the first position.
99 // The cores from a same cluster are kept together. It is not an ACPI requirement but in case the OSPM uses
100 // the ACPI ARM Parking protocol, it might want to wake up the cores in the order of this table.
101 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-0
102 2, 0, GET_MPID(1, 0), EFI_ACPI_5_0_GIC_ENABLED, 50, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
103 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
104 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-1
105 3, 1, GET_MPID(1, 1), EFI_ACPI_5_0_GIC_ENABLED, 54, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
106 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
107 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-2
108 4, 2, GET_MPID(1, 2), EFI_ACPI_5_0_GIC_ENABLED, 58, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
109 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
110 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A53-3
111 5, 3, GET_MPID(1, 3), EFI_ACPI_5_0_GIC_ENABLED, 62, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
112 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
113 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A57-0
114 0, 4, GET_MPID(0, 0), EFI_ACPI_5_0_GIC_ENABLED, 34, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
115 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
116 EFI_ACPI_5_1_GICC_STRUCTURE_INIT( // A57-1
117 1, 5, GET_MPID(0, 1), EFI_ACPI_5_0_GIC_ENABLED, 38, FixedPcdGet32 (PcdGicInterruptInterfaceBase),
118 0x2C06F000, 0x2C04F000, 25, 0 /* GicRBase */),
119 },
120 EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet32 (PcdGicDistributorBase), 0)
121 };
122 #endif
123
124 VOID*
125 ReferenceAcpiTable (
126 VOID
127 )
128 {
129 //
130 // Reference the table being generated to prevent the optimizer from removing the
131 // data structure from the executable
132 //
133 return (VOID*)&Madt;
134 }