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
/** @file
*  Static Resource Affinity Table (SRAT)
*
*  Copyright (c) 2020, ARM Limited. All rights reserved.
*
*  SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
 
#include "SgiAcpiHeader.h"
#include "SgiPlatform.h"
#include <IndustryStandard/Acpi.h>
#include <Library/AcpiLib.h>
#include <Library/ArmLib.h>
 
//
// Static Resource Affinity Table
//
#pragma pack (1)
 
typedef struct {
  EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER  Header;
  EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE              Memory[4];
  EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE                Gicc[16];
} EFI_ACPI_STATIC_RESOURCE_AFFINITY_TABLE;
 
#pragma pack ()
 
EFI_ACPI_STATIC_RESOURCE_AFFINITY_TABLE Srat = {
  // Header
  {
    ARM_ACPI_HEADER (
      EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE,
      EFI_ACPI_STATIC_RESOURCE_AFFINITY_TABLE,
      EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION
    ),
    0x00000001,
    EFI_ACPI_RESERVED_QWORD
  },
  // Memory Affinity
  {
    // Chip 0 (2GB and 6GB)
    EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE_INIT (
      0x0, FixedPcdGet64 (PcdSystemMemoryBase),
      FixedPcdGet64 (PcdSystemMemorySize), 0x00000001),
    EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE_INIT (
      0x0, FixedPcdGet64 (PcdDramBlock2Base),
      FixedPcdGet64 (PcdDramBlock2Size), 0x00000001),
 
    // Chip 1 (2GB and 6GB)
    EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE_INIT (
      0x1, SYSTEM_MEMORY_BASE_REMOTE(1),
      FixedPcdGet64 (PcdSystemMemorySize), 0x00000001),
    EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE_INIT (
      0x1, DRAM_BLOCK2_BASE_REMOTE(1),
      FixedPcdGet64 (PcdDramBlock2Size), 0x00000001),
  },
  // Processor Affinity
  {
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000000, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000001, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000002, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000003, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000004, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000005, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000006, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x0, 0x00000007, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x00000008, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x00000009, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000A, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000B, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000C, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000D, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000E, 0x00000001, 0x00000000),
    EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE_INIT (
      0x1, 0x0000000F, 0x00000001, 0x00000000),
  },
};
 
VOID* CONST ReferenceAcpiTable = &Srat;