acpica: Import ACPICA 20221020

(cherry picked from commit a799bdd9d50e84cd6a36e8f1d2ac4301b2a6b374)
This commit is contained in:
Jung-uk Kim 2022-10-27 17:34:40 -04:00
parent d78c2cd831
commit 9a4bc5208f
52 changed files with 2123 additions and 286 deletions

View File

@ -387,16 +387,36 @@ AcGetOneTableFromFile (
ACPI_TABLE_HEADER TableHeader;
ACPI_TABLE_HEADER *Table;
INT32 Count;
long TableOffset;
UINT32 TableLength;
UINT32 HeaderLength;
long TableOffset = 0;
*ReturnTable = NULL;
/* Get the table header to examine signature and length */
/*
* Special handling for the CDAT table (both the Length field
* and the Checksum field are not in the standard positions).
* (The table header is non-standard).
*/
if (AcpiGbl_CDAT)
{
HeaderLength = sizeof (ACPI_TABLE_CDAT);
}
else
{
HeaderLength = sizeof (ACPI_TABLE_HEADER);
}
Status = AcValidateTableHeader (File, TableOffset);
if (ACPI_FAILURE (Status))
{
return (Status);
}
TableOffset = ftell (File);
Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File);
if (Count != sizeof (ACPI_TABLE_HEADER))
Count = fread (&TableHeader, 1, HeaderLength, File);
if (Count != (INT32) HeaderLength)
{
return (AE_CTRL_TERMINATE);
}
@ -405,12 +425,6 @@ AcGetOneTableFromFile (
{
/* Validate the table signature/header (limited ASCII chars) */
Status = AcValidateTableHeader (File, TableOffset);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* Table must be an AML table (DSDT/SSDT).
* Used for iASL -e option only.
@ -425,9 +439,22 @@ AcGetOneTableFromFile (
}
}
/*
* Special handling for the CDAT table (both the Length field
* and the Checksum field are not in the standard positions).
*/
if (AcpiGbl_CDAT)
{
TableLength = ACPI_CAST_PTR (ACPI_TABLE_CDAT, &TableHeader)->Length;
}
else
{
TableLength = TableHeader.Length;
}
/* Allocate a buffer for the entire table */
Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
Table = AcpiOsAllocate ((ACPI_SIZE) TableLength);
if (!Table)
{
return (AE_NO_MEMORY);
@ -436,22 +463,31 @@ AcGetOneTableFromFile (
/* Read the entire ACPI table, including header */
fseek (File, TableOffset, SEEK_SET);
Count = fread (Table, 1, TableHeader.Length, File);
Count = fread (Table, 1, TableLength, File);
/*
* Checks for data table headers happen later in the execution. Only verify
* for Aml tables at this point in the code.
*/
if (GetOnlyAmlTables && Count != (INT32) TableHeader.Length)
if (GetOnlyAmlTables && Count != (INT32) TableLength)
{
Status = AE_ERROR;
goto ErrorExit;
}
/* Validate the checksum (just issue a warning) */
/*
* Validate the checksum (just issue a warning if incorrect).
* Note: CDAT is special cased here because the table does
* not have the checksum field in the standard position.
*/
if (AcpiGbl_CDAT)
{
Status = AcpiUtVerifyCdatChecksum ((ACPI_TABLE_CDAT *) Table, TableLength);
} else
{
Status = AcpiUtVerifyChecksum (Table, TableLength);
}
Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
if (ACPI_FAILURE (Status))
{
Status = AcCheckTextModeCorruption (Table);
@ -540,6 +576,8 @@ AcValidateTableHeader (
long TableOffset)
{
ACPI_TABLE_HEADER TableHeader;
ACPI_TABLE_CDAT *CdatTableHeader = ACPI_CAST_PTR (ACPI_TABLE_CDAT, &TableHeader);
UINT32 HeaderLength;
ACPI_SIZE Actual;
long OriginalOffset;
UINT32 FileSize;
@ -548,6 +586,16 @@ AcValidateTableHeader (
ACPI_FUNCTION_TRACE (AcValidateTableHeader);
/* Determine the type of table header */
if (AcpiGbl_CDAT)
{
HeaderLength = sizeof (ACPI_TABLE_CDAT);
}
else
{
HeaderLength = sizeof (ACPI_TABLE_HEADER);
}
/* Read a potential table header */
@ -556,41 +604,76 @@ AcValidateTableHeader (
{
fprintf (stderr, "SEEK error\n");
}
Actual = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File);
Actual = fread (&TableHeader, 1, HeaderLength, File);
if (fseek (File, OriginalOffset, SEEK_SET))
{
fprintf (stderr, "SEEK error\n");
}
if (Actual < sizeof (ACPI_TABLE_HEADER))
if (Actual < HeaderLength)
{
fprintf (stderr,
"Could not read entire table header: Actual %u, Requested %u\n",
(UINT32) Actual, (UINT32) sizeof (ACPI_TABLE_HEADER));
(UINT32) Actual, HeaderLength);
return (AE_ERROR);
}
/* Validate the signature (limited ASCII chars) */
if (!AcpiUtValidNameseg (TableHeader.Signature))
if (!AcpiGbl_CDAT && !AcpiUtValidNameseg (TableHeader.Signature))
{
/*
* The "-ds cdat" option was not used, and the signature is not valid.
*
* For CDAT we are assuming that there should be at least one non-ASCII
* byte in the (normally) 4-character Signature field (at least the
* high-order byte should be zero). Otherwise, this is OK.
*/
fprintf (stderr,
"\nTable appears to be a CDAT table, which has no signature.\n"
"If this is in fact a CDAT table, use the -ds option on the\n"
"command line to specify the table type (signature):\n"
"\"iasl -d -ds CDAT <file>\" or \"iasl -ds CDAT -T CDAT\"\n\n");
return (AE_BAD_SIGNATURE);
}
/* Validate table length against bytes remaining in the file */
FileSize = CmGetFileSize (File);
if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
if (!AcpiGbl_CDAT)
{
fprintf (stderr, "Table [%4.4s] is too long for file - "
/* Standard ACPI table header */
if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
{
fprintf (stderr, "Table [%4.4s] is too long for file - "
"needs: 0x%.2X, remaining in file: 0x%.2X\n",
TableHeader.Signature, TableHeader.Length,
(UINT32) (FileSize - TableOffset));
return (AE_BAD_HEADER);
}
}
else if (CdatTableHeader->Length > (UINT32) (FileSize - TableOffset))
{
/* Special header for CDAT table */
fprintf (stderr, "Table [CDAT] is too long for file - "
"needs: 0x%.2X, remaining in file: 0x%.2X\n",
TableHeader.Signature, TableHeader.Length,
CdatTableHeader->Length,
(UINT32) (FileSize - TableOffset));
return (AE_BAD_HEADER);
}
/* For CDAT table, there are no ASCII fields in the header, we are done */
if (AcpiGbl_CDAT)
{
return (AE_OK);
}
/*
* These fields must be ASCII: OemId, OemTableId, AslCompilerId.
* These standard fields must be ASCII: OemId, OemTableId, AslCompilerId.
* We allow a NULL terminator in OemId and OemTableId.
*/
for (i = 0; i < ACPI_NAMESEG_SIZE; i++)

View File

@ -476,13 +476,13 @@ AdDisassembleOneTable (
/* This is a "Data Table" (non-AML table) */
AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
Table->Signature);
AcpiGbl_CDAT ? (char *) AcpiGbl_CDAT : Table->Signature);
AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] "
"FieldName : FieldValue (in hex)\n */\n\n");
AcpiDmDumpDataTable (Table);
fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
Table->Signature);
AcpiGbl_CDAT ? (char *) AcpiGbl_CDAT : Table->Signature);
if (File)
{

View File

@ -206,6 +206,8 @@ const AH_TABLE AcpiGbl_SupportedTables[] =
{ACPI_SIG_BERT, "Boot Error Record Table"},
{ACPI_SIG_BGRT, "Boot Graphics Resource Table"},
{ACPI_SIG_BOOT, "Simple Boot Flag Table"},
{ACPI_SIG_CCEL, "CC-Event Log Table"},
{ACPI_SIG_CDAT, "Coherent Device Attribute Table"},
{ACPI_SIG_CEDT, "CXL Early Discovery Table"},
{ACPI_SIG_CPEP, "Corrected Platform Error Polling Table"},
{ACPI_SIG_CSRT, "Core System Resource Table"},

View File

@ -209,6 +209,9 @@ const AH_UUID Gbl_AcpiUuids[] =
{"Hierarchical Data Extension", UUID_HIERARCHICAL_DATA_EXTENSION},
{"ARM Coresight Graph", UUID_CORESIGHT_GRAPH},
{"USB4 Capabilities", UUID_USB4_CAPABILITIES},
{"First Function ID for _DSM", UUID_1ST_FUNCTION_ID},
{"Second Function ID for _DSM", UUID_2ND_FUNCTION_ID},
{NULL, NULL}
};

View File

@ -234,6 +234,17 @@ static const char *AcpiDmAsfSubnames[] =
"Unknown Subtable Type" /* Reserved */
};
static const char *AcpiDmCdatSubnames[] =
{
"Device Scoped Memory Affinity Structure (DSMAS)",
"Device scoped Latency and Bandwidth Information Structure (DSLBIS)",
"Device Scoped Memory Side Cache Information Structure (DSMSCIS)",
"Device Scoped Initiator Structure (DSIS)",
"Device Scoped EFI Memory Type Structure (DSEMTS)",
"Switch Scoped Latency and Bandwidth Information Structure (SSLBIS)",
"Unknown Subtable Type" /* Reserved */
};
static const char *AcpiDmCedtSubnames[] =
{
"CXL Host Bridge Structure",
@ -403,6 +414,13 @@ static const char *AcpiDmMadtSubnames[] =
"Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */
"Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */
"Mutiprocessor Wakeup", /* ACPI_MADT_TYPE_MULTIPROC_WAKEUP */
"CPU Core Interrupt Controller", /* ACPI_MADT_TYPE_CORE_PIC */
"Legacy I/O Interrupt Controller", /* ACPI_MADT_TYPE_LIO_PIC */
"HT Interrupt Controller", /* ACPI_MADT_TYPE_HT_PIC */
"Extend I/O Interrupt Controller", /* ACPI_MADT_TYPE_EIO_PIC */
"MSI Interrupt Controller", /* ACPI_MADT_TYPE_MSI_PIC */
"Bridge I/O Interrupt Controller", /* ACPI_MADT_TYPE_BIO_PIC */
"LPC Interrupt Controller", /* ACPI_MADT_TYPE_LPC_PIC */
"Unknown Subtable Type", /* Reserved */
"Types 80-FF are used for OEM data" /* Reserved for OEM data */
};
@ -658,6 +676,8 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert},
{ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot},
{ACPI_SIG_CCEL, AcpiDmTableInfoCcel, NULL, NULL, TemplateCcel},
{ACPI_SIG_CDAT, NULL, AcpiDmDumpCdat, NULL, TemplateCdat},
{ACPI_SIG_CEDT, NULL, AcpiDmDumpCedt, DtCompileCedt, TemplateCedt},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep},
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt},
@ -722,44 +742,6 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
};
/*******************************************************************************
*
* FUNCTION: AcpiDmGenerateChecksum
*
* PARAMETERS: Table - Pointer to table to be checksummed
* Length - Length of the table
* OriginalChecksum - Value of the checksum field
*
* RETURN: 8 bit checksum of buffer
*
* DESCRIPTION: Computes an 8 bit checksum of the table.
*
******************************************************************************/
UINT8
AcpiDmGenerateChecksum (
void *Table,
UINT32 Length,
UINT8 OriginalChecksum)
{
UINT8 Checksum;
/* Sum the entire table as-is */
Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
/* Subtract off the existing checksum value in the table */
Checksum = (UINT8) (Checksum - OriginalChecksum);
/* Compute the final checksum */
Checksum = (UINT8) (0 - Checksum);
return (Checksum);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmGetTableData
@ -834,7 +816,7 @@ AcpiDmDumpDataTable (
/*
* Handle tables that don't use the common ACPI table header structure.
* Currently, these are the FACS, RSDP, and S3PT.
* Currently, these are the FACS, RSDP, S3PT and CDAT.
*/
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
{
@ -854,6 +836,28 @@ AcpiDmDumpDataTable (
{
Length = AcpiDmDumpS3pt (Table);
}
else if (!AcpiUtValidNameseg (Table->Signature))
{
/*
* For CDAT we are assuming that there should be at least one non-ASCII
* byte in the (normally) 4-character Signature field (at least the
* high-order byte should be zero).
*/
if (AcpiGbl_CDAT)
{
/*
* Invalid signature and <-ds CDAT> was specified on the command line.
* Therefore, we have a CDAT table.
*/
AcpiDmDumpCdat (Table);
}
else
{
fprintf (stderr, "Table has an invalid signature\n");
}
return;
}
else
{
/*
@ -977,7 +981,7 @@ AcpiDmLineHeader (
{
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ",
AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %27s : ",
Offset, Offset, ByteLength, Name);
}
else
@ -1019,12 +1023,12 @@ AcpiDmLineHeader2 (
{
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4u %3.3Xh] %24s %3d : ",
Offset, Offset, ByteLength, Name, Value);
}
else
{
AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4u ] %24s %3d : ",
Offset, Offset, Name, Value);
}
}
@ -1106,7 +1110,8 @@ AcpiDmDumpTable (
{
AcpiOsPrintf (
"/**** ACPI table terminates "
"in the middle of a data structure! (dump table) */\n");
"in the middle of a data structure! (dump table) \n"
"CurrentOffset: %X, TableLength: %X ***/", CurrentOffset, TableLength);
return (AE_BAD_DATA);
}
@ -1140,6 +1145,7 @@ AcpiDmDumpTable (
case ACPI_DMT_AEST_XFACE:
case ACPI_DMT_AEST_XRUPT:
case ACPI_DMT_ASF:
case ACPI_DMT_CDAT:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
case ACPI_DMT_EINJACT:
@ -1522,7 +1528,7 @@ AcpiDmDumpTable (
/* Checksum, display and validate */
AcpiOsPrintf ("%2.2X", *Target);
Temp8 = AcpiDmGenerateChecksum (Table,
Temp8 = AcpiUtGenerateChecksum (Table,
ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
@ -1668,6 +1674,20 @@ AcpiDmDumpTable (
AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
break;
case ACPI_DMT_CDAT:
/* CDAT subtable types */
Temp8 = *Target;
if (Temp8 > ACPI_CDAT_TYPE_RESERVED)
{
Temp8 = ACPI_CDAT_TYPE_RESERVED;
}
AcpiOsPrintf (UINT8_FORMAT, *Target,
AcpiDmCdatSubnames[Temp8]);
break;
case ACPI_DMT_CEDT:
/* CEDT subtable types */
@ -2017,15 +2037,15 @@ AcpiDmDumpTable (
case ACPI_DMT_PHAT:
/* PMTT subtable types */
/* PHAT subtable types */
Temp16 = *Target;
Temp16 = ACPI_GET16 (Target);
if (Temp16 > ACPI_PHAT_TYPE_RESERVED)
{
Temp16 = ACPI_PHAT_TYPE_RESERVED;
}
AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16(Target),
AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
AcpiDmPhatSubnames[Temp16]);
break;
@ -2069,7 +2089,7 @@ AcpiDmDumpTable (
break;
}
AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength);
AcpiDmDumpUnicode (Table, 0, ByteLength);
break;
case ACPI_DMT_RAW_BUFFER:

View File

@ -296,7 +296,7 @@ AdCreateTableHeader (
AcpiOsPrintf ("\n * Checksum 0x%2.2X", Table->Checksum);
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
Checksum = AcpiUtChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
if (Checksum)
{
AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",

View File

@ -384,7 +384,7 @@ AcpiDmDumpRsdp (
/* Validate the first checksum */
Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
Checksum = AcpiUtGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
Rsdp->Checksum);
if (Checksum != Rsdp->Checksum)
{
@ -405,7 +405,7 @@ AcpiDmDumpRsdp (
/* Validate the extended checksum over entire RSDP */
Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
Checksum = AcpiUtGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
Rsdp->ExtendedChecksum);
if (Checksum != Rsdp->ExtendedChecksum)
{

View File

@ -153,6 +153,7 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/actables.h>
#include <contrib/dev/acpica/compiler/aslcompiler.h>
/* This module used for application-level code only */
@ -608,6 +609,192 @@ AcpiDmDumpAsf (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpCdat
*
* PARAMETERS: InTable - A CDAT table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a CDAT. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpCdat (
ACPI_TABLE_HEADER *InTable)
{
ACPI_TABLE_CDAT *Table = ACPI_CAST_PTR (ACPI_TABLE_CDAT, InTable);
ACPI_STATUS Status;
ACPI_CDAT_HEADER *Subtable;
ACPI_TABLE_CDAT *CdatTable = ACPI_CAST_PTR (ACPI_TABLE_CDAT, Table);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 Length = CdatTable->Length;
UINT32 Offset = sizeof (ACPI_TABLE_CDAT);
UINT32 SubtableLength;
UINT32 SubtableType;
INT32 EntriesLength;
/* Main table */
Status = AcpiDmDumpTable (Offset, 0, CdatTable, 0,
AcpiDmTableInfoCdatTableHdr);
if (ACPI_FAILURE (Status))
{
return;
}
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, sizeof (ACPI_TABLE_CDAT));
while (Offset < Table->Length)
{
/* Dump the common subtable header */
DbgPrint (ASL_DEBUG_OUTPUT, "0) HeaderOffset: %X\n", Offset);
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_CDAT_HEADER), AcpiDmTableInfoCdatHeader);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point past the common subtable header, decode the subtable type */
Offset += sizeof (ACPI_CDAT_HEADER);
SubtableType = Subtable->Type;
switch (Subtable->Type)
{
case ACPI_CDAT_TYPE_DSMAS:
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
SubtableLength = sizeof (ACPI_CDAT_DSMAS);
InfoTable = AcpiDmTableInfoCdat0;
break;
case ACPI_CDAT_TYPE_DSLBIS:
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
SubtableLength = sizeof (ACPI_CDAT_DSLBIS);
DbgPrint (ASL_DEBUG_OUTPUT, "1) Offset: %X\n", Offset);
InfoTable = AcpiDmTableInfoCdat1;
break;
case ACPI_CDAT_TYPE_DSMSCIS:
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
SubtableLength = sizeof (ACPI_CDAT_DSMSCIS);
InfoTable = AcpiDmTableInfoCdat2;
break;
case ACPI_CDAT_TYPE_DSIS:
DbgPrint (ASL_DEBUG_OUTPUT, "2) Offset: %X ", Offset);
SubtableLength = sizeof (ACPI_CDAT_DSIS);
DbgPrint (ASL_DEBUG_OUTPUT, "1) input pointer: %p\n", Table);
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
DbgPrint (ASL_DEBUG_OUTPUT, "1) output pointers: %p, %p, Offset: %X\n",
Table, Subtable, Offset);
DbgPrint (ASL_DEBUG_OUTPUT, "3) Offset: %X\n", Offset);
InfoTable = AcpiDmTableInfoCdat3;
break;
case ACPI_CDAT_TYPE_DSEMTS:
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
SubtableLength = sizeof (ACPI_CDAT_DSEMTS);
InfoTable = AcpiDmTableInfoCdat4;
break;
case ACPI_CDAT_TYPE_SSLBIS:
SubtableLength = Subtable->Length;
InfoTable = AcpiDmTableInfoCdat5;
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
break;
default:
fprintf (stderr, "ERROR: Unknown SubtableType: %X\n", Subtable->Type);
return;
}
DbgPrint (ASL_DEBUG_OUTPUT, "SubtableType: %X, Length: %X Actual "
"Length: %X Offset: %X tableptr: %p\n", SubtableType,
Subtable->Length, SubtableLength, Offset, Table);
/*
* Do the subtable-specific fields
*/
Status = AcpiDmDumpTable (Length, Offset, Subtable, Offset, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
DbgPrint (ASL_DEBUG_OUTPUT, "Subtable Type: %X, Offset: %X, SubtableLength: %X\n",
SubtableType, Offset, SubtableLength);
/* Additional sub-subtables, dependent on the main subtable type */
switch (SubtableType)
{
case ACPI_CDAT_TYPE_SSLBIS:
Offset += sizeof (ACPI_CDAT_SSLBIS);
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table,
Offset);
DbgPrint (ASL_DEBUG_OUTPUT, "Case SSLBIS, Offset: %X, SubtableLength: %X "
"Subtable->Length %X\n", Offset, SubtableLength, Subtable->Length);
/* Generate the total length of all the SSLBE entries */
EntriesLength = SubtableLength - sizeof (ACPI_CDAT_HEADER) -
sizeof (ACPI_CDAT_SSLBIS);
DbgPrint (ASL_DEBUG_OUTPUT, "EntriesLength: %X, Offset: %X, Table->Length: %X\n",
EntriesLength, Offset, Table->Length);
/* Do each of the SSLBE Entries */
while ((EntriesLength > 0) && (Offset < Table->Length))
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable, Offset,
AcpiDmTableInfoCdatEntries);
if (ACPI_FAILURE (Status))
{
return;
}
EntriesLength -= sizeof (ACPI_CDAT_SSLBE);
Offset += sizeof (ACPI_CDAT_SSLBE);
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
}
SubtableLength = 0;
break;
default:
break;
}
DbgPrint (ASL_DEBUG_OUTPUT, "Offset: %X, Subtable Length: %X\n",
Offset, SubtableLength);
/* Point to next subtable */
Offset += SubtableLength;
Subtable = ACPI_ADD_PTR (ACPI_CDAT_HEADER, Table, Offset);
}
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpCedt
@ -651,12 +838,14 @@ AcpiDmDumpCedt (
case ACPI_CEDT_TYPE_CHBS:
Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoCedt0);
if (ACPI_FAILURE (Status)) {
if (ACPI_FAILURE (Status))
{
return;
}
break;
case ACPI_CEDT_TYPE_CFMWS: {
case ACPI_CEDT_TYPE_CFMWS:
{
ACPI_CEDT_CFMWS *ptr = (ACPI_CEDT_CFMWS *) Subtable;
unsigned int i, max = 0x01 << (ptr->InterleaveWays);
@ -664,18 +853,22 @@ AcpiDmDumpCedt (
Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoCedt1);
if (ACPI_FAILURE (Status)) {
if (ACPI_FAILURE (Status))
{
return;
}
/* Now, print out any interleave targets beyond the first. */
for (i = 1; i < max; i++) {
unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET(ACPI_CEDT_CFMWS, InterleaveTargets);
for (i = 1; i < max; i++)
{
unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET (ACPI_CEDT_CFMWS, InterleaveTargets);
unsigned int *trg = &(ptr->InterleaveTargets[i]);
Status = AcpiDmDumpTable (Length, loc_offset, trg,
Subtable->Length, AcpiDmTableInfoCedt1_te);
if (ACPI_FAILURE (Status)) {
if (ACPI_FAILURE (Status))
{
return;
}
}

View File

@ -149,6 +149,7 @@
*
*****************************************************************************/
#include <wchar.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acdisasm.h>
@ -2104,9 +2105,12 @@ AcpiDmDumpPhat (
UINT32 RecordCount;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_PHAT);
UINT32 OriginalOffset;
UINT32 SubtableLength;
UINT32 PathLength;
UINT32 VendorLength;
UINT16 RecordType;
const wchar_t *WideString;
Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT));
@ -2116,58 +2120,93 @@ AcpiDmDumpPhat (
/* Common subtable header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, 0, Subtable,
Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr);
if (ACPI_FAILURE (Status))
{
return;
}
DbgPrint (ASL_DEBUG_OUTPUT, "\n/* %u, Subtable->Type %X */\n",
__LINE__, Subtable->Type);
switch (Subtable->Type)
{
case ACPI_PHAT_TYPE_FW_VERSION_DATA:
InfoTable = AcpiDmTableInfoPhat0;
SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA);
SubtableLength = Offset += sizeof (ACPI_PHAT_VERSION_DATA);
break;
case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
InfoTable = AcpiDmTableInfoPhat1;
SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA);
SubtableLength = Offset += sizeof (ACPI_PHAT_TYPE_FW_HEALTH_DATA);
break;
default:
AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n",
DbgPrint (ASL_DEBUG_OUTPUT, "\n**** Unknown PHAT subtable type 0x%X\n\n",
Subtable->Type);
return;
}
Status = AcpiDmDumpTable (Length, 0, Subtable,
Status = AcpiDmDumpTable (Length, SubtableLength, Subtable,
SubtableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
OriginalOffset = Offset;
switch (Subtable->Type)
{
case ACPI_PHAT_TYPE_FW_VERSION_DATA:
VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable);
RecordCount = VersionData->ElementCount;
while (RecordCount)
RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
/*
* Skip past a zero-valued block (not part of the ACPI PHAT specification).
* First, check for a zero length record and a zero element count
*/
if (!VersionData->Header.Length && !VersionData->ElementCount)
{
Status = AcpiDmDumpTable (Length, Offset,
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)),
while (RecordType == 0)
{
Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
RecordType = *ACPI_CAST_PTR (UINT8, Subtable);
RecordCount = VersionData->ElementCount;
Offset += 1;
}
Offset -= 1;
AcpiOsPrintf ("\n/* Warning: Block of zeros found above starting at Offset %X Length %X */\n"
"/* (not compliant to PHAT specification -- ignoring block) */\n",
OriginalOffset - 12, Offset - OriginalOffset + 12);
}
DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, RecordCount: %X, Offset %X, SubtableLength %X */\n",
__LINE__, RecordCount, Offset, SubtableLength);
/* Emit each of the version elements */
while (RecordCount && VersionData->Header.Length)
{
AcpiOsPrintf ("\n/* Version Element #%Xh Offset %Xh */\n\n",
VersionData->ElementCount - RecordCount + 1, Offset);
Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, Offset);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a);
if (ACPI_FAILURE (Status))
{
return;
}
Offset += sizeof (ACPI_PHAT_VERSION_ELEMENT);
RecordCount--;
}
@ -2175,24 +2214,48 @@ AcpiDmDumpPhat (
case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
/* account for the null terminator */
/*
* Get the length of the Device Path (UEFI wide string).
* Include the wide null terminator (+2),
*/
WideString = ACPI_ADD_PTR (wchar_t, Subtable,
sizeof (ACPI_PHAT_HEALTH_DATA));
PathLength = (wcslen (WideString) * 2) + 2;
DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, PathLength %X, Offset %X, Table->Length %X */\n",
__LINE__, PathLength, Offset, Length);
PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1;
Status = AcpiDmDumpTable (Length, Offset,
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)),
PathLength, AcpiDmTableInfoPhat1a);
Offset += PathLength;
if (ACPI_FAILURE (Status))
{
return;
}
/* Get vendor data - data length is the remaining subtable length */
/* Get Device-Specific Data - length of which is the remaining subtable length. */
VendorLength =
Subtable->Length - sizeof (ACPI_PHAT_HEALTH_DATA) - PathLength;
Status = AcpiDmDumpTable (Length, 0,
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
VendorLength, AcpiDmTableInfoPhat1b);
DbgPrint (ASL_DEBUG_OUTPUT, "%u, Subtable->Length %X, VendorLength %X, Offset %X PathLength: %X\n",
__LINE__, Subtable->Length, VendorLength, Offset, PathLength);
if (VendorLength)
{
/* Point past the Device Path, Compile the Device-Specific Data */
Status = AcpiDmDumpTable (Length, Offset,
ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA) + PathLength),
VendorLength, AcpiDmTableInfoPhat1b);
if (ACPI_FAILURE (Status))
{
return;
}
Offset += VendorLength;
}
if (ACPI_FAILURE (Status))
{
return;
@ -2208,9 +2271,12 @@ AcpiDmDumpPhat (
/* Next subtable */
Offset += Subtable->Length;
Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable,
Subtable->Length);
DbgPrint (ASL_DEBUG_OUTPUT, "/* %u, Bottom of main loop: Offset %X, "
"Subtable->Length %X, Table->Length %X */\n",
__LINE__, Offset, Subtable->Length, Table->Length);
Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table,
Offset);
}
}

View File

@ -494,6 +494,116 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] =
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* CDAT - Coherent Device Attribute Table
*
******************************************************************************/
/* Table header (not ACPI-compliant) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdatTableHdr[] =
{
{ACPI_DMT_UINT32, ACPI_CDAT_OFFSET (Length), "CDAT Table Length", DT_LENGTH},
{ACPI_DMT_UINT8, ACPI_CDAT_OFFSET (Revision), "Revision", 0},
{ACPI_DMT_UINT8, ACPI_CDAT_OFFSET (Checksum), "Checksum", 0},
{ACPI_DMT_UINT48, ACPI_CDAT_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_CDAT_OFFSET (Sequence), "Sequence", 0},
ACPI_DMT_TERMINATOR
};
/* Common subtable header */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdatHeader[] =
{
{ACPI_DMT_CDAT, ACPI_CDATH_OFFSET (Type), "Subtable Type", 0},
{ACPI_DMT_UINT8, ACPI_CDATH_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT16, ACPI_CDATH_OFFSET (Length), "Length", DT_LENGTH},
ACPI_DMT_TERMINATOR
};
/* Subtable 0: Device Scoped Memory Affinity Structure (DSMAS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat0[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT0_OFFSET (DsmadHandle), "DSMAD Handle", 0},
{ACPI_DMT_UINT8, ACPI_CDAT0_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_UINT16, ACPI_CDAT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CDAT0_OFFSET (DpaBaseAddress), "DPA Base Address", 0},
{ACPI_DMT_UINT64, ACPI_CDAT0_OFFSET (DpaLength), "DPA Length", 0},
ACPI_DMT_TERMINATOR
};
/* Subtable 1: Device scoped Latency and Bandwidth Information Structure (DSLBIS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat1[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT1_OFFSET (Handle), "Handle", 0},
{ACPI_DMT_UINT8, ACPI_CDAT1_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_UINT8, ACPI_CDAT1_OFFSET (DataType), "Data Type", 0},
{ACPI_DMT_UINT8, ACPI_CDAT1_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CDAT1_OFFSET (EntryBaseUnit), "Entry Base Unit", 0},
{ACPI_DMT_UINT16, ACPI_CDAT1_OFFSET (Entry[0]), "Entry0", 0},
{ACPI_DMT_UINT16, ACPI_CDAT1_OFFSET (Entry[1]), "Entry1", 0},
{ACPI_DMT_UINT16, ACPI_CDAT1_OFFSET (Entry[2]), "Entry2", 0},
{ACPI_DMT_UINT16, ACPI_CDAT1_OFFSET (Reserved2), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
/* Subtable 2: Device Scoped Memory Side Cache Information Structure (DSMSCIS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat2[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT2_OFFSET (DsmasHandle), "DSMAS Handle", 0},
{ACPI_DMT_UINT24, ACPI_CDAT2_OFFSET (Reserved[3]), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CDAT2_OFFSET (SideCacheSize), "Side Cache Size", 0},
{ACPI_DMT_UINT32, ACPI_CDAT2_OFFSET (CacheAttributes), "Cache Attributes", 0},
ACPI_DMT_TERMINATOR
};
/* Subtable 3: Device Scoped Initiator Structure (DSIS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat3[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT3_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_UINT8, ACPI_CDAT3_OFFSET (Handle), "Handle", 0},
{ACPI_DMT_UINT16, ACPI_CDAT3_OFFSET (Reserved), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
/* Subtable 4: Device Scoped EFI Memory Type Structure (DSEMTS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat4[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT4_OFFSET (DsmasHandle), "DSMAS Handle", 0},
{ACPI_DMT_UINT8, ACPI_CDAT4_OFFSET (MemoryType), "Memory Type", 0},
{ACPI_DMT_UINT16, ACPI_CDAT4_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CDAT4_OFFSET (DpaOffset), "DPA Offset", 0},
{ACPI_DMT_UINT64, ACPI_CDAT4_OFFSET (RangeLength), "DPA Range Length", 0},
ACPI_DMT_TERMINATOR
};
/* Subtable 5: Switch Scoped Latency and Bandwidth Information Structure (SSLBIS) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdat5[] =
{
{ACPI_DMT_UINT8, ACPI_CDAT5_OFFSET (DataType), "Data Type", 0},
{ACPI_DMT_UINT24, ACPI_CDAT5_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CDAT5_OFFSET (EntryBaseUnit), "Entry Base Unit", 0},
ACPI_DMT_TERMINATOR
};
/* Switch Scoped Latency and Bandwidth Entry (SSLBE) (For subtable 5 above) */
ACPI_DMTABLE_INFO AcpiDmTableInfoCdatEntries[] =
{
{ACPI_DMT_UINT16, ACPI_CDATE_OFFSET (PortxId), "Port X Id", 0},
{ACPI_DMT_UINT16, ACPI_CDATE_OFFSET (PortyId), "Port Y Id", 0},
{ACPI_DMT_UINT16, ACPI_CDATE_OFFSET (LatencyOrBandwidth), "Latency or Bandwidth", 0},
{ACPI_DMT_UINT16, ACPI_CDATE_OFFSET (Reserved), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*

View File

@ -412,6 +412,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] =
{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_FLAG3, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "Proximity Domain Valid", 0},
{ACPI_DMT_FLAG4, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "DeviceID Valid", 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},
@ -1652,11 +1653,13 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[] =
*
******************************************************************************/
/* Common subtable header */
ACPI_DMTABLE_INFO AcpiDmTableInfoPhatHdr[] =
{
{ACPI_DMT_PHAT, ACPI_PHATH_OFFSET (Type), "Subtable Type", 0},
{ACPI_DMT_UINT16, ACPI_PHATH_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT8, ACPI_PHATH_OFFSET (Revision), "Revision", 0},
{ACPI_DMT_PHAT, ACPI_PHATH_OFFSET (Type), "Subtable Type", 0},
{ACPI_DMT_UINT16, ACPI_PHATH_OFFSET (Length), "Length", DT_LENGTH},
{ACPI_DMT_UINT8, ACPI_PHATH_OFFSET (Revision), "Revision", 0},
ACPI_DMT_TERMINATOR
};
@ -1664,16 +1667,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPhatHdr[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0[] =
{
{ACPI_DMT_UINT24, ACPI_PHAT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_PHAT0_OFFSET (ElementCount), "Element Count", 0},
{ACPI_DMT_UINT24, ACPI_PHAT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_PHAT0_OFFSET (ElementCount), "Element Count", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0a[] =
{
{ACPI_DMT_UUID, ACPI_PHAT0A_OFFSET (Guid), "GUID", 0},
{ACPI_DMT_UINT64, ACPI_PHAT0A_OFFSET (VersionValue), "Version Value", 0},
{ACPI_DMT_UINT32, ACPI_PHAT0A_OFFSET (ProducerId), "Producer ID", 0},
{ACPI_DMT_UUID, ACPI_PHAT0A_OFFSET (Guid), "GUID", 0},
{ACPI_DMT_UINT64, ACPI_PHAT0A_OFFSET (VersionValue), "Version Value", 0},
{ACPI_DMT_UINT32, ACPI_PHAT0A_OFFSET (ProducerId), "Producer ID", 0},
ACPI_DMT_TERMINATOR
};
@ -1681,22 +1684,22 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0a[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1[] =
{
{ACPI_DMT_UINT16, ACPI_PHAT1_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT8, ACPI_PHAT1_OFFSET (Health), "Health", 0},
{ACPI_DMT_UUID, ACPI_PHAT1_OFFSET (DeviceGuid), "Device GUID", 0},
{ACPI_DMT_UINT32, ACPI_PHAT1_OFFSET (DeviceSpecificOffset), "Device specific offset", 0},
{ACPI_DMT_UINT16, ACPI_PHAT1_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT8, ACPI_PHAT1_OFFSET (Health), "Health", 0},
{ACPI_DMT_UUID, ACPI_PHAT1_OFFSET (DeviceGuid), "Device GUID", 0},
{ACPI_DMT_UINT32, ACPI_PHAT1_OFFSET (DeviceSpecificOffset), "Device-Specific Offset", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1a[] =
{
{ACPI_DMT_STRING, 0, "Namepath", 0},
{ACPI_DMT_UNICODE, 0, "Device Path", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoPhat1b[] =
{
{ACPI_DMT_RAW_BUFFER, 0, "Vendor Data", 0},
{ACPI_DMT_RAW_BUFFER, 0, "Device-Specific Data", DT_OPTIONAL},
ACPI_DMT_TERMINATOR
};
@ -1895,7 +1898,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPrmtHandler[] =
{ACPI_DMT_UINT16, ACPI_PRMT1_OFFSET (Length), "Length", 0},
{ACPI_DMT_UUID, ACPI_PRMT1_OFFSET (HandlerGuid[0]), "Handler GUID", 0},
{ACPI_DMT_UINT64, ACPI_PRMT1_OFFSET (HandlerAddress), "Handler address", 0},
{ACPI_DMT_UINT64, ACPI_PRMT1_OFFSET (StaticDataBufferAddress),"Satic Data Address", 0},
{ACPI_DMT_UINT64, ACPI_PRMT1_OFFSET (StaticDataBufferAddress),"Static Data Address", 0},
{ACPI_DMT_UINT64, ACPI_PRMT1_OFFSET (AcpiParamBufferAddress), "ACPI Parameter Address", 0},
ACPI_DMT_NEW_LINE,
ACPI_DMT_TERMINATOR

View File

@ -190,6 +190,23 @@
* Each entry is of the form: <Field Type, Field Offset, Field Name>
*/
/*******************************************************************************
*
* CCEL - CC-Event Log Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoCcel[] =
{
{ACPI_DMT_UINT8, ACPI_CCEL_OFFSET (CCType), "CC Type", 0},
{ACPI_DMT_UINT8, ACPI_CCEL_OFFSET (CCSubType), "CC Sub Type", 0},
{ACPI_DMT_UINT32, ACPI_CCEL_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_CCEL_OFFSET (LogAreaMinimumLength), "Log Area Minimum Length", 0},
{ACPI_DMT_UINT64, ACPI_CCEL_OFFSET (LogAreaStartAddress), "Log Area Start Address", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* SLIC - Software Licensing Description Table. This table contains the standard

View File

@ -153,6 +153,7 @@
#include "aslcompiler.y.h"
#include <contrib/dev/acpica/include/amlcode.h>
#include <contrib/dev/acpica/include/acconvert.h>
#include <contrib/dev/acpica/include/actbinfo.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcodegen")
@ -181,6 +182,10 @@ static void
CgUpdateHeader (
ACPI_PARSE_OBJECT *Op);
static void
CgUpdateCdatHeader (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@ -207,7 +212,14 @@ CgGenerateAmlOutput (
CgAmlWriteWalk, NULL, NULL);
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);
CgUpdateHeader (AslGbl_CurrentDB);
if (AcpiGbl_CDAT)
{
CgUpdateCdatHeader (AslGbl_CurrentDB);
}
else
{
CgUpdateHeader (AslGbl_CurrentDB);
}
}
@ -656,6 +668,67 @@ CgWriteTableHeader (
}
/*******************************************************************************
*
* FUNCTION: CgUpdateCdatHeader
*
* PARAMETERS: Op - Op for the Definition Block
*
* RETURN: None.
*
* DESCRIPTION: Complete the ACPI table by calculating the checksum and
* re-writing the header for the input definition block
*
******************************************************************************/
static void
CgUpdateCdatHeader (
ACPI_PARSE_OBJECT *Op)
{
signed char Sum;
UINT32 i;
UINT32 Length;
UINT8 FileByte;
UINT8 Checksum;
/* Calculate the checksum over the entire definition block */
Sum = 0;
Length = sizeof (ACPI_TABLE_CDAT) + Op->Asl.AmlSubtreeLength;
FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset);
for (i = 0; i < Length; i++)
{
if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,
"Table length is greater than size of the input file");
return;
}
Sum = (signed char) (Sum + FileByte);
}
Checksum = (UINT8) (0 - Sum);
DbgPrint (ASL_DEBUG_OUTPUT, "Computed checksum = %X\n", Checksum);
/* Re-write the checksum byte */
FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset +
ACPI_CDAT_OFFSET (Checksum));
FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1);
/*
* Seek to the end of the file. This is done to support multiple file
* compilation. Doing this simplifies other parts of the codebase because
* it eliminates the need to seek for a different starting place.
*/
FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + Length);
}
/*******************************************************************************
*
* FUNCTION: CgUpdateHeader

View File

@ -241,7 +241,7 @@ CmDoCompile (
if (AslGbl_SyntaxError)
{
fprintf (stderr,
AslError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
"Compiler aborting due to parser-detected syntax error(s)\n");
/* Flag this error in the FileNode for compilation summary */
@ -250,6 +250,8 @@ CmDoCompile (
FileNode->ParserErrorDetected = TRUE;
AslGbl_ParserErrorDetected = TRUE;
LsDumpParseTree ();
AePrintErrorLog(ASL_FILE_STDERR);
goto ErrorExit;
}
@ -267,6 +269,8 @@ CmDoCompile (
goto ErrorExit;
}
AePrintErrorLog(ASL_FILE_STDERR);
/* Flush out any remaining source after parse tree is complete */
Event = UtBeginEvent ("Flush source input");
@ -283,10 +287,13 @@ CmDoCompile (
LsDumpParseTree ();
AslGbl_ParserErrorDetected = FALSE;
AslGbl_SyntaxError = FALSE;
UtEndEvent (Event);
UtEndEvent (FullCompile);
return (AE_OK);
AslGbl_ParserErrorDetected = FALSE;
AslGbl_SyntaxError = FALSE;
ErrorExit:
UtEndEvent (FullCompile);
return (AE_ERROR);
@ -919,7 +926,6 @@ CmCleanupAndExit (
ASL_MAX_ERROR_COUNT);
}
AslGbl_ExceptionCount[ASL_ERROR] = 0;
UtDisplaySummary (ASL_FILE_STDOUT);
/*

View File

@ -1033,7 +1033,6 @@ AslLogNewError (
exit(1);
}
AslGbl_ExceptionCount[ASL_ERROR] = 0;
return;
}

View File

@ -261,6 +261,7 @@ Usage (
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML");
ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)");
ACPI_OPTION ("-ds <signature(4)>", "Specify a table signature(4) (CDAT table only)");
ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");

View File

@ -152,6 +152,7 @@
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/include/acapps.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acglobal.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asloption")
@ -176,7 +177,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|t|T+G^v^w|x:z"
#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|:t|T+G^v^w|x:z"
/*******************************************************************************
@ -270,7 +271,7 @@ AslDoOptions (
BOOLEAN IsResponseFile)
{
ACPI_STATUS Status;
UINT32 j;
INT32 j;
/* Get the command line options */
@ -366,7 +367,6 @@ AslDoOptions (
{
return (-1);
}
AslGbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
break;
@ -445,6 +445,28 @@ AslDoOptions (
AcpiGbl_CstyleDisassembly = FALSE;
break;
case 's': /* Specify table signature (Only supported for CDAT table) */
/* Get the required argument */
if (AcpiGetoptArgument (argc, argv))
{
return (-1);
}
/* Check for exact string "CDAT" (upper or lower case) */
AcpiGbl_CDAT = ACPI_CAST_PTR (char, &AcpiGbl_Optarg);
if (AcpiUtStricmp (AcpiGbl_Optarg, ACPI_SIG_CDAT))
{
printf ("\nUnknown table signature: %s\n", AcpiGbl_Optarg);
return (-1);
}
AcpiGbl_CDAT = malloc (5);
AcpiUtSafeStrncpy ((char *) AcpiGbl_CDAT, ACPI_SIG_CDAT, 5);
break;
default:
printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
@ -837,7 +859,7 @@ AslDoOptions (
AslGbl_HexOutputFlag = HEX_OUTPUT_C;
break;
case 'p': /* data table flex/bison prototype */
case 'p': /* data table flex/bison prototype */
AslGbl_DtLexBisonPrototype = TRUE;
break;

View File

@ -563,7 +563,7 @@ ApCheckForPredefinedName (
if (Name[0] == 0)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"zero length name found");
"Zero length name found");
}
/* All reserved names are prefixed with a single underscore */

View File

@ -166,9 +166,17 @@ PrTreePruneWalk (
void *Context);
static void
<<<<<<< HEAD:sys/contrib/dev/acpica/compiler/aslprune.c
PrPrintObjectAtLevel (
UINT32 Level,
const char *ObjectName);
=======
AhDisplayUsage (
void);
#define AH_UTILITY_NAME "ACPI Help Utility"
#define AH_SUPPORTED_OPTIONS "adeghikmopstuv^x"
>>>>>>> a799bdd9d50e (Import ACPICA 20221020):source/tools/acpihelp/ahmain.c
/* Structure used for the pruning parse tree walk */

View File

@ -317,7 +317,7 @@ AslDetectSourceFileType (
else
{
fprintf (stderr,
"Binary file does not contain a valid ACPI table\n");
"Binary file does not contain a valid standard ACPI table\n");
}
Type = ASL_INPUT_TYPE_BINARY;

View File

@ -451,6 +451,48 @@ DtCompileDataTable (
return (Status);
}
/*
* If the first field is named "CDAT Table Length" (not "Signature"),
* assume that we have a CDAT table (whose table header does not have
* a signature). Instead, the TableLength field is where the
* signature would (normally) be.
*/
else if (!strcmp ((*FieldList)->Name, "CDAT Table Length"))
{
/* No longer true: (However, use this technique in the disassembler)
* We are assuming that there
* should be at least one non-ASCII byte in the 4-character
* Signature field, (At least the high-order byte should be zero).
*/
Status = DtCompileTable (FieldList, AcpiDmTableInfoCdatTableHdr,
&AslGbl_RootTable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Compile the CDAT */
DtPushSubtable (AslGbl_RootTable);
Status = DtCompileCdat ((void **) FieldList);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* Set the overall table length and the table checksum.
* The entire compiled table (including the CDAT table header with
* the table length and checksum) is in AslGbl_RootTable->Buffer.
*/
DtSetTableLength ();
DtSetTableChecksum (&ACPI_CAST_PTR (ACPI_TABLE_CDAT, AslGbl_RootTable->Buffer)->Checksum);
DtDumpFieldList (RootField);
DtDumpSubtableList ();
return (AE_OK);
}
/*
* All other tables must use the common ACPI table header. Insert the
* current iASL IDs (name, version), and compile the header now.

View File

@ -577,6 +577,14 @@ ACPI_STATUS
DtCompileAsf (
void **PFieldList);
ACPI_STATUS
DtCompileCdat (
void **PFieldList);
ACPI_STATUS
DtCompileCedt (
void **PFieldList);
ACPI_STATUS
DtCompileCpep (
void **PFieldList);
@ -773,6 +781,8 @@ extern const unsigned char TemplateBoot[];
extern const unsigned char TemplateBdat[];
extern const unsigned char TemplateBert[];
extern const unsigned char TemplateBgrt[];
extern const unsigned char TemplateCcel[];
extern const unsigned char TemplateCdat[];
extern const unsigned char TemplateCedt[];
extern const unsigned char TemplateCpep[];
extern const unsigned char TemplateCsrt[];

View File

@ -952,7 +952,7 @@ DtDumpBuffer (
UINT8 BufChar;
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d %3d] ",
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d %3.3Xh] ",
Offset, Offset, Length);
i = 0;

View File

@ -655,6 +655,133 @@ DtCompileAsf (
}
/******************************************************************************
*
* FUNCTION: DtCompileCdat
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile CDAT.
*
*****************************************************************************/
ACPI_STATUS
DtCompileCdat (
void **List)
{
ACPI_STATUS Status = AE_OK;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_CDAT_HEADER *CdatHeader;
ACPI_DMTABLE_INFO *InfoTable = NULL;
DT_FIELD *SubtableStart;
/* Walk the parse tree.
*
* Note: Main table consists of only the CDAT table header
* (This is not the standard ACPI table header, however)--
* Followed by some number of subtables.
*/
while (*PFieldList)
{
SubtableStart = *PFieldList;
/* Compile the expected CDAT Subtable header */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoCdatHeader,
&Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DtPushSubtable (Subtable);
CdatHeader = ACPI_CAST_PTR (ACPI_CDAT_HEADER, Subtable->Buffer);
/* Decode the subtable by type */
switch (CdatHeader->Type)
{
case ACPI_CDAT_TYPE_DSMAS:
InfoTable = AcpiDmTableInfoCdat0;
break;
case ACPI_CDAT_TYPE_DSLBIS:
InfoTable = AcpiDmTableInfoCdat1;
break;
case ACPI_CDAT_TYPE_DSMSCIS:
InfoTable = AcpiDmTableInfoCdat2;
break;
case ACPI_CDAT_TYPE_DSIS:
InfoTable = AcpiDmTableInfoCdat3;
break;
case ACPI_CDAT_TYPE_DSEMTS:
InfoTable = AcpiDmTableInfoCdat4;
break;
case ACPI_CDAT_TYPE_SSLBIS:
InfoTable = AcpiDmTableInfoCdat5;
break;
default:
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "CDAT");
}
/* Compile the CDAT subtable */
Status = DtCompileTable (PFieldList, InfoTable, &Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
switch (CdatHeader->Type)
{
/* Multiple entries supported for this type */
case ACPI_CDAT_TYPE_SSLBIS:
/*
* Check for multiple SSLBEs
*/
while (*PFieldList && !AcpiUtStricmp ((*PFieldList)->Name, "Port X ID"))
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoCdatEntries, &Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
}
break;
default:
break;
}
/* Pop off the CDAT Subtable header subtree */
DtPopSubtable ();
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtCompileCedt
@ -2592,7 +2719,6 @@ DtCompileIvrs (
DtInsertSubtable (MainSubtable, Subtable);
DtPushSubtable (Subtable);
ParentTable = MainSubtable;
break;
case ACPI_IVRS_TYPE_HID:

View File

@ -825,6 +825,7 @@ DtCompileNhlt (
ACPI_NHLT_FORMATS_CONFIG *FormatsConfig;
ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D *ConfigSpecific;
ACPI_NHLT_DEVICE_INFO_COUNT *DeviceInfo;
ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B *Terminator;
/* Main table */
@ -1088,7 +1089,7 @@ DtCompileNhlt (
* some non documeneted structure(s) yet to be processed. First, get
* the count of such structure(s).
*/
if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Device Info struct count")))
{
/* Get the count of non documented structures */
@ -1124,9 +1125,8 @@ DtCompileNhlt (
DtInsertSubtable (ParentTable, Subtable);
} /* for (j = 0; j < LinuxSpecificCount; j++) */
/* Undocumented data at the end of endpoint */
if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Bytes")))
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
&Subtable);
@ -1148,7 +1148,7 @@ DtCompileNhlt (
* All Endpoint Descriptors are completed.
* Do the table terminator specific config (not in NHLT spec, optional)
*/
if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Capabilities Size")))
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5b,
&Subtable);
@ -1160,15 +1160,20 @@ DtCompileNhlt (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a,
&Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Terminator = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Subtable->Buffer);
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
if (Terminator->CapabilitiesSize)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a,
&Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
}
}
return (AE_OK);
@ -1369,19 +1374,30 @@ DtCompilePhat (
ACPI_PHAT_HEADER *PhatHeader;
ACPI_DMTABLE_INFO *Info;
ACPI_PHAT_VERSION_DATA *VersionData;
UINT32 DeviceDataLength;
UINT32 RecordCount;
DT_FIELD *DataOffsetField;
DT_FIELD *DevicePathField;
UINT32 TableOffset = 0;
UINT32 DataOffsetValue;
UINT32 i;
/* The table consist of subtables */
/* The table consists of subtables */
while (*PFieldList)
{
/* Compile the common subtable header */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhatHdr, &Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
TableOffset += Subtable->Length;
DbgPrint (ASL_DEBUG_OUTPUT, "0 Subtable->Length: %X\n", Subtable->Length);
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DtPushSubtable (Subtable);
@ -1392,12 +1408,66 @@ DtCompilePhat (
{
case ACPI_PHAT_TYPE_FW_VERSION_DATA:
/* Compile the middle portion of the Firmware Version Data */
Info = AcpiDmTableInfoPhat0;
PhatHeader->Length = sizeof (ACPI_PHAT_VERSION_DATA);
DataOffsetField = NULL;
break;
case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
DbgPrint (ASL_DEBUG_OUTPUT, "1 Offset: %X, Name: \"%s\" Length: %X\n",
(*PFieldList)->TableOffset, (*PFieldList)->Name, Subtable->Length);
DataOffsetField = *PFieldList;
/* Walk the field list to get to the "Device-specific data Offset" field */
TableOffset = sizeof (ACPI_PHAT_HEALTH_DATA);
for (i = 0; i < 3; i++)
{
DataOffsetField = DataOffsetField->Next;
DbgPrint (ASL_DEBUG_OUTPUT, "2 Offset: %X, Name: \"%s\" Length: %X Value: %s:\n",
TableOffset, DataOffsetField->Name, DataOffsetField->StringLength, DataOffsetField->Value);
}
/* Convert DataOffsetField->Value (a char * string) to an integer value */
sscanf (DataOffsetField->Value, "%X", &DataOffsetValue);
/*
* Get the next field (Device Path):
* DataOffsetField points to "Device-Specific Offset", next field is
* "Device Path".
*/
DevicePathField = DataOffsetField->Next;
/* Compute the size of the input ASCII string as a unicode string (*2 + 2) */
DevicePathField->StringLength = (strlen ((const char *) DevicePathField->Value) * 2) + 2;
TableOffset += DevicePathField->StringLength;
DbgPrint (ASL_DEBUG_OUTPUT, "3 Offset: %X, Length: %X devicepathLength: %X\n",
TableOffset, Subtable->Length, DevicePathField->StringLength);
/* Set the DataOffsetField to the current TableOffset */
/* Must set the DataOffsetField here (not later) */
if (DataOffsetValue != 0)
{
snprintf (DataOffsetField->Value, Subtable->Length, "%X", TableOffset);
}
DbgPrint (ASL_DEBUG_OUTPUT, "4 Offset: %X, Length: %X\n", TableOffset, Subtable->Length);
DbgPrint (ASL_DEBUG_OUTPUT, "5 TableOffset: %X, DataOffsetField->StringLength: "
"%X DevicePathField Length: %X DevicePathField->Value: %s, DataOffsetField->Value: %s DataOffsetField->ByteOffset %X\n",
TableOffset, DataOffsetField->StringLength, DevicePathField->StringLength,
DevicePathField->Value, DataOffsetField->Value, DataOffsetField->ByteOffset);
/* Compile the middle portion of the Health Data Record */
Info = AcpiDmTableInfoPhat1;
PhatHeader->Length = sizeof (ACPI_PHAT_HEALTH_DATA);
break;
@ -1406,16 +1476,19 @@ DtCompilePhat (
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, *PFieldList, "PHAT");
return (AE_ERROR);
break;
}
/* Compile either the Version Data or the Health Data */
Status = DtCompileTable (PFieldList, Info, &Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DbgPrint (ASL_DEBUG_OUTPUT, "6 Offset: %X, Name: \"%s\" SubtableLength: %X\n",
TableOffset /* - StartTableOffset*/, (*PFieldList)->Name, Subtable->Length);
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
@ -1427,6 +1500,8 @@ DtCompilePhat (
(Subtable->Buffer - sizeof (ACPI_PHAT_HEADER)));
RecordCount = VersionData->ElementCount;
/* Compile all of the Version Elements */
while (RecordCount)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat0a,
@ -1435,17 +1510,29 @@ DtCompilePhat (
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
TableOffset += Subtable->Length;
RecordCount--;
PhatHeader->Length += sizeof (ACPI_PHAT_VERSION_ELEMENT);
}
DtPopSubtable ();
break;
case ACPI_PHAT_TYPE_FW_HEALTH_DATA:
/* Compile device path */
/* Compile the Device Path */
DeviceDataLength = Subtable->Length;
TableOffset += Subtable->Length;
DbgPrint (ASL_DEBUG_OUTPUT, "7 Device Path Length: %X FieldName: \"%s\" FieldLength: "
"%s FieldValue: %s SubtableLength: %X TableOffset: %X\n", DeviceDataLength,
(*PFieldList)->Name, DataOffsetField->Value, (*PFieldList)->Value,
Subtable->Length, TableOffset);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat1a, &Subtable);
if (ACPI_FAILURE (Status))
@ -1455,20 +1542,58 @@ DtCompilePhat (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
PhatHeader->Length += (UINT16) Subtable->Length;
/* *PFieldList will be null if previous field was at the end-of-ParseTree (EOF) */
/* Compile vendor specific data */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat1b, &Subtable);
if (ACPI_FAILURE (Status))
if (!*PFieldList)
{
return (Status);
DbgPrint (ASL_DEBUG_OUTPUT, "8 Exit on end-of-ParseTree\n");
return (AE_OK);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DbgPrint (ASL_DEBUG_OUTPUT, "9 Device Data Length: %X FieldName: \"%s"
" TableOffset: %X FieldLength: %X Field Value: %s SubtableLength: %X\n",
DeviceDataLength, (*PFieldList)->Name, TableOffset,
(*PFieldList)->StringLength, (*PFieldList)->Value, Subtable->Length);
PhatHeader->Length += (UINT16) Subtable->Length;
/* Convert DataOffsetField->Value (a hex char * string) to an integer value */
sscanf (DataOffsetField->Value, "%X", &DataOffsetValue);
DbgPrint (ASL_DEBUG_OUTPUT, "10 Device-Specific Offset: %X Table Offset: %X\n",
DataOffsetValue, TableOffset);
if (DataOffsetValue != 0)
{
/* Compile Device-Specific Data - only if the Data Offset is non-zero */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoPhat1b, &Subtable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DbgPrint (ASL_DEBUG_OUTPUT, "11 Subtable: %p Table Offset: %X\n",
Subtable, TableOffset);
if (Subtable)
{
DbgPrint (ASL_DEBUG_OUTPUT, "12 Device Specific Offset: "
"%X FieldName \"%s\" SubtableLength %X\n",
DeviceDataLength, DataOffsetField->Name, Subtable->Length);
DeviceDataLength += Subtable->Length;
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
PhatHeader->Length += (UINT16) Subtable->Length;
}
}
DtPopSubtable ();
DbgPrint (ASL_DEBUG_OUTPUT, "13 FieldName: \"%s\" FieldLength: %X Field Value: %s\n",
DataOffsetField->Name, DataOffsetField->StringLength, DataOffsetField->Value);
break;
default:

View File

@ -341,6 +341,17 @@ const unsigned char TemplateBoot[] =
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00 /* 00000020 "(.. ...." */
};
const unsigned char TemplateCcel[] =
{
0x43,0x43,0x45,0x4C,0x38,0x00,0x00,0x00, /* 00000000 "CCEL8..." */
0x04,0x1C,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x30,0x09,0x21,0x20,0x00,0x00,0x00,0x00, /* 00000020 "0.! ...." */
0xEF,0xCD,0xAB,0x78,0x56,0x34,0x12,0x00, /* 00000028 "...xV4.." */
0x78,0x56,0x34,0x12,0xEF,0xCD,0xAB,0x00 /* 00000030 "xV4....." */
};
const unsigned char TemplateCedt[] =
{
0x43,0x45,0x44,0x54,0x9c,0x01,0x00,0x00, /* 00000000 "CEDT...." */
@ -397,6 +408,39 @@ const unsigned char TemplateCedt[] =
0x03,0x5e,0xba,0x00 /* 00000198 ".^.." */
};
const unsigned char TemplateCdat[] =
{
0xE4,0x00,0x00,0x00,0x01,0x0C,0x00,0x00, /* 00000000 "........" */
0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, /* 00000008 "........" */
0x03,0x00,0x08,0x00,0x04,0x56,0x00,0x00, /* 00000010 ".....V.." */
0x00,0x00,0x18,0x00,0xEF,0x01,0x00,0x00, /* 00000018 "........" */
0x89,0x67,0x45,0x23,0x01,0x00,0x00,0x00, /* 00000020 ".gE#...." */
0xAB,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x03,0x00,0x08,0x00,0x04,0x56,0x00,0x00, /* 00000030 ".....V.." */
0x01,0x00,0x18,0x00,0x44,0x04,0x64,0x00, /* 00000038 "....D.d." */
0xCD,0xAB,0x89,0x67,0x45,0x23,0x01,0x00, /* 00000040 "...gE#.." */
0x33,0x22,0x44,0x33,0x55,0x44,0x00,0x00, /* 00000048 "3"D3UD.." */
0x02,0x00,0x14,0x00,0x99,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x78,0x56,0x34,0x12, /* 00000058 "....xV4." */
0x55,0x55,0x44,0x44,0x04,0x00,0x18,0x00, /* 00000060 "UUDD...." */
0x88,0x32,0x00,0x00,0x77,0x77,0x77,0x77, /* 00000068 ".2..wwww" */
0x11,0x11,0x11,0x11,0x88,0x88,0x88,0x88, /* 00000070 "........" */
0x22,0x22,0x22,0x22,0x05,0x00,0x20,0x00, /* 00000078 """"".. ." */
0x04,0x00,0x00,0x00,0x44,0x44,0x44,0x44, /* 00000080 "....DDDD" */
0x33,0x33,0x33,0x33,0x44,0x44,0x55,0x55, /* 00000088 "3333DDUU" */
0x66,0x66,0x00,0x00,0x77,0x77,0x88,0x88, /* 00000090 "ff..ww.." */
0x99,0x99,0x00,0x00,0x05,0x00,0x18,0x00, /* 00000098 "........" */
0x04,0x00,0x00,0x00,0x22,0x22,0x22,0x22, /* 000000A0 "....""""" */
0x11,0x11,0x11,0x11,0x34,0x12,0x56,0x78, /* 000000A8 "....4.Vx" */
0x11,0x11,0x00,0x00,0x05,0x00,0x30,0x00, /* 000000B0 "......0." */
0x08,0x00,0x00,0x00,0x66,0x66,0x66,0x66, /* 000000B8 "....ffff" */
0x55,0x55,0x55,0x55,0x44,0x44,0x55,0x55, /* 000000C0 "UUUUDDUU" */
0x66,0x66,0x00,0x00,0x77,0x77,0x88,0x88, /* 000000C8 "ff..ww.." */
0x99,0x99,0x00,0x00,0xAA,0xAA,0xBB,0xBB, /* 000000D0 "........" */
0xCC,0xCC,0x00,0x00,0x55,0x55,0x44,0x44, /* 000000D8 "....UUDD" */
0x33,0x33,0x00,0x00 /* 000000E0 "33.." */
};
const unsigned char TemplateCpep[] =
{
0x43,0x50,0x45,0x50,0x34,0x00,0x00,0x00, /* 00000000 "CPEP4..." */
@ -1430,20 +1474,27 @@ const unsigned char TemplatePdtt[] =
const unsigned char TemplatePhat [] =
{
0x50,0x48,0x41,0x54,0x6F,0x00,0x00,0x00, /* 00000000 "PHATo..." */
0x01,0xC7,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x50,0x48,0x41,0x54,0xA2,0x00,0x00,0x00, /* 00000000 "PHAT...." */
0x01,0xCA,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" */
0x05,0x01,0x21,0x20,0x00,0x00,0x28,0x00, /* 00000020 "..! ..(." */
0x31,0x03,0x22,0x20,0x00,0x00,0x28,0x00, /* 00000020 "1." ..(." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000028 "........" */
0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000030 "0....].G" */
0xA6,0xB0,0x0A,0x2D,0xB9,0x40,0x82,0x49, /* 00000038 "...-.@.I" */
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01, /* 00000040 "........" */
0x0C,0x0B,0x0A,0x09,0x01,0x00,0x23,0x00, /* 00000048 "......#." */
0x0C,0x0B,0x0A,0x09,0x01,0x00,0x2E,0x00, /* 00000048 "........" */
0x00,0x00,0x00,0x00,0x30,0x05,0xAF,0x91, /* 00000050 "....0..." */
0x86,0x5D,0x0E,0x47,0xA6,0xB0,0x0A,0x2D, /* 00000058 ".].G...-" */
0xB9,0x40,0x82,0x49,0x00,0x00,0x00,0x00, /* 00000060 ".@.I...." */
0x61,0x73,0x64,0x66,0x00,0xFF,0x11 /* 00000068 "asdf..." */
0xB9,0x40,0x82,0x49,0x2A,0x00,0x00,0x00, /* 00000060 ".@.I*..." */
0x41,0x00,0x42,0x00,0x43,0x00,0x44,0x00, /* 00000068 "A.B.C.D." */
0x45,0x00,0x46,0x00,0x00,0x00,0x01,0x02, /* 00000070 "E.F....." */
0x03,0x04,0x00,0x00,0x28,0x00,0x00,0x00, /* 00000078 "....(..." */
0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x05, /* 00000080 "......0." */
0xAF,0x91,0x86,0x5D,0x0E,0x47,0xA6,0xB0, /* 00000088 "...].G.." */
0x0A,0x2D,0xB9,0x40,0x82,0x49,0x08,0x07, /* 00000090 ".-.@.I.." */
0x06,0x05,0x04,0x03,0x02,0x01,0x0C,0x0B, /* 00000098 "........" */
0x0A,0x09 /* 000000A0 ".." */
};
const unsigned char TemplatePmtt[] =

View File

@ -601,6 +601,7 @@ DtGetFieldLength (
case ACPI_DMT_AEST_XFACE:
case ACPI_DMT_AEST_XRUPT:
case ACPI_DMT_ASF:
case ACPI_DMT_CDAT:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
case ACPI_DMT_EINJACT:
@ -800,7 +801,7 @@ DtSum (
UINT8 *Sum = ReturnValue;
Checksum = AcpiTbChecksum (Subtable->Buffer, Subtable->Length);
Checksum = AcpiUtChecksum (Subtable->Buffer, Subtable->Length);
*Sum = (UINT8) (*Sum + Checksum);
}

View File

@ -190,6 +190,198 @@ AcpiDbMatchArgument (
char *UserArgument,
ACPI_DB_ARGUMENT_INFO *Arguments)
{
<<<<<<< HEAD:sys/contrib/dev/acpica/components/debugger/dbutils.c
=======
if (!ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
/* Make sure signature is all ASCII and a valid ACPI name */
if (!AcpiUtValidNameseg (Table->Signature))
{
fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
*(UINT32 *) Table->Signature);
return (FALSE);
}
/* Check for minimum table length */
if (Table->Length < sizeof (ACPI_TABLE_HEADER))
{
fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
return (FALSE);
}
}
return (TRUE);
}
/******************************************************************************
*
* FUNCTION: ApIsValidChecksum
*
* PARAMETERS: Table - Pointer to table to be validated
*
* RETURN: TRUE if the checksum appears to be valid. FALSE otherwise.
*
* DESCRIPTION: Check for a valid ACPI table checksum.
*
******************************************************************************/
BOOLEAN
ApIsValidChecksum (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_RSDP *Rsdp;
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
/*
* Checksum for RSDP.
* Note: Other checksums are computed during the table dump.
*/
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
Status = AcpiTbValidateRsdp (Rsdp);
}
else
{
/* We don't have to check for a CDAT here, since CDAT is not in the RSDT/XSDT */
Status = AcpiUtVerifyChecksum (Table, Table->Length);
}
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n",
Table->Signature);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: ApGetTableLength
*
* PARAMETERS: Table - Pointer to the table
*
* RETURN: Table length
*
* DESCRIPTION: Obtain table length according to table signature.
*
******************************************************************************/
UINT32
ApGetTableLength (
ACPI_TABLE_HEADER *Table)
{
ACPI_TABLE_RSDP *Rsdp;
/* Check if table is valid */
if (!ApIsValidHeader (Table))
{
return (0);
}
if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
return (AcpiTbGetRsdpLength (Rsdp));
}
/* Normal ACPI table */
return (Table->Length);
}
/******************************************************************************
*
* FUNCTION: ApDumpTableBuffer
*
* PARAMETERS: Table - ACPI table to be dumped
* Instance - ACPI table instance no. to be dumped
* Address - Physical address of the table
*
* RETURN: None
*
* DESCRIPTION: Dump an ACPI table in standard ASCII hex format, with a
* header that is compatible with the AcpiXtract utility.
*
******************************************************************************/
static int
ApDumpTableBuffer (
ACPI_TABLE_HEADER *Table,
UINT32 Instance,
ACPI_PHYSICAL_ADDRESS Address)
{
UINT32 TableLength;
TableLength = ApGetTableLength (Table);
/* Print only the header if requested */
if (Gbl_SummaryMode)
{
AcpiTbPrintTableHeader (Address, Table);
return (0);
}
/* Dump to binary file if requested */
if (Gbl_BinaryMode)
{
return (ApWriteToBinaryFile (Table, Instance));
}
/*
* Dump the table with header for use with acpixtract utility.
* Note: simplest to just always emit a 64-bit address. AcpiXtract
* utility can handle this.
*/
fprintf (Gbl_OutputFile, "%4.4s @ 0x%8.8X%8.8X\n",
Table->Signature, ACPI_FORMAT_UINT64 (Address));
AcpiUtDumpBufferToFile (Gbl_OutputFile,
ACPI_CAST_PTR (UINT8, Table), TableLength,
DB_BYTE_DISPLAY, 0);
fprintf (Gbl_OutputFile, "\n");
return (0);
}
/******************************************************************************
*
* FUNCTION: ApDumpAllTables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Get all tables from the RSDT/XSDT (or at least all of the
* tables that we can possibly get).
*
******************************************************************************/
int
ApDumpAllTables (
void)
{
ACPI_TABLE_HEADER *Table;
UINT32 Instance = 0;
ACPI_PHYSICAL_ADDRESS Address;
ACPI_STATUS Status;
int TableStatus;
>>>>>>> a799bdd9d50e (Import ACPICA 20221020):source/tools/acpidump/apdump.c
UINT32 i;

View File

@ -312,7 +312,8 @@ AcpiEvFixedEventInitialize (
{
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[i].EnableRegisterId,
ACPI_DISABLE_EVENT);
(i == ACPI_EVENT_PCIE_WAKE) ?
ACPI_ENABLE_EVENT : ACPI_DISABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -361,6 +362,11 @@ AcpiEvFixedEventDetect (
return (IntStatus);
}
if (FixedEnable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
FixedEnable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
else
FixedEnable |= ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
FixedEnable, FixedStatus));
@ -431,7 +437,8 @@ AcpiEvFixedEventDispatch (
{
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
(Event == ACPI_EVENT_PCIE_WAKE) ?
ACPI_ENABLE_EVENT : ACPI_DISABLE_EVENT);
ACPI_ERROR ((AE_INFO,
"No installed handler for fixed event - %s (%u), disabling",

View File

@ -329,6 +329,14 @@ AcpiEvAddressSpaceDispatch (
Ctx->SubspaceId = (UINT8) RegionObj->Region.Address;
}
if (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
{
ACPI_FFH_INFO *Ctx = HandlerDesc->AddressSpace.Context;
Ctx->Length = RegionObj->Region.Length;
Ctx->Offset = RegionObj->Region.Address;
}
/*
* We must exit the interpreter because the region setup will
* potentially execute control methods (for example, the _REG method

View File

@ -296,7 +296,8 @@ AcpiExReadDataFromField (
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT))
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE))
{
/* SMBus, GSBus, IPMI serial */
@ -469,7 +470,8 @@ AcpiExWriteDataToField (
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT))
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE))
{
/* SMBus, GSBus, IPMI serial */

View File

@ -484,6 +484,12 @@ AcpiExWriteSerialBus (
Function = ACPI_WRITE;
break;
case ACPI_ADR_SPACE_FIXED_HARDWARE:
BufferLength = ACPI_FFH_INPUT_BUFFER_SIZE;
Function = ACPI_WRITE;
break;
default:
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}

View File

@ -475,6 +475,16 @@ AcpiHwLegacyWake (
AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].StatusRegisterId,
ACPI_CLEAR_STATUS);
/* Enable pcie wake event if support */
if ((AcpiGbl_FADT.Flags & ACPI_FADT_PCI_EXPRESS_WAKE)) {
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].EnableRegisterId,
ACPI_DISABLE_EVENT);
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].StatusRegisterId,
ACPI_CLEAR_STATUS);
}
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS (Status);
}

View File

@ -724,7 +724,7 @@ AcpiTbVerifyTempTable (
{
/* Verify the checksum */
Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
Status = AcpiUtVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,

View File

@ -472,7 +472,7 @@ AcpiTbParseFadt (
* Validate the FADT checksum before we copy the table. Ignore
* checksum error as we want to try to get the DSDT and FACS.
*/
(void) AcpiTbVerifyChecksum (Table, Length);
(void) AcpiUtVerifyChecksum (Table, Length);
/* Create a local copy of the FADT in common ACPI 2.0+ format */

View File

@ -152,6 +152,8 @@
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/actables.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acutils.h>
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbprint")
@ -192,7 +194,7 @@ AcpiTbFixString (
while (Length && *String)
{
if (!isprint ((int) *String))
if (!isprint ((int) (UINT8) *String))
{
*String = '?';
}
@ -293,89 +295,3 @@ AcpiTbPrintTableHeader (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbValidateChecksum
*
* PARAMETERS: Table - ACPI table to verify
* Length - Length of entire table
*
* RETURN: Status
*
* DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
* exception on bad checksum.
*
******************************************************************************/
ACPI_STATUS
AcpiTbVerifyChecksum (
ACPI_TABLE_HEADER *Table,
UINT32 Length)
{
UINT8 Checksum;
/*
* FACS/S3PT:
* They are the odd tables, have no standard ACPI header and no checksum
*/
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT) ||
ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
{
return (AE_OK);
}
/* Compute the checksum on the table */
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
/* Checksum ok? (should be zero) */
if (Checksum)
{
ACPI_BIOS_WARNING ((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
Table->Signature, Table->Checksum,
(UINT8) (Table->Checksum - Checksum)));
#if (ACPI_CHECKSUM_ABORT)
return (AE_BAD_CHECKSUM);
#endif
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbChecksum
*
* PARAMETERS: Buffer - Pointer to memory region to be checked
* Length - Length of this memory region
*
* RETURN: Checksum (UINT8)
*
* DESCRIPTION: Calculates circular checksum of memory region.
*
******************************************************************************/
UINT8
AcpiTbChecksum (
UINT8 *Buffer,
UINT32 Length)
{
UINT8 Sum = 0;
UINT8 *End = Buffer + Length;
while (Buffer < End)
{
Sum = (UINT8) (Sum + *(Buffer++));
}
return (Sum);
}

View File

@ -471,7 +471,7 @@ AcpiTbParseRootTable (
/* Validate the root table checksum */
Status = AcpiTbVerifyChecksum (Table, Length);
Status = AcpiUtVerifyChecksum (Table, Length);
if (ACPI_FAILURE (Status))
{
AcpiOsUnmapMemory (Table, Length);

View File

@ -227,7 +227,7 @@ AcpiTbValidateRsdp (
/* Check the standard checksum */
if (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
if (AcpiUtChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
{
return (AE_BAD_CHECKSUM);
}
@ -235,7 +235,7 @@ AcpiTbValidateRsdp (
/* Check extended checksum if table version >= 2 */
if ((Rsdp->Revision >= 2) &&
(AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
(AcpiUtChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
{
return (AE_BAD_CHECKSUM);
}
@ -271,6 +271,7 @@ AcpiFindRootPointer (
UINT8 *TablePtr;
UINT8 *MemRover;
UINT32 PhysicalAddress;
UINT32 EbdaWindowSize;
ACPI_FUNCTION_TRACE (AcpiFindRootPointer);
@ -299,27 +300,40 @@ AcpiFindRootPointer (
/* EBDA present? */
if (PhysicalAddress > 0x400)
/*
* Check that the EBDA pointer from memory is sane and does not point
* above valid low memory
*/
if (PhysicalAddress > 0x400 &&
PhysicalAddress < 0xA0000)
{
/*
* 1b) Search EBDA paragraphs (EBDA is required to be a
* minimum of 1K length)
* Calculate the scan window size
* The EBDA is not guaranteed to be larger than a KiB and in case
* that it is smaller, the scanning function would leave the low
* memory and continue to the VGA range.
*/
EbdaWindowSize = ACPI_MIN(ACPI_EBDA_WINDOW_SIZE,
0xA0000 - PhysicalAddress);
/*
* 1b) Search EBDA paragraphs
*/
TablePtr = AcpiOsMapMemory (
(ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
ACPI_EBDA_WINDOW_SIZE);
EbdaWindowSize);
if (!TablePtr)
{
ACPI_ERROR ((AE_INFO,
"Could not map memory at 0x%8.8X for length %u",
PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
PhysicalAddress, EbdaWindowSize));
return_ACPI_STATUS (AE_NO_MEMORY);
}
MemRover = AcpiTbScanMemoryForRsdp (
TablePtr, ACPI_EBDA_WINDOW_SIZE);
AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
TablePtr, EbdaWindowSize);
AcpiOsUnmapMemory (TablePtr, EbdaWindowSize);
if (MemRover)
{

View File

@ -0,0 +1,335 @@
/******************************************************************************
*
* Module Name: utcksum - Support generating table checksums
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2022, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************
*
* Alternatively, you may choose to be licensed under the terms of the
* following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, you may choose to be licensed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
*****************************************************************************/
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acutils.h>
/* This module used for application-level code only */
#define _COMPONENT ACPI_CA_DISASSEMBLER
ACPI_MODULE_NAME ("utcksum")
/*******************************************************************************
*
* FUNCTION: AcpiUtVerifyChecksum
*
* PARAMETERS: Table - ACPI table to verify
* Length - Length of entire table
*
* RETURN: Status
*
* DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
* exception on bad checksum.
* Note: We don't have to check for a CDAT here, since CDAT is
* not in the RSDT/XSDT, and the CDAT table is never installed
* via ACPICA.
*
******************************************************************************/
ACPI_STATUS
AcpiUtVerifyChecksum (
ACPI_TABLE_HEADER *Table,
UINT32 Length)
{
UINT8 Checksum;
/*
* FACS/S3PT:
* They are the odd tables, have no standard ACPI header and no checksum
*/
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT) ||
ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
{
return (AE_OK);
}
/* Compute the checksum on the table */
Length = Table->Length;
Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, Table), Length, Table->Checksum);
/* Computed checksum matches table? */
if (Checksum != Table->Checksum)
{
ACPI_BIOS_WARNING ((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
Table->Signature, Table->Checksum,
Table->Checksum - Checksum));
#if (ACPI_CHECKSUM_ABORT)
return (AE_BAD_CHECKSUM);
#endif
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtVerifyCdatChecksum
*
* PARAMETERS: Table - CDAT ACPI table to verify
* Length - Length of entire table
*
* RETURN: Status
*
* DESCRIPTION: Verifies that the CDAT table checksums to zero. Optionally
* returns an exception on bad checksum.
*
******************************************************************************/
ACPI_STATUS
AcpiUtVerifyCdatChecksum (
ACPI_TABLE_CDAT *CdatTable,
UINT32 Length)
{
UINT8 Checksum;
/* Compute the checksum on the table */
Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, CdatTable),
CdatTable->Length, CdatTable->Checksum);
/* Computed checksum matches table? */
if (Checksum != CdatTable->Checksum)
{
ACPI_BIOS_WARNING ((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
AcpiGbl_CDAT, CdatTable->Checksum, Checksum));
#if (ACPI_CHECKSUM_ABORT)
return (AE_BAD_CHECKSUM);
#endif
}
CdatTable->Checksum = Checksum;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGenerateChecksum
*
* PARAMETERS: Table - Pointer to table to be checksummed
* Length - Length of the table
* OriginalChecksum - Value of the checksum field
*
* RETURN: 8 bit checksum of buffer
*
* DESCRIPTION: Computes an 8 bit checksum of the table.
*
******************************************************************************/
UINT8
AcpiUtGenerateChecksum (
void *Table,
UINT32 Length,
UINT8 OriginalChecksum)
{
UINT8 Checksum;
/* Sum the entire table as-is */
Checksum = AcpiUtChecksum ((UINT8 *) Table, Length);
/* Subtract off the existing checksum value in the table */
Checksum = (UINT8) (Checksum - OriginalChecksum);
/* Compute and return the final checksum */
Checksum = (UINT8) (0 - Checksum);
return (Checksum);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtChecksum
*
* PARAMETERS: Buffer - Pointer to memory region to be checked
* Length - Length of this memory region
*
* RETURN: Checksum (UINT8)
*
* DESCRIPTION: Calculates circular checksum of memory region.
*
******************************************************************************/
UINT8
AcpiUtChecksum (
UINT8 *Buffer,
UINT32 Length)
{
UINT8 Sum = 0;
UINT8 *End = Buffer + Length;
while (Buffer < End)
{
Sum = (UINT8) (Sum + *(Buffer++));
}
return (Sum);
}

View File

@ -287,6 +287,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
/* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS, ACPI_BITMASK_POWER_BUTTON_ENABLE},
/* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
/* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
/* ACPI_EVENT_PCIE_WAKE */ {ACPI_BITREG_PCIEXP_WAKE_STATUS, ACPI_BITREG_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
};
#endif /* !ACPI_REDUCED_HARDWARE */

View File

@ -308,7 +308,7 @@ AcpiUtRepairName (
return;
}
ACPI_COPY_NAMESEG (&OriginalName, Name);
ACPI_COPY_NAMESEG (&OriginalName, &Name[0]);
/* Check each character in the name */
@ -321,10 +321,10 @@ AcpiUtRepairName (
/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* "odd". This prevents any collisions with existing "good"
* names in the namespace.
*/
Name[i] = '*';
Name[i] = '_';
FoundBadChar = TRUE;
}
@ -335,8 +335,8 @@ AcpiUtRepairName (
if (!AcpiGbl_EnableInterpreterSlack)
{
ACPI_WARNING ((AE_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
OriginalName, Name));
"Invalid character(s) in name (0x%.8X) %p, repaired: [%4.4s]",
OriginalName, Name, &Name[0]));
}
else
{

View File

@ -335,6 +335,8 @@
#define ACPI_PRM_INPUT_BUFFER_SIZE 26
#define ACPI_FFH_INPUT_BUFFER_SIZE 256
/* _SxD and _SxW control methods */
#define ACPI_NUM_SxD_METHODS 4

View File

@ -260,6 +260,7 @@ typedef enum
ACPI_DMT_AEST_XRUPT,
ACPI_DMT_AGDI,
ACPI_DMT_ASF,
ACPI_DMT_CDAT,
ACPI_DMT_CEDT,
ACPI_DMT_DMAR,
ACPI_DMT_DMAR_SCOPE,
@ -402,6 +403,16 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoBdat[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCcel[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatTableHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatHeader[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat3[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat4[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdat5[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCdatEntries[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedtHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCedt1[];
@ -747,6 +758,14 @@ void
AcpiDmDumpAsf (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpCcel (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpCdat (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpCedt (
ACPI_TABLE_HEADER *Table);

View File

@ -167,6 +167,7 @@ ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList);
ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT);
ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader);
ACPI_INIT_GLOBAL (char *, AcpiGbl_CDAT, NULL);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX);

View File

@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20220331
#define ACPI_CA_VERSION 0x20221020
#include <contrib/dev/acpica/include/acconfig.h>
#include <contrib/dev/acpica/include/actypes.h>

View File

@ -345,16 +345,6 @@ AcpiTbPrintTableHeader(
ACPI_PHYSICAL_ADDRESS Address,
ACPI_TABLE_HEADER *Header);
UINT8
AcpiTbChecksum (
UINT8 *Buffer,
UINT32 Length);
ACPI_STATUS
AcpiTbVerifyChecksum (
ACPI_TABLE_HEADER *Table,
UINT32 Length);
void
AcpiTbCheckDsdtHeader (
void);

View File

@ -161,6 +161,7 @@
#define ACPI_BERT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BERT,f)
#define ACPI_BGRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BGRT,f)
#define ACPI_BOOT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_BOOT,f)
#define ACPI_CCEL_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CCEL,f)
#define ACPI_CPEP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CPEP,f)
#define ACPI_DBG2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBG2,f)
#define ACPI_DBGP_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_DBGP,f)
@ -233,6 +234,15 @@
#define ACPI_ASF2a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f)
#define ACPI_ASF3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f)
#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
#define ACPI_CDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_CDAT,f)
#define ACPI_CDATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_HEADER,f)
#define ACPI_CDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSMAS,f)
#define ACPI_CDAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSLBIS,f)
#define ACPI_CDAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSMSCIS,f)
#define ACPI_CDAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSIS,f)
#define ACPI_CDAT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_DSEMTS,f)
#define ACPI_CDAT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_SSLBIS,f)
#define ACPI_CDATE_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CDAT_SSLBE,f)
#define ACPI_CEDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_HEADER, f)
#define ACPI_CEDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CHBS, f)
#define ACPI_CEDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CEDT_CFMWS, f)

View File

@ -189,6 +189,7 @@
#define ACPI_SIG_HMAT "HMAT" /* Heterogeneous Memory Attributes Table */
#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */
#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table*/
#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */
#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */
@ -494,12 +495,154 @@ typedef struct acpi_table_boot
} ACPI_TABLE_BOOT;
/*******************************************************************************
*
* CDAT - Coherent Device Attribute Table
* Version 1
*
* Conforms to the "Coherent Device Attribute Table (CDAT) Specification
" (Revision 1.01, October 2020.)
*
******************************************************************************/
typedef struct acpi_table_cdat
{
UINT32 Length; /* Length of table in bytes, including this header */
UINT8 Revision; /* ACPI Specification minor version number */
UINT8 Checksum; /* To make sum of entire table == 0 */
UINT8 Reserved[6];
UINT32 Sequence; /* Used to detect runtime CDAT table changes */
} ACPI_TABLE_CDAT;
/* CDAT common subtable header */
typedef struct acpi_cdat_header
{
UINT8 Type;
UINT8 Reserved;
UINT16 Length;
} ACPI_CDAT_HEADER;
/* Values for Type field above */
enum AcpiCdatType
{
ACPI_CDAT_TYPE_DSMAS = 0,
ACPI_CDAT_TYPE_DSLBIS = 1,
ACPI_CDAT_TYPE_DSMSCIS = 2,
ACPI_CDAT_TYPE_DSIS = 3,
ACPI_CDAT_TYPE_DSEMTS = 4,
ACPI_CDAT_TYPE_SSLBIS = 5,
ACPI_CDAT_TYPE_RESERVED = 6 /* 6 through 0xFF are reserved */
};
/* Subtable 0: Device Scoped Memory Affinity Structure (DSMAS) */
typedef struct acpi_cadt_dsmas
{
UINT8 DsmadHandle;
UINT8 Flags;
UINT16 Reserved;
UINT64 DpaBaseAddress;
UINT64 DpaLength;
} ACPI_CDAT_DSMAS;
/* Flags for subtable above */
#define ACPI_CEDT_DSMAS_NON_VOLATILE (1 << 2)
/* Subtable 1: Device scoped Latency and Bandwidth Information Structure (DSLBIS) */
typedef struct acpi_cdat_dslbis
{
UINT8 Handle;
UINT8 Flags; /* If Handle matches a DSMAS handle, the definition of this field matches
* Flags field in HMAT System Locality Latency */
UINT8 DataType;
UINT8 Reserved;
UINT64 EntryBaseUnit;
UINT16 Entry[3];
UINT16 Reserved2;
} ACPI_CDAT_DSLBIS;
/* Subtable 2: Device Scoped Memory Side Cache Information Structure (DSMSCIS) */
typedef struct acpi_cdat_dsmscis
{
UINT8 DsmasHandle;
UINT8 Reserved[3];
UINT64 SideCacheSize;
UINT32 CacheAttributes;
} ACPI_CDAT_DSMSCIS;
/* Subtable 3: Device Scoped Initiator Structure (DSIS) */
typedef struct acpi_cdat_dsis
{
UINT8 Flags;
UINT8 Handle;
UINT16 Reserved;
} ACPI_CDAT_DSIS;
/* Flags for above subtable */
#define ACPI_CDAT_DSIS_MEM_ATTACHED (1 << 0)
/* Subtable 4: Device Scoped EFI Memory Type Structure (DSEMTS) */
typedef struct acpi_cdat_dsemts
{
UINT8 DsmasHandle;
UINT8 MemoryType;
UINT16 Reserved;
UINT64 DpaOffset;
UINT64 RangeLength;
} ACPI_CDAT_DSEMTS;
/* Subtable 5: Switch Scoped Latency and Bandwidth Information Structure (SSLBIS) */
typedef struct acpi_cdat_sslbis
{
UINT8 DataType;
UINT8 Reserved[3];
UINT64 EntryBaseUnit;
} ACPI_CDAT_SSLBIS;
/* Sub-subtable for above, SslbeEntries field */
typedef struct acpi_cdat_sslbe
{
UINT16 PortxId;
UINT16 PortyId;
UINT16 LatencyOrBandwidth;
UINT16 Reserved;
} ACPI_CDAT_SSLBE;
/*******************************************************************************
*
* CEDT - CXL Early Discovery Table
* Version 1
*
* Conforms to the "CXL Early Discovery Table" (CXL 2.0)
* Conforms to the "CXL Early Discovery Table" (CXL 2.0, October 2020)
*
******************************************************************************/
@ -525,7 +668,9 @@ enum AcpiCedtType
{
ACPI_CEDT_TYPE_CHBS = 0,
ACPI_CEDT_TYPE_CFMWS = 1,
ACPI_CEDT_TYPE_RESERVED = 2,
ACPI_CEDT_TYPE_CXIMS = 2,
ACPI_CEDT_TYPE_RDPAS = 3,
ACPI_CEDT_TYPE_RESERVED = 4,
};
/* Values for version field above */
@ -583,6 +728,7 @@ typedef struct acpi_cedt_cfmws_target_element
/* Values for Interleave Arithmetic field above */
#define ACPI_CEDT_CFMWS_ARITHMETIC_MODULO (0)
#define ACPI_CEDT_CFMWS_ARITHMETIC_XOR (1)
/* Values for Restrictions field above */
@ -592,6 +738,35 @@ typedef struct acpi_cedt_cfmws_target_element
#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3)
#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)
/* 2: CXL XOR Interleave Math Structure */
struct acpi_cedt_cxims {
ACPI_CEDT_HEADER Header;
UINT16 Reserved1;
UINT8 Hbig;
UINT8 NrXormaps;
UINT64 XormapList[];
};
/* 3: CXL RCEC Downstream Port Association Structure */
struct acpi_cedt_rdpas {
ACPI_CEDT_HEADER Header;
UINT8 Reserved1;
UINT16 Length;
UINT16 Segment;
UINT16 Bdf;
UINT8 Protocol;
UINT64 Address;
};
/* Masks for bdf field above */
#define ACPI_CEDT_RDPAS_BUS_MASK 0xff00
#define ACPI_CEDT_RDPAS_DEVICE_MASK 0x00f8
#define ACPI_CEDT_RDPAS_FUNCTION_MASK 0x0007
#define ACPI_CEDT_RDPAS_PROTOCOL_IO (0)
#define ACPI_CEDT_RDPAS_PROTOCOL_CACHEMEM (1)
/*******************************************************************************
*

View File

@ -171,6 +171,8 @@
#define ACPI_SIG_AGDI "AGDI" /* Arm Generic Diagnostic Dump and Reset Device Interface */
#define ACPI_SIG_APMT "APMT" /* Arm Performance Monitoring Unit table */
#define ACPI_SIG_BDAT "BDAT" /* BIOS Data ACPI Table */
#define ACPI_SIG_CCEL "CCEL" /* CC Event Log Table */
#define ACPI_SIG_CDAT "CDAT" /* Coherent Device Attribute Table */
#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */
#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */
@ -178,7 +180,6 @@
#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
#define ACPI_SIG_NHLT "NHLT" /* Non HD Audio Link Table */
@ -521,13 +522,31 @@ typedef struct acpi_table_bdat
} ACPI_TABLE_BDAT;
/*******************************************************************************
*
* CCEL - CC-Event Log
* From: "Guest-Host-Communication Interface (GHCI) for Intel
* Trust Domain Extensions (Intel TDX)". Feb 2022
*
******************************************************************************/
typedef struct acpi_table_ccel
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT8 CCType;
UINT8 CCSubType;
UINT16 Reserved;
UINT64 LogAreaMinimumLength;
UINT64 LogAreaStartAddress;
} ACPI_TABLE_CCEL;
/*******************************************************************************
*
* IORT - IO Remapping Table
*
* Conforms to "IO Remapping Table System Software on ARM Platforms",
* Document number: ARM DEN 0049E.d, Feb 2022
* Document number: ARM DEN 0049E.e, Sep 2022
*
******************************************************************************/
@ -725,6 +744,7 @@ typedef struct acpi_iort_smmu_v3
#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (3<<1)
#define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3)
#define ACPI_IORT_SMMU_V3_DEVICEID_VALID (1<<4)
typedef struct acpi_iort_pmcg
{
@ -1107,7 +1127,14 @@ enum AcpiMadtType
ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
ACPI_MADT_TYPE_MULTIPROC_WAKEUP = 16,
ACPI_MADT_TYPE_RESERVED = 17, /* 17 to 0x7F are reserved */
ACPI_MADT_TYPE_CORE_PIC = 17,
ACPI_MADT_TYPE_LIO_PIC = 18,
ACPI_MADT_TYPE_HT_PIC = 19,
ACPI_MADT_TYPE_EIO_PIC = 20,
ACPI_MADT_TYPE_MSI_PIC = 21,
ACPI_MADT_TYPE_BIO_PIC = 22,
ACPI_MADT_TYPE_LPC_PIC = 23,
ACPI_MADT_TYPE_RESERVED = 24, /* 24 to 0x7F are reserved */
ACPI_MADT_TYPE_OEM_RESERVED = 0x80 /* 0x80 to 0xFF are reserved for OEM use */
};
@ -1391,7 +1418,135 @@ typedef struct acpi_madt_multiproc_wakeup_mailbox
#define ACPI_MP_WAKE_COMMAND_WAKEUP 1
/* 17: OEM data */
/* 17: CPU Core Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_core_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT32 ProcessorId;
UINT32 CoreId;
UINT32 Flags;
} ACPI_MADT_CORE_PIC;
/* Values for Version field above */
enum AcpiMadtCorePicVersion {
ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 18: Legacy I/O Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_lio_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT64 Address;
UINT16 Size;
UINT8 Cascade[2];
UINT32 CascadeMap[2];
} ACPI_MADT_LIO_PIC;
/* Values for Version field above */
enum AcpiMadtLioPicVersion {
ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 19: HT Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_ht_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT64 Address;
UINT16 Size;
UINT8 Cascade[8];
} ACPI_MADT_HT_PIC;
/* Values for Version field above */
enum AcpiMadtHtPicVersion {
ACPI_MADT_HT_PIC_VERSION_NONE = 0,
ACPI_MADT_HT_PIC_VERSION_V1 = 1,
ACPI_MADT_HT_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 20: Extend I/O Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_eio_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT8 Cascade;
UINT8 Node;
UINT64 NodeMap;
} ACPI_MADT_EIO_PIC;
/* Values for Version field above */
enum AcpiMadtEioPicVersion {
ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 21: MSI Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_msi_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT64 MsgAddress;
UINT32 Start;
UINT32 Count;
} ACPI_MADT_MSI_PIC;
/* Values for Version field above */
enum AcpiMadtMsiPicVersion {
ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 22: Bridge I/O Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_bio_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT64 Address;
UINT16 Size;
UINT16 Id;
UINT16 GsiBase;
} ACPI_MADT_BIO_PIC;
/* Values for Version field above */
enum AcpiMadtBioPicVersion {
ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 23: LPC Interrupt Controller (ACPI 6.5) */
typedef struct acpi_madt_lpc_pic {
ACPI_SUBTABLE_HEADER Header;
UINT8 Version;
UINT64 Address;
UINT16 Size;
UINT8 Cascade;
} ACPI_MADT_LPC_PIC;
/* Values for Version field above */
enum AcpiMadtLpcPicVersion {
ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 80: OEM data */
typedef struct acpi_madt_oem_data
{

View File

@ -873,7 +873,8 @@ typedef UINT32 ACPI_EVENT_TYPE;
#define ACPI_EVENT_POWER_BUTTON 2
#define ACPI_EVENT_SLEEP_BUTTON 3
#define ACPI_EVENT_RTC 4
#define ACPI_EVENT_MAX 4
#define ACPI_EVENT_PCIE_WAKE 5
#define ACPI_EVENT_MAX 5
#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
/*
@ -1335,6 +1336,12 @@ typedef struct acpi_pcc_info {
UINT8 *InternalBuffer;
} ACPI_PCC_INFO;
/* Special Context data for FFH Opregion (ACPI 6.5) */
typedef struct acpi_ffh_info {
UINT64 Offset;
UINT64 Length;
} ACPI_FFH_INFO;
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (

View File

@ -317,6 +317,31 @@ AcpiUtCheckAndRepairAscii (
UINT32 Count);
/*
* utcksum - Checksum utilities
*/
UINT8
AcpiUtGenerateChecksum (
void *Table,
UINT32 Length,
UINT8 OriginalChecksum);
UINT8
AcpiUtChecksum (
UINT8 *Buffer,
UINT32 Length);
ACPI_STATUS
AcpiUtVerifyCdatChecksum (
ACPI_TABLE_CDAT *CdatTable,
UINT32 Length);
ACPI_STATUS
AcpiUtVerifyChecksum (
ACPI_TABLE_HEADER *Table,
UINT32 Length);
/*
* utnonansi - Non-ANSI C library functions
*/

View File

@ -211,5 +211,6 @@
#define UUID_HIERARCHICAL_DATA_EXTENSION "dbb8e3e6-5886-4ba6-8795-1319f52a966b"
#define UUID_CORESIGHT_GRAPH "3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"
#define UUID_USB4_CAPABILITIES "23a0d13a-26ab-486c-9c5f-0ffa525a575a"
#define UUID_1ST_FUNCTION_ID "893f00a6-660c-494e-bcfd-3043f4fb67c0"
#define UUID_2ND_FUNCTION_ID "107ededd-d381-4fd7-8da9-08e9a6c79644"
#endif /* __ACUUID_H__ */