Merge branch 'x86-setup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Dec 2009 21:35:29 +0000 (13:35 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Dec 2009 21:35:29 +0000 (13:35 -0800)
* 'x86-setup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  vgacon: Add support for setting the default cursor state
  vc: Add support for hiding the cursor when creating VTs
  x86, setup: Store the boot cursor state

Documentation/kernel-parameters.txt
arch/x86/boot/video.c
drivers/char/vt.c
drivers/video/console/vgacon.c
include/linux/screen_info.h
include/linux/vt_kern.h

index 495a39a773414878083b83287e28c5fb08d72db6..777dc8a32df8d077fc9bdca101a071d3c7f97294 100644 (file)
@@ -2747,6 +2747,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>
 
index d42da380249940ced8d6cdbb13bf76467ea89792..f767164cd5df91e1aaf2088fca44a3a26213f69c 100644 (file)
@@ -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)
index 0c80c68cd047400fc4f59a19cb1c0e47826be57c..1e3d728dbf7e15a9c15664562c1057a376f33434 100644 (file)
@@ -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, &param);
@@ -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);
index da55ccaf4d55043bc3889bdba7feff1b6326213b..cc4bbbe44aca6b4672568f5ee36d27bdc1b17222 100644 (file)
@@ -585,6 +585,11 @@ 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);
+
+       /* 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)
index 1ee2c05142f627ba68cfcf17205a1ae3e38b8893..899fbb487c94e5cb2385ff90ab86f0b8985aa435 100644 (file)
@@ -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;
 
index c0c4e1103a73e4c6e735de2c0ab22987a7e0326b..7f56db4a79f02e02810c3018b34b8a52af2c24a6 100644 (file)
@@ -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 */