SOURCES (LINUX_2_6): kernel-display_vesa_modes_in_vgaask_menu.patc...

pluto pluto at pld-linux.org
Wed Apr 9 13:31:16 CEST 2008


Author: pluto                        Date: Wed Apr  9 11:31:16 2008 GMT
Module: SOURCES                       Tag: LINUX_2_6
---- Log message:
- backport fixes from mainline.

---- Files affected:
SOURCES:
   kernel-display_vesa_modes_in_vgaask_menu.patch (NONE -> 1.1.2.1)  (NEW), kernel-dont_request_vbe2_info.patch (NONE -> 1.1.2.1)  (NEW), kernel-uvesafb-upstream.patch (NONE -> 1.1.2.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/kernel-display_vesa_modes_in_vgaask_menu.patch
diff -u /dev/null SOURCES/kernel-display_vesa_modes_in_vgaask_menu.patch:1.1.2.1
--- /dev/null	Wed Apr  9 13:31:16 2008
+++ SOURCES/kernel-display_vesa_modes_in_vgaask_menu.patch	Wed Apr  9 13:31:10 2008
@@ -0,0 +1,195 @@
+commit 1cac5004e953506166e980da5776d5cc1c176d79
+Author: H. Peter Anvin <hpa at zytor.com>
+Date:   Wed Jan 30 13:33:02 2008 +0100
+
+    x86 setup: display VESA graphics modes in vga=ask menu
+    
+    Display VESA graphics modes, with their mode IDs, in the vga=ask
+    menu.  Most VESA mode numbers are platform-dependent, so it helps to
+    have an easy way to display them.
+    
+    Based in part on a patch by Petr Vandrovec <petr at vandrovec.name>.
+    
+    Cc: Petr Vandrovec <petr at vandrovec.name>
+    Signed-off-by: H. Peter Anvin <hpa at zytor.com>
+    Signed-off-by: Ingo Molnar <mingo at elte.hu>
+    Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
+
+diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c
+index ed0672a..ff664a1 100644
+--- a/arch/x86/boot/video-bios.c
++++ b/arch/x86/boot/video-bios.c
+@@ -104,6 +104,7 @@ static int bios_probe(void)
+ 
+ 		mi = GET_HEAP(struct mode_info, 1);
+ 		mi->mode = VIDEO_FIRST_BIOS+mode;
++		mi->depth = 0;	/* text */
+ 		mi->x = rdfs16(0x44a);
+ 		mi->y = rdfs8(0x484)+1;
+ 		nmodes++;
+@@ -116,7 +117,7 @@ static int bios_probe(void)
+ 
+ __videocard video_bios =
+ {
+-	.card_name	= "BIOS (scanned)",
++	.card_name	= "BIOS",
+ 	.probe		= bios_probe,
+ 	.set_mode	= bios_set_mode,
+ 	.unsafe		= 1,
+diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
+index 4716b9a..662dd2f 100644
+--- a/arch/x86/boot/video-vesa.c
++++ b/arch/x86/boot/video-vesa.c
+@@ -79,20 +79,28 @@ static int vesa_probe(void)
+ 			/* Text Mode, TTY BIOS supported,
+ 			   supported by hardware */
+ 			mi = GET_HEAP(struct mode_info, 1);
+-			mi->mode = mode + VIDEO_FIRST_VESA;
+-			mi->x    = vminfo.h_res;
+-			mi->y    = vminfo.v_res;
++			mi->mode  = mode + VIDEO_FIRST_VESA;
++			mi->depth = 0; /* text */
++			mi->x     = vminfo.h_res;
++			mi->y     = vminfo.v_res;
+ 			nmodes++;
+-		} else if ((vminfo.mode_attr & 0x99) == 0x99) {
++		} else if ((vminfo.mode_attr & 0x99) == 0x99 &&
++			   (vminfo.memory_layout == 4 ||
++			    vminfo.memory_layout == 6) &&
++			   vminfo.memory_planes == 1) {
+ #ifdef CONFIG_FB
+ 			/* Graphics mode, color, linear frame buffer
+-			   supported -- register the mode but hide from
+-			   the menu.  Only do this if framebuffer is
+-			   configured, however, otherwise the user will
+-			   be left without a screen. */
++			   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. */
+ 			mi = GET_HEAP(struct mode_info, 1);
+ 			mi->mode = mode + VIDEO_FIRST_VESA;
+-			mi->x = mi->y = 0;
++			mi->depth = vminfo.bpp;
++			mi->x = vminfo.h_res;
++			mi->y = vminfo.v_res;
+ 			nmodes++;
+ #endif
+ 		}
+diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
+index aef02f9..7259387 100644
+--- a/arch/x86/boot/video-vga.c
++++ b/arch/x86/boot/video-vga.c
+@@ -18,22 +18,22 @@
+ #include "video.h"
+ 
+ static struct mode_info vga_modes[] = {
+-	{ VIDEO_80x25,  80, 25 },
+-	{ VIDEO_8POINT, 80, 50 },
+-	{ VIDEO_80x43,  80, 43 },
+-	{ VIDEO_80x28,  80, 28 },
+-	{ VIDEO_80x30,  80, 30 },
+-	{ VIDEO_80x34,  80, 34 },
+-	{ VIDEO_80x60,  80, 60 },
++	{ VIDEO_80x25,  80, 25, 0 },
++	{ VIDEO_8POINT, 80, 50, 0 },
++	{ VIDEO_80x43,  80, 43, 0 },
++	{ VIDEO_80x28,  80, 28, 0 },
++	{ VIDEO_80x30,  80, 30, 0 },
++	{ VIDEO_80x34,  80, 34, 0 },
++	{ VIDEO_80x60,  80, 60, 0 },
+ };
+ 
+ static struct mode_info ega_modes[] = {
+-	{ VIDEO_80x25,  80, 25 },
+-	{ VIDEO_8POINT, 80, 43 },
++	{ VIDEO_80x25,  80, 25, 0 },
++	{ VIDEO_8POINT, 80, 43, 0 },
+ };
+ 
+ static struct mode_info cga_modes[] = {
+-	{ VIDEO_80x25,  80, 25 },
++	{ VIDEO_80x25,  80, 25, 0 },
+ };
+ 
+ __videocard video_vga;
+diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c
+index ad9712f..696d08f 100644
+--- a/arch/x86/boot/video.c
++++ b/arch/x86/boot/video.c
+@@ -293,13 +293,28 @@ static void display_menu(void)
+ 	struct mode_info *mi;
+ 	char ch;
+ 	int i;
++	int nmodes;
++	int modes_per_line;
++	int col;
+ 
+-	puts("Mode:    COLSxROWS:\n");
++	nmodes = 0;
++	for (card = video_cards; card < video_cards_end; card++)
++		nmodes += card->nmodes;
+ 
++	modes_per_line = 1;
++	if (nmodes >= 20)
++		modes_per_line = 3;
++
++	for (col = 0; col < modes_per_line; col++)
++		puts("Mode: Resolution:  Type: ");
++	putchar('\n');
++
++	col = 0;
+ 	ch = '0';
+ 	for (card = video_cards; card < video_cards_end; card++) {
+ 		mi = card->modes;
+ 		for (i = 0; i < card->nmodes; i++, mi++) {
++			char resbuf[32];
+ 			int visible = mi->x && mi->y;
+ 			u16 mode_id = mi->mode ? mi->mode :
+ 				(mi->y << 8)+mi->x;
+@@ -307,8 +322,18 @@ static void display_menu(void)
+ 			if (!visible)
+ 				continue; /* Hidden mode */
+ 
+-			printf("%c  %04X  %3dx%-3d  %s\n",
+-			       ch, mode_id, mi->x, mi->y, card->card_name);
++			if (mi->depth)
++				sprintf(resbuf, "%dx%d", mi->y, mi->depth);
++			else
++				sprintf(resbuf, "%d", mi->y);
++
++			printf("%c %03X %4dx%-7s %-6s",
++			       ch, mode_id, mi->x, resbuf, card->card_name);
++			col++;
++			if (col >= modes_per_line) {
++				putchar('\n');
++				col = 0;
++			}
+ 
+ 			if (ch == '9')
+ 				ch = 'a';
+@@ -318,6 +343,8 @@ static void display_menu(void)
+ 				ch++;
+ 		}
+ 	}
++	if (col)
++		putchar('\n');
+ }
+ 
+ #define H(x)	((x)-'a'+10)
+diff --git a/arch/x86/boot/video.h b/arch/x86/boot/video.h
+index b92447d..d69347f 100644
+--- a/arch/x86/boot/video.h
++++ b/arch/x86/boot/video.h
+@@ -83,7 +83,8 @@ void store_screen(void);
+ 
+ struct mode_info {
+ 	u16 mode;		/* Mode number (vga= style) */
+-	u8  x, y;		/* Width, height */
++	u16 x, y;		/* Width, height */
++	u16 depth;		/* Bits per pixel, 0 for text mode */
+ };
+ 
+ struct card_info {

================================================================
Index: SOURCES/kernel-dont_request_vbe2_info.patch
diff -u /dev/null SOURCES/kernel-dont_request_vbe2_info.patch:1.1.2.1
--- /dev/null	Wed Apr  9 13:31:16 2008
+++ SOURCES/kernel-dont_request_vbe2_info.patch	Wed Apr  9 13:31:11 2008
@@ -0,0 +1,135 @@
+commit 1722770f131bb5c8e238825f3eba2efa331483a2
+Author: Peter Korsgaard <jacmet at sunsite.dk>
+Date:   Thu Mar 6 10:56:45 2008 +0100
+
+    x86-boot: don't request VBE2 information
+    
+    The new x86 setup code (4fd06960f120) broke booting on an old P3/500MHz
+    with an onboard Voodoo3 of mine. After debugging it, it turned out
+    to be caused by the fact that the vesa probing now asks for VBE2 data.
+    
+    Disassembing the video BIOS shows that it overflows the vesa_general_info
+    structure when VBE2 data is requested because the source addresses for the
+    information strings which get strcpy'ed to the buffer lie outside the 32K
+    BIOS code (and hence contain long sequences of 0xff's).
+    
+    E.G.:
+    
+    get_vbe_controller_info:
+    00002A9C  60                pushaw
+    00002A9D  1E                push ds
+    00002A9E  0E                push cs
+    00002A9F  1F                pop ds
+    00002AA0  2BC9              sub cx,cx
+    00002AA2  6626813D56424532  cmp dword [es:di],0x32454256 ; "VBE2"
+    00002AAA  7501              jnz .1
+    00002AAC  41                inc cx
+    .1:
+    00002AAD  51                push cx
+    00002AAE  B91400            mov cx,0x14
+    00002AB1  BED47F            mov si, controller_header
+    00002AB4  57                push di
+    00002AB5  F3A4              rep movsb ; copy vbe1.2 header
+    
+    00002AB7  B9EC00            mov cx,0xec
+    00002ABA  2AC0              sub al,al
+    00002ABC  F3AA              rep stosb ; zero pad remainder
+    
+    00002ABE  5F                pop di
+    00002ABF  E8EB0D            call word get_memory
+    00002AC2  C1E002            shl ax,0x2
+    00002AC5  26894512          mov [es:di+0x12],ax ; total memory
+    00002AC9  26C745040003      mov word [es:di+0x4],0x300 ; VBE version
+    00002ACF  268C4D08          mov [es:di+0x8],cs
+    00002AD3  268C4D10          mov [es:di+0x10],cs
+    00002AD7  59                pop cx
+    00002AD8  E361              jcxz .done ; VBE2 requested?
+    00002ADA  8D9D0001          lea bx,[di+0x100]
+    00002ADE  53                push bx
+    00002ADF  87DF              xchg bx,di ; di now points to 2nd half
+    00002AE1  26C747140001      mov word [es:bx+0x14],0x100 ; sw rev
+    
+    00002AE7  26897F06          mov [es:bx+0x6],di		; oem string
+    00002AEB  268C4708          mov [es:bx+0x8],es
+    00002AEF  BE5280            mov si,0x8052 ; oem string
+    00002AF2  E87A1B            call word strcpy
+    
+    00002AF5  26897F0E          mov [es:bx+0xe],di ; video mode list
+    00002AF9  268C4710          mov [es:bx+0x10],es
+    00002AFD  B91E00            mov cx,0x1e
+    00002B00  BEE87F            mov si,vidmodes
+    00002B03  F3A5              rep movsw
+    
+    00002B05  26897F16          mov [es:bx+0x16],di ; oem vendor
+    00002B09  268C4718          mov [es:bx+0x18],es
+    00002B0D  BE2480            mov si,0x8024 ; oem vendor
+    00002B10  E85C1B            call word strcpy
+    
+    00002B13  26897F1A          mov [es:bx+0x1a],di ; oem product
+    00002B17  268C471C          mov [es:bx+0x1c],es
+    00002B1B  BE3880            mov si,0x8038 ; oem product
+    00002B1E  E84E1B            call word strcpy
+    
+    00002B21  26897F1E          mov [es:bx+0x1e],di ; oem product rev
+    00002B25  268C4720          mov [es:bx+0x20],es
+    00002B29  BE4580            mov si,0x8045 ; oem product rev
+    00002B2C  E8401B            call word strcpy
+    
+    00002B2F  58                pop ax
+    00002B30  B90001            mov cx,0x100
+    00002B33  2BCF              sub cx,di
+    00002B35  03C8              add cx,ax
+    00002B37  2AC0              sub al,al
+    00002B39  F3AA              rep stosb ; zero pad
+    .done:
+    00002B3B  1F                pop ds
+    00002B3C  61                popaw
+    00002B3D  B84F00            mov ax,0x4f
+    00002B40  C3                ret
+    
+    (The full BIOS can be found at http://peter.korsgaard.com/vgabios.bin
+    if interested).
+    
+    The old setup code didn't ask for VBE2 info, and the new code doesn't
+    actually do anything with the extra information, so the fix is to simply
+    not request it. Other BIOS'es might have the same problem.
+    
+    Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
+    Signed-off-by: Ingo Molnar <mingo at elte.hu>
+
+diff --git a/arch/x86/boot/vesa.h b/arch/x86/boot/vesa.h
+index ff5b73c..468e444 100644
+--- a/arch/x86/boot/vesa.h
++++ b/arch/x86/boot/vesa.h
+@@ -26,17 +26,10 @@ struct vesa_general_info {
+ 	far_ptr video_mode_ptr;	/* 14 */
+ 	u16 total_memory;	/* 18 */
+ 
+-	u16 oem_software_rev;	/* 20 */
+-	far_ptr oem_vendor_name_ptr;	/* 22 */
+-	far_ptr oem_product_name_ptr;	/* 26 */
+-	far_ptr oem_product_rev_ptr;	/* 30 */
+-
+-	u8 reserved[222];	/* 34 */
+-	u8 oem_data[256];	/* 256 */
++	u8 reserved[236];	/* 20 */
+ } __attribute__ ((packed));
+ 
+ #define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
+-#define VBE2_MAGIC ('V' + ('B' << 8) + ('E' << 16) + ('2' << 24))
+ 
+ struct vesa_mode_info {
+ 	u16 mode_attr;		/* 0 */
+diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
+index 662dd2f..419b5c2 100644
+--- a/arch/x86/boot/video-vesa.c
++++ b/arch/x86/boot/video-vesa.c
+@@ -37,8 +37,6 @@ static int vesa_probe(void)
+ 
+ 	video_vesa.modes = GET_HEAP(struct mode_info, 0);
+ 
+-	vginfo.signature = VBE2_MAGIC;
+-
+ 	ax = 0x4f00;
+ 	di = (size_t)&vginfo;
+ 	asm(INT10

================================================================
Index: SOURCES/kernel-uvesafb-upstream.patch
diff -u /dev/null SOURCES/kernel-uvesafb-upstream.patch:1.1.2.1
--- /dev/null	Wed Apr  9 13:31:16 2008
+++ SOURCES/kernel-uvesafb-upstream.patch	Wed Apr  9 13:31:11 2008
@@ -0,0 +1,40 @@
+--- linux-2.6.24/drivers/video/uvesafb.c	2008-01-24 23:58:37.000000000 +0100
++++ linux-2.6.25-rc6-git8/drivers/video/uvesafb.c	2008-03-25 14:53:40.000000000 +0100
+@@ -44,7 +44,7 @@
+ 
+ static int mtrr		__devinitdata = 3; /* enable mtrr by default */
+ static int blank	= 1;		   /* enable blanking by default */
+-static int ypan		__devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */
++static int ypan		= 1; 		 /* 0: scroll, 1: ypan, 2: ywrap */
+ static int pmi_setpal	__devinitdata = 1; /* use PMI for palette changes */
+ static int nocrtc	__devinitdata; /* ignore CRTC settings */
+ static int noedid	__devinitdata; /* don't try DDC transfers */
+@@ -2003,12 +2003,12 @@
+ 
+ module_exit(uvesafb_exit);
+ 
+-static inline int param_get_scroll(char *buffer, struct kernel_param *kp)
++static int param_get_scroll(char *buffer, struct kernel_param *kp)
+ {
+ 	return 0;
+ }
+ 
+-static inline int param_set_scroll(const char *val, struct kernel_param *kp)
++static int param_set_scroll(const char *val, struct kernel_param *kp)
+ {
+ 	ypan = 0;
+ 
+@@ -2022,11 +2022,11 @@
+ 	return 0;
+ }
+ 
+-#define param_check_scroll(name, p) __param_check(name, p, void);
++#define param_check_scroll(name, p) __param_check(name, p, void)
+ 
+ module_param_named(scroll, ypan, scroll, 0);
+ MODULE_PARM_DESC(scroll,
+-	"Scrolling mode, set to 'redraw', ''ypan' or 'ywrap'");
++	"Scrolling mode, set to 'redraw', 'ypan', or 'ywrap'");
+ module_param_named(vgapal, pmi_setpal, invbool, 0);
+ MODULE_PARM_DESC(vgapal, "Set palette using VGA registers");
+ module_param_named(pmipal, pmi_setpal, bool, 0);
================================================================


More information about the pld-cvs-commit mailing list