ACPI-CA upstream fixes for acpica-unix-20060912 - Fix compiler warnings. (I believe some of these or similar fixes were submitted by Linux people but I do not know the current status. This is just enough fixes for FreeBSD.) debugger/dbstats.c include/acglobal.h namespace/nsparse.c tables/tbfadt.c - FreeBSD -CURRENT kernel has strstr(). include/platform/acfreebsd.h - Do not traverse reserved indexes for DSDT and FACS. - Do not load SSDTs when DSDT is overriden. (acpidump(8) generates concatenated SSDTs with DSDT.) tables/tbxface.c --- debugger/dbstats.c Mon Oct 9 19:57:45 2006 +++ debugger/dbstats.c Thu Oct 5 20:17:10 2006 @@ -141,9 +141,11 @@ void *Context, void **ReturnValue); +#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE static void AcpiDbListInfo ( ACPI_MEMORY_LIST *List); +#endif /* @@ -518,17 +520,19 @@ case CMD_STAT_MEMORY: #ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n"); + AcpiOsPrintf ("\n----Object Statistics-------------------------------------------------------\n"); AcpiDbListInfo (AcpiGbl_GlobalList); AcpiDbListInfo (AcpiGbl_NsNodeList); +#endif #ifdef ACPI_USE_LOCAL_CACHE + AcpiOsPrintf ("\n----Cache Statistics--------------------------------------------------------\n"); + AcpiDbListInfo (AcpiGbl_OperandCache); AcpiDbListInfo (AcpiGbl_PsNodeCache); AcpiDbListInfo (AcpiGbl_PsNodeExtCache); AcpiDbListInfo (AcpiGbl_StateCache); -#endif #endif break; --- include/acglobal.h Mon Oct 9 19:57:45 2006 +++ include/acglobal.h Mon Oct 2 18:13:54 2006 @@ -322,11 +322,13 @@ /* Exception codes */ +#ifndef DEFINE_ACPI_GLOBALS extern char const *AcpiGbl_ExceptionNames_Env[]; extern char const *AcpiGbl_ExceptionNames_Pgm[]; extern char const *AcpiGbl_ExceptionNames_Tbl[]; extern char const *AcpiGbl_ExceptionNames_Aml[]; extern char const *AcpiGbl_ExceptionNames_Ctrl[]; +#endif /***************************************************************************** --- include/platform/acfreebsd.h Mon Oct 9 19:57:46 2006 +++ include/platform/acfreebsd.h Mon Oct 2 17:22:10 2006 @@ -176,7 +176,7 @@ /* Always use FreeBSD code over our local versions */ #define ACPI_USE_SYSTEM_CLIBRARY -#ifdef _KERNEL +#if defined(_KERNEL) && (__FreeBSD_version < 700020) /* Or strstr (used in debugging mode, also move to libkern) */ static __inline char * strstr(char *s, char *find) --- namespace/nsparse.c Mon Oct 9 19:57:46 2006 +++ namespace/nsparse.c Tue Oct 3 14:19:44 2006 @@ -211,7 +211,7 @@ /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %lu parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (ParseRoot); --- tables/tbfadt.c Mon Oct 9 19:57:46 2006 +++ tables/tbfadt.c Tue Oct 10 12:10:13 2006 @@ -320,7 +320,7 @@ if (Length > sizeof (ACPI_TABLE_FADT)) { ACPI_WARNING ((AE_INFO, - "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%X", + "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%lX", Table->Revision, Length, sizeof (ACPI_TABLE_FADT))); } --- tables/tbxface.c Mon Oct 9 19:57:46 2006 +++ tables/tbxface.c Tue Oct 10 15:25:48 2006 @@ -516,6 +516,7 @@ ACPI_STATUS Status; ACPI_TABLE_HEADER *Table; ACPI_NATIVE_UINT i; + BOOLEAN DsdtOverriden; ACPI_FUNCTION_TRACE (TbLoadNamespace); @@ -539,6 +540,7 @@ /* * Find DSDT table */ + DsdtOverriden = FALSE; Status = AcpiOsTableOverride ( AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer, &Table); if (ACPI_SUCCESS (Status) && Table) @@ -550,6 +552,7 @@ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer = Table; AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Length = Table->Length; AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags = ACPI_TABLE_ORIGIN_UNKNOWN; + DsdtOverriden = TRUE; ACPI_INFO ((AE_INFO, "Table DSDT replaced by host OS")); AcpiTbPrintTableHeader (0, Table); @@ -579,13 +582,33 @@ * Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - for (i = 0; i < AcpiGbl_RootTableList.Count; ++i) + for (i = 2; i < AcpiGbl_RootTableList.Count; ++i) { - if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_SSDT) && - !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_PSDT)) || - ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]))) + if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + ACPI_SIG_SSDT)) + { + /* Delete SSDT when DSDT is overriden */ + + if (DsdtOverriden) + { + AcpiTbDeleteTable (i); + continue; + } + + if (ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]))) + { + continue; + } + } + else if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), + ACPI_SIG_PSDT)) + { + if (ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]))) + { + continue; + } + } + else { continue; }