Function report |
Source Code:arch\x86\kernel\cpu\mtrr\cleanup.c |
Create Date:2022-07-28 08:06:42 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:mtrr_trim_uncached_memory - trim RAM not covered by MTRRs*@end_pfn: ending page frame number* Some buggy BIOSes don't setup the MTRRs properly for systems with certain* memory configurations
Proto:int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| unsigned long | end_pfn |
| 879 | highest_pfn = 0 |
| 889 | If Not is_cpu(INTEL) || disable_mtrr_trim Then Return 0 |
| 893 | def &= 0xff |
| 894 | If def != MTRR memory types, which are defined in SDM Then Return 0 |
| 898 | memset(range_state, 0, size of range_state ) |
| 899 | When i < num_var_ranges cycle |
| 907 | When i < num_var_ranges cycle |
| 909 | If type != MTRR_TYPE_WRBACK Then Continue |
| 913 | If highest_pfn < base + size Then highest_pfn = base + size |
| 918 | If Not highest_pfn Then |
| 919 | pr_info("CPU MTRRs all blank - virtualized system.\n") |
| 920 | Return 0 |
| 925 | When i < num_var_ranges cycle |
| 927 | If type >= MTRR_NUM_TYPES Then Continue |
| 930 | If Not size Then type = MTRR_NUM_TYPES |
| 936 | If Not num[MTRR_TYPE_WRBACK] Then Return 0 |
| 940 | If num[MTRR_TYPE_WRBACK] + num[MTRR memory types, which are defined in SDM ] != num_var_ranges - num[MTRR_NUM_TYPES] Then Return 0 |
| 945 | nr_range = 0 |
| 946 | If mtrr_tom2 Then |
| 947 | start = 1ULL << 32 - PAGE_SHIFT determines the page size |
| 949 | If highest_pfn < end Then highest_pfn = end |
| 951 | nr_range++ |
| 953 | nr_range = x86_get_mtrr_mem_range(range, nr_range, 0, 0) |
| 956 | total_trim_size = 0 |
| 957 | If start Then total_trim_size += real_trim_memory(0, start) |
| 962 | If end < start Then total_trim_size += real_trim_memory(end, start) |
| 969 | If end < end_pfn Then total_trim_size += real_trim_memory(end, end_pfn) |
| 973 | If total_trim_size Then |
| 974 | pr_warn("WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing %lluMB of RAM.\n", total_trim_size >> 20) |
| 977 | If Not changed_by_mtrr_cleanup Then WARN_ON(1) |
| 980 | pr_info("update e820 for mtrr\n") |
| 981 | e820__update_table_print() |
| 983 | Return 1 |
| 986 | Return 0 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |