1 Star 0 Fork 44

panchenbo/xorg-x11-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
xorg-server-1.20.11-sw.patch 23.49 KB
一键复制 编辑 原始数据 按行查看 历史
kerongw 提交于 2022-11-18 06:51 . add sw64 architecture
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
From c99b7ba27942230458a127e9925d073ac75466af Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 26 Aug 2022 11:09:12 +0000
Subject: [PATCH] sw
---
configure | 24 +++
configure.ac | 9 +
hw/xfree86/common/compiler.h | 24 ++-
hw/xfree86/dri/dri.c | 2 +-
hw/xfree86/dri/sarea.h | 2 +-
hw/xfree86/os-support/bsd/Makefile.am | 6 +
hw/xfree86/os-support/bsd/Makefile.in | 24 ++-
hw/xfree86/os-support/bsd/sw_64_video.c | 234 ++++++++++++++++++++++++
hw/xfree86/os-support/linux/lnx_video.c | 4 +-
hw/xfree86/os-support/meson.build | 2 +
hw/xfree86/os-support/misc/SlowBcopy.c | 4 +-
include/do-not-use-config.h.in | 3 +
include/xorg-config.h.in | 3 +
include/xorg-config.h.meson.in | 3 +
xkb/xkbInit.c | 2 +-
15 files changed, 322 insertions(+), 24 deletions(-)
create mode 100644 hw/xfree86/os-support/bsd/sw_64_video.c
diff --git a/configure b/configure
index 7e53cbd..009e48a 100755
--- a/configure
+++ b/configure
@@ -1055,6 +1055,8 @@ I386_VIDEO_FALSE
I386_VIDEO_TRUE
ARM_VIDEO_FALSE
ARM_VIDEO_TRUE
+SW_64_VIDEO_FALSE
+SW_64_VIDEO_TRUE
ALPHA_VIDEO_FALSE
ALPHA_VIDEO_TRUE
GLX_ARCH_DEFINES
@@ -23208,6 +23210,16 @@ DEFAULT_INT10="x86emu"
case $host_cpu in
+ sw_64*)
+ SW_64_VIDEO=yes
+ case $host_os in
+ *freebsd*) SYS_LIBS=-lio ;;
+ *netbsd*)
+$as_echo "#define USE_SW_64_PIO 1" >>confdefs.h
+ ;;
+ esac
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
+ ;;
alpha*)
ALPHA_VIDEO=yes
case $host_os in
@@ -23289,6 +23301,14 @@ else
ALPHA_VIDEO_FALSE=
fi
+ if test "x$SW_64_VIDEO" = xyes; then
+ SW_64_VIDEO_TRUE=
+ SW_64_VIDEO_FALSE='#'
+else
+ SW_64_VIDEO_TRUE='#'
+ SW_64_VIDEO_FALSE=
+fi
+
if test "x$ARM_VIDEO" = xyes; then
ARM_VIDEO_TRUE=
ARM_VIDEO_FALSE='#'
@@ -32898,6 +32918,10 @@ if test -z "${BSD_KQUEUE_APM_TRUE}" && test -z "${BSD_KQUEUE_APM_FALSE}"; then
as_fn_error $? "conditional \"BSD_KQUEUE_APM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${SW_64_VIDEO_TRUE}" && test -z "${SW_64_VIDEO_FALSE}"; then
+ as_fn_error $? "conditional \"SW_64_VIDEO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ALPHA_VIDEO_TRUE}" && test -z "${ALPHA_VIDEO_FALSE}"; then
as_fn_error $? "conditional \"ALPHA_VIDEO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 7ba6d05..3a8b759 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,14 @@ DEFAULT_INT10="x86emu"
dnl Override defaults as needed for specific platforms:
case $host_cpu in
+ sw_64*)
+ SW_64_VIDEO=yes
+ case $host_os in
+ *freebsd*) SYS_LIBS=-lio ;;
+ *netbsd*) AC_DEFINE(USE_SW_64_PIO, 1, [NetBSD PIO sw_64 IO]) ;;
+ esac
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
+ ;;
alpha*)
ALPHA_VIDEO=yes
case $host_os in
@@ -319,6 +327,7 @@ AC_SUBST(GLX_ARCH_DEFINES)
dnl BSD *_video.c selection
AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
+AM_CONDITIONAL(SW_64_VIDEO, [test "x$SW_64_VIDEO" = xyes])
AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 2b2008b..c416d65 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -99,6 +99,7 @@
#if !defined(__arm__)
#if !defined(__sparc__) && !defined(__arm32__) && !defined(__nds32__) \
&& !(defined(__alpha__) && defined(__linux__)) \
+ && !(defined(__sw_64__) && defined(__linux__)) \
&& !(defined(__ia64__) && defined(__linux__)) \
&& !(defined(__mips64) && defined(__linux__)) \
@@ -109,7 +110,7 @@ extern _X_EXPORT unsigned int inb(unsigned short);
extern _X_EXPORT unsigned int inw(unsigned short);
extern _X_EXPORT unsigned int inl(unsigned short);
-#else /* __sparc__, __arm32__, __alpha__, __nds32__ */
+#else /* __sparc__, __arm32__, __alpha__, __sw_64__, __nds32__ */
extern _X_EXPORT void outb(unsigned long, unsigned char);
extern _X_EXPORT void outw(unsigned long, unsigned short);
extern _X_EXPORT void outl(unsigned long, unsigned int);
@@ -129,7 +130,7 @@ extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int);
extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int);
extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
#endif /* _SUNPRO_C */
-#endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
+#endif /* __sparc__, __arm32__, __alpha__, __sw_64__, __nds32__ */
#endif /* __arm__ */
#endif /* NO_INLINE || DO_PROTOTYPES */
@@ -149,6 +150,11 @@ extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
#define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
#endif
+#elif defined __sw_64__
+
+#define mem_barrier() __asm__ __volatile__ ("memb" : : : "memory")
+#define write_mem_barrier() __asm__ __volatile__ ("memb" : : : "memory")
+
#elif defined __alpha__
#define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
@@ -213,7 +219,7 @@ extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
#endif
#ifdef __GNUC__
-#if defined(__alpha__)
+#if defined(__alpha__) || defined(__sw_64__)
#ifdef __linux__
/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
@@ -955,7 +961,7 @@ inl(unsigned PORT_SIZE port)
#define MMIO_IS_BE
#endif
-#ifdef __alpha__
+#if defined __alpha__ || defined __sw_64__
static inline int
xf86ReadMmio8(void *Base, unsigned long Offset)
{
@@ -1068,7 +1074,7 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
xf86WriteMmio32(base, offset, (CARD32)(val))
#endif
-#else /* !__alpha__ && !__powerpc__ && !__sparc__ */
+#else /* !__alpha__ && !__sw_64__ && !__powerpc__ && !__sparc__ */
#define MMIO_IN8(base, offset) \
*(volatile CARD8 *)(((CARD8*)(base)) + (offset))
@@ -1083,19 +1089,19 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
#define MMIO_OUT32(base, offset, val) \
*(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-#endif /* __alpha__ */
+#endif /* __alpha__, __sw_64__ */
/*
* With Intel, the version in os-support/misc/SlowBcopy.s is used.
* This avoids port I/O during the copy (which causes problems with
* some hardware).
*/
-#ifdef __alpha__
+#if defined __alpha__ || defined __sw_64__
#define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
#define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
-#else /* __alpha__ */
+#else /* __alpha__, __sw_64__ */
#define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
#define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
-#endif /* __alpha__ */
+#endif /* __alpha__, __sw_64__ */
#endif /* _COMPILER_H */
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 9f70759..091681e 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -2012,7 +2012,7 @@ DRISpinLockTimeout(drmLock * lock, int val, unsigned long timeout /* in mS */ )
{
int count = 10000;
-#if !defined(__alpha__) && !defined(__powerpc__)
+#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sw_64__)
char ret;
#else
int ret;
diff --git a/hw/xfree86/dri/sarea.h b/hw/xfree86/dri/sarea.h
index 1bef242..cd7e416 100644
--- a/hw/xfree86/dri/sarea.h
+++ b/hw/xfree86/dri/sarea.h
@@ -39,7 +39,7 @@
#include "xf86drm.h"
/* SAREA area needs to be at least a page */
-#if defined(__alpha__)
+#if defined(__alpha__) || defined(__sw_64__)
#define SAREA_MAX 0x2000
#elif defined(__ia64__)
#define SAREA_MAX 0x10000 /* 64kB */
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 66ac838..38fe659 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -29,6 +29,12 @@ ARCH_SOURCES = \
alpha_video.c
endif
+if SW_64_VIDEO
+# Cheat here and piggyback other sw_64 bits on SW_64_VIDEO.
+ARCH_SOURCES = \
+ sw_64_video.c
+endif
+
if ARM_VIDEO
ARCH_SOURCES = arm_video.c
endif
diff --git a/hw/xfree86/os-support/bsd/Makefile.in b/hw/xfree86/os-support/bsd/Makefile.in
index 21495a2..ba525eb 100644
--- a/hw/xfree86/os-support/bsd/Makefile.in
+++ b/hw/xfree86/os-support/bsd/Makefile.in
@@ -113,19 +113,20 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
libbsd_la_LIBADD =
am__libbsd_la_SOURCES_DIST = $(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c $(srcdir)/../shared/vidmem.c \
- bsd_VTsw.c bsd_init.c bsd_bell.c alpha_video.c arm_video.c \
+ bsd_VTsw.c bsd_init.c bsd_bell.c alpha_video.c sw_64_video.c arm_video.c \
i386_video.c ppc_video.c sparc64_video.c \
$(srcdir)/../shared/ioperm_noop.c \
$(srcdir)/../shared/agp_noop.c $(srcdir)/../linux/lnx_agp.c \
$(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \
$(srcdir)/bsd_kqueue_apm.c $(srcdir)/../shared/kmod_noop.c \
bsd_kmod.c
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@am__objects_1 = sparc64_video.lo \
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@ ioperm_noop.lo
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_TRUE@am__objects_1 = ppc_video.lo
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_TRUE@am__objects_1 = i386_video.lo
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_TRUE@am__objects_1 = arm_video.lo
-@ALPHA_VIDEO_TRUE@am__objects_1 = alpha_video.lo
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@am__objects_1 = sparc64_video.lo \
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@ ioperm_noop.lo
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_TRUE@am__objects_1 = ppc_video.lo
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_TRUE@am__objects_1 = i386_video.lo
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_FALSE@@ARM_VIDEO_TRUE@am__objects_1 = arm_video.lo
+@SW_64_VIDEO_FALSE@@ALPHA_VIDEO_TRUE@am__objects_1 = alpha_video.lo
+@SW_64_VIDEO_TURE@am__objects_1 = sw_64_video.lo
@AGP_FALSE@am__objects_2 = agp_noop.lo
@AGP_TRUE@am__objects_2 = lnx_agp.lo
@BSD_APM_FALSE@@BSD_KQUEUE_APM_FALSE@am__objects_3 = pm_noop.lo
@@ -157,7 +158,7 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/agp_noop.Plo \
- ./$(DEPDIR)/alpha_video.Plo ./$(DEPDIR)/arm_video.Plo \
+ ./$(DEPDIR)/alpha_video.Plo ./$(DEPDIR)/sw_64_video.Plo ./$(DEPDIR)/arm_video.Plo \
./$(DEPDIR)/bsd_VTsw.Plo ./$(DEPDIR)/bsd_apm.Plo \
./$(DEPDIR)/bsd_bell.Plo ./$(DEPDIR)/bsd_init.Plo \
./$(DEPDIR)/bsd_kmod.Plo ./$(DEPDIR)/bsd_kqueue_apm.Plo \
@@ -587,6 +588,10 @@ noinst_LTLIBRARIES = libbsd.la
@ALPHA_VIDEO_TRUE@ARCH_SOURCES = \
@ALPHA_VIDEO_TRUE@ alpha_video.c
+# Cheat here and piggyback other sw_64 bits on SW_64_VIDEO.
+@SW_64_VIDEO_TRUE@ARCH_SOURCES = \
+@SW_64_VIDEO_TRUE@ sw_64_video.c
+
@ARM_VIDEO_TRUE@ARCH_SOURCES = arm_video.c
@I386_VIDEO_TRUE@ARCH_SOURCES = i386_video.c
@PPC_VIDEO_TRUE@ARCH_SOURCES = ppc_video.c
@@ -676,6 +681,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_video.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sw_64_video.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_video.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_VTsw.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_apm.Plo@am__quote@ # am--include-marker
@@ -924,6 +930,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f ./$(DEPDIR)/agp_noop.Plo
-rm -f ./$(DEPDIR)/alpha_video.Plo
+ -rm -f ./$(DEPDIR)/sw_64_video.Plo
-rm -f ./$(DEPDIR)/arm_video.Plo
-rm -f ./$(DEPDIR)/bsd_VTsw.Plo
-rm -f ./$(DEPDIR)/bsd_apm.Plo
@@ -988,6 +995,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/agp_noop.Plo
-rm -f ./$(DEPDIR)/alpha_video.Plo
+ -rm -f ./$(DEPDIR)/sw_64_video.Plo
-rm -f ./$(DEPDIR)/arm_video.Plo
-rm -f ./$(DEPDIR)/bsd_VTsw.Plo
-rm -f ./$(DEPDIR)/bsd_apm.Plo
diff --git a/hw/xfree86/os-support/bsd/sw_64_video.c b/hw/xfree86/os-support/bsd/sw_64_video.c
new file mode 100644
index 0000000..7c42435
--- /dev/null
+++ b/hw/xfree86/os-support/bsd/sw_64_video.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * 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 names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#include <sys/param.h>
+#ifndef __NetBSD__
+#include <sys/sysctl.h>
+#endif
+
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(__NetBSD__) && !defined(MAP_FILE)
+#define MAP_FLAGS MAP_SHARED
+#else
+#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
+#endif
+
+#ifndef __NetBSD__
+extern unsigned long dense_base(void);
+#else /* __NetBSD__ */
+static struct sw_64_bus_window *abw;
+static int abw_count = -1;
+
+static void
+init_abw(void)
+{
+ if (abw_count < 0) {
+ abw_count = sw_64_bus_getwindows(SW_64_BUS_TYPE_PCI_MEM, &abw);
+ if (abw_count <= 0)
+ FatalError("init_abw: sw_64_bus_getwindows failed\n");
+ }
+}
+
+static unsigned long
+dense_base(void)
+{
+ if (abw_count < 0)
+ init_abw();
+
+ /* XXX check abst_flags for ABST_DENSE just to be safe? */
+ xf86Msg(X_INFO, "dense base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
+ return abw[0].abw_abst.abst_sys_start;
+}
+
+#endif /* __NetBSD__ */
+
+#define BUS_BASE dense_base()
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+#ifdef __OpenBSD__
+#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
+ "\tin /etc/sysctl.conf and reboot your machine\n" \
+ "\trefer to xf86(4) for details"
+#endif
+
+static int devMemFd = -1;
+
+#ifdef HAS_APERTURE_DRV
+#define DEV_APERTURE "/dev/xf86"
+#endif
+
+/*
+ * Check if /dev/mem can be mmap'd. If it can't print a warning when
+ * "warn" is TRUE.
+ */
+static void
+checkDevMem(Bool warn)
+{
+ static Bool devMemChecked = FALSE;
+ int fd;
+ void *base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+#ifdef HAS_APERTURE_DRV
+ /* Try the aperture driver first */
+ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
+ DEV_APERTURE);
+ return;
+ }
+ else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_APERTURE, strerror(errno));
+ }
+ }
+ }
+#endif
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t) 0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t) 0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t) base, 4096);
+ devMemFd = fd;
+ return;
+ }
+ else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ }
+ }
+ if (warn) {
+#ifndef HAS_APERTURE_DRV
+ xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+#else
+#ifndef __OpenBSD__
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
+#else /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
+ SYSCTL_MSG);
+#endif /* __OpenBSD__ */
+#endif
+ xf86ErrorF("\tlinear framebuffer access unavailable\n");
+ }
+ return;
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ checkDevMem(TRUE);
+
+ pVidMem->initialised = TRUE;
+}
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+
+extern int ioperm(unsigned long from, unsigned long num, int on);
+
+Bool
+xf86EnableIO()
+{
+ if (!ioperm(0, 65536, TRUE))
+ return TRUE;
+ return FALSE;
+}
+
+void
+xf86DisableIO()
+{
+ return;
+}
+
+#endif /* __FreeBSD_kernel__ || __OpenBSD__ */
+
+#ifdef USE_SW_64_PIO
+
+Bool
+xf86EnableIO()
+{
+ sw_64_pci_io_enable(1);
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ sw_64_pci_io_enable(0);
+}
+
+#endif /* USE_SW_64_PIO */
+
+extern int readDense8(void *Base, register unsigned long Offset);
+extern int readDense16(void *Base, register unsigned long Offset);
+extern int readDense32(void *Base, register unsigned long Offset);
+extern void
+ writeDense8(int Value, void *Base, register unsigned long Offset);
+extern void
+ writeDense16(int Value, void *Base, register unsigned long Offset);
+extern void
+ writeDense32(int Value, void *Base, register unsigned long Offset);
+
+void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
+ = writeDense8;
+void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
+ = writeDense16;
+void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
+ = writeDense32;
+int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
+ = readDense8;
+int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
+ = readDense16;
+int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
+ = readDense32;
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 04e4509..d4d7349 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -111,7 +111,7 @@ hwDisableIO(void)
}
#elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \
- defined(__alpha__)
+ defined(__alpha__) || defined(__sw_64__)
static Bool
hwEnableIO(void)
@@ -121,7 +121,7 @@ hwEnableIO(void)
strerror(errno));
return FALSE;
}
-#if !defined(__alpha__)
+#if !defined(__alpha__) && !defined(__sw_64__)
/* XXX: this is actually not trapping anything because of iopl(3)
* above */
ioperm(0x40, 4, 0); /* trap access to the timer chip */
diff --git a/hw/xfree86/os-support/meson.build b/hw/xfree86/os-support/meson.build
index b6e5c97..0e2a127 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -100,6 +100,8 @@ elif host_machine.system().endswith('bsd')
srcs_xorg_os_support += 'shared/ioperm_noop.c'
elif host_machine.cpu_family() == 'alpha'
srcs_xorg_os_support += 'bsd/alpha_video.c'
+ elif host_machine.cpu_family() == 'sw_64'
+ srcs_xorg_os_support += 'bsd/sw_64_video.c'
endif
if host_machine.system() == 'freebsd'
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index 9d82c71..a7d9a7b 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- for Alpha Linux
+ for Alpha/Sw_64 Linux
*******************************************************************************/
/*
@@ -55,7 +55,7 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
*dst++ = *src++;
}
-#ifdef __alpha__
+#if defined __alpha__ || defined __sw_64__
#ifdef __linux__
diff --git a/include/do-not-use-config.h.in b/include/do-not-use-config.h.in
index f421c61..f440b84 100644
--- a/include/do-not-use-config.h.in
+++ b/include/do-not-use-config.h.in
@@ -585,6 +585,9 @@
/* Support UNIX socket connections */
#undef UNIXCONN
+/* NetBSD PIO sw_64 IO */
+#undef USE_SW_64_PIO
+
/* NetBSD PIO alpha IO */
#undef USE_ALPHA_PIO
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index bf555eb..f40e1ca 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -82,6 +82,9 @@
/* Building vgahw module */
#undef WITH_VGAHW
+/* NetBSD PIO sw_64 IO */
+#undef USE_SW_64_PIO
+
/* NetBSD PIO alpha IO */
#undef USE_ALPHA_PIO
diff --git a/include/xorg-config.h.meson.in b/include/xorg-config.h.meson.in
index 1e4213f..27365f9 100644
--- a/include/xorg-config.h.meson.in
+++ b/include/xorg-config.h.meson.in
@@ -79,6 +79,9 @@
/* Building vgahw module */
#mesondefine WITH_VGAHW
+/* NetBSD PIO sw_64 IO */
+#mesondefine USE_SW_64_PIO
+
/* NetBSD PIO alpha IO */
#mesondefine USE_ALPHA_PIO
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 9e45b4b..c290fac 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -53,7 +53,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1)
-#if defined(__alpha) || defined(__alpha__)
+#if defined(__alpha) || defined(__alpha__) || defined(__sw_64) || defined(__sw_64__)
#define LED_COMPOSE 2
#define LED_CAPS 3
#define LED_SCROLL 4
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/panchenbo/xorg-x11-server.git
git@gitee.com:panchenbo/xorg-x11-server.git
panchenbo
xorg-x11-server
xorg-x11-server
master

搜索帮助