drivers/acpi/acpica/utcache.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/utcache.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/utcache.c- Extension
.c- Size
- 6719 bytes
- Lines
- 280
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
acpi/acpi.haccommon.h
Detected Declarations
function Copyrightfunction acpi_os_purge_cachefunction acpi_os_delete_cachefunction acpi_os_release_object
Annotated Snippet
if (ACPI_FAILURE(status)) {
return (status);
}
/* Mark the object as cached */
memset(object, 0xCA, cache->object_size);
ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
ACPI_SET_DESCRIPTOR_PTR(object, cache->list_head);
cache->list_head = object;
cache->current_depth++;
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_os_acquire_object
*
* PARAMETERS: cache - Handle to cache object
*
* RETURN: the acquired object. NULL on error
*
* DESCRIPTION: Get an object from the specified cache. If cache is empty,
* the object is allocated.
*
******************************************************************************/
void *acpi_os_acquire_object(struct acpi_memory_list *cache)
{
acpi_status status;
void *object;
ACPI_FUNCTION_TRACE(os_acquire_object);
if (!cache) {
return_PTR(NULL);
}
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
return_PTR(NULL);
}
ACPI_MEM_TRACKING(cache->requests++);
/* Check the cache first */
if (cache->list_head) {
/* There is an object available, use it */
object = cache->list_head;
cache->list_head = ACPI_GET_DESCRIPTOR_PTR(object);
cache->current_depth--;
ACPI_MEM_TRACKING(cache->hits++);
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
"%s: Object %p from %s cache\n",
ACPI_GET_FUNCTION_NAME, object,
cache->list_name));
status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
return_PTR(NULL);
}
/* Clear (zero) the previously used Object */
memset(object, 0, cache->object_size);
} else {
/* The cache is empty, create a new object */
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
ACPI_MEM_TRACKING(cache->total_allocated++);
if ((cache->total_allocated - cache->total_freed) >
cache->max_occupied) {
cache->max_occupied =
cache->total_allocated - cache->total_freed;
}
#endif
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`.
- Detected declarations: `function Copyright`, `function acpi_os_purge_cache`, `function acpi_os_delete_cache`, `function acpi_os_release_object`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.