diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-01-30 07:33:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:02 -0500 |
commit | 1cac5004e953506166e980da5776d5cc1c176d79 (patch) | |
tree | da90c8870839b0445b45b39b473c8715afc31424 /arch | |
parent | 02a7b425e82cd0052e5eaedbae81a522c6aae6c4 (diff) |
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@vandrovec.name>.
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/boot/video-bios.c | 3 | ||||
-rw-r--r-- | arch/x86/boot/video-vesa.c | 26 | ||||
-rw-r--r-- | arch/x86/boot/video-vga.c | 20 | ||||
-rw-r--r-- | arch/x86/boot/video.c | 33 | ||||
-rw-r--r-- | arch/x86/boot/video.h | 3 |
5 files changed, 61 insertions, 24 deletions
diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c index ed0672a81870..ff664a117096 100644 --- a/arch/x86/boot/video-bios.c +++ b/arch/x86/boot/video-bios.c | |||
@@ -104,6 +104,7 @@ static int bios_probe(void) | |||
104 | 104 | ||
105 | mi = GET_HEAP(struct mode_info, 1); | 105 | mi = GET_HEAP(struct mode_info, 1); |
106 | mi->mode = VIDEO_FIRST_BIOS+mode; | 106 | mi->mode = VIDEO_FIRST_BIOS+mode; |
107 | mi->depth = 0; /* text */ | ||
107 | mi->x = rdfs16(0x44a); | 108 | mi->x = rdfs16(0x44a); |
108 | mi->y = rdfs8(0x484)+1; | 109 | mi->y = rdfs8(0x484)+1; |
109 | nmodes++; | 110 | nmodes++; |
@@ -116,7 +117,7 @@ static int bios_probe(void) | |||
116 | 117 | ||
117 | __videocard video_bios = | 118 | __videocard video_bios = |
118 | { | 119 | { |
119 | .card_name = "BIOS (scanned)", | 120 | .card_name = "BIOS", |
120 | .probe = bios_probe, | 121 | .probe = bios_probe, |
121 | .set_mode = bios_set_mode, | 122 | .set_mode = bios_set_mode, |
122 | .unsafe = 1, | 123 | .unsafe = 1, |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 4716b9a96357..662dd2f13068 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -79,20 +79,28 @@ static int vesa_probe(void) | |||
79 | /* Text Mode, TTY BIOS supported, | 79 | /* Text Mode, TTY BIOS supported, |
80 | supported by hardware */ | 80 | supported by hardware */ |
81 | mi = GET_HEAP(struct mode_info, 1); | 81 | mi = GET_HEAP(struct mode_info, 1); |
82 | mi->mode = mode + VIDEO_FIRST_VESA; | 82 | mi->mode = mode + VIDEO_FIRST_VESA; |
83 | mi->x = vminfo.h_res; | 83 | mi->depth = 0; /* text */ |
84 | mi->y = vminfo.v_res; | 84 | mi->x = vminfo.h_res; |
85 | mi->y = vminfo.v_res; | ||
85 | nmodes++; | 86 | nmodes++; |
86 | } else if ((vminfo.mode_attr & 0x99) == 0x99) { | 87 | } else if ((vminfo.mode_attr & 0x99) == 0x99 && |
88 | (vminfo.memory_layout == 4 || | ||
89 | vminfo.memory_layout == 6) && | ||
90 | vminfo.memory_planes == 1) { | ||
87 | #ifdef CONFIG_FB | 91 | #ifdef CONFIG_FB |
88 | /* Graphics mode, color, linear frame buffer | 92 | /* Graphics mode, color, linear frame buffer |
89 | supported -- register the mode but hide from | 93 | supported. Only register the mode if |
90 | the menu. Only do this if framebuffer is | 94 | if framebuffer is configured, however, |
91 | configured, however, otherwise the user will | 95 | otherwise the user will be left without a screen. |
92 | be left without a screen. */ | 96 | We don't require CONFIG_FB_VESA, however, since |
97 | some of the other framebuffer drivers can use | ||
98 | this mode-setting, too. */ | ||
93 | mi = GET_HEAP(struct mode_info, 1); | 99 | mi = GET_HEAP(struct mode_info, 1); |
94 | mi->mode = mode + VIDEO_FIRST_VESA; | 100 | mi->mode = mode + VIDEO_FIRST_VESA; |
95 | mi->x = mi->y = 0; | 101 | mi->depth = vminfo.bpp; |
102 | mi->x = vminfo.h_res; | ||
103 | mi->y = vminfo.v_res; | ||
96 | nmodes++; | 104 | nmodes++; |
97 | #endif | 105 | #endif |
98 | } | 106 | } |
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c index aef02f9ec0c1..7259387b7d19 100644 --- a/arch/x86/boot/video-vga.c +++ b/arch/x86/boot/video-vga.c | |||
@@ -18,22 +18,22 @@ | |||
18 | #include "video.h" | 18 | #include "video.h" |
19 | 19 | ||
20 | static struct mode_info vga_modes[] = { | 20 | static struct mode_info vga_modes[] = { |
21 | { VIDEO_80x25, 80, 25 }, | 21 | { VIDEO_80x25, 80, 25, 0 }, |
22 | { VIDEO_8POINT, 80, 50 }, | 22 | { VIDEO_8POINT, 80, 50, 0 }, |
23 | { VIDEO_80x43, 80, 43 }, | 23 | { VIDEO_80x43, 80, 43, 0 }, |
24 | { VIDEO_80x28, 80, 28 }, | 24 | { VIDEO_80x28, 80, 28, 0 }, |
25 | { VIDEO_80x30, 80, 30 }, | 25 | { VIDEO_80x30, 80, 30, 0 }, |
26 | { VIDEO_80x34, 80, 34 }, | 26 | { VIDEO_80x34, 80, 34, 0 }, |
27 | { VIDEO_80x60, 80, 60 }, | 27 | { VIDEO_80x60, 80, 60, 0 }, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static struct mode_info ega_modes[] = { | 30 | static struct mode_info ega_modes[] = { |
31 | { VIDEO_80x25, 80, 25 }, | 31 | { VIDEO_80x25, 80, 25, 0 }, |
32 | { VIDEO_8POINT, 80, 43 }, | 32 | { VIDEO_8POINT, 80, 43, 0 }, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static struct mode_info cga_modes[] = { | 35 | static struct mode_info cga_modes[] = { |
36 | { VIDEO_80x25, 80, 25 }, | 36 | { VIDEO_80x25, 80, 25, 0 }, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | __videocard video_vga; | 39 | __videocard video_vga; |
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index ad9712f01739..696d08f3843c 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -293,13 +293,28 @@ static void display_menu(void) | |||
293 | struct mode_info *mi; | 293 | struct mode_info *mi; |
294 | char ch; | 294 | char ch; |
295 | int i; | 295 | int i; |
296 | int nmodes; | ||
297 | int modes_per_line; | ||
298 | int col; | ||
296 | 299 | ||
297 | puts("Mode: COLSxROWS:\n"); | 300 | nmodes = 0; |
301 | for (card = video_cards; card < video_cards_end; card++) | ||
302 | nmodes += card->nmodes; | ||
298 | 303 | ||
304 | modes_per_line = 1; | ||
305 | if (nmodes >= 20) | ||
306 | modes_per_line = 3; | ||
307 | |||
308 | for (col = 0; col < modes_per_line; col++) | ||
309 | puts("Mode: Resolution: Type: "); | ||
310 | putchar('\n'); | ||
311 | |||
312 | col = 0; | ||
299 | ch = '0'; | 313 | ch = '0'; |
300 | for (card = video_cards; card < video_cards_end; card++) { | 314 | for (card = video_cards; card < video_cards_end; card++) { |
301 | mi = card->modes; | 315 | mi = card->modes; |
302 | for (i = 0; i < card->nmodes; i++, mi++) { | 316 | for (i = 0; i < card->nmodes; i++, mi++) { |
317 | char resbuf[32]; | ||
303 | int visible = mi->x && mi->y; | 318 | int visible = mi->x && mi->y; |
304 | u16 mode_id = mi->mode ? mi->mode : | 319 | u16 mode_id = mi->mode ? mi->mode : |
305 | (mi->y << 8)+mi->x; | 320 | (mi->y << 8)+mi->x; |
@@ -307,8 +322,18 @@ static void display_menu(void) | |||
307 | if (!visible) | 322 | if (!visible) |
308 | continue; /* Hidden mode */ | 323 | continue; /* Hidden mode */ |
309 | 324 | ||
310 | printf("%c %04X %3dx%-3d %s\n", | 325 | if (mi->depth) |
311 | ch, mode_id, mi->x, mi->y, card->card_name); | 326 | sprintf(resbuf, "%dx%d", mi->y, mi->depth); |
327 | else | ||
328 | sprintf(resbuf, "%d", mi->y); | ||
329 | |||
330 | printf("%c %03X %4dx%-7s %-6s", | ||
331 | ch, mode_id, mi->x, resbuf, card->card_name); | ||
332 | col++; | ||
333 | if (col >= modes_per_line) { | ||
334 | putchar('\n'); | ||
335 | col = 0; | ||
336 | } | ||
312 | 337 | ||
313 | if (ch == '9') | 338 | if (ch == '9') |
314 | ch = 'a'; | 339 | ch = 'a'; |
@@ -318,6 +343,8 @@ static void display_menu(void) | |||
318 | ch++; | 343 | ch++; |
319 | } | 344 | } |
320 | } | 345 | } |
346 | if (col) | ||
347 | putchar('\n'); | ||
321 | } | 348 | } |
322 | 349 | ||
323 | #define H(x) ((x)-'a'+10) | 350 | #define H(x) ((x)-'a'+10) |
diff --git a/arch/x86/boot/video.h b/arch/x86/boot/video.h index b92447d51213..d69347f79e8e 100644 --- a/arch/x86/boot/video.h +++ b/arch/x86/boot/video.h | |||
@@ -83,7 +83,8 @@ void store_screen(void); | |||
83 | 83 | ||
84 | struct mode_info { | 84 | struct mode_info { |
85 | u16 mode; /* Mode number (vga= style) */ | 85 | u16 mode; /* Mode number (vga= style) */ |
86 | u8 x, y; /* Width, height */ | 86 | u16 x, y; /* Width, height */ |
87 | u16 depth; /* Bits per pixel, 0 for text mode */ | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | struct card_info { | 90 | struct card_info { |