PATCH: Neomagic driver to detect more chips
Brent Cook <busterbcook-/[email protected]>
| Newsgroups | gmane.comp.freedesktop.xserver |
|---|---|
| Message-ID | <[email protected]> |
I'll try to keep patches short and focused.
This patch adds a NeoChipInfo structure and extends the PCI detection
routines to detect all NeoMagic chips known by the original xizzle driver,
including 4 CAP_* classifications depending on acceleration capabilities.
Some of the other capabilities may not be useful if we're doing VESA
initialization, such as maxClock, so they can be whittled away as
necessary. This patch also adds touchscreen support, which is a minor
thing.
I only have a NM2200 right now, but this code appears to do the right
thing. This will at least allow us to mask acceleration for other chips
until we have testing hardware.
Interestingly, the Xneomagic that builds from this sets my hardware to
640x480 while the Linux vesa framebuffer defaults to 1024x768.
- Brent
--- /home/busterb/neomagic/neomagic.c 2004-03-29 20:59:49.000000000 -0600
+++ ./neomagic.c 2004-03-30 21:51:33.000000000 -0600
@@ -27,10 +27,33 @@
#include "neomagic.h"
#include <sys/io.h>
+struct NeoChipInfo neoChips[] = {
+ {NEO_VENDOR, 0x0001, CAP_NM2070, "MagicGraph 128 (NM2070)",
+ 896, 65000, 2048, 0x100, 1024, 1024, 1024},
+ {NEO_VENDOR, 0x0002, CAP_NM2090, "MagicGraph 128V (NM2090)",
+ 1152, 80000, 2048, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0003, CAP_NM2090, "MagicGraph 128ZV (NM2093)",
+ 1152, 80000, 2048, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0083, CAP_NM2097, "MagicGraph 128ZV+ (NM2097)",
+ 1152, 80000, 1024, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0004, CAP_NM2097, "MagicGraph 128XD (NM2160)",
+ 2048, 90000, 1024, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0005, CAP_NM2200, "MagicGraph 256AV (NM2200)",
+ 2560, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0025, CAP_NM2200, "MagicGraph 256AV+ (NM2230)",
+ 3008, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0006, CAP_NM2200, "MagicGraph 256ZX (NM2360)",
+ 4096, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0016, CAP_NM2200, "MagicGraph 256XL+ (NM2380)",
+ 6144, 110000, 1024, 0x1000, 8192, 1280, 1024},
+ {0, 0, 0, NULL},
+};
+
static Bool
neoCardInit (KdCardInfo *card)
{
NeoCardInfo *neoc;
+ struct NeoChipInfo *chip;
neoc = (NeoCardInfo *) xalloc (sizeof (NeoCardInfo));
if (!neoc)
@@ -42,6 +65,15 @@
return FALSE;
}
+ for (chip = neoChips; chip->name != NULL; ++chip) {
+ if (chip->device == card->attr.deviceID) {
+ neoc->chip = chip;
+ break;
+ }
+ }
+
+ ErrorF("Using Neomagic card: %s\n", neoc->chip->name);
+
iopl (3);
neoMapReg (card, neoc);
diff -u /home/busterb/neomagic/neomagic.h ./neomagic.h
--- /home/busterb/neomagic/neomagic.h 2004-03-28 10:29:26.000000000 -0600
+++ ./neomagic.h 2004-03-30 21:37:16.000000000 -0600
@@ -38,8 +38,11 @@
#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
-#define NEOMAGIC_VENDOR 0x10c8
-#define NEOMAGIC_NM2230 0x0025
+#define NEO_VENDOR 0x10c8
+#define CAP_NM2070 0x01 /* If it's a NM2070 series */
+#define CAP_NM2090 0x02 /* If it's a NM2090 series */
+#define CAP_NM2097 0x03 /* If it's a NM2097 series */
+#define CAP_NM2200 0x04 /* If it's a NM2200 series */
#define NEO_BS0_BLT_BUSY 0x00000001
#define NEO_BS0_FIFO_AVAIL 0x00000002
@@ -106,7 +109,6 @@
CARD32 dataPtr;
} NeoMMIO;
-
typedef struct _neoCardInfo {
VesaCardPrivRec vesa;
CARD32 reg_base;
@@ -118,10 +120,26 @@
int srcOrg;
int srcPitch;
int srcPixelWidth;
+
+ struct NeoChipInfo *chip;
CARD32 bltCntl;
} NeoCardInfo;
+
+struct NeoChipInfo {
+ CARD16 vendor;
+ CARD16 device;
+ CARD8 caps;
+ char *name;
+ int videoRam;
+ int maxClock;
+ int cursorMem;
+ int cursorOff;
+ int linearSize;
+ int maxWidth;
+ int maxHeight;
+};
#define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver))
#define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd)
Only in ./: neomagic.o
diff -u /home/busterb/neomagic/neomagicstub.c ./neomagicstub.c
--- /home/busterb/neomagic/neomagicstub.c 2004-03-29 19:45:13.000000000 -0600
+++ ./neomagicstub.c 2004-03-30 21:51:46.000000000 -0600
@@ -26,13 +26,20 @@
#endif
#include "neomagic.h"
+extern struct NeoChipInfo neoChips[];
+
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);
+ struct NeoChipInfo *chip;
+
+ for (chip = neoChips; chip->name != NULL; ++chip) {
+ int j = 0;
+ while (LinuxFindPci(chip->vendor, chip->device, j++, &attr)) {
+ KdCardInfoAdd(&neoFuncs, &attr, 0);
+ }
+ }
}
void
@@ -45,6 +52,9 @@
InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+#ifdef TOUCHSCREEN
+ KdInitTouchScreen (&TsFuncs);
+#endif
}
void