diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-01 20:07:40 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-01 20:07:40 +0300 |
commit | 25525bea46e7d5bc1f82cbc12de2f27b9c346a92 (patch) | |
tree | 9308304c84f0f776f6477662335bff9a9b0d1327 /drivers | |
parent | 2962156d5cc0e7f959353d3f5275da7cc3765f06 (diff) | |
parent | 2baa891e42d84159b693eadd44f6fe1486285bdc (diff) | |
download | linux-25525bea46e7d5bc1f82cbc12de2f27b9c346a92.tar.xz |
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm updates from Ingo Molnar:
"The dominant change in this cycle was the continued work to isolate
kernel drivers from MTRR legacies: this tree gets rid of all kernel
internal driver interfaces to MTRRs (mostly by rewriting it to proper
PAT interfaces), the only access left is the /proc/mtrr ABI.
This work was done by Luis R Rodriguez.
There's also some related PCI interface additions for which I've
Cc:-ed Bjorn"
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
x86/mm/mtrr: Remove kernel internal MTRR interfaces: unexport mtrr_add() and mtrr_del()
s390/io: Add pci_iomap_wc() and pci_iomap_wc_range()
drivers/dma/iop-adma: Use dma_alloc_writecombine() kernel-style
drivers/video/fbdev/vt8623fb: Use arch_phys_wc_add() and pci_iomap_wc()
drivers/video/fbdev/s3fb: Use arch_phys_wc_add() and pci_iomap_wc()
drivers/video/fbdev/arkfb.c: Use arch_phys_wc_add() and pci_iomap_wc()
PCI: Add pci_iomap_wc() variants
drivers/video/fbdev/gxt4500: Use pci_ioremap_wc_bar() to map framebuffer
drivers/video/fbdev/kyrofb: Use arch_phys_wc_add() and pci_ioremap_wc_bar()
drivers/video/fbdev/i740fb: Use arch_phys_wc_add() and pci_ioremap_wc_bar()
PCI: Add pci_ioremap_wc_bar()
x86/mm: Make kernel/check.c explicitly non-modular
x86/mm/pat: Make mm/pageattr[-test].c explicitly non-modular
x86/mm/pat: Add comments to cachemode translation tables
arch/*/io.h: Add ioremap_uc() to all architectures
drivers/video/fbdev/atyfb: Use arch_phys_wc_add() and ioremap_wc()
drivers/video/fbdev/atyfb: Replace MTRR UC hole with strong UC
drivers/video/fbdev/atyfb: Clarify ioremap() base and length used
drivers/video/fbdev/atyfb: Carve out framebuffer length fudging into a helper
x86/mm, asm-generic: Add IOMMU ioremap_uc() variant default
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/iop-adma.c | 9 | ||||
-rw-r--r-- | drivers/pci/pci.c | 14 | ||||
-rw-r--r-- | drivers/video/fbdev/arkfb.c | 36 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/atyfb.h | 5 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/atyfb_base.c | 109 | ||||
-rw-r--r-- | drivers/video/fbdev/gxt4500.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/i740fb.c | 35 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/fbdev.c | 33 | ||||
-rw-r--r-- | drivers/video/fbdev/s3fb.c | 35 | ||||
-rw-r--r-- | drivers/video/fbdev/vt8623fb.c | 31 |
10 files changed, 105 insertions, 204 deletions
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 998826854fdd..e4f43125e0fb 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c @@ -1300,10 +1300,11 @@ static int iop_adma_probe(struct platform_device *pdev) * note: writecombine gives slightly better performance, but * requires that we explicitly flush the writes */ - if ((adev->dma_desc_pool_virt = dma_alloc_writecombine(&pdev->dev, - plat_data->pool_size, - &adev->dma_desc_pool, - GFP_KERNEL)) == NULL) { + adev->dma_desc_pool_virt = dma_alloc_writecombine(&pdev->dev, + plat_data->pool_size, + &adev->dma_desc_pool, + GFP_KERNEL); + if (!adev->dma_desc_pool_virt) { ret = -ENOMEM; goto err_free_adev; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cc76238c86fb..6a9a1116f1eb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -138,6 +138,20 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) return ioremap_nocache(res->start, resource_size(res)); } EXPORT_SYMBOL_GPL(pci_ioremap_bar); + +void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar) +{ + /* + * Make sure the BAR is actually a memory resource, not an IO resource + */ + if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { + WARN_ON(1); + return NULL; + } + return ioremap_wc(pci_resource_start(pdev, bar), + pci_resource_len(pdev, bar)); +} +EXPORT_SYMBOL_GPL(pci_ioremap_wc_bar); #endif diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index b305a1e7cc76..6a317de7082c 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -26,13 +26,9 @@ #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ #include <video/vga.h> -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif - struct arkfb_info { int mclk_freq; - int mtrr_reg; + int wc_cookie; struct dac_info *dac; struct vgastate state; @@ -102,10 +98,6 @@ static const struct svga_timing_regs ark_timing_regs = { static char *mode_option = "640x480-8@60"; -#ifdef CONFIG_MTRR -static int mtrr = 1; -#endif - MODULE_AUTHOR("(c) 2007 Ondrej Zajicek <santiago@crfreenet.org>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("fbdev driver for ARK 2000PV"); @@ -115,11 +107,6 @@ MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); module_param_named(mode, mode_option, charp, 0444); MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc) (deprecated)"); -#ifdef CONFIG_MTRR -module_param(mtrr, int, 0444); -MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)"); -#endif - static int threshold = 4; module_param(threshold, int, 0644); @@ -1002,7 +989,7 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) info->fix.smem_len = pci_resource_len(dev, 0); /* Map physical IO memory address into kernel space */ - info->screen_base = pci_iomap(dev, 0, 0); + info->screen_base = pci_iomap_wc(dev, 0, 0); if (! info->screen_base) { rc = -ENOMEM; dev_err(info->device, "iomap for framebuffer failed\n"); @@ -1057,14 +1044,8 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* Record a reference to the driver data */ pci_set_drvdata(dev, info); - -#ifdef CONFIG_MTRR - if (mtrr) { - par->mtrr_reg = -1; - par->mtrr_reg = mtrr_add(info->fix.smem_start, info->fix.smem_len, MTRR_TYPE_WRCOMB, 1); - } -#endif - + par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, + info->fix.smem_len); return 0; /* Error handling */ @@ -1092,14 +1073,7 @@ static void ark_pci_remove(struct pci_dev *dev) if (info) { struct arkfb_info *par = info->par; - -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } -#endif - + arch_phys_wc_del(par->wc_cookie); dac_release(par->dac); unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h index 1f39a62f899b..63c4842eb224 100644 --- a/drivers/video/fbdev/aty/atyfb.h +++ b/drivers/video/fbdev/aty/atyfb.h @@ -182,10 +182,7 @@ struct atyfb_par { unsigned long irq_flags; unsigned int irq; spinlock_t int_lock; -#ifdef CONFIG_MTRR - int mtrr_aper; - int mtrr_reg; -#endif + int wc_cookie; u32 mem_cntl; struct crtc saved_crtc; union aty_pll saved_pll; diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 8789e487b96e..f34ed47fcaf8 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -98,9 +98,6 @@ #ifdef CONFIG_PMAC_BACKLIGHT #include <asm/backlight.h> #endif -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif /* * Debug flags. @@ -303,9 +300,7 @@ static struct fb_ops atyfb_ops = { }; static bool noaccel; -#ifdef CONFIG_MTRR static bool nomtrr; -#endif static int vram; static int pll; static int mclk; @@ -427,6 +422,20 @@ static struct { #endif /* CONFIG_FB_ATY_CT */ }; +/* + * Last page of 8 MB (4 MB on ISA) aperture is MMIO, + * unless the auxiliary register aperture is used. + */ +static void aty_fudge_framebuffer_len(struct fb_info *info) +{ + struct atyfb_par *par = (struct atyfb_par *) info->par; + + if (!par->aux_start && + (info->fix.smem_len == 0x800000 || + (par->bus_type == ISA && info->fix.smem_len == 0x400000))) + info->fix.smem_len -= GUI_RESERVE; +} + static int correct_chipset(struct atyfb_par *par) { u8 rev; @@ -2603,14 +2612,7 @@ static int aty_init(struct fb_info *info) if (par->pll_ops->resume_pll) par->pll_ops->resume_pll(info, &par->pll); - /* - * Last page of 8 MB (4 MB on ISA) aperture is MMIO, - * unless the auxiliary register aperture is used. - */ - if (!par->aux_start && - (info->fix.smem_len == 0x800000 || - (par->bus_type == ISA && info->fix.smem_len == 0x400000))) - info->fix.smem_len -= GUI_RESERVE; + aty_fudge_framebuffer_len(info); /* * Disable register access through the linear aperture @@ -2621,25 +2623,13 @@ static int aty_init(struct fb_info *info) aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) | BUS_APER_REG_DIS, par); -#ifdef CONFIG_MTRR - par->mtrr_aper = -1; - par->mtrr_reg = -1; - if (!nomtrr) { - /* Cover the whole resource. */ - par->mtrr_aper = mtrr_add(par->res_start, par->res_size, - MTRR_TYPE_WRCOMB, 1); - if (par->mtrr_aper >= 0 && !par->aux_start) { - /* Make a hole for mmio. */ - par->mtrr_reg = mtrr_add(par->res_start + 0x800000 - - GUI_RESERVE, GUI_RESERVE, - MTRR_TYPE_UNCACHABLE, 1); - if (par->mtrr_reg < 0) { - mtrr_del(par->mtrr_aper, 0, 0); - par->mtrr_aper = -1; - } - } - } -#endif + if (!nomtrr) + /* + * Only the ioremap_wc()'d area will get WC here + * since ioremap_uc() was used on the entire PCI BAR. + */ + par->wc_cookie = arch_phys_wc_add(par->res_start, + par->res_size); info->fbops = &atyfb_ops; info->pseudo_palette = par->pseudo_palette; @@ -2767,17 +2757,8 @@ aty_init_exit: /* restore video mode */ aty_set_crtc(par, &par->saved_crtc); par->pll_ops->set_pll(info, &par->saved_pll); + arch_phys_wc_del(par->wc_cookie); -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } - if (par->mtrr_aper >= 0) { - mtrr_del(par->mtrr_aper, 0, 0); - par->mtrr_aper = -1; - } -#endif return ret; } @@ -3459,7 +3440,11 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info, } info->fix.mmio_start = raddr; - par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); + /* + * By using strong UC we force the MTRR to never have an + * effect on the MMIO region on both non-PAT and PAT systems. + */ + par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000); if (par->ati_regbase == NULL) return -ENOMEM; @@ -3482,7 +3467,24 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info, /* Map in frame buffer */ info->fix.smem_start = addr; - info->screen_base = ioremap(addr, 0x800000); + + /* + * The framebuffer is not always 8 MiB, that's just the size of the + * PCI BAR. We temporarily abuse smem_len here to store the size + * of the BAR. aty_init() will later correct it to match the actual + * framebuffer size. + * + * On devices that don't have the auxiliary register aperture, the + * registers are housed at the top end of the framebuffer PCI BAR. + * aty_fudge_framebuffer_len() is used to reduce smem_len to not + * overlap with the registers. + */ + info->fix.smem_len = 0x800000; + + aty_fudge_framebuffer_len(info); + + info->screen_base = ioremap_wc(info->fix.smem_start, + info->fix.smem_len); if (info->screen_base == NULL) { ret = -ENOMEM; goto atyfb_setup_generic_fail; @@ -3554,6 +3556,7 @@ static int atyfb_pci_probe(struct pci_dev *pdev, return -ENOMEM; } par = info->par; + par->bus_type = PCI; info->fix = atyfb_fix; info->device = &pdev->dev; par->pci_id = pdev->device; @@ -3655,7 +3658,8 @@ static int __init atyfb_atari_probe(void) * Map the video memory (physical address given) * to somewhere in the kernel address space. */ - info->screen_base = ioremap(phys_vmembase[m64_num], phys_size[m64_num]); + info->screen_base = ioremap_wc(phys_vmembase[m64_num], + phys_size[m64_num]); info->fix.smem_start = (unsigned long)info->screen_base; /* Fake! */ par->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000) + 0xFC00ul; @@ -3721,17 +3725,8 @@ static void atyfb_remove(struct fb_info *info) if (M64_HAS(MOBIL_BUS)) aty_bl_exit(info->bl_dev); #endif + arch_phys_wc_del(par->wc_cookie); -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } - if (par->mtrr_aper >= 0) { - mtrr_del(par->mtrr_aper, 0, 0); - par->mtrr_aper = -1; - } -#endif #ifndef __sparc__ if (par->ati_regbase) iounmap(par->ati_regbase); @@ -3847,10 +3842,8 @@ static int __init atyfb_setup(char *options) while ((this_opt = strsep(&options, ",")) != NULL) { if (!strncmp(this_opt, "noaccel", 7)) { noaccel = 1; -#ifdef CONFIG_MTRR } else if (!strncmp(this_opt, "nomtrr", 6)) { nomtrr = 1; -#endif } else if (!strncmp(this_opt, "vram:", 5)) vram = simple_strtoul(this_opt + 5, NULL, 0); else if (!strncmp(this_opt, "pll:", 4)) @@ -4020,7 +4013,5 @@ module_param(comp_sync, int, 0); MODULE_PARM_DESC(comp_sync, "Set composite sync signal to low (0) or high (1)"); module_param(mode, charp, 0); MODULE_PARM_DESC(mode, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" "); -#ifdef CONFIG_MTRR module_param(nomtrr, bool, 0); MODULE_PARM_DESC(nomtrr, "bool: disable use of MTRR registers"); -#endif diff --git a/drivers/video/fbdev/gxt4500.c b/drivers/video/fbdev/gxt4500.c index 135d78a02588..f19133a80e8c 100644 --- a/drivers/video/fbdev/gxt4500.c +++ b/drivers/video/fbdev/gxt4500.c @@ -662,7 +662,7 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent) info->fix.smem_start = fb_phys; info->fix.smem_len = pci_resource_len(pdev, 1); - info->screen_base = pci_ioremap_bar(pdev, 1); + info->screen_base = pci_ioremap_wc_bar(pdev, 1); if (!info->screen_base) { dev_err(&pdev->dev, "gxt4500: cannot map framebuffer\n"); goto err_unmap_regs; diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c index a2b4204b42bb..452e1163ad02 100644 --- a/drivers/video/fbdev/i740fb.c +++ b/drivers/video/fbdev/i740fb.c @@ -27,24 +27,15 @@ #include <linux/console.h> #include <video/vga.h> -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif - #include "i740_reg.h" static char *mode_option; - -#ifdef CONFIG_MTRR static int mtrr = 1; -#endif struct i740fb_par { unsigned char __iomem *regs; bool has_sgram; -#ifdef CONFIG_MTRR - int mtrr_reg; -#endif + int wc_cookie; bool ddc_registered; struct i2c_adapter ddc_adapter; struct i2c_algo_bit_data ddc_algo; @@ -1040,7 +1031,7 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent) goto err_request_regions; } - info->screen_base = pci_ioremap_bar(dev, 0); + info->screen_base = pci_ioremap_wc_bar(dev, 0); if (!info->screen_base) { dev_err(info->device, "error remapping base\n"); ret = -ENOMEM; @@ -1144,13 +1135,9 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent) fb_info(info, "%s frame buffer device\n", info->fix.id); pci_set_drvdata(dev, info); -#ifdef CONFIG_MTRR - if (mtrr) { - par->mtrr_reg = -1; - par->mtrr_reg = mtrr_add(info->fix.smem_start, - info->fix.smem_len, MTRR_TYPE_WRCOMB, 1); - } -#endif + if (mtrr) + par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, + info->fix.smem_len); return 0; err_reg_framebuffer: @@ -1177,13 +1164,7 @@ static void i740fb_remove(struct pci_dev *dev) if (info) { struct i740fb_par *par = info->par; - -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } -#endif + arch_phys_wc_del(par->wc_cookie); unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); if (par->ddc_registered) @@ -1287,10 +1268,8 @@ static int __init i740fb_setup(char *options) while ((opt = strsep(&options, ",")) != NULL) { if (!*opt) continue; -#ifdef CONFIG_MTRR else if (!strncmp(opt, "mtrr:", 5)) mtrr = simple_strtoul(opt + 5, NULL, 0); -#endif else mode_option = opt; } @@ -1327,7 +1306,5 @@ MODULE_DESCRIPTION("fbdev driver for Intel740"); module_param(mode_option, charp, 0444); MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); -#ifdef CONFIG_MTRR module_param(mtrr, int, 0444); MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)"); -#endif diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c index 65041e15fd59..5bb01533271e 100644 --- a/drivers/video/fbdev/kyro/fbdev.c +++ b/drivers/video/fbdev/kyro/fbdev.c @@ -22,9 +22,6 @@ #include <linux/pci.h> #include <asm/io.h> #include <linux/uaccess.h> -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif #include <video/kyro.h> @@ -84,9 +81,7 @@ static device_info_t deviceInfo; static char *mode_option = NULL; static int nopan = 0; static int nowrap = 1; -#ifdef CONFIG_MTRR static int nomtrr = 0; -#endif /* PCI driver prototypes */ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent); @@ -570,10 +565,8 @@ static int __init kyrofb_setup(char *options) nopan = 1; } else if (strcmp(this_opt, "nowrap") == 0) { nowrap = 1; -#ifdef CONFIG_MTRR } else if (strcmp(this_opt, "nomtrr") == 0) { nomtrr = 1; -#endif } else { mode_option = this_opt; } @@ -691,17 +684,16 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) currentpar->regbase = deviceInfo.pSTGReg = ioremap_nocache(kyro_fix.mmio_start, kyro_fix.mmio_len); + if (!currentpar->regbase) + goto out_free_fb; - info->screen_base = ioremap_nocache(kyro_fix.smem_start, - kyro_fix.smem_len); + info->screen_base = pci_ioremap_wc_bar(pdev, 0); + if (!info->screen_base) + goto out_unmap_regs; -#ifdef CONFIG_MTRR if (!nomtrr) - currentpar->mtrr_handle = - mtrr_add(kyro_fix.smem_start, - kyro_fix.smem_len, - MTRR_TYPE_WRCOMB, 1); -#endif + currentpar->wc_cookie = arch_phys_wc_add(kyro_fix.smem_start, + kyro_fix.smem_len); kyro_fix.ypanstep = nopan ? 0 : 1; kyro_fix.ywrapstep = nowrap ? 0 : 1; @@ -745,8 +737,10 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; out_unmap: - iounmap(currentpar->regbase); iounmap(info->screen_base); +out_unmap_regs: + iounmap(currentpar->regbase); +out_free_fb: framebuffer_release(info); return -EINVAL; @@ -770,12 +764,7 @@ static void kyrofb_remove(struct pci_dev *pdev) iounmap(info->screen_base); iounmap(par->regbase); -#ifdef CONFIG_MTRR - if (par->mtrr_handle) - mtrr_del(par->mtrr_handle, - info->fix.smem_start, - info->fix.smem_len); -#endif + arch_phys_wc_del(par->wc_cookie); unregister_framebuffer(info); framebuffer_release(info); diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index f0ae61a37f04..13b109073c63 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -28,13 +28,9 @@ #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif - struct s3fb_info { int chip, rev, mclk_freq; - int mtrr_reg; + int wc_cookie; struct vgastate state; struct mutex open_lock; unsigned int ref_count; @@ -154,11 +150,7 @@ static const struct svga_timing_regs s3_timing_regs = { static char *mode_option; - -#ifdef CONFIG_MTRR static int mtrr = 1; -#endif - static int fasttext = 1; @@ -170,11 +162,8 @@ module_param(mode_option, charp, 0444); MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); module_param_named(mode, mode_option, charp, 0444); MODULE_PARM_DESC(mode, "Default video mode ('640x480-8@60', etc) (deprecated)"); - -#ifdef CONFIG_MTRR module_param(mtrr, int, 0444); MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)"); -#endif module_param(fasttext, int, 0644); MODULE_PARM_DESC(fasttext, "Enable S3 fast text mode (1=enable, 0=disable, default=1)"); @@ -1168,7 +1157,7 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) info->fix.smem_len = pci_resource_len(dev, 0); /* Map physical IO memory address into kernel space */ - info->screen_base = pci_iomap(dev, 0, 0); + info->screen_base = pci_iomap_wc(dev, 0, 0); if (! info->screen_base) { rc = -ENOMEM; dev_err(info->device, "iomap for framebuffer failed\n"); @@ -1365,12 +1354,9 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* Record a reference to the driver data */ pci_set_drvdata(dev, info); -#ifdef CONFIG_MTRR - if (mtrr) { - par->mtrr_reg = -1; - par->mtrr_reg = mtrr_add(info->fix.smem_start, info->fix.smem_len, MTRR_TYPE_WRCOMB, 1); - } -#endif + if (mtrr) + par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, + info->fix.smem_len); return 0; @@ -1405,14 +1391,7 @@ static void s3_pci_remove(struct pci_dev *dev) if (info) { par = info->par; - -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } -#endif - + arch_phys_wc_del(par->wc_cookie); unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); @@ -1551,10 +1530,8 @@ static int __init s3fb_setup(char *options) if (!*opt) continue; -#ifdef CONFIG_MTRR else if (!strncmp(opt, "mtrr:", 5)) mtrr = simple_strtoul(opt + 5, NULL, 0); -#endif else if (!strncmp(opt, "fasttext:", 9)) fasttext = simple_strtoul(opt + 9, NULL, 0); else diff --git a/drivers/video/fbdev/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index 8bac309c24b9..dd0f18e42d3e 100644 --- a/drivers/video/fbdev/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c @@ -26,13 +26,9 @@ #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ #include <video/vga.h> -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif - struct vt8623fb_info { char __iomem *mmio_base; - int mtrr_reg; + int wc_cookie; struct vgastate state; struct mutex open_lock; unsigned int ref_count; @@ -99,10 +95,7 @@ static struct svga_timing_regs vt8623_timing_regs = { /* Module parameters */ static char *mode_option = "640x480-8@60"; - -#ifdef CONFIG_MTRR static int mtrr = 1; -#endif MODULE_AUTHOR("(c) 2006 Ondrej Zajicek <santiago@crfreenet.org>"); MODULE_LICENSE("GPL"); @@ -112,11 +105,8 @@ module_param(mode_option, charp, 0644); MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)"); module_param_named(mode, mode_option, charp, 0); MODULE_PARM_DESC(mode, "Default video mode e.g. '648x480-8@60' (deprecated)"); - -#ifdef CONFIG_MTRR module_param(mtrr, int, 0444); MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)"); -#endif /* ------------------------------------------------------------------------- */ @@ -710,7 +700,7 @@ static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) info->fix.mmio_len = pci_resource_len(dev, 1); /* Map physical IO memory address into kernel space */ - info->screen_base = pci_iomap(dev, 0, 0); + info->screen_base = pci_iomap_wc(dev, 0, 0); if (! info->screen_base) { rc = -ENOMEM; dev_err(info->device, "iomap for framebuffer failed\n"); @@ -781,12 +771,9 @@ static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* Record a reference to the driver data */ pci_set_drvdata(dev, info); -#ifdef CONFIG_MTRR - if (mtrr) { - par->mtrr_reg = -1; - par->mtrr_reg = mtrr_add(info->fix.smem_start, info->fix.smem_len, MTRR_TYPE_WRCOMB, 1); - } -#endif + if (mtrr) + par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, + info->fix.smem_len); return 0; @@ -816,13 +803,7 @@ static void vt8623_pci_remove(struct pci_dev *dev) if (info) { struct vt8623fb_info *par = info->par; -#ifdef CONFIG_MTRR - if (par->mtrr_reg >= 0) { - mtrr_del(par->mtrr_reg, 0, 0); - par->mtrr_reg = -1; - } -#endif - + arch_phys_wc_del(par->wc_cookie); unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); |