https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f0dd1e7b57b7a993c3d312f53c07b9e71c979ad4
commit f0dd1e7b57b7a993c3d312f53c07b9e71c979ad4 Author: Thomas Faber <thomas.fa...@reactos.org> AuthorDate: Sat Nov 5 12:00:04 2022 -0400 Commit: Thomas Faber <thomas.fa...@reactos.org> CommitDate: Sun Nov 6 08:33:29 2022 -0500 [ACPICA] Update to version 20221020. CORE-17905 --- drivers/bus/acpi/CMakeLists.txt | 1 + drivers/bus/acpi/acpica/events/evevent.c | 11 +- drivers/bus/acpi/acpica/events/evregion.c | 8 + drivers/bus/acpi/acpica/executer/exconfig.c | 2 +- drivers/bus/acpi/acpica/executer/exfield.c | 6 +- drivers/bus/acpi/acpica/executer/exserial.c | 6 + drivers/bus/acpi/acpica/executer/exsystem.c | 12 -- drivers/bus/acpi/acpica/hardware/hwsleep.c | 10 + drivers/bus/acpi/acpica/include/acconfig.h | 2 + drivers/bus/acpi/acpica/include/acdisasm.h | 19 ++ drivers/bus/acpi/acpica/include/acglobal.h | 1 + drivers/bus/acpi/acpica/include/acpixf.h | 2 +- drivers/bus/acpi/acpica/include/actables.h | 10 - drivers/bus/acpi/acpica/include/actbinfo.h | 10 + drivers/bus/acpi/acpica/include/actbl1.h | 179 +++++++++++++++- drivers/bus/acpi/acpica/include/actbl2.h | 163 ++++++++++++++- drivers/bus/acpi/acpica/include/actypes.h | 9 +- drivers/bus/acpi/acpica/include/acutils.h | 25 +++ drivers/bus/acpi/acpica/include/acuuid.h | 3 +- .../bus/acpi/acpica/include/platform/acfreebsd.h | 4 + drivers/bus/acpi/acpica/tables/tbdata.c | 2 +- drivers/bus/acpi/acpica/tables/tbfadt.c | 2 +- drivers/bus/acpi/acpica/tables/tbprint.c | 90 +------- drivers/bus/acpi/acpica/tables/tbutils.c | 2 +- drivers/bus/acpi/acpica/tables/tbxfroot.c | 32 ++- .../{tables/tbprint.c => utilities/utcksum.c} | 232 +++++++++------------ drivers/bus/acpi/acpica/utilities/utglobal.c | 1 + drivers/bus/acpi/acpica/utilities/utstring.c | 10 +- media/doc/3rd Party Files.txt | 2 +- 29 files changed, 576 insertions(+), 280 deletions(-) diff --git a/drivers/bus/acpi/CMakeLists.txt b/drivers/bus/acpi/CMakeLists.txt index f7a3a19bf39..f9ee29be83d 100644 --- a/drivers/bus/acpi/CMakeLists.txt +++ b/drivers/bus/acpi/CMakeLists.txt @@ -137,6 +137,7 @@ list(APPEND ACPICA_SOURCE acpica/utilities/utascii.c acpica/utilities/utbuffer.c acpica/utilities/utcache.c + acpica/utilities/utcksum.c # acpica/utilities/utclib.c acpica/utilities/utcopy.c # acpica/utilities/utdebug.c diff --git a/drivers/bus/acpi/acpica/events/evevent.c b/drivers/bus/acpi/acpica/events/evevent.c index 58fca82250b..e8b35823407 100644 --- a/drivers/bus/acpi/acpica/events/evevent.c +++ b/drivers/bus/acpi/acpica/events/evevent.c @@ -204,7 +204,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); @@ -253,6 +254,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)); @@ -323,7 +329,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", diff --git a/drivers/bus/acpi/acpica/events/evregion.c b/drivers/bus/acpi/acpica/events/evregion.c index a1718aa59e7..86a2d7e0c4e 100644 --- a/drivers/bus/acpi/acpica/events/evregion.c +++ b/drivers/bus/acpi/acpica/events/evregion.c @@ -221,6 +221,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 diff --git a/drivers/bus/acpi/acpica/executer/exconfig.c b/drivers/bus/acpi/acpica/executer/exconfig.c index 17a5497e597..029371bea36 100644 --- a/drivers/bus/acpi/acpica/executer/exconfig.c +++ b/drivers/bus/acpi/acpica/executer/exconfig.c @@ -362,7 +362,7 @@ AcpiExLoadOp ( } if (Target->Common.Type != ACPI_TYPE_INTEGER) { - fprintf (stderr, "Type not integer: %X\n", Target->Common.Type); + ACPI_ERROR ((AE_INFO, "Type not integer: %X", Target->Common.Type)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } diff --git a/drivers/bus/acpi/acpica/executer/exfield.c b/drivers/bus/acpi/acpica/executer/exfield.c index abd261ed650..54887f67102 100644 --- a/drivers/bus/acpi/acpica/executer/exfield.c +++ b/drivers/bus/acpi/acpica/executer/exfield.c @@ -188,7 +188,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 */ @@ -361,7 +362,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 */ diff --git a/drivers/bus/acpi/acpica/executer/exserial.c b/drivers/bus/acpi/acpica/executer/exserial.c index ddf7c517a81..507ad1b0141 100644 --- a/drivers/bus/acpi/acpica/executer/exserial.c +++ b/drivers/bus/acpi/acpica/executer/exserial.c @@ -376,6 +376,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); } diff --git a/drivers/bus/acpi/acpica/executer/exsystem.c b/drivers/bus/acpi/acpica/executer/exsystem.c index e4f02d40ea2..38574ba805f 100644 --- a/drivers/bus/acpi/acpica/executer/exsystem.c +++ b/drivers/bus/acpi/acpica/executer/exsystem.c @@ -230,18 +230,6 @@ AcpiExSystemDoSleep ( AcpiExExitInterpreter (); - /* - * Warn users about excessive sleep times, so ASL code can be improved to - * use polling or similar techniques. - */ - if (HowLongMs > 10) - { - ACPI_WARNING ((AE_INFO, - "Firmware issue: Excessive sleep time (0x%8.8X%8.8X ms > 10 ms)" - " in ACPI Control Method", - ACPI_FORMAT_UINT64 (HowLongMs))); - } - /* * For compatibility with other ACPI implementations and to prevent * accidental deep sleeps, limit the sleep time to something reasonable. diff --git a/drivers/bus/acpi/acpica/hardware/hwsleep.c b/drivers/bus/acpi/acpica/hardware/hwsleep.c index c9385e5a079..53281830b93 100644 --- a/drivers/bus/acpi/acpica/hardware/hwsleep.c +++ b/drivers/bus/acpi/acpica/hardware/hwsleep.c @@ -367,6 +367,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); } diff --git a/drivers/bus/acpi/acpica/include/acconfig.h b/drivers/bus/acpi/acpica/include/acconfig.h index b0dd9d3cfa1..c162ee43205 100644 --- a/drivers/bus/acpi/acpica/include/acconfig.h +++ b/drivers/bus/acpi/acpica/include/acconfig.h @@ -227,6 +227,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 diff --git a/drivers/bus/acpi/acpica/include/acdisasm.h b/drivers/bus/acpi/acpica/include/acdisasm.h index 7d4d95d7ce5..863d466dc3c 100644 --- a/drivers/bus/acpi/acpica/include/acdisasm.h +++ b/drivers/bus/acpi/acpica/include/acdisasm.h @@ -152,6 +152,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, @@ -294,6 +295,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[]; @@ -639,6 +650,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); diff --git a/drivers/bus/acpi/acpica/include/acglobal.h b/drivers/bus/acpi/acpica/include/acglobal.h index f4fda22180c..ac667b5fe05 100644 --- a/drivers/bus/acpi/acpica/include/acglobal.h +++ b/drivers/bus/acpi/acpica/include/acglobal.h @@ -59,6 +59,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); diff --git a/drivers/bus/acpi/acpica/include/acpixf.h b/drivers/bus/acpi/acpica/include/acpixf.h index 18bc857b1ba..981f7086d1a 100644 --- a/drivers/bus/acpi/acpica/include/acpixf.h +++ b/drivers/bus/acpi/acpica/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20220331 +#define ACPI_CA_VERSION 0x20221020 #include "acconfig.h" #include "actypes.h" diff --git a/drivers/bus/acpi/acpica/include/actables.h b/drivers/bus/acpi/acpica/include/actables.h index 18ad21fc792..ba9b0e06936 100644 --- a/drivers/bus/acpi/acpica/include/actables.h +++ b/drivers/bus/acpi/acpica/include/actables.h @@ -237,16 +237,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); diff --git a/drivers/bus/acpi/acpica/include/actbinfo.h b/drivers/bus/acpi/acpica/include/actbinfo.h index 58223a8ea22..cf99fb0f1dd 100644 --- a/drivers/bus/acpi/acpica/include/actbinfo.h +++ b/drivers/bus/acpi/acpica/include/actbinfo.h @@ -53,6 +53,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) @@ -125,6 +126,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) diff --git a/drivers/bus/acpi/acpica/include/actbl1.h b/drivers/bus/acpi/acpica/include/actbl1.h index 6834241afbd..f2772660fc7 100644 --- a/drivers/bus/acpi/acpica/include/actbl1.h +++ b/drivers/bus/acpi/acpica/include/actbl1.h @@ -81,6 +81,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 */ @@ -386,12 +387,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) * ******************************************************************************/ @@ -417,7 +560,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 */ @@ -475,6 +620,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 */ @@ -484,6 +630,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) /******************************************************************************* * diff --git a/drivers/bus/acpi/acpica/include/actbl2.h b/drivers/bus/acpi/acpica/include/actbl2.h index 1963c92249b..0bd0e169375 100644 --- a/drivers/bus/acpi/acpica/include/actbl2.h +++ b/drivers/bus/acpi/acpica/include/actbl2.h @@ -63,6 +63,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 */ @@ -70,7 +72,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 */ @@ -413,13 +414,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 * ******************************************************************************/ @@ -617,6 +636,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 { @@ -999,7 +1019,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 */ }; @@ -1283,7 +1310,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 { diff --git a/drivers/bus/acpi/acpica/include/actypes.h b/drivers/bus/acpi/acpica/include/actypes.h index 42f31110dac..a8b206b628f 100644 --- a/drivers/bus/acpi/acpica/include/actypes.h +++ b/drivers/bus/acpi/acpica/include/actypes.h @@ -765,7 +765,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 /* @@ -1227,6 +1228,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) ( diff --git a/drivers/bus/acpi/acpica/include/acutils.h b/drivers/bus/acpi/acpica/include/acutils.h index f6b22430bc1..8193ce0948e 100644 --- a/drivers/bus/acpi/acpica/include/acutils.h +++ b/drivers/bus/acpi/acpica/include/acutils.h @@ -209,6 +209,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 */ diff --git a/drivers/bus/acpi/acpica/include/acuuid.h b/drivers/bus/acpi/acpica/include/acuuid.h index d2c49d1fcde..29fb3dc7301 100644 --- a/drivers/bus/acpi/acpica/include/acuuid.h +++ b/drivers/bus/acpi/acpica/include/acuuid.h @@ -103,5 +103,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__ */ diff --git a/drivers/bus/acpi/acpica/include/platform/acfreebsd.h b/drivers/bus/acpi/acpica/include/platform/acfreebsd.h index c02674234fb..48ca63c069e 100644 --- a/drivers/bus/acpi/acpica/include/platform/acfreebsd.h +++ b/drivers/bus/acpi/acpica/include/platform/acfreebsd.h @@ -58,6 +58,9 @@ #define ACPI_UINTPTR_T uintptr_t +#define ACPI_TO_INTEGER(p) ((uintptr_t)(p)) +#define ACPI_OFFSET(d, f) __offsetof(d, f) + #define ACPI_USE_DO_WHILE_0 #define ACPI_USE_LOCAL_CACHE #define ACPI_USE_NATIVE_DIVIDE @@ -103,6 +106,7 @@ #if __STDC_HOSTED__ #include <ctype.h> +#include <unistd.h> #endif #define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread)) diff --git a/drivers/bus/acpi/acpica/tables/tbdata.c b/drivers/bus/acpi/acpica/tables/tbdata.c index c28ad91bc96..7a56bffc0fa 100644 --- a/drivers/bus/acpi/acpica/tables/tbdata.c +++ b/drivers/bus/acpi/acpica/tables/tbdata.c @@ -616,7 +616,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, diff --git a/drivers/bus/acpi/acpica/tables/tbfadt.c b/drivers/bus/acpi/acpica/tables/tbfadt.c index af0f3934556..ff72fad9c1f 100644 --- a/drivers/bus/acpi/acpica/tables/tbfadt.c +++ b/drivers/bus/acpi/acpica/tables/tbfadt.c @@ -364,7 +364,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 */ diff --git a/drivers/bus/acpi/acpica/tables/tbprint.c b/drivers/bus/acpi/acpica/tables/tbprint.c index 78d25139b33..82bbcd8cf21 100644 --- a/drivers/bus/acpi/acpica/tables/tbprint.c +++ b/drivers/bus/acpi/acpica/tables/tbprint.c @@ -44,6 +44,8 @@ #include "acpi.h" #include "accommon.h" #include "actables.h" +#include "acdisasm.h" +#include "acutils.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbprint") @@ -84,7 +86,7 @@ AcpiTbFixString ( while (Length && *String) { - if (!isprint ((int) *String)) + if (!isprint ((int) (UINT8) *String)) { *String = '?'; } @@ -185,89 +187,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); -} diff --git a/drivers/bus/acpi/acpica/tables/tbutils.c b/drivers/bus/acpi/acpica/tables/tbutils.c index 422fb18db82..be979c888a0 100644 --- a/drivers/bus/acpi/acpica/tables/tbutils.c +++ b/drivers/bus/acpi/acpica/tables/tbutils.c @@ -363,7 +363,7 @@ AcpiTbParseRootTable ( /* Validate the root table checksum */ - Status = AcpiTbVerifyChecksum (Table, Length); + Status = AcpiUtVerifyChecksum (Table, Length); if (ACPI_FAILURE (Status)) { AcpiOsUnmapMemory (Table, Length); diff --git a/drivers/bus/acpi/acpica/tables/tbxfroot.c b/drivers/bus/acpi/acpica/tables/tbxfroot.c index 4195480d44a..5028a1dd8f6 100644 --- a/drivers/bus/acpi/acpica/tables/tbxfroot.c +++ b/drivers/bus/acpi/acpica/tables/tbxfroot.c @@ -119,7 +119,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); } @@ -127,7 +127,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); } @@ -163,6 +163,7 @@ AcpiFindRootPointer ( UINT8 *TablePtr; UINT8 *MemRover; UINT32 PhysicalAddress; + UINT32 EbdaWindowSize; ACPI_FUNCTION_TRACE (AcpiFindRootPointer); @@ -191,27 +192,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) { diff --git a/drivers/bus/acpi/acpica/tables/tbprint.c b/drivers/bus/acpi/acpica/utilities/utcksum.c similarity index 51% copy from drivers/bus/acpi/acpica/tables/tbprint.c copy to drivers/bus/acpi/acpica/utilities/utcksum.c index 78d25139b33..49625a8f42b 100644 --- a/drivers/bus/acpi/acpica/tables/tbprint.c +++ b/drivers/bus/acpi/acpica/utilities/utcksum.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: tbprint - Table output utilities + * Module Name: utcksum - Support generating table checksums * *****************************************************************************/ @@ -43,208 +43,162 @@ #include "acpi.h" #include "accommon.h" -#include "actables.h" +#include "acdisasm.h" +#include "acutils.h" -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("tbprint") +/* This module used for application-level code only */ -/* Local prototypes */ - -static void -AcpiTbFixString ( - char *String, - ACPI_SIZE Length); - -static void -AcpiTbCleanupTableHeader ( - ACPI_TABLE_HEADER *OutHeader, - ACPI_TABLE_HEADER *Header); +#define _COMPONENT ACPI_CA_DISASSEMBLER + ACPI_MODULE_NAME ("utcksum") /******************************************************************************* * - * FUNCTION: AcpiTbFixString + * FUNCTION: AcpiUtVerifyChecksum * - * PARAMETERS: String - String to be repaired - * Length - Maximum length + * PARAMETERS: Table - ACPI table to verify + * Length - Length of entire table * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Replace every non-printable or non-ascii byte in the string - * with a question mark '?'. + * 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. * ******************************************************************************/ -static void -AcpiTbFixString ( - char *String, - ACPI_SIZE Length) +ACPI_STATUS +AcpiUtVerifyChecksum ( + ACPI_TABLE_HEADER *Table, + UINT32 Length) { + UINT8 Checksum; - while (Length && *String) - { - if (!isprint ((int) *String)) - { - *String = '?'; - } - String++; - Length--; + /* + * 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 */ -/******************************************************************************* - * - * FUNCTION: AcpiTbCleanupTableHeader - * - * PARAMETERS: OutHeader - Where the cleaned header is returned - * Header - Input ACPI table header - * - * RETURN: Returns the cleaned header in OutHeader - * - * DESCRIPTION: Copy the table header and ensure that all "string" fields in - * the header consist of printable characters. - * - ******************************************************************************/ + Length = Table->Length; + Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, Table), Length, Table->Checksum); -static void -AcpiTbCleanupTableHeader ( - ACPI_TABLE_HEADER *OutHeader, - ACPI_TABLE_HEADER *Header) -{ + /* Computed checksum matches table? */ - memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); + 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)); - AcpiTbFixString (OutHeader->Signature, ACPI_NAMESEG_SIZE); - AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); - AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE); - AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAMESEG_SIZE); +#if (ACPI_CHECKSUM_ABORT) + return (AE_BAD_CHECKSUM); +#endif + } + + return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiTbPrintTableHeader + * FUNCTION: AcpiUtVerifyCdatChecksum * - * PARAMETERS: Address - Table physical address - * Header - Table header + * PARAMETERS: Table - CDAT ACPI table to verify + * Length - Length of entire table * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP. + * DESCRIPTION: Verifies that the CDAT table checksums to zero. Optionally + * returns an exception on bad checksum. * ******************************************************************************/ -void -AcpiTbPrintTableHeader ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_TABLE_HEADER *Header) +ACPI_STATUS +AcpiUtVerifyCdatChecksum ( + ACPI_TABLE_CDAT *CdatTable, + UINT32 Length) { - ACPI_TABLE_HEADER LocalHeader; + UINT8 Checksum; - if (ACPI_COMPARE_NAMESEG (Header->Signature, ACPI_SIG_FACS)) - { - /* FACS only has signature and length fields */ + /* Compute the checksum on the table */ - ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", - Header->Signature, ACPI_FORMAT_UINT64 (Address), - Header->Length)); - } - else if (ACPI_VALIDATE_RSDP_SIG (ACPI_CAST_PTR (ACPI_TABLE_RSDP, - Header)->Signature)) - { - /* RSDP has no common fields */ - - memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP, - Header)->OemId, ACPI_OEM_ID_SIZE); - AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - - ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)", - ACPI_FORMAT_UINT64 (Address), - (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, - LocalHeader.OemId)); - } - else - { - /* Standard ACPI table with full common header */ + Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, CdatTable), + CdatTable->Length, CdatTable->Checksum); + + /* Computed checksum matches table? */ - AcpiTbCleanupTableHeader (&LocalHeader, Header); + 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)); - ACPI_INFO (( - "%-4.4s 0x%8.8X%8.8X" - " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", - LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address), - LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, - LocalHeader.OemTableId, LocalHeader.OemRevision, - LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); +#if (ACPI_CHECKSUM_ABORT) + return (AE_BAD_CHECKSUM); +#endif } + + CdatTable->Checksum = Checksum; + return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiTbValidateChecksum + * FUNCTION: AcpiUtGenerateChecksum * - * PARAMETERS: Table - ACPI table to verify - * Length - Length of entire table + * PARAMETERS: Table - Pointer to table to be checksummed + * Length - Length of the table + * OriginalChecksum - Value of the checksum field * - * RETURN: Status + * RETURN: 8 bit checksum of buffer * - * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns - * exception on bad checksum. + * DESCRIPTION: Computes an 8 bit checksum of the table. * ******************************************************************************/ -ACPI_STATUS -AcpiTbVerifyChecksum ( - ACPI_TABLE_HEADER *Table, - UINT32 Length) +UINT8 +AcpiUtGenerateChecksum ( + void *Table, + UINT32 Length, + UINT8 OriginalChecksum) { UINT8 Checksum; - /* - * FACS/S3PT: - * They are the odd tables, have no standard ACPI header and no checksum - */ + /* Sum the entire table as-is */ - if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT) || - ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS)) - { - return (AE_OK); - } + Checksum = AcpiUtChecksum ((UINT8 *) Table, Length); - /* Compute the checksum on the table */ + /* Subtract off the existing checksum value in the table */ - Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length); + Checksum = (UINT8) (Checksum - OriginalChecksum); - /* Checksum ok? (should be zero) */ + /* Compute and return the final checksum */ - 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); + Checksum = (UINT8) (0 - Checksum); + return (Checksum); } /******************************************************************************* * - * FUNCTION: AcpiTbChecksum + * FUNCTION: AcpiUtChecksum * * PARAMETERS: Buffer - Pointer to memory region to be checked * Length - Length of this memory region @@ -256,7 +210,7 @@ AcpiTbVerifyChecksum ( ******************************************************************************/ UINT8 -AcpiTbChecksum ( +AcpiUtChecksum ( UINT8 *Buffer, UINT32 Length) { diff --git a/drivers/bus/acpi/acpica/utilities/utglobal.c b/drivers/bus/acpi/acpica/utilities/utglobal.c index 6126b8832aa..d8ad20f1a5a 100644 --- a/drivers/bus/acpi/acpica/utilities/utglobal.c +++ b/drivers/bus/acpi/acpica/utilities/utglobal.c @@ -179,6 +179,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 */ diff --git a/drivers/bus/acpi/acpica/utilities/utstring.c b/drivers/bus/acpi/acpica/utilities/utstring.c index 13e43423645..d8f39c6cb17 100644 --- a/drivers/bus/acpi/acpica/utilities/utstring.c +++ b/drivers/bus/acpi/acpica/utilities/utstring.c @@ -200,7 +200,7 @@ AcpiUtRepairName ( return; } - ACPI_COPY_NAMESEG (&OriginalName, Name); + ACPI_COPY_NAMESEG (&OriginalName, &Name[0]); /* Check each character in the name */ @@ -213,10 +213,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; } @@ -227,8 +227,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 { diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt index efea8ab703c..16917402132 100644 --- a/media/doc/3rd Party Files.txt +++ b/media/doc/3rd Party Files.txt @@ -69,7 +69,7 @@ URL: https://gitlab.freedesktop.org/mesa/glu, ftp://ftp.freedesktop.org/pub/mesa Title: ACPICA Path: drivers/bus/acpi/acpica -Used Version: 20220331 +Used Version: 20221020 License: GPL-2.0 (https://spdx.org/licenses/GPL-2.0.html) URL: https://acpica.org/