函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mtrr\mtrr.c Create Date:2022-07-27 09:05:23
Last Modify:2022-05-18 17:35:08 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:mtrr_add_page - Add a memory type region*@base: Physical base address of region in pages (in units of 4 kB!)*@size: Physical size of region in pages (4 kB)*@type: Type of MTRR desired*@increment: If this is true do usage counting on the region* Memory

函数原型:int mtrr_add_page(unsigned long base, unsigned long size, unsigned int type, bool increment)

返回类型:int

参数:

类型参数名称
unsigned longbase
unsigned longsize
unsigned inttype
boolincrement
308  如果非mtrr_enabled()则返回:负ENXIO
311  error等于validate_add_page(base, size, type)
312  如果error则返回:error
315  如果type大于等于MTRR_NUM_TYPES
316  打印警告信息("type: %u invalid\n", type)
317  返回:负EINVAL
321  如果type恒等于MTRR_TYPE_WRCOMB且非Returns non-zero if we have the write-combining memory type
322  打印警告信息("your processor doesn't support write-combining\n")
323  返回:负ENOSYS
326  如果非size
327  打印警告信息("zero sized request\n")
328  返回:负EINVAL
331  如果base按位或basesize减1的值右移x86_phys_bitsPAGE_SHIFT determines the page size 位则
333  打印警告信息("base or size exceeds the MTRR width\n")
334  返回:负EINVAL
337  error等于负EINVAL
338  replace等于负1
341  get_online_cpus()
344  mutex_lock( & mtrr_mutex)
345 i小于num_var_ranges循环
346  get(i, & lbase, & lsize, & ltype)
347  如果非lsizebase大于lbaselsize减1或basesize减1小于lbase则继续下一循环
354  如果base小于lbasebasesize减1大于lbaselsize减1则
355  如果base小于等于lbasebasesize减1大于等于lbaselsize减1则
358  如果type恒等于ltype
359  replace等于如果replace恒等于负1则i否则负2
360  继续下一循环
361  否则如果types_compatible(type, ltype)则继续下一循环
364  打印警告信息("0x%lx000,0x%lx000 overlaps existing 0x%lx000,0x%lx000\n", base, size, lbase, lsize)
366  转到:out
369  如果ltype不等于type
370  如果types_compatible(type, ltype)则继续下一循环
372  打印警告信息("type mismatch for %lx000,%lx000 old: %s new: %s\n", base, size, mtrr_attrib_to_str(ltype), mtrr_attrib_to_str(type))
375  转到:out
377  如果incrementmtrr_usage_table[i]先自加
379  error等于i
380  转到:out
383  i等于get_free_region(base, size, replace)
384  如果i大于等于0则
385  set_mtrr_cpuslocked(i, base, size, type)
387  mtrr_usage_table[i]等于1
388  否则
390  如果incrementmtrr_usage_table[i]自加
393  set_mtrr_cpuslocked(replace, 0, 0, 0)
394  mtrr_usage_table[replace]等于0
397  否则
398  打印信息("no more MTRRs available\n")
400  error等于i
401  out :
402  mutex_unlock( & mtrr_mutex)
403  put_online_cpus()
404  返回:error
调用者
名称描述
mtrr_addmtrr_add - Add a memory type region*@base: Physical base address of region*@size: Physical size of region*@type: Type of MTRR desired*@increment: If this is true do usage counting on the region* Memory type region registers control the caching on newer
mtrr_file_add
mtrr_writeseq_file can seek but we ignore it.* Format of control line:* "base=%Lx size=%Lx type=%s" or "disable=%d"
mtrr_ioctl