* [PATCH v2] fbdev: ignore VESA modes if framebuffer does not support them
@ 2008-09-24 19:08 Michal Januszewski
2008-09-25 9:12 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Michal Januszewski @ 2008-09-24 19:08 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fbdev-devel, krzysztof.h1, Andrew Morton, bonbons
Currently, it is possible to set a graphics VESA mode at boot time via
the vga= parameter even when no framebuffer driver supporting this is
configured. This could lead to the system booting with a black screen,
without a usable console.
Fix this problem by only allowing to set graphics modes at boot time
if a supporting framebuffer driver is configured.
Signed-off-by: Michal Januszewski <spock@gentoo.org>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
---
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
index 401ad99..961a163 100644
--- a/arch/x86/boot/video-vesa.c
+++ b/arch/x86/boot/video-vesa.c
@@ -88,14 +88,11 @@ static int vesa_probe(void)
(vminfo.memory_layout == 4 ||
vminfo.memory_layout == 6) &&
vminfo.memory_planes == 1) {
-#ifdef CONFIG_FB
+#if FB_SUPPORTS_BOOT_VESA
/* Graphics mode, color, linear frame buffer
supported. Only register the mode if
if framebuffer is configured, however,
- otherwise the user will be left without a screen.
- We don't require CONFIG_FB_VESA, however, since
- some of the other framebuffer drivers can use
- this mode-setting, too. */
+ otherwise the user will be left without a screen. */
mi = GET_HEAP(struct mode_info, 1);
mi->mode = mode + VIDEO_FIRST_VESA;
mi->depth = vminfo.bpp;
@@ -133,10 +130,12 @@ static int vesa_set_mode(struct mode_info *mode)
if ((vminfo.mode_attr & 0x15) == 0x05) {
/* It's a supported text mode */
is_graphic = 0;
+#if FB_SUPPORTS_BOOT_VESA
} else if ((vminfo.mode_attr & 0x99) == 0x99) {
/* It's a graphics mode with linear frame buffer */
is_graphic = 1;
vesa_mode |= 0x4000; /* Request linear frame buffer */
+#endif
} else {
return -1; /* Invalid mode */
}
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 1ee2c05..20fdc2f 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -76,6 +76,10 @@ extern struct screen_info screen_info;
#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
+
+#define FB_SUPPORTS_BOOT_VESA (defined(CONFIG_FB_VESA) || \
+ defined(CONFIG_FB_SIS) || defined(CONFIG_FB_IMAC) || \
+ defined(CONFIG_FB_INTEL))
#endif /* __KERNEL__ */
#endif /* _SCREEN_INFO_H */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] fbdev: ignore VESA modes if framebuffer does not support them
2008-09-24 19:08 [PATCH v2] fbdev: ignore VESA modes if framebuffer does not support them Michal Januszewski
@ 2008-09-25 9:12 ` H. Peter Anvin
0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2008-09-25 9:12 UTC (permalink / raw)
To: spock; +Cc: linux-kernel, linux-fbdev-devel, krzysztof.h1, Andrew Morton,
bonbons
Michal Januszewski wrote:
> Currently, it is possible to set a graphics VESA mode at boot time via
> the vga= parameter even when no framebuffer driver supporting this is
> configured. This could lead to the system booting with a black screen,
> without a usable console.
> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
> index 1ee2c05..20fdc2f 100644
> --- a/include/linux/screen_info.h
> +++ b/include/linux/screen_info.h
> @@ -76,6 +76,10 @@ extern struct screen_info screen_info;
> #define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
> #define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
> #define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
> +
> +#define FB_SUPPORTS_BOOT_VESA (defined(CONFIG_FB_VESA) || \
> + defined(CONFIG_FB_SIS) || defined(CONFIG_FB_IMAC) || \
> + defined(CONFIG_FB_INTEL))
> #endif /* __KERNEL__ */
>
> #endif /* _SCREEN_INFO_H */
I'm *REALLY* skeptical to burying this in screen_info like this, it
would probably be better to put it in Kconfig, or it is unlikely to get
updated properly.
-hpa
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-25 9:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 19:08 [PATCH v2] fbdev: ignore VESA modes if framebuffer does not support them Michal Januszewski
2008-09-25 9:12 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).