patch-2.1.23 linux/drivers/char/selection.h

Next file: linux/drivers/char/tga.c
Previous file: linux/drivers/char/rtc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/drivers/char/selection.h linux/drivers/char/selection.h
@@ -62,7 +62,7 @@
 
 #include <linux/config.h>
 
-#ifdef CONFIG_TGA_CONSOLE
+#if defined(CONFIG_TGA_CONSOLE)
 
 extern int tga_blitc(unsigned int, unsigned long);
 extern unsigned long video_mem_term;
@@ -73,10 +73,6 @@
  * TGA is *not* a character/attribute cell device; font bitmaps must be rendered
  * to the screen pixels.
  *
- * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either
- * of the VC's backing store, or the "shadow screen" memory where the screen
- * contents are kept, as the TGA frame buffer is *not* char/attr cells.
- *
  * We must test for an Alpha kernel virtual address that falls within
  *  the "shadow screen" memory. This condition indicates we really want 
  *  to write to the screen, so, we do... :-)
@@ -86,10 +82,10 @@
  */
 static inline void scr_writew(unsigned short val, unsigned short * addr)
 {
-	/*
-	 * always deposit the char/attr, then see if it was to "screen" mem.
+        /*
+         * always deposit the char/attr, then see if it was to "screen" mem.
 	 * if so, then render the char/attr onto the real screen.
-	 */
+         */
         *addr = val;
         if ((unsigned long)addr < video_mem_term &&
 	    (unsigned long)addr >= video_mem_base) {
@@ -101,7 +97,37 @@
 {
 	return *addr;
 }
-#else /* CONFIG_TGA_CONSOLE */
+
+#elif defined(CONFIG_SUN_CONSOLE)
+#include "vt_kern.h"
+#include <linux/kd.h>
+extern int sun_blitc(unsigned int, unsigned long);
+extern void memsetw(void * s, unsigned short c, unsigned int count);
+extern void memcpyw(unsigned short *to, unsigned short *from, unsigned int count);
+extern unsigned long video_mem_term;
+
+/* Basically the same as the TGA stuff. */
+static inline void scr_writew(unsigned short val, unsigned short * addr)
+{
+        /*
+         * always deposit the char/attr, then see if it was to "screen" mem.
+	 * if so, then render the char/attr onto the real screen.
+         */
+	if (*addr != val) {
+        	*addr = val;
+		if ((unsigned long)addr < video_mem_term &&
+		    (unsigned long)addr >= video_mem_base &&
+		    vt_cons [fg_console]->vc_mode == KD_TEXT)
+			sun_blitc(val, (unsigned long) addr);
+	}
+}
+
+static inline unsigned short scr_readw(unsigned short * addr)
+{
+	return *addr;
+}
+
+#else /* CONFIG_TGA_CONSOLE  || CONFIG_SUN_CONSOLE */
 
 /*
  * normal VGA console access
@@ -147,6 +173,7 @@
 
 #endif /* CONFIG_TGA_CONSOLE */
 
+#ifndef CONFIG_SUN_CONSOLE
 static inline void memsetw(void * s, unsigned short c, unsigned int count)
 {
 	unsigned short * addr = (unsigned short *) s;
@@ -167,3 +194,4 @@
 		scr_writew(scr_readw(from++), to++);
 	}
 }
+#endif /* CONFIG_SUN_CONSOLE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov