Skip to contentSkip to conversation

add support for PC-9800 architecture (console)

PATCH In review Osamu Tomita 1 participant 1 message Oct 18, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/25 add support for PC-9800 architecture (console)

This is part 3/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.

Summary:
console display modules
- add jis-x201 charset("kana") support
- add multi-byte char("kanji") support

Now, support japanese only and works only with PC-9800 video driver. I hope this may be base for ather multi-byte languege support.

diffstat:

 drivers/char/Makefile          |   18 +
 drivers/char/console_macros.h  |   24 +
 drivers/char/console_pc9800.h  |   27 +
 drivers/char/consolemap.c      |   67 +++
 drivers/char/pc9800.uni        |  260 +++++++++++++++
 drivers/char/vc_screen.c       |   33 +
 drivers/char/vt.c              |  690 ++++++++++++++++++++++++++++++++++++++++-
 drivers/char/vt_ioctl.c        |   19 +
 include/linux/console.h        |    3 
 include/linux/console_struct.h |   34 ++
 include/linux/consolemap.h     |    6 
 include/linux/tty.h            |    8 
 include/linux/vt.h             |    5 
 include/linux/vt_buffer.h      |    6 
 14 files changed, 1187 insertions(+), 13 deletions(-)

patch:

drivers/char/Makefile +18 -0
diff -urN linux/drivers/char/Makefile linux98/drivers/char/Makefile
@@ -5,7 +5,11 @@
 #
 # This file contains the font map for the default (hardware) font
 #
+ifneq ($(CONFIG_PC9800),y)
 FONTMAPFILE = cp437.uni
+else
+FONTMAPFILE = pc9800.uni
+endif
 
 obj-y	 += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o
 
@@ -15,9 +19,14 @@
 export-objs     :=	busmouse.o vt.o generic_serial.o ip2main.o \
 			ite_gpio.o keyboard.o misc.o nvram.o random.o rtc.o \
 			selection.o sonypi.o sysrq.o tty_io.o tty_ioctl.o
+export-objs     +=	upd4990a.o
 
 obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o
+ifneq ($(CONFIG_PC9800),y)
 obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
+else
+obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap_pc9800.o
+endif
 obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
 obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
 obj-$(CONFIG_ROCKETPORT) += rocket.o
@@ -51,6 +60,7 @@
 
 obj-$(CONFIG_PRINTER) += lp.o
 obj-$(CONFIG_TIPAR) += tipar.o
+obj-$(CONFIG_PC9800_OLDLP)) += lp_old98.o
 
 obj-$(CONFIG_BUSMOUSE) += busmouse.o
 obj-$(CONFIG_DTLK) += dtlk.o
@@ -58,7 +68,11 @@
 obj-$(CONFIG_APPLICOM) += applicom.o
 obj-$(CONFIG_SONYPI) += sonypi.o
 obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
+ifneq ($(CONFIG_PC9800),y)
 obj-$(CONFIG_RTC) += rtc.o
+else
+obj-$(CONFIG_RTC) += upd4990a.o
+endif
 obj-$(CONFIG_GEN_RTC) += genrtc.o
 obj-$(CONFIG_EFI_RTC) += efirtc.o
 ifeq ($(CONFIG_PPC),)
@@ -109,7 +123,11 @@
 $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE)
 	$(call do_cmd,CONMK  $(echo_target),$(objtree)/scripts/conmakehash $< > $@)
 
+ifneq ($(CONFIG_PC9800),y)
 $(obj)/defkeymap.o:  $(obj)/defkeymap.c
+else
+$(obj)/defkeymap_pc9800.o:  $(obj)/defkeymap_pc9800.c
+endif
 
 $(obj)/qtronixmap.o: $(obj)/qtronixmap.c
 
drivers/char/console_macros.h +24 -0
diff -urN linux/drivers/char/console_macros.h linux98/drivers/char/console_macros.h
@@ -1,3 +1,5 @@
+#include <linux/config.h>
+
 #define cons_num	(vc_cons[currcons].d->vc_num)
 #define sw		(vc_cons[currcons].d->vc_sw)
 #define screenbuf	(vc_cons[currcons].d->vc_screenbuf)
@@ -27,6 +29,9 @@
 #define utf_count	(vc_cons[currcons].d->vc_utf_count)
 #define utf_char	(vc_cons[currcons].d->vc_utf_char)
 #define video_erase_char (vc_cons[currcons].d->vc_video_erase_char)
+#ifdef CONFIG_PC9800
+#define video_erase_attr (vc_cons[currcons].d->vc_video_erase_attr)
+#endif
 #define disp_ctrl	(vc_cons[currcons].d->vc_disp_ctrl)
 #define toggle_meta	(vc_cons[currcons].d->vc_toggle_meta)
 #define decscnm		(vc_cons[currcons].d->vc_decscnm)
@@ -55,6 +60,12 @@
 #define	s_reverse	(vc_cons[currcons].d->vc_s_reverse)
 #define	ulcolor		(vc_cons[currcons].d->vc_ulcolor)
 #define	halfcolor	(vc_cons[currcons].d->vc_halfcolor)
+#ifdef CONFIG_GDC_CONSOLE
+# define def_attr	(vc_cons[currcons].d->vc_def_attr)
+# define ul_attr	(vc_cons[currcons].d->vc_ul_attr)
+# define half_attr	(vc_cons[currcons].d->vc_half_attr)
+# define bold_attr	(vc_cons[currcons].d->vc_bold_attr)
+#endif
 #define tab_stop	(vc_cons[currcons].d->vc_tab_stop)
 #define palette		(vc_cons[currcons].d->vc_palette)
 #define bell_pitch	(vc_cons[currcons].d->vc_bell_pitch)
@@ -64,6 +75,19 @@
 #define complement_mask (vc_cons[currcons].d->vc_complement_mask)
 #define s_complement_mask (vc_cons[currcons].d->vc_s_complement_mask)
 #define hi_font_mask	(vc_cons[currcons].d->vc_hi_font_mask)
+#ifdef CONFIG_PC9800
+#define kanji_mode     (vc_cons[currcons].d->vc_kanji_mode)
+#define s_kanji_mode   (vc_cons[currcons].d->vc_s_kanji_mode)
+#define kanji_char1    (vc_cons[currcons].d->vc_kanji_char1)
+#define translate_ex   (vc_cons[currcons].d->vc_translate_ex)
+#define G0_charset_ex  (vc_cons[currcons].d->vc_G0_charset_ex)
+#define G1_charset_ex  (vc_cons[currcons].d->vc_G1_charset_ex)
+#define saved_G0_ex    (vc_cons[currcons].d->vc_saved_G0_ex)
+#define saved_G1_ex    (vc_cons[currcons].d->vc_saved_G1_ex)
+#define kanji_jis_mode (vc_cons[currcons].d->vc_kanji_jis_mode)
+#define s_kanji_jis_mode (vc_cons[currcons].d->vc_s_kanji_jis_mode)
+#define pc98_addbuf	(vc_cons[currcons].d->vc_pc98_addbuf)
+#endif
 
 #define vcmode		(vt_cons[currcons]->vc_mode)
 
drivers/char/console_pc9800.h +27 -0
diff -urN linux/drivers/char/console_pc9800.h linux98/drivers/char/console_pc9800.h
@@ -0,0 +1,27 @@
+#ifndef __CONSOLE_PC9800_H
+#define __CONSOLE_PC9800_H
+
+#define PC9800_VRAM_ATTR_OFFSET 0x2000
+static inline unsigned long __pc9800_attr_offset(unsigned long Addr, unsigned long vss)
+{
+	if(Addr >= (unsigned long)__va(0xa0000)
+	   && Addr < (unsigned long)__va(0xa2000)) {
+		Addr += PC9800_VRAM_ATTR_OFFSET;
+	}else{
+		Addr += vss;
+	}
+	return Addr;
+}
+#define pc9800_attr_offset(x) \
+	((typeof(x))__pc9800_attr_offset((unsigned long)(x),(vc_cons[currcons].d->vc_screenbuf_size)))
+#define BLANK_ATTR	0x00E1
+
+#define JIS_CODE       0x01
+#define EUC_CODE       0x00
+#define SJIS_CODE      0x02
+#define JIS_CODE_ASCII  0x00
+#define JIS_CODE_78     0x01
+#define JIS_CODE_83     0x02
+#define JIS_CODE_90     0x03
+
+#endif /* __CONSOLE_PC9800_H */
drivers/char/consolemap.c +65 -2

87 lines not on this page · raw message

drivers/char/pc9800.uni +260 -0

260 lines not on this page · raw message

drivers/char/vc_screen.c +33 -0
diff -urN linux/drivers/char/vc_screen.c linux98/drivers/char/vc_screen.c
@@ -41,6 +41,10 @@
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 
+#ifdef CONFIG_PC9800
+#include "console_pc9800.h"
+#endif
+
 #undef attr
 #undef org
 #undef addr
@@ -137,6 +141,9 @@
 		goto unlock_out;
 	read = 0;
 	ret = 0;
+#ifdef CONFIG_PC9800
+	/* need modification for kanji */
+#endif
 	while (count) {
 		char *con_buf0, *con_buf_start;
 		long this_round, size;
@@ -229,7 +236,15 @@
 				this_round = (this_round + 1) >> 1;
 
 				while (this_round) {
+#ifndef CONFIG_PC9800
 					*tmp_buf++ = vcs_scr_readw(currcons, org++);
+#else
+					/* need modification for kanji */
+					*tmp_buf++ = (vcs_scr_readw(currcons, org) & 0xff)
+						| ((vcs_scr_readw(currcons, pc9800_attr_offset(org)) & 0xff) << 8);
+					org++;
+#endif
+
 					this_round --;
 					if (++col == maxcol) {
 						org = screen_pos(currcons, p, viewed);
@@ -237,6 +252,9 @@
 						p += maxcol;
 					}
 				}
+#ifdef CONFIG_PC9800
+/* need modification for kanji */
+#endif
 			}
 		}
 
@@ -395,6 +413,9 @@
 
 					this_round--;
 					c = *con_buf0++;
+#ifdef CONFIG_PC9800
+					vcs_scr_writew(currcons, c, pc9800_attr_offset(org));
+#else /* !CONFIG_PC9800 */
 #ifdef __BIG_ENDIAN
 					vcs_scr_writew(currcons, c |
 					     (vcs_scr_readw(currcons, org) & 0xff00), org);
@@ -402,6 +423,7 @@
 					vcs_scr_writew(currcons, (c << 8) |
 					     (vcs_scr_readw(currcons, org) & 0xff), org);
 #endif
+#endif /* CONFIG_PC9800 */
 					org++;
 					p++;
 					if (++col == maxcol) {
@@ -416,7 +438,14 @@
 				unsigned short w;
 
 				w = get_unaligned(((const unsigned short *)con_buf0));
+#ifndef CONFIG_PC9800
 				vcs_scr_writew(currcons, w, org++);
+#else
+				vcs_scr_writew(currcons, w & 0xff, org);
+				vcs_scr_writew(currcons, w >> 8,
+					       pc9800_attr_offset (org));
+				org++;
+#endif
 				con_buf0 += 2;
 				this_round -= 2;
 				if (++col == maxcol) {
@@ -429,11 +458,15 @@
 				unsigned char c;
 
 				c = *con_buf0++;
+#ifdef CONFIG_PC9800
+				vcs_scr_writew(currcons, c, org);
+#else
 #ifdef __BIG_ENDIAN
 				vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff) | (c << 8), org);
 #else
 				vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff00) | c, org);
 #endif
+#endif
 			}
 		}
 		count -= orig_count;
drivers/char/vt.c +679 -11

1,168 lines not on this page · raw message

drivers/char/vt_ioctl.c +19 -0
diff -urN linux/drivers/char/vt_ioctl.c linux98/drivers/char/vt_ioctl.c
@@ -63,9 +63,11 @@
 asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
 #endif
 
+#ifndef CONFIG_PC9800
 unsigned int video_font_height;
 unsigned int default_font_height;
 unsigned int video_scan_lines;
+#endif
 
 /*
  * these are the valid i/o ports we're allowed to change. they map all the
@@ -637,6 +639,17 @@
 		return 0;
 	}
 
+#ifdef CONFIG_PC9800
+	case VT_GDC_RESIZE:
+	{
+		if (!perm)
+			return -EPERM; 
+/*		con_adjust_height(0);*/
+		update_screen(console);
+		return 0;
+	}
+#endif 
+
 	case VT_SETMODE:
 	{
 		struct vt_mode tmp;
@@ -828,7 +841,9 @@
 		__get_user(clin, &vtconsize->v_clin);
 		__get_user(vcol, &vtconsize->v_vcol);
 		__get_user(ccol, &vtconsize->v_ccol);
+#ifndef CONFIG_PC9800
 		vlin = vlin ? vlin : video_scan_lines;
+#endif
 		if ( clin )
 		  {
 		    if ( ll )
@@ -853,10 +868,12 @@
 		if ( clin > 32 )
 		  return -EINVAL;
 		    
+#ifndef CONFIG_PC9800		    
 		if ( vlin )
 		  video_scan_lines = vlin;
 		if ( clin )
 		  video_font_height = clin;
+#endif
 		
 		return vc_resize_all(ll, cc);
   	}
@@ -1024,8 +1041,10 @@
 	vt_cons[new_console]->vt_mode.frsig = 0;
 	vt_cons[new_console]->vt_pid = -1;
 	vt_cons[new_console]->vt_newvt = -1;
+#ifndef CONFIG_PC9800
 	if (!in_interrupt())    /* Via keyboard.c:SAK() - akpm */
 		reset_palette(new_console) ;
+#endif
 }
 
 /*
include/linux/console.h +3 -0
diff -urN linux/include/linux/console.h linux98/include/linux/console.h
@@ -48,6 +48,7 @@
 	void	(*con_invert_region)(struct vc_data *, u16 *, int);
 	u16    *(*con_screen_pos)(struct vc_data *, int);
 	unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *);
+	int	(*con_setterm_command)(struct vc_data *);
 };
 
 extern const struct consw *conswitchp;
@@ -55,8 +56,10 @@
 extern const struct consw dummy_con;	/* dummy console buffer */
 extern const struct consw fb_con;	/* frame buffer based console */
 extern const struct consw vga_con;	/* VGA text console */
+extern const struct consw gdc_con;	/* PC-9800 GDC text console */
 extern const struct consw newport_con;	/* SGI Newport console  */
 extern const struct consw prom_con;	/* SPARC PROM console */
+extern const struct consw fb_con_pc98;	/* frame buffer based console for PC-9800 */
 
 void take_over_console(const struct consw *sw, int first, int last, int deflt);
 void give_up_console(const struct consw *sw);
include/linux/console_struct.h +34 -0
diff -urN linux/include/linux/console_struct.h linux98/include/linux/console_struct.h
@@ -9,6 +9,8 @@
  * to achieve effects such as fast scrolling by changing the origin.
  */
 
+#include <linux/config.h>
+
 #define NPAR 16
 
 struct vc_data {
@@ -19,15 +21,28 @@
 	const struct consw *vc_sw;
 	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
 	unsigned int	vc_screenbuf_size;
+#if  defined(CONFIG_PC9800) && defined(CONFIG_FB)
+	unsigned short	vc_attr;		/* Current attributes */
+#else
 	unsigned char	vc_attr;		/* Current attributes */
+#endif
 	unsigned char	vc_def_color;		/* Default colors */
 	unsigned char	vc_color;		/* Foreground & background */
 	unsigned char	vc_s_color;		/* Saved foreground & background */
 	unsigned char	vc_ulcolor;		/* Color for underline mode */
 	unsigned char	vc_halfcolor;		/* Color for half intensity mode */
+#ifdef CONFIG_GDC_CONSOLE
+	unsigned char	vc_def_attr;	/* Default attributes */
+	unsigned char	vc_ul_attr;	/* Attribute for underline mode */
+	unsigned char	vc_half_attr;	/* Attribute for half intensity mode */
+	unsigned char	vc_bold_attr;	/* Attribute for bold mode */
+#endif
 	unsigned short	vc_complement_mask;	/* [#] Xor mask for mouse pointer */
 	unsigned short	vc_hi_font_mask;	/* [#] Attribute set for upper 256 chars of font or 0 if not supported */
 	unsigned short	vc_video_erase_char;	/* Background erase character */
+#ifdef CONFIG_PC9800
+	unsigned short	vc_video_erase_attr;	/* Background erase attribute */
+#endif
 	unsigned short	vc_s_complement_mask;	/* Saved mouse pointer mask */
 	unsigned int	vc_x, vc_y;		/* Cursor position */
 	unsigned int	vc_top, vc_bottom;	/* Scrolling region */
@@ -82,6 +97,21 @@
 	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
 	unsigned long	vc_uni_pagedir;
 	unsigned long	*vc_uni_pagedir_loc;  /* [!] Location of uni_pagedir variable for this console */
+#ifdef CONFIG_PC9800
+	unsigned char   vc_kanji_char1;
+	unsigned char   vc_kanji_mode;
+	unsigned char   vc_kanji_jis_mode;
+	unsigned char   vc_s_kanji_mode;
+	unsigned char   vc_s_kanji_jis_mode;
+	unsigned int    vc_translate_ex;
+	unsigned char   vc_G0_charset_ex;
+	unsigned char   vc_G1_charset_ex;
+	unsigned char   vc_saved_G0_ex;
+	unsigned char   vc_saved_G1_ex;
+# ifdef CONFIG_FB
+	unsigned short  vc_pc98_addbuf;
+# endif
+#endif /* CONFIG_PC9800 */
 	/* additional information is in vt_kern.h */
 };
 
@@ -105,6 +135,10 @@
 #define CUR_HWMASK	0x0f
 #define CUR_SWMASK	0xfff0
 
+#ifndef CONFIG_PC9800
 #define CUR_DEFAULT CUR_UNDERLINE
+#else
+#define CUR_DEFAULT CUR_BLOCK
+#endif
 
 #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
include/linux/consolemap.h +6 -0
diff -urN linux/include/linux/consolemap.h linux98/include/linux/consolemap.h
@@ -3,10 +3,16 @@
  *
  * Interface between console.c, selection.c  and consolemap.c
  */
+
+#include <linux/config.h>
+
 #define LAT1_MAP 0
 #define GRAF_MAP 1
 #define IBMPC_MAP 2
 #define USER_MAP 3
+#ifdef CONFIG_PC9800
+#define JP_MAP 4
+#endif
 
 struct vc_data;
 
include/linux/tty.h +8 -0
diff -urN linux/include/linux/tty.h linux98/include/linux/tty.h
@@ -5,6 +5,8 @@
  * 'tty.h' defines some structures used by tty_io.c and some defines.
  */
 
+#include <linux/config.h>
+
 /*
  * These constants are also useful for user-level apps (e.g., VC
  * resizing).
@@ -123,6 +125,12 @@
 
 #define VIDEO_TYPE_PMAC		0x60	/* PowerMacintosh frame buffer. */
 
+#ifdef CONFIG_PC9800
+#define VIDEO_TYPE_98NORMAL	0xa4	/* NEC PC-9800 normal */
+#define VIDEO_TYPE_9840		0xa5	/* NEC PC-9800 normal 40 lines */
+#define VIDEO_TYPE_98HIRESO	0xa6	/* NEC PC-9800 hireso */
+#endif
+
 /*
  * This character is the same as _POSIX_VDISABLE: it cannot be used as
  * a c_cc[] character, but indicates that a particular special character
include/linux/vt.h +5 -0
diff -urN linux/include/linux/vt.h linux98/include/linux/vt.h
@@ -1,6 +1,8 @@
 #ifndef _LINUX_VT_H
 #define _LINUX_VT_H
 
+#include <linux/config.h>
+
 /* 0x56 is 'V', to avoid collision with termios and kd */
 
 #define VT_OPENQRY	0x5600	/* find available vt */
@@ -50,5 +52,8 @@
 #define VT_RESIZEX      0x560A  /* set kernel's idea of screensize + more */
 #define VT_LOCKSWITCH   0x560B  /* disallow vt switching */
 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
+#ifdef CONFIG_PC9800
+#define VT_GDC_RESIZE	0x5698
+#endif
 
 #endif /* _LINUX_VT_H */
include/linux/vt_buffer.h +6 -0
diff -urN linux/include/linux/vt_buffer.h linux98/include/linux/vt_buffer.h
@@ -19,6 +19,12 @@
 #include <asm/vga.h>
 #endif
 
+#ifdef CONFIG_PC9800
+#ifdef CONFIG_GDC_CONSOLE
+#include <asm/gdc.h>
+#endif
+#endif
+
 #ifndef VT_BUF_HAVE_RW
 #define scr_writew(val, addr) (*(addr) = (val))
 #define scr_readw(addr) (*(addr))