/** @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;
|