Skip to content

Commit

Permalink
ACPI 6.5: RAS2: Add support for RAS2 table
Browse files Browse the repository at this point in the history
Add support for ACPI RAS2 feature table(RAS2) defined in the ACPI 6.5
Specification & upwards revision, section 5.2.21.

The RAS2 table provides interfaces for platform RAS features. RAS2 offers
the same services as RASF, but is more scalable than the latter.
RAS2 supports independent RAS controls and capabilities for a given RAS
feature for multiple instances of the same component in a given system.
The platform can support either RAS2 or RASF but not both.

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
  • Loading branch information
shijujose4 committed Sep 27, 2023
1 parent f6f1c48 commit c581606
Show file tree
Hide file tree
Showing 11 changed files with 311 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/common/ahtable.c
Expand Up @@ -246,6 +246,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] =
{ACPI_SIG_PPTT, "Processor Properties Topology Table"},
{ACPI_SIG_PRMT, "Platform Runtime Mechanism Table"},
{ACPI_SIG_RASF, "RAS Features Table"},
{ACPI_SIG_RAS2, "RAS2 Features Table"},
{ACPI_SIG_RHCT, "RISC-V Hart Capabilities Table"},
{ACPI_SIG_RGRT, "Regulatory Graphics Resource Table"},
{ACPI_RSDP_NAME,"Root System Description Pointer"},
Expand Down
1 change: 1 addition & 0 deletions source/common/dmtable.c
Expand Up @@ -681,6 +681,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt},
{ACPI_SIG_PRMT, NULL, AcpiDmDumpPrmt, DtCompilePrmt, TemplatePrmt},
{ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf},
{ACPI_SIG_RAS2, AcpiDmTableInfoRas2, AcpiDmDumpRas2, DtCompileRas2, TemplateRas2},
{ACPI_SIG_RGRT, NULL, AcpiDmDumpRgrt, DtCompileRgrt, TemplateRgrt},
{ACPI_SIG_RHCT, NULL, AcpiDmDumpRhct, DtCompileRhct, TemplateRhct},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt},
Expand Down
54 changes: 54 additions & 0 deletions source/common/dmtbdump2.c
Expand Up @@ -2356,6 +2356,60 @@ AcpiDmDumpPrmt (
}


/*******************************************************************************
*
* FUNCTION: AcpiDmDumpRas2
*
* PARAMETERS: Table - A RAS2 table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a Ras2. This is a variable-length
* table that contains an open-ended number of the RAS2 PCC
* descriptors at the end of the table.
*
******************************************************************************/

void
AcpiDmDumpRas2 (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_RAS2_PCC_DESC *Subtable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_RAS2);


/* Main table */

Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRas2);
if (ACPI_FAILURE (Status))
{
return;
}

/* Subtables - RAS2 PCC descriptor list */

Subtable = ACPI_ADD_PTR (ACPI_RAS2_PCC_DESC, Table, Offset);
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_RAS2_PCC_DESC), AcpiDmTableInfoRas2PccDesc);
if (ACPI_FAILURE (Status))
{
return;
}

/* Point to next subtable */

Offset += sizeof (ACPI_RAS2_PCC_DESC);
Subtable = ACPI_ADD_PTR (ACPI_RAS2_PCC_DESC, Subtable,
sizeof (ACPI_RAS2_PCC_DESC));
}
}


/*******************************************************************************
*
* FUNCTION: AcpiDmDumpRgrt
Expand Down
25 changes: 25 additions & 0 deletions source/common/dmtbinfo2.c
Expand Up @@ -1987,6 +1987,31 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[] =
};


/*******************************************************************************
*
* RAS2 - RAS2 Feature table (ACPI 6.5)
*
******************************************************************************/

ACPI_DMTABLE_INFO AcpiDmTableInfoRas2[] =
{
{ACPI_DMT_UINT16, ACPI_RAS2_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT16, ACPI_RAS2_OFFSET (NumPccDescs), "Number of PCC Descriptors", 0},
ACPI_DMT_TERMINATOR
};

/* RAS2 PCC Descriptor */

ACPI_DMTABLE_INFO AcpiDmTableInfoRas2PccDesc[] =
{
{ACPI_DMT_UINT8, ACPI_RAS2_PCC_DESC_OFFSET (ChannelId), "Channel ID", 0},
{ACPI_DMT_UINT16, ACPI_RAS2_PCC_DESC_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT8, ACPI_RAS2_PCC_DESC_OFFSET (FeatureType), "Feature Type", 0},
{ACPI_DMT_UINT32, ACPI_RAS2_PCC_DESC_OFFSET (Instance), "Instance", 0},
ACPI_DMT_TERMINATOR
};


/*******************************************************************************
*
* RGRT - Regulatory Graphics Resource Table
Expand Down
5 changes: 5 additions & 0 deletions source/compiler/dtcompiler.h
Expand Up @@ -697,6 +697,10 @@ ACPI_STATUS
DtCompilePrmt (
void **PFieldList);

ACPI_STATUS
DtCompileRas2 (
void **PFieldList);

ACPI_STATUS
DtCompileRgrt (
void **PFieldList);
Expand Down Expand Up @@ -822,6 +826,7 @@ extern const unsigned char TemplatePmtt[];
extern const unsigned char TemplatePptt[];
extern const unsigned char TemplatePrmt[];
extern const unsigned char TemplateRasf[];
extern const unsigned char TemplateRas2[];
extern const unsigned char TemplateRgrt[];
extern const unsigned char TemplateRhct[];
extern const unsigned char TemplateRsdt[];
Expand Down
59 changes: 59 additions & 0 deletions source/compiler/dttable2.c
Expand Up @@ -1740,6 +1740,65 @@ DtCompilePrmt (
}


/******************************************************************************
*
* FUNCTION: DtCompileRas2
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile RAS2.
*
*****************************************************************************/

ACPI_STATUS
DtCompileRas2 (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_TABLE_RAS2 *Ras2Header;
UINT32 Count = 0;


/* Main table */

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

ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);

Ras2Header = ACPI_CAST_PTR (ACPI_TABLE_RAS2, ParentTable->Buffer);

/* There is only one type of subtable at this time, no need to decode */

while (*PFieldList)
{
/* List of RAS2 PCC descriptors, each 8 bytes */

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

DtInsertSubtable (ParentTable, Subtable);
Count++;
}

Ras2Header->NumPccDescs = (UINT8) Count;
return (AE_OK);
}


/******************************************************************************
*
* FUNCTION: DtCompileRgrt
Expand Down
11 changes: 11 additions & 0 deletions source/compiler/dttemplate.h
Expand Up @@ -1660,6 +1660,17 @@ const unsigned char TemplateRasf[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */
};

const unsigned char TemplateRas2[] =
{
0x52,0x41,0x53,0x32,0x38,0x00,0x00,0x00, /* 00000000 "RAS28..." */
0x01,0x28,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".(INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x06,0x23,0x20,0x00,0x00,0x02,0x00, /* 00000020 "(.# ...." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000028 "........" */
0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00 /* 00000030 "........" */
};

const unsigned char TemplateRgrt[] =
{
0x52,0x47,0x52,0x54,0x50,0x00,0x00,0x00, /* 00000000 "RGRTP..." */
Expand Down
6 changes: 6 additions & 0 deletions source/include/acdisasm.h
Expand Up @@ -626,6 +626,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtModule[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtHandler[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRas2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRas2PccDesc[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRhct[];
Expand Down Expand Up @@ -895,6 +897,10 @@ void
AcpiDmDumpPrmt (
ACPI_TABLE_HEADER *Table);

void
AcpiDmDumpRas2 (
ACPI_TABLE_HEADER *Table);

void
AcpiDmDumpRgrt (
ACPI_TABLE_HEADER *Table);
Expand Down
2 changes: 2 additions & 0 deletions source/include/actbinfo.h
Expand Up @@ -187,6 +187,7 @@
#define ACPI_PDTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PDTT,f)
#define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f)
#define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f)
#define ACPI_RAS2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RAS2,f)
#define ACPI_RGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RGRT,f)
#define ACPI_RHCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RHCT,f)
#define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f)
Expand Down Expand Up @@ -396,6 +397,7 @@
#define ACPI_PRMTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PRMT_HEADER,f)
#define ACPI_PRMT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PRMT_MODULE_INFO,f)
#define ACPI_PRMT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PRMT_HANDLER_INFO,f)
#define ACPI_RAS2_PCC_DESC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RAS2_PCC_DESC,f)
#define ACPI_RHCTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_NODE_HEADER,f)
#define ACPI_RHCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_ISA_STRING,f)
#define ACPI_RHCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_RHCT_CMO_NODE,f)
Expand Down

0 comments on commit c581606

Please sign in to comment.