diff options
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/dtutils.c')
-rw-r--r-- | sys/contrib/dev/acpica/compiler/dtutils.c | 153 |
1 files changed, 151 insertions, 2 deletions
diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 54832f7b24bf..1d4e23396967 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -150,6 +150,7 @@ *****************************************************************************/ #include <contrib/dev/acpica/compiler/aslcompiler.h> +#include <contrib/dev/acpica/compiler/dtcompiler.h> #include <contrib/dev/acpica/include/actables.h> #define _COMPONENT DT_COMPILER @@ -569,7 +570,6 @@ DtGetFieldLength ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: - case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -602,7 +602,6 @@ DtGetFieldLength ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: - case ACPI_DMT_TPM2: ByteLength = 4; break; @@ -921,3 +920,153 @@ DtWalkTableTree ( } } } + + +/******************************************************************************* + * + * FUNCTION: UtSubtableCacheCalloc + * + * PARAMETERS: None + * + * RETURN: Pointer to the buffer. Aborts on allocation failure + * + * DESCRIPTION: Allocate a subtable object buffer. Bypass the local + * dynamic memory manager for performance reasons (This has a + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +DT_SUBTABLE * +UtSubtableCacheCalloc ( + void) +{ + ASL_CACHE_INFO *Cache; + + + if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + + (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE)); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_SubtableCacheList; + Gbl_SubtableCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer); + Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE; + } + + Gbl_SubtableCount++; + return (Gbl_SubtableCacheNext++); +} + + +/******************************************************************************* + * + * FUNCTION: UtFieldCacheCalloc + * + * PARAMETERS: None + * + * RETURN: Pointer to the buffer. Aborts on allocation failure + * + * DESCRIPTION: Allocate a field object buffer. Bypass the local + * dynamic memory manager for performance reasons (This has a + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +DT_FIELD * +UtFieldCacheCalloc ( + void) +{ + ASL_CACHE_INFO *Cache; + + + if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + + (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE)); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_FieldCacheList; + Gbl_FieldCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer); + Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE; + } + + Gbl_FieldCount++; + return (Gbl_FieldCacheNext++); +} + + +/******************************************************************************* + * + * FUNCTION: DtDeleteCaches + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Delete all local cache buffer blocks + * + ******************************************************************************/ + +void +DtDeleteCaches ( + void) +{ + UINT32 BufferCount; + ASL_CACHE_INFO *Next; + + + /* Field cache */ + + BufferCount = 0; + while (Gbl_FieldCacheList) + { + Next = Gbl_FieldCacheList->Next; + ACPI_FREE (Gbl_FieldCacheList); + Gbl_FieldCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", + Gbl_FieldCount, ASL_FIELD_CACHE_SIZE, + (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); + + Gbl_FieldCount = 0; + Gbl_FieldCacheNext = NULL; + Gbl_FieldCacheLast = NULL; + + /* Subtable cache */ + + BufferCount = 0; + while (Gbl_SubtableCacheList) + { + Next = Gbl_SubtableCacheList->Next; + ACPI_FREE (Gbl_SubtableCacheList); + Gbl_SubtableCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", + Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, + (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); + + Gbl_SubtableCount = 0; + Gbl_SubtableCacheNext = NULL; + Gbl_SubtableCacheLast = NULL; +} |