summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/os-support/bsd
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2016-03-27 18:48:42 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2016-03-27 18:48:42 +0000
commitb9f5c675a3b283a76833710c63b3d95e53295636 (patch)
treef2cf1a051dd0931a095baed807a1a5a30022c07a /xserver/hw/xfree86/os-support/bsd
parent536477fc01accae88f0e8d344feb68bc0c266055 (diff)
Make alpha_video.c build in recent X server.
Completely broken on VGA cards (libpciaccess doesn't know about the alpha specific ways of mapping the PCI space), only XRender is broken on TGA cards.
Diffstat (limited to 'xserver/hw/xfree86/os-support/bsd')
-rw-r--r--xserver/hw/xfree86/os-support/bsd/alpha_video.c78
1 files changed, 20 insertions, 58 deletions
diff --git a/xserver/hw/xfree86/os-support/bsd/alpha_video.c b/xserver/hw/xfree86/os-support/bsd/alpha_video.c
index 8bf779d69..df3eecf1a 100644
--- a/xserver/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/xserver/hw/xfree86/os-support/bsd/alpha_video.c
@@ -38,8 +38,7 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#include <machine/sysarch.h>
#endif
-
-#include "shared/xf86Axp.h"
+#include <machine/cpu.h>
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -95,6 +94,25 @@ memory_base(void)
}
#endif /* __NetBSD__ */
+static int
+has_bwx(void)
+{
+ static int bwx = 0;
+ size_t len = sizeof(bwx);
+ int error;
+
+ int mib[3];
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_BWX;
+
+ if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0)
+ return FALSE;
+ else
+ return bwx;
+}
+
#define BUS_BASE dense_base()
#define BUS_BASE_BWX memory_base()
@@ -191,72 +209,16 @@ void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
if (has_bwx()) {
xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
}
else {
xf86Msg(X_PROBED, "Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
-#ifndef __NetBSD__
- if (axpSystem == -1)
- axpSystem = bsdGetAXP();
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
-#endif /* __NetBSD__ */
}
pVidMem->initialised = TRUE;
}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
-
- checkDevMem(FALSE);
- Base = Base & ((1L << 32) - 1);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%lx outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
/*
* Read BIOS via mmap()ing DEV_MEM