Lines Matching defs:range
45 uint64_t types; /* fixed-range type octet */
72 static void mtrr_get_var_ranges(mtrr_var_range_t * range, int count);
73 static void mtrr_set_var_ranges(const mtrr_var_range_t * range, int count);
74 static void mtrr_get_fix_ranges(mtrr_fix_range_t * range);
75 static void mtrr_set_fix_ranges(const mtrr_fix_range_t * range);
79 static void var_range_encode(mtrr_var_range_t * range, addr64_t address,
81 static int var_range_overlap(mtrr_var_range_t * range, addr64_t address,
113 * Variable-range mask to/from length conversions.
124 * Fetch variable-range MTRR register pairs.
127 mtrr_get_var_ranges(mtrr_var_range_t * range, int count)
132 range[i].base = rdmsr64(MSR_IA32_MTRR_PHYSBASE(i));
133 range[i].mask = rdmsr64(MSR_IA32_MTRR_PHYSMASK(i));
136 if (range[i].mask & IA32_MTRR_PHYMASK_VALID)
137 range[i].refcnt = 1;
139 range[i].refcnt = 0;
144 * Update variable-range MTRR register pairs.
147 mtrr_set_var_ranges(const mtrr_var_range_t * range, int count)
152 wrmsr64(MSR_IA32_MTRR_PHYSBASE(i), range[i].base);
153 wrmsr64(MSR_IA32_MTRR_PHYSMASK(i), range[i].mask);
158 * Fetch all fixed-range MTRR's. Note MSR offsets are not consecutive.
161 mtrr_get_fix_ranges(mtrr_fix_range_t * range)
165 /* assume 11 fix range registers */
166 range[0].types = rdmsr64(MSR_IA32_MTRR_FIX64K_00000);
167 range[1].types = rdmsr64(MSR_IA32_MTRR_FIX16K_80000);
168 range[2].types = rdmsr64(MSR_IA32_MTRR_FIX16K_A0000);
170 range[3 + i].types = rdmsr64(MSR_IA32_MTRR_FIX4K_C0000 + i);
174 * Update all fixed-range MTRR's.
177 mtrr_set_fix_ranges(const struct mtrr_fix_range * range)
181 /* assume 11 fix range registers */
182 wrmsr64(MSR_IA32_MTRR_FIX64K_00000, range[0].types);
183 wrmsr64(MSR_IA32_MTRR_FIX16K_80000, range[1].types);
184 wrmsr64(MSR_IA32_MTRR_FIX16K_A0000, range[2].types);
186 wrmsr64(MSR_IA32_MTRR_FIX4K_C0000 + i, range[3 + i].types);
324 /* enable all MTRR range registers (what if E was not set?) */
398 * Add a MTRR range to associate the physical memory range specified
432 /* leave the fix range area below 1MB alone */
450 * Check for overlap and locate a free range.
457 /* free range candidate if no overlaps are found */
498 * Remove a previously added MTRR range. The same arguments used for adding
499 * the memory range must be supplied again.
523 /* found specified variable range */
550 * Variable range helper routines
553 var_range_encode(mtrr_var_range_t * range, addr64_t address,
556 range->base = (address & IA32_MTRR_PHYSBASE_MASK) |
559 range->mask = LEN_TO_MASK(length) |
564 var_range_overlap(mtrr_var_range_t * range, addr64_t address,
571 v_address = range->base & IA32_MTRR_PHYSBASE_MASK;
572 v_type = range->base & IA32_MTRR_PHYSBASE_TYPE;
573 v_length = MASK_TO_LEN(range->mask);
575 /* detect range overlap */