xref: /OK3568_Linux_fs/external/xserver/debian/patches/04_compiler_h_inb_outb_mips.diff (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 5e9b9d11ce1662d0de6dd8b5e79e5f8870f7a397 Mon Sep 17 00:00:00 2001
2From: Julien Cristau <jcristau@debian.org>
3Date: Wed, 6 Jan 2021 10:20:53 +0100
4Subject: [PATCH] compiler.h: don't define inb/outb and friends on mips
5
6The definition relies on IOPortBase, which is only ever set in
7hw/xfree86/os-support/bsd/arm_video.c
8
9This caused build failures on linux/mips with GCC 10, because anything
10including compiler.h would get its own definition of IOPortBase.
11---
12 hw/xfree86/common/compiler.h          | 8 ++------
13 hw/xfree86/os-support/bsd/arm_video.c | 3 +++
14 2 files changed, 5 insertions(+), 6 deletions(-)
15
16diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
17index 2b2008b3f4..eb788d3fd7 100644
18--- a/hw/xfree86/common/compiler.h
19+++ b/hw/xfree86/common/compiler.h
20@@ -518,14 +518,10 @@ xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
21     barrier();
22 }
23
24-#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
25-#if defined(__arm32__) || defined(__mips64)
26+#elif defined(__arm32__) && !defined(__linux__)
27 #define PORT_SIZE long
28-#else
29-#define PORT_SIZE short
30-#endif
31
32-_X_EXPORT unsigned int IOPortBase;      /* Memory mapped I/O port area */
33+extern _X_EXPORT unsigned int IOPortBase;      /* Memory mapped I/O port area */
34
35 static __inline__ void
36 outb(unsigned PORT_SIZE port, unsigned char val)
37diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
38index dd1020e33f..180d70543f 100644
39--- a/hw/xfree86/os-support/bsd/arm_video.c
40+++ b/hw/xfree86/os-support/bsd/arm_video.c
41@@ -65,6 +65,7 @@
42 #include "xf86Priv.h"
43 #include "xf86_OSlib.h"
44 #include "xf86OSpriv.h"
45+#include "compiler.h"
46
47 #if defined(__NetBSD__) && !defined(MAP_FILE)
48 #define MAP_FLAGS MAP_SHARED
49@@ -162,6 +163,8 @@ xf86DisableIO()
50
51 #if defined(USE_ARC_MMAP) || defined(__arm32__)
52
53+unsigned int IOPortBase;
54+
55 Bool
56 xf86EnableIO()
57 {
58--
592.29.2
60
61