Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Dec 2002 13:51:02 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22995 for review
Message-ID:  <200212312151.gBVLp21p087923@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22995

Change 22995 by marcel@marcel_nfs on 2002/12/31 13:50:48

	o  Mostly revert the ia64 hacks to the FB structures. We
	   really have to assume that the registers are I/O ports
	   if we want to use fb(4) and syscons(4). Allowing memory
	   mapped VGA registers in that context just makes it too
	   hard.
	o  Use inb and outb to access the registers in vga_vid.c
	   so that we don't have to worry about tags. Limit this
	   to vga_vid.c only. This file is specifically tied to
	   fb(4) and syscons(4).
	o  Hook-up VGA/ng to the i386 build.

Affected files ...

.. //depot/projects/ia64/sys/conf/files.i386#25 edit
.. //depot/projects/ia64/sys/dev/fb/fb.c#4 edit
.. //depot/projects/ia64/sys/dev/vga/vga_vid.c#5 edit
.. //depot/projects/ia64/sys/sys/fbio.h#4 edit

Differences ...

==== //depot/projects/ia64/sys/conf/files.i386#25 (text+ko) ====

@@ -116,9 +116,8 @@
 dev/ed/if_ed_isa.c		optional	ed isa
 dev/eisa/eisaconf.c		optional	eisa
 dev/fb/fb.c			optional	fb
-dev/fb/fb.c			optional	vga
+dev/fb/fb.c			optional	vga sc
 dev/fb/splash.c			optional	splash
-dev/fb/vga.c			optional	vga
 dev/fe/if_fe_isa.c		optional	fe isa
 dev/kbd/atkbd.c			optional	atkbd
 dev/kbd/atkbdc.c		optional	atkbdc
@@ -148,6 +147,10 @@
 dev/syscons/scvtb.c		optional	sc
 dev/syscons/syscons.c		optional	sc
 dev/syscons/sysmouse.c		optional	sc
+dev/vga/vga.c			optional	vga
+dev/vga/vga_isa.c		optional	vga isa
+dev/vga/vga_pci.c		optional	vga pci
+dev/vga/vga_vid.c		optional	vga sc
 geom/geom_bsd.c			standard
 geom/geom_mbr.c			standard
 gnu/i386/fpemul/div_small.s	optional	gpl_math_emulate \
@@ -232,6 +235,7 @@
 i386/i386/swtch.s		standard
 i386/i386/sys_machdep.c		standard
 i386/i386/trap.c		standard
+i386/i386/vga_machdep.c		optional	vga
 i386/i386/vm86.c		standard
 i386/i386/vm_machdep.c		standard
 i386/ibcs2/ibcs2_errno.c	optional	ibcs2
@@ -405,7 +409,6 @@
 isa/ppc.c			optional	ppc
 isa/psm.c			optional	psm
 isa/syscons_isa.c		optional	sc
-isa/vga_isa.c			optional	vga
 kern/imgact_aout.c		optional	compat_aout
 kern/imgact_gzip.c		optional	gzip
 kern/subr_diskmbr.c		standard

==== //depot/projects/ia64/sys/dev/fb/fb.c#4 (text+ko) ====

@@ -637,7 +637,6 @@
     printf("%s%d: %s%d, %s, type:%s (%d), flags:0x%x\n", 
 	   FB_DRIVER_NAME, adp->va_index, driver, adp->va_unit, adp->va_name,
 	   adapter_name(adp->va_type), adp->va_type, adp->va_flags);
-#if !defined(__ia64__)
     printf("%s%d: port:0x%lx-0x%lx, crtc:0x%lx, mem:0x%lx 0x%x\n",
 	   FB_DRIVER_NAME, adp->va_index, (u_long)adp->va_io_base,
 	   (u_long)adp->va_io_base + adp->va_io_size - 1,
@@ -651,7 +650,6 @@
 	   (void *)adp->va_window, (int)adp->va_window_size/1024,
 	   (int)adp->va_window_gran/1024, (void *)adp->va_buffer,
 	   (int)adp->va_buffer_size/1024);
-#endif
 }
 
 void
@@ -720,55 +718,42 @@
 		*(int *)arg = adp->va_type;
 		break;
 
-	case FBIO_ADPINFO:	/* get video adapter info */
-	        ((video_adapter_info_t *)arg)->va_index = adp->va_index;
-		((video_adapter_info_t *)arg)->va_type = adp->va_type;
-		bcopy(adp->va_name, ((video_adapter_info_t *)arg)->va_name,
-		      imin(strlen(adp->va_name) + 1,
-			   sizeof(((video_adapter_info_t *)arg)->va_name))); 
-		((video_adapter_info_t *)arg)->va_unit = adp->va_unit;
-		((video_adapter_info_t *)arg)->va_flags = adp->va_flags;
-#if !defined(__ia64__)
-		((video_adapter_info_t *)arg)->va_io_base = adp->va_io_base;
-		((video_adapter_info_t *)arg)->va_io_size = adp->va_io_size;
-		((video_adapter_info_t *)arg)->va_crtc_addr = adp->va_crtc_addr;
-		((video_adapter_info_t *)arg)->va_mem_base = adp->va_mem_base;
-		((video_adapter_info_t *)arg)->va_mem_size = adp->va_mem_size;
-		((video_adapter_info_t *)arg)->va_window
+	case FBIO_ADPINFO: {	/* get video adapter info */
+		video_adapter_info_t *vi = (void*)arg;
+
+	        vi->va_index = adp->va_index;
+		vi->va_type = adp->va_type;
+		bcopy(adp->va_name, vi->va_name, imin(strlen(adp->va_name) + 1,
+			  sizeof(vi->va_name))); 
+		vi->va_unit = adp->va_unit;
+		vi->va_flags = adp->va_flags;
+		vi->va_io_base = adp->va_io_base;
+		vi->va_io_size = adp->va_io_size;
+		vi->va_crtc_addr = adp->va_crtc_addr;
+		vi->va_mem_base = adp->va_mem_base;
+		vi->va_mem_size = adp->va_mem_size;
 #ifdef __i386__
-			= vtophys(adp->va_window);
+		vi->va_window = vtophys(adp->va_window);
 #else
-			= adp->va_window;
+		vi->va_window = adp->va_window;
 #endif
-		((video_adapter_info_t *)arg)->va_window_size
-			= adp->va_window_size;
-		((video_adapter_info_t *)arg)->va_window_gran
-			= adp->va_window_gran;
-		((video_adapter_info_t *)arg)->va_window_orig
-			= adp->va_window_orig;
-		((video_adapter_info_t *)arg)->va_unused0
+		vi->va_window_size = adp->va_window_size;
+		vi->va_window_gran = adp->va_window_gran;
+		vi->va_window_orig = adp->va_window_orig;
 #ifdef __i386__
-			= (adp->va_buffer) ? vtophys(adp->va_buffer) : 0;
+		vi->va_unused0 = (adp->va_buffer) ? vtophys(adp->va_buffer) : 0;
 #else
-			= adp->va_buffer;
+		vi->va_unused0 = adp->va_buffer;
 #endif
-		((video_adapter_info_t *)arg)->va_buffer_size
-			= adp->va_buffer_size;
-		((video_adapter_info_t *)arg)->va_mode = adp->va_mode;
-		((video_adapter_info_t *)arg)->va_initial_mode
-			= adp->va_initial_mode;
-		((video_adapter_info_t *)arg)->va_initial_bios_mode
-			= adp->va_initial_bios_mode;
-#endif
-		((video_adapter_info_t *)arg)->va_line_width
-			= adp->va_line_width;
-		((video_adapter_info_t *)arg)->va_disp_start.x
-			= adp->va_disp_start.x;
-		((video_adapter_info_t *)arg)->va_disp_start.y
-			= adp->va_disp_start.y;
+		vi->va_buffer_size = adp->va_buffer_size;
+		vi->va_mode = adp->va_mode;
+		vi->va_initial_mode = adp->va_initial_mode;
+		vi->va_initial_bios_mode = adp->va_initial_bios_mode;
+		vi->va_line_width = adp->va_line_width;
+		vi->va_disp_start.x = adp->va_disp_start.x;
+		vi->va_disp_start.y = adp->va_disp_start.y;
 		break;
-
-#if !defined(__ia64__)
+	}
 	case FBIO_MODEINFO:	/* get mode information */
 		error = (*vidsw[adp->va_index]->get_info)(adp,
 				((video_info_t *)arg)->vi_mode,
@@ -795,7 +780,6 @@
 	case FBIO_GETWINORG:	/* get frame buffer window origin */
 		*(u_int *)arg = adp->va_window_orig;
 		break;
-#endif
 
 	case FBIO_GETDISPSTART:	/* get display start address */
 		((video_display_start_t *)arg)->x = adp->va_disp_start.x;

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

@@ -26,13 +26,10 @@
  * $FreeBSD$
  */
 
-#include <machine/bus_memio.h>
-#include <machine/bus_pio.h>
+#include <sys/param.h>
+#include <sys/systm.h>
 #include <machine/bus.h>
 #include <machine/resource.h>
-
-#include <sys/param.h>
-#include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/fbio.h>
 #include <sys/kernel.h>
@@ -165,9 +162,8 @@
 	vga_adapter.va_flags |= (sc->vga_mono) ? 0 : V_ADP_COLOR;
 	vga_adapter.va_name = vga_device_name;
 	vga_adapter.va_type = KD_VGA;
-	vga_adapter.va_crtc_tag = sc->vga_crtc.bst;
-	vga_adapter.va_crtc_handle = sc->vga_crtc.bsh;
-	vga_adapter.va_window = sc->vga_screen.bsh; /* XXX */
+	vga_adapter.va_crtc_addr = sc->vga_crtc.bsh;
+	vga_adapter.va_window = sc->vga_screen.bsh;		/* XXX */
 
 	vga_adapter.va_info.vi_mode = 3;
 	vga_adapter.va_info.vi_flags = V_INFO_COLOR;
@@ -189,6 +185,10 @@
 
 	vid_register(&vga_adapter);
 	vga_adapter.va_flags |= V_ADP_REGISTERED;
+
+	/* Disable the hardware cursor. */
+	vga_vid_set_hw_cursor_shape(&vga_adapter, 0, 0, 0, 0);
+
 	return (1);
 }
 
@@ -309,23 +309,14 @@
 static int
 vga_vid_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
 {
-	bus_space_handle_t handle;
-	bus_space_tag_t tag;
 	int s;
 	uint16_t ofs;
 
-	handle = adp->va_crtc_handle;
-	tag = adp->va_crtc_tag;
-
 	s = spltty();
-	bus_space_write_1(tag, handle, 0, 14);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	ofs = bus_space_read_1(tag, handle, 1) << 8;
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 0, 15);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	ofs |= bus_space_read_1(tag, handle, 1) & 0xff;
-	bus_space_barrier(tag, handle, 0, 2, -1);
+	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);
@@ -368,24 +359,15 @@
 vga_vid_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
     int celsize, int blink)
 {
-	bus_space_handle_t handle;
-	bus_space_tag_t tag;
 	int s;
 
-	handle = adp->va_crtc_handle;
-	tag = adp->va_crtc_tag;
-
 	s = spltty();
-	bus_space_write_1(tag, handle, 0, 10);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 1, (height > 0)
+	outb(adp->va_crtc_addr + 0, 10);
+	outb(adp->va_crtc_addr + 1, (height > 0)
 	    ? (celsize - base - height) & 0x1f : 0x20);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 0, 11);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 1, (height > 0)
+	outb(adp->va_crtc_addr + 0, 11);
+	outb(adp->va_crtc_addr + 1, (height > 0)
 	    ? (celsize - base - 1) & 0x1f : 0);
-	bus_space_barrier(tag, handle, 0, 2, -1);
 	splx(s);
 	return (0);
 }
@@ -393,24 +375,15 @@
 static int
 vga_vid_set_hw_cursor(video_adapter_t *adp, int col, int row)
 {
-	bus_space_handle_t handle;
-	bus_space_tag_t tag;
 	int s;
 	uint16_t ofs;
 
-	handle = adp->va_crtc_handle;
-	tag = adp->va_crtc_tag;
-
 	s = spltty();
 	ofs = (col != -1 || row != -1) ? row*adp->va_info.vi_width + col : -1;
-	bus_space_write_1(tag, handle, 0, 14);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 1, ofs >> 8);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 0, 15);
-	bus_space_barrier(tag, handle, 0, 2, -1);
-	bus_space_write_1(tag, handle, 1, ofs & 0xff);
-	bus_space_barrier(tag, handle, 0, 2, -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);
 }

==== //depot/projects/ia64/sys/sys/fbio.h#4 (text+ko) ====

@@ -42,7 +42,6 @@
 #ifndef _SYS_FBIO_H_
 #define _SYS_FBIO_H_
 
-#include <machine/bus.h>
 #ifndef _KERNEL
 #include <sys/types.h>
 #endif
@@ -332,7 +331,6 @@
 #define V_ADP_INITIALIZED (1 << 17)
 #define V_ADP_REGISTERED (1 << 18)
 #define V_ADP_ATTACHED	(1 << 19)
-#if !defined(__ia64__)
     vm_offset_t		va_io_base;
     int			va_io_size;
     vm_offset_t		va_crtc_addr;
@@ -347,13 +345,6 @@
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
-#else
-    bus_space_tag_t	va_crtc_tag;
-    bus_space_handle_t	va_crtc_handle;
-    vm_offset_t		va_window;	/* virtual address */
-    size_t		va_window_size;
-    int			va_initial_mode;
-#endif
     struct video_info	va_info;
     int			va_line_width;
     struct {
@@ -378,7 +369,6 @@
     char		va_name[16];
     int			va_unit;
     int			va_flags;
-#if !defined(__ia64__)
     vm_offset_t		va_io_base;
     int			va_io_size;
     vm_offset_t		va_crtc_addr;
@@ -392,7 +382,6 @@
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
-#endif
     int			va_line_width;
     struct {
 	int		x;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212312151.gBVLp21p087923>