drivers/acpi/pptt.c
Source file repositories/reference/linux-study-clean/drivers/acpi/pptt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/pptt.c- Extension
.c- Size
- 32588 bytes
- Lines
- 1071
- 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
linux/acpi.hlinux/cacheinfo.hacpi/processor.h
Detected Declarations
function Copyrightfunction acpi_pptt_match_typefunction acpi_pptt_walk_cachefunction acpi_find_cache_levelfunction acpi_count_levelsfunction acpi_pptt_leaf_nodefunction acpi_find_processor_nodefunction acpi_cache_typefunction update_cache_propertiesfunction cache_setup_acpi_cpufunction flag_identicalfunction acpi_pptt_warn_missingfunction topology_get_acpi_cpu_tagfunction find_acpi_cpu_topology_tagfunction check_acpi_cpu_flagfunction acpi_get_cache_infofunction cache_setup_acpifunction acpi_pptt_cpu_is_threadfunction find_acpi_cpu_topologyfunction find_acpi_cpu_topology_packagefunction find_acpi_cpu_topology_clusterfunction find_acpi_cpu_topology_hetero_idfunction acpi_pptt_get_child_cpusfunction for_each_possible_cpufunction acpi_pptt_get_cpus_from_containerfunction find_acpi_cache_level_from_idfunction for_each_possible_cpufunction acpi_pptt_get_cpumask_from_cache_idfunction for_each_possible_cpu
Annotated Snippet
if (!(cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)) {
cache = fetch_pptt_cache(table_hdr, cache->next_level_of_cache);
continue;
}
if (split_levels &&
(acpi_pptt_match_type(cache->attributes, ACPI_PPTT_CACHE_TYPE_DATA) ||
acpi_pptt_match_type(cache->attributes, ACPI_PPTT_CACHE_TYPE_INSTR)))
*split_levels = local_level;
if (local_level == level &&
acpi_pptt_match_type(cache->attributes, type)) {
if (*found != NULL && cache != *found)
pr_warn("Found duplicate cache level/type unable to determine uniqueness\n");
pr_debug("Found cache @ level %u\n", level);
*found = cache;
/*
* continue looking at this node's resource list
* to verify that we don't find a duplicate
* cache node.
*/
}
cache = fetch_pptt_cache(table_hdr, cache->next_level_of_cache);
}
return local_level;
}
static struct acpi_pptt_cache *
acpi_find_cache_level(struct acpi_table_header *table_hdr,
struct acpi_pptt_processor *cpu_node,
unsigned int *starting_level, unsigned int *split_levels,
unsigned int level, int type)
{
struct acpi_subtable_header *res;
unsigned int number_of_levels = *starting_level;
int resource = 0;
struct acpi_pptt_cache *ret = NULL;
unsigned int local_level;
/* walk down from processor node */
while ((res = acpi_get_pptt_resource(table_hdr, cpu_node, resource))) {
resource++;
local_level = acpi_pptt_walk_cache(table_hdr, *starting_level,
split_levels, res, &ret,
level, type);
/*
* we are looking for the max depth. Since its potentially
* possible for a given node to have resources with differing
* depths verify that the depth we have found is the largest.
*/
if (number_of_levels < local_level)
number_of_levels = local_level;
}
if (number_of_levels > *starting_level)
*starting_level = number_of_levels;
return ret;
}
/**
* acpi_count_levels() - Given a PPTT table, and a CPU node, count the
* total number of levels and split cache levels (data/instruction).
* @table_hdr: Pointer to the head of the PPTT table
* @cpu_node: processor node we wish to count caches for
* @split_levels: Number of split cache levels (data/instruction) if
* success. Can by NULL.
*
* Return: number of levels.
* Given a processor node containing a processing unit, walk into it and count
* how many levels exist solely for it, and then walk up each level until we hit
* the root node (ignore the package level because it may be possible to have
* caches that exist across packages). Count the number of cache levels and
* split cache levels (data/instruction) that exist at each level on the way
* up.
*/
static int acpi_count_levels(struct acpi_table_header *table_hdr,
struct acpi_pptt_processor *cpu_node,
unsigned int *split_levels)
{
int current_level = 0;
do {
acpi_find_cache_level(table_hdr, cpu_node, ¤t_level, split_levels, 0, 0);
cpu_node = fetch_pptt_node(table_hdr, cpu_node->parent);
} while (cpu_node);
return current_level;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cacheinfo.h`, `acpi/processor.h`.
- Detected declarations: `function Copyright`, `function acpi_pptt_match_type`, `function acpi_pptt_walk_cache`, `function acpi_find_cache_level`, `function acpi_count_levels`, `function acpi_pptt_leaf_node`, `function acpi_find_processor_node`, `function acpi_cache_type`, `function update_cache_properties`, `function cache_setup_acpi_cpu`.
- 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.