Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20131218
acpica-unix2-20130823
PANKOVs restructure

@@ -3,11 +3,11 @@
  * Module Name: utcache - local cache allocation routines
  *
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

@@ -93,11 +93,10 @@
     }
 
     /* Populate the cache object and return it */
 
     ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
-    Cache->LinkOffset = 8;
     Cache->ListName   = CacheName;
     Cache->ObjectSize = ObjectSize;
     Cache->MaxDepth   = MaxDepth;
 
     *ReturnCache = Cache;

@@ -119,11 +118,11 @@
 
 ACPI_STATUS
 AcpiOsPurgeCache (
     ACPI_MEMORY_LIST        *Cache)
 {
-    char                    *Next;
+    void                    *Next;
     ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_ENTRY ();
 

@@ -143,12 +142,11 @@
 
     while (Cache->ListHead)
     {
         /* Delete and unlink one cached state object */
 
-        Next = *(ACPI_CAST_INDIRECT_PTR (char,
-                    &(((char *) Cache->ListHead)[Cache->LinkOffset])));
+        Next = ACPI_GET_DESCRIPTOR_PTR (Cache->ListHead);
         ACPI_FREE (Cache->ListHead);
 
         Cache->ListHead = Next;
         Cache->CurrentDepth--;
     }

@@ -249,12 +247,11 @@
         ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
         ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
 
         /* Put the object at the head of the cache list */
 
-        * (ACPI_CAST_INDIRECT_PTR (char,
-            &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
+        ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead);
         Cache->ListHead = Object;
         Cache->CurrentDepth++;
 
         (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
     }

@@ -287,17 +284,17 @@
     ACPI_FUNCTION_NAME (OsAcquireObject);
 
 
     if (!Cache)
     {
-        return (NULL);
+        return_PTR (NULL);
     }
 
     Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
     if (ACPI_FAILURE (Status))
     {
-        return (NULL);
+        return_PTR (NULL);
     }
 
     ACPI_MEM_TRACKING (Cache->Requests++);
 
     /* Check the cache first */

@@ -305,12 +302,11 @@
     if (Cache->ListHead)
     {
         /* There is an object available, use it */
 
         Object = Cache->ListHead;
-        Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) Object)[Cache->LinkOffset])));
+        Cache->ListHead = ACPI_GET_DESCRIPTOR_PTR (Object);
 
         Cache->CurrentDepth--;
 
         ACPI_MEM_TRACKING (Cache->Hits++);
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,

@@ -317,11 +313,11 @@
             "Object %p from %s cache\n", Object, Cache->ListName));
 
         Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
         if (ACPI_FAILURE (Status))
         {
-            return (NULL);
+            return_PTR (NULL);
         }
 
         /* Clear (zero) the previously used Object */
 
         ACPI_MEMSET (Object, 0, Cache->ObjectSize);

@@ -342,20 +338,18 @@
         /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
 
         Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
         if (ACPI_FAILURE (Status))
         {
-            return (NULL);
+            return_PTR (NULL);
         }
 
         Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
         if (!Object)
         {
-            return (NULL);
+            return_PTR (NULL);
         }
     }
 
-    return (Object);
+    return_PTR (Object);
 }
 #endif /* ACPI_USE_LOCAL_CACHE */
-
-