summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2012-01-12 10:00:41 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2012-01-12 13:54:22 +0100
commit8ddbb3216d29b2ecd336d50461216feef0900fd9 (patch)
treee6ea0b6d8ed266ea3029e1a17a27bc95fa1df272
parent194ff6f1517d0a8250e64c3d768a9b7ae9ed3140 (diff)
vmware: Make sure the driver builds on old servers
Move things around a bit so the driver compiles with servers back to Xserver 1.0. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r--src/svga_reg.h1
-rw-r--r--src/vmware.c96
-rw-r--r--src/vmware.h10
-rw-r--r--src/vmware_bootstrap.c106
-rw-r--r--src/vmware_bootstrap.h14
5 files changed, 120 insertions, 107 deletions
diff --git a/src/svga_reg.h b/src/svga_reg.h
index 6757aa6..0e1aa17 100644
--- a/src/svga_reg.h
+++ b/src/svga_reg.h
@@ -75,6 +75,7 @@
/* Base and Offset gets us headed the right way for PCI Base Addr Registers */
#define SVGA_LEGACY_BASE_PORT 0x4560
+#define SVGA_NUM_PORTS 0x3
#define SVGA_MAGIC 0x900000UL
#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
diff --git a/src/vmware.c b/src/vmware.c
index 9160cf2..e2fb67b 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -17,9 +17,6 @@ char rcsId_vmware[] =
#include "xf86.h"
#include "xf86_OSproc.h"
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
-#include "xf86Resources.h"
-#endif
#include "compiler.h" /* inb/outb */
@@ -48,7 +45,43 @@ char rcsId_vmware[] =
#endif
#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5)
+
#define xf86LoaderReqSymLists(...) do {} while (0)
+#define LoaderRefSymLists(...) do {} while (0)
+
+#else
+
+const char *vgahwSymbols[] = {
+ "vgaHWGetHWRec",
+ "vgaHWGetIOBase",
+ "vgaHWGetIndex",
+ "vgaHWInit",
+ "vgaHWProtect",
+ "vgaHWRestore",
+ "vgaHWSave",
+ "vgaHWSaveScreen",
+ "vgaHWUnlock",
+ NULL
+};
+
+static const char *fbSymbols[] = {
+ "fbCreateDefColormap",
+ "fbPictureInit",
+ "fbScreenInit",
+ NULL
+};
+
+static const char *ramdacSymbols[] = {
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
+ "xf86InitCursor",
+ NULL
+};
+
+static const char *shadowfbSymbols[] = {
+ "ShadowFBInit2",
+ NULL
+};
#endif
/* Table of default modes to always add to the mode list. */
@@ -240,54 +273,6 @@ VMXGetVMwareSvgaId(VMWAREPtr pVMWARE)
return SVGA_ID_INVALID;
}
-#ifndef XSERVER_LIBPCIACCESS
-/*
- *----------------------------------------------------------------------
- *
- * RewriteTagString --
- *
- * Rewrites the given string, removing the $Name$, and
- * replacing it with the contents. The output string must
- * have enough room, or else.
- *
- * Results:
- *
- * Output string updated.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-RewriteTagString(const char *istr, char *ostr, int osize)
-{
- int chr;
- Bool inTag = FALSE;
- char *op = ostr;
-
- do {
- chr = *istr++;
- if (chr == '$') {
- if (inTag) {
- inTag = FALSE;
- for (; op > ostr && op[-1] == ' '; op--) {
- }
- continue;
- }
- if (strncmp(istr, "Name:", 5) == 0) {
- istr += 5;
- istr += strspn(istr, " ");
- inTag = TRUE;
- continue;
- }
- }
- *op++ = chr;
- } while (chr);
-}
-#endif
-
static Bool
VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
{
@@ -1653,3 +1638,12 @@ vmwlegacy_hookup(ScrnInfoPtr pScrn)
pScrn->FreeScreen = VMWAREFreeScreen;
pScrn->ValidMode = VMWAREValidMode;
}
+
+#ifdef XFree86LOADER
+void
+VMWARERefSymLists(void)
+{
+ LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols,
+ shadowfbSymbols, NULL);
+}
+#endif /* XFree86LOADER */
diff --git a/src/vmware.h b/src/vmware.h
index 0385292..632796e 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -42,6 +42,7 @@
#include "vm_basic_types.h"
#include "svga_reg.h"
#include "svga_struct.h"
+#include "vmware_bootstrap.h"
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
#define _swapl(x, n) swapl(x,n)
@@ -208,15 +209,6 @@ static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
#define MOUSE_ID 1
-/*#define DEBUG_LOGGING*/
-#ifdef DEBUG_LOGGING
-# define VmwareLog(args) ErrorF args
-# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
-#else
-# define VmwareLog(args)
-# define TRACEPOINT
-#endif
-
/* Undefine this to kill all acceleration */
#define ACCELERATE_OPS
diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index 522fec0..2f21c2a 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -36,6 +36,15 @@
#include "vm_device_version.h"
#include "vmware_bootstrap.h"
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
+#include "xf86Resources.h"
+#endif
+
+#ifndef XSERVER_LIBPCIACCESS
+#include "vm_basic_types.h"
+#include "svga_reg.h"
+#endif
+
#ifndef HAVE_XORG_SERVER_1_5_0
#include <xf86_ansic.h>
#include <xf86_libc.h>
@@ -295,6 +304,52 @@ VMwarePciProbe (DriverPtr drv,
}
#else
+/*
+ *----------------------------------------------------------------------
+ *
+ * RewriteTagString --
+ *
+ * Rewrites the given string, removing the $Name$, and
+ * replacing it with the contents. The output string must
+ * have enough room, or else.
+ *
+ * Results:
+ *
+ * Output string updated.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RewriteTagString(const char *istr, char *ostr, int osize)
+{
+ int chr;
+ Bool inTag = FALSE;
+ char *op = ostr;
+
+ do {
+ chr = *istr++;
+ if (chr == '$') {
+ if (inTag) {
+ inTag = FALSE;
+ for (; op > ostr && op[-1] == ' '; op--) {
+ }
+ continue;
+ }
+ if (strncmp(istr, "Name:", 5) == 0) {
+ istr += 5;
+ istr += strspn(istr, " ");
+ inTag = TRUE;
+ continue;
+ }
+ }
+ *op++ = chr;
+ } while (chr);
+}
+
static Bool
VMWAREProbe(DriverPtr drv, int flags)
{
@@ -339,16 +394,15 @@ VMWAREProbe(DriverPtr drv, int flags)
pScrn->driverName = VMWARE_DRIVER_NAME;
pScrn->name = VMWARE_NAME;
pScrn->Probe = VMWAREProbe;
- pScrn->PreInit = VMWAREPreInit;
#ifdef BUILD_VMWGFX
- vmwgfx_hookup(scrn);
+ vmwgfx_hookup(pScrn);
#else
- vmwlegacy_hookup(scrn);
+ vmwlegacy_hookup(pScrn);
#endif /* defined(BUILD_VMWGFX) */
- scrn->driverPrivate = scrn->PreInit;
- scrn->PreInit = VMwarePreinitStub;
+ pScrn->driverPrivate = pScrn->PreInit;
+ pScrn->PreInit = VMwarePreinitStub;
foundScreen = TRUE;
}
}
@@ -431,45 +485,6 @@ _X_EXPORT DriverRec vmware = {
#endif
};
-#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5)
-
-#define xf86LoaderReqSymLists(...) do {} while (0)
-#define LoaderRefSymLists(...) do {} while (0)
-
-#else
-
-const char *vgahwSymbols[] = {
- "vgaHWGetHWRec",
- "vgaHWGetIOBase",
- "vgaHWGetIndex",
- "vgaHWInit",
- "vgaHWProtect",
- "vgaHWRestore",
- "vgaHWSave",
- "vgaHWSaveScreen",
- "vgaHWUnlock",
- NULL
-};
-
-static const char *fbSymbols[] = {
- "fbCreateDefColormap",
- "fbPictureInit",
- "fbScreenInit",
- NULL
-};
-
-static const char *ramdacSymbols[] = {
- "xf86CreateCursorInfoRec",
- "xf86DestroyCursorInfoRec",
- "xf86InitCursor",
- NULL
-};
-
-static const char *shadowfbSymbols[] = {
- "ShadowFBInit2",
- NULL
-};
-#endif
#ifdef XFree86LOADER
static MODULESETUPPROTO(vmwareSetup);
@@ -490,8 +505,7 @@ vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin)
xf86AddDriver(&vmware, module, VMWARE_DRIVER_FUNC);
- LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols,
- shadowfbSymbols, NULL);
+ VMWARERefSymLists();
return (pointer)1;
}
diff --git a/src/vmware_bootstrap.h b/src/vmware_bootstrap.h
index 172deb8..f72d298 100644
--- a/src/vmware_bootstrap.h
+++ b/src/vmware_bootstrap.h
@@ -45,7 +45,6 @@ typedef enum {
} VMWAREOpts;
OptionInfoPtr VMWARECopyOptions(void);
-const char **vgahwSymbols;
void
vmwlegacy_hookup(ScrnInfoPtr pScrn);
@@ -55,5 +54,18 @@ void
vmwgfx_hookup(ScrnInfoPtr pScrn);
#endif /* defined(BUILD_VMWGFX) */
+#ifdef XFree86LOADER
+void
+VMWARERefSymLists(void);
+#endif /* XFree86LOADER */
+
+/*#define DEBUG_LOGGING*/
+#ifdef DEBUG_LOGGING
+# define VmwareLog(args) ErrorF args
+# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
+#else
+# define VmwareLog(args)
+# define TRACEPOINT
+#endif
#endif