博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
os 通过pptt table得到cache信息
阅读量:4216 次
发布时间:2019-05-26

本文共 2270 字,大约阅读时间需要 7 分钟。

在driver/base/cacheinfo.c 中cache_shared_cpu_map_setup 函数会通过pptt table来parse bios 通过ACPI 表传给os的cache信息cache_shared_cpu_map_setup->cache_setup_acpi其源码在driver/acpi/pptt.c 中int cache_setup_acpi(unsigned int cpu){	struct acpi_table_header *table;	acpi_status status;	pr_debug("Cache Setup ACPI cpu %d\n", cpu);#得到pptt table	status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);	if (ACPI_FAILURE(status)) {		pr_warn_once("No PPTT table found, cache topology may be inaccurate\n");		return -ENOENT;	}#开始parse Cache信息	cache_setup_acpi_cpu(table, cpu);	acpi_put_table(table);	return status;}static void cache_setup_acpi_cpu(struct acpi_table_header *table,				 unsigned int cpu){	struct acpi_pptt_cache *found_cache;	struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);	u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);	struct cacheinfo *this_leaf;	unsigned int index = 0;	struct acpi_pptt_processor *cpu_node = NULL;	while (index < get_cpu_cacheinfo(cpu)->num_leaves) {		this_leaf = this_cpu_ci->info_list + index;		found_cache = acpi_find_cache_node(table, acpi_cpu_id,						   this_leaf->type,						   this_leaf->level,						   &cpu_node);		pr_debug("found = %p %p\n", found_cache, cpu_node);		if (found_cache)		#找到cache node,则根据flag更新cache信息			update_cache_properties(this_leaf,						found_cache,						cpu_node);		index++;	}}static void update_cache_properties(struct cacheinfo *this_leaf,				    struct acpi_pptt_cache *found_cache,				    struct acpi_pptt_processor *cpu_node){	this_leaf->fw_token = cpu_node;	#根据flag更新cache的size等信息	if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)		this_leaf->size = found_cache->size;	if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID)		this_leaf->coherency_line_size = found_cache->line_size;	if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID)		this_leaf->number_of_sets = found_cache->number_of_sets;	if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID)		this_leaf->ways_of_associativity = found_cache->associativity;	if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) {		switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) {		case ACPI_PPTT_CACHE_POLICY_WT:			this_leaf->attributes = CACHE_WRITE_THROUGH;			break;		case ACPI_PPTT_CACHE_POLICY_WB:			this_leaf->attributes = CACHE_WRITE_BACK;			break;		}	}	}

 

转载地址:http://nvnmi.baihongyu.com/

你可能感兴趣的文章
cocos2dx android启动错误
查看>>
eclipse: android rename package name
查看>>
cocos2dx c++调用java思想
查看>>
cocos2dx lua Node节点 私有数据存取
查看>>
lua math.ceil math.ceil
查看>>
cocos2dx CCNode计算node的大小
查看>>
cocos2dx 布局记录(1)
查看>>
lua 多行注释和取消多行注释
查看>>
缩放系数计算
查看>>
cocos2dx --- 按钮点击居中放大
查看>>
cocos2dx menu位置计算
查看>>
cocos2dx资源加载机制(同步/异步)
查看>>
cocos2dx C++调用java -- 字符串传递
查看>>
git学习网站
查看>>
JavaScript 学习网站
查看>>
cocos2dx java调用c++ -- 字符串传递
查看>>
CCScaleTo与CCScaleBy比较
查看>>
cocos2dx CCObject引用计数,内存释放分析(1)
查看>>
cocos2dx2.X 编译时,传递编译选项
查看>>
ccCArray.cpp 文件
查看>>