From: Michal J. <sp...@ge...> - 2008-09-24 19:10:04
|
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 <sp...@ge...> Acked-by: Krzysztof Helt <krz...@wp...> --- 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 */ |
From: Michal J. <sp...@ge...> - 2008-09-28 12:55:40
|
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 <sp...@ge...> Acked-by: Krzysztof Helt <krz...@wp...> --- This version of the patch replaces the FB_SUPPORTS_BOOT_VESA macro from screen-info.h with a config option in drivers/video/Kconfig. diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 401ad99..47e5080 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 +#ifdef CONFIG_FB_BOOT_VESA_SUPPORT /* 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; +#ifdef CONFIG_FB_BOOT_VESA_SUPPORT } 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/drivers/video/Kconfig b/drivers/video/Kconfig index 70d135e..651249d 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -76,6 +76,14 @@ config FB_DDC select I2C default n +config FB_BOOT_VESA_SUPPORT + bool + depends on FB + default n + ---help--- + If true, at least one selected framebuffer driver can take advantage + of VESA video modes set at an early boot stage via the vga= parameter. + config FB_CFB_FILLRECT tristate depends on FB @@ -679,6 +687,7 @@ config FB_VESA select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select VIDEO_SELECT + select FB_BOOT_VESA_SUPPORT help This is the frame buffer device driver for generic VESA 2.0 compliant graphic cards. The older VESA 1.2 cards are not supported. @@ -702,6 +711,7 @@ config FB_IMAC select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_BOOT_VESA_SUPPORT help This is the frame buffer device driver for the Intel-based Macintosh @@ -1124,6 +1134,7 @@ config FB_INTEL select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_BOOT_VESA_SUPPORT help This driver supports the on-board graphics built in to the Intel 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. @@ -1476,6 +1487,7 @@ config FB_SIS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_BOOT_VESA_SUPPORT help This is the frame buffer device driver for the SiS 300, 315, 330 and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. |
From: Andrew M. <ak...@li...> - 2008-10-03 06:40:46
|
On Sun, 28 Sep 2008 14:54:15 +0200 Michal Januszewski <sp...@ge...> 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. > > 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 <sp...@ge...> > Acked-by: Krzysztof Helt <krz...@wp...> > --- > This version of the patch replaces the FB_SUPPORTS_BOOT_VESA macro from > screen-info.h with a config option in drivers/video/Kconfig. > > diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c > index 401ad99..47e5080 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 > +#ifdef CONFIG_FB_BOOT_VESA_SUPPORT > /* 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; > +#ifdef CONFIG_FB_BOOT_VESA_SUPPORT > } 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/drivers/video/Kconfig b/drivers/video/Kconfig > index 70d135e..651249d 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -76,6 +76,14 @@ config FB_DDC > select I2C > default n > > +config FB_BOOT_VESA_SUPPORT > + bool > + depends on FB > + default n > + ---help--- > + If true, at least one selected framebuffer driver can take advantage > + of VESA video modes set at an early boot stage via the vga= parameter. > + > config FB_CFB_FILLRECT > tristate > depends on FB > @@ -679,6 +687,7 @@ config FB_VESA > select FB_CFB_COPYAREA > select FB_CFB_IMAGEBLIT > select VIDEO_SELECT > + select FB_BOOT_VESA_SUPPORT > help > This is the frame buffer device driver for generic VESA 2.0 > compliant graphic cards. The older VESA 1.2 cards are not supported. > @@ -702,6 +711,7 @@ config FB_IMAC > select FB_CFB_FILLRECT > select FB_CFB_COPYAREA > select FB_CFB_IMAGEBLIT > + select FB_BOOT_VESA_SUPPORT > help > This is the frame buffer device driver for the Intel-based Macintosh > > @@ -1124,6 +1134,7 @@ config FB_INTEL > select FB_CFB_FILLRECT > select FB_CFB_COPYAREA > select FB_CFB_IMAGEBLIT > + select FB_BOOT_VESA_SUPPORT > help > This driver supports the on-board graphics built in to the Intel > 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. > @@ -1476,6 +1487,7 @@ config FB_SIS > select FB_CFB_FILLRECT > select FB_CFB_COPYAREA > select FB_CFB_IMAGEBLIT > + select FB_BOOT_VESA_SUPPORT > help > This is the frame buffer device driver for the SiS 300, 315, 330 > and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. -mm's efifb-imacfb-consolidation-hardware-support.patch removed FB_IMAC and moved it into FB_EDD. But your patch changes FB_IMAC and not FB_EDD, so I don't know what needs to be done here. |
From: Michal J. <mi...@gm...> - 2008-10-04 19:45:39
|
On Fri, Oct 3, 2008 at 08:40, Andrew Morton <ak...@li...> wrote: > -mm's efifb-imacfb-consolidation-hardware-support.patch removed FB_IMAC > and moved it into FB_EDD. But your patch changes FB_IMAC and not > FB_EDD, so I don't know what needs to be done here. I had a look at that patch and it looks like simply dropping the FB_IMAC part from my patch is correct (i.e. the version of fbdev-ignore-vesa-modes-if-framebuffer-does-not-support-them that is currently in -mm is fine). Best regards, -- Michal Januszewski, Gentoo Linux Developer http://people.gentoo.org/spock |
From: H. P. A. <hp...@zy...> - 2008-09-25 09:27:00
|
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 |