summaryrefslogtreecommitdiff
path: root/ArmPkg/Drivers/AcpiTables/foundation-v8/Srat.aslc
blob: d5c433ffce39f40ef969f58f92204c96473ee170 (plain)
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
/*
 * Copyright (c) 2013 Linaro Limited
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the BSD License which accompanies
 * this distribution, and is available at
 * http://opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     Yi Li - yi.li@linaro.org
*/

#include <IndustryStandard/Acpi.h>
#include <Platform.h>


//
// Define the number of each table type.
// This is where the table layout is modified.
//
#define EFI_ACPI_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE_COUNT  4
#define EFI_ACPI_MEMORY_AFFINITY_STRUCTURE_COUNT                      4  


#pragma pack(1)
typedef struct {
  EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER          Header;
  EFI_ACPI_5_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE  Apic; 
  EFI_ACPI_5_0_MEMORY_AFFINITY_STRUCTURE                      Memory;
  EFI_ACPI_5_0_PROCESSOR_LOCAL_X2APIC_AFFINITY_STRUCTURE      x2APIC;
} EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE;

#pragma pack()


//
// Static Resource Affinity Table definition
//
EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE Srat = {
  {
    EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE,
    sizeof (EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE),
    EFI_ACPI_5_0_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION,
    0x00,                                                     // Checksum will be updated at runtime
    {EFI_ACPI_OEM_ID},
    EFI_ACPI_OEM_TABLE_ID,
    EFI_ACPI_OEM_REVISION,
    EFI_ACPI_CREATOR_ID,
    EFI_ACPI_CREATOR_REVISION,
    /*Reserved*/
    0x00000001,                                  // Reserved to be 1 for backward compatibility
    EFI_ACPI_RESERVED_QWORD
  },
  /**/
  {
      0x00,                                     // Subtable Type:Processor Local APIC/SAPIC Affinity
      sizeof(EFI_ACPI_5_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE),                                     //Length
      0x00,                                     //Proximity Domain Low(8)
      0x00,                                     //Apic ID
      0x00000001,                               //Flags 
      0x00,                                     //Local Sapic EID
      {0,0,0},                                     //Proximity Domain High(24)
      0x00000000,                               //ClockDomain
  },
  //
  //
  // Memory Affinity 
  //
  {
    0x01,                                               // Subtable Type:Memory Affinity
    sizeof (EFI_ACPI_5_0_MEMORY_AFFINITY_STRUCTURE),    // Length
    0x00000000,                                         // Proximity Domain
    EFI_ACPI_RESERVED_WORD,                             // Reserved
    0x00000000,                                         // Address Base Low
    0x00000000,                                         // Address Base High
    0x0009FC00,                                         // Length Low
    0x00000000,                                         // Length High
    EFI_ACPI_RESERVED_DWORD,                            // Reserved
    0x00000001,                                         // Flags disabled, until enabled by Platform driver
    EFI_ACPI_RESERVED_QWORD ,                           // Reserved
  },
  
  /*Processor Local x2APIC Affinity*/
  {
     0x02,                                              // Subtable Type:Processor Local x2APIC Affinity
     sizeof(EFI_ACPI_5_0_PROCESSOR_LOCAL_X2APIC_AFFINITY_STRUCTURE),
     {0,0},                                             //Reserved1
     0x00000000,                                        //Proximity Domain
     0x00000000,                                        //Apic ID
     0x00000001,                                        //Flags 
     0x00000000,                                        //Clock Domain
     {0,0,0,0},                                         //Reserved2     
  },  
};

VOID*
ReferenceAcpiTable (
  VOID
  )
{
  //
  // Reference the table being generated to prevent the optimizer from removing the
  // data structure from the exeutable
  //
  return (VOID*)&Srat;
}