summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-11-02 21:18:16 -0700
committerKeith Packard <keithp@keithp.com>2011-11-02 21:18:16 -0700
commit8df3a9ca5abbd56eb2013fa65250d21a8f18865b (patch)
treea811d4763841f0b627a595072ad8c4524220419f
parent8329afa59dd5ea3adf7adebdb2111a9bccbb126b (diff)
parentef895484c8a43d447d9d3ea7d4226936cc5f92cc (diff)
Merge remote-tracking branch 'koba/reviewed'
-rw-r--r--hw/xfree86/os-support/bsd/alpha_video.c69
-rw-r--r--hw/xfree86/os-support/bsd/arm_video.c7
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c5
-rw-r--r--hw/xfree86/os-support/bsd/ppc_video.c9
-rw-r--r--hw/xfree86/os-support/bsd/sparc64_video.c4
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c4
-rw-r--r--hw/xfree86/os-support/shared/bios_mmap.c4
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h23
8 files changed, 23 insertions, 102 deletions
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index 15eb2a422..882fb3b46 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -33,12 +33,10 @@
#include <sys/param.h>
#ifndef __NetBSD__
-# include <sys/sysctl.h>
-# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-# include <machine/sysarch.h>
-# endif
-# else
-# include <machine/sysarch.h>
+#include <sys/sysctl.h>
+#endif
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
+#include <machine/sysarch.h>
#endif
#include "xf86Axp.h"
@@ -52,10 +50,6 @@
#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
#endif
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-
axpDevice bsdGetAXP(void);
#ifndef __NetBSD__
@@ -64,8 +58,6 @@ extern unsigned long dense_base(void);
static int axpSystem = -1;
static unsigned long hae_thresh;
static unsigned long hae_mask;
-static unsigned long bus_base;
-static unsigned long sparse_size;
static unsigned long
memory_base(void)
@@ -197,7 +189,6 @@ static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
#endif
-#define DEV_MEM "/dev/mem"
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
@@ -297,7 +288,6 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
axpSystem = bsdGetAXP();
hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
hae_mask = xf86AXPParams[axpSystem].hae_mask;
- sparse_size = xf86AXPParams[axpSystem].size;
#endif /* __NetBSD__ */
}
pVidMem->initialised = TRUE;
@@ -440,7 +430,6 @@ xf86DisableIO()
#define vuip volatile unsigned int *
-static unsigned long msb_set = 0;
static pointer memSBase = 0;
static pointer memBase = 0;
@@ -478,29 +467,25 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
extern int sysarch(int, void *);
-#endif
struct parms {
u_int64_t hae;
};
-#ifndef __NetBSD__
-static int
+static void
sethae(u_int64_t hae)
{
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#ifndef ALPHA_SETHAE
#define ALPHA_SETHAE 0
#endif
- struct parms p;
- p.hae = hae;
- return (sysarch(ALPHA_SETHAE, (char *)&p));
-#endif
-#ifdef __OpenBSD__
- return -1;
-#endif
+ static struct parms p;
+
+ if (p.hae != hae) {
+ p.hae = hae;
+ sysarch(ALPHA_SETHAE, (char *)&p);
+ }
}
-#endif /* __NetBSD__ */
+#endif
static pointer
mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
@@ -555,12 +540,9 @@ readSparse8(pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
result >>= shift;
@@ -579,12 +561,9 @@ readSparse16(pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2)));
result >>= shift;
@@ -609,12 +588,9 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
*(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
}
@@ -630,12 +606,9 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
*(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
w * 0x00010001;
@@ -660,12 +633,9 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
*(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
}
@@ -680,12 +650,9 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask ;
Offset -= msb;
- if (msb_set != msb) {
-#ifndef __NetBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
sethae(msb);
#endif
- msb_set = msb;
- }
}
*(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
w * 0x00010001;
diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index eb631a7f3..1de6c87d6 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -97,11 +97,6 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
#endif
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-
-
#define BUS_BASE 0L
#define BUS_BASE_BWX 0L
@@ -113,8 +108,6 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
static Bool useDevMem = FALSE;
static int devMemFd = -1;
-#define DEV_MEM "/dev/mem"
-
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 20dbde86a..35e00fce7 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -64,10 +64,6 @@
#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
#endif
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-
#ifdef __OpenBSD__
#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
"\tin /etc/sysctl.conf and reboot your machine\n" \
@@ -88,7 +84,6 @@ static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
#endif
-#define DEV_MEM "/dev/mem"
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c
index aeaf18305..e5d832eed 100644
--- a/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/hw/xfree86/os-support/bsd/ppc_video.c
@@ -36,18 +36,11 @@
#include "bus/Pci.h"
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-
-
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
-#ifndef __OpenBSD__
-#define DEV_MEM "/dev/mem"
-#else
+#ifdef __OpenBSD__
#define DEV_MEM "/dev/xf86"
#endif
diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c
index a2a30c9d7..960c850a8 100644
--- a/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -34,10 +34,6 @@
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 3d455112c..e711784e7 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -46,10 +46,6 @@
#include <asm/mtrr.h>
#endif
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
static Bool ExtendedEnabled = FALSE;
#ifdef __ia64__
diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c
index 33a8df042..b7b35d9db 100644
--- a/hw/xfree86/os-support/shared/bios_mmap.c
+++ b/hw/xfree86/os-support/shared/bios_mmap.c
@@ -31,10 +31,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
/*
* Read BIOS via mmap()ing DEV_MEM
*/
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 1d5906084..0a5861f49 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -230,20 +230,13 @@
# include <sys/mman.h>
# include <sys/stat.h>
-# if defined(__bsdi__)
-# include <sys/param.h>
-# if (_BSDI_VERSION < 199510)
-# include <i386/isa/vgaioctl.h>
-# endif
-# endif /* __bsdi__ */
-
#endif /* CSRG_BASED */
/**************************************************************************/
/* Kernel of *BSD */
/**************************************************************************/
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
- defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
+ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# include <sys/param.h>
# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
@@ -252,12 +245,6 @@
# if !defined(LINKKIT)
/* Don't need this stuff for the Link Kit */
-# if defined(__bsdi__)
-# include <i386/isa/pcconsioctl.h>
-# define CONSOLE_X_MODE_ON PCCONIOCRAW
-# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
-# define CONSOLE_X_BELL PCCONIOCBEEP
-# else /* __bsdi__ */
# ifdef SYSCONS_SUPPORT
# define COMPAT_SYSCONS
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@@ -328,7 +315,6 @@
#ifndef CONSOLE_GET_MEM_INFO
# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
#endif
-# endif /* __bsdi__ */
# endif /* !LINKKIT */
#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
@@ -337,8 +323,7 @@
# define CLEARDTR_SUPPORT
-#endif
-/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
/**************************************************************************/
/* IRIX */
@@ -378,8 +363,8 @@
#define DEV_MEM "/dev/mem"
#endif
-#ifndef VT_SYSREQ_DEFAULT
-#define VT_SYSREQ_DEFAULT FALSE
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
#endif
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))