PERFORCE change 75866 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat Apr 23 23:22:18 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=75866

Change 75866 by marcel at marcel_nfs on 2005/04/24 06:21:22

	Submit various changes I made over the time.

Affected files ...

.. //depot/projects/tty/sys/conf/files#20 edit
.. //depot/projects/tty/sys/conf/files.amd64#13 edit
.. //depot/projects/tty/sys/conf/files.i386#17 edit
.. //depot/projects/tty/sys/conf/files.ia64#15 edit
.. //depot/projects/tty/sys/conf/files.pc98#14 edit
.. //depot/projects/tty/sys/conf/files.powerpc#8 edit
.. //depot/projects/tty/sys/conf/files.sparc64#12 edit
.. //depot/projects/tty/sys/conf/options#17 edit
.. //depot/projects/tty/sys/conf/options.i386#12 edit
.. //depot/projects/tty/sys/conf/options.powerpc#6 edit
.. //depot/projects/tty/sys/conf/options.sparc64#5 edit
.. //depot/projects/tty/sys/dev/vga/vga.c#2 edit
.. //depot/projects/tty/sys/dev/vga/vga.h#3 edit
.. //depot/projects/tty/sys/dev/vga/vga_bus_isa.c#1 add
.. //depot/projects/tty/sys/dev/vga/vga_bus_pci.c#1 add
.. //depot/projects/tty/sys/dev/vga/vga_cons.c#5 edit
.. //depot/projects/tty/sys/dev/vga/vga_cpu_alpha.c#2 edit
.. //depot/projects/tty/sys/dev/vga/vga_cpu_amd64.c#1 add
.. //depot/projects/tty/sys/dev/vga/vga_cpu_i386.c#2 edit
.. //depot/projects/tty/sys/dev/vga/vga_cpu_ia64.c#2 edit
.. //depot/projects/tty/sys/dev/vga/vga_cpu_sparc64.c#1 add
.. //depot/projects/tty/sys/dev/vga/vga_isa.c#2 delete
.. //depot/projects/tty/sys/dev/vga/vga_pci.c#3 delete
.. //depot/projects/tty/sys/dev/vga/vga_vid.c#2 edit

Differences ...

==== //depot/projects/tty/sys/conf/files#20 (text+ko) ====

@@ -832,18 +832,6 @@
 dev/sx/sx_pci.c			optional sx pci
 dev/sym/sym_hipd.c		optional sym				\
 	dependency	"$S/dev/sym/sym_{conf,defs}.h"
-dev/syscons/blank/blank_saver.c	optional blank_saver
-dev/syscons/daemon/daemon_saver.c optional daemon_saver
-dev/syscons/dragon/dragon_saver.c optional dragon_saver
-dev/syscons/fade/fade_saver.c	optional fade_saver
-dev/syscons/fire/fire_saver.c	optional fire_saver
-dev/syscons/green/green_saver.c	optional green_saver
-dev/syscons/logo/logo.c		optional logo_saver
-dev/syscons/logo/logo_saver.c	optional logo_saver
-dev/syscons/rain/rain_saver.c	optional rain_saver
-dev/syscons/snake/snake_saver.c	optional snake_saver
-dev/syscons/star/star_saver.c	optional star_saver
-dev/syscons/warp/warp_saver.c	optional warp_saver
 dev/tdfx/tdfx_pci.c		optional tdfx pci
 dev/trm/trm.c			optional trm
 dev/twa/tw_cl_fwimg.c		optional twa
@@ -923,9 +911,9 @@
 dev/utopia/suni.c		optional utopia
 dev/utopia/utopia.c		optional utopia
 dev/vga/vga.c			optional vga
+dev/vga/vga_bus_isa.c		optional vga isa
+dev/vga/vga_bus_pci.c		optional vga pci
 dev/vga/vga_cons.c		optional vga
-dev/vga/vga_isa.c		optional vga
-dev/vga/vga_pci.c		optional vga
 dev/vge/if_vge.c		optional vge
 dev/vkbd/vkbd.c			optional vkbd
 dev/vtc/vtc_core.c		optional vtc

==== //depot/projects/tty/sys/conf/files.amd64#13 (text+ko) ====

@@ -32,11 +32,6 @@
 	no-obj no-implicit-rule before-depend				\
 	clean		"ia32_assym.h"
 #
-font.h				optional	sc_dflt_font		\
-	compile-with	"uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h"									\
-	no-obj no-implicit-rule before-depend				\
-	clean		"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
-#
 atkbdmap.h			optional	atkbd_dflt_keymap	\
 	compile-with	"/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h"			\
 	no-obj no-implicit-rule before-depend				\
@@ -151,6 +146,7 @@
 dev/sio/sio.c			optional	sio
 dev/sio/sio_isa.c		optional	sio isa
 dev/uart/uart_cpu_amd64.c	optional	uart
+dev/vga/vga_cpu_amd64.c		optional	vga
 geom/geom_bsd.c			standard
 geom/geom_bsd_enc.c		standard
 geom/geom_mbr.c			standard

==== //depot/projects/tty/sys/conf/files.i386#17 (text+ko) ====

@@ -154,10 +154,6 @@
 dev/ed/if_ed_wd80x3.c		optional ed isa
 dev/ed/if_ed_hpp.c		optional ed isa ed_hpp
 dev/ed/if_ed_sic.c		optional ed isa ed_sic
-dev/fb/fb.c			optional fb
-dev/fb/fb.c			optional vga
-dev/fb/splash.c			optional splash
-dev/fb/vga.c			optional vga
 dev/fdc/fdc.c			optional fdc
 dev/fdc/fdc_acpi.c		optional fdc
 dev/fdc/fdc_isa.c		optional fdc isa

==== //depot/projects/tty/sys/conf/files.ia64#15 (text+ko) ====

@@ -13,11 +13,6 @@
 	no-obj no-implicit-rule before-depend				\
 	clean		"atkbdmap.h"
 #
-font.h				optional	sc_dflt_font		\
-	compile-with	"uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h"									\
-	no-obj no-implicit-rule before-depend				\
-	clean		"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
-#
 ukbdmap.h			optional	ukbd_dflt_keymap	\
 	compile-with	"/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h"			\
 	no-obj no-implicit-rule before-depend				\

==== //depot/projects/tty/sys/conf/files.pc98#14 (text+ko) ====

@@ -112,14 +112,10 @@
 dev/ed/if_ed_wd80x3.c		optional ed isa
 dev/ep/if_ep_pccard.c		optional ep card
 dev/ex/if_ex_pccard.c		optional ex card
-dev/fb/fb.c			optional fb
-dev/fb/fb.c			optional gdc
-dev/fb/splash.c			optional splash
 dev/fe/if_fe_cbus.c		optional fe isa
 dev/fe/if_fe_pccard.c		optional fe card
 dev/io/iodev.c			optional io
 dev/kbd/kbd.c			optional pckbd
-dev/kbd/kbd.c			optional sc
 dev/kbd/kbd.c			optional ukbd
 dev/lnc/if_lnc_cbus.c		optional lnc isa
 dev/mem/memutil.c		optional mem
@@ -139,14 +135,6 @@
 dev/snc/if_snc_cbus.c		optional snc isa
 dev/snc/if_snc_pccard.c		optional snc card
 dev/stg/tmc18c30_pccard.c	optional stg card
-dev/syscons/apm/apm_saver.c	optional apm_saver apm
-dev/syscons/schistory.c		optional sc
-dev/syscons/scmouse.c		optional sc
-dev/syscons/scterm.c		optional sc
-dev/syscons/scterm-dumb.c	optional sc
-dev/syscons/scvidctl.c		optional sc
-dev/syscons/syscons.c		optional sc
-dev/syscons/sysmouse.c		optional sc
 dev/uart/uart_cpu_pc98.c	optional uart
 dev/wi/if_wi_pccard.c		optional wi card
 dev/xe/if_xe_pccard.c		optional xe card
@@ -364,12 +352,8 @@
 pc98/pc98/pc98kbd.c		optional pckbd
 pc98/pc98/pmc.c			optional pmc
 pc98/pc98/ppc.c			optional ppc
-pc98/pc98/scgdcrndr.c		optional sc gdc
-pc98/pc98/scterm-sck.c		optional sc
-pc98/pc98/scvtbpc98.c		optional sc
 pc98/pc98/sio.c			optional sio
 pc98/pc98/sio_cbus.c		optional sio isa
-pc98/pc98/syscons_pc98.c	optional sc
 pccard/pccard.c			optional card
 pccard/pccard_beep.c		optional card
 pccard/pccard_nbk.c		optional card

==== //depot/projects/tty/sys/conf/files.powerpc#8 (text+ko) ====

@@ -9,23 +9,6 @@
 #
 #
 
-font.h                          optional        sc            \
-        compile-with    "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
-	no-obj no-implicit-rule before-depend				\
-	clean	"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
-
-dev/fb/fb.c			optional	sc
-dev/kbd/kbd.c			optional	sc
-dev/syscons/scgfbrndr.c		optional	sc
-dev/syscons/schistory.c		optional	sc
-dev/syscons/scmouse.c		optional	sc
-dev/syscons/scterm.c		optional	sc
-dev/syscons/scterm-dumb.c	optional	sc
-dev/syscons/scterm-sc.c		optional	sc
-dev/syscons/scvidctl.c		optional	sc
-dev/syscons/scvtb.c		optional	sc
-dev/syscons/syscons.c		optional	sc
-dev/syscons/sysmouse.c		optional	sc
 geom/geom_apple.c		standard
 kern/syscalls.c			optional	ktr
 powerpc/powerpc/atomic.S	standard
@@ -50,7 +33,6 @@
 powerpc/powerpc/openpic.c	standard
 powerpc/powerpc/pic_if.m	standard
 powerpc/powerpc/pmap.c		standard
-powerpc/powerpc/sc_machdep.c	optional	sc
 powerpc/powerpc/setjmp.S	standard
 powerpc/powerpc/sigcode.S	standard
 powerpc/powerpc/suswintr.c	standard
@@ -95,7 +77,6 @@
 
 powerpc/ofw/ofw_pci.c		optional	pci
 powerpc/ofw/ofw_pcib_pci.c	optional	pci
-powerpc/ofw/ofw_syscons.c	optional	sc
 
 powerpc/powermac/ata_kauai.c	optional	powermac ata
 powerpc/powermac/ata_macio.c	optional	powermac ata

==== //depot/projects/tty/sys/conf/files.sparc64#12 (text+ko) ====

@@ -15,10 +15,6 @@
 dev/auxio/auxio.c		optional	auxio sbus
 dev/auxio/auxio.c		optional	auxio ebus
 dev/esp/esp_sbus.c		optional	esp sbus
-dev/fb/creator.c		optional	creator sc
-dev/fb/fb.c			optional	sc
-dev/fb/splash.c			optional	splash
-dev/kbd/kbd.c			optional	sc
 dev/ofw/ofw_bus_if.m		standard
 dev/ofw/ofw_console.c		optional	ofw_console
 dev/ofw/openfirm.c		standard
@@ -26,18 +22,9 @@
 dev/ofw/openpromio.c		standard
 dev/sound/sbus/cs4231.c		optional	snd_audiocs ebus
 dev/sound/sbus/cs4231.c		optional	snd_audiocs sbus
-dev/syscons/scgfbrndr.c		optional	sc
-dev/syscons/schistory.c		optional	sc
-dev/syscons/scmouse.c		optional	sc
-dev/syscons/scterm.c		optional	sc
-dev/syscons/scterm-dumb.c	optional	sc
-dev/syscons/scterm-sc.c		optional	sc
-dev/syscons/scvidctl.c		optional	sc
-dev/syscons/scvtb.c		optional	sc
-dev/syscons/syscons.c		optional	sc
-dev/syscons/sysmouse.c		optional	sc
 dev/uart/uart_cpu_sparc64.c	optional	uart
-dev/uart/uart_kbd_sun.c		optional	uart sc
+#dev/uart/uart_kbd_sun.c	optional	uart sc
+dev/vga/vga_cpu_sparc64.c	optional	vga
 geom/geom_bsd.c			standard
 geom/geom_bsd_enc.c		standard
 geom/geom_sunlabel.c		standard
@@ -48,7 +35,6 @@
 libkern/fls.c			standard
 libkern/flsl.c			standard
 sparc64/central/central.c	optional	central
-sparc64/creator/creator_upa.c	optional	creator sc
 sparc64/ebus/ebus.c		optional	ebus
 sparc64/fhc/clkbrd.c		optional	clkbrd fhc
 sparc64/fhc/fhc.c		optional	fhc
@@ -104,7 +90,6 @@
 sparc64/sparc64/rtc.c		optional	rtc ebus
 sparc64/sparc64/rtc.c		optional	rtc isa
 sparc64/sparc64/rwindow.c	standard
-sparc64/sparc64/sc_machdep.c	optional	sc
 sparc64/sparc64/spitfire.c	standard
 sparc64/sparc64/support.S	standard
 sparc64/sparc64/sys_machdep.c	standard

==== //depot/projects/tty/sys/conf/options#17 (text+ko) ====

@@ -470,10 +470,6 @@
 SI_DEBUG		opt_debug_si.h
 SX_DEBUG		opt_debug_sx.h
 
-# Fb options
-FB_DEBUG		opt_fb.h
-FB_INSTALL_CDEV		opt_fb.h
-
 # ppbus related options
 PERIPH_1284		opt_ppb_1284.h
 DONTPROBE_1284		opt_ppb_1284.h
@@ -640,30 +636,6 @@
 SAFE_NO_RNG		opt_safe.h
 SAFE_RNDTEST		opt_safe.h
 
-# syscons options
-MAXCONS			opt_syscons.h
-SC_ALT_MOUSE_IMAGE	opt_syscons.h
-SC_CUT_SPACES2TABS	opt_syscons.h
-SC_CUT_SEPCHARS		opt_syscons.h
-SC_DEBUG_LEVEL		opt_syscons.h
-SC_DFLT_FONT		opt_syscons.h
-SC_DISABLE_KDBKEY	opt_syscons.h
-SC_DISABLE_REBOOT	opt_syscons.h
-SC_HISTORY_SIZE		opt_syscons.h
-SC_KERNEL_CONS_ATTR	opt_syscons.h
-SC_KERNEL_CONS_REV_ATTR	opt_syscons.h
-SC_MOUSE_CHAR		opt_syscons.h
-SC_NO_CUTPASTE		opt_syscons.h
-SC_NO_FONT_LOADING	opt_syscons.h
-SC_NO_HISTORY		opt_syscons.h
-SC_NO_SUSPEND_VTYSWITCH	opt_syscons.h
-SC_NO_SYSMOUSE		opt_syscons.h
-SC_NORM_ATTR		opt_syscons.h
-SC_NORM_REV_ATTR	opt_syscons.h
-SC_PIXEL_MODE		opt_syscons.h
-SC_RENDER_DEBUG		opt_syscons.h
-SC_TWOBUTTON_MOUSE	opt_syscons.h
-
 # kbd options
 KBD_DISABLE_KEYMAP_LOAD	opt_kbd.h
 KBD_INSTALL_CDEV	opt_kbd.h

==== //depot/projects/tty/sys/conf/options.i386#12 (text+ko) ====

@@ -80,30 +80,6 @@
 
 ATKBD_DFLT_KEYMAP	opt_atkbd.h
 
-# pcvt(4) has a bunch of options
-FAT_CURSOR		opt_pcvt.h
-PCVT_123GENERIC		opt_pcvt.h
-PCVT_24LINESDEF		opt_pcvt.h
-PCVT_CTRL_ALT_DEL	opt_pcvt.h
-PCVT_GREENSAVER		opt_pcvt.h
-PCVT_INHIBIT_NUMLOCK	opt_pcvt.h
-PCVT_META_ESC		opt_pcvt.h
-PCVT_NO_LED_UPDATE	opt_pcvt.h
-PCVT_NSCREENS		opt_pcvt.h
-PCVT_NULLCHARS		opt_pcvt.h
-PCVT_PRETTYSCRNS	opt_pcvt.h
-PCVT_SCANSET		opt_pcvt.h
-PCVT_SCREENSAVER	opt_pcvt.h
-PCVT_SETCOLOR		opt_pcvt.h
-PCVT_SHOWKEYS		opt_pcvt.h
-PCVT_SLOW_INTERRUPT	opt_pcvt.h
-PCVT_SYSBEEPF		opt_pcvt.h
-PCVT_UPDATEFAST		opt_pcvt.h
-PCVT_UPDATESLOW		opt_pcvt.h
-PCVT_USEKBDSEC		opt_pcvt.h
-PCVT_VT220KEYB		opt_pcvt.h
-XSERVER			opt_pcvt.h
-
 # Video spigot
 SPIGOT_UNSECURE		opt_spigot.h
 

==== //depot/projects/tty/sys/conf/options.powerpc#6 (text+ko) ====

@@ -4,13 +4,7 @@
 OEA			opt_global.h
 IPKDB
 
-GFB_DEBUG		opt_gfb.h
-GFB_NO_FONT_LOADING	opt_gfb.h
-GFB_NO_MODE_CHANGE	opt_gfb.h
-
 POWERMAC		opt_platform.h
 PSIM
 
-SC_OFWFB		opt_ofwfb.h
-
 OFWCONS_POLL_HZ		opt_ofw.h

==== //depot/projects/tty/sys/conf/options.sparc64#5 (text+ko) ====

@@ -2,10 +2,6 @@
 
 SUN4U			opt_global.h
 
-GFB_DEBUG		opt_gfb.h
-GFB_NO_FONT_LOADING	opt_gfb.h
-GFB_NO_MODE_CHANGE	opt_gfb.h
-
 PSYCHO_DEBUG		opt_psycho.h
 DEBUGGER_ON_POWERFAIL	opt_psycho.h
 OFW_PCI_DEBUG		opt_ofw_pci.h

==== //depot/projects/tty/sys/dev/vga/vga.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <machine/bus.h>
@@ -39,11 +40,14 @@
 devclass_t vga_devclass;
 char vga_device_name[] = "vga";
 
+int vga_curcol;
+int vga_currow;
+
 static void
-vga_write(struct vga_softc *sc, int x, int y, int ascii, int color)
+vga_write(struct vga_softc *sc, int y, int x, int ascii, int color)
 {
-	u_int32_t ofs;
-	u_int16_t w;
+	uint32_t ofs;
+	uint16_t w;
 
 	ofs = y * 160 + x * 2;
 	w = color * 256 + ascii;
@@ -53,8 +57,8 @@
 static void
 vga_scrollup(struct vga_softc *sc)
 {
-	u_int32_t count, ofs;
-	u_int16_t w;
+	uint32_t count, ofs;
+	uint16_t w;
 
 	ofs = 0;
 
@@ -79,44 +83,73 @@
 }
 
 void
+vga_setpos(struct vga_softc *sc, int row, int col)
+{
+	uint16_t ofs;
+
+	ofs = row * 80 + col;
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 0, 14);
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 1, ofs >> 8);
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 0, 15);
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 1, ofs & 0xff);
+}
+
+void
+vga_getpos(struct vga_softc *sc, int *row, int *col)
+{
+	uint16_t ofs;
+
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 0, 14);
+	ofs = bus_space_read_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 1) << 8;
+	bus_space_write_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 0, 15);
+	ofs |= bus_space_read_1(sc->vga_crtc.bst, sc->vga_crtc.bsh, 1) & 0xff;
+	*row = ofs / 80;
+	*col = ofs % 80;
+}
+
+void
 vga_putc(struct vga_softc *sc, int c)
 {
-	static uint32_t x = 0, y = 24;
-	int d = 1;
+	int d;
 
+	d = 1;
 	switch (c) {
 	case 0x07:	/* bell */
 		return;
 	case 0x08:	/* backspace */
 		c = ' ';
-		if (x)
-			x--;
+		if (vga_curcol)
+			vga_curcol--;
 		d = 0;
 		break;
 	case 0x09:	/* tab */
-		x = (x + 8) & ~7;
-		if (x < 80)
+		vga_curcol = (vga_curcol + 8) & ~7;
+		if (vga_curcol < 80) {
+			vga_setpos(sc, vga_currow, vga_curcol);
 			return;
+		}
 		/* FALLTHOUGH */
 	case 0x0a:	/* linefeed */
-		if (y == 24)
+		if (vga_currow == 24)
 			vga_scrollup(sc);
 		else
-			y++;
+			vga_currow++;
 		/* FALLTHROUGH */
 	case 0x0d:	/* carriage return */
-		x = 0;
+		vga_curcol = 0;
+		vga_setpos(sc, vga_currow, vga_curcol);
 		return;
 	}
-	vga_write(sc, x, y, c, 0x0f);
-	x += d;
-	if (x == 80) {
-		x = 0;
-		if (y == 24)
+	vga_write(sc, vga_currow, vga_curcol, c, 0x0f);
+	vga_curcol += d;
+	if (vga_curcol >= 80) {
+		vga_curcol = 0;
+		if (vga_currow == 24)
 			vga_scrollup(sc);
 		else
-			y++;
+			vga_currow++;
 	}
+	vga_setpos(sc, vga_currow, vga_curcol);
 }
 
 void
@@ -127,11 +160,12 @@
 		vga_putc(sc, *s++);
 }
 
-int vga_attach(device_t dev)
+int
+vga_attach(device_t dev)
 {
 	struct vga_softc *sc;
 	int error;
-	u_int32_t x, y;
+	uint32_t x, y;
 
 	sc = device_get_softc(dev);
 
@@ -148,12 +182,10 @@
 
 	for (y = 0; y < 24; y++)
 		for (x = 0; x < 80; x++)
-			vga_write(sc, x, y, ' ', 7);
+			vga_write(sc, y, x, ' ', 7);
 
-	vga_write(sc, 0, 0, '\\', 7);
-	vga_write(sc, 79, 0, '/', 7);
-	vga_write(sc, 0, 24, '/', 7);
-	vga_write(sc, 79, 24, '\\', 7);
+	vga_currow = vga_curcol = 0;
+	vga_puts(sc, "Please wait...\r");
 
 	return (0);
 }

==== //depot/projects/tty/sys/dev/vga/vga.h#3 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,9 @@
  * $FreeBSD$
  */
 
+#ifndef _DEV_VGA_VGA_H_
+#define	_DEV_VGA_VGA_H_
+
 #define	VGA_REG_MISC		0x1c		/* 0x3CC */
 
 struct vga_space
@@ -41,12 +44,12 @@
 	dev_t			vga_node;
 
 	/* Device flags and state. */
-	u_int32_t		vga_bustype:2;
+	int			vga_bustype:2;
 #define	VGA_BUSTYPE_ISA		1
 #define	VGA_BUSTYPE_PCI		2
-	u_int32_t		vga_console:1;
-	u_int32_t		vga_enable:1;
-	u_int32_t		vga_mono:1;
+	int			vga_console:1;
+	int			vga_enable:1;
+	int			vga_mono:1;
 
 	/* Bus spaces */
 	struct vga_space	vga_space[4];
@@ -73,7 +76,14 @@
 extern devclass_t vga_devclass;
 extern char vga_device_name[];
 
+extern int vga_curcol;
+extern int vga_currow;
+
 int vga_attach(device_t);
 
+void vga_getpos(struct vga_softc *, int *, int *);
 void vga_putc(struct vga_softc *, int);
 void vga_puts(struct vga_softc *, const char *);
+void vga_setpos(struct vga_softc *, int, int);
+
+#endif /* _DEV_VGA_VGA_H_ */

==== //depot/projects/tty/sys/dev/vga/vga_cons.c#5 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -35,7 +36,6 @@
 #include <sys/tty.h>
 
 #include <dev/vga/vga.h>
-#include <dev/sio/siovar.h>
 
 #include <sys/cons.h>
 
@@ -59,6 +59,7 @@
 	bzero(&vga_console, sizeof(vga_console));
 
 	cp->cn_pri = CN_DEAD;
+	cp->cn_arg = &vga_console;
 
 	if (vga_get_console(&cd) != 0)
 		return;
@@ -79,39 +80,35 @@
 	if (error)
 		return;
 
-	vga_puts(&vga_console, "VGA probe successful\n");
-
 	cp->cn_pri = CN_INTERNAL;
 }
 
 static void
 vga_cninit(struct consdev *cp)
 {
+	struct vga_softc *sc = cp->cn_arg;
 
-	vga_console.vga_console = 1;
-	vga_console.vga_enable = 1;
+	sc->vga_console = 1;
+	sc->vga_enable = 1;
 
-	vga_puts(&vga_console, "VGA is the system console\n");
+	vga_getpos(sc, &vga_currow, &vga_curcol);
+	vga_putc(sc, '\n');
 
 	/* It's official... */
-	vga_console.vga_consdev = cp;
+	sc->vga_consdev = cp;
 }
 
 static void
 vga_cnterm(struct consdev *cp)
 {
-
-	/* XXX what to do here? */
 }
 
 static void
 vga_cnputc(struct consdev *cp, int c)
 {
-	int s;
+	struct vga_softc *sc = cp->cn_arg;
 
-	s = spltty();
-	vga_putc(&vga_console, c);
-	splx(s);
+	vga_putc(sc, c);
 }
 
 static int

==== //depot/projects/tty/sys/dev/vga/vga_cpu_alpha.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/bus.h>
 
@@ -33,10 +34,11 @@
 
 #include <dev/vga/vga.h>
 
-int vga_get_console(struct vga_consdata *cd)
+int
+vga_get_console(struct vga_consdata *cd)
 {
 	int mono;
-	u_char misc;
+	uint8_t misc;
 
 	cd->fb.bst = busspace_isa_mem;
 	cd->fb.bsh = 0xA0000;

==== //depot/projects/tty/sys/dev/vga/vga_cpu_i386.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/bus.h>
 
@@ -34,13 +35,14 @@
 
 #include <dev/vga/vga.h>
 
-int vga_get_console(struct vga_consdata *cd)
+int
+vga_get_console(struct vga_consdata *cd)
 {
 	int mono;
-	u_char misc;
+	uint8_t misc;
 
 	cd->fb.bst = I386_BUS_SPACE_MEM;
-	cd->fb.bsh = atdevbase;		/* Virtual address of 0xA0000 */
+	cd->fb.bsh = 0xA0000 + KERNBASE;
 	cd->reg.bst = I386_BUS_SPACE_IO;
 	cd->reg.bsh = 0x3c0;
 

==== //depot/projects/tty/sys/dev/vga/vga_cpu_ia64.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002, 2003, 2004 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/bus.h>
 
@@ -33,10 +34,11 @@
 
 #include <dev/vga/vga.h>
 
-int vga_get_console(struct vga_consdata *cd)
+int
+vga_get_console(struct vga_consdata *cd)
 {
 	int mono;
-	u_char misc;
+	uint8_t misc;
 
 	cd->fb.bst = IA64_BUS_SPACE_MEM;
 	cd->fb.bsh = IA64_PHYS_TO_RR6(0xA0000);		/* XXX */

==== //depot/projects/tty/sys/dev/vga/vga_vid.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2002 Marcel Moolenaar
+/*-
+ * Copyright (c) 2002-2005 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,11 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <machine/bus.h>
@@ -152,7 +153,7 @@
 	(void)bus_space_subregion(sc->vga_fb.bst, sc->vga_fb.bsh,
 	    (sc->vga_mono) ? 0x10000 : 0x18000, 4096, &sc->vga_screen.bsh);
 
-	sc->vga_console = 1;
+	sc->vga_enable = 1;
 	vga_adapter.va_flags |= V_ADP_PROBED;
 
  init_adapter:
@@ -310,17 +311,14 @@
 static int
 vga_vid_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
 {
-	int s;
 	uint16_t ofs;
 
-	s = spltty();
 	outb(adp->va_crtc_addr + 0, 14);
 	ofs = inb(adp->va_crtc_addr + 1) << 8;
 	outb(adp->va_crtc_addr + 0, 15);
 	ofs |= inb(adp->va_crtc_addr + 1) & 0xff;
 	*row = ofs / adp->va_info.vi_width;
 	*col = ofs % adp->va_info.vi_width;
-	splx(s);
 	return (0);
 }
 
@@ -352,40 +350,37 @@
 static int
 vga_vid_set_border(video_adapter_t *adp, int color)
 {
+	return (ENODEV);
+#if 0
 	static int called = 0;
 	return (vga_vid_todo(__func__, ++called));
+#endif
 }
 
 static int
 vga_vid_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
     int celsize, int blink)
 {
-	int s;
 
-	s = spltty();
 	outb(adp->va_crtc_addr + 0, 10);
 	outb(adp->va_crtc_addr + 1, (height > 0)
 	    ? (celsize - base - height) & 0x1f : 0x20);
 	outb(adp->va_crtc_addr + 0, 11);
 	outb(adp->va_crtc_addr + 1, (height > 0)
 	    ? (celsize - base - 1) & 0x1f : 0);
-	splx(s);
 	return (0);
 }
 
 static int
 vga_vid_set_hw_cursor(video_adapter_t *adp, int col, int row)
 {
-	int s;
 	uint16_t ofs;
 
-	s = spltty();
 	ofs = (col != -1 || row != -1) ? row*adp->va_info.vi_width + col : -1;
 	outb(adp->va_crtc_addr + 0, 14);
 	outb(adp->va_crtc_addr + 1, ofs >> 8);
 	outb(adp->va_crtc_addr + 0, 15);
 	outb(adp->va_crtc_addr + 1, ofs & 0xff);
-	splx(s);
 	return (0);
 }
 


More information about the p4-projects mailing list