hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/** @file
*  I/O Remapping Table (Iort)
*
*  Copyright (c) 2018, ARM Ltd. All rights reserved.
*
*  SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
 
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/Acpi62.h>
#include <IndustryStandard/IoRemappingTable.h>
#include "SgiAcpiHeader.h"
 
#pragma pack(1)
 
typedef struct
{
  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE       ItsNode;
  UINT32                                   ItsIdentifiers;
} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE;
 
typedef struct
{
  EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE     SmmuNode;
  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE       SmmuIdMap[2];
} ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;
 
typedef struct
{
  EFI_ACPI_6_0_IO_REMAPPING_RC_NODE        RcNode;
  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE       RcIdMap;
} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;
 
typedef struct
{
  EFI_ACPI_6_0_IO_REMAPPING_TABLE          Header;
  ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE   ItsNode;
  ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE SmmuNode;
  ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE    RcNode;
} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE;
 
#pragma pack ()
 
ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
{
  // EFI_ACPI_6_0_IO_REMAPPING_TABLE
  {
     ARM_ACPI_HEADER  // EFI_ACPI_DESCRIPTION_HEADER
     (
       EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE,
       ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,
       EFI_ACPI_IO_REMAPPING_TABLE_REVISION
     ),
     3,  // NumNodes
     sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),  // NodeOffset
     0,  // Reserved
  },
  // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
  {
    // EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE
    {
      // EFI_ACPI_6_0_IO_REMAPPING_NODE
      {
        EFI_ACPI_IORT_TYPE_ITS_GROUP,  // Type
        sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length
        0,  // Revision
        0,  // Reserved
        0,  // NumIdMappings
        0,  // IdReference
      },
      1,    // ITS count
    },
    0,      // GIC ITS Identifiers
  },
  // SMMU
  {
    // EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE
    {
      // EFI_ACPI_6_0_IO_REMAPPING_NODE
      {
        EFI_ACPI_IORT_TYPE_SMMUv3, // Type
        sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE), // Length
        2, // Revision
        0, // Reserved
        2, // NumIdMapping
        OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE, SmmuIdMap), // IdReference
      },
      0x4F000000, // Base address
      EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE, // Flags
      0,   // Reserved
      0,   // VATOS address
      EFI_ACPI_IORT_SMMUv3_MODEL_GENERIC, // SMMUv3 Model
      260, // Event
      0,   // Pri
      262, // Gerror
      261, // Sync
      0,   // Proximity domain
      1,   // DevIDMappingIndex
    },
    // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE
    {
      {
        0x0000, // InputBase
        0xffff, // NumIds
        0x0000, // OutputBase
        OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode), // OutputReference
        0, // Flags
      },
      {
        0x0,     // InputBase
        0x1,     // NumIds
        0x10000, // OutputBase
        OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode), // OutputReference
        EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE, // Flags
      },
    },
  },
  // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
  {
    // EFI_ACPI_6_0_IO_REMAPPING_RC_NODE
    {
      // EFI_ACPI_6_0_IO_REMAPPING_NODE
      {
        EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,  // Type
        sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE),  // Length
        0,  // Revision
        0,  // Reserved
        1,  // NumIdMappings
        OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, RcIdMap)  // IdReference
      },
      1,  // CacheCoherent
      0,  // AllocationHints
      0,  // Reserved
      0,  // MemoryAccessFlags
      EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED,    // AtsAttribute
      0x0,                                         // PciSegmentNumber
    },
    // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE
    {
      0x0000,  // InputBase
      0xffff,  // NumIds
      0x0000,  // OutputBase
      OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, SmmuNode),  // OutputReference
      0,       // Flags
    }
  }
};
 
VOID* CONST ReferenceAcpiTable = &Iort;