diff options
author | Robert Moore <Robert.Moore@intel.com> | 2021-05-14 09:30:42 -0700 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2021-05-14 09:30:42 -0700 |
commit | 6949e1dd2d92788a994ce657857fe8809159e71e (patch) | |
tree | fe556725804ab26050d25d0eaa93f5f0cb9286c2 | |
parent | aafcdadf72d73b19025d55d216cbca6ab6e58292 (diff) | |
download | acpica-6949e1dd2d92788a994ce657857fe8809159e71e.tar.gz |
iASL Table Compiler: Add full support for RGRT ACPI table
Includes compiler, disassembler, and template generator.
-rw-r--r-- | source/common/ahtable.c | 1 | ||||
-rw-r--r-- | source/common/dmtable.c | 22 | ||||
-rw-r--r-- | source/common/dmtbdump2.c | 40 | ||||
-rw-r--r-- | source/common/dmtbinfo2.c | 25 | ||||
-rw-r--r-- | source/compiler/dtcompiler.h | 5 | ||||
-rw-r--r-- | source/compiler/dttable2.c | 48 | ||||
-rw-r--r-- | source/compiler/dttemplate.h | 14 | ||||
-rw-r--r-- | source/compiler/dtutils.c | 1 | ||||
-rw-r--r-- | source/include/acdisasm.h | 7 | ||||
-rw-r--r-- | source/include/actbinfo.h | 1 | ||||
-rw-r--r-- | source/include/actbl2.h | 31 | ||||
-rw-r--r-- | source/tools/acpisrc/astable.c | 1 |
12 files changed, 196 insertions, 0 deletions
diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 112e143a7..c7810e3b6 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -237,6 +237,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, + {ACPI_SIG_RGRT, "Regulatory Graphics Resource Table"}, {ACPI_RSDP_NAME,"Root System Description Pointer"}, {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 2dcd5a230..b8314db3e 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -401,6 +401,12 @@ static const char *AcpiDmPpttSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmRgrtSubnames[] = +{ + "Unknown/Reserved Image Type", /* ACPI_RGRT_TYPE_RESERVED0 */ + "Type PNG" /* ACPI_RGRT_IMAGE_TYPE_PNG */ +}; + static const char *AcpiDmSdevSubnames[] = { "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ @@ -561,6 +567,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, + {ACPI_SIG_RGRT, NULL, AcpiDmDumpRgrt, DtCompileRgrt, TemplateRgrt}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, @@ -992,6 +999,7 @@ AcpiDmDumpTable ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_RGRT: case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: @@ -1715,6 +1723,20 @@ AcpiDmDumpTable ( AcpiDmDumpBuffer (Target, 0, ByteLength, 0, NULL); break; + case ACPI_DMT_RGRT: + + /* RGRT subtable types */ + + Temp8 = *Target; + if (Temp8 >= ACPI_RGRT_TYPE_RESERVED) + { + Temp8 = ACPI_RGRT_TYPE_RESERVED0; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmRgrtSubnames[Temp8]); + break; + case ACPI_DMT_SDEV: /* SDEV subtable types */ diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index 658684df3..2a4f9dcab 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -2005,6 +2005,46 @@ NextSubtable: /******************************************************************************* * + * FUNCTION: AcpiDmDumpRgrt + * + * PARAMETERS: Table - A RGRT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a RGRT + * + ******************************************************************************/ + +void +AcpiDmDumpRgrt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_TABLE_RGRT *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table); + UINT32 Offset = sizeof (ACPI_TABLE_RGRT); + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump the binary image as a subtable */ + + Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image, + Table->Length - Offset, AcpiDmTableInfoRgrt0); + if (ACPI_FAILURE (Status)) + { + return; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpS3pt * * PARAMETERS: Table - A S3PT table diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c index 0f037a1aa..011c32953 100644 --- a/source/common/dmtbinfo2.c +++ b/source/common/dmtbinfo2.c @@ -1609,6 +1609,31 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[] = /******************************************************************************* * + * RGRT - Regulatory Graphics Resource Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt[] = +{ + {ACPI_DMT_UINT16, ACPI_RGRT_OFFSET (Version), "Version", 0}, + {ACPI_DMT_RGRT, ACPI_RGRT_OFFSET (ImageType), "Image Type", 0}, + {ACPI_DMT_UINT8, ACPI_RGRT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* + * We treat the binary image field as its own subtable (to make + * ACPI_DMT_RAW_BUFFER work properly). + */ +ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt0[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Image", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * S3PT - S3 Performance Table * ******************************************************************************/ diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 7c9478ce2..116ca020d 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -674,6 +674,10 @@ DtCompilePptt ( void **PFieldList); ACPI_STATUS +DtCompileRgrt ( + void **PFieldList); + +ACPI_STATUS DtCompileRsdt ( void **PFieldList); @@ -781,6 +785,7 @@ extern const unsigned char TemplatePhat[]; extern const unsigned char TemplatePmtt[]; extern const unsigned char TemplatePptt[]; extern const unsigned char TemplateRasf[]; +extern const unsigned char TemplateRgrt[]; extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; extern const unsigned char TemplateSbst[]; diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index a27aa358b..c3e751d96 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -1337,6 +1337,54 @@ DtCompilePptt ( /****************************************************************************** * + * FUNCTION: DtCompileRgrt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile RGRT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileRgrt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoRgrt, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile the "Subtable" -- actually just the binary (PNG) image */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoRgrt0, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileRsdt * * PARAMETERS: List - Current field list pointer diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index b0bd8cbe9..516d4dd9f 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -1257,6 +1257,20 @@ const unsigned char TemplateRasf[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */ }; +const unsigned char TemplateRgrt[] = +{ + 0x52,0x47,0x52,0x54,0x50,0x00,0x00,0x00, /* 00000000 "RGRTP..." */ + 0x01,0x33,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".3INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x31,0x03,0x21,0x20,0x01,0x00,0x01,0x00, /* 00000020 "1.! ...." */ + 0xAA,0x01,0x02,0x03,0x04,0x05,0x06,0x07, /* 00000028 "........" */ + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, /* 00000030 "........" */ + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, /* 00000038 "........" */ + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 00000040 "........" */ + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 /* 00000048 " !"#$%&'" */ +}; + const unsigned char TemplateRsdp[] = { 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */ diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index f2c815252..ba454b31e 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -583,6 +583,7 @@ DtGetFieldLength ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_RGRT: case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 618a524e3..12acfcc89 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -276,6 +276,7 @@ typedef enum ACPI_DMT_PMTT, ACPI_DMT_PMTT_VENDOR, ACPI_DMT_PPTT, + ACPI_DMT_RGRT, ACPI_DMT_SDEI, ACPI_DMT_SDEV, ACPI_DMT_SLIC, @@ -553,6 +554,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1a[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoRgrt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; @@ -782,6 +785,10 @@ void AcpiDmDumpPptt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpRgrt ( + ACPI_TABLE_HEADER *Table); + UINT32 AcpiDmDumpRsdp ( ACPI_TABLE_HEADER *Table); diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h index 6a8c7621f..622961d85 100644 --- a/source/include/actbinfo.h +++ b/source/include/actbinfo.h @@ -183,6 +183,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_RGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RGRT,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f) diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 226ef1fca..bba780b94 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -184,6 +184,7 @@ #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ #define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ +#define ACPI_SIG_RGRT "RGRT" /* Regulatory Graphics Resource Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */ #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ @@ -2233,6 +2234,36 @@ enum AcpiRasfStatus /******************************************************************************* * + * RGRT - Regulatory Graphics Resource Table + * Version 1 + * + * Conforms to "ACPI RGRT" available at: + * https://microsoft.github.io/mu/dyn/mu_plus/MsCorePkg/AcpiRGRT/feature_acpi_rgrt/ + * + ******************************************************************************/ + +typedef struct acpi_table_rgrt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 Version; + UINT8 ImageType; + UINT8 Reserved; + UINT8 Image[0]; + +} ACPI_TABLE_RGRT; + +/* ImageType values */ + +enum AcpiRgrtImageType +{ + ACPI_RGRT_TYPE_RESERVED0 = 0, + ACPI_RGRT_IMAGE_TYPE_PNG = 1, + ACPI_RGRT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + + +/******************************************************************************* + * * SBST - Smart Battery Specification Table * Version 1 * diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index a23c3b947..92c4b347d 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -676,6 +676,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_PHAT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_PMTT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_PPTT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_RGRT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_MCHI", SRC_TYPE_STRUCT}, |