setup: Store the boot cursor state
Subsystems (7)
PATCH 1/3 setup: Store the boot cursor state
Add a field to store the boot cursor state and implement this for VGA on x86. This can then be used to set the default policy for the boot console.
--- arch/x86/boot/video.c | 6 ++++++ include/linux/screen_info.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletions(-)
arch/x86/boot/video.c +6 -0
@@ -27,6 +27,12 @@ static void store_cursor_position(void) boot_params.screen_info.orig_x = oreg.dl; boot_params.screen_info.orig_y = oreg.dh; + +if (oreg.ch &0x20 ) + boot_params.screen_info.flags |=VIDEO_FLAGS_NOCURSOR ; + +if ((oreg.ch &0x1f ) > (oreg.cl &0x1f )) + boot_params.screen_info.flags |=VIDEO_FLAGS_NOCURSOR ; }static void store_video_mode (void )
include/linux/screen_info.h +4 -1
@@ -14,7 +14,8 @@ struct screen_info {__u16 orig_video_page;/* 0x04 */ __u8 orig_video_mode;/* 0x06 */ __u8 orig_video_cols;/* 0x07 */ -__u16 unused2;/* 0x08 */ +__u8 flags;/* 0x08 */ +__u8 unused2;/* 0x09 */ __u16 orig_video_ega_bx;/* 0x0a */ __u16 unused3;/* 0x0c */ __u8 orig_video_lines;/* 0x0e */
@@ -65,6 +66,8 @@ struct screen_info {#define VIDEO_TYPE_EFI 0x70/* EFI graphic mode */ +#define VIDEO_FLAGS_NOCURSOR (1 << 0)/* The video mode has no cursor set */ +#ifdef __KERNEL__extern struct screen_info screen_info;
Signature · 1 line
1.6.5.2
PATCH 2/3 vc: Add support for hiding the cursor when creating VTs
Add support for setting a global default for whether or not a visible cursor should be enabled when creating VCs. The default will be to do so, unless overridden by the user at boot time or by a driver.
--- Documentation/kernel-parameters.txt | 9 +++++++++ drivers/char/vt.c | 22 ++++++++++++++++------ drivers/video/console/vgacon.c | 2 ++ include/linux/vt_kern.h | 3 +++ 4 files changed, 30 insertions(+), 6 deletions(-)
Documentation/kernel-parameters.txt +9 -0
@@ -2729,6 +2729,15 @@ and is between 256 and 4096 characters. It is defined in the file Default is 1, i.e. UTF-8 mode is enabled for all newly opened terminals. + vt.global_cursor_default= + [VT] + Format=<-1|0|1> + Set system-wide default for whether a cursor + is shown on new VTs. Default is -1, + i.e. cursors will be created by default unless + overridden by individual drivers. 0 will hide + cursors, 1 will display them. + waveartist= [HW,OSS] Format: <io>,<irq>,<dma>,<dma2>
drivers/char/vt.c +16 -6
@@ -146,10 +146,11 @@ static const struct consw *con_driver_map[MAX_NR_CONSOLES];static int con_open (struct tty_struct *,struct file *); static void vc_init(struct vc_data *vc, unsigned int rows, -unsigned int cols,int do_clear); + unsigned int cols, int do_clear) static void gotoxy(struct vc_data *vc, int new_x, int new_y);static void save_cur (struct vc_data *vc); -static void reset_terminal (struct vc_data *vc,int do_clear); +static void reset_terminal (struct vc_data *vc,int do_clear, +int show_cursor);static void con_flush_chars (struct tty_struct *tty);static int set_vesa_blanking (char __user *p);static void set_cursor (struct vc_data *vc);
@@ -161,6 +162,8 @@ static void set_palette(struct vc_data *vc);static int printable;/* Is console ready for printing? */ int default_utf8 = true;module_param (default_utf8, int,S_IRUGO |S_IWUSR ); +static int global_cursor_default =-1 ; +module_param (global_cursor_default, int,S_IRUGO |S_IWUSR );/* * ignore_poke: don't unblank the screen when things are typed. This is
@@ -775,6 +778,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ vc_cons[currcons].d =NULL ;return -ENOMEM ; } + +/* If no drivers have overridden us and the user didn't pass a +boot option, default to displaying the cursor */ +if (global_cursor_default ==-1 ) + global_cursor_default =1 ; +vc_init (vc, vc->vc_rows, vc->vc_cols,1 );vcs_make_sysfs (currcons);atomic_notifier_call_chain (&vt_notifier_list,VT_ALLOCATE , ¶m);
@@ -1616,7 +1625,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) vc->vc_decscnm =0 ; vc->vc_decom =0 ; vc->vc_decawm =1 ; - vc->vc_deccm =1 ; + vc->vc_deccm = global_cursor_default; vc->vc_decim =0 ;set_kbd (vc, decarm);
@@ -1756,7 +1765,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) vc->vc_state = EShash;return ;case 'c' : -reset_terminal (vc,1 ); +reset_terminal (vc,1 ,1 );return ;case '>' :/* Numeric keypad */ clr_kbd (vc, kbdapplic);
@@ -2821,7 +2830,7 @@ static void vc_init(struct vc_data *vc, unsigned int rows, vc->vc_itcolor = default_italic_color; vc->vc_halfcolor =0x08 ;/* grey */ init_waitqueue_head (&vc->paste_wait); -reset_terminal (vc, do_clear); +reset_terminal (vc, do_clear, show_cursor); }/*
@@ -2873,7 +2882,7 @@ static int __init con_init(void)visual_init (vc, currcons,1 ); vc->vc_screenbuf =kzalloc (vc->vc_screenbuf_size,GFP_NOWAIT );vc_init (vc, vc->vc_rows, vc->vc_cols, - currcons || !vc->vc_sw->con_save_screen); + currcons || !vc->vc_sw->con_save_screen) } currcons = fg_console =0 ; master_display_fg = vc = vc_cons[currcons].d;
@@ -4078,6 +4087,7 @@ EXPORT_SYMBOL(fg_console);EXPORT_SYMBOL (console_blank_hook);EXPORT_SYMBOL (console_blanked);EXPORT_SYMBOL (vc_cons); +EXPORT_SYMBOL (global_cursor_default);#ifndef VT_SINGLE_DRIVER EXPORT_SYMBOL (take_over_console);EXPORT_SYMBOL (give_up_console);
drivers/video/console/vgacon.c +2 -0
@@ -585,6 +585,8 @@ static void vgacon_init(struct vc_data *c, int init) vgacon_uni_pagedir[1 ]++;if (!vgacon_uni_pagedir[0 ] && p)con_set_default_unimap (c); + +hide_boot_cursor (screen_info.flags &VIDEO_FLAGS_NOCURSOR ); }static void vgacon_deinit (struct vc_data *c)
include/linux/vt_kern.h +3 -0
@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE];extern struct mutex con_buf_mtx;extern char vt_dont_switch;extern int default_utf8; +extern int global_cursor_default;struct vt_spawn_console {spinlock_t lock;
@@ -130,4 +131,6 @@ struct vt_notifier_param {extern int register_vt_notifier (struct notifier_block *nb);extern int unregister_vt_notifier (struct notifier_block *nb); +extern void hide_boot_cursor (bool hide); +#endif /* _VT_KERN_H */
Signature · 1 line
1.6.5.2
PATCH 3/3 vgacon: Add support for setting the default cursor state
Pass the vga cursor state to the vt layer, ensuring that we don't hide the cursor when the bootloader has deliberately disabled it.
--- drivers/video/console/vgacon.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/video/console/vgacon.c +4 -1
@@ -586,7 +586,10 @@ static void vgacon_init(struct vc_data *c, int init)if (!vgacon_uni_pagedir[0 ] && p)con_set_default_unimap (c); -hide_boot_cursor (screen_info.flags &VIDEO_FLAGS_NOCURSOR ); +/* Only set the default if the user didn't deliberately override it */ +if (global_cursor_default ==-1 ) + global_cursor_default = + !(screen_info.flags &VIDEO_FLAGS_NOCURSOR ); }static void vgacon_deinit (struct vc_data *c)
Signature · 1 line
1.6.5.2
[tip:x86/setup] vgacon: Add support for setting the default cursor state
Commit-ID: b434a680a29424856e0f40199daa9f65963c7cb4 Gitweb: http://git.kernel.org/tip/b434a680a29424856e0f40199daa9f65963c7cb4 Author: Matthew Garrett <[email protected]> AuthorDate: Fri, 13 Nov 2009 14:57:02 -0500 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 13 Nov 2009 15:55:02 -0800
vgacon: Add support for setting the default cursor state
Pass the vga cursor state to the vt layer, ensuring that we don't hide the cursor when the bootloader has deliberately disabled it.
LKML-Reference: <[email protected]>
--- drivers/video/console/vgacon.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/video/console/vgacon.c +4 -1
@@ -586,7 +586,10 @@ static void vgacon_init(struct vc_data *c, int init)if (!vgacon_uni_pagedir[0 ] && p)con_set_default_unimap (c); -hide_boot_cursor (screen_info.flags &VIDEO_FLAGS_NOCURSOR ); +/* Only set the default if the user didn't deliberately override it */ +if (global_cursor_default ==-1 ) + global_cursor_default = + !(screen_info.flags &VIDEO_FLAGS_NOCURSOR ); }static void vgacon_deinit (struct vc_data *c)
PATCH v2 1/1 vc: Add support for hiding the cursor when creating VTs
In reply to Matthew GarrettAdd support for setting a global default for whether or not a visible cursor should be enabled when creating VCs. The default will be to do so, unless overridden by the user at boot time or by a driver.
---
sorry, sent the wrong version of this to start with.
Documentation/kernel-parameters.txt | 9 +++++++++ drivers/char/vt.c | 11 ++++++++++- drivers/video/console/vgacon.c | 2 ++ include/linux/vt_kern.h | 3 +++ 4 files changed, 24 insertions(+), 1 deletions(-)
Documentation/kernel-parameters.txt +9 -0
@@ -2729,6 +2729,15 @@ and is between 256 and 4096 characters. It is defined in the file Default is 1, i.e. UTF-8 mode is enabled for all newly opened terminals. + vt.global_cursor_default= + [VT] + Format=<-1|0|1> + Set system-wide default for whether a cursor + is shown on new VTs. Default is -1, + i.e. cursors will be created by default unless + overridden by individual drivers. 0 will hide + cursors, 1 will display them. + waveartist= [HW,OSS] Format: <io>,<irq>,<dma>,<dma2>
drivers/char/vt.c +10 -1
@@ -161,6 +161,8 @@ static void set_palette(struct vc_data *vc);static int printable;/* Is console ready for printing? */ int default_utf8 = true;module_param (default_utf8, int,S_IRUGO |S_IWUSR ); +int global_cursor_default =-1 ; +module_param (global_cursor_default, int,S_IRUGO |S_IWUSR );/* * ignore_poke: don't unblank the screen when things are typed. This is
@@ -775,6 +777,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ vc_cons[currcons].d =NULL ;return -ENOMEM ; } + +/* If no drivers have overridden us and the user didn't pass a +boot option, default to displaying the cursor */ +if (global_cursor_default ==-1 ) + global_cursor_default =1 ; +vc_init (vc, vc->vc_rows, vc->vc_cols,1 );vcs_make_sysfs (currcons);atomic_notifier_call_chain (&vt_notifier_list,VT_ALLOCATE , ¶m);
@@ -1616,7 +1624,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) vc->vc_decscnm =0 ; vc->vc_decom =0 ; vc->vc_decawm =1 ; - vc->vc_deccm =1 ; + vc->vc_deccm = global_cursor_default; vc->vc_decim =0 ;set_kbd (vc, decarm);
@@ -4078,6 +4086,7 @@ EXPORT_SYMBOL(fg_console);EXPORT_SYMBOL (console_blank_hook);EXPORT_SYMBOL (console_blanked);EXPORT_SYMBOL (vc_cons); +EXPORT_SYMBOL (global_cursor_default);#ifndef VT_SINGLE_DRIVER EXPORT_SYMBOL (take_over_console);EXPORT_SYMBOL (give_up_console);
drivers/video/console/vgacon.c +2 -0
@@ -585,6 +585,8 @@ static void vgacon_init(struct vc_data *c, int init) vgacon_uni_pagedir[1 ]++;if (!vgacon_uni_pagedir[0 ] && p)con_set_default_unimap (c); + +hide_boot_cursor (screen_info.flags &VIDEO_FLAGS_NOCURSOR ); }static void vgacon_deinit (struct vc_data *c)
include/linux/vt_kern.h +3 -0
@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE];extern struct mutex con_buf_mtx;extern char vt_dont_switch;extern int default_utf8; +extern int global_cursor_default;struct vt_spawn_console {spinlock_t lock;
@@ -130,4 +131,6 @@ struct vt_notifier_param {extern int register_vt_notifier (struct notifier_block *nb);extern int unregister_vt_notifier (struct notifier_block *nb); +extern void hide_boot_cursor (bool hide); +#endif /* _VT_KERN_H */
Signature · 1 line
1.6.5.2
[tip:x86/setup] vc: Add support for hiding the cursor when creating VTs
Commit-ID: f6c06b6807ff9281295989ebad72523865325a4f Gitweb: http://git.kernel.org/tip/f6c06b6807ff9281295989ebad72523865325a4f Author: Matthew Garrett <[email protected]> AuthorDate: Fri, 13 Nov 2009 15:14:11 -0500 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 13 Nov 2009 15:54:27 -0800
vc: Add support for hiding the cursor when creating VTs
Add support for setting a global default for whether or not a visible cursor should be enabled when creating VCs. The default will be to do so, unless overridden by the user at boot time or by a driver.
LKML-Reference: <[email protected]>
--- Documentation/kernel-parameters.txt | 9 +++++++++ drivers/char/vt.c | 11 ++++++++++- drivers/video/console/vgacon.c | 2 ++ include/linux/vt_kern.h | 3 +++ 4 files changed, 24 insertions(+), 1 deletions(-)
Documentation/kernel-parameters.txt +9 -0
@@ -2729,6 +2729,15 @@ and is between 256 and 4096 characters. It is defined in the file Default is 1, i.e. UTF-8 mode is enabled for all newly opened terminals. + vt.global_cursor_default= + [VT] + Format=<-1|0|1> + Set system-wide default for whether a cursor + is shown on new VTs. Default is -1, + i.e. cursors will be created by default unless + overridden by individual drivers. 0 will hide + cursors, 1 will display them. + waveartist= [HW,OSS] Format: <io>,<irq>,<dma>,<dma2>
drivers/char/vt.c +10 -1
@@ -161,6 +161,8 @@ static void set_palette(struct vc_data *vc);static int printable;/* Is console ready for printing? */ int default_utf8 = true;module_param (default_utf8, int,S_IRUGO |S_IWUSR ); +int global_cursor_default =-1 ; +module_param (global_cursor_default, int,S_IRUGO |S_IWUSR );/* * ignore_poke: don't unblank the screen when things are typed. This is
@@ -775,6 +777,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ vc_cons[currcons].d =NULL ;return -ENOMEM ; } + +/* If no drivers have overridden us and the user didn't pass a +boot option, default to displaying the cursor */ +if (global_cursor_default ==-1 ) + global_cursor_default =1 ; +vc_init (vc, vc->vc_rows, vc->vc_cols,1 );vcs_make_sysfs (currcons);atomic_notifier_call_chain (&vt_notifier_list,VT_ALLOCATE , ¶m);
@@ -1616,7 +1624,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) vc->vc_decscnm =0 ; vc->vc_decom =0 ; vc->vc_decawm =1 ; - vc->vc_deccm =1 ; + vc->vc_deccm = global_cursor_default; vc->vc_decim =0 ;set_kbd (vc, decarm);
@@ -4078,6 +4086,7 @@ EXPORT_SYMBOL(fg_console);EXPORT_SYMBOL (console_blank_hook);EXPORT_SYMBOL (console_blanked);EXPORT_SYMBOL (vc_cons); +EXPORT_SYMBOL (global_cursor_default);#ifndef VT_SINGLE_DRIVER EXPORT_SYMBOL (take_over_console);EXPORT_SYMBOL (give_up_console);
drivers/video/console/vgacon.c +2 -0
@@ -585,6 +585,8 @@ static void vgacon_init(struct vc_data *c, int init) vgacon_uni_pagedir[1 ]++;if (!vgacon_uni_pagedir[0 ] && p)con_set_default_unimap (c); + +hide_boot_cursor (screen_info.flags &VIDEO_FLAGS_NOCURSOR ); }static void vgacon_deinit (struct vc_data *c)
include/linux/vt_kern.h +3 -0
@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE];extern struct mutex con_buf_mtx;extern char vt_dont_switch;extern int default_utf8; +extern int global_cursor_default;struct vt_spawn_console {spinlock_t lock;
@@ -130,4 +131,6 @@ struct vt_notifier_param {extern int register_vt_notifier (struct notifier_block *nb);extern int unregister_vt_notifier (struct notifier_block *nb); +extern void hide_boot_cursor (bool hide); +#endif /* _VT_KERN_H */
H. Peter Anvin
reviewerRe: [PATCH 2/3] vc: Add support for hiding the cursor when creating VTs
In reply to Matthew Garrettdrivers/char/vt.c static const struct consw *con_driver_map[MAX_NR_CONSOLES]; · line 149
Quoted 5 lines · Matthew Garrett
static int
con_open(struct tty_struct *, struct file *); static void vc_init(structvc_data*vc, unsigned int rows,drivers/char/vt.c +1
-1- unsigned int cols, int do_clear); + unsigned int cols, int do_clear)
Uhm... this doesn't compile.
I'm going to bounce this patch, not because I can't just add the semicolon back and recompile it, but because that means you never compiled it and therefore never tested it.
Please fix, test, and resubmit.
-hpa
Re: [PATCH 2/3] vc: Add support for hiding the cursor when creating VTs
Quoted 8 lines · H. Peter Anvin
drivers/char/vt.c static const struct consw *con_driver_map[MAX_NR_CONSOLES]; · line 149
Quoted 5 lines · Matthew Garrett
static int
con_open(struct tty_struct *, struct file *); static void vc_init(structvc_data*vc, unsigned int rows,drivers/char/vt.c +1
-1- unsigned int cols, int do_clear); + unsigned int cols, int do_clear)Uhm... this doesn't compile.
Yes, I managed to send the wrong version. You should have the correct one already.
Signature · 1 line
Matthew Garrett | [email protected]
H. Peter Anvin
reviewerQuoted 4 lines · Matthew Garrett
Add a field to store the boot cursor state and implement this for VGA on x86. This can then be used to set the default policy for the boot console.
Signed-off-by Matthew Garrett <[email protected]>
I'm cool with this, but please update the appropriate files in Documentation/x86 as well.
-hpa
Quoted 2 lines · H. Peter Anvin
I'm cool with this, but please update the appropriate files in
Documentation/x86as well.
It's in screen_info rather than the zero page - is there any relevant documentation to update?
Signature · 1 line
Matthew Garrett | [email protected]
H. Peter Anvin
reviewerQuoted 8 lines · Matthew Garrett
Quoted 2 lines · H. Peter Anvin
I'm cool with this, but please update the appropriate files in
Documentation/x86as well.It's in
screen_inforather than the zero page - is there any relevant documentation to update?
Hm, looks like there isn't... although it would be rather good to get screen_info and the other substructures documented!
-hpa
[tip:x86/setup] x86, setup: Store the boot cursor state
In reply to Matthew GarrettCommit-ID: d9b263528e01bfbaf716b51f38606b3dfe5ac1e9 Gitweb: http://git.kernel.org/tip/d9b263528e01bfbaf716b51f38606b3dfe5ac1e9 Author: Matthew Garrett <[email protected]> AuthorDate: Fri, 13 Nov 2009 14:57:00 -0500 Committer: H. Peter Anvin <[email protected]> CommitDate: Fri, 13 Nov 2009 14:23:11 -0800
x86, setup: Store the boot cursor state
Add a field to store the boot cursor state and implement this for VGA on x86. This can then be used to set the default policy for the boot console.
LKML-Reference: <[email protected]>
--- arch/x86/boot/video.c | 6 ++++++ include/linux/screen_info.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletions(-)
arch/x86/boot/video.c +6 -0
@@ -27,6 +27,12 @@ static void store_cursor_position(void) boot_params.screen_info.orig_x = oreg.dl; boot_params.screen_info.orig_y = oreg.dh; + +if (oreg.ch &0x20 ) + boot_params.screen_info.flags |=VIDEO_FLAGS_NOCURSOR ; + +if ((oreg.ch &0x1f ) > (oreg.cl &0x1f )) + boot_params.screen_info.flags |=VIDEO_FLAGS_NOCURSOR ; }static void store_video_mode (void )
include/linux/screen_info.h +4 -1
@@ -14,7 +14,8 @@ struct screen_info {__u16 orig_video_page;/* 0x04 */ __u8 orig_video_mode;/* 0x06 */ __u8 orig_video_cols;/* 0x07 */ -__u16 unused2;/* 0x08 */ +__u8 flags;/* 0x08 */ +__u8 unused2;/* 0x09 */ __u16 orig_video_ega_bx;/* 0x0a */ __u16 unused3;/* 0x0c */ __u8 orig_video_lines;/* 0x0e */
@@ -65,6 +66,8 @@ struct screen_info {#define VIDEO_TYPE_EFI 0x70/* EFI graphic mode */ +#define VIDEO_FLAGS_NOCURSOR (1 << 0)/* The video mode has no cursor set */ +#ifdef __KERNEL__extern struct screen_info screen_info;