• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** @file
2*  Multiple APIC Description Table (MADT)
3*
4*  Copyright (c) 2012 - 2015, ARM Limited. All rights reserved.
5*  Copyright (c) 2016 Linaro Ltd. All rights reserved.
6*
7*  This program and the accompanying materials
8*  are licensed and made available under the terms and conditions of the BSD License
9*  which accompanies this distribution.  The full text of the license may be found at
10*  http://opensource.org/licenses/bsd-license.php
11*
12*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14*
15**/
16
17#include "FvpPlatform.h"
18#include <Library/AcpiLib.h>
19#include <Library/ArmLib.h>
20#include <Library/PcdLib.h>
21#include <IndustryStandard/Acpi61.h>
22
23//
24// Multiple APIC Description Table
25//
26#pragma pack (1)
27
28typedef struct {
29  EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
30  EFI_ACPI_6_1_GIC_STRUCTURE                            GicInterfaces[8];
31  EFI_ACPI_6_1_GIC_DISTRIBUTOR_STRUCTURE                GicDistributor;
32  EFI_ACPI_6_1_GICR_STRUCTURE                           Gicr;
33} FVP_MULTIPLE_APIC_DESCRIPTION_TABLE;
34
35#pragma pack ()
36
37FVP_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
38  {
39    ARM_ACPI_HEADER (
40      EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
41      FVP_MULTIPLE_APIC_DESCRIPTION_TABLE,
42      EFI_ACPI_6_1_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION
43    ),
44    //
45    // MADT specific fields
46    //
47    0, // LocalApicAddress
48    0, // Flags
49  },
50  {
51    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
52        0, 0, GET_MPID(0, 0), EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
53        0x2C02F000, 0x2C010000, 0x19, 0, 0),
54    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
55        1, 1, GET_MPID(0, 1),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
56        0x2C02F000, 0x2C010000, 0x19, 0, 0),
57    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
58        2, 2, GET_MPID(0, 2),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
59        0x2C02F000, 0x2C010000, 0x19, 0, 0),
60    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
61        3, 3, GET_MPID(0, 3),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
62        0x2C02F000, 0x2C010000, 0x19, 0, 0),
63    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
64        4, 4, GET_MPID(1, 0),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
65        0x2C02F000, 0x2C010000, 0x19, 0, 0),
66    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
67        5, 5, GET_MPID(1, 1),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
68        0x2C02F000, 0x2C010000, 0x19, 0, 0),
69    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
70        6, 6, GET_MPID(1, 2),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
71        0x2C02F000, 0x2C010000, 0x19, 0, 0),
72    EFI_ACPI_6_0_GICC_STRUCTURE_INIT(
73        7, 7, GET_MPID(1, 3),  EFI_ACPI_6_0_GIC_ENABLED, 0, FixedPcdGet64 (PcdGicInterruptInterfaceBase),
74        0x2C02F000, 0x2C010000, 0x19, 0, 0),
75  },
76  EFI_ACPI_6_0_GIC_DISTRIBUTOR_INIT(0, FixedPcdGet64 (PcdGicDistributorBase), 0, 3),
77  /* GIC Redistributor */
78  {
79    EFI_ACPI_6_1_GICR,                         // UINT8 Type
80    sizeof(EFI_ACPI_6_1_GICR_STRUCTURE),       // UINT8 Length
81    EFI_ACPI_RESERVED_WORD,                    // UINT16 Reserved
82    FixedPcdGet64 (PcdGicRedistributorsBase),  // UINT64 DiscoveryRangeBaseAddress
83    0x00200000,                                // UINT32 DiscoveryRangeLength
84  }
85};
86
87//
88// Reference the table being generated to prevent the optimizer from removing the
89// data structure from the executable
90//
91VOID* CONST ReferenceAcpiTable = &Madt;
92