From d9dd2f6f432a58b09bc805c6493095b4dde79cc0 Mon Sep 17 00:00:00 2001 From: wxiat Date: Wed, 2 Aug 2023 15:13:56 +0800 Subject: [PATCH 1/2] cherry-pick `add sw arch #1ba6a0036d929c82c5516a18350d5c27cc28e210`. Signed-off-by: Weisson --- xorg-server-1.20.11-sw.patch | 632 +++++++++++++++++++++++++++++++++++ xorg-x11-server.spec | 6 +- 2 files changed, 637 insertions(+), 1 deletion(-) create mode 100644 xorg-server-1.20.11-sw.patch diff --git a/xorg-server-1.20.11-sw.patch b/xorg-server-1.20.11-sw.patch new file mode 100644 index 0000000..facedf6 --- /dev/null +++ b/xorg-server-1.20.11-sw.patch @@ -0,0 +1,632 @@ +diff -Nuar xorg-server-1.20.11.org/configure xorg-server-1.20.11.sw/configure +--- xorg-server-1.20.11.org/configure 2023-08-02 13:40:40.511356223 +0800 ++++ xorg-server-1.20.11.sw/configure 2023-08-02 13:53:15.543952064 +0800 +@@ -1055,6 +1055,8 @@ + 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 @@ + + + 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 @@ + 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 @@ + 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 -Nuar xorg-server-1.20.11.org/configure.ac xorg-server-1.20.11.sw/configure.ac +--- xorg-server-1.20.11.org/configure.ac 2023-08-02 13:40:40.510356188 +0800 ++++ xorg-server-1.20.11.sw/configure.ac 2023-08-02 13:56:59.616842856 +0800 +@@ -257,6 +257,14 @@ + 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_ALPHA_PIO, 1, [NetBSD PIO sw_64 IO]) ;; ++ esac ++ GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ++ ;; + alpha*) + ALPHA_VIDEO=yes + case $host_os in +@@ -318,6 +326,7 @@ + + 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/common/compiler.h xorg-server-1.20.11.sw/hw/xfree86/common/compiler.h +--- xorg-server-1.20.11.org/hw/xfree86/common/compiler.h 2023-08-02 13:40:40.532356964 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/common/compiler.h 2023-08-02 14:07:16.099576881 +0800 +@@ -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 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 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 @@ + #define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") + #endif + ++#elif defined __sw_64__ ++ ++#define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory") ++#define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory") ++ + #elif defined __alpha__ + + #define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory") +@@ -213,7 +219,7 @@ + #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 @@ + #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 @@ + 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 @@ + #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 -Nuar xorg-server-1.20.11.org/hw/xfree86/dri/dri.c xorg-server-1.20.11.sw/hw/xfree86/dri/dri.c +--- xorg-server-1.20.11.org/hw/xfree86/dri/dri.c 2023-08-02 13:40:40.529356858 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/dri/dri.c 2023-08-02 14:09:08.899555230 +0800 +@@ -2012,7 +2012,7 @@ + { + int count = 10000; + +-#if !defined(__alpha__) && !defined(__powerpc__) ++#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sw_64__) + char ret; + #else + int ret; +diff -Nuar xorg-server-1.20.11.org/hw/xfree86/dri/sarea.h xorg-server-1.20.11.sw/hw/xfree86/dri/sarea.h +--- xorg-server-1.20.11.org/hw/xfree86/dri/sarea.h 2023-08-02 13:40:40.529356858 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/dri/sarea.h 2023-08-02 14:10:14.417866001 +0800 +@@ -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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.am xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.am +--- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.am 2023-08-02 13:40:40.524356682 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.am 2023-08-02 14:13:17.196312432 +0800 +@@ -29,6 +29,12 @@ + 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.in xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.in +--- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.in 2023-08-02 13:40:40.524356682 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.in 2023-08-02 14:28:08.627761541 +0800 +@@ -113,19 +113,20 @@ + 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_TRUE@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 @@ + 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 @@ + @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 @@ + + @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 @@ + 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 @@ + 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/sw_64_video.c xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/sw_64_video.c +--- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/sw_64_video.c 1970-01-01 08:00:00.000000000 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/sw_64_video.c 2023-08-02 14:37:16.117075270 +0800 +@@ -0,0 +1,234 @@ ++/* ++ * Copyright 1992 by Rich Murphey ++ * Copyright 1993 by David Wexelblat ++ * ++ * 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 ++#endif ++ ++#include ++#include "xf86.h" ++#include "xf86Priv.h" ++ ++#include ++#ifndef __NetBSD__ ++#include ++#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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/linux/lnx_video.c xorg-server-1.20.11.sw/hw/xfree86/os-support/linux/lnx_video.c +--- xorg-server-1.20.11.org/hw/xfree86/os-support/linux/lnx_video.c 2023-08-02 13:40:40.524356682 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/linux/lnx_video.c 2023-08-02 14:40:33.286028803 +0800 +@@ -111,7 +111,7 @@ + } + + #elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \ +- defined(__alpha__) ++ defined(__alpha__) || defined(__sw_64__) + + static Bool + hwEnableIO(void) +@@ -121,7 +121,7 @@ + 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/meson.build xorg-server-1.20.11.sw/hw/xfree86/os-support/meson.build +--- xorg-server-1.20.11.org/hw/xfree86/os-support/meson.build 2023-08-02 13:40:40.525356717 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/meson.build 2023-08-02 14:42:17.587707195 +0800 +@@ -100,6 +100,8 @@ + 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/misc/SlowBcopy.c xorg-server-1.20.11.sw/hw/xfree86/os-support/misc/SlowBcopy.c +--- xorg-server-1.20.11.org/hw/xfree86/os-support/misc/SlowBcopy.c 2023-08-02 13:40:40.526356753 +0800 ++++ xorg-server-1.20.11.sw/hw/xfree86/os-support/misc/SlowBcopy.c 2023-08-02 14:56:42.832229374 +0800 +@@ -1,5 +1,5 @@ + /******************************************************************************* +- for Alpha Linux ++ for Alpha/Sw_64 Linux + *******************************************************************************/ + + /* +@@ -55,7 +55,7 @@ + *dst++ = *src++; + } + +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + + #ifdef __linux__ + +diff -Nuar xorg-server-1.20.11.org/include/do-not-use-config.h.in xorg-server-1.20.11.sw/include/do-not-use-config.h.in +--- xorg-server-1.20.11.org/include/do-not-use-config.h.in 2023-08-02 13:40:40.563358058 +0800 ++++ xorg-server-1.20.11.sw/include/do-not-use-config.h.in 2023-08-02 14:58:15.612503621 +0800 +@@ -585,6 +585,10 @@ + /* Support UNIX socket connections */ + #undef UNIXCONN + ++/* NetBSD PIO sw_64 IO */ ++#undef USE_SW_64_PIO ++ ++/* BSD AMD64 iopl */ + /* NetBSD PIO alpha IO */ + #undef USE_ALPHA_PIO + +diff -Nuar xorg-server-1.20.11.org/include/xorg-config.h.in xorg-server-1.20.11.sw/include/xorg-config.h.in +--- xorg-server-1.20.11.org/include/xorg-config.h.in 2023-08-02 13:40:40.562358023 +0800 ++++ xorg-server-1.20.11.sw/include/xorg-config.h.in 2023-08-02 15:00:59.297280111 +0800 +@@ -82,6 +82,10 @@ + /* Building vgahw module */ + #undef WITH_VGAHW + ++/* NetBSD PIO sw_64 IO */ ++#undef USE_SW_64_PIO ++ ++/* BSD AMD64 iopl */ + /* NetBSD PIO alpha IO */ + #undef USE_ALPHA_PIO + +diff -Nuar xorg-server-1.20.11.org/include/xorg-config.h.meson.in xorg-server-1.20.11.sw/include/xorg-config.h.meson.in +--- xorg-server-1.20.11.org/include/xorg-config.h.meson.in 2023-08-02 13:40:40.562358023 +0800 ++++ xorg-server-1.20.11.sw/include/xorg-config.h.meson.in 2023-08-02 15:02:12.088848947 +0800 +@@ -79,6 +79,10 @@ + /* Building vgahw module */ + #mesondefine WITH_VGAHW + ++/* NetBSD PIO sw_64 IO */ ++#mesondefine USE_SW_64_PIO ++ ++/* BSD AMD64 iopl */ + /* NetBSD PIO alpha IO */ + #mesondefine USE_ALPHA_PIO + +diff -Nuar xorg-server-1.20.11.org/xkb/xkbInit.c xorg-server-1.20.11.sw/xkb/xkbInit.c +--- xorg-server-1.20.11.org/xkb/xkbInit.c 2023-08-02 13:40:40.577358552 +0800 ++++ xorg-server-1.20.11.sw/xkb/xkbInit.c 2023-08-02 15:04:12.242089191 +0800 +@@ -53,7 +53,7 @@ + + #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 diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 0e89f8a..2546d3f 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -9,7 +9,7 @@ # check out the master branch, pull, cherry-pick, and push. # X.org requires lazy relocations to work. -%define anolis_release .0.1 +%define anolis_release .0.2 %undefine _hardened_build %undefine _strict_symbol_defs_build @@ -149,6 +149,7 @@ Patch10026: 0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch # upstream: 26ef545b3502f61ca722a7a3373507e88ef64110 # CVE-2023-1393 Patch10027: 0001-composite-Fix-use-after-free-of-the-COW.patch +Patch10028: xorg-server-1.20.11-sw.patch BuildRequires: make BuildRequires: systemtap-sdt-devel @@ -612,6 +613,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Thu Mar 21 2024 wxiat - 1.20.11-16.0.2 +- cherry-pick `add sw arch #1ba6a0036d929c82c5516a18350d5c27cc28e210`. + * Thu Dec 26 2023 Kaiqiang Wang - 1.20.11-16.0.1 - CVE fix for: CVE-2023-1393 Resolves: rhbz#2180296 -- Gitee From 15f371c4841d1698875ba70b8912b7faac97ef4b Mon Sep 17 00:00:00 2001 From: Weisson Date: Thu, 29 Feb 2024 15:14:42 +0800 Subject: [PATCH 2/2] cherry-pick: `add sw arch #3b1aa1ee2c00aeebe71a618589826c2d1cab136e`. Signed-off-by: Weisson --- xorg-server-1.20.11-sw.patch | 352 ++++++++++++----------------------- xorg-x11-server.spec | 5 +- 2 files changed, 127 insertions(+), 230 deletions(-) diff --git a/xorg-server-1.20.11-sw.patch b/xorg-server-1.20.11-sw.patch index facedf6..fb97b51 100644 --- a/xorg-server-1.20.11-sw.patch +++ b/xorg-server-1.20.11-sw.patch @@ -1,64 +1,32 @@ -diff -Nuar xorg-server-1.20.11.org/configure xorg-server-1.20.11.sw/configure ---- xorg-server-1.20.11.org/configure 2023-08-02 13:40:40.511356223 +0800 -+++ xorg-server-1.20.11.sw/configure 2023-08-02 13:53:15.543952064 +0800 -@@ -1055,6 +1055,8 @@ - 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 @@ - - - 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 @@ - 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 @@ - 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 -Nuar xorg-server-1.20.11.org/configure.ac xorg-server-1.20.11.sw/configure.ac ---- xorg-server-1.20.11.org/configure.ac 2023-08-02 13:40:40.510356188 +0800 -+++ xorg-server-1.20.11.sw/configure.ac 2023-08-02 13:56:59.616842856 +0800 -@@ -257,6 +257,14 @@ +From 3ae0cebb8e57926591d659dd43c72f961cc94990 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 29 Feb 2024 10:50:12 +0800 +Subject: [PATCH] xorg-server-1.20.11-sw.patch + +Signed-off-by: rpm-build +--- + 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/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/xorg-config.h.in | 4 + + include/xorg-config.h.meson.in | 4 + + xkb/xkbInit.c | 2 +- + 12 files changed, 281 insertions(+), 16 deletions(-) + create mode 100644 hw/xfree86/os-support/bsd/sw_64_video.c + +diff --git a/configure.ac b/configure.ac +index 915941c..7a09cee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -257,6 +257,14 @@ DEFAULT_INT10="x86emu" dnl Override defaults as needed for specific platforms: - + case $host_cpu in + sw_64*) + SW_64_VIDEO=yes @@ -71,17 +39,18 @@ diff -Nuar xorg-server-1.20.11.org/configure.ac xorg-server-1.20.11.sw/configure alpha*) ALPHA_VIDEO=yes case $host_os in -@@ -318,6 +326,7 @@ - +@@ -318,6 +326,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 -Nuar xorg-server-1.20.11.org/hw/xfree86/common/compiler.h xorg-server-1.20.11.sw/hw/xfree86/common/compiler.h ---- xorg-server-1.20.11.org/hw/xfree86/common/compiler.h 2023-08-02 13:40:40.532356964 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/common/compiler.h 2023-08-02 14:07:16.099576881 +0800 +diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h +index 2b2008b..2657620 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__) \ @@ -89,71 +58,71 @@ diff -Nuar xorg-server-1.20.11.org/hw/xfree86/common/compiler.h xorg-server-1.20 + && !(defined(__sw_64__) && defined(__linux__)) \ && !(defined(__ia64__) && defined(__linux__)) \ && !(defined(__mips64) && defined(__linux__)) \ - -@@ -109,7 +110,7 @@ + +@@ -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 @@ +@@ -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 @@ +@@ -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__ ("mb" : : : "memory") -+#define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory") ++#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 @@ +@@ -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 @@ +@@ -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 @@ +@@ -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 @@ +@@ -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 @@ -169,39 +138,42 @@ diff -Nuar xorg-server-1.20.11.org/hw/xfree86/common/compiler.h xorg-server-1.20 #define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count) -#endif /* __alpha__ */ +#endif /* __alpha__, __sw_64__ */ - + #endif /* _COMPILER_H */ -diff -Nuar xorg-server-1.20.11.org/hw/xfree86/dri/dri.c xorg-server-1.20.11.sw/hw/xfree86/dri/dri.c ---- xorg-server-1.20.11.org/hw/xfree86/dri/dri.c 2023-08-02 13:40:40.529356858 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/dri/dri.c 2023-08-02 14:09:08.899555230 +0800 -@@ -2012,7 +2012,7 @@ +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 -Nuar xorg-server-1.20.11.org/hw/xfree86/dri/sarea.h xorg-server-1.20.11.sw/hw/xfree86/dri/sarea.h ---- xorg-server-1.20.11.org/hw/xfree86/dri/sarea.h 2023-08-02 13:40:40.529356858 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/dri/sarea.h 2023-08-02 14:10:14.417866001 +0800 +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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.am xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.am ---- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.am 2023-08-02 13:40:40.524356682 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.am 2023-08-02 14:13:17.196312432 +0800 -@@ -29,6 +29,12 @@ +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 = \ @@ -211,84 +183,11 @@ diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.am xorg-se if ARM_VIDEO ARCH_SOURCES = arm_video.c endif -diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.in xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.in ---- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/Makefile.in 2023-08-02 13:40:40.524356682 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/Makefile.in 2023-08-02 14:28:08.627761541 +0800 -@@ -113,19 +113,20 @@ - 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_TRUE@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 @@ - 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 @@ - @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 @@ - - @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 @@ - 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 @@ - 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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/sw_64_video.c xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/sw_64_video.c ---- xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/sw_64_video.c 1970-01-01 08:00:00.000000000 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/bsd/sw_64_video.c 2023-08-02 14:37:16.117075270 +0800 +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 @@ -524,19 +423,20 @@ diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/bsd/sw_64_video.c xorg- + = readDense16; +int (*xf86ReadMmio32) (void *Base, unsigned long Offset) + = readDense32; -diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/linux/lnx_video.c xorg-server-1.20.11.sw/hw/xfree86/os-support/linux/lnx_video.c ---- xorg-server-1.20.11.org/hw/xfree86/os-support/linux/lnx_video.c 2023-08-02 13:40:40.524356682 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/linux/lnx_video.c 2023-08-02 14:40:33.286028803 +0800 -@@ -111,7 +111,7 @@ +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 @@ +@@ -121,7 +121,7 @@ hwEnableIO(void) strerror(errno)); return FALSE; } @@ -545,88 +445,82 @@ diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/linux/lnx_video.c xorg- /* XXX: this is actually not trapping anything because of iopl(3) * above */ ioperm(0x40, 4, 0); /* trap access to the timer chip */ -diff -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/meson.build xorg-server-1.20.11.sw/hw/xfree86/os-support/meson.build ---- xorg-server-1.20.11.org/hw/xfree86/os-support/meson.build 2023-08-02 13:40:40.525356717 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/meson.build 2023-08-02 14:42:17.587707195 +0800 -@@ -100,6 +100,8 @@ +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 -Nuar xorg-server-1.20.11.org/hw/xfree86/os-support/misc/SlowBcopy.c xorg-server-1.20.11.sw/hw/xfree86/os-support/misc/SlowBcopy.c ---- xorg-server-1.20.11.org/hw/xfree86/os-support/misc/SlowBcopy.c 2023-08-02 13:40:40.526356753 +0800 -+++ xorg-server-1.20.11.sw/hw/xfree86/os-support/misc/SlowBcopy.c 2023-08-02 14:56:42.832229374 +0800 +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 @@ +@@ -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 -Nuar xorg-server-1.20.11.org/include/do-not-use-config.h.in xorg-server-1.20.11.sw/include/do-not-use-config.h.in ---- xorg-server-1.20.11.org/include/do-not-use-config.h.in 2023-08-02 13:40:40.563358058 +0800 -+++ xorg-server-1.20.11.sw/include/do-not-use-config.h.in 2023-08-02 14:58:15.612503621 +0800 -@@ -585,6 +585,10 @@ - /* Support UNIX socket connections */ - #undef UNIXCONN - -+/* NetBSD PIO sw_64 IO */ -+#undef USE_SW_64_PIO -+ -+/* BSD AMD64 iopl */ - /* NetBSD PIO alpha IO */ - #undef USE_ALPHA_PIO - -diff -Nuar xorg-server-1.20.11.org/include/xorg-config.h.in xorg-server-1.20.11.sw/include/xorg-config.h.in ---- xorg-server-1.20.11.org/include/xorg-config.h.in 2023-08-02 13:40:40.562358023 +0800 -+++ xorg-server-1.20.11.sw/include/xorg-config.h.in 2023-08-02 15:00:59.297280111 +0800 + +diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in +index bf555eb..c1dc7b6 100644 +--- a/include/xorg-config.h.in ++++ b/include/xorg-config.h.in @@ -82,6 +82,10 @@ /* Building vgahw module */ #undef WITH_VGAHW - + +/* NetBSD PIO sw_64 IO */ +#undef USE_SW_64_PIO + +/* BSD AMD64 iopl */ /* NetBSD PIO alpha IO */ #undef USE_ALPHA_PIO - -diff -Nuar xorg-server-1.20.11.org/include/xorg-config.h.meson.in xorg-server-1.20.11.sw/include/xorg-config.h.meson.in ---- xorg-server-1.20.11.org/include/xorg-config.h.meson.in 2023-08-02 13:40:40.562358023 +0800 -+++ xorg-server-1.20.11.sw/include/xorg-config.h.meson.in 2023-08-02 15:02:12.088848947 +0800 + +diff --git a/include/xorg-config.h.meson.in b/include/xorg-config.h.meson.in +index 1e4213f..96d86b2 100644 +--- a/include/xorg-config.h.meson.in ++++ b/include/xorg-config.h.meson.in @@ -79,6 +79,10 @@ /* Building vgahw module */ #mesondefine WITH_VGAHW - + +/* NetBSD PIO sw_64 IO */ +#mesondefine USE_SW_64_PIO + +/* BSD AMD64 iopl */ /* NetBSD PIO alpha IO */ #mesondefine USE_ALPHA_PIO - -diff -Nuar xorg-server-1.20.11.org/xkb/xkbInit.c xorg-server-1.20.11.sw/xkb/xkbInit.c ---- xorg-server-1.20.11.org/xkb/xkbInit.c 2023-08-02 13:40:40.577358552 +0800 -+++ xorg-server-1.20.11.sw/xkb/xkbInit.c 2023-08-02 15:04:12.242089191 +0800 -@@ -53,7 +53,7 @@ - + +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.31.1 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 2546d3f..a42bf4c 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -9,7 +9,7 @@ # check out the master branch, pull, cherry-pick, and push. # X.org requires lazy relocations to work. -%define anolis_release .0.2 +%define anolis_release .0.3 %undefine _hardened_build %undefine _strict_symbol_defs_build @@ -613,6 +613,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Thu Mar 21 2024 Weisson - 1.20.11-16.0.3 +- cherry-pick: `add sw arch #3b1aa1ee2c00aeebe71a618589826c2d1cab136e`. + * Thu Mar 21 2024 wxiat - 1.20.11-16.0.2 - cherry-pick `add sw arch #1ba6a0036d929c82c5516a18350d5c27cc28e210`. -- Gitee