diff --git a/sys/arm/freescale/imx/imx51_ipuv3.c b/sys/arm/freescale/imx/imx51_ipuv3.c
index 520ace1a1b53..a29a562719d4 100644
--- a/sys/arm/freescale/imx/imx51_ipuv3.c
+++ b/sys/arm/freescale/imx/imx51_ipuv3.c
@@ -1,878 +1,876 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
  * Copyright (c) 2012, 2013 The FreeBSD Foundation
  * All rights reserved.
  *
  * Portions of this software were developed by Oleksandr Rybalko
  * under sponsorship from the FreeBSD Foundation.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY 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.
  *
  */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bio.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/endian.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 #include <sys/mutex.h>
 #include <sys/queue.h>
 #include <sys/resource.h>
 #include <sys/rman.h>
 #include <sys/time.h>
 #include <sys/timetc.h>
 #include <sys/fbio.h>
 #include <sys/consio.h>
 
 #include <sys/kdb.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
 
 #include <machine/bus.h>
 #include <machine/fdt.h>
 #include <machine/resource.h>
 #include <machine/intr.h>
 
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
 #include <dev/fb/fbreg.h>
 #include <dev/syscons/syscons.h>
 
 #include <arm/freescale/imx/imx51_ccmvar.h>
 
 #include <arm/freescale/imx/imx51_ipuv3reg.h>
 
 #define	IMX51_IPU_HSP_CLOCK	665000000
 #define	IPU3FB_FONT_HEIGHT	16
 
 struct ipu3sc_softc {
 	device_t		dev;
 	bus_addr_t		pbase;
 	bus_addr_t		vbase;
 
 	bus_space_tag_t		iot;
 	bus_space_handle_t	ioh;
 	bus_space_handle_t	cm_ioh;
 	bus_space_handle_t	dp_ioh;
 	bus_space_handle_t	di0_ioh;
 	bus_space_handle_t	di1_ioh;
 	bus_space_handle_t	dctmpl_ioh;
 	bus_space_handle_t	dc_ioh;
 	bus_space_handle_t	dmfc_ioh;
 	bus_space_handle_t	idmac_ioh;
 	bus_space_handle_t	cpmem_ioh;
 };
 
 struct video_adapter_softc {
 	/* Videoadpater part */
 	video_adapter_t	va;
 
 	intptr_t	fb_addr;
 	intptr_t	fb_paddr;
 	unsigned int	fb_size;
 
 	int		bpp;
 	int		depth;
 	unsigned int	height;
 	unsigned int	width;
 	unsigned int	stride;
 
 	unsigned int	xmargin;
 	unsigned int	ymargin;
 
 	unsigned char	*font;
 	int		initialized;
 };
 
 static struct ipu3sc_softc *ipu3sc_softc;
 static struct video_adapter_softc va_softc;
 
 /* FIXME: not only 2 bytes color supported */
 static uint16_t colors[16] = {
 	0x0000,	/* black */
 	0x001f,	/* blue */
 	0x07e0,	/* green */
 	0x07ff,	/* cyan */
 	0xf800,	/* red */
 	0xf81f,	/* magenta */
 	0x3800,	/* brown */
 	0xc618,	/* light grey */
 	0xc618,	/* XXX: dark grey */
 	0x001f,	/* XXX: light blue */
 	0x07e0,	/* XXX: light green */
 	0x07ff,	/* XXX: light cyan */
 	0xf800,	/* XXX: light red */
 	0xf81f,	/* XXX: light magenta */
 	0xffe0,	/* yellow */
 	0xffff,	/* white */
 };
 static uint32_t colors_24[16] = {
 	0x000000,/* Black	*/
 	0x000080,/* Blue	*/
 	0x008000,/* Green 	*/
 	0x008080,/* Cyan 	*/
 	0x800000,/* Red 	*/
 	0x800080,/* Magenta	*/
 	0xcc6600,/* brown	*/
 	0xC0C0C0,/* Silver 	*/
 	0x808080,/* Gray 	*/
 	0x0000FF,/* Light Blue 	*/
 	0x00FF00,/* Light Green */
 	0x00FFFF,/* Light Cyan 	*/
 	0xFF0000,/* Light Red 	*/
 	0xFF00FF,/* Light Magenta */
 	0xFFFF00,/* Yellow 	*/
 	0xFFFFFF,/* White 	*/
 
 };
 
 #define	IPUV3_READ(ipuv3, module, reg)					\
 	bus_space_read_4((ipuv3)->iot, (ipuv3)->module##_ioh, (reg))
 #define	IPUV3_WRITE(ipuv3, module, reg, val)				\
 	bus_space_write_4((ipuv3)->iot, (ipuv3)->module##_ioh, (reg), (val))
 
 #define	CPMEM_CHANNEL_OFFSET(_c)	((_c) * 0x40)
 #define	CPMEM_WORD_OFFSET(_w)		((_w) * 0x20)
 #define	CPMEM_DP_OFFSET(_d)		((_d) * 0x10000)
 #define	IMX_IPU_DP0		0
 #define	IMX_IPU_DP1		1
 #define	CPMEM_CHANNEL(_dp, _ch, _w)					\
 	    (CPMEM_DP_OFFSET(_dp) + CPMEM_CHANNEL_OFFSET(_ch) +		\
 		CPMEM_WORD_OFFSET(_w))
 #define	CPMEM_OFFSET(_dp, _ch, _w, _o)					\
 	    (CPMEM_CHANNEL((_dp), (_ch), (_w)) + (_o))
 
 #define	IPUV3_DEBUG 100
 
 #ifdef IPUV3_DEBUG
 #define	SUBMOD_DUMP_REG(_sc, _m, _l)					\
 	{								\
 		int i;							\
 		printf("*** " #_m " ***\n");				\
 		for (i = 0; i <= (_l); i += 4) {			\
 			if ((i % 32) == 0)				\
 				printf("%04x: ", i & 0xffff);		\
 			printf("0x%08x%c", IPUV3_READ((_sc), _m, i),	\
 			    ((i + 4) % 32)?' ':'\n');			\
 		}							\
 		printf("\n");						\
 	}
 #endif
 
 #ifdef IPUV3_DEBUG
 int ipuv3_debug = IPUV3_DEBUG;
 #define	DPRINTFN(n,x)   if (ipuv3_debug>(n)) printf x; else
 #else
 #define	DPRINTFN(n,x)
 #endif
 
 static int	ipu3_fb_probe(device_t);
 static int	ipu3_fb_attach(device_t);
 
 static int
 ipu3_fb_malloc(struct ipu3sc_softc *sc, size_t size)
 {
 
 	sc->vbase = (uint32_t)contigmalloc(size, M_DEVBUF, M_ZERO, 0, ~0,
 	    PAGE_SIZE, 0);
 	sc->pbase = vtophys(sc->vbase);
 
 	return (0);
 }
 
 static void
 ipu3_fb_init(void *arg)
 {
 	struct ipu3sc_softc *sc = arg;
 	struct video_adapter_softc *va_sc = &va_softc;
 	uint64_t w0sh96;
 	uint32_t w1sh96;
 
 	/* FW W0[137:125] - 96 = [41:29] */
 	/* FH W0[149:138] - 96 = [53:42] */
 	w0sh96 = IPUV3_READ(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 0, 16));
 	w0sh96 <<= 32;
 	w0sh96 |= IPUV3_READ(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 0, 12));
 
 	va_sc->width = ((w0sh96 >> 29) & 0x1fff) + 1;
 	va_sc->height = ((w0sh96 >> 42) & 0x0fff) + 1;
 
 	/* SLY W1[115:102] - 96 = [19:6] */
 	w1sh96 = IPUV3_READ(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 12));
 	va_sc->stride = ((w1sh96 >> 6) & 0x3fff) + 1;
 
 	printf("%dx%d [%d]\n", va_sc->width, va_sc->height, va_sc->stride);
 	va_sc->fb_size = va_sc->height * va_sc->stride;
 
 	ipu3_fb_malloc(sc, va_sc->fb_size);
 
 	/* DP1 + config_ch_23 + word_2 */
 	IPUV3_WRITE(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 0),
 	    ((sc->pbase >> 3) | ((sc->pbase >> 3) << 29)) & 0xffffffff);
 
 	IPUV3_WRITE(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 4),
 	    ((sc->pbase >> 3) >> 3) & 0xffffffff);
 
 	va_sc->fb_addr = (intptr_t)sc->vbase;
 	va_sc->fb_paddr = (intptr_t)sc->pbase;
 	va_sc->bpp = va_sc->stride / va_sc->width;
 	va_sc->depth = va_sc->bpp * 8;
 }
 
 static int
 ipu3_fb_probe(device_t dev)
 {
 	int error;
 
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
 
 	if (!ofw_bus_is_compatible(dev, "fsl,ipu3"))
 		return (ENXIO);
 
 	device_set_desc(dev, "i.MX5x Image Processing Unit v3 (FB)");
 
 	error = sc_probe_unit(device_get_unit(dev), 
 	    device_get_flags(dev) | SC_AUTODETECT_KBD);
 
 	if (error != 0)
 		return (error);
 
 	return (BUS_PROBE_DEFAULT);
 }
 
 static int
 ipu3_fb_attach(device_t dev)
 {
 	struct ipu3sc_softc *sc = device_get_softc(dev);
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
 	phandle_t node;
 	pcell_t reg;
 	int err;
 	uintptr_t base;
 
 	if (ipu3sc_softc)
 		return (ENXIO);
 
 	ipu3sc_softc = sc;
 
 	if (bootverbose)
 		device_printf(dev, "clock gate status is %d\n",
 		    imx51_get_clk_gating(IMX51CLK_IPU_HSP_CLK_ROOT));
 
 	sc->dev = dev;
 
 	err = (sc_attach_unit(device_get_unit(dev),
 	    device_get_flags(dev) | SC_AUTODETECT_KBD));
 
 	if (err) {
 		device_printf(dev, "failed to attach syscons\n");
 		goto fail;
 	}
 
 	sc = device_get_softc(dev);
 	sc->iot = iot = fdtbus_bs_tag;
 
 	/*
 	 * Retrieve the device address based on the start address in the
 	 * DTS.  The DTS for i.MX51 specifies 0x5e000000 as the first register
 	 * address, so we just subtract IPU_CM_BASE to get the offset at which
 	 * the IPU device was memory mapped.
 	 * On i.MX53, the offset is 0.
 	 */
 	node = ofw_bus_get_node(dev);
 	if ((OF_getencprop(node, "reg", &reg, sizeof(reg))) <= 0)
 		base = 0;
 	else
 		base = reg - IPU_CM_BASE(0);
 	/* map controller registers */
 	err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_cm;
 	sc->cm_ioh = ioh;
 
 	/* map Display Multi FIFO Controller registers */
 	err = bus_space_map(iot, IPU_DMFC_BASE(base), IPU_DMFC_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_dmfc;
 	sc->dmfc_ioh = ioh;
 
 	/* map Display Interface 0 registers */
 	err = bus_space_map(iot, IPU_DI0_BASE(base), IPU_DI0_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_di0;
 	sc->di0_ioh = ioh;
 
 	/* map Display Interface 1 registers */
 	err = bus_space_map(iot, IPU_DI1_BASE(base), IPU_DI0_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_di1;
 	sc->di1_ioh = ioh;
 
 	/* map Display Processor registers */
 	err = bus_space_map(iot, IPU_DP_BASE(base), IPU_DP_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_dp;
 	sc->dp_ioh = ioh;
 
 	/* map Display Controller registers */
 	err = bus_space_map(iot, IPU_DC_BASE(base), IPU_DC_SIZE, 0, &ioh);
 	if (err)
 		goto fail_retarn_dc;
 	sc->dc_ioh = ioh;
 
 	/* map Image DMA Controller registers */
 	err = bus_space_map(iot, IPU_IDMAC_BASE(base), IPU_IDMAC_SIZE, 0,
 	    &ioh);
 	if (err)
 		goto fail_retarn_idmac;
 	sc->idmac_ioh = ioh;
 
 	/* map CPMEM registers */
 	err = bus_space_map(iot, IPU_CPMEM_BASE(base), IPU_CPMEM_SIZE, 0,
 	    &ioh);
 	if (err)
 		goto fail_retarn_cpmem;
 	sc->cpmem_ioh = ioh;
 
 	/* map DCTEMPL registers */
 	err = bus_space_map(iot, IPU_DCTMPL_BASE(base), IPU_DCTMPL_SIZE, 0,
 	    &ioh);
 	if (err)
 		goto fail_retarn_dctmpl;
 	sc->dctmpl_ioh = ioh;
 
 #ifdef notyet
 	sc->ih = imx51_ipuv3_intr_establish(IMX51_INT_IPUV3, IPL_BIO,
 	    ipuv3intr, sc);
 	if (sc->ih == NULL) {
 		device_printf(sc->dev,
 		    "unable to establish interrupt at irq %d\n",
 		    IMX51_INT_IPUV3);
 		return (ENXIO);
 	}
 #endif
 
 	/*
 	 * We have to wait until interrupts are enabled. 
 	 * Mailbox relies on it to get data from VideoCore
 	 */
 	ipu3_fb_init(sc);
 
 	return (0);
 
 fail:
 	return (ENXIO);
 fail_retarn_dctmpl:
 	bus_space_unmap(sc->iot, sc->cpmem_ioh, IPU_CPMEM_SIZE);
 fail_retarn_cpmem:
 	bus_space_unmap(sc->iot, sc->idmac_ioh, IPU_IDMAC_SIZE);
 fail_retarn_idmac:
 	bus_space_unmap(sc->iot, sc->dc_ioh, IPU_DC_SIZE);
 fail_retarn_dp:
 	bus_space_unmap(sc->iot, sc->dp_ioh, IPU_DP_SIZE);
 fail_retarn_dc:
 	bus_space_unmap(sc->iot, sc->di1_ioh, IPU_DI1_SIZE);
 fail_retarn_di1:
 	bus_space_unmap(sc->iot, sc->di0_ioh, IPU_DI0_SIZE);
 fail_retarn_di0:
 	bus_space_unmap(sc->iot, sc->dmfc_ioh, IPU_DMFC_SIZE);
 fail_retarn_dmfc:
 	bus_space_unmap(sc->iot, sc->dc_ioh, IPU_CM_SIZE);
 fail_retarn_cm:
 	device_printf(sc->dev,
 	    "failed to map registers (errno=%d)\n", err);
 	return (err);
 }
 
 static device_method_t ipu3_fb_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		ipu3_fb_probe),
 	DEVMETHOD(device_attach,	ipu3_fb_attach),
 	{ 0, 0 }
 };
 
 static devclass_t ipu3_fb_devclass;
 
 static driver_t ipu3_fb_driver = {
 	"fb",
 	ipu3_fb_methods,
 	sizeof(struct ipu3sc_softc),
 };
 
 DRIVER_MODULE(ipu3fb, simplebus, ipu3_fb_driver, ipu3_fb_devclass, 0, 0);
 
 /*
  * Video driver routines and glue.
  */
 static int			ipu3fb_configure(int);
 static vi_probe_t		ipu3fb_probe;
 static vi_init_t		ipu3fb_init;
 static vi_get_info_t		ipu3fb_get_info;
 static vi_query_mode_t		ipu3fb_query_mode;
 static vi_set_mode_t		ipu3fb_set_mode;
 static vi_save_font_t		ipu3fb_save_font;
 static vi_load_font_t		ipu3fb_load_font;
 static vi_show_font_t		ipu3fb_show_font;
 static vi_save_palette_t	ipu3fb_save_palette;
 static vi_load_palette_t	ipu3fb_load_palette;
 static vi_set_border_t		ipu3fb_set_border;
 static vi_save_state_t		ipu3fb_save_state;
 static vi_load_state_t		ipu3fb_load_state;
 static vi_set_win_org_t		ipu3fb_set_win_org;
 static vi_read_hw_cursor_t	ipu3fb_read_hw_cursor;
 static vi_set_hw_cursor_t	ipu3fb_set_hw_cursor;
 static vi_set_hw_cursor_shape_t	ipu3fb_set_hw_cursor_shape;
 static vi_blank_display_t	ipu3fb_blank_display;
 static vi_mmap_t		ipu3fb_mmap;
 static vi_ioctl_t		ipu3fb_ioctl;
 static vi_clear_t		ipu3fb_clear;
 static vi_fill_rect_t		ipu3fb_fill_rect;
 static vi_bitblt_t		ipu3fb_bitblt;
 static vi_diag_t		ipu3fb_diag;
 static vi_save_cursor_palette_t	ipu3fb_save_cursor_palette;
 static vi_load_cursor_palette_t	ipu3fb_load_cursor_palette;
 static vi_copy_t		ipu3fb_copy;
 static vi_putp_t		ipu3fb_putp;
 static vi_putc_t		ipu3fb_putc;
 static vi_puts_t		ipu3fb_puts;
 static vi_putm_t		ipu3fb_putm;
 
 static video_switch_t ipu3fbvidsw = {
 	.probe			= ipu3fb_probe,
 	.init			= ipu3fb_init,
 	.get_info		= ipu3fb_get_info,
 	.query_mode		= ipu3fb_query_mode,
 	.set_mode		= ipu3fb_set_mode,
 	.save_font		= ipu3fb_save_font,
 	.load_font		= ipu3fb_load_font,
 	.show_font		= ipu3fb_show_font,
 	.save_palette		= ipu3fb_save_palette,
 	.load_palette		= ipu3fb_load_palette,
 	.set_border		= ipu3fb_set_border,
 	.save_state		= ipu3fb_save_state,
 	.load_state		= ipu3fb_load_state,
 	.set_win_org		= ipu3fb_set_win_org,
 	.read_hw_cursor		= ipu3fb_read_hw_cursor,
 	.set_hw_cursor		= ipu3fb_set_hw_cursor,
 	.set_hw_cursor_shape	= ipu3fb_set_hw_cursor_shape,
 	.blank_display		= ipu3fb_blank_display,
 	.mmap			= ipu3fb_mmap,
 	.ioctl			= ipu3fb_ioctl,
 	.clear			= ipu3fb_clear,
 	.fill_rect		= ipu3fb_fill_rect,
 	.bitblt			= ipu3fb_bitblt,
 	.diag			= ipu3fb_diag,
 	.save_cursor_palette	= ipu3fb_save_cursor_palette,
 	.load_cursor_palette	= ipu3fb_load_cursor_palette,
 	.copy			= ipu3fb_copy,
 	.putp			= ipu3fb_putp,
 	.putc			= ipu3fb_putc,
 	.puts			= ipu3fb_puts,
 	.putm			= ipu3fb_putm,
 };
 
 VIDEO_DRIVER(ipu3fb, ipu3fbvidsw, ipu3fb_configure);
 
 extern sc_rndr_sw_t txtrndrsw;
 RENDERER(ipu3fb, 0, txtrndrsw, gfb_set);
 RENDERER_MODULE(ipu3fb, gfb_set);
 
 static uint16_t ipu3fb_static_window[ROW*COL];
 extern u_char dflt_font_16[];
 
 static int
 ipu3fb_configure(int flags)
 {
 	struct video_adapter_softc *sc;
 
 	sc = &va_softc;
 
 	if (sc->initialized)
 		return 0;
 
 	sc->width = 640;
 	sc->height = 480;
 	sc->bpp = 2;
 	sc->stride = sc->width * sc->bpp;
 
 	ipu3fb_init(0, &sc->va, 0);
 
 	sc->initialized = 1;
 
 	return (0);
 }
 
 static int
 ipu3fb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_init(int unit, video_adapter_t *adp, int flags)
 {
 	struct video_adapter_softc *sc;
 	video_info_t *vi;
 
 	sc = (struct video_adapter_softc *)adp;
 	vi = &adp->va_info;
 
 	vid_init_struct(adp, "ipu3fb", -1, unit);
 
 	sc->font = dflt_font_16;
 	vi->vi_cheight = IPU3FB_FONT_HEIGHT;
 	vi->vi_cwidth = 8;
 	vi->vi_width = sc->width/8;
 	vi->vi_height = sc->height/vi->vi_cheight;
 
 	/*
 	 * Clamp width/height to syscons maximums
 	 */
 	if (vi->vi_width > COL)
 		vi->vi_width = COL;
 	if (vi->vi_height > ROW)
 		vi->vi_height = ROW;
 
 	sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
 	sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
 
 	adp->va_window = (vm_offset_t) ipu3fb_static_window;
 	adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */;
 	adp->va_line_width = sc->stride;
 	adp->va_buffer_size = sc->fb_size;
 
 	vid_register(&sc->va);
 
 	return (0);
 }
 
 static int
 ipu3fb_get_info(video_adapter_t *adp, int mode, video_info_t *info)
 {
 
 	bcopy(&adp->va_info, info, sizeof(*info));
 	return (0);
 }
 
 static int
 ipu3fb_query_mode(video_adapter_t *adp, video_info_t *info)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_set_mode(video_adapter_t *adp, int mode)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_save_font(video_adapter_t *adp, int page, int size, int width,
     u_char *data, int c, int count)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_load_font(video_adapter_t *adp, int page, int size, int width,
     u_char *data, int c, int count)
 {
 	struct video_adapter_softc *sc;
 
 	sc = (struct video_adapter_softc *)adp;
 	sc->font = data;
 
 	return (0);
 }
 
 static int
 ipu3fb_show_font(video_adapter_t *adp, int page)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_save_palette(video_adapter_t *adp, u_char *palette)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_load_palette(video_adapter_t *adp, u_char *palette)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_set_border(video_adapter_t *adp, int border)
 {
 
 	return (ipu3fb_blank_display(adp, border));
 }
 
 static int
 ipu3fb_save_state(video_adapter_t *adp, void *p, size_t size)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_load_state(video_adapter_t *adp, void *p)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_set_win_org(video_adapter_t *adp, off_t offset)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
 {
 
 	*col = *row = 0;
 	return (0);
 }
 
 static int
 ipu3fb_set_hw_cursor(video_adapter_t *adp, int col, int row)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
     int celsize, int blink)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_blank_display(video_adapter_t *adp, int mode)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
     int prot, vm_memattr_t *memattr)
 {
 	struct video_adapter_softc *sc;
 
 	sc = (struct video_adapter_softc *)adp;
 
 	/*
 	 * This might be a legacy VGA mem request: if so, just point it at the
 	 * framebuffer, since it shouldn't be touched
 	 */
 	if (offset < sc->stride * sc->height) {
 		*paddr = sc->fb_paddr + offset;
 		return (0);
 	}
 
 	return (EINVAL);
 }
 
 static int
 ipu3fb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data)
 {
 	struct video_adapter_softc *sc;
 	struct fbtype *fb;
 
 	sc = (struct video_adapter_softc *)adp;
 
 	switch (cmd) {
 	case FBIOGTYPE:
 		fb = (struct fbtype *)data;
 		fb->fb_type = FBTYPE_PCIMISC;
 		fb->fb_height = sc->height;
 		fb->fb_width = sc->width;
 		fb->fb_depth = sc->depth;
 		if (sc->depth <= 1 || sc->depth > 8)
 			fb->fb_cmsize = 0;
 		else
 			fb->fb_cmsize = 1 << sc->depth;
 		fb->fb_size = sc->fb_size;
 		break;
-	case FBIOSCURSOR:
-		return (ENODEV);
 	default:
 		return (fb_commonioctl(adp, cmd, data));
 	}
 
 	return (0);
 }
 
 static int
 ipu3fb_clear(video_adapter_t *adp)
 {
 
 	return (ipu3fb_blank_display(adp, 0));
 }
 
 static int
 ipu3fb_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_bitblt(video_adapter_t *adp, ...)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_diag(video_adapter_t *adp, int level)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_save_cursor_palette(video_adapter_t *adp, u_char *palette)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_load_cursor_palette(video_adapter_t *adp, u_char *palette)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p, uint32_t a,
     int size, int bpp, int bit_ltor, int byte_ltor)
 {
 
 	return (0);
 }
 
 static int
 ipu3fb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a)
 {
 	struct video_adapter_softc *sc;
 	int col, row, bpp;
 	int b, i, j, k;
 	uint8_t *addr;
 	u_char *p;
 	uint32_t fg, bg, color;
 
 	sc = (struct video_adapter_softc *)adp;
 	bpp = sc->bpp;
 
 	if (sc->fb_addr == 0)
 		return (0);
 	row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
 	col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
 	p = sc->font + c * IPU3FB_FONT_HEIGHT;
 	addr = (uint8_t *)sc->fb_addr
 	    + (row + sc->ymargin) * (sc->stride)
 	    + bpp * (col + sc->xmargin);
 
 	if (bpp == 2) {
 		bg = colors[(a >> 4) & 0x0f];
 		fg = colors[a & 0x0f];
 	} else if (bpp == 3) {
 		bg = colors_24[(a >> 4) & 0x0f];
 		fg = colors_24[a & 0x0f];
 	} else {
 		return (ENXIO);
 	}
 
 	for (i = 0; i < IPU3FB_FONT_HEIGHT; i++) {
 		for (j = 0, k = 7; j < 8; j++, k--) {
 			if ((p[i] & (1 << k)) == 0)
 				color = bg;
 			else
 				color = fg;
 			/* FIXME: BPP maybe different */
 			for (b = 0; b < bpp; b ++)
 				addr[bpp * j + b] =
 				    (color >> (b << 3)) & 0xff;
 		}
 
 		addr += (sc->stride);
 	}
 
         return (0);
 }
 
 static int
 ipu3fb_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len)
 {
 	int i;
 
 	for (i = 0; i < len; i++) 
 		ipu3fb_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8);
 
 	return (0);
 }
 
 static int
 ipu3fb_putm(video_adapter_t *adp, int x, int y, uint8_t *pixel_image,
     uint32_t pixel_mask, int size, int width)
 {
 
 	return (0);
 }
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c
index 8226c3317c6b..12423ad86f4f 100644
--- a/sys/dev/fb/fb.c
+++ b/sys/dev/fb/fb.c
@@ -1,756 +1,751 @@
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer as
  *    the first lines of this file unmodified.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  * 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.
  */
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
 #include "opt_fb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/bus.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 #include <sys/uio.h>
 #include <sys/fbio.h>
 #include <sys/linker_set.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
 
 #include <dev/fb/fbreg.h>
 
 SET_DECLARE(videodriver_set, const video_driver_t);
 
 /* local arrays */
 
 /*
  * We need at least one entry each in order to initialize a video card
  * for the kernel console.  The arrays will be increased dynamically
  * when necessary.
  */
 
 static int		vid_malloc;
 static int		adapters = 1;
 static video_adapter_t	*adp_ini;
 static video_adapter_t	**adapter = &adp_ini;
 static video_switch_t	*vidsw_ini;
        video_switch_t	**vidsw = &vidsw_ini;
 
 #ifdef FB_INSTALL_CDEV
 static struct cdevsw	*vidcdevsw_ini;
 static struct cdevsw	**vidcdevsw = &vidcdevsw_ini;
 #endif
 
 #define ARRAY_DELTA	4
 
 static int
 vid_realloc_array(void)
 {
 	video_adapter_t **new_adp;
 	video_switch_t **new_vidsw;
 #ifdef FB_INSTALL_CDEV
 	struct cdevsw **new_cdevsw;
 #endif
 	int newsize;
 	int s;
 
 	if (!vid_malloc)
 		return ENOMEM;
 
 	s = spltty();
 	newsize = rounddown(adapters + ARRAY_DELTA, ARRAY_DELTA);
 	new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO);
 	new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF,
 	    M_WAITOK | M_ZERO);
 #ifdef FB_INSTALL_CDEV
 	new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF,
 	    M_WAITOK | M_ZERO);
 #endif
 	bcopy(adapter, new_adp, sizeof(*adapter)*adapters);
 	bcopy(vidsw, new_vidsw, sizeof(*vidsw)*adapters);
 #ifdef FB_INSTALL_CDEV
 	bcopy(vidcdevsw, new_cdevsw, sizeof(*vidcdevsw)*adapters);
 #endif
 	if (adapters > 1) {
 		free(adapter, M_DEVBUF);
 		free(vidsw, M_DEVBUF);
 #ifdef FB_INSTALL_CDEV
 		free(vidcdevsw, M_DEVBUF);
 #endif
 	}
 	adapter = new_adp;
 	vidsw = new_vidsw;
 #ifdef FB_INSTALL_CDEV
 	vidcdevsw = new_cdevsw;
 #endif
 	adapters = newsize;
 	splx(s);
 
 	if (bootverbose)
 		printf("fb: new array size %d\n", adapters);
 
 	return 0;
 }
 
 static void
 vid_malloc_init(void *arg)
 {
 	vid_malloc = TRUE;
 }
 
 SYSINIT(vid_mem, SI_SUB_KMEM, SI_ORDER_ANY, vid_malloc_init, NULL);
 
 /*
  * Low-level frame buffer driver functions
  * frame buffer subdrivers, such as the VGA driver, call these functions
  * to initialize the video_adapter structure and register it to the virtual
  * frame buffer driver `fb'.
  */
 
 /* initialize the video_adapter_t structure */
 void
 vid_init_struct(video_adapter_t *adp, char *name, int type, int unit)
 {
 	adp->va_flags = 0;
 	adp->va_name = name;
 	adp->va_type = type;
 	adp->va_unit = unit;
 }
 
 /* Register a video adapter */
 int
 vid_register(video_adapter_t *adp)
 {
 	const video_driver_t **list;
 	const video_driver_t *p;
 	int index;
 
 	for (index = 0; index < adapters; ++index) {
 		if (adapter[index] == NULL)
 			break;
 	}
 	if (index >= adapters) {
 		if (vid_realloc_array())
 			return -1;
 	}
 
 	adp->va_index = index;
 	adp->va_token = NULL;
 	SET_FOREACH(list, videodriver_set) {
 		p = *list;
 		if (strcmp(p->name, adp->va_name) == 0) {
 			adapter[index] = adp;
 			vidsw[index] = p->vidsw;
 			return index;
 		}
 	}
 
 	return -1;
 }
 
 int
 vid_unregister(video_adapter_t *adp)
 {
 	if ((adp->va_index < 0) || (adp->va_index >= adapters))
 		return ENOENT;
 	if (adapter[adp->va_index] != adp)
 		return ENOENT;
 
 	adapter[adp->va_index] = NULL;
 	vidsw[adp->va_index] = NULL;
 	return 0;
 }
 
 /* Get video I/O function table */
 video_switch_t
 *vid_get_switch(char *name)
 {
 	const video_driver_t **list;
 	const video_driver_t *p;
 
 	SET_FOREACH(list, videodriver_set) {
 		p = *list;
 		if (strcmp(p->name, name) == 0)
 			return p->vidsw;
 	}
 
 	return NULL;
 }
 
 /*
  * Video card client functions
  * Video card clients, such as the console driver `syscons' and the frame
  * buffer cdev driver, use these functions to claim and release a card for
  * exclusive use.
  */
 
 /* find the video card specified by a driver name and a unit number */
 int
 vid_find_adapter(char *driver, int unit)
 {
 	int i;
 
 	for (i = 0; i < adapters; ++i) {
 		if (adapter[i] == NULL)
 			continue;
 		if (strcmp("*", driver) && strcmp(adapter[i]->va_name, driver))
 			continue;
 		if ((unit != -1) && (adapter[i]->va_unit != unit))
 			continue;
 		return i;
 	}
 	return -1;
 }
 
 /* allocate a video card */
 int
 vid_allocate(char *driver, int unit, void *id)
 {
 	int index;
 	int s;
 
 	s = spltty();
 	index = vid_find_adapter(driver, unit);
 	if (index >= 0) {
 		if (adapter[index]->va_token) {
 			splx(s);
 			return -1;
 		}
 		adapter[index]->va_token = id;
 	}
 	splx(s);
 	return index;
 }
 
 int
 vid_release(video_adapter_t *adp, void *id)
 {
 	int error;
 	int s;
 
 	s = spltty();
 	if (adp->va_token == NULL) {
 		error = EINVAL;
 	} else if (adp->va_token != id) {
 		error = EPERM;
 	} else {
 		adp->va_token = NULL;
 		error = 0;
 	}
 	splx(s);
 	return error;
 }
 
 /* Get a video adapter structure */
 video_adapter_t
 *vid_get_adapter(int index)
 {
 	if ((index < 0) || (index >= adapters))
 		return NULL;
 	return adapter[index];
 }
 
 /* Configure drivers: this is a backdoor for the console driver XXX */
 int
 vid_configure(int flags)
 {
 	const video_driver_t **list;
 	const video_driver_t *p;
 
 	SET_FOREACH(list, videodriver_set) {
 		p = *list;
 		if (p->configure != NULL)
 			(*p->configure)(flags);
 	}
 
 	return 0;
 }
 
 /*
  * Virtual frame buffer cdev driver functions
  * The virtual frame buffer driver dispatches driver functions to
  * appropriate subdrivers.
  */
 
 #define FB_DRIVER_NAME	"fb"
 
 #ifdef FB_INSTALL_CDEV
 
 #if 0 /* experimental */
 
 static devclass_t	fb_devclass;
 
 static int		fbprobe(device_t dev);
 static int		fbattach(device_t dev);
 
 static device_method_t fb_methods[] = {
 	DEVMETHOD(device_probe,		fbprobe),
 	DEVMETHOD(device_attach,	fbattach),
 
 	DEVMETHOD_END
 };
 
 static driver_t fb_driver = {
 	FB_DRIVER_NAME,
 	fb_methods,
 	0,
 };
 
 static int
 fbprobe(device_t dev)
 {
 	int unit;
 
 	unit = device_get_unit(dev);
 	if (unit >= adapters)
 		return ENXIO;
 	if (adapter[unit] == NULL)
 		return ENXIO;
 
 	device_set_desc(dev, "generic frame buffer");
 	return 0;
 }
 
 static int
 fbattach(device_t dev)
 {
 	printf("fbattach: about to attach children\n");
 	bus_generic_attach(dev);
 	return 0;
 }
 
 #endif
 
 #define FB_UNIT(dev)	dev2unit(dev)
 #define FB_MKMINOR(unit) (u)
 
 #if 0 /* experimental */
 static d_open_t		fbopen;
 static d_close_t	fbclose;
 static d_read_t		fbread;
 static d_write_t	fbwrite;
 static d_ioctl_t	fbioctl;
 static d_mmap_t		fbmmap;
 
 
 static struct cdevsw fb_cdevsw = {
 	.d_version =	D_VERSION,
 	.d_flags =	D_NEEDGIANT,
 	.d_open =	fbopen,
 	.d_close =	fbclose,
 	.d_read =	fbread,
 	.d_write =	fbwrite,
 	.d_ioctl =	fbioctl,
 	.d_mmap =	fbmmap,
 	.d_name =	FB_DRIVER_NAME,
 };
 #endif
 
 
 static int
 fb_modevent(module_t mod, int type, void *data) 
 { 
 
 	switch (type) { 
 	case MOD_LOAD: 
 		break; 
 	case MOD_UNLOAD: 
 		printf("fb module unload - not possible for this module type\n"); 
 		return EINVAL; 
 	default:
 		return EOPNOTSUPP;
 	} 
 	return 0; 
 } 
 
 static moduledata_t fb_mod = { 
 	"fb", 
 	fb_modevent, 
 	NULL
 }; 
 
 DECLARE_MODULE(fb, fb_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 
 int
 fb_attach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw)
 {
 	int s;
 
 	if (adp->va_index >= adapters)
 		return EINVAL;
 	if (adapter[adp->va_index] != adp)
 		return EINVAL;
 
 	s = spltty();
 	adp->va_minor = unit;
 	vidcdevsw[adp->va_index] = cdevsw;
 	splx(s);
 
 	printf("fb%d at %s%d\n", adp->va_index, adp->va_name, adp->va_unit);
 	return 0;
 }
 
 int
 fb_detach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw)
 {
 	int s;
 
 	if (adp->va_index >= adapters)
 		return EINVAL;
 	if (adapter[adp->va_index] != adp)
 		return EINVAL;
 	if (vidcdevsw[adp->va_index] != cdevsw)
 		return EINVAL;
 
 	s = spltty();
 	vidcdevsw[adp->va_index] = NULL;
 	splx(s);
 	return 0;
 }
 
 /*
  * Generic frame buffer cdev driver functions
  * Frame buffer subdrivers may call these functions to implement common
  * driver functions.
  */
 
 int genfbopen(genfb_softc_t *sc, video_adapter_t *adp, int flag, int mode,
 	      struct thread *td)
 {
 	int s;
 
 	s = spltty();
 	if (!(sc->gfb_flags & FB_OPEN))
 		sc->gfb_flags |= FB_OPEN;
 	splx(s);
 	return 0;
 }
 
 int genfbclose(genfb_softc_t *sc, video_adapter_t *adp, int flag, int mode,
 	       struct thread *td)
 {
 	int s;
 
 	s = spltty();
 	sc->gfb_flags &= ~FB_OPEN;
 	splx(s);
 	return 0;
 }
 
 int genfbread(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio,
 	      int flag)
 {
 	int size;
 	int offset;
 	int error;
 	int len;
 
 	error = 0;
 	size = adp->va_buffer_size/adp->va_info.vi_planes;
 	while (uio->uio_resid > 0) {
 		if (uio->uio_offset >= size)
 			break;
 		offset = uio->uio_offset%adp->va_window_size;
 		len = imin(uio->uio_resid, size - uio->uio_offset);
 		len = imin(len, adp->va_window_size - offset);
 		if (len <= 0)
 			break;
 		vidd_set_win_org(adp, uio->uio_offset);
 		error = uiomove((caddr_t)(adp->va_window + offset), len, uio);
 		if (error)
 			break;
 	}
 	return error;
 }
 
 int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio,
 	       int flag)
 {
 	return ENODEV;
 }
 
 int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd,
 	       caddr_t arg, int flag, struct thread *td)
 {
 	int error;
 
 	if (adp == NULL)	/* XXX */
 		return ENXIO;
 	error = vidd_ioctl(adp, cmd, arg);
 	if (error == ENOIOCTL)
 		error = ENODEV;
 	return error;
 }
 
 int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_ooffset_t offset,
 	      vm_paddr_t *paddr, int prot, vm_memattr_t *memattr)
 {
 	return vidd_mmap(adp, offset, paddr, prot, memattr);
 }
 
 #endif /* FB_INSTALL_CDEV */
 
 static char
 *adapter_name(int type)
 {
     static struct {
 	int type;
 	char *name;
     } names[] = {
 	{ KD_MONO,	"MDA" },
 	{ KD_HERCULES,	"Hercules" },
 	{ KD_CGA,	"CGA" },
 	{ KD_EGA,	"EGA" },
 	{ KD_VGA,	"VGA" },
 	{ KD_TGA,	"TGA" },
 	{ -1,		"Unknown" },
     };
     int i;
 
     for (i = 0; names[i].type != -1; ++i)
 	if (names[i].type == type)
 	    break;
     return names[i].name;
 }
 
 /*
  * Generic low-level frame buffer functions
  * The low-level functions in the frame buffer subdriver may use these
  * functions.
  */
 
 void
 fb_dump_adp_info(char *driver, video_adapter_t *adp, int level)
 {
     if (level <= 0)
 	return;
 
     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);
     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,
 	   (u_long)adp->va_crtc_addr, (u_long)adp->va_mem_base, 
 	   adp->va_mem_size);
     printf("%s%d: init mode:%d, bios mode:%d, current mode:%d\n",
 	   FB_DRIVER_NAME, adp->va_index,
 	   adp->va_initial_mode, adp->va_initial_bios_mode, adp->va_mode);
     printf("%s%d: window:%p size:%dk gran:%dk, buf:%p size:%dk\n",
 	   FB_DRIVER_NAME, adp->va_index, 
 	   (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);
 }
 
 void
 fb_dump_mode_info(char *driver, video_adapter_t *adp, video_info_t *info,
 		  int level)
 {
     if (level <= 0)
 	return;
 
     printf("%s%d: %s, mode:%d, flags:0x%x ", 
 	   driver, adp->va_unit, adp->va_name, info->vi_mode, info->vi_flags);
     if (info->vi_flags & V_INFO_GRAPHICS)
 	printf("G %dx%dx%d, %d plane(s), font:%dx%d, ",
 	       info->vi_width, info->vi_height, 
 	       info->vi_depth, info->vi_planes, 
 	       info->vi_cwidth, info->vi_cheight); 
     else
 	printf("T %dx%d, font:%dx%d, ",
 	       info->vi_width, info->vi_height, 
 	       info->vi_cwidth, info->vi_cheight); 
     printf("win:0x%lx\n", (u_long)info->vi_window);
 }
 
 int
 fb_type(int adp_type)
 {
 	static struct {
 		int	fb_type;
 		int	va_type;
 	} types[] = {
 		{ FBTYPE_MDA,		KD_MONO },
 		{ FBTYPE_HERCULES,	KD_HERCULES },
 		{ FBTYPE_CGA,		KD_CGA },
 		{ FBTYPE_EGA,		KD_EGA },
 		{ FBTYPE_VGA,		KD_VGA },
 		{ FBTYPE_TGA,		KD_TGA },
 	};
 	int i;
 
 	for (i = 0; i < nitems(types); ++i) {
 		if (types[i].va_type == adp_type)
 			return types[i].fb_type;
 	}
 	return -1;
 }
 
 int
 fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg)
 {
 	int error;
 	int s;
 
 	/* assert(adp != NULL) */
 
 	error = 0;
 	s = spltty();
 
 	switch (cmd) {
 
 	case FBIO_ADAPTER:	/* get video adapter index */
 		*(int *)arg = adp->va_index;
 		break;
 
 	case FBIO_ADPTYPE:	/* get video adapter type */
 		*(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;
 		((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
 #if defined(__amd64__) || defined(__i386__)
 			= vtophys(adp->va_window);
 #else
 			= 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
 #if defined(__amd64__) || defined(__i386__)
 			= adp->va_buffer != 0 ? vtophys(adp->va_buffer) : 0;
 #else
 			= 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;
 		((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;
 		break;
 
 	case FBIO_MODEINFO:	/* get mode information */
 		error = vidd_get_info(adp,
 		    ((video_info_t *)arg)->vi_mode,
 		    (video_info_t *)arg);
 		if (error)
 			error = ENODEV;
 		break;
 
 	case FBIO_FINDMODE:	/* find a matching video mode */
 		error = vidd_query_mode(adp, (video_info_t *)arg);
 		break;
 
 	case FBIO_GETMODE:	/* get video mode */
 		*(int *)arg = adp->va_mode;
 		break;
 
 	case FBIO_SETMODE:	/* set video mode */
 		error = vidd_set_mode(adp, *(int *)arg);
 		if (error)
 			error = ENODEV;	/* EINVAL? */
 		break;
 
 	case FBIO_GETWINORG:	/* get frame buffer window origin */
 		*(u_int *)arg = adp->va_window_orig;
 		break;
 
 	case FBIO_GETDISPSTART:	/* get display start address */
 		((video_display_start_t *)arg)->x = adp->va_disp_start.x;
 		((video_display_start_t *)arg)->y = adp->va_disp_start.y;
 		break;
 
 	case FBIO_GETLINEWIDTH:	/* get scan line width in bytes */
 		*(u_int *)arg = adp->va_line_width;
 		break;
 
 	case FBIO_BLANK:	/* blank display */
 		error = vidd_blank_display(adp, *(int *)arg);
 		break;
 
 	case FBIO_GETPALETTE:	/* get color palette */
 	case FBIO_SETPALETTE:	/* set color palette */
 		/* XXX */
 
 	case FBIOPUTCMAP:
 	case FBIOGETCMAP:
 	case FBIOPUTCMAPI:
 	case FBIOGETCMAPI:
 		/* XXX */
 
 	case FBIO_SETWINORG:	/* set frame buffer window origin */
 	case FBIO_SETDISPSTART:	/* set display start address */
 	case FBIO_SETLINEWIDTH:	/* set scan line width in pixel */
 
 	case FBIOGTYPE:
-	case FBIOSCURSOR:
-	case FBIOGCURSOR:
-	case FBIOSCURPOS:
-	case FBIOGCURPOS:
-	case FBIOGCURMAX:
 	case FBIOMONINFO:
 	case FBIOGXINFO:
 
 	default:
 		error = ENODEV;
 		break;
 	}
 
 	splx(s);
 	return error;
 }
diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c
index c5881545f435..7c2b395d975b 100644
--- a/sys/dev/syscons/scvidctl.c
+++ b/sys/dev/syscons/scvidctl.c
@@ -1,863 +1,858 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
  * All rights reserved.
  *
  * This code is derived from software contributed to The DragonFly Project
  * by Sascha Wildner <saw@online.de>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer as
  *    the first lines of this file unmodified.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  * 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.
  */
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
 #include "opt_syscons.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/signalvar.h>
 #include <sys/tty.h>
 #include <sys/kernel.h>
 #include <sys/fbio.h>
 #include <sys/consio.h>
 #include <sys/filedesc.h>
 #include <sys/lock.h>
 #include <sys/sx.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 
 #include <dev/fb/fbreg.h>
 #include <dev/syscons/syscons.h>
 
 SET_DECLARE(scrndr_set, const sc_renderer_t);
 
 /* for compatibility with previous versions */
 /* 3.0-RELEASE used the following structure */
 typedef struct old_video_adapter {
     int			va_index;
     int			va_type;
     int			va_flags;
 /* flag bits are the same as the -CURRENT
 #define V_ADP_COLOR	(1<<0)
 #define V_ADP_MODECHANGE (1<<1)
 #define V_ADP_STATESAVE	(1<<2)
 #define V_ADP_STATELOAD	(1<<3)
 #define V_ADP_FONT	(1<<4)
 #define V_ADP_PALETTE	(1<<5)
 #define V_ADP_BORDER	(1<<6)
 #define V_ADP_VESA	(1<<7)
 */
     int			va_crtc_addr;
     u_int		va_window;	/* virtual address */
     size_t		va_window_size;
     size_t		va_window_gran;
     u_int		va_buffer;	/* virtual address */
     size_t		va_buffer_size;
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
 } old_video_adapter_t;
 
 #define OLD_CONS_ADPINFO _IOWR('c', 101, old_video_adapter_t)
 
 /* 3.1-RELEASE used the following structure */
 typedef struct old_video_adapter_info {
     int			va_index;
     int			va_type;
     char		va_name[16];
     int			va_unit;
     int			va_flags;
     int			va_io_base;
     int			va_io_size;
     int			va_crtc_addr;
     int			va_mem_base;
     int			va_mem_size;
     u_int		va_window;	/* virtual address */
     size_t		va_window_size;
     size_t		va_window_gran;
     u_int		va_buffer;
     size_t		va_buffer_size;
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
     int			va_line_width;
 } old_video_adapter_info_t;
 
 #define OLD_CONS_ADPINFO2 _IOWR('c', 101, old_video_adapter_info_t)
 
 /* 3.0-RELEASE and 3.1-RELEASE used the following structure */
 typedef struct old_video_info {
     int			vi_mode;
     int			vi_flags;
 /* flag bits are the same as the -CURRENT
 #define V_INFO_COLOR	(1<<0)
 #define V_INFO_GRAPHICS	(1<<1)
 #define V_INFO_LINEAR	(1<<2)
 #define V_INFO_VESA	(1<<3)
 */
     int			vi_width;
     int			vi_height;
     int			vi_cwidth;
     int			vi_cheight;
     int			vi_depth;
     int			vi_planes;
     u_int		vi_window;	/* physical address */
     size_t		vi_window_size;
     size_t		vi_window_gran;
     u_int		vi_buffer;	/* physical address */
     size_t		vi_buffer_size;
 } old_video_info_t;
 
 #define OLD_CONS_MODEINFO _IOWR('c', 102, old_video_info_t)
 #define OLD_CONS_FINDMODE _IOWR('c', 103, old_video_info_t)
 
 int
 sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
 		 int fontsize, int fontwidth)
 {
     video_info_t info;
     struct winsize wsz;
     u_char *font;
     int prev_ysize;
     int error;
     int s;
 
     if (vidd_get_info(scp->sc->adp, mode, &info))
 	return ENODEV;
 
     /* adjust argument values */
     if (fontwidth <= 0)
 	fontwidth = info.vi_cwidth;
     if (fontsize <= 0)
 	fontsize = info.vi_cheight;
     if (fontsize < 14)
 	fontsize = 8;
     else if (fontsize >= 16)
 	fontsize = 16;
     else
 	fontsize = 14;
 #ifndef SC_NO_FONT_LOADING
     switch (fontsize) {
     case 8:
 	if ((scp->sc->fonts_loaded & FONT_8) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_8;
 	break;
     case 14:
 	if ((scp->sc->fonts_loaded & FONT_14) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_14;
 	break;
     case 16:
 	if ((scp->sc->fonts_loaded & FONT_16) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_16;
 	break;
     }
 #else
     font = NULL;
 #endif
     if ((xsize <= 0) || (xsize > info.vi_width))
 	xsize = info.vi_width;
     if ((ysize <= 0) || (ysize > info.vi_height))
 	ysize = info.vi_height;
 
     /* stop screen saver, etc */
     s = spltty();
     if ((error = sc_clean_up(scp))) {
 	splx(s);
 	return error;
     }
 
     if (sc_render_match(scp, scp->sc->adp->va_name, 0) == NULL) {
 	splx(s);
 	return ENODEV;
     }
 
     /* set up scp */
 #ifndef SC_NO_HISTORY
     if (scp->history != NULL)
 	sc_hist_save(scp);
 #endif
     prev_ysize = scp->ysize;
     /*
      * This is a kludge to fend off scrn_update() while we
      * muck around with scp. XXX
      */
     scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
     scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE | MOUSE_VISIBLE);
     scp->mode = mode;
     scp->xsize = xsize;
     scp->ysize = ysize;
     scp->xoff = 0;
     scp->yoff = 0;
     scp->xpixel = scp->xsize*8;
     scp->ypixel = scp->ysize*fontsize;
     scp->font = font;
     scp->font_size = fontsize;
     scp->font_width = fontwidth;
 
     /* allocate buffers */
     sc_alloc_scr_buffer(scp, TRUE, TRUE);
     sc_init_emulator(scp, NULL);
 #ifndef SC_NO_CUTPASTE
     sc_alloc_cut_buffer(scp, FALSE);
 #endif
 #ifndef SC_NO_HISTORY
     sc_alloc_history_buffer(scp, 0, prev_ysize, FALSE);
 #endif
     splx(s);
 
     if (scp == scp->sc->cur_scp)
 	set_mode(scp);
     scp->status &= ~UNKNOWN_MODE;
 
     if (tp == NULL)
 	return 0;
     wsz.ws_col = scp->xsize;
     wsz.ws_row = scp->ysize;
     tty_set_winsize(tp, &wsz);
     return 0;
 }
 
 int
 sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
 {
 #ifdef SC_NO_MODE_CHANGE
     return ENODEV;
 #else
     video_info_t info;
     struct winsize wsz;
     int error;
     int s;
 
     if (vidd_get_info(scp->sc->adp, mode, &info))
 	return ENODEV;
 
     /* stop screen saver, etc */
     s = spltty();
     if ((error = sc_clean_up(scp))) {
 	splx(s);
 	return error;
     }
 
     if (sc_render_match(scp, scp->sc->adp->va_name, GRAPHICS_MODE) == NULL) {
 	splx(s);
 	return ENODEV;
     }
 
     /* set up scp */
     scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE | MOUSE_HIDDEN);
     scp->status &= ~(PIXEL_MODE | MOUSE_VISIBLE);
     scp->mode = mode;
     /*
      * Don't change xsize and ysize; preserve the previous vty
      * and history buffers.
      */
     scp->xoff = 0;
     scp->yoff = 0;
     scp->xpixel = info.vi_width;
     scp->ypixel = info.vi_height;
     scp->font = NULL;
     scp->font_size = 0;
 #ifndef SC_NO_SYSMOUSE
     /* move the mouse cursor at the center of the screen */
     sc_mouse_move(scp, scp->xpixel / 2, scp->ypixel / 2);
 #endif
     sc_init_emulator(scp, NULL);
     splx(s);
 
     if (scp == scp->sc->cur_scp)
 	set_mode(scp);
     /* clear_graphics();*/
     scp->status &= ~UNKNOWN_MODE;
 
     if (tp == NULL)
 	return 0;
     wsz.ws_col = scp->xsize;
     wsz.ws_row = scp->ysize;
     tty_set_winsize(tp, &wsz);
     return 0;
 #endif /* SC_NO_MODE_CHANGE */
 }
 
 int
 sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, 
 		  int fontsize, int fontwidth)
 {
 #ifndef SC_PIXEL_MODE
     return ENODEV;
 #else
     video_info_t info;
     struct winsize wsz;
     u_char *font;
     int prev_ysize;
     int error;
     int s;
 
     if (vidd_get_info(scp->sc->adp, scp->mode, &info))
 	return ENODEV;		/* this shouldn't happen */
 
     /* adjust argument values */
     if (fontsize <= 0)
 	fontsize = info.vi_cheight;
     if (fontsize < 14)
 	fontsize = 8;
     else if (fontsize >= 16)
 	fontsize = 16;
     else
 	fontsize = 14;
 #ifndef SC_NO_FONT_LOADING
     switch (fontsize) {
     case 8:
 	if ((scp->sc->fonts_loaded & FONT_8) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_8;
 	break;
     case 14:
 	if ((scp->sc->fonts_loaded & FONT_14) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_14;
 	break;
     case 16:
 	if ((scp->sc->fonts_loaded & FONT_16) == 0)
 	    return (EINVAL);
 	font = scp->sc->font_16;
 	break;
     }
 #else
     font = NULL;
 #endif
     if (xsize <= 0)
 	xsize = info.vi_width/8;
     if (ysize <= 0)
 	ysize = info.vi_height/fontsize;
 
     if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize))
 	return EINVAL;
 
     if (!sc_support_pixel_mode(&info))
 	return ENODEV;
 
     /* stop screen saver, etc */
     s = spltty();
     if ((error = sc_clean_up(scp))) {
 	splx(s);
 	return error;
     }
 
     if (sc_render_match(scp, scp->sc->adp->va_name, PIXEL_MODE) == NULL) {
 	splx(s);
 	return ENODEV;
     }
 
 #if 0
     if (scp->tsw)
 	(*scp->tsw->te_term)(scp, scp->ts);
     scp->tsw = NULL;
     scp->ts = NULL;
 #endif
 
     /* set up scp */
 #ifndef SC_NO_HISTORY
     if (scp->history != NULL)
 	sc_hist_save(scp);
 #endif
     prev_ysize = scp->ysize;
     scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
     scp->status &= ~(GRAPHICS_MODE | MOUSE_VISIBLE);
     scp->xsize = xsize;
     scp->ysize = ysize;
     scp->xoff = (scp->xpixel/8 - xsize)/2;
     scp->yoff = (scp->ypixel/fontsize - ysize)/2;
     scp->font = font;
     scp->font_size = fontsize;
     scp->font_width = fontwidth;
 
     /* allocate buffers */
     sc_alloc_scr_buffer(scp, TRUE, TRUE);
     sc_init_emulator(scp, NULL);
 #ifndef SC_NO_CUTPASTE
     sc_alloc_cut_buffer(scp, FALSE);
 #endif
 #ifndef SC_NO_HISTORY
     sc_alloc_history_buffer(scp, 0, prev_ysize, FALSE);
 #endif
     splx(s);
 
     if (scp == scp->sc->cur_scp) {
 	sc_set_border(scp, scp->border);
 	sc_set_cursor_image(scp);
     }
 
     scp->status &= ~UNKNOWN_MODE;
 
     if (tp == NULL)
 	return 0;
     wsz.ws_col = scp->xsize;
     wsz.ws_row = scp->ysize;
     tty_set_winsize(tp, &wsz);
     return 0;
 #endif /* SC_PIXEL_MODE */
 }
 
 int
 sc_support_pixel_mode(void *arg)
 {
 #ifdef SC_PIXEL_MODE
 	video_info_t *info = arg;
 
 	if ((info->vi_flags & V_INFO_GRAPHICS) == 0)
 		return (0);
 
 	/*
 	 * We currently support the following graphic modes:
 	 *
 	 * - 4 bpp planar modes whose memory size does not exceed 64K
 	 * - 15, 16, 24 and 32 bpp linear modes
 	 */
 	switch (info->vi_mem_model) {
 	case V_INFO_MM_PLANAR:
 		if (info->vi_planes != 4)
 			break;
 		/*
 		 * A memory size >64K requires bank switching to access
 		 * the entire screen. XXX
 		 */
 		if (info->vi_width * info->vi_height / 8 > info->vi_window_size)
 			break;
 		return (1);
 	case V_INFO_MM_DIRECT:
 		if ((info->vi_flags & V_INFO_LINEAR) == 0 &&
 		    info->vi_depth != 15 && info->vi_depth != 16 &&
 		    info->vi_depth != 24 && info->vi_depth != 32)
 			break;
 		return (1);
 	case V_INFO_MM_PACKED:
 		if ((info->vi_flags & V_INFO_LINEAR) == 0 &&
 		    info->vi_depth != 8)
 			break;
 		return (1);
 	}
 #endif
 	return (0);
 }
 
 #define fb_ioctl(a, c, d)		\
 	(((a) == NULL) ? ENODEV : 	\
 			 vidd_ioctl((a), (c), (caddr_t)(d)))
 
 int
 sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
 {
     scr_stat *scp;
     video_adapter_t *adp;
     video_info_t info;
     video_adapter_info_t adp_info;
     int error;
     int s;
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
     defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
     int ival;
 #endif
 
     scp = SC_STAT(tp);
     if (scp == NULL)		/* tp == SC_MOUSE */
 	return ENOIOCTL;
     adp = scp->sc->adp;
     if (adp == NULL)		/* shouldn't happen??? */
 	return ENODEV;
 
     switch (cmd) {
     case CONS_CURRENTADP:	/* get current adapter index */
     case FBIO_ADAPTER:
 	return fb_ioctl(adp, FBIO_ADAPTER, data);
 
     case CONS_CURRENT:  	/* get current adapter type */
     case FBIO_ADPTYPE:
 	return fb_ioctl(adp, FBIO_ADPTYPE, data);
 
     case OLD_CONS_ADPINFO:	/* adapter information (old interface) */
 	if (((old_video_adapter_t *)data)->va_index >= 0) {
 	    adp = vid_get_adapter(((old_video_adapter_t *)data)->va_index);
 	    if (adp == NULL)
 		return ENODEV;
 	}
 	((old_video_adapter_t *)data)->va_index = adp->va_index;
 	((old_video_adapter_t *)data)->va_type = adp->va_type;
 	((old_video_adapter_t *)data)->va_flags = adp->va_flags;
 	((old_video_adapter_t *)data)->va_crtc_addr = adp->va_crtc_addr;
 	((old_video_adapter_t *)data)->va_window = adp->va_window;
 	((old_video_adapter_t *)data)->va_window_size = adp->va_window_size;
 	((old_video_adapter_t *)data)->va_window_gran = adp->va_window_gran;
 	((old_video_adapter_t *)data)->va_buffer = adp->va_buffer;
 	((old_video_adapter_t *)data)->va_buffer_size = adp->va_buffer_size;
 	((old_video_adapter_t *)data)->va_mode = adp->va_mode;
 	((old_video_adapter_t *)data)->va_initial_mode = adp->va_initial_mode;
 	((old_video_adapter_t *)data)->va_initial_bios_mode
 	    = adp->va_initial_bios_mode;
 	return 0;
 
     case OLD_CONS_ADPINFO2:	/* adapter information (yet another old I/F) */
 	adp_info.va_index = ((old_video_adapter_info_t *)data)->va_index;
 	if (adp_info.va_index >= 0) {
 	    adp = vid_get_adapter(adp_info.va_index);
 	    if (adp == NULL)
 		return ENODEV;
 	}
 	error = fb_ioctl(adp, FBIO_ADPINFO, &adp_info);
 	if (error == 0)
 	    bcopy(&adp_info, data, sizeof(old_video_adapter_info_t));
 	return error;
 
     case CONS_ADPINFO:		/* adapter information */
     case FBIO_ADPINFO:
 	if (((video_adapter_info_t *)data)->va_index >= 0) {
 	    adp = vid_get_adapter(((video_adapter_info_t *)data)->va_index);
 	    if (adp == NULL)
 		return ENODEV;
 	}
 	return fb_ioctl(adp, FBIO_ADPINFO, data);
 
     case CONS_GET:      	/* get current video mode */
     case FBIO_GETMODE:
 	*(int *)data = scp->mode;
 	return 0;
 
 #ifndef SC_NO_MODE_CHANGE
     case FBIO_SETMODE:		/* set video mode */
 	if (!(adp->va_flags & V_ADP_MODECHANGE))
  	    return ENODEV;
 	info.vi_mode = *(int *)data;
 	error = fb_ioctl(adp, FBIO_MODEINFO, &info);
 	if (error)
 	    return error;
 	if (info.vi_flags & V_INFO_GRAPHICS)
 	    return sc_set_graphics_mode(scp, tp, *(int *)data);
 	else
 	    return sc_set_text_mode(scp, tp, *(int *)data, 0, 0, 0, 0);
 #endif /* SC_NO_MODE_CHANGE */
 
     case OLD_CONS_MODEINFO:	/* get mode information (old infterface) */
 	info.vi_mode = ((old_video_info_t *)data)->vi_mode;
 	error = fb_ioctl(adp, FBIO_MODEINFO, &info);
 	if (error == 0)
 	    bcopy(&info, (old_video_info_t *)data, sizeof(old_video_info_t));
 	return error;
 
     case CONS_MODEINFO:		/* get mode information */
     case FBIO_MODEINFO:
 	return fb_ioctl(adp, FBIO_MODEINFO, data);
 
     case OLD_CONS_FINDMODE:	/* find a matching video mode (old interface) */
 	bzero(&info, sizeof(info));
 	bcopy((old_video_info_t *)data, &info, sizeof(old_video_info_t));
 	error = fb_ioctl(adp, FBIO_FINDMODE, &info);
 	if (error == 0)
 	    bcopy(&info, (old_video_info_t *)data, sizeof(old_video_info_t));
 	return error;
 
     case CONS_FINDMODE:		/* find a matching video mode */
     case FBIO_FINDMODE:
 	return fb_ioctl(adp, FBIO_FINDMODE, data);
 
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
     defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
     case _IO('c', 104):
 	ival = IOCPARM_IVAL(data);
 	data = (caddr_t)&ival;
 	/* FALLTHROUGH */
 #endif
     case CONS_SETWINORG:	/* set frame buffer window origin */
     case FBIO_SETWINORG:
 	if (scp != scp->sc->cur_scp)
 	    return ENODEV;	/* XXX */
 	return fb_ioctl(adp, FBIO_SETWINORG, data);
 
     case FBIO_GETWINORG:	/* get frame buffer window origin */
 	if (scp != scp->sc->cur_scp)
 	    return ENODEV;	/* XXX */
 	return fb_ioctl(adp, FBIO_GETWINORG, data);
 
     case FBIO_GETDISPSTART:
     case FBIO_SETDISPSTART:
     case FBIO_GETLINEWIDTH:
     case FBIO_SETLINEWIDTH:
 	if (scp != scp->sc->cur_scp)
 	    return ENODEV;	/* XXX */
 	return fb_ioctl(adp, cmd, data);
 
     case FBIO_GETPALETTE:
     case FBIO_SETPALETTE:
     case FBIOPUTCMAP:
     case FBIOGETCMAP:
     case FBIOGTYPE:
-    case FBIOSCURSOR:
-    case FBIOGCURSOR:
-    case FBIOSCURPOS:
-    case FBIOGCURPOS:
-    case FBIOGCURMAX:
 	if (scp != scp->sc->cur_scp)
 	    return ENODEV;	/* XXX */
 	return fb_ioctl(adp, cmd, data);
 
     case FBIO_BLANK:
 	if (scp != scp->sc->cur_scp)
 	    return ENODEV;	/* XXX */
 	return fb_ioctl(adp, cmd, data);
 
 #ifndef SC_NO_MODE_CHANGE
     /* generic text modes */
     case SW_TEXT_80x25:	case SW_TEXT_80x30:
     case SW_TEXT_80x43: case SW_TEXT_80x50:
     case SW_TEXT_80x60:
 	/* FALLTHROUGH */
 
     /* VGA TEXT MODES */
     case SW_VGA_C40x25:
     case SW_VGA_C80x25: case SW_VGA_M80x25:
     case SW_VGA_C80x30: case SW_VGA_M80x30:
     case SW_VGA_C80x50: case SW_VGA_M80x50:
     case SW_VGA_C80x60: case SW_VGA_M80x60:
     case SW_VGA_C90x25: case SW_VGA_M90x25:
     case SW_VGA_C90x30: case SW_VGA_M90x30:
     case SW_VGA_C90x43: case SW_VGA_M90x43:
     case SW_VGA_C90x50: case SW_VGA_M90x50:
     case SW_VGA_C90x60: case SW_VGA_M90x60:
     case SW_B40x25:     case SW_C40x25:
     case SW_B80x25:     case SW_C80x25:
     case SW_ENH_B40x25: case SW_ENH_C40x25:
     case SW_ENH_B80x25: case SW_ENH_C80x25:
     case SW_ENH_B80x43: case SW_ENH_C80x43:
     case SW_EGAMONO80x25:
 	if (!(adp->va_flags & V_ADP_MODECHANGE))
  	    return ENODEV;
 	return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0);
 
     /* GRAPHICS MODES */
     case SW_BG320:     case SW_BG640:
     case SW_CG320:     case SW_CG320_D:   case SW_CG640_E:
     case SW_CG640x350: case SW_ENH_CG640:
     case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320:
     case SW_VGA_MODEX:
 	if (!(adp->va_flags & V_ADP_MODECHANGE))
 	    return ENODEV;
 	return sc_set_graphics_mode(scp, tp, cmd & 0xff);
 #endif /* SC_NO_MODE_CHANGE */
 
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
     defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
     case _IO('K', 10):
 	ival = IOCPARM_IVAL(data);
 	data = (caddr_t)&ival;
 	/* FALLTHROUGH */
 #endif
     case KDSETMODE:     	/* set current mode of this (virtual) console */
 	switch (*(int *)data) {
 	case KD_TEXT:   	/* switch to TEXT (known) mode */
 	    /*
 	     * If scp->mode is of graphics modes, we don't know which
 	     * text mode to switch back to...
 	     */
 	    if (scp->status & GRAPHICS_MODE)
 		return EINVAL;
 	    /* restore fonts & palette ! */
 #if 0
 #ifndef SC_NO_FONT_LOADING
 	    if (ISFONTAVAIL(adp->va_flags) 
 		&& !(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
 		/*
 		 * FONT KLUDGE
 		 * Don't load fonts for now... XXX
 		 */
 		if (scp->sc->fonts_loaded & FONT_8)
 		    sc_load_font(scp, 0, 8, 8, scp->sc->font_8, 0, 256);
 		if (scp->sc->fonts_loaded & FONT_14)
 		    sc_load_font(scp, 0, 14, 8, scp->sc->font_14, 0, 256);
 		if (scp->sc->fonts_loaded & FONT_16)
 		    sc_load_font(scp, 0, 16, 8, scp->sc->font_16, 0, 256);
 	    }
 #endif /* SC_NO_FONT_LOADING */
 #endif
 
 #ifndef SC_NO_PALETTE_LOADING
 #ifdef SC_PIXEL_MODE
 	    if (adp->va_info.vi_mem_model == V_INFO_MM_DIRECT)
 		vidd_load_palette(adp, scp->sc->palette2);
 	    else
 #endif
 	    vidd_load_palette(adp, scp->sc->palette);
 #endif
 
 	    /* move hardware cursor out of the way */
 	    vidd_set_hw_cursor(adp, -1, -1);
 
 	    /* FALLTHROUGH */
 
 	case KD_TEXT1:  	/* switch to TEXT (known) mode */
 	    /*
 	     * If scp->mode is of graphics modes, we don't know which
 	     * text/pixel mode to switch back to...
 	     */
 	    if (scp->status & GRAPHICS_MODE)
 		return EINVAL;
 	    s = spltty();
 	    if ((error = sc_clean_up(scp))) {
 		splx(s);
 		return error;
 	    }
 	    scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
 	    splx(s);
 	    /* no restore fonts & palette */
 	    if (scp == scp->sc->cur_scp)
 		set_mode(scp);
 	    sc_clear_screen(scp);
 	    scp->status &= ~UNKNOWN_MODE;
 	    return 0;
 
 #ifdef SC_PIXEL_MODE
 	case KD_PIXEL:		/* pixel (raster) display */
 	    if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
 		return EINVAL;
 	    if (scp->status & GRAPHICS_MODE)
 		return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize, 
 					 scp->font_size, scp->font_width);
 	    s = spltty();
 	    if ((error = sc_clean_up(scp))) {
 		splx(s);
 		return error;
 	    }
 	    scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
 	    splx(s);
 	    if (scp == scp->sc->cur_scp) {
 		set_mode(scp);
 #ifndef SC_NO_PALETTE_LOADING
 		if (adp->va_info.vi_mem_model == V_INFO_MM_DIRECT)
 		    vidd_load_palette(adp, scp->sc->palette2);
 		else
 		    vidd_load_palette(adp, scp->sc->palette);
 #endif
 	    }
 	    sc_clear_screen(scp);
 	    scp->status &= ~UNKNOWN_MODE;
 	    return 0;
 #endif /* SC_PIXEL_MODE */
 
 	case KD_GRAPHICS:	/* switch to GRAPHICS (unknown) mode */
 	    s = spltty();
 	    if ((error = sc_clean_up(scp))) {
 		splx(s);
 		return error;
 	    }
 	    scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
 	    splx(s);
 	    return 0;
 
 	default:
 	    return EINVAL;
 	}
 	/* NOT REACHED */
 
 #ifdef SC_PIXEL_MODE
     case KDRASTER:		/* set pixel (raster) display mode */
 	if (ISUNKNOWNSC(scp) || ISTEXTSC(scp))
 	    return ENODEV;
 	return sc_set_pixel_mode(scp, tp, ((int *)data)[0], ((int *)data)[1], 
 				 ((int *)data)[2], 8);
 #endif /* SC_PIXEL_MODE */
 
     case KDGETMODE:     	/* get current mode of this (virtual) console */
 	/* 
 	 * From the user program's point of view, KD_PIXEL is the same 
 	 * as KD_TEXT... 
 	 */
 	*data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT;
 	return 0;
 
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
     defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
     case _IO('K', 13):
 	ival = IOCPARM_IVAL(data);
 	data = (caddr_t)&ival;
 	/* FALLTHROUGH */
 #endif
     case KDSBORDER:     	/* set border color of this (virtual) console */
 	scp->border = *(int *)data;
 	if (scp == scp->sc->cur_scp)
 	    sc_set_border(scp, scp->border);
 	return 0;
     }
 
     return ENOIOCTL;
 }
 
 static LIST_HEAD(, sc_renderer) sc_rndr_list = 
 	LIST_HEAD_INITIALIZER(sc_rndr_list);
 
 int
 sc_render_add(sc_renderer_t *rndr)
 {
 	LIST_INSERT_HEAD(&sc_rndr_list, rndr, link);
 	return 0;
 }
 
 int
 sc_render_remove(sc_renderer_t *rndr)
 {
 	/*
 	LIST_REMOVE(rndr, link);
 	*/
 	return EBUSY;	/* XXX */
 }
 
 sc_rndr_sw_t
 *sc_render_match(scr_stat *scp, char *name, int mode)
 {
 	const sc_renderer_t **list;
 	const sc_renderer_t *p;
 
 	if (!LIST_EMPTY(&sc_rndr_list)) {
 		LIST_FOREACH(p, &sc_rndr_list, link) {
 			if ((strcmp(p->name, name) == 0)
 				&& (mode == p->mode)) {
 				scp->status &=
 				    ~(VR_CURSOR_ON | VR_CURSOR_BLINK);
 				return p->rndrsw;
 			}
 		}
 	} else {
 		SET_FOREACH(list, scrndr_set) {
 			p = *list;
 			if ((strcmp(p->name, name) == 0)
 				&& (mode == p->mode)) {
 				scp->status &=
 				    ~(VR_CURSOR_ON | VR_CURSOR_BLINK);
 				return p->rndrsw;
 			}
 		}
 	}
 
 	return NULL;
 }
diff --git a/sys/sys/fbio.h b/sys/sys/fbio.h
index e6e9ede78e30..6b618777e84a 100644
--- a/sys/sys/fbio.h
+++ b/sys/sys/fbio.h
@@ -1,569 +1,531 @@
 /*-
  * SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software developed by the Computer Systems
  * Engineering group at Lawrence Berkeley Laboratory under DARPA
  * contract BG 91-66 and contributed to Berkeley.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY 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.
  *
  *	@(#)fbio.h	8.2 (Berkeley) 10/30/93
  *
  * $FreeBSD$
  */
 
 #ifndef _SYS_FBIO_H_
 #define _SYS_FBIO_H_
 
 #ifndef _KERNEL
 #include <sys/types.h>
 #else
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/eventhandler.h>
 #endif
 #include <sys/ioccom.h>
 
 /*
  * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
  */
 
 /*
  * Frame buffer type codes.
  */
 #define	FBTYPE_SUN1BW		0	/* multibus mono */
 #define	FBTYPE_SUN1COLOR	1	/* multibus color */
 #define	FBTYPE_SUN2BW		2	/* memory mono */
 #define	FBTYPE_SUN2COLOR	3	/* color w/rasterop chips */
 #define	FBTYPE_SUN2GP		4	/* GP1/GP2 */
 #define	FBTYPE_SUN5COLOR	5	/* RoadRunner accelerator */
 #define	FBTYPE_SUN3COLOR	6	/* memory color */
 #define	FBTYPE_MEMCOLOR		7	/* memory 24-bit */
 #define	FBTYPE_SUN4COLOR	8	/* memory color w/overlay */
 
 #define	FBTYPE_NOTSUN1		9	/* reserved for customer */
 #define	FBTYPE_NOTSUN2		10	/* reserved for customer */
 #define	FBTYPE_PCIMISC		11	/* (generic) PCI misc. disp. */
 
 #define	FBTYPE_SUNFAST_COLOR	12	/* accelerated 8bit */
 #define	FBTYPE_SUNROP_COLOR	13	/* MEMCOLOR with rop h/w */
 #define	FBTYPE_SUNFB_VIDEO	14	/* Simple video mixing */
 #define	FBTYPE_RESERVED5	15	/* reserved, do not use */
 #define	FBTYPE_RESERVED4	16	/* reserved, do not use */
 #define	FBTYPE_SUNGP3		17
 #define	FBTYPE_SUNGT		18
 #define	FBTYPE_SUNLEO		19	/* zx Leo */
 
 #define	FBTYPE_MDA		20
 #define	FBTYPE_HERCULES		21
 #define	FBTYPE_CGA		22
 #define	FBTYPE_EGA		23
 #define	FBTYPE_VGA		24
 #define	FBTYPE_TGA		26
 #define	FBTYPE_TGA2		27
 
 #define	FBTYPE_MDICOLOR		28	/* cg14 */
 #define	FBTYPE_TCXCOLOR		29	/* SUNW,tcx */
 #define	FBTYPE_CREATOR		30
 
 #define	FBTYPE_LASTPLUSONE	31	/* max number of fbs (change as add) */
 
 /*
  * Frame buffer descriptor as returned by FBIOGTYPE.
  */
 struct fbtype {
 	int	fb_type;	/* as defined above */
 	int	fb_height;	/* in pixels */
 	int	fb_width;	/* in pixels */
 	int	fb_depth;	/* bits per pixel */
 	int	fb_cmsize;	/* size of color map (entries) */
 	int	fb_size;	/* total size in bytes */
 };
 #define	FBIOGTYPE	_IOR('F', 0, struct fbtype)
 
 #define	FBTYPE_GET_STRIDE(_fb)	((_fb)->fb_size / (_fb)->fb_height)
 #define	FBTYPE_GET_BPP(_fb)	((_fb)->fb_bpp)
 #define	FBTYPE_GET_BYTESPP(_fb)	((_fb)->fb_bpp / 8)
 
 #ifdef	_KERNEL
 
 struct fb_info;
 
 typedef int fb_enter_t(void *priv);
 typedef int fb_leave_t(void *priv);
 typedef int fb_setblankmode_t(void *priv, int mode);
 
 struct fb_info {
 	/* Raw copy of fbtype. Do not change. */
 	int		fb_type;	/* as defined above */
 	int		fb_height;	/* in pixels */
 	int		fb_width;	/* in pixels */
 	int		fb_depth;	/* bits to define color */
 	int		fb_cmsize;	/* size of color map (entries) */
 	int		fb_size;	/* total size in bytes */
 
 	struct cdev 	*fb_cdev;
 
 	device_t	 fb_fbd_dev;	/* "fbd" device. */
 	device_t	 fb_video_dev;	/* Video adapter. */
 
 	fb_enter_t	*enter;
 	fb_leave_t	*leave;
 	fb_setblankmode_t *setblankmode;
 
 	uintptr_t	fb_pbase;	/* For FB mmap. */
 	uintptr_t	fb_vbase;	/* if NULL, use fb_write/fb_read. */
 	void		*fb_priv;	/* First argument for read/write. */
 	const char	*fb_name;
 	uint32_t	fb_flags;
 #define	FB_FLAG_NOMMAP		1	/* mmap unsupported. */
 #define	FB_FLAG_NOWRITE		2	/* disable writes for the time being */
 #define	FB_FLAG_MEMATTR		4	/* override memattr for mmap */
 	vm_memattr_t	fb_memattr;
 	int		fb_stride;
 	int		fb_bpp;		/* bits per pixel */
 	uint32_t	fb_cmap[16];
 };
 
 int fbd_list(void);
 int fbd_register(struct fb_info *);
 int fbd_unregister(struct fb_info *);
 
 static inline int
 register_framebuffer(struct fb_info *info)
 {
 
 	EVENTHANDLER_INVOKE(register_framebuffer, info);
 	return (0);
 }
 
 static inline int
 unregister_framebuffer(struct fb_info *info)
 {
 
 	EVENTHANDLER_INVOKE(unregister_framebuffer, info);
 	return (0);
 }
 #endif
 
 /*
  * Color map I/O.
  */
 struct fbcmap {
 	int	index;		/* first element (0 origin) */
 	int	count;		/* number of elements */
 	u_char	*red;		/* red color map elements */
 	u_char	*green;		/* green color map elements */
 	u_char	*blue;		/* blue color map elements */
 };
 #define	FBIOPUTCMAP	_IOW('F', 3, struct fbcmap)
 #define	FBIOGETCMAP	_IOW('F', 4, struct fbcmap)
 
-/*
- * Hardware cursor control (for, e.g., CG6).  A rather complex and icky
- * interface that smells like VMS, but there it is....
- */
-struct fbcurpos {
-	short	x;
-	short	y;
-};
-
-struct fbcursor {
-	short	set;		/* flags; see below */
-	short	enable;		/* nonzero => cursor on, 0 => cursor off */
-	struct	fbcurpos pos;	/* position on display */
-	struct	fbcurpos hot;	/* hot-spot within cursor */
-	struct	fbcmap cmap;	/* cursor color map */
-	struct	fbcurpos size;	/* number of valid bits in image & mask */
-	caddr_t	image;		/* cursor image bits */
-	caddr_t	mask;		/* cursor mask bits */
-};
-#define	FB_CUR_SETCUR	0x01	/* set on/off (i.e., obey fbcursor.enable) */
-#define	FB_CUR_SETPOS	0x02	/* set position */
-#define	FB_CUR_SETHOT	0x04	/* set hot-spot */
-#define	FB_CUR_SETCMAP	0x08	/* set cursor color map */
-#define	FB_CUR_SETSHAPE	0x10	/* set size & bits */
-#define	FB_CUR_SETALL	(FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT | \
-			 FB_CUR_SETCMAP | FB_CUR_SETSHAPE)
-
-/* controls for cursor attributes & shape (including position) */
-#define	FBIOSCURSOR	_IOW('F', 24, struct fbcursor)
-#define	FBIOGCURSOR	_IOWR('F', 25, struct fbcursor)
-
-/* controls for cursor position only */
-#define	FBIOSCURPOS	_IOW('F', 26, struct fbcurpos)
-#define	FBIOGCURPOS	_IOW('F', 27, struct fbcurpos)
-
-/* get maximum cursor size */
-#define	FBIOGCURMAX	_IOR('F', 28, struct fbcurpos)
-
 /*
  * Video board information
  */
 struct brd_info {
 	u_short		accessible_width; /* accessible bytes in scanline */
 	u_short		accessible_height; /* number of accessible scanlines */
 	u_short		line_bytes;	/* number of bytes/scanline */
 	u_short		hdb_capable;	/* can this thing hardware db? */
 	u_short		vmsize;		/* video memory size */
 	u_char		boardrev;	/* board revision # */
 	u_char		pad0;
 	u_long		pad1;
 };
 #define	FBIOGXINFO	_IOR('F', 39, struct brd_info)
 
 /*
  * Monitor information
  */
 struct mon_info {
 	u_long		mon_type;	/* bit array */
 #define MON_TYPE_STEREO		0x8	/* stereo display */
 #define MON_TYPE_0_OFFSET	0x4	/* black level 0 ire instead of 7.5 */
 #define MON_TYPE_OVERSCAN	0x2	/* overscan */
 #define MON_TYPE_GRAY		0x1	/* greyscale monitor */
 	u_long		pixfreq;	/* pixel frequency in Hz */
 	u_long		hfreq;		/* horizontal freq in Hz */
 	u_long		vfreq;		/* vertical freq in Hz */
 	u_long		vsync;		/* vertical sync in scanlines */
 	u_long		hsync;		/* horizontal sync in pixels */
 	/* these are in pixel units */
 	u_short		hfporch;	/* horizontal front porch */
 	u_short		hbporch;	/* horizontal back porch */
 	u_short		vfporch;	/* vertical front porch */
 	u_short		vbporch;	/* vertical back porch */
 };
 #define	FBIOMONINFO	_IOR('F', 40, struct mon_info)
 
 /*
  * Color map I/O.
  */
 struct fbcmap_i {
 	unsigned int	flags;
 #define	FB_CMAP_BLOCK	(1 << 0)	/* wait for vertical refresh */
 #define	FB_CMAP_KERNEL	(1 << 1)	/* called within kernel */
 	int		id;		/* color map id */
 	int		index;		/* first element (0 origin) */
 	int		count;		/* number of elements */
 	u_char		*red;		/* red color map elements */
 	u_char		*green;		/* green color map elements */
 	u_char		*blue;		/* blue color map elements */
 };
 #define	FBIOPUTCMAPI	_IOW('F', 41, struct fbcmap_i)
 #define	FBIOGETCMAPI	_IOW('F', 42, struct fbcmap_i)
 
 /* The new style frame buffer ioctls. */
 
 /* video mode information block */
 struct video_info {
     int			vi_mode;	/* mode number, see below */
     int			vi_flags;
 #define V_INFO_COLOR	(1 << 0)
 #define V_INFO_GRAPHICS	(1 << 1)
 #define V_INFO_LINEAR	(1 << 2)
 #define V_INFO_VESA	(1 << 3)
 #define	V_INFO_NONVGA	(1 << 4)
 #define	V_INFO_CWIDTH9	(1 << 5)
     int			vi_width;
     int			vi_height;
     int			vi_cwidth;
     int			vi_cheight;
     int			vi_depth;
     int			vi_planes;
     vm_offset_t		vi_window;	/* physical address */
     size_t		vi_window_size;
     size_t		vi_window_gran;
     vm_offset_t		vi_buffer;	/* physical address */
     size_t		vi_buffer_size;
     int			vi_mem_model;
 #define V_INFO_MM_OTHER  (-1)
 #define V_INFO_MM_TEXT	 0
 #define V_INFO_MM_PLANAR 1
 #define V_INFO_MM_PACKED 2
 #define V_INFO_MM_DIRECT 3
 #define V_INFO_MM_CGA	 100
 #define V_INFO_MM_HGC	 101
 #define V_INFO_MM_VGAX	 102
     /* for MM_PACKED and MM_DIRECT only */
     int			vi_pixel_size;	/* in bytes */
     /* for MM_DIRECT only */
     int			vi_pixel_fields[4];	/* RGB and reserved fields */
     int			vi_pixel_fsizes[4];
     /* reserved */
     u_char		vi_reserved[64];
     vm_offset_t		vi_registers;	/* physical address */
     vm_offset_t		vi_registers_size;
 };
 typedef struct video_info video_info_t;
 
 /* adapter infromation block */
 struct video_adapter {
     int			va_index;
     int			va_type;
 #define KD_OTHER	0		/* unknown */
 #define KD_MONO		1		/* monochrome adapter */
 #define KD_HERCULES	2		/* hercules adapter */
 #define KD_CGA		3		/* color graphics adapter */
 #define KD_EGA		4		/* enhanced graphics adapter */
 #define KD_VGA		5		/* video graphics adapter */
 #define KD_TGA		7		/* TGA */
 #define KD_TGA2		8		/* TGA2 */
     char		*va_name;
     int			va_unit;
     int			va_minor;
     int			va_flags;
 #define V_ADP_COLOR	(1 << 0)
 #define V_ADP_MODECHANGE (1 << 1)
 #define V_ADP_STATESAVE	(1 << 2)
 #define V_ADP_STATELOAD	(1 << 3)
 #define V_ADP_FONT	(1 << 4)
 #define V_ADP_PALETTE	(1 << 5)
 #define V_ADP_BORDER	(1 << 6)
 #define V_ADP_VESA	(1 << 7)
 #define V_ADP_BOOTDISPLAY (1 << 8)
 #define V_ADP_PROBED	(1 << 16)
 #define V_ADP_INITIALIZED (1 << 17)
 #define V_ADP_REGISTERED (1 << 18)
 #define V_ADP_ATTACHED	(1 << 19)
 #define	V_ADP_DAC8	(1 << 20)
 #define	V_ADP_CWIDTH9	(1 << 21)
     vm_offset_t		va_io_base;
     int			va_io_size;
     vm_offset_t		va_crtc_addr;
     vm_offset_t		va_mem_base;
     int			va_mem_size;
     vm_offset_t		va_window;	/* virtual address */
     size_t		va_window_size;
     size_t		va_window_gran;
     u_int		va_window_orig;
     vm_offset_t		va_buffer;	/* virtual address */
     size_t		va_buffer_size;
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
     struct video_info	va_info;
     int			va_line_width;
     struct {
 	int		x;
 	int		y;
     } 			va_disp_start;
     void		*va_token;
     int			va_model;
     int			va_little_bitian;
     int			va_little_endian;
     int			va_buffer_alias;
     vm_offset_t		va_registers;	/* virtual address */
     vm_offset_t		va_registers_size;
 };
 typedef struct video_adapter video_adapter_t;
 
 struct video_adapter_info {
     int			va_index;
     int			va_type;
     char		va_name[16];
     int			va_unit;
     int			va_flags;
     vm_offset_t		va_io_base;
     int			va_io_size;
     vm_offset_t		va_crtc_addr;
     vm_offset_t		va_mem_base;
     int			va_mem_size;
     vm_offset_t		va_window;	/* virtual address */
     size_t		va_window_size;
     size_t		va_window_gran;
     vm_offset_t		va_unused0;
     size_t		va_buffer_size;
     int			va_initial_mode;
     int			va_initial_bios_mode;
     int			va_mode;
     int			va_line_width;
     struct {
 	int		x;
 	int		y;
     } 			va_disp_start;
     u_int		va_window_orig;
     /* reserved */
     u_char		va_reserved[64];
 };
 typedef struct video_adapter_info video_adapter_info_t;
 
 /* some useful video adapter index */
 #define V_ADP_PRIMARY	0
 #define V_ADP_SECONDARY	1
 
 /* video mode numbers */
 
 #define M_B40x25	0	/* black & white 40 columns */
 #define M_C40x25	1	/* color 40 columns */
 #define M_B80x25	2	/* black & white 80 columns */
 #define M_C80x25	3	/* color 80 columns */
 #define M_BG320		4	/* black & white graphics 320x200 */
 #define M_CG320		5	/* color graphics 320x200 */
 #define M_BG640		6	/* black & white graphics 640x200 hi-res */
 #define M_EGAMONO80x25  7       /* ega-mono 80x25 */
 #define M_CG320_D	13	/* ega mode D */
 #define M_CG640_E	14	/* ega mode E */
 #define M_EGAMONOAPA	15	/* ega mode F */
 #define M_CG640x350	16	/* ega mode 10 */
 #define M_ENHMONOAPA2	17	/* ega mode F with extended memory */
 #define M_ENH_CG640	18	/* ega mode 10* */
 #define M_ENH_B40x25    19      /* ega enhanced black & white 40 columns */
 #define M_ENH_C40x25    20      /* ega enhanced color 40 columns */
 #define M_ENH_B80x25    21      /* ega enhanced black & white 80 columns */
 #define M_ENH_C80x25    22      /* ega enhanced color 80 columns */
 #define M_VGA_C40x25	23	/* vga 8x16 font on color */
 #define M_VGA_C80x25	24	/* vga 8x16 font on color */
 #define M_VGA_M80x25	25	/* vga 8x16 font on mono */
 
 #define M_VGA11		26	/* vga 640x480 2 colors */
 #define M_BG640x480	26
 #define M_VGA12		27	/* vga 640x480 16 colors */
 #define M_CG640x480	27
 #define M_VGA13		28	/* vga 320x200 256 colors */
 #define M_VGA_CG320	28
 
 #define M_VGA_C80x50	30	/* vga 8x8 font on color */
 #define M_VGA_M80x50	31	/* vga 8x8 font on color */
 #define M_VGA_C80x30	32	/* vga 8x16 font on color */
 #define M_VGA_M80x30	33	/* vga 8x16 font on color */
 #define M_VGA_C80x60	34	/* vga 8x8 font on color */
 #define M_VGA_M80x60	35	/* vga 8x8 font on color */
 #define M_VGA_CG640	36	/* vga 640x400 256 color */
 #define M_VGA_MODEX	37	/* vga 320x240 256 color */
 
 #define M_VGA_C90x25	40	/* vga 8x16 font on color */
 #define M_VGA_M90x25	41	/* vga 8x16 font on mono */
 #define M_VGA_C90x30	42	/* vga 8x16 font on color */
 #define M_VGA_M90x30	43	/* vga 8x16 font on mono */
 #define M_VGA_C90x43	44	/* vga 8x8 font on color */
 #define M_VGA_M90x43	45	/* vga 8x8 font on mono */
 #define M_VGA_C90x50	46	/* vga 8x8 font on color */
 #define M_VGA_M90x50	47	/* vga 8x8 font on mono */
 #define M_VGA_C90x60	48	/* vga 8x8 font on color */
 #define M_VGA_M90x60	49	/* vga 8x8 font on mono */
 
 #define M_ENH_B80x43	0x70	/* ega black & white 80x43 */
 #define M_ENH_C80x43	0x71	/* ega color 80x43 */
 
 #define M_HGC_P0	0xe0	/* hercules graphics - page 0 @ B0000 */
 #define M_HGC_P1	0xe1	/* hercules graphics - page 1 @ B8000 */
 #define M_MCA_MODE	0xff	/* monochrome adapter mode */
 
 #define M_TEXT_80x25	200	/* generic text modes */
 #define M_TEXT_80x30	201
 #define M_TEXT_80x43	202
 #define M_TEXT_80x50	203
 #define M_TEXT_80x60	204
 #define M_TEXT_132x25	205
 #define M_TEXT_132x30	206
 #define M_TEXT_132x43	207
 #define M_TEXT_132x50	208
 #define M_TEXT_132x60	209
 
 #define M_VESA_BASE		0x100	/* VESA mode number base */
 #define M_VESA_CG640x400	0x100	/* 640x400, 256 color */
 #define M_VESA_CG640x480	0x101	/* 640x480, 256 color */
 #define M_VESA_800x600		0x102	/* 800x600, 16 color */
 #define M_VESA_CG800x600	0x103	/* 800x600, 256 color */
 #define M_VESA_1024x768		0x104	/* 1024x768, 16 color */
 #define M_VESA_CG1024x768	0x105	/* 1024x768, 256 color */
 #define M_VESA_1280x1024	0x106	/* 1280x1024, 16 color */
 #define M_VESA_CG1280x1024	0x107	/* 1280x1024, 256 color */
 #define M_VESA_C80x60		0x108	/* 8x8 font */
 #define M_VESA_C132x25		0x109	/* 8x16 font */
 #define M_VESA_C132x43		0x10a	/* 8x14 font */
 #define M_VESA_C132x50		0x10b	/* 8x8 font */
 #define M_VESA_C132x60		0x10c	/* 8x8 font */
 #define M_VESA_32K_320		0x10d	/* 320x200, 5:5:5 */
 #define M_VESA_64K_320		0x10e	/* 320x200, 5:6:5 */
 #define M_VESA_FULL_320		0x10f	/* 320x200, 8:8:8 */
 #define M_VESA_32K_640		0x110	/* 640x480, 5:5:5 */
 #define M_VESA_64K_640		0x111	/* 640x480, 5:6:5 */
 #define M_VESA_FULL_640		0x112	/* 640x480, 8:8:8 */
 #define M_VESA_32K_800		0x113	/* 800x600, 5:5:5 */
 #define M_VESA_64K_800		0x114	/* 800x600, 5:6:5 */
 #define M_VESA_FULL_800		0x115	/* 800x600, 8:8:8 */
 #define M_VESA_32K_1024		0x116	/* 1024x768, 5:5:5 */
 #define M_VESA_64K_1024		0x117	/* 1024x768, 5:6:5 */
 #define M_VESA_FULL_1024	0x118	/* 1024x768, 8:8:8 */
 #define M_VESA_32K_1280		0x119	/* 1280x1024, 5:5:5 */
 #define M_VESA_64K_1280		0x11a	/* 1280x1024, 5:6:5 */
 #define M_VESA_FULL_1280	0x11b	/* 1280x1024, 8:8:8 */
 #define M_VESA_MODE_MAX		0x1ff
 
 struct video_display_start {
 	int		x;
 	int		y;
 };
 typedef struct video_display_start video_display_start_t;
 
 struct video_color_palette {
 	int		index;		/* first element (zero-based) */
 	int		count;		/* number of elements */
 	u_char		*red;		/* red */
 	u_char		*green;		/* green */
 	u_char		*blue;		/* blue */
 	u_char		*transparent;	/* may be NULL */
 };
 typedef struct video_color_palette video_color_palette_t;
 
 /* adapter info. */
 #define FBIO_ADAPTER	_IOR('F', 100, int)
 #define FBIO_ADPTYPE	_IOR('F', 101, int)
 #define FBIO_ADPINFO	_IOR('F', 102, struct video_adapter_info)
 
 /* video mode control */
 #define FBIO_MODEINFO	_IOWR('F', 103, struct video_info)
 #define FBIO_FINDMODE	_IOWR('F', 104, struct video_info)
 #define FBIO_GETMODE	_IOR('F', 105, int)
 #define FBIO_SETMODE	_IOW('F', 106, int)
 
 /* get/set frame buffer window origin */
 #define FBIO_GETWINORG	_IOR('F', 107, u_int)
 #define FBIO_SETWINORG	_IOW('F', 108, u_int)
 
 /* get/set display start address */
 #define FBIO_GETDISPSTART	_IOR('F', 109, video_display_start_t) 
 #define FBIO_SETDISPSTART	_IOW('F', 110, video_display_start_t)
 
 /* get/set scan line width */
 #define FBIO_GETLINEWIDTH	_IOR('F', 111, u_int) 
 #define FBIO_SETLINEWIDTH	_IOW('F', 112, u_int)
 
 /* color palette control */
 #define FBIO_GETPALETTE	_IOW('F', 113, video_color_palette_t)
 #define FBIO_SETPALETTE	_IOW('F', 114, video_color_palette_t)
 
 /* blank display */
 #define V_DISPLAY_ON		0
 #define V_DISPLAY_BLANK		1
 #define V_DISPLAY_STAND_BY	2
 #define V_DISPLAY_SUSPEND	3
 
 #define FBIO_BLANK	_IOW('F', 115, int)
 
 #endif /* !_SYS_FBIO_H_ */