Lines Matching +full:no +full:- +full:memory +full:- +full:wc
1 /* Generic MTRR (Memory Type Range Register) driver.
3 Copyright (C) 1997-2000 Richard Gooch
29 on 6-7 March 2002.
31 System Programming Guide; Section 9.11. (1997 edition - PPro).
74 /* Returns non-zero if we have the write-combining memory type */
83 * write-combining. Don't allow it and leave room for other in have_wrcomb()
86 if (dev->vendor == PCI_VENDOR_ID_SERVERWORKS && in have_wrcomb()
87 dev->device == PCI_DEVICE_ID_SERVERWORKS_LE && in have_wrcomb()
88 dev->revision <= 5) { in have_wrcomb()
89 pr_info("Serverworks LE rev < 6 detected. Write-combining disabled.\n"); in have_wrcomb()
95 * write combining memory may resulting in data corruption in have_wrcomb()
97 if (dev->vendor == PCI_VENDOR_ID_INTEL && in have_wrcomb()
98 dev->device == PCI_DEVICE_ID_INTEL_82451NX) { in have_wrcomb()
99 pr_info("Intel 450NX MMC detected. Write-combining disabled.\n"); in have_wrcomb()
105 return mtrr_if->have_wrcomb ? mtrr_if->have_wrcomb() : 0; in have_wrcomb()
125 * mtrr_rendezvous_handler - Work done in the synchronization handler. Executed
135 mtrr_if->set(data->smp_reg, data->smp_base, in mtrr_rendezvous_handler()
136 data->smp_size, data->smp_type); in mtrr_rendezvous_handler()
149 * set_mtrr - update mtrrs on all processors
160 * 4. Enter no-fill cache mode
176 * (the CPU vendors may each do it differently, so we call mtrr_if->set()
197 * mtrr_add_page - Add a memory type region
203 * Memory type region registers control the caching on newer Intel and
220 * %MTRR_TYPE_UNCACHABLE - No caching
222 * %MTRR_TYPE_WRBACK - Write data back in bursts whenever
224 * %MTRR_TYPE_WRCOMB - Write data back soon but allow bursts
226 * %MTRR_TYPE_WRTHROUGH - Cache reads but not writes
239 return -ENXIO; in mtrr_add_page()
241 error = mtrr_if->validate_add_page(base, size, type); in mtrr_add_page()
247 return -EINVAL; in mtrr_add_page()
250 /* If the type is WC, check that this processor supports it */ in mtrr_add_page()
252 pr_warn("your processor doesn't support write-combining\n"); in mtrr_add_page()
253 return -ENOSYS; in mtrr_add_page()
258 return -EINVAL; in mtrr_add_page()
261 if ((base | (base + size - 1)) >> in mtrr_add_page()
262 (boot_cpu_data.x86_phys_bits - PAGE_SHIFT)) { in mtrr_add_page()
264 return -EINVAL; in mtrr_add_page()
267 error = -EINVAL; in mtrr_add_page()
268 replace = -1; in mtrr_add_page()
270 /* No CPU hotplug when we change MTRR entries */ in mtrr_add_page()
276 mtrr_if->get(i, &lbase, &lsize, <ype); in mtrr_add_page()
277 if (!lsize || base > lbase + lsize - 1 || in mtrr_add_page()
278 base + size - 1 < lbase) in mtrr_add_page()
284 if (base < lbase || base + size - 1 > lbase + lsize - 1) { in mtrr_add_page()
286 base + size - 1 >= lbase + lsize - 1) { in mtrr_add_page()
289 replace = replace == -1 ? i : -2; in mtrr_add_page()
313 i = mtrr_if->get_free_region(base, size, replace); in mtrr_add_page()
328 pr_info("no more MTRRs available\n"); in mtrr_add_page()
339 if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { in mtrr_check()
343 return -1; in mtrr_check()
349 * mtrr_add - Add a memory type region
355 * Memory type region registers control the caching on newer Intel and
372 * %MTRR_TYPE_UNCACHABLE - No caching
374 * %MTRR_TYPE_WRBACK - Write data back in bursts whenever
376 * %MTRR_TYPE_WRCOMB - Write data back soon but allow bursts
378 * %MTRR_TYPE_WRTHROUGH - Cache reads but not writes
387 return -ENODEV; in mtrr_add()
389 return -EINVAL; in mtrr_add()
395 * mtrr_del_page - delete a memory type region
413 int error = -EINVAL; in mtrr_del_page()
416 return -ENODEV; in mtrr_del_page()
419 /* No CPU hotplug when we change MTRR entries */ in mtrr_del_page()
425 mtrr_if->get(i, &lbase, &lsize, <ype); in mtrr_del_page()
432 Dprintk("no MTRR for %lx000,%lx000 found\n", base, size); in mtrr_del_page()
440 mtrr_if->get(reg, &lbase, &lsize, <ype); in mtrr_del_page()
449 if (--mtrr_usage_table[reg] < 1) in mtrr_del_page()
459 * mtrr_del - delete a memory type region
475 return -ENODEV; in mtrr_del()
477 return -EINVAL; in mtrr_del()
482 * arch_phys_wc_add - add a WC MTRR and handle errors if PAT is unavailable
487 * attempts to add a WC MTRR covering size bytes starting at base and
505 pr_warn("Failed to add WC MTRR for [%p-%p]; performance may suffer.", in arch_phys_wc_add()
506 (void *)base, (void *)(base + size - 1)); in arch_phys_wc_add()
514 * arch_phys_wc_del - undoes arch_phys_wc_add
526 mtrr_del(handle - MTRR_TO_PHYS_WC_OFFSET, 0, 0); in arch_phys_wc_del()
532 * arch_phys_wc_index - translates arch_phys_wc_add's return value
538 * Note: There is no legitimate use for this function, except possibly
545 return -1; in arch_phys_wc_index()
547 return handle - MTRR_TO_PHYS_WC_OFFSET; in arch_phys_wc_index()
554 * mtrr_bp_init - initialize MTRRs on the boot CPU
565 phys_hi_rsvd = GENMASK(31, boot_cpu_data.x86_phys_bits - 32); in mtrr_bp_init()
574 pr_info("MTRRs set to read-only\n"); in mtrr_bp_init()
589 config = mtrr_if->var_regs; in mtrr_bp_init()
611 * mtrr_save_state - Save current fixed-range MTRR state of the first