Home | History | Annotate | Download | only in utilities

Lines Matching defs:Cache

3  * Module Name: utcache - local cache allocation routines
164 * PARAMETERS: CacheName - Ascii name for the cache
166 * MaxDepth - Maximum depth of the cache (in objects)
167 * ReturnCache - Where the new cache object is returned
171 * DESCRIPTION: Create a cache object
182 ACPI_MEMORY_LIST *Cache;
193 /* Create the cache object */
195 Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
196 if (!Cache)
201 /* Populate the cache object and return it */
203 memset (Cache, 0, sizeof (ACPI_MEMORY_LIST));
204 Cache->ListName = __UNCONST(CacheName);
205 Cache->ObjectSize = ObjectSize;
206 Cache->MaxDepth = MaxDepth;
208 *ReturnCache = Cache;
217 * PARAMETERS: Cache - Handle to cache object
221 * DESCRIPTION: Free all objects within the requested cache.
227 ACPI_MEMORY_LIST *Cache)
236 if (!Cache)
247 /* Walk the list of objects in this cache */
249 while (Cache->ListHead)
253 Next = ACPI_GET_DESCRIPTOR_PTR (Cache->ListHead);
254 ACPI_FREE (Cache->ListHead);
256 Cache->ListHead = Next;
257 Cache->CurrentDepth--;
269 * PARAMETERS: Cache - Handle to cache object
273 * DESCRIPTION: Free all objects within the requested cache and delete the
274 * cache object.
280 ACPI_MEMORY_LIST *Cache)
288 /* Purge all objects in the cache */
290 Status = AcpiOsPurgeCache (Cache);
296 /* Now we can delete the cache object */
298 AcpiOsFree (Cache);
307 * PARAMETERS: Cache - Handle to cache object
312 * DESCRIPTION: Release an object to the specified cache. If cache is full,
319 ACPI_MEMORY_LIST *Cache,
328 if (!Cache || !Object)
333 /* If cache is full, just free this object */
335 if (Cache->CurrentDepth >= Cache->MaxDepth)
338 ACPI_MEM_TRACKING (Cache->TotalFreed++);
341 /* Otherwise put this object back into the cache */
353 memset (Object, 0xCA, Cache->ObjectSize);
356 /* Put the object at the head of the cache list */
358 ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead);
359 Cache->ListHead = Object;
360 Cache->CurrentDepth++;
373 * PARAMETERS: Cache - Handle to cache object
377 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
384 ACPI_MEMORY_LIST *Cache)
393 if (!Cache)
404 ACPI_MEM_TRACKING (Cache->Requests++);
406 /* Check the cache first */
408 if (Cache->ListHead)
412 Object = Cache->ListHead;
413 Cache->ListHead = ACPI_GET_DESCRIPTOR_PTR (Object);
415 Cache->CurrentDepth--;
417 ACPI_MEM_TRACKING (Cache->Hits++);
419 "%s: Object %p from %s cache\n",
420 ACPI_GET_FUNCTION_NAME, Object, Cache->ListName));
430 memset (Object, 0, Cache->ObjectSize);
434 /* The cache is empty, create a new object */
437 ACPI_MEM_TRACKING (Cache->TotalAllocated++);
439 if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
441 Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
453 Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);