diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-06-29 11:00:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-06-29 11:00:17 -0700 |
commit | 1b722407a13b7f8658d2e26917791f32805980a2 (patch) | |
tree | 30aab582725a46e42843d75e2eb9ce4151f0f3ed /drivers/video | |
parent | f8824e151fbfa0ac0a258015d606ea6f4a10251b (diff) | |
parent | 5ff2977b19769fd24b0cfbe7cbe4d5114b6106af (diff) |
Merge tag 'drm-next-2023-06-29' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie:
"There is one set of patches to misc for a i915 gsc/mei proxy driver.
Otherwise it's mostly amdgpu/i915/msm, lots of hw enablement and lots
of refactoring.
core:
- replace strlcpy with strscpy
- EDID changes to support further conversion to struct drm_edid
- Move i915 DSC parameter code to common DRM helpers
- Add Colorspace functionality
aperture:
- ignore framebuffers with non-primary devices
fbdev:
- use fbdev i/o helpers
- add Kconfig options for fb_ops helpers
- use new fb io helpers directly in drivers
sysfs:
- export DRM connector ID
scheduler:
- Avoid an infinite loop
ttm:
- store function table in .rodata
- Add query for TTM mem limit
- Add NUMA awareness to pools
- Export ttm_pool_fini()
bridge:
- fsl-ldb: support i.MX6SX
- lt9211, lt9611: remove blanking packets
- tc358768: implement input bus formats, devm cleanups
- ti-snd65dsi86: implement wait_hpd_asserted
- analogix: fix endless probe loop
- samsung-dsim: support swapped clock, fix enabling, support var
clock
- display-connector: Add support for external power supply
- imx: Fix module linking
- tc358762: Support reset GPIO
panel:
- nt36523: Support Lenovo J606F
- st7703: Support Anbernic RG353V-V2
- InnoLux G070ACE-L01 support
- boe-tv101wum-nl6: Improve initialization
- sharp-ls043t1le001: Mode fixes
- simple: BOE EV121WXM-N10-1850, S6D7AA0
- Ampire AM-800480L1TMQW-T00H
- Rocktech RK043FN48H
- Starry himax83102-j02
- Starry ili9882t
amdgpu:
- add new ctx query flag to handle reset better
- add new query/set shadow buffer for rdna3
- DCN 3.2/3.1.x/3.0.x updates
- Enable DC_FP on loongarch
- PCIe fix for RDNA2
- improve DC FAMS/SubVP support for better power management
- partition support for lots of engines
- Take NUMA into account when allocating memory
- Add new DRM_AMDGPU_WERROR config parameter to help with CI
- Initial SMU13 overdrive support
- Add support for new colorspace KMS API
- W=1 fixes
amdkfd:
- Query TTM mem limit rather than hardcoding it
- GC 9.4.3 partition support
- Handle NUMA for partitions
- Add debugger interface for enabling gdb
- Add KFD event age tracking
radeon:
- Fix possible UAF
i915:
- new getparam for PXP support
- GSC/MEI proxy driver
- Meteorlake display enablement
- avoid clearing preallocated framebuffers with TTM
- implement framebuffer mmap support
- Disable sampler indirect state in bindless heap
- Enable fdinfo for GuC backends
- GuC loading and firmware table handling fixes
- Various refactors for multi-tile enablement
- Define MOCS and PAT tables for MTL
- GSC/MEI support for Meteorlake
- PMU multi-tile support
- Large driver kernel doc cleanup
- Allow VRR toggling and arbitrary refresh rates
- Support async flips on linear buffers on display ver 12+
- Expose CRTC CTM property on ILK/SNB/VLV
- New debugfs for display clock frequencies
- Hotplug refactoring
- Display refactoring
- I915_GEM_CREATE_EXT_SET_PAT for Mesa on Meteorlake
- Use large rings for compute contexts
- HuC loading for MTL
- Allow user to set cache at BO creation
- MTL powermanagement enhancements
- Switch to dedicated workqueues to stop using flush_scheduled_work()
- Move display runtime init under display/
- Remove 10bit gamma on desktop gen3 parts, they don't support it
habanalabs:
- uapi: return 0 for user queries if there was a h/w or f/w error
- Add pci health check when we lose connection with the firmware.
This can be used to distinguish between pci link down and firmware
getting stuck.
- Add more info to the error print when TPC interrupt occur.
- Firmware fixes
msm:
- Adreno A660 bindings
- SM8350 MDSS bindings fix
- Added support for DPU on sm6350 and sm6375 platforms
- Implemented tearcheck support to support vsync on SM150 and newer
platforms
- Enabled missing features (DSPP, DSC, split display) on sc8180x,
sc8280xp, sm8450
- Added support for DSI and 28nm DSI PHY on MSM8226 platform
- Added support for DSI on sm6350 and sm6375 platforms
- Added support for display controller on MSM8226 platform
- A690 GPU support
- Move cmdstream dumping out of fence signaling path
- a610 support
- Support for a6xx devices without GMU
nouveau:
- NULL ptr before deref fixes
armada:
- implement fbdev emulation as client
sun4i:
- fix mipi-dsi dotclock
- release clocks
vc4:
- rgb range toggle property
- BT601 / BT2020 HDMI support
vkms:
- convert to drmm helpers
- add reflection and rotation support
- fix rgb565 conversion
gma500:
- fix iomem access
shmobile:
- support renesas soc platform
- enable fbdev
mxsfb:
- Add support for i.MX93 LCDIF
stm:
- dsi: Use devm_ helper
- ltdc: Fix potential invalid pointer deref
renesas:
- Group drivers in renesas subdirectory to prepare for new platform
- Drop deprecated R-Car H3 ES1.x support
meson:
- Add support for MIPI DSI displays
virtio:
- add sync object support
mediatek:
- Add display binding document for MT6795"
* tag 'drm-next-2023-06-29' of git://anongit.freedesktop.org/drm/drm: (1791 commits)
drm/i915: Fix a NULL vs IS_ERR() bug
drm/i915: make i915_drm_client_fdinfo() reference conditional again
drm/i915/huc: Fix missing error code in intel_huc_init()
drm/i915/gsc: take a wakeref for the proxy-init-completion check
drm/msm/a6xx: Add A610 speedbin support
drm/msm/a6xx: Add A619_holi speedbin support
drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching
drm/msm/a6xx: Use "else if" in GPU speedbin rev matching
drm/msm/a6xx: Fix some A619 tunables
drm/msm/a6xx: Add A610 support
drm/msm/a6xx: Add support for A619_holi
drm/msm/adreno: Disable has_cached_coherent in GMU wrapper configurations
drm/msm/a6xx: Introduce GMU wrapper support
drm/msm/a6xx: Move CX GMU power counter enablement to hw_init
drm/msm/a6xx: Extend and explain UBWC config
drm/msm/a6xx: Remove both GBIF and RBBM GBIF halt on hw init
drm/msm/a6xx: Add a helper for software-resetting the GPU
drm/msm/a6xx: Improve a6xx_bus_clear_pending_transactions()
drm/msm/a6xx: Move a6xx_bus_clear_pending_transactions to a6xx_gpu
drm/msm/a6xx: Move force keepalive vote removal to a6xx_gmu_force_off()
...
Diffstat (limited to 'drivers/video')
40 files changed, 441 insertions, 754 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index bf05363d8906..8b2b9ac37c3d 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -11,6 +11,13 @@ config APERTURE_HELPERS Support tracking and hand-over of aperture ownership. Required by graphics drivers for firmware-provided framebuffers. +config STI_CORE + bool + depends on PARISC + help + STI refers to the HP "Standard Text Interface" which is a set of + BIOS routines contained in a ROM chip in HP PA-RISC based machines. + config VIDEO_CMDLINE bool diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 831c9fa57a6c..6bbc03950899 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_APERTURE_HELPERS) += aperture.o +obj-$(CONFIG_STI_CORE) += sticore.o obj-$(CONFIG_VGASTATE) += vgastate.o obj-$(CONFIG_VIDEO_CMDLINE) += cmdline.o obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index b009468ffdff..561be8feca96 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -43,7 +43,7 @@ * base = mem->start; * size = resource_size(mem); * - * ret = aperture_remove_conflicting_devices(base, size, false, "example"); + * ret = aperture_remove_conflicting_devices(base, size, "example"); * if (ret) * return ret; * @@ -274,7 +274,6 @@ static void aperture_detach_devices(resource_size_t base, resource_size_t size) * aperture_remove_conflicting_devices - remove devices in the given range * @base: the aperture's base address in physical memory * @size: aperture size in bytes - * @primary: also kick vga16fb if present; only relevant for VGA devices * @name: a descriptive name of the requesting driver * * This function removes devices that own apertures within @base and @size. @@ -283,7 +282,7 @@ static void aperture_detach_devices(resource_size_t base, resource_size_t size) * 0 on success, or a negative errno code otherwise */ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, - bool primary, const char *name) + const char *name) { /* * If a driver asked to unregister a platform device registered by @@ -298,19 +297,42 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si aperture_detach_devices(base, size); - /* - * If this is the primary adapter, there could be a VGA device - * that consumes the VGA framebuffer I/O range. Remove this device - * as well. - */ - if (primary) - aperture_detach_devices(VGA_FB_PHYS_BASE, VGA_FB_PHYS_SIZE); - return 0; } EXPORT_SYMBOL(aperture_remove_conflicting_devices); /** + * __aperture_remove_legacy_vga_devices - remove legacy VGA devices of a PCI devices + * @pdev: PCI device + * + * This function removes VGA devices provided by @pdev, such as a VGA + * framebuffer or a console. This is useful if you have a VGA-compatible + * PCI graphics device with framebuffers in non-BAR locations. Drivers + * should acquire ownership of those memory areas and afterwards call + * this helper to release remaining VGA devices. + * + * If your hardware has its framebuffers accessible via PCI BARS, use + * aperture_remove_conflicting_pci_devices() instead. The function will + * release any VGA devices automatically. + * + * WARNING: Apparently we must remove graphics drivers before calling + * this helper. Otherwise the vga fbdev driver falls over if + * we have vgacon configured. + * + * Returns: + * 0 on success, or a negative errno code otherwise + */ +int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev) +{ + /* VGA framebuffer */ + aperture_detach_devices(VGA_FB_PHYS_BASE, VGA_FB_PHYS_SIZE); + + /* VGA textmode console */ + return vga_remove_vgacon(pdev); +} +EXPORT_SYMBOL(__aperture_remove_legacy_vga_devices); + +/** * aperture_remove_conflicting_pci_devices - remove existing framebuffers for PCI devices * @pdev: PCI device * @name: a descriptive name of the requesting driver @@ -326,11 +348,13 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na { bool primary = false; resource_size_t base, size; - int bar, ret; + int bar, ret = 0; -#ifdef CONFIG_X86 - primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -#endif + if (pdev == vga_default_device()) + primary = true; + + if (primary) + sysfb_disable(); for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) { if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) @@ -338,20 +362,18 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na base = pci_resource_start(pdev, bar); size = pci_resource_len(pdev, bar); - ret = aperture_remove_conflicting_devices(base, size, primary, name); - if (ret) - return ret; + aperture_detach_devices(base, size); } /* - * WARNING: Apparently we must kick fbdev drivers before vgacon, - * otherwise the vga fbdev driver falls over. + * If this is the primary adapter, there could be a VGA device + * that consumes the VGA framebuffer I/O range. Remove this + * device as well. */ - ret = vga_remove_vgacon(pdev); - if (ret) - return ret; + if (primary) + ret = __aperture_remove_legacy_vga_devices(pdev); - return 0; + return ret; } EXPORT_SYMBOL(aperture_remove_conflicting_pci_devices); diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 22cea5082ac4..a2a88d42edf0 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -141,6 +141,7 @@ config STI_CONSOLE depends on PARISC && HAS_IOMEM select FONT_SUPPORT select CRC32 + select STI_CORE default y help The STI console is the builtin display/keyboard on HP-PARISC diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index db07b784bd2c..fd79016a0d95 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -5,8 +5,6 @@ obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o -obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o +obj-$(CONFIG_STI_CONSOLE) += sticon.o obj-$(CONFIG_VGA_CONSOLE) += vgacon.o obj-$(CONFIG_MDA_CONSOLE) += mdacon.o - -obj-$(CONFIG_FB_STI) += sticore.o diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c index 2cea69418a83..d11cfd2d68b5 100644 --- a/drivers/video/console/sticon.c +++ b/drivers/video/console/sticon.c @@ -50,7 +50,7 @@ #include <asm/io.h> -#include "../fbdev/sticore.h" +#include <video/sticore.h> /* switching to graphics mode */ #define BLANK 0 @@ -282,7 +282,7 @@ static void sticon_init(struct vc_data *c, int init) vc_cols = sti_onscreen_x(sti) / sti->font->width; vc_rows = sti_onscreen_y(sti) / sti->font->height; c->vc_can_do_color = 1; - + if (init) { c->vc_cols = vc_cols; c->vc_rows = vc_rows; @@ -374,7 +374,7 @@ static const struct consw sti_con = { .con_font_set = sticon_font_set, .con_font_default = sticon_font_default, .con_build_attr = sticon_build_attr, - .con_invert_region = sticon_invert_region, + .con_invert_region = sticon_invert_region, }; diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 0fdf5f46802c..6df9bd09454a 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -158,6 +158,27 @@ config FB_DEFERRED_IO bool depends on FB +config FB_IO_HELPERS + bool + depends on FB + select FB_CFB_COPYAREA + select FB_CFB_FILLRECT + select FB_CFB_IMAGEBLIT + +config FB_SYS_HELPERS + bool + depends on FB + select FB_SYS_COPYAREA + select FB_SYS_FILLRECT + select FB_SYS_FOPS + select FB_SYS_IMAGEBLIT + +config FB_SYS_HELPERS_DEFERRED + bool + depends on FB + select FB_DEFERRED_IO + select FB_SYS_HELPERS + config FB_HECUBA tristate depends on FB @@ -551,10 +572,9 @@ config FB_STI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select STI_CORE default y help - STI refers to the HP "Standard Text Interface" which is a set of - BIOS routines contained in a ROM chip in HP PA-RISC based machines. Enabling this option will implement the linux framebuffer device using calls to the STI BIOS routines for initialisation. diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c index 08d15e408413..9aaea3be8281 100644 --- a/drivers/video/fbdev/arcfb.c +++ b/drivers/video/fbdev/arcfb.c @@ -41,6 +41,7 @@ #include <linux/vmalloc.h> #include <linux/delay.h> #include <linux/interrupt.h> +#include <linux/io.h> #include <linux/fb.h> #include <linux/init.h> #include <linux/arcfb.h> @@ -260,7 +261,7 @@ static void arcfb_lcd_update_page(struct arcfb_par *par, unsigned int upper, ks108_set_yaddr(par, chipindex, upper/8); linesize = par->info->var.xres/8; - src = (unsigned char __force *) par->info->screen_base + (left/8) + + src = (unsigned char *)par->info->screen_buffer + (left/8) + (upper * linesize); ks108_set_xaddr(par, chipindex, left); @@ -451,6 +452,9 @@ static ssize_t arcfb_write(struct fb_info *info, const char __user *buf, struct arcfb_par *par; unsigned int xres; + if (!info->screen_buffer) + return -ENODEV; + p = *ppos; par = info->par; xres = info->var.xres; @@ -468,7 +472,7 @@ static ssize_t arcfb_write(struct fb_info *info, const char __user *buf, if (count) { char *base_addr; - base_addr = (char __force *)info->screen_base; + base_addr = info->screen_buffer; count -= copy_from_user(base_addr + p, buf, count); *ppos += count; err = -EFAULT; @@ -525,7 +529,7 @@ static int arcfb_probe(struct platform_device *dev) if (!info) goto err_fb_alloc; - info->screen_base = (char __iomem *)videomemory; + info->screen_buffer = videomemory; info->fbops = &arcfb_ops; info->var = arcfb_var; @@ -598,7 +602,7 @@ static void arcfb_remove(struct platform_device *dev) unregister_framebuffer(info); if (irq) free_irq(((struct arcfb_par *)(info->par))->irq, info); - vfree((void __force *)info->screen_base); + vfree(info->screen_buffer); framebuffer_release(info); } } diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h index 465f55beb97f..30da3e82ed3c 100644 --- a/drivers/video/fbdev/aty/atyfb.h +++ b/drivers/video/fbdev/aty/atyfb.h @@ -3,8 +3,10 @@ * ATI Frame Buffer Device Driver Core Definitions */ +#include <linux/io.h> #include <linux/spinlock.h> #include <linux/wait.h> + /* * Elements of the hardware specific atyfb_par structure */ diff --git a/drivers/video/fbdev/aty/mach64_cursor.c b/drivers/video/fbdev/aty/mach64_cursor.c index 4ad0331a8c57..971355c2cd7e 100644 --- a/drivers/video/fbdev/aty/mach64_cursor.c +++ b/drivers/video/fbdev/aty/mach64_cursor.c @@ -153,7 +153,7 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor) u8 m, b; // Clear cursor image with 1010101010... - fb_memset(dst, 0xaa, 1024); + fb_memset_io(dst, 0xaa, 1024); offset = align - width*2; diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index aed88ce45bf0..5c232eb13724 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1568,7 +1568,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) fbi->fix.mmio_len = 0; fbi->fix.accel = FB_ACCEL_NONE; - fbi->screen_base = (char __iomem *) fbdev->fb_mem; + fbi->screen_buffer = fbdev->fb_mem; au1200fb_update_fbinfo(fbi); diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 678d182d187d..06403a4fe0e3 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c @@ -824,7 +824,7 @@ static void broadsheet_init_display(struct broadsheetfb_par *par) broadsheet_burst_write(par, (panel_table[par->panel_index].w * panel_table[par->panel_index].h)/2, - (u16 *) par->info->screen_base); + (u16 *)par->info->screen_buffer); broadsheet_send_command(par, BS_CMD_LD_IMG_END); @@ -865,7 +865,7 @@ static void broadsheetfb_dpy_update_pages(struct broadsheetfb_par *par, u16 y1, u16 y2) { u16 args[5]; - unsigned char *buf = (unsigned char *)par->info->screen_base; + unsigned char *buf = par->info->screen_buffer; mutex_lock(&(par->io_lock)); /* y1 must be a multiple of 4 so drop the lower bits */ @@ -913,7 +913,7 @@ static void broadsheetfb_dpy_update(struct broadsheetfb_par *par) broadsheet_send_cmdargs(par, BS_CMD_WR_REG, 1, args); broadsheet_burst_write(par, (panel_table[par->panel_index].w * panel_table[par->panel_index].h)/2, - (u16 *) par->info->screen_base); + (u16 *)par->info->screen_buffer); broadsheet_send_command(par, BS_CMD_LD_IMG_END); @@ -1013,8 +1013,8 @@ static ssize_t broadsheetfb_write(struct fb_info *info, const char __user *buf, int err = 0; unsigned long total_size; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; + if (!info->screen_buffer) + return -ENODEV; total_size = info->fix.smem_len; @@ -1033,7 +1033,7 @@ static ssize_t broadsheetfb_write(struct fb_info *info, const char __user *buf, count = total_size - p; } - dst = (void *)(info->screen_base + p); + dst = info->screen_buffer + p; if (copy_from_user(dst, buf, count)) err = -EFAULT; @@ -1109,7 +1109,7 @@ static int broadsheetfb_probe(struct platform_device *dev) if (!videomemory) goto err_fb_rel; - info->screen_base = (char *)videomemory; + info->screen_buffer = videomemory; info->fbops = &broadsheetfb_ops; broadsheetfb_var.xres = dpyw; @@ -1205,7 +1205,7 @@ static void broadsheetfb_remove(struct platform_device *dev) fb_deferred_io_cleanup(info); par->board->cleanup(par); fb_dealloc_cmap(&info->cmap); - vfree((void *)info->screen_base); + vfree(info->screen_buffer); module_put(par->board->owner); framebuffer_release(info); } diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 7799d52a651f..2a27ba94f652 100644 --- a/drivers/video/fbdev/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c @@ -332,7 +332,7 @@ static const struct fb_var_screeninfo chipsfb_var = { static void init_chips(struct fb_info *p, unsigned long addr) { - fb_memset(p->screen_base, 0, 0x100000); + fb_memset_io(p->screen_base, 0, 0x100000); p->fix = chipsfb_fix; p->fix.smem_start = addr; diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c index feeace079425..3d59a01ec677 100644 --- a/drivers/video/fbdev/cobalt_lcdfb.c +++ b/drivers/video/fbdev/cobalt_lcdfb.c @@ -129,6 +129,9 @@ static ssize_t cobalt_lcdfb_read(struct fb_info *info, char __user *buf, unsigned long pos; int len, retval = 0; + if (!info->screen_base) + return -ENODEV; + pos = *ppos; if (pos >= LCD_CHARS_MAX || count == 0) return 0; @@ -175,6 +178,9 @@ static ssize_t cobalt_lcdfb_write(struct fb_info *info, const char __user *buf, unsigned long pos; int len, retval = 0; + if (!info->screen_base) + return -ENODEV; + pos = *ppos; if (pos >= LCD_CHARS_MAX || count == 0) return 0; diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index 08fabce76b74..8f0060160ffb 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -2,7 +2,7 @@ obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ - modedb.o fbcvt.o fb_cmdline.o + modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y) diff --git a/drivers/video/fbdev/core/fb_io_fops.c b/drivers/video/fbdev/core/fb_io_fops.c new file mode 100644 index 000000000000..5985e5e1b040 --- /dev/null +++ b/drivers/video/fbdev/core/fb_io_fops.c @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/fb.h> +#include <linux/module.h> +#include <linux/uaccess.h> + +ssize_t fb_io_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos) +{ + unsigned long p = *ppos; + u8 *buffer, *dst; + u8 __iomem *src; + int c, cnt = 0, err = 0; + unsigned long total_size, trailing; + + if (!info->screen_base) + return -ENODEV; + + total_size = info->screen_size; + + if (total_size == 0) + total_size = info->fix.smem_len; + + if (p >= total_size) + return 0; + + if (count >= total_size) + count = total_size; + + if (count + p > total_size) + count = total_size - p; + + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, + GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + src = (u8 __iomem *) (info->screen_base + p); + + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + + while (count) { + c = (count > PAGE_SIZE) ? PAGE_SIZE : count; + dst = buffer; + fb_memcpy_fromio(dst, src, c); + dst += c; + src += c; + + trailing = copy_to_user(buf, buffer, c); + if (trailing == c) { + err = -EFAULT; + break; + } + c -= trailing; + + *ppos += c; + buf += c; + cnt += c; + count -= c; + } + + kfree(buffer); + + return cnt ? cnt : err; +} +EXPORT_SYMBOL(fb_io_read); + +ssize_t fb_io_write(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos) +{ + unsigned long p = *ppos; + u8 *buffer, *src; + u8 __iomem *dst; + int c, cnt = 0, err = 0; + unsigned long total_size, trailing; + + if (!info->screen_base) + return -ENODEV; + + total_size = info->screen_size; + + if (total_size == 0) + total_size = info->fix.smem_len; + + if (p > total_size) + return -EFBIG; + + if (count > total_size) { + err = -EFBIG; + count = total_size; + } + + if (count + p > total_size) { + if (!err) + err = -ENOSPC; + + count = total_size - p; + } + + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, + GFP_KERNEL); + if (!buffer) + return -ENOMEM; + + dst = (u8 __iomem *) (info->screen_base + p); + + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + + while (count) { + c = (count > PAGE_SIZE) ? PAGE_SIZE : count; + src = buffer; + + trailing = copy_from_user(src, buf, c); + if (trailing == c) { + err = -EFAULT; + break; + } + c -= trailing; + + fb_memcpy_toio(dst, src, c); + dst += c; + src += c; + *ppos += c; + buf += c; + cnt += c; + count -= c; + } + + kfree(buffer); + + return (cnt) ? cnt : err; +} +EXPORT_SYMBOL(fb_io_write); diff --git a/drivers/video/fbdev/core/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c index ff275d7f3eaf..0cb0989abda6 100644 --- a/drivers/video/fbdev/core/fb_sys_fops.c +++ b/drivers/video/fbdev/core/fb_sys_fops.c @@ -19,10 +19,11 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count, unsigned long p = *ppos; void *src; int err = 0; - unsigned long total_size; + unsigned long total_size, c; + ssize_t ret; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; + if (!info->screen_buffer) + return -ENODEV; total_size = info->screen_size; @@ -38,18 +39,19 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count, if (count + p > total_size) count = total_size - p; - src = (void __force *)(info->screen_base + p); + src = info->screen_buffer + p; if (info->fbops->fb_sync) info->fbops->fb_sync(info); - if (copy_to_user(buf, src, count)) + c = copy_to_user(buf, src, count); + if (c) err = -EFAULT; + ret = count - c; - if (!err) - *ppos += count; + *ppos += ret; - return (err) ? err : count; + return ret ? ret : err; } EXPORT_SYMBOL_GPL(fb_sys_read); @@ -59,10 +61,11 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, unsigned long p = *ppos; void *dst; int err = 0; - unsigned long total_size; + unsigned long total_size, c; + size_t ret; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; + if (!info->screen_buffer) + return -ENODEV; total_size = info->screen_size; @@ -84,18 +87,19 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, count = total_size - p; } - dst = (void __force *) (info->screen_base + p); + dst = info->screen_buffer + p; if (info->fbops->fb_sync) info->fbops->fb_sync(info); - if (copy_from_user(dst, buf, count)) + c = copy_from_user(dst, buf, count); + if (c) err = -EFAULT; + ret = count - c; - if (!err) - *ppos += count; + *ppos += ret; - return (err) ? err : count; + return ret ? ret : err; } EXPORT_SYMBOL_GPL(fb_sys_write); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index eb565a10e5cd..c6c9d040bdec 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -75,7 +75,6 @@ #include <linux/interrupt.h> #include <linux/crc32.h> /* For counting font checksums */ #include <linux/uaccess.h> -#include <asm/fb.h> #include <asm/irq.h> #include "fbcon.h" diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 28739f1cb5e7..329d16e49a90 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -37,8 +37,6 @@ #include <linux/mem_encrypt.h> #include <linux/pci.h> -#include <asm/fb.h> - #include <video/nomodeset.h> #include <video/vga.h> @@ -761,14 +759,9 @@ static struct fb_info *file_fb_info(struct file *file) static ssize_t fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { - unsigned long p = *ppos; struct fb_info *info = file_fb_info(file); - u8 *buffer, *dst; - u8 __iomem *src; - int c, cnt = 0, err = 0; - unsigned long total_size; - if (!info || ! info->screen_base) + if (!info) return -ENODEV; if (info->state != FBINFO_STATE_RUNNING) @@ -777,63 +770,15 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) if (info->fbops->fb_read) return info->fbops->fb_read(info, buf, count, ppos); - total_size = info->screen_size; - - if (total_size == 0) - total_size = info->fix.smem_len; - - if (p >= total_size) - return 0; - - if (count >= total_size) - count = total_size; - - if (count + p > total_size) - count = total_size - p; - - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, - GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - src = (u8 __iomem *) (info->screen_base + p); - - if (info->fbops->fb_sync) - info->fbops->fb_sync(info); - - while (count) { - c = (count > PAGE_SIZE) ? PAGE_SIZE : count; - dst = buffer; - fb_memcpy_fromfb(dst, src, c); - dst += c; - src += c; - - if (copy_to_user(buf, buffer, c)) { - err = -EFAULT; - break; - } - *ppos += c; - buf += c; - cnt += c; - count -= c; - } - - kfree(buffer); - - return (err) ? err : cnt; + return fb_io_read(info, buf, count, ppos); } static ssize_t fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { - unsigned long p = *ppos; struct fb_info *info = file_fb_info(file); - u8 *buffer, *src; - u8 __iomem *dst; - int c, cnt = 0, err = 0; - unsigned long total_size; - if (!info || !info->screen_base) + if (!info) return -ENODEV; if (info->state != FBINFO_STATE_RUNNING) @@ -842,57 +787,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) if (info->fbops->fb_write) return info->fbops->fb_write(info, buf, count, ppos); - total_size = info->screen_size; - - if (total_size == 0) - total_size = info->fix.smem_len; - - if (p > total_size) - return -EFBIG; - - if (count > total_size) { - err = -EFBIG; - count = total_size; - } - - if (count + p > total_size) { - if (!err) - err = -ENOSPC; - - count = total_size - p; - } - - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, - GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - dst = (u8 __iomem *) (info->screen_base + p); - - if (info->fbops->fb_sync) - info->fbops->fb_sync(info); - - while (count) { - c = (count > PAGE_SIZE) ? PAGE_SIZE : count; - src = buffer; - - if (copy_from_user(src, buf, c)) { - err = -EFAULT; - break; - } - - fb_memcpy_tofb(dst, src, c); - dst += c; - src += c; - *ppos += c; - buf += c; - cnt += c; - count -= c; - } - - kfree(buffer); - - return (cnt) ? cnt : err; + return fb_io_write(info, buf, count, ppos); } int diff --git a/drivers/video/fbdev/hecubafb.c b/drivers/video/fbdev/hecubafb.c index 5a149458d3b4..7ce0a16ce8b9 100644 --- a/drivers/video/fbdev/hecubafb.c +++ b/drivers/video/fbdev/hecubafb.c @@ -102,7 +102,7 @@ static void apollo_send_command(struct hecubafb_par *par, unsigned char data) static void hecubafb_dpy_update(struct hecubafb_par *par) { int i; - unsigned char *buf = (unsigned char __force *)par->info->screen_base; + unsigned char *buf = par->info->screen_buffer; apollo_send_command(par, APOLLO_START_NEW_IMG); @@ -163,8 +163,8 @@ static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, int err = 0; unsigned long total_size; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; + if (!info->screen_buffer) + return -ENODEV; total_size = info->fix.smem_len; @@ -183,7 +183,7 @@ static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, count = total_size - p; } - dst = (void __force *) (info->screen_base + p); + dst = info->screen_buffer + p; if (copy_from_user(dst, buf, count)) err = -EFAULT; @@ -239,7 +239,7 @@ static int hecubafb_probe(struct platform_device *dev) if (!info) goto err_fballoc; - info->screen_base = (char __force __iomem *)videomemory; + info->screen_buffer = videomemory; info->fbops = &hecubafb_ops; info->var = hecubafb_var; @@ -287,7 +287,7 @@ static void hecubafb_remove(struct platform_device *dev) struct hecubafb_par *par = info->par; fb_deferred_io_cleanup(info); unregister_framebuffer(info); - vfree((void __force *)info->screen_base); + vfree(info->screen_buffer); if (par->board->remove) par->board->remove(par); module_put(par->board->owner); diff --git a/drivers/video/fbdev/hitfb.c b/drivers/video/fbdev/hitfb.c index 5f544a177033..9fd196637d14 100644 --- a/drivers/video/fbdev/hitfb.c +++ b/drivers/video/fbdev/hitfb.c @@ -42,17 +42,33 @@ static struct fb_fix_screeninfo hitfb_fix = { .accel = FB_ACCEL_NONE, }; +static volatile void __iomem *hitfb_offset_to_addr(unsigned int offset) +{ + return (__force volatile void __iomem *)(uintptr_t)offset; +} + +static u16 hitfb_readw(unsigned int offset) +{ + return fb_readw(hitfb_offset_to_addr(offset)); +} + +static void hitfb_writew(u16 value, unsigned int offset) +{ + fb_writew(value, hitfb_offset_to_addr(offset)); +} + static inline void hitfb_accel_wait(void) { - while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ; + while (hitfb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) + ; } static inline void hitfb_accel_start(int truecolor) { if (truecolor) { - fb_writew(6, HD64461_GRCFGR); + hitfb_writew(6, HD64461_GRCFGR); } else { - fb_writew(7, HD64461_GRCFGR); + hitfb_writew(7, HD64461_GRCFGR); } } @@ -63,11 +79,11 @@ static inline void hitfb_accel_set_dest(int truecolor, u16 dx, u16 dy, if (truecolor) saddr <<= 1; - fb_writew(width-1, HD64461_BBTDWR); - fb_writew(height-1, HD64461_BBTDHR); + hitfb_writew(width-1, HD64461_BBTDWR); + hitfb_writew(height-1, HD64461_BBTDHR); - fb_writew(saddr & 0xffff, HD64461_BBTDSARL); - fb_writew(saddr >> 16, HD64461_BBTDSARH); + hitfb_writew(saddr & 0xffff, HD64461_BBTDSARL); + hitfb_writew(saddr >> 16, HD64461_BBTDSARH); } @@ -80,7 +96,7 @@ static inline void hitfb_accel_bitblt(int truecolor, u16 sx, u16 sy, u16 dx, height--; width--; - fb_writew(rop, HD64461_BBTROPR); + hitfb_writew(rop, HD64461_BBTROPR); if ((sy < dy) || ((sy == dy) && (sx <= dx))) { saddr = WIDTH * (sy + height) + sx + width; daddr = WIDTH * (dy + height) + dx + width; @@ -91,32 +107,32 @@ static inline void hitfb_accel_bitblt(int truecolor, u16 sx, u16 sy, u16 dx, maddr = (((width >> 4) + 1) * (height + 1) - 1) * 2; - fb_writew((1 << 5) | 1, HD64461_BBTMDR); + hitfb_writew((1 << 5) | 1, HD64461_BBTMDR); } else - fb_writew(1, HD64461_BBTMDR); + hitfb_writew(1, HD64461_BBTMDR); } else { saddr = WIDTH * sy + sx; daddr = WIDTH * dy + dx; if (mask_addr) { - fb_writew((1 << 5), HD64461_BBTMDR); + hitfb_writew((1 << 5), HD64461_BBTMDR); } else { - fb_writew(0, HD64461_BBTMDR); + hitfb_writew(0, HD64461_BBTMDR); } } if (truecolor) { saddr <<= 1; daddr <<= 1; } - fb_writew(width, HD64461_BBTDWR); - fb_writew(height, HD64461_BBTDHR); - fb_writew(saddr & 0xffff, HD64461_BBTSSARL); - fb_writew(saddr >> 16, HD64461_BBTSSARH); - fb_writew(daddr & 0xffff, HD64461_BBTDSARL); - fb_writew(daddr >> 16, HD64461_BBTDSARH); + hitfb_writew(width, HD64461_BBTDWR); + hitfb_writew(height, HD64461_BBTDHR); + hitfb_writew(saddr & 0xffff, HD64461_BBTSSARL); + hitfb_writew(saddr >> 16, HD64461_BBTSSARH); + hitfb_writew(daddr & 0xffff, HD64461_BBTDSARL); + hitfb_writew(daddr >> 16, HD64461_BBTDSARH); if (mask_addr) { maddr += mask_addr; - fb_writew(maddr & 0xffff, HD64461_BBTMARL); - fb_writew(maddr >> 16, HD64461_BBTMARH); + hitfb_writew(maddr & 0xffff, HD64461_BBTMARL); + hitfb_writew(maddr >> 16, HD64461_BBTMARH); } hitfb_accel_start(truecolor); } @@ -127,17 +143,17 @@ static void hitfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) cfb_fillrect(p, rect); else { hitfb_accel_wait(); - fb_writew(0x00f0, HD64461_BBTROPR); - fb_writew(16, HD64461_BBTMDR); + hitfb_writew(0x00f0, HD64461_BBTROPR); + hitfb_writew(16, HD64461_BBTMDR); if (p->var.bits_per_pixel == 16) { - fb_writew(((u32 *) (p->pseudo_palette))[rect->color], + hitfb_writew(((u32 *) (p->pseudo_palette))[rect->color], HD64461_GRSCR); hitfb_accel_set_dest(1, rect->dx, rect->dy, rect->width, rect->height); hitfb_accel_start(1); } else { - fb_writew(rect->color, HD64461_GRSCR); + hitfb_writew(rect->color, HD64461_GRSCR); hitfb_accel_set_dest(0, rect->dx, rect->dy, rect->width, rect->height); hitfb_accel_start(0); @@ -162,7 +178,7 @@ static int hitfb_pan_display(struct fb_var_screeninfo *var, if (xoffset != 0) return -EINVAL; - fb_writew((yoffset*info->fix.line_length)>>10, HD64461_LCDCBAR); + hitfb_writew((yoffset*info->fix.line_length)>>10, HD64461_LCDCBAR); return 0; } @@ -172,33 +188,33 @@ static int hitfb_blank(int blank_mode, struct fb_info *info) unsigned short v; if (blank_mode) { - v = fb_readw(HD64461_LDR1); + v = hitfb_readw(HD64461_LDR1); v &= ~HD64461_LDR1_DON; - fb_writew(v, HD64461_LDR1); + hitfb_writew(v, HD64461_LDR1); - v = fb_readw(HD64461_LCDCCR); + v = hitfb_readw(HD64461_LCDCCR); v |= HD64461_LCDCCR_MOFF; - fb_writew(v, HD64461_LCDCCR); + hitfb_writew(v, HD64461_LCDCCR); - v = fb_readw(HD64461_STBCR); + v = hitfb_readw(HD64461_STBCR); v |= HD64461_STBCR_SLCDST; - fb_writew(v, HD64461_STBCR); + hitfb_writew(v, HD64461_STBCR); } else { - v = fb_readw(HD64461_STBCR); + v = hitfb_readw(HD64461_STBCR); v &= ~HD64461_STBCR_SLCDST; - fb_writew(v, HD64461_STBCR); + hitfb_writew(v, HD64461_STBCR); - v = fb_readw(HD64461_LCDCCR); + v = hitfb_readw(HD64461_LCDCCR); v &= ~(HD64461_LCDCCR_MOFF | HD64461_LCDCCR_STREQ); - fb_writew(v, HD64461_LCDCCR); + hitfb_writew(v, HD64461_LCDCCR); do { - v = fb_readw(HD64461_LCDCCR); + v = hitfb_readw(HD64461_LCDCCR); } while(v&HD64461_LCDCCR_STBACK); - v = fb_readw(HD64461_LDR1); + v = hitfb_readw(HD64461_LDR1); v |= HD64461_LDR1_DON; - fb_writew(v, HD64461_LDR1); + hitfb_writew(v, HD64461_LDR1); } return 0; } @@ -211,10 +227,10 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green, switch (info->var.bits_per_pixel) { case 8: - fb_writew(regno << 8, HD64461_CPTWAR); - fb_writew(red >> 10, HD64461_CPTWDR); - fb_writew(green >> 10, HD64461_CPTWDR); - fb_writew(blue >> 10, HD64461_CPTWDR); + hitfb_writew(regno << 8, HD64461_CPTWAR); + hitfb_writew(red >> 10, HD64461_CPTWDR); + hitfb_writew(green >> 10, HD64461_CPTWDR); + hitfb_writew(blue >> 10, HD64461_CPTWDR); break; case 16: if (regno >= 16) @@ -302,11 +318,11 @@ static int hitfb_set_par(struct fb_info *info) break; } - fb_writew(info->fix.line_length, HD64461_LCDCLOR); - ldr3 = fb_readw(HD64461_LDR3); + hitfb_writew(info->fix.line_length, HD64461_LCDCLOR); + ldr3 = hitfb_readw(HD64461_LDR3); ldr3 &= ~15; ldr3 |= (info->var.bits_per_pixel == 8) ? 4 : 8; - fb_writew(ldr3, HD64461_LDR3); + hitfb_writew(ldr3, HD64461_LDR3); return 0; } @@ -337,9 +353,9 @@ static int hitfb_probe(struct platform_device *dev) hitfb_fix.smem_start = HD64461_IO_OFFSET(0x02000000); hitfb_fix.smem_len = 512 * 1024; - lcdclor = fb_readw(HD64461_LCDCLOR); - ldvndr = fb_readw(HD64461_LDVNDR); - ldr3 = fb_readw(HD64461_LDR3); + lcdclor = hitfb_readw(HD64461_LCDCLOR); + ldvndr = hitfb_readw(HD64461_LDVNDR); + ldr3 = hitfb_readw(HD64461_LDR3); switch (ldr3 & 15) { default: @@ -429,9 +445,9 @@ static int hitfb_suspend(struct device *dev) u16 v; hitfb_blank(1, NULL); - v = fb_readw(HD64461_STBCR); + v = hitfb_readw(HD64461_STBCR); v |= HD64461_STBCR_SLCKE_IST; - fb_writew(v, HD64461_STBCR); + hitfb_writew(v, HD64461_STBCR); return 0; } @@ -440,12 +456,12 @@ static int hitfb_resume(struct device *dev) { u16 v; - v = fb_readw(HD64461_STBCR); + v = hitfb_readw(HD64461_STBCR); v &= ~HD64461_STBCR_SLCKE_OST; msleep(100); - v = fb_readw(HD64461_STBCR); + v = hitfb_readw(HD64461_STBCR); v &= ~HD64461_STBCR_SLCKE_IST; - fb_writew(v, HD64461_STBCR); + hitfb_writew(v, HD64461_STBCR); hitfb_blank(0, NULL); return 0; diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 34781dec3856..1ae35ab62b29 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -1073,7 +1073,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) info->screen_size = dio_fb_size; getmem_done: - aperture_remove_conflicting_devices(base, size, false, KBUILD_MODNAME); + aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); if (gen2vm) { /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c index 0596573ef140..3f277bdb3a32 100644 --- a/drivers/video/fbdev/kyro/fbdev.c +++ b/drivers/video/fbdev/kyro/fbdev.c @@ -737,7 +737,7 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) info->var.bits_per_pixel); size *= info->var.yres_virtual; - fb_memset(info->screen_base, 0, size); + fb_memset_io(info->screen_base, 0, size); if (register_framebuffer(info) < 0) goto out_unmap; diff --git a/drivers/video/fbdev/matrox/matroxfb_accel.c b/drivers/video/fbdev/matrox/matroxfb_accel.c index 9cb0685feddd..ce51227798a1 100644 --- a/drivers/video/fbdev/matrox/matroxfb_accel.c +++ b/drivers/video/fbdev/matrox/matroxfb_accel.c @@ -88,7 +88,7 @@ static inline void matrox_cfb4_pal(u_int32_t* pal) { unsigned int i; - + for (i = 0; i < 16; i++) { pal[i] = i * 0x11111111U; } @@ -96,7 +96,7 @@ static inline void matrox_cfb4_pal(u_int32_t* pal) { static inline void matrox_cfb8_pal(u_int32_t* pal) { unsigned int i; - + for (i = 0; i < 16; i++) { pal[i] = i * 0x01010101U; } @@ -482,7 +482,7 @@ static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx, /* Tell... well, why bother... */ while (height--) { size_t i; - + for (i = 0; i < step; i += 4) { /* Hope that there are at least three readable bytes beyond the end of bitmap */ fb_writel(get_unaligned((u_int32_t*)(chardata + i)),mmio.vaddr); diff --git a/drivers/video/fbdev/matrox/matroxfb_base.h b/drivers/video/fbdev/matrox/matroxfb_base.h index 958be6805f87..c93c69bbcd57 100644 --- a/drivers/video/fbdev/matrox/matroxfb_base.h +++ b/drivers/video/fbdev/matrox/matroxfb_base.h @@ -301,9 +301,9 @@ struct matrox_altout { int (*verifymode)(void* altout_dev, u_int32_t mode); int (*getqueryctrl)(void* altout_dev, struct v4l2_queryctrl* ctrl); - int (*getctrl)(void* altout_dev, + int (*getctrl)(void *altout_dev, struct v4l2_control* ctrl); - int (*setctrl)(void* altout_dev, + int (*setctrl)(void *altout_dev, struct v4l2_control* ctrl); }; diff --git a/drivers/video/fbdev/metronomefb.c b/drivers/video/fbdev/metronomefb.c index 4e50882d080c..ebdb4949c4ac 100644 --- a/drivers/video/fbdev/metronomefb.c +++ b/drivers/video/fbdev/metronomefb.c @@ -438,7 +438,7 @@ static void metronomefb_dpy_update(struct metronomefb_par *par) { int fbsize; u16 cksum; - unsigned char *buf = (unsigned char __force *)par->info->screen_base; + unsigned char *buf = par->info->screen_buffer; fbsize = par->info->fix.smem_len; /* copy from vm to metromem */ @@ -453,7 +453,7 @@ static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index) { int i; u16 csum = 0; - u16 *buf = (u16 __force *)(par->info->screen_base + index); + u16 *buf = (u16 *)(par->info->screen_buffer + index); u16 *img = (u16 *)(par->metromem_img + index); /* swizzle from vm to metromem and recalc cksum at the same time*/ @@ -523,8 +523,8 @@ static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf, int err = 0; unsigned long total_size; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; + if (!info->screen_buffer) + return -ENODEV; total_size = info->fix.smem_len; @@ -543,7 +543,7 @@ static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf, count = total_size - p; } - dst = (void __force *)(info->screen_base + p); + dst = info->screen_buffer + p; if (copy_from_user(dst, buf, count)) err = -EFAULT; @@ -599,7 +599,7 @@ static int metronomefb_probe(struct platform_device *dev) goto err; /* we have two blocks of memory. - info->screen_base which is vm, and is the fb used by apps. + info->screen_buffer which is vm, and is the fb used by apps. par->metromem which is physically contiguous memory and contains the display controller commands, waveform, processed image data and padding. this is the data pulled @@ -634,7 +634,7 @@ static int metronomefb_probe(struct platform_device *dev) if (!videomemory) goto err_fb_rel; - info->screen_base = (char __force __iomem *)videomemory; + info->screen_buffer = videomemory; info->fbops = &metronomefb_ops; metronomefb_fix.line_length = fw; @@ -756,7 +756,7 @@ static void metronomefb_remove(struct platform_device *dev) fb_dealloc_cmap(&info->cmap); par->board->cleanup(par); vfree(par->csum_table); - vfree((void __force *)info->screen_base); + vfree(info->screen_buffer); module_put(par->board->owner); dev_dbg(&dev->dev, "calling release\n"); framebuffer_release(info); diff --git a/drivers/video/fbdev/ps3fb.c b/drivers/video/fbdev/ps3fb.c index 98aaa330a193..d4abcf8aff75 100644 --- a/drivers/video/fbdev/ps3fb.c +++ b/drivers/video/fbdev/ps3fb.c @@ -650,7 +650,7 @@ static int ps3fb_set_par(struct fb_info *info) } /* Clear XDR frame buffer memory */ - memset((void __force *)info->screen_base, 0, info->fix.smem_len); + memset(info->screen_buffer, 0, info->fix.smem_len); /* Clear DDR frame buffer memory */ lines = vmode->yres * par->num_frames; @@ -1140,7 +1140,7 @@ static int ps3fb_probe(struct ps3_system_bus_device *dev) * memory */ fb_start = ps3fb_videomemory.address + GPU_FB_START; - info->screen_base = (char __force __iomem *)fb_start; + info->screen_buffer = fb_start; info->fix.smem_start = __pa(fb_start); info->fix.smem_len = ps3fb_videomemory.size - GPU_FB_START; diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index 6888127a5eb8..c692cd597ce3 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -647,6 +647,9 @@ static ssize_t pvr2fb_write(struct fb_info *info, const char *buf, struct page **pages; int ret, i; + if (!info->screen_base) + return -ENODEV; + nr_pages = (count + PAGE_SIZE - 1) >> PAGE_SHIFT; pages = kmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL); @@ -798,7 +801,7 @@ static int __maybe_unused pvr2fb_common_init(void) goto out_err; } - fb_memset(fb_info->screen_base, 0, pvr2_fix.smem_len); + fb_memset_io(fb_info->screen_base, 0, pvr2_fix.smem_len); pvr2_fix.ypanstep = nopan ? 0 : 1; pvr2_fix.ywrapstep = nowrap ? 0 : 1; diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c index b528776c7612..b7ad3c644e13 100644 --- a/drivers/video/fbdev/sm712fb.c +++ b/drivers/video/fbdev/sm712fb.c @@ -1028,12 +1028,9 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, int c, i, cnt = 0, err = 0; unsigned long total_size; - if (!info || !info->screen_base) + if (!info->screen_base) return -ENODEV; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - total_size = info->screen_size; if (total_size == 0) @@ -1094,12 +1091,9 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, int c, i, cnt = 0, err = 0; unsigned long total_size; - if (!info || !info->screen_base) + if (!info->screen_base) return -ENODEV; - if (info->state != FBINFO_STATE_RUNNING) - return -EPERM; - total_size = info->screen_size; if (total_size == 0) diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c index 2ad6e98ce10d..17cec62cc65d 100644 --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -1150,7 +1150,7 @@ static void ufx_free_framebuffer(struct ufx_data *dev) fb_dealloc_cmap(&info->cmap); if (info->monspecs.modedb) fb_destroy_modedb(info->monspecs.modedb); - vfree(info->screen_base); + vfree(info->screen_buffer); fb_destroy_modelist(&info->modelist); @@ -1257,7 +1257,7 @@ static int ufx_ops_set_par(struct fb_info *info) if ((result == 0) && (dev->fb_count == 0)) { /* paint greenscreen */ - pix_framebuffer = (u16 *) info->screen_base; + pix_framebuffer = (u16 *)info->screen_buffer; for (i = 0; i < info->fix.smem_len / 2; i++) pix_framebuffer[i] = 0x37e6; @@ -1303,7 +1303,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) { int old_len = info->fix.smem_len; int new_len; - unsigned char *old_fb = info->screen_base; + unsigned char *old_fb = info->screen_buffer; unsigned char *new_fb; pr_debug("Reallocating framebuffer. Addresses will change!"); @@ -1318,12 +1318,12 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) if (!new_fb) return -ENOMEM; - if (info->screen_base) { + if (info->screen_buffer) { memcpy(new_fb, old_fb, old_len); - vfree(info->screen_base); + vfree(info->screen_buffer); } - info->screen_base = new_fb; + info->screen_buffer = new_fb; info->fix.smem_len = PAGE_ALIGN(new_len); info->fix.smem_start = (unsigned long) new_fb; info->flags = smscufx_info_flags; @@ -1746,7 +1746,7 @@ reset_active: atomic_set(&dev->usb_active, 0); setup_modes: fb_destroy_modedb(info->monspecs.modedb); - vfree(info->screen_base); + vfree(info->screen_buffer); fb_destroy_modelist(&info->modelist); error: fb_dealloc_cmap(&info->cmap); diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 132d1a205011..11c373798279 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -301,6 +301,9 @@ static ssize_t ssd1307fb_write(struct fb_info *info, const char __user *buf, void *dst; int ret; + if (!info->screen_buffer) + return -ENODEV; + total_size = info->fix.smem_len; if (p > total_size) diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c index da296b2ab54a..582324f5d869 100644 --- a/drivers/video/fbdev/sstfb.c +++ b/drivers/video/fbdev/sstfb.c @@ -335,7 +335,7 @@ static int sst_calc_pll(const int freq, int *freq_out, struct pll_timing *t) static void sstfb_clear_screen(struct fb_info *info) { /* clear screen */ - fb_memset(info->screen_base, 0, info->fix.smem_len); + fb_memset_io(info->screen_base, 0, info->fix.smem_len); } diff --git a/drivers/video/fbdev/sticore.h b/drivers/video/fbdev/sticore.h deleted file mode 100644 index 0ebdd28a0b81..000000000000 --- a/drivers/video/fbdev/sticore.h +++ /dev/null @@ -1,404 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef STICORE_H -#define STICORE_H - -/* generic STI structures & functions */ - -#define MAX_STI_ROMS 4 /* max no. of ROMs which this driver handles */ - -#define STI_REGION_MAX 8 /* hardcoded STI constants */ -#define STI_DEV_NAME_LENGTH 32 -#define STI_MONITOR_MAX 256 - -#define STI_FONT_HPROMAN8 1 -#define STI_FONT_KANA8 2 - -#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */ -#define ALT_CODE_TYPE_PA_RISC_64 0x01 - -/* The latency of the STI functions cannot really be reduced by setting - * this to 0; STI doesn't seem to be designed to allow calling a different - * function (or the same function with different arguments) after a - * function exited with 1 as return value. - * - * As all of the functions below could be called from interrupt context, - * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1) - * block. Really bad latency there. - * - * Probably the best solution to all this is have the generic code manage - * the screen buffer and a kernel thread to call STI occasionally. - * - * Luckily, the frame buffer guys have the same problem so we can just wait - * for them to fix it and steal their solution. prumpf - */ - -#include <asm/io.h> - -#define STI_WAIT 1 - -#define STI_PTR(p) ( virt_to_phys(p) ) -#define PTR_STI(p) ( phys_to_virt((unsigned long)p) ) - -#define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) -#define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) - -/* sti_font_xy() use the native font ROM ! */ -#define sti_font_x(sti) (PTR_STI(sti->font)->width) -#define sti_font_y(sti) (PTR_STI(sti->font)->height) - -#ifdef CONFIG_64BIT -#define STI_LOWMEM (GFP_KERNEL | GFP_DMA) -#else -#define STI_LOWMEM (GFP_KERNEL) -#endif - - -/* STI function configuration structs */ - -typedef union region { - struct { - u32 offset : 14; /* offset in 4kbyte page */ - u32 sys_only : 1; /* don't map to user space */ - u32 cache : 1; /* map to data cache */ - u32 btlb : 1; /* map to block tlb */ - u32 last : 1; /* last region in list */ - u32 length : 14; /* length in 4kbyte page */ - } region_desc; - - u32 region; /* complete region value */ -} region_t; - -#define REGION_OFFSET_TO_PHYS( rt, hpa ) \ - (((rt).region_desc.offset << 12) + (hpa)) - -struct sti_glob_cfg_ext { - u8 curr_mon; /* current monitor configured */ - u8 friendly_boot; /* in friendly boot mode */ - s16 power; /* power calculation (in Watts) */ - s32 freq_ref; /* frequency reference */ - u32 sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_glob_cfg { - s32 text_planes; /* number of planes used for text */ - s16 onscreen_x; /* screen width in pixels */ - s16 onscreen_y; /* screen height in pixels */ - s16 offscreen_x; /* offset width in pixels */ - s16 offscreen_y; /* offset height in pixels */ - s16 total_x; /* frame buffer width in pixels */ - s16 total_y; /* frame buffer height in pixels */ - u32 region_ptrs[STI_REGION_MAX]; /* region pointers */ - s32 reent_lvl; /* storage for reentry level value */ - u32 save_addr; /* where to save or restore reentrant state */ - u32 ext_ptr; /* pointer to extended glob_cfg data structure */ -}; - - -/* STI init function structs */ - -struct sti_init_flags { - u32 wait : 1; /* should routine idle wait or not */ - u32 reset : 1; /* hard reset the device? */ - u32 text : 1; /* turn on text display planes? */ - u32 nontext : 1; /* turn on non-text display planes? */ - u32 clear : 1; /* clear text display planes? */ - u32 cmap_blk : 1; /* non-text planes cmap black? */ - u32 enable_be_timer : 1; /* enable bus error timer */ - u32 enable_be_int : 1; /* enable bus error timer interrupt */ - u32 no_chg_tx : 1; /* don't change text settings */ - u32 no_chg_ntx : 1; /* don't change non-text settings */ - u32 no_chg_bet : 1; /* don't change berr timer settings */ - u32 no_chg_bei : 1; /* don't change berr int settings */ - u32 init_cmap_tx : 1; /* initialize cmap for text planes */ - u32 cmt_chg : 1; /* change current monitor type */ - u32 retain_ie : 1; /* don't allow reset to clear int enables */ - u32 caller_bootrom : 1; /* set only by bootrom for each call */ - u32 caller_kernel : 1; /* set only by kernel for each call */ - u32 caller_other : 1; /* set only by non-[BR/K] caller */ - u32 pad : 14; /* pad to word boundary */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_init_inptr_ext { - u8 config_mon_type; /* configure to monitor type */ - u8 pad[1]; /* pad to word boundary */ - u16 inflight_data; /* inflight data possible on PCI */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_init_inptr { - s32 text_planes; /* number of planes to use for text */ - u32 ext_ptr; /* pointer to extended init_graph inptr data structure*/ -}; - - -struct sti_init_outptr { - s32 errno; /* error number on failure */ - s32 text_planes; /* number of planes used for text */ - u32 future_ptr; /* pointer to future data */ -}; - - - -/* STI configuration function structs */ - -struct sti_conf_flags { - u32 wait : 1; /* should routine idle wait or not */ - u32 pad : 31; /* pad to word boundary */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_conf_inptr { - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_conf_outptr_ext { - u32 crt_config[3]; /* hardware specific X11/OGL information */ - u32 crt_hdw[3]; - u32 future_ptr; -}; - -struct sti_conf_outptr { - s32 errno; /* error number on failure */ - s16 onscreen_x; /* screen width in pixels */ - s16 onscreen_y; /* screen height in pixels */ - s16 offscreen_x; /* offscreen width in pixels */ - s16 offscreen_y; /* offscreen height in pixels */ - s16 total_x; /* frame buffer width in pixels */ - s16 total_y; /* frame buffer height in pixels */ - s32 bits_per_pixel; /* bits/pixel device has configured */ - s32 bits_used; /* bits which can be accessed */ - s32 planes; /* number of fb planes in system */ - u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */ - u32 attributes; /* flags denoting attributes */ - u32 ext_ptr; /* pointer to future data */ -}; - -struct sti_rom { - u8 type[4]; - u8 res004; - u8 num_mons; - u8 revno[2]; - u32 graphics_id[2]; - - u32 font_start; - u32 statesize; - u32 last_addr; - u32 region_list; - - u16 reentsize; - u16 maxtime; - u32 mon_tbl_addr; - u32 user_data_addr; - u32 sti_mem_req; - - u32 user_data_size; - u16 power; - u8 bus_support; - u8 ext_bus_support; - u8 alt_code_type; - u8 ext_dd_struct[3]; - u32 cfb_addr; - - u32 init_graph; - u32 state_mgmt; - u32 font_unpmv; - u32 block_move; - u32 self_test; - u32 excep_hdlr; - u32 inq_conf; - u32 set_cm_entry; - u32 dma_ctrl; - u8 res040[7 * 4]; - - u32 init_graph_addr; - u32 state_mgmt_addr; - u32 font_unp_addr; - u32 block_move_addr; - u32 self_test_addr; - u32 excep_hdlr_addr; - u32 inq_conf_addr; - u32 set_cm_entry_addr; - u32 image_unpack_addr; - u32 pa_risx_addrs[7]; -}; - -struct sti_rom_font { - u16 first_char; - u16 last_char; - u8 width; - u8 height; - u8 font_type; /* language type */ - u8 bytes_per_char; - u32 next_font; - u8 underline_height; - u8 underline_pos; - u8 res008[2]; -}; - -/* sticore internal font handling */ - -struct sti_cooked_font { - struct sti_rom_font *raw; /* native ptr for STI functions */ - void *raw_ptr; /* kmalloc'ed font data */ - struct sti_cooked_font *next_font; - int height, width; - int refcount; - u32 crc; -}; - -struct sti_cooked_rom { - struct sti_rom *raw; - struct sti_cooked_font *font_start; -}; - -/* STI font printing function structs */ - -struct sti_font_inptr { - u32 font_start_addr; /* address of font start */ - s16 index; /* index into font table of character */ - u8 fg_color; /* foreground color of character */ - u8 bg_color; /* background color of character */ - s16 dest_x; /* X location of character upper left */ - s16 dest_y; /* Y location of character upper left */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_font_flags { - u32 wait : 1; /* should routine idle wait or not */ - u32 non_text : 1; /* font unpack/move in non_text planes =1, text =0 */ - u32 pad : 30; /* pad to word boundary */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_font_outptr { - s32 errno; /* error number on failure */ - u32 future_ptr; /* pointer to future data */ -}; - -/* STI blockmove structs */ - -struct sti_blkmv_flags { - u32 wait : 1; /* should routine idle wait or not */ - u32 color : 1; /* change color during move? */ - u32 clear : 1; /* clear during move? */ - u32 non_text : 1; /* block move in non_text planes =1, text =0 */ - u32 pad : 28; /* pad to word boundary */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_blkmv_inptr { - u8 fg_color; /* foreground color after move */ - u8 bg_color; /* background color after move */ - s16 src_x; /* source upper left pixel x location */ - s16 src_y; /* source upper left pixel y location */ - s16 dest_x; /* dest upper left pixel x location */ - s16 dest_y; /* dest upper left pixel y location */ - s16 width; /* block width in pixels */ - s16 height; /* block height in pixels */ - u32 future_ptr; /* pointer to future data */ -}; - -struct sti_blkmv_outptr { - s32 errno; /* error number on failure */ - u32 future_ptr; /* pointer to future data */ -}; - - -/* sti_all_data is an internal struct which needs to be allocated in - * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */ - -struct sti_all_data { - struct sti_glob_cfg glob_cfg; - struct sti_glob_cfg_ext glob_cfg_ext; - - struct sti_conf_inptr inq_inptr; - struct sti_conf_outptr inq_outptr; /* configuration */ - struct sti_conf_outptr_ext inq_outptr_ext; - - struct sti_init_inptr_ext init_inptr_ext; - struct sti_init_inptr init_inptr; - struct sti_init_outptr init_outptr; - - struct sti_blkmv_inptr blkmv_inptr; - struct sti_blkmv_outptr blkmv_outptr; - - struct sti_font_inptr font_inptr; - struct sti_font_outptr font_outptr; - - /* leave as last entries */ - unsigned long save_addr[1024 / sizeof(unsigned long)]; - /* min 256 bytes which is STI default, max sti->sti_mem_request */ - unsigned long sti_mem_addr[256 / sizeof(unsigned long)]; - /* do not add something below here ! */ -}; - -/* internal generic STI struct */ - -struct sti_struct { - spinlock_t lock; - - /* char **mon_strings; */ - int sti_mem_request; - u32 graphics_id[2]; - - struct sti_cooked_rom *rom; - - unsigned long font_unpmv; - unsigned long block_move; - unsigned long init_graph; - unsigned long inq_conf; - - /* all following fields are initialized by the generic routines */ - int text_planes; - region_t regions[STI_REGION_MAX]; - unsigned long regions_phys[STI_REGION_MAX]; - - struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ - - int wordmode; - struct sti_cooked_font *font; /* ptr to selected font (cooked) */ - - struct pci_dev *pd; - - /* PCI data structures (pg. 17ff from sti.pdf) */ - u8 rm_entry[16]; /* pci region mapper array == pci config space offset */ - - /* pointer to the fb_info where this STI device is used */ - struct fb_info *info; - - /* pointer to all internal data */ - struct sti_all_data *sti_data; - - /* pa_path of this device */ - char pa_path[24]; -}; - - -/* sticore interface functions */ - -struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ -void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f); - - -/* sticore main function to call STI firmware */ - -int sti_call(const struct sti_struct *sti, unsigned long func, - const void *flags, void *inptr, void *outptr, - struct sti_glob_cfg *glob_cfg); - - -/* functions to call the STI ROM directly */ - -void sti_putc(struct sti_struct *sti, int c, int y, int x, - struct sti_cooked_font *font); -void sti_set(struct sti_struct *sti, int src_y, int src_x, - int height, int width, u8 color); -void sti_clear(struct sti_struct *sti, int src_y, int src_x, - int height, int width, int c, struct sti_cooked_font *font); -void sti_bmove(struct sti_struct *sti, int src_y, int src_x, - int dst_y, int dst_x, int height, int width, - struct sti_cooked_font *font); - -#endif /* STICORE_H */ diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index 686a234f3899..66d82f6d17c7 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -69,7 +69,7 @@ #include <asm/grfioctl.h> /* for HP-UX compatibility */ #include <linux/uaccess.h> -#include "sticore.h" +#include <video/sticore.h> /* REGION_BASE(fb_info, index) returns the virtual address for region <index> */ #define REGION_BASE(fb_info, index) \ @@ -527,8 +527,8 @@ rattlerSetupPlanes(struct stifb_info *fb) fb->id = saved_id; for (y = 0; y < fb->info.var.yres; ++y) - fb_memset(fb->info.screen_base + y * fb->info.fix.line_length, - 0xff, fb->info.var.xres * fb->info.var.bits_per_pixel/8); + fb_memset_io(fb->info.screen_base + y * fb->info.fix.line_length, + 0xff, fb->info.var.xres * fb->info.var.bits_per_pixel/8); CRX24_SET_OVLY_MASK(fb); SETUP_FB(fb); diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index d17e5e1472aa..cdf8e9fe9948 100644 --- a/drivers/video/fbdev/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c @@ -1116,7 +1116,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) u8 *mask = (u8 *)cursor->mask; int i; - fb_memset(cursorbase, 0, 1024); + fb_memset_io(cursorbase, 0, 1024); for (i = 0; i < cursor->image.height; i++) { int h = 0; diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index dabc30a09f96..a4a21b4ac28c 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1008,7 +1008,7 @@ static void dlfb_ops_destroy(struct fb_info *info) fb_dealloc_cmap(&info->cmap); if (info->monspecs.modedb) fb_destroy_modedb(info->monspecs.modedb); - vfree(info->screen_base); + vfree(info->screen_buffer); fb_destroy_modelist(&info->modelist); @@ -1122,7 +1122,7 @@ static int dlfb_ops_set_par(struct fb_info *info) /* paint greenscreen */ - pix_framebuffer = (u16 *) info->screen_base; + pix_framebuffer = (u16 *)info->screen_buffer; for (i = 0; i < info->fix.smem_len / 2; i++) pix_framebuffer[i] = 0x37e6; } @@ -1221,7 +1221,7 @@ static void dlfb_deferred_vfree(struct dlfb_data *dlfb, void *mem) static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info, u32 new_len) { u32 old_len = info->fix.smem_len; - const void *old_fb = (const void __force *)info->screen_base; + const void *old_fb = info->screen_buffer; unsigned char *new_fb; unsigned char *new_back = NULL; @@ -1238,12 +1238,12 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info } memset(new_fb, 0xff, new_len); - if (info->screen_base) { + if (info->screen_buffer) { memcpy(new_fb, old_fb, old_len); - dlfb_deferred_vfree(dlfb, (void __force *)info->screen_base); + dlfb_deferred_vfree(dlfb, info->screen_buffer); } - info->screen_base = (char __iomem *)new_fb; + info->screen_buffer = new_fb; info->fix.smem_len = new_len; info->fix.smem_start = (unsigned long) new_fb; info->flags = udlfb_info_flags; diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c index 6f1990969361..cf3c72754ce7 100644 --- a/drivers/video/fbdev/vfb.c +++ b/drivers/video/fbdev/vfb.c @@ -440,7 +440,7 @@ static int vfb_probe(struct platform_device *dev) if (!info) goto err; - info->screen_base = (char __iomem *)videomemory; + info->screen_buffer = videomemory; info->fbops = &vfb_ops; if (!fb_find_mode(&info->var, info, mode_option, diff --git a/drivers/video/fbdev/wmt_ge_rops.c b/drivers/video/fbdev/wmt_ge_rops.c index 3ed143457d22..b70961901683 100644 --- a/drivers/video/fbdev/wmt_ge_rops.c +++ b/drivers/video/fbdev/wmt_ge_rops.c @@ -9,7 +9,9 @@ #include <linux/module.h> #include <linux/fb.h> +#include <linux/io.h> #include <linux/platform_device.h> + #include "core/fb_draw.h" #include "wmt_ge_rops.h" diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c index d7f3e6281ce4..9b2a786621a6 100644 --- a/drivers/video/fbdev/xen-fbfront.c +++ b/drivers/video/fbdev/xen-fbfront.c @@ -429,7 +429,7 @@ static int xenfb_probe(struct xenbus_device *dev, fb_info->pseudo_palette = fb_info->par; fb_info->par = info; - fb_info->screen_base = info->fb; + fb_info->screen_buffer = info->fb; fb_info->fbops = &xenfb_fb_ops; fb_info->var.xres_virtual = fb_info->var.xres = video[KPARAM_WIDTH]; diff --git a/drivers/video/console/sticore.c b/drivers/video/sticore.c index db568f67e4dc..7eb925f2ba9c 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/sticore.c @@ -6,12 +6,12 @@ * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> * Copyright (C) 2001-2020 Helge Deller <deller@gmx.de> * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de> - * + * * TODO: * - call STI in virtual mode rather than in real mode - * - screen blanking with state_mgmt() in text mode STI ? + * - screen blanking with state_mgmt() in text mode STI ? * - try to make it work on m68k hp workstations ;) - * + * */ #define pr_fmt(fmt) "%s: " fmt, KBUILD_MODNAME @@ -30,9 +30,8 @@ #include <asm/pdc.h> #include <asm/cacheflush.h> #include <asm/grfioctl.h> -#include <asm/fb.h> -#include "../fbdev/sticore.h" +#include <video/sticore.h> #define STI_DRIVERVERSION "Version 0.9c" @@ -66,12 +65,12 @@ static const u8 col_trans[8] = { #define c_index(sti, c) ((c) & 0xff) static const struct sti_init_flags default_init_flags = { - .wait = STI_WAIT, + .wait = STI_WAIT, .reset = 1, - .text = 1, + .text = 1, .nontext = 1, - .no_chg_bet = 1, - .no_chg_bei = 1, + .no_chg_bet = 1, + .no_chg_bei = 1, .init_cmap_tx = 1, }; @@ -104,7 +103,7 @@ static int sti_init_graph(struct sti_struct *sti) pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); return -1; } - + return 0; } @@ -120,7 +119,7 @@ static void sti_inq_conf(struct sti_struct *sti) s32 ret; outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext); - + do { spin_lock_irqsave(&sti->lock, flags); memset(inptr, 0, sizeof(*inptr)); @@ -162,9 +161,9 @@ sti_putc(struct sti_struct *sti, int c, int y, int x, } static const struct sti_blkmv_flags clear_blkmv_flags = { - .wait = STI_WAIT, - .color = 1, - .clear = 1, + .wait = STI_WAIT, + .color = 1, + .clear = 1, }; void @@ -185,7 +184,7 @@ sti_set(struct sti_struct *sti, int src_y, int src_x, struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; s32 ret; unsigned long flags; - + do { spin_lock_irqsave(&sti->lock, flags); *inptr = inptr_default; @@ -224,7 +223,7 @@ sti_clear(struct sti_struct *sti, int src_y, int src_x, } static const struct sti_blkmv_flags default_blkmv_flags = { - .wait = STI_WAIT, + .wait = STI_WAIT, }; void @@ -291,14 +290,14 @@ static int __init sti_setup(char *str) { if (str) strscpy(default_sti_path, str, sizeof(default_sti_path)); - + return 1; } /* Assuming the machine has multiple STI consoles (=graphic cards) which * all get detected by sticon, the user may define with the linux kernel * parameter sti=<x> which of them will be the initial boot-console. - * <x> is a number between 0 and MAX_STI_ROMS, with 0 as the default + * <x> is a number between 0 and MAX_STI_ROMS, with 0 as the default * STI screen. */ __setup("sti=", sti_setup); @@ -341,13 +340,13 @@ static int sti_font_setup(char *str) * should be used by the sticon driver to draw characters to the screen. * Possible values are: * - sti_font=<fb_fontname>: - * <fb_fontname> is the name of one of the linux-kernel built-in - * framebuffer font names (e.g. VGA8x16, SUN22x18). - * This is only available if the fonts have been statically compiled + * <fb_fontname> is the name of one of the linux-kernel built-in + * framebuffer font names (e.g. VGA8x16, SUN22x18). + * This is only available if the fonts have been statically compiled * in with e.g. the CONFIG_FONT_8x16 or CONFIG_FONT_SUN12x22 options. * - sti_font=<number> (<number> = 1,2,3,...) * most STI ROMs have built-in HP specific fonts, which can be selected - * by giving the desired number to the sticon driver. + * by giving the desired number to the sticon driver. * NOTE: This number is machine and STI ROM dependend. * - sti_font=<height>x<width> (e.g. sti_font=16x8) * <height> and <width> gives hints to the height and width of the @@ -359,12 +358,12 @@ __setup("sti_font=", sti_font_setup); #endif - + static void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request) { struct sti_glob_cfg_ext *cfg; - + pr_debug("%d text planes\n" "%4d x %4d screen resolution\n" "%4d x %4d offscreen\n" @@ -384,7 +383,7 @@ static void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, glob_cfg->reent_lvl, glob_cfg->save_addr); - /* dump extended cfg */ + /* dump extended cfg */ cfg = PTR_STI((unsigned long)glob_cfg->ext_ptr); pr_debug("monitor %d\n" "in friendly mode: %d\n" @@ -437,10 +436,10 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, glob_cfg->save_addr = STI_PTR(save_addr); for (i=0; i<8; i++) { unsigned long newhpa, len; - + if (sti->pd) { unsigned char offs = sti->rm_entry[i]; - + if (offs == 0) continue; if (offs != PCI_ROM_ADDRESS && @@ -456,18 +455,18 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, sti->regions_phys[i] = REGION_OFFSET_TO_PHYS(sti->regions[i], newhpa); - + len = sti->regions[i].region_desc.length * 4096; if (len) glob_cfg->region_ptrs[i] = sti->regions_phys[i]; - + pr_debug("region #%d: phys %08lx, region_ptr %08x, len=%lukB, " "btlb=%d, sysonly=%d, cache=%d, last=%d\n", i, sti->regions_phys[i], glob_cfg->region_ptrs[i], len/1024, sti->regions[i].region_desc.btlb, sti->regions[i].region_desc.sys_only, - sti->regions[i].region_desc.cache, + sti->regions[i].region_desc.cache, sti->regions[i].region_desc.last); /* last entry reached ? */ @@ -482,7 +481,7 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr); sti->glob_cfg = glob_cfg; - + return 0; } @@ -495,7 +494,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) void *dest; struct sti_rom_font *nf; struct sti_cooked_font *cooked_font; - + if (fbfont_name && strlen(fbfont_name)) fbfont = find_font(fbfont_name); if (!fbfont) @@ -505,8 +504,8 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) pr_info(" using %ux%u framebuffer font %s\n", fbfont->width, fbfont->height, fbfont->name); - - bpc = ((fbfont->width+7)/8) * fbfont->height; + + bpc = ((fbfont->width+7)/8) * fbfont->height; size = bpc * fbfont->charcount; size += sizeof(struct sti_rom_font); @@ -533,7 +532,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) kfree(nf); return NULL; } - + cooked_font->raw = nf; cooked_font->raw_ptr = nf; cooked_font->next_font = NULL; @@ -617,9 +616,9 @@ static void sti_dump_rom(struct sti_struct *sti) int nr; pr_info(" id %04x-%04x, conforms to spec rev. %d.%02x\n", - rom->graphics_id[0], + rom->graphics_id[0], rom->graphics_id[1], - rom->revno[0] >> 4, + rom->revno[0] >> 4, rom->revno[0] & 0x0f); pr_debug(" supports %d monitors\n", rom->num_mons); pr_debug(" font start %08x\n", rom->font_start); @@ -647,7 +646,7 @@ static int sti_cook_fonts(struct sti_cooked_rom *cooked_rom, { struct sti_rom_font *raw_font, *font_start; struct sti_cooked_font *cooked_font; - + cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font) return 0; @@ -745,7 +744,7 @@ static struct sti_rom *sti_get_bmode_rom (unsigned long address) raw_font = ((void *)raw) + raw->font_start; font_start = raw_font; - + while (raw_font->next_font) { BMODE_RELOCATE (raw_font->next_font); raw_font = ((void *)font_start) + raw_font->next_font; @@ -759,7 +758,7 @@ static struct sti_rom *sti_get_wmode_rom(unsigned long address) struct sti_rom *raw; unsigned long size; - /* read the ROM size directly from the struct in ROM */ + /* read the ROM size directly from the struct in ROM */ size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); raw = kmalloc(size, STI_LOWMEM); @@ -869,7 +868,7 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address, pr_warn("maximum number of STI ROMS reached !\n"); return NULL; } - + sti = kzalloc(sizeof(*sti), GFP_KERNEL); if (!sti) return NULL; @@ -890,19 +889,19 @@ test_rom: u32 *rm; i = gsc_readl(address+0x04); if (i != 1) { - /* The ROM could have multiple architecture + /* The ROM could have multiple architecture * dependent images (e.g. i386, parisc,...) */ pr_warn("PCI ROM is not a STI ROM type image (0x%8x)\n", i); goto out_err; } - + sti->pd = pd; i = gsc_readl(address+0x0c); pr_debug("PCI ROM size (from header) = %d kB\n", le16_to_cpu(i>>16)*512/1024); rm_offset = le16_to_cpu(i & 0xffff); - if (rm_offset) { + if (rm_offset) { /* read 16 bytes from the pci region mapper array */ rm = (u32*) &sti->rm_entry; *rm++ = gsc_readl(address+rm_offset+0x00); @@ -915,9 +914,9 @@ test_rom: pr_debug("sig %04x, PCI STI ROM at %08lx\n", sig, address); goto test_rom; } - + ok = 0; - + if ((sig & 0xff) == 0x01) { pr_debug(" byte mode ROM at %08lx, hpa at %08lx\n", address, hpa); @@ -941,7 +940,7 @@ test_rom: */ if (sti->pd) { unsigned long rom_base; - rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); + rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE); pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE); pr_debug("STI PCI ROM disabled\n"); } @@ -952,13 +951,13 @@ test_rom: sti_inq_conf(sti); sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); sti_dump_outptr(sti); - + pr_info(" graphics card name: %s\n", sti->sti_data->inq_outptr.dev_name); sti_roms[num_sti_roms] = sti; num_sti_roms++; - + return sti; out_err: @@ -974,9 +973,9 @@ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) } /* - * on newer systems PDC gives the address of the ROM + * on newer systems PDC gives the address of the ROM * in the additional address field addr[1] while on - * older Systems the PDC stores it in page0->proc_sti + * older Systems the PDC stores it in page0->proc_sti */ static int __init sticore_pa_init(struct parisc_device *dev) { @@ -1005,7 +1004,7 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent) unsigned int fb_len, rom_len; int err; struct sti_struct *sti; - + err = pci_enable_device(pd); if (err < 0) { dev_err(&pd->dev, "Cannot enable PCI device\n"); @@ -1032,7 +1031,7 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent) print_pci_hwpath(pd, sti->pa_path); sticore_check_for_default_sti(sti, sti->pa_path); } - + if (!sti) { pr_warn("Unable to handle STI device '%s'\n", pci_name(pd)); return -ENODEV; @@ -1148,24 +1147,6 @@ int sti_call(const struct sti_struct *sti, unsigned long func, return ret; } -#if defined(CONFIG_FB_STI) -/* check if given fb_info is the primary device */ -int fb_is_primary_device(struct fb_info *info) -{ - struct sti_struct *sti; - - sti = sti_get_rom(0); - - /* if no built-in graphics card found, allow any fb driver as default */ - if (!sti) - return true; - - /* return true if it's the default built-in framebuffer driver */ - return (sti->info == info); -} -EXPORT_SYMBOL(fb_is_primary_device); -#endif - MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); MODULE_LICENSE("GPL v2"); |