blob: dab2a4e2911ccf473ac2c999300193b81dd78636 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From 4760065a58153e4dae24e4e437a5136592c624bc Mon Sep 17 00:00:00 2001
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05002From: Marek Vasut <marex@denx.de>
3Date: Sat, 30 Jan 2016 07:18:02 +0100
4Subject: [PATCH] Add nios2 support
5
6Add support for the nios2 CPU.
7
8Signed-off-by: Marek Vasut <marex@denx.de>
9Upstream-Status: Submitted [ https://bugzilla.mozilla.org/show_bug.cgi?id=1244421 ]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050010
Andrew Geissler517393d2023-01-13 08:55:19 -060011---
12 pr/include/md/_linux.cfg | 45 +++++++++++++++++++++++++++++++++++
13 pr/include/md/_linux.h | 4 +++-
14 2 files changed, 48 insertions(+), 1 deletion(-)
15
16--- a/pr/include/md/_linux.cfg
17+++ b/pr/include/md/_linux.cfg
Brad Bishop19323692019-04-05 15:28:33 -040018@@ -975,6 +975,51 @@
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019 #define PR_BYTES_PER_WORD_LOG2 2
20 #define PR_BYTES_PER_DWORD_LOG2 3
21
22+#elif defined(__nios2__)
23+
24+#define IS_LITTLE_ENDIAN 1
25+#undef IS_BIG_ENDIAN
26+
27+#define PR_BYTES_PER_BYTE 1
28+#define PR_BYTES_PER_SHORT 2
29+#define PR_BYTES_PER_INT 4
30+#define PR_BYTES_PER_INT64 8
31+#define PR_BYTES_PER_LONG 4
32+#define PR_BYTES_PER_FLOAT 4
33+#define PR_BYTES_PER_DOUBLE 8
34+#define PR_BYTES_PER_WORD 4
35+#define PR_BYTES_PER_DWORD 8
36+
37+#define PR_BITS_PER_BYTE 8
38+#define PR_BITS_PER_SHORT 16
39+#define PR_BITS_PER_INT 32
40+#define PR_BITS_PER_INT64 64
41+#define PR_BITS_PER_LONG 32
42+#define PR_BITS_PER_FLOAT 32
43+#define PR_BITS_PER_DOUBLE 64
44+#define PR_BITS_PER_WORD 32
45+
46+#define PR_BITS_PER_BYTE_LOG2 3
47+#define PR_BITS_PER_SHORT_LOG2 4
48+#define PR_BITS_PER_INT_LOG2 5
49+#define PR_BITS_PER_INT64_LOG2 6
50+#define PR_BITS_PER_LONG_LOG2 5
51+#define PR_BITS_PER_FLOAT_LOG2 5
52+#define PR_BITS_PER_DOUBLE_LOG2 6
53+#define PR_BITS_PER_WORD_LOG2 5
54+
55+#define PR_ALIGN_OF_SHORT 2
56+#define PR_ALIGN_OF_INT 4
57+#define PR_ALIGN_OF_LONG 4
58+#define PR_ALIGN_OF_INT64 4
59+#define PR_ALIGN_OF_FLOAT 4
60+#define PR_ALIGN_OF_DOUBLE 4
61+#define PR_ALIGN_OF_POINTER 4
62+#define PR_ALIGN_OF_WORD 4
63+
64+#define PR_BYTES_PER_WORD_LOG2 2
65+#define PR_BYTES_PER_DWORD_LOG2 3
66+
67 #elif defined(__or1k__)
68
69 #undef IS_LITTLE_ENDIAN
Andrew Geissler517393d2023-01-13 08:55:19 -060070--- a/pr/include/md/_linux.h
71+++ b/pr/include/md/_linux.h
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050072@@ -55,6 +55,8 @@
73 #define _PR_SI_ARCHITECTURE "avr32"
74 #elif defined(__m32r__)
75 #define _PR_SI_ARCHITECTURE "m32r"
76+#elif defined(__nios2__)
77+#define _PR_SI_ARCHITECTURE "nios2"
78 #elif defined(__or1k__)
79 #define _PR_SI_ARCHITECTURE "or1k"
Brad Bishop19323692019-04-05 15:28:33 -040080 #elif defined(__riscv) && (__riscv_xlen == 32)
Andrew Geissler517393d2023-01-13 08:55:19 -060081@@ -143,7 +145,7 @@ extern PRInt32 _PR_x86_64_AtomicSet(PRIn
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050082 #define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
83 #endif
84
Andrew Geissler517393d2023-01-13 08:55:19 -060085-#if defined(__loongarch__)
86+#if defined(__loongarch__) || defined(__nios2__)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050087 #if defined(__GNUC__)
88 /* Use GCC built-in functions */
Andrew Geissler517393d2023-01-13 08:55:19 -060089 #define _PR_HAVE_ATOMIC_OPS