x86: clean up early_printk output
PATCH 1/1 x86: clean up early_printk output
early_printk() starts output on the second screen line and doesn't clear the rest of the line when it hits a newline char. When there is already a BIOS message there, it becomes hard to read. Change this so it starts on the first line and clears to EOL upon hitting newline.
arch/x86_64/kernel/early_printk.c +11 -3
@@ -21,7 +21,15 @@#define MAX_XPOS max_xposstatic int max_ypos =25 , max_xpos =80 ; -static int current_ypos =1 , current_xpos =0 ; +static int current_ypos, current_xpos;/* 0,0 */ + +static noinline void clear_to_eol(int xpos, int ypos) +{ +int i; + +for (i = xpos; i <MAX_XPOS ; i++) +writew (0x720 ,VGABASE +2 *(MAX_XPOS *ypos + i)); +}static void early_vga_write (struct console *con,const char *str,unsigned n) {
@@ -37,11 +45,11 @@ static void early_vga_write(struct conso VGABASE + 2*(MAX_XPOS*j + i)); } } -for (i =0 ; i <MAX_XPOS ; i++) -writew (0x720 ,VGABASE +2 *(MAX_XPOS *j + i)); +clear_to_eol (0 , j); current_ypos =MAX_YPOS -1 ; }if (c =='\n' ) { +clear_to_eol (current_xpos, current_ypos); current_xpos =0 ; current_ypos++; }else if (c !='\r' ) {
Signature · 2 lines
Chuck "Equations are the Devil's sentences." --Stephen Colbert
Quoted 6 lines · Chuck Ebbert
early_printk()starts output on the second screen line and doesn't clear the rest of the line when it hits a newline char. When there is already a BIOS message there, it becomes hard to read. Change this so it starts on the first line and clears to EOL upon hitting newline.
This conflicts in intent with Stas's patch:
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc4/2.6.16-rc4-mm2/broken-out/x86-early-printk-handling-fixes.patch
that patch solves the same problem, and I think in a slightly better way:
at least there's a chance that some of those (potentially useful) bootloader messages are still visible when the kernel goes tits up.
Of course, the best fix would be to start the kernel messages at the next line after the bootloader, but I guess that info would be hard to locate.
Quoted 5 lines · Chuck Ebbert
early_printk()starts output on the second screen line and doesn't clear the rest of the line when it hits a newline char. When there is already a BIOS message there, it becomes hard to read. Change this so it starts on the first line and clears to EOL upon hitting newline.
early_printk is designed to do absolutely minimal work to get the message out. Your patch adds too much potential disturbance imho.
-Andi