Skip to content

Commit

Permalink
IORT: Add in support for the SMMUv3 subtable
Browse files Browse the repository at this point in the history
The most recent version of the IORT specification adds in a definition
for a subtable to describe SMMUv3 devices; there is already a subtable
for SMMUv1/v2 devices.

Add in the definition of the subtable, add in the code to compile it,
and add in a template for it.

Signed-off-by: Al Stone <ahs3@redhat.com>
  • Loading branch information
Al Stone authored and acpibob committed Mar 1, 2016
1 parent 3f1ad3f commit 9f7c3e1
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 8 deletions.
6 changes: 6 additions & 0 deletions source/common/dmtbdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,12 @@ AcpiDmDumpIort (
IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset);
break;

case ACPI_IORT_NODE_SMMU_V3:

InfoTable = AcpiDmTableInfoIort4;
Length = IortNode->Length - NodeOffset;
break;

default:

AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n",
Expand Down
19 changes: 19 additions & 0 deletions source/common/dmtbinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
#define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f)
#define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f)
#define ACPI_IORT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU,f)
#define ACPI_IORT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU_V3,f)
#define ACPI_IORTA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_MEMORY_ACCESS,f)
#define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f)
#define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f)
Expand Down Expand Up @@ -328,6 +329,7 @@
#define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o)
#define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o)
#define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o)
#define ACPI_IORT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_V3,f,o)
#define ACPI_IORTA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_MEMORY_ACCESS,f,o)
#define ACPI_IORTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_ID_MAPPING,f,o)
#define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o)
Expand Down Expand Up @@ -1633,6 +1635,23 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[] =
ACPI_DMT_TERMINATOR
};

/* 0x04: SMMUv3 */

ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] =
{
{ACPI_DMT_UINT64, ACPI_IORT4_OFFSET (BaseAddress), "Base Address", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Flags), "Flags (decoded below)", 0},
{ACPI_DMT_FLAG0, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "COHACC Override", 0},
{ACPI_DMT_FLAG1, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "HTTU Override", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_IORT4_OFFSET (VatosAddress), "VATOS Address", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Model), "Model", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (EventGsiv), "Event GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (PriGsiv), "PRI GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (GerrGsiv), "GERR GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (SyncGsiv), "Sync GSIV", 0},
ACPI_DMT_TERMINATOR
};

/*******************************************************************************
*
Expand Down
17 changes: 15 additions & 2 deletions source/compiler/dttable1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ DtCompileIort (
DtInsertSubtable (ParentTable, Subtable);

/*
* Using ACPI_SUB_PTR, We needn't define a seperate structure. Care
* should be taken to avoid accessing ACPI_TABLE_HADER fields.
* Using ACPI_SUB_PTR, We needn't define a separate structure. Care
* should be taken to avoid accessing ACPI_TABLE_HEADER fields.
*/
Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT,
Subtable->Buffer, sizeof (ACPI_TABLE_HEADER));
Expand Down Expand Up @@ -1547,6 +1547,19 @@ DtCompileIort (
IortSmmu->PmuInterruptCount = PmuIrptNumber;
break;

case ACPI_IORT_NODE_SMMU_V3:

Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort4,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}

DtInsertSubtable (ParentTable, Subtable);
NodeLength += Subtable->Length;
break;

default:

DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT");
Expand Down
15 changes: 11 additions & 4 deletions source/compiler/dttemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,11 +615,11 @@ const unsigned char TemplateHpet[] =

const unsigned char TemplateIort[] =
{
0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */
0x00,0xBC,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x49,0x4F,0x52,0x54,0x48,0x01,0x00,0x00, /* 00000000 "IORTH..." */
0x00,0x02,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x10,0x04,0x15,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */
0x12,0x02,0x16,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */
0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */
0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */
Expand Down Expand Up @@ -648,7 +648,14 @@ const unsigned char TemplateIort[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0x00,0x00,0x00,0x00 /* 00000108 "...." */
0x00,0x00,0x00,0x00,0x04,0x3C,0x00,0x00, /* 00000108 ".....<.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "<......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000140 "........" */
};

const unsigned char TemplateIvrs[] =
Expand Down
1 change: 1 addition & 0 deletions source/include/acdisasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[];
Expand Down
25 changes: 23 additions & 2 deletions source/include/actbl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ typedef struct acpi_ibft_target
* IORT - IO Remapping Table
*
* Conforms to "IO Remapping Table System Software on ARM Platforms",
* Document number: ARM DEN 0049A, 2015
* Document number: ARM DEN 0049B, October 2015
*
******************************************************************************/

Expand Down Expand Up @@ -870,7 +870,8 @@ enum AcpiIortNodeType
ACPI_IORT_NODE_ITS_GROUP = 0x00,
ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
ACPI_IORT_NODE_SMMU = 0x03
ACPI_IORT_NODE_SMMU = 0x03,
ACPI_IORT_NODE_SMMU_V3 = 0x04
};


Expand Down Expand Up @@ -979,6 +980,26 @@ typedef struct acpi_iort_smmu
#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)


typedef struct acpi_iort_smmu_v3
{
UINT64 BaseAddress; /* SMMUv3 base address */
UINT32 Flags;
UINT32 Reserved;
UINT64 VatosAddress;
UINT32 Model; /* O: generic SMMUv3 */
UINT32 EventGsiv;
UINT32 PriGsiv;
UINT32 GerrGsiv;
UINT32 SyncGsiv;

} ACPI_IORT_SMMU_V3;

/* Masks for Flags field above */

#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1)


/*******************************************************************************
*
* IVRS - I/O Virtualization Reporting Structure
Expand Down

0 comments on commit 9f7c3e1

Please sign in to comment.