summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <busterbcook@yahoo.com>2004-04-03 22:22:48 +0000
committerBrent Cook <busterbcook@yahoo.com>2004-04-03 22:22:48 +0000
commit962b898868dcab959c390986dcb0b4dd750dc107 (patch)
tree124cae7b19e98e36b2b1dc47314b77a745da3e40
parent8a2fce3b90b5efc8bab19675cb8e02690e24442e (diff)
initial import of original driver by Franco Catrin L. Wraps VESA for most
parts, with some hardware acceleration enabled for the cursor on the NM2300.
-rw-r--r--hw/kdrive/neomagic/Makefile.am28
-rw-r--r--hw/kdrive/neomagic/neo_draw.c211
-rw-r--r--hw/kdrive/neomagic/neomagic.c290
-rw-r--r--hw/kdrive/neomagic/neomagic.h184
-rw-r--r--hw/kdrive/neomagic/neomagicstub.c65
5 files changed, 778 insertions, 0 deletions
diff --git a/hw/kdrive/neomagic/Makefile.am b/hw/kdrive/neomagic/Makefile.am
new file mode 100644
index 000000000..b1bf3a159
--- /dev/null
+++ b/hw/kdrive/neomagic/Makefile.am
@@ -0,0 +1,28 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @XSERVER_CFLAGS@
+
+bin_PROGRAMS = Xneomagic
+
+noinst_LIBRARIES = libneomagic.a
+
+libneomagic_a_SOURCES = \
+ neomagic.c \
+ neomagic.h \
+ neo_draw.c
+
+Xneomagic_SOURCES = \
+ neomagicstub.c
+
+NEOMAGIC_LIBS = \
+ libneomagic.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+Xneomagic_LDADD = \
+ $(NEOMAGIC_LIBS) \
+ @KDRIVE_LIBS@ \
+ @XSERVER_LIBS@
+
+Xneomagic_DEPENDENCIES = $(NEOMAGIC_LIBS) @KDRIVE_LIBS@
diff --git a/hw/kdrive/neomagic/neo_draw.c b/hw/kdrive/neomagic/neo_draw.c
new file mode 100644
index 000000000..7f237c429
--- /dev/null
+++ b/hw/kdrive/neomagic/neo_draw.c
@@ -0,0 +1,211 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "neomagic.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+
+static inline void neoWaitIdle( NeoCardInfo *neoc)
+{
+ // if MMIO is not working it may halt the machine
+ int i = 0;
+ while ((neoc->mmio->bltStat & 1) && ++i<10000);
+ if (i>=10000) DBGOUT("Wait Idle timeout");
+}
+
+static inline void neoWaitFifo(NeoCardInfo *neoc,
+ int requested_fifo_space )
+{
+ neoWaitIdle( neoc );
+}
+
+NeoMMIO *mmio;
+NeoScreenInfo *screen;
+NeoCardInfo *card;
+CARD32 fgColor;
+
+static Bool neoPrepareSolid(PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ FbBits depthMask = FbFullMask(pPixmap->drawable.depth);
+
+ if ((pm & depthMask) != depthMask)
+ {
+ return FALSE;
+ }
+ else
+ {
+ fgColor = fg;
+ neoWaitIdle(card);
+ /* set blt control */
+ mmio->bltCntl =
+ NEO_BC0_SRC_IS_FG |
+ NEO_BC3_SRC_XY_ADDR |
+ NEO_BC3_DST_XY_ADDR |
+ NEO_BC3_SKIP_MAPPING | 0x0c0000;
+
+ mmio->fgColor = fgColor;
+ return TRUE;
+ }
+}
+
+void
+neoSolid (int x1, int y1, int x2, int y2)
+{
+ DBGOUT("Solid (%i, %i) - (%i, %i). \n", x1, y1, x2, y2);
+ int x, y, w, h;
+ x = x1;
+ y = y1;
+ w = x2-x1 + 1;
+ h = y2-y1 + 1;
+ if (x1>x2)
+ {
+ x = x2;
+ w = -w;
+ }
+ if (y1>y2)
+ {
+ y = y2;
+ h = -h;
+ }
+
+ neoWaitIdle(card);
+ mmio->dstStart = (y <<16) | (x & 0xffff);
+
+ mmio->xyExt = (h << 16) | (w & 0xffff);
+ DBGOUT("Solid (%i, %i) - (%i, %i). Color %x\n", x, y, w, h, fgColor);
+ DBGOUT("Offset %lx. Extent %lx\n",mmio->dstStart, mmio->xyExt);
+}
+
+
+void
+neoDoneSolid(void)
+{
+}
+
+Bool
+neoPrepareCopy (PixmapPtr pSrcPixpam,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ return TRUE;
+}
+
+void
+neoCopy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int w,
+ int h)
+{
+}
+
+void
+neoDoneCopy (void)
+{
+}
+
+KaaScreenInfoRec neoKaa = {
+ neoPrepareSolid,
+ neoSolid,
+ neoDoneSolid,
+
+ neoPrepareCopy,
+ neoCopy,
+ neoDoneCopy
+};
+
+Bool
+neoDrawInit (ScreenPtr pScreen)
+{
+ ENTER();
+// SetupNeo(pScreen);
+// PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ if (!kaaDrawInit (pScreen, &neoKaa))
+ return FALSE;
+
+// if (ps && tridents->off_screen)
+// ps->Composite = tridentComposite;
+ LEAVE();
+ return TRUE;
+}
+
+void
+neoDrawEnable (ScreenPtr pScreen)
+{
+ ENTER();
+ SetupNeo(pScreen);
+ screen = neos;
+ card = neoc;
+ mmio = neoc->mmio;
+ DBGOUT("NEO AA MMIO=%lx\n", mmio);
+ screen->depth = screen->vesa.mode.BitsPerPixel/8;
+ screen->pitch = screen->vesa.mode.BytesPerScanLine;
+ DBGOUT("NEO depth=%x, pitch=%x\n", screen->depth, screen->pitch);
+ LEAVE();
+}
+
+void
+neoDrawDisable (ScreenPtr pScreen)
+{
+ ENTER();
+ LEAVE();
+}
+
+void
+neoDrawFini (ScreenPtr pScreen)
+{
+ ENTER();
+ LEAVE();
+}
+
+void
+neoDrawSync (ScreenPtr pScreen)
+{
+ ENTER();
+ SetupNeo(pScreen);
+
+ neoWaitIdle(neoc);
+ LEAVE();
+}
diff --git a/hw/kdrive/neomagic/neomagic.c b/hw/kdrive/neomagic/neomagic.c
new file mode 100644
index 000000000..4971e5758
--- /dev/null
+++ b/hw/kdrive/neomagic/neomagic.c
@@ -0,0 +1,290 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "neomagic.h"
+#include <sys/io.h>
+
+static Bool
+neoCardInit (KdCardInfo *card)
+{
+ NeoCardInfo *neoc;
+
+ neoc = (NeoCardInfo *) xalloc (sizeof (NeoCardInfo));
+ if (!neoc)
+ return FALSE;
+
+ if (!vesaInitialize (card, &neoc->vesa))
+ {
+ xfree (neoc);
+ return FALSE;
+ }
+
+ iopl (3);
+ neoMapReg (card, neoc);
+
+ card->driver = neoc;
+
+ return TRUE;
+}
+
+static Bool
+neoScreenInit (KdScreenInfo *screen)
+{
+ NeoCardInfo *neoc = screen->card->driver;
+ NeoScreenInfo *neos;
+ int screen_size, memory;
+
+ neos = (NeoScreenInfo *) xalloc (sizeof (NeoScreenInfo));
+ if (!neos)
+ return FALSE;
+ memset (neos, '\0', sizeof (NeoScreenInfo));
+ if (!vesaScreenInitialize (screen, &neos->vesa))
+ {
+ xfree (neos);
+ return FALSE;
+ }
+ if (!neoc->reg_base)
+ screen->dumb = TRUE;
+ if (neos->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+ screen->softCursor = TRUE; // no hardware color cursor available
+ neos->screen = neos->vesa.fb;
+ memory = neos->vesa.fb_size;
+ screen_size = screen->fb[0].byteStride * screen->height;
+ memory -= screen_size;
+ if (memory > screen->fb[0].byteStride)
+ {
+ neos->off_screen = neos->screen + screen_size;
+ neos->off_screen_size = memory;
+ }
+ else
+ {
+ neos->off_screen = 0;
+ neos->off_screen_size = 0;
+ }
+ screen->driver = neos;
+ return TRUE;
+}
+
+static Bool
+neoInitScreen (ScreenPtr pScreen)
+{
+ return vesaInitScreen (pScreen);
+}
+
+static Bool
+neoFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = vesaFinishInitScreen (pScreen);
+ return ret;
+}
+
+void
+neoPreserve (KdCardInfo *card)
+{
+ vesaPreserve(card);
+}
+
+CARD8
+neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 index)
+{
+ outb (index, addr);
+ return inb(addr+1);
+}
+
+void
+neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 index, CARD8 val)
+{
+ outb(index, addr);
+ outb(val, addr+1);
+}
+
+static void neoLock(NeoCardInfo *neoc){
+ CARD8 cr11;
+ neoSetIndex(neoc, 0x3ce, 0x09, 0x00);
+ cr11 = neoGetIndex (neoc, 0x3d4, 0x11);
+ neoSetIndex (neoc, 0x3d4, 0x11, cr11 | 0x80);
+}
+
+static void neoUnlock(NeoCardInfo *neoc){
+ CARD8 cr11;
+ cr11 = neoGetIndex (neoc, 0x3d4, 0x11);
+ neoSetIndex (neoc, 0x3d4, 0x11, cr11 & 0x7F);
+ neoSetIndex(neoc, 0x3ce, 0x09, 0x26);
+}
+
+
+Bool
+neoMapReg (KdCardInfo *card, NeoCardInfo *neoc)
+{
+ ENTER();
+ neoc->reg_base = card->attr.address[1] & 0xFFF80000;
+ if (!neoc->reg_base)
+ {
+ return FALSE;
+ }
+
+ neoc->mmio = KdMapDevice(neoc->reg_base, NEO_REG_SIZE(card));
+ if (!neoc->mmio)
+ {
+ return FALSE;
+ }
+
+ KdSetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS);
+
+ // if you see the cursor sprite them MMIO is working
+
+ *(((CARD32 *)neoc->mmio)+0x400) = (CARD32)8;
+ //neoSetIndex(neoc, 0x3ce, 0x82,8);
+ LEAVE();
+ return TRUE;
+}
+
+void
+neoUnmapReg (KdCardInfo *card, NeoCardInfo *neoc)
+{
+ ENTER();
+ if (neoc->reg_base)
+ {
+ neoSetIndex(neoc, 0x3ce, 0x82,0);
+ KdResetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *)neoc->mmio, NEO_REG_SIZE(card));
+ neoc->reg_base = 0;
+ }
+ LEAVE();
+}
+
+void
+neoSetMMIO (KdCardInfo *card, NeoCardInfo *neoc)
+{
+ if (!neoc->reg_base)
+ neoMapReg (card, neoc);
+ neoUnlock (neoc);
+}
+
+void
+neoResetMMIO (KdCardInfo *card, NeoCardInfo *neoc)
+{
+ neoUnmapReg (card, neoc);
+ neoLock (neoc);
+}
+
+
+Bool
+neoEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ NeoCardInfo *neoc = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+ neoSetMMIO (pScreenPriv->card, neoc);
+ return TRUE;
+}
+
+void
+neoDisable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+
+ NeoCardInfo *neoc = pScreenPriv->card->driver;
+ neoResetMMIO (pScreenPriv->card, neoc);
+
+ vesaDisable (pScreen);
+}
+
+static Bool
+neoDPMS (ScreenPtr pScreen, int mode)
+{
+ return vesaDPMS (pScreen, mode);
+}
+
+static void
+neoRestore (KdCardInfo *card)
+{
+ NeoCardInfo *neoc = card->driver;
+
+ neoResetMMIO (card, neoc);
+ vesaRestore (card);
+}
+
+static void
+neoScreenFini (KdScreenInfo *screen)
+{
+ NeoScreenInfo *neos = (NeoScreenInfo *) screen->driver;
+
+ vesaScreenFini (screen);
+ xfree (neos);
+ screen->driver = 0;
+}
+
+static void
+neoCardFini (KdCardInfo *card)
+{
+ NeoCardInfo *neos = card->driver;
+
+ neoUnmapReg (card, neos);
+ vesaCardFini (card);
+}
+
+
+#define neoCursorInit 0 /* initCursor */
+#define neoCursorEnable 0 /* enableCursor */
+#define neoCursorDisable 0 /* disableCursor */
+#define neoCursorFini 0 /* finiCursor */
+#define neoRecolorCursor 0 /* recolorCursor */
+
+
+KdCardFuncs neoFuncs = {
+ neoCardInit, /* cardinit */
+ neoScreenInit, /* scrinit */
+ neoInitScreen, /* initScreen */
+ neoFinishInitScreen, /* finishInitScreen */
+ vesaCreateResources, /* createRes */
+ neoPreserve, /* preserve */
+ neoEnable, /* enable */
+ neoDPMS, /* dpms */
+ neoDisable, /* disable */
+ neoRestore, /* restore */
+ neoScreenFini, /* scrfini */
+ neoCardFini, /* cardfini */
+
+ neoCursorInit, /* initCursor */
+ neoCursorEnable, /* enableCursor */
+ neoCursorDisable, /* disableCursor */
+ neoCursorFini, /* finiCursor */
+ neoRecolorCursor, /* recolorCursor */
+
+ neoDrawInit, /* initAccel */
+ neoDrawEnable, /* enableAccel */
+ neoDrawSync, /* syncAccel */
+ neoDrawDisable, /* disableAccel */
+ neoDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h
new file mode 100644
index 000000000..aa94db566
--- /dev/null
+++ b/hw/kdrive/neomagic/neomagic.h
@@ -0,0 +1,184 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NEOMAGIC_H_
+#define _NEOMAGIC_H_
+#include <vesa.h>
+#include "kxv.h"
+#include "klinux.h"
+
+
+#define DEBUG
+#ifdef DEBUG
+#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
+#else
+#define DBGOUT(fmt,a...)
+#endif
+
+#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
+#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
+
+#define NEOMAGIC_VENDOR 0x10c8
+#define NEOMAGIC_NM2230 0x0025
+
+#define NEO_BS0_BLT_BUSY 0x00000001
+#define NEO_BS0_FIFO_AVAIL 0x00000002
+#define NEO_BS0_FIFO_PEND 0x00000004
+
+#define NEO_BC0_DST_Y_DEC 0x00000001
+#define NEO_BC0_X_DEC 0x00000002
+#define NEO_BC0_SRC_TRANS 0x00000004
+#define NEO_BC0_SRC_IS_FG 0x00000008
+#define NEO_BC0_SRC_Y_DEC 0x00000010
+#define NEO_BC0_FILL_PAT 0x00000020
+#define NEO_BC0_SRC_MONO 0x00000040
+#define NEO_BC0_SYS_TO_VID 0x00000080
+
+#define NEO_BC1_DEPTH8 0x00000100
+#define NEO_BC1_DEPTH16 0x00000200
+#define NEO_BC1_X_320 0x00000400
+#define NEO_BC1_X_640 0x00000800
+#define NEO_BC1_X_800 0x00000c00
+#define NEO_BC1_X_1024 0x00001000
+#define NEO_BC1_X_1152 0x00001400
+#define NEO_BC1_X_1280 0x00001800
+#define NEO_BC1_X_1600 0x00001c00
+#define NEO_BC1_DST_TRANS 0x00002000
+#define NEO_BC1_MSTR_BLT 0x00004000
+#define NEO_BC1_FILTER_Z 0x00008000
+
+#define NEO_BC2_WR_TR_DST 0x00800000
+
+#define NEO_BC3_SRC_XY_ADDR 0x01000000
+#define NEO_BC3_DST_XY_ADDR 0x02000000
+#define NEO_BC3_CLIP_ON 0x04000000
+#define NEO_BC3_FIFO_EN 0x08000000
+#define NEO_BC3_BLT_ON_ADDR 0x10000000
+#define NEO_BC3_SKIP_MAPPING 0x80000000
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+#define NEO_REG_SIZE(c) (0x200000L)
+
+typedef volatile struct {
+ CARD32 bltStat;
+ CARD32 bltCntl;
+ CARD32 xpColor;
+ CARD32 fgColor;
+ CARD32 bgColor;
+ CARD32 pitch;
+ CARD32 clipLT;
+ CARD32 clipRB;
+ CARD32 srcBitOffset;
+ CARD32 srcStart;
+ CARD32 reserved0;
+ CARD32 dstStart;
+ CARD32 xyExt;
+
+ CARD32 reserved1[19];
+
+ CARD32 pageCntl;
+ CARD32 pageBase;
+ CARD32 postBase;
+ CARD32 postPtr;
+ CARD32 dataPtr;
+} NeoMMIO;
+
+
+typedef struct _neoCardInfo {
+ VesaCardPrivRec vesa;
+ CARD32 reg_base;
+ NeoMMIO *mmio;
+ int dstOrg;
+ int dstPitch;
+ int dstPixelWidth;
+
+ int srcOrg;
+ int srcPitch;
+ int srcPixelWidth;
+
+ CARD32 bltCntl;
+
+} NeoCardInfo;
+
+#define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver))
+#define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd)
+
+typedef struct _neoScreenInfo {
+ VesaScreenPrivRec vesa;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ int pitch;
+ int depth;
+ KdVideoAdaptorPtr pAdaptor;
+} NeoScreenInfo;
+
+#define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver))
+#define neoScreenInfo(kd) NeoScreenInfo *neos = getNeoScreenInfo(kd)
+
+#define SetupNeo(s) KdScreenPriv(s); \
+ neoCardInfo(pScreenPriv); \
+ neoScreenInfo(pScreenPriv);
+
+void
+neoPreserve (KdCardInfo *card);
+
+Bool
+neoEnable (ScreenPtr pScreen);
+
+void
+neoDisable (ScreenPtr pScreen);
+
+Bool
+neoMapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
+
+void
+neoUnmapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
+
+CARD8
+neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id);
+
+void
+neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id, CARD8 val);
+
+Bool
+neoDrawInit (ScreenPtr pScreen);
+
+void
+neoDrawEnable (ScreenPtr pScreen);
+
+void
+neoDrawDisable (ScreenPtr pScreen);
+
+void
+neoDrawFini (ScreenPtr pScreen);
+
+void
+neoDrawSync (ScreenPtr pScreen);
+
+extern KdCardFuncs neoFuncs;
+
+#endif /* _NEOMAGIC_H_ */
diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c
new file mode 100644
index 000000000..9b57b4822
--- /dev/null
+++ b/hw/kdrive/neomagic/neomagicstub.c
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "neomagic.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+ // NM2230 MagicGraph 256AV+ the only card I have for testing
+ if (LinuxFindPci (NEOMAGIC_VENDOR, NEOMAGIC_NM2230, 0, &attr))
+ KdCardInfoAdd (&neoFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}