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
/** @file
  Phytium ACPI ASL Sources.
 
  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.<BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#include <IndustryStandard/IoRemappingTable.h>
#include <Platform.h>
 
#define FIELD_OFFSET(type, name)            __builtin_offsetof(type, name)
 
#pragma pack(1)
typedef struct {
  EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE        Node;
  UINT32                                    Identifiers[1];
} PHYTIUM_ITS_NODE;
 
typedef struct {
  EFI_ACPI_6_0_IO_REMAPPING_RC_NODE         Node;
  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE        RcIdMapping;
} PHYTIUM_RC_NODE;
 
typedef struct {
  EFI_ACPI_6_0_IO_REMAPPING_TABLE         Iort;
  PHYTIUM_ITS_NODE                        ItsNode;
  PHYTIUM_RC_NODE                         RcNode[1];
} PHYTIUM_IO_REMAPPING_STRUCTURE;
 
#define __PHYTIUM_ID_MAPPING(In, Num, Out, Ref, Flags)      \
  {                                                         \
    In,                                                     \
    Num,                                                    \
    Out,                                                    \
    FIELD_OFFSET (PHYTIUM_IO_REMAPPING_STRUCTURE, Ref),     \
    Flags                                                   \
  }
 
STATIC PHYTIUM_IO_REMAPPING_STRUCTURE Iort = {
  {
    PHYTIUM_ACPI_HEADER (EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE,
                  PHYTIUM_IO_REMAPPING_STRUCTURE,
                  EFI_ACPI_IO_REMAPPING_TABLE_REVISION),
    2,                                              // NumNodes
    sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),       // NodeOffset
    0                                               // Reserved
  }, {
    // ItsNode
    {
      {
        EFI_ACPI_IORT_TYPE_ITS_GROUP,                       // Type
        sizeof (PHYTIUM_ITS_NODE),                          // Length
        0x0,                                                // Revision
        0x0,                                                // Reserved
        0x0,                                                // NumIdMappings
        0x0,                                                // IdReference
      },
      1,
    }, {
      0x0
    },
  }, {
    {
      // PciRcNode
      {
        {
          EFI_ACPI_IORT_TYPE_ROOT_COMPLEX,                    // Type
          sizeof (PHYTIUM_RC_NODE),                           // Length
          0x0,                                                // Revision
          0x0,                                                // Reserved
          0x1,                                                // NumIdMappings
          FIELD_OFFSET (PHYTIUM_RC_NODE, RcIdMapping),        // IdReference
        },
        EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA,                    // CacheCoherent
        0x0,                                                  // AllocationHints
        0x0,                                                  // Reserved
        EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM,                   // MemoryAccessFlags
        EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED,           // AtsAttribute
        0x0,                                                  // PciSegmentNumber
      },
      __PHYTIUM_ID_MAPPING (0x0, 0xffff, 0x0, ItsNode, 0),
    }
  }
};
#pragma pack()
#
VOID * CONST ReferenceAcpiTable = &Iort;