aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/compiler/dtutils.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2014-10-02 19:11:18 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2014-10-02 19:11:18 +0000
commit313a0c13efa638cf248e35eed49f36ec0a1a7f26 (patch)
tree49241b28d0e1f0a071c6f48d46efb05b092b011e /sys/contrib/dev/acpica/compiler/dtutils.c
parent27d6eee170ad3f4c78841505514dc1a9574215c8 (diff)
parentd4e301bc21b6911ed7f5d6a86659c4882fa7ab55 (diff)
downloadsrc-313a0c13efa638cf248e35eed49f36ec0a1a7f26.tar.gz
src-313a0c13efa638cf248e35eed49f36ec0a1a7f26.zip
Merge ACPICA 20140926.
Notes
Notes: svn path=/head/; revision=272444
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/dtutils.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/dtutils.c188
1 files changed, 137 insertions, 51 deletions
diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c
index d7ef56eff1b5..1cd281a86141 100644
--- a/sys/contrib/dev/acpica/compiler/dtutils.c
+++ b/sys/contrib/dev/acpica/compiler/dtutils.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,7 +77,7 @@ DtSum (
void
DtError (
UINT8 Level,
- UINT8 MessageId,
+ UINT16 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
@@ -124,7 +124,7 @@ DtError (
void
DtNameError (
UINT8 Level,
- UINT8 MessageId,
+ UINT16 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
@@ -177,7 +177,7 @@ DtNameError (
void
DtFatal (
- UINT8 MessageId,
+ UINT16 MessageId,
DT_FIELD *FieldObject,
char *ExtraMessage)
{
@@ -286,36 +286,6 @@ DtStrtoul64 (
/******************************************************************************
*
- * FUNCTION: DtGetFileSize
- *
- * PARAMETERS: Handle - Open file handler
- *
- * RETURN: Current file size
- *
- * DESCRIPTION: Get the current size of a file. Seek to the EOF and get the
- * offset. Seek back to the original location.
- *
- *****************************************************************************/
-
-UINT32
-DtGetFileSize (
- FILE *Handle)
-{
- int CurrentOffset;
- int LastOffset;
-
-
- CurrentOffset = ftell (Handle);
- fseek (Handle, 0, SEEK_END);
- LastOffset = ftell (Handle);
- fseek (Handle, CurrentOffset, SEEK_SET);
-
- return ((UINT32) LastOffset);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
@@ -531,7 +501,9 @@ DtGetFieldLength (
case ACPI_DMT_SPACEID:
case ACPI_DMT_ACCWIDTH:
case ACPI_DMT_IVRS:
+ case ACPI_DMT_GTDT:
case ACPI_DMT_MADT:
+ case ACPI_DMT_PCCT:
case ACPI_DMT_PMTT:
case ACPI_DMT_SRAT:
case ACPI_DMT_ASF:
@@ -541,6 +513,7 @@ DtGetFieldLength (
case ACPI_DMT_EINJINST:
case ACPI_DMT_ERSTACT:
case ACPI_DMT_ERSTINST:
+ case ACPI_DMT_DMAR_SCOPE:
ByteLength = 1;
break;
@@ -562,6 +535,7 @@ DtGetFieldLength (
case ACPI_DMT_NAME4:
case ACPI_DMT_SLIC:
case ACPI_DMT_SIG:
+ case ACPI_DMT_LPIT:
ByteLength = 4;
break;
@@ -871,39 +845,151 @@ 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: DtFreeFieldList
+ * FUNCTION: DtDeleteCaches
*
* PARAMETERS: None
*
* RETURN: None
*
- * DESCRIPTION: Free the field list
+ * DESCRIPTION: Delete all local cache buffer blocks
*
- *****************************************************************************/
+ ******************************************************************************/
void
-DtFreeFieldList (
+DtDeleteCaches (
void)
{
- DT_FIELD *Field = Gbl_FieldList;
- DT_FIELD *NextField;
+ UINT32 BufferCount;
+ ASL_CACHE_INFO *Next;
- /* Walk and free entire field list */
+ /* Field cache */
- while (Field)
+ BufferCount = 0;
+ while (Gbl_FieldCacheList)
{
- NextField = Field->Next; /* Save link */
+ Next = Gbl_FieldCacheList->Next;
+ ACPI_FREE (Gbl_FieldCacheList);
+ Gbl_FieldCacheList = Next;
+ BufferCount++;
+ }
- if (!(Field->Flags & DT_FIELD_NOT_ALLOCATED))
- {
- ACPI_FREE (Field->Name);
- ACPI_FREE (Field->Value);
- }
+ 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;
- ACPI_FREE (Field);
- Field = NextField;
+ /* 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;
}