svn commit: r197085 - in head: share/man/man4 sys/dev/syscons

Xin LI delphij at FreeBSD.org
Fri Sep 11 02:07:25 UTC 2009


Author: delphij
Date: Fri Sep 11 02:07:24 2009
New Revision: 197085
URL: http://svn.freebsd.org/changeset/base/197085

Log:
  Extend the usage of sc(4)'s hint variable 'flag'.  Bit 0x80 now means
  "set vesa mode" and higher 16bits of the flag would be the desired mode.
  
  One can now set, for instance, hint.sc.0.flags=0x01680180, which means
  that the system should set VESA mode 0x168 upon boot.
  
  Submitted by:	paradox <ddkprog yahoo com>, swell k at gmail.com with
  		some minor changes.

Modified:
  head/share/man/man4/syscons.4
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/share/man/man4/syscons.4
==============================================================================
--- head/share/man/man4/syscons.4	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/share/man/man4/syscons.4	Fri Sep 11 02:07:24 2009	(r197085)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2006
+.Dd September 10, 2009
 .Dt SYSCONS 4
 .Os
 .Sh NAME
@@ -325,7 +325,7 @@ This mode is useful on some laptop compu
 most other systems, and it adds substantial amount of code to syscons.
 If this option is NOT defined, you can reduce the kernel size a lot.
 See the
-.Dv VESA800X600
+.Dv VESAMODE
 flag below.
 .It Dv SC_TWOBUTTON_MOUSE
 If you have a two button mouse, you may want to add this option
@@ -426,15 +426,15 @@ or else at the loader prompt (see
 .\".It bit 6 (QUIET_BELL)
 .\"This option suppresses the bell, whether audible or visual,
 .\"if it is rung in a background virtual terminal.
-.It 0x0080 (VESA800X600)
-This option puts the video card in the VESA 800x600 pixel, 16 color
-mode.
-It may be useful for laptop computers for which the 800x600 mode
-is otherwise unsupported by the X server.
+.It 0x0080 (VESAMODE)
+This option puts the video card in the VESA mode specified by higher
+16 bits of the flags during kernel initialization.
 Note that in order for this flag to work, the kernel must be
 compiled with the
 .Dv SC_PIXEL_MODE
 option explained above.
+A list of the available mode can be obtained via
+.Xr vidcontrol 1 .
 .\"Note also that the ``copy-and-paste'' function is not currently supported
 .\"in this mode and the mouse pointer will not be displayed.
 .It 0x0100 (AUTODETECT_KBD)

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/sys/dev/syscons/syscons.c	Fri Sep 11 02:07:24 2009	(r197085)
@@ -352,6 +352,7 @@ sc_attach_unit(int unit, int flags)
 #endif
     int vc;
     struct cdev *dev;
+    u_int16_t vmode;
 
     flags &= ~SC_KERNEL_CONSOLE;
 
@@ -372,16 +373,20 @@ sc_attach_unit(int unit, int flags)
     if (sc_console == NULL)	/* sc_console_unit < 0 */
 	sc_console = scp;
 
+    vmode = (flags >> 16) & 0x1fff;
+    if (vmode < M_VESA_BASE || vmode > M_VESA_MODE_MAX)
+	vmode = M_VESA_FULL_800;
+
 #ifdef SC_PIXEL_MODE
-    if ((sc->config & SC_VESA800X600)
-	&& (vidd_get_info(sc->adp, M_VESA_800x600, &info) == 0)) {
+    if ((sc->config & SC_VESAMODE)
+	&& (vidd_get_info(sc->adp, vmode, &info) == 0)) {
 #ifdef DEV_SPLASH
 	if (sc->flags & SC_SPLASH_SCRN)
 	    splash_term(sc->adp);
 #endif
-	sc_set_graphics_mode(scp, NULL, M_VESA_800x600);
-	sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
-	sc->initial_mode = M_VESA_800x600;
+	sc_set_graphics_mode(scp, NULL, vmode);
+	sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8);
+	sc->initial_mode = vmode;
 #ifdef DEV_SPLASH
 	/* put up the splash again! */
 	if (sc->flags & SC_SPLASH_SCRN)
@@ -517,7 +522,7 @@ sctty_open(struct tty *tp)
     if (scp == NULL) {
 	scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp));
 	if (ISGRAPHSC(scp))
-	    sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
+	    sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8);
     }
     if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) {
 	tp->t_winsize.ws_col = scp->xsize;
@@ -2995,6 +3000,8 @@ init_scp(sc_softc_t *sc, int vty, scr_st
 	scp->ysize = info.vi_height;
 	scp->xpixel = scp->xsize*info.vi_cwidth;
 	scp->ypixel = scp->ysize*info.vi_cheight;
+    }
+
 	scp->font_size = info.vi_cheight;
 	scp->font_width = info.vi_cwidth;
 	if (info.vi_cheight < 14) {
@@ -3016,7 +3023,7 @@ init_scp(sc_softc_t *sc, int vty, scr_st
 	    scp->font = NULL;
 #endif
 	}
-    }
+
     sc_vtb_init(&scp->vtb, VTB_MEMORY, 0, 0, NULL, FALSE);
 #ifndef __sparc64__
     sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, 0, 0, NULL, FALSE);

Modified: head/sys/dev/syscons/syscons.h
==============================================================================
--- head/sys/dev/syscons/syscons.h	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/sys/dev/syscons/syscons.h	Fri Sep 11 02:07:24 2009	(r197085)
@@ -191,7 +191,7 @@ struct tty;
 typedef struct sc_softc {
 	int		unit;			/* unit # */
 	int		config;			/* configuration flags */
-#define SC_VESA800X600	(1 << 7)
+#define SC_VESAMODE	(1 << 7)
 #define SC_AUTODETECT_KBD (1 << 8)
 #define SC_KERNEL_CONSOLE (1 << 9)
 


More information about the svn-src-head mailing list