aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/aperture.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2022-07-18 09:23:20 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2022-07-19 13:19:11 +0200
commit482b1c7d478875508ac112c36dcd65739f664b0e (patch)
tree786bbd5e6629af3c73f0f5c42bacb7c5e7b11ef6 /drivers/video/aperture.c
parentvideo: Provide constants for VGA I/O range (diff)
downloadlinux-dev-482b1c7d478875508ac112c36dcd65739f664b0e.tar.xz
linux-dev-482b1c7d478875508ac112c36dcd65739f664b0e.zip
video/aperture: Remove conflicting VGA devices, if any
On the primary graphics adapter, a driver might conflict with a VGA driver that controls the VGA framebuffer I/O range. Remove the VGA driver from the aperture helpers. Until now, this case has been hendled by fbdev, but it should work even with fbdev disabled. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-10-tzimmermann@suse.de
Diffstat (limited to 'drivers/video/aperture.c')
-rw-r--r--drivers/video/aperture.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c
index 101e13c2cf41..abc691284a77 100644
--- a/drivers/video/aperture.c
+++ b/drivers/video/aperture.c
@@ -12,6 +12,8 @@
#include <linux/types.h>
#include <linux/vgaarb.h>
+#include <video/vga.h>
+
/**
* DOC: overview
*
@@ -300,6 +302,16 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si
*/
sysfb_disable();
+ 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);
+
#if IS_REACHABLE(CONFIG_FB)
a = alloc_apertures(1);
if (!a)
@@ -315,8 +327,6 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si
return ret;
#endif
- aperture_detach_devices(base, size);
-
return 0;
}
EXPORT_SYMBOL(aperture_remove_conflicting_devices);