[PATCH 02/21] MIPS: addrspace: simplify the header
Denis Orlov
denorl2009 at gmail.com
Mon Jul 24 22:05:03 PDT 2023
Deduplicate some of the definitions for 32/64-bit targets and make KSEG*
32-bit defines available for 64-bit builds, as those might still be
useful in certain cases.
Signed-off-by: Denis Orlov <denorl2009 at gmail.com>
---
arch/mips/include/asm/addrspace.h | 45 ++++++++++++++-----------------
1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
index 7a2006a8d1..dd3b5570dd 100644
--- a/arch/mips/include/asm/addrspace.h
+++ b/arch/mips/include/asm/addrspace.h
@@ -49,6 +49,16 @@
#define XPHYSADDR(a) ((_ACAST64_(a)) & \
_CONST64_(0x000000ffffffffff))
+/*
+ * Memory segments (32bit kernel mode addresses)
+ * These are the traditional names used in the 32-bit universe.
+ */
+#define KUSEG 0x00000000
+#define KSEG0 0x80000000
+#define KSEG1 0xa0000000
+#define KSSEG 0xc0000000
+#define KSEG3 0xe0000000
+
#ifdef CONFIG_64BIT
/*
@@ -65,11 +75,6 @@
#define CKSSEG _CONST64_(0xffffffffc0000000)
#define CKSEG3 _CONST64_(0xffffffffe0000000)
-#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
-#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
-#define CKSSEGADDR(a) (CPHYSADDR(a) | CKSSEG)
-#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
-
/*
* Cache modes for XKPHYS address conversion macros
*/
@@ -92,11 +97,6 @@
#else
-#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
-#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
-#define CKSSEGADDR(a) (CPHYSADDR(a) | KSSEG)
-#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
-
/*
* Map an address to a certain kernel segment
*/
@@ -105,22 +105,17 @@
#define KSSEGADDR(a) (CPHYSADDR(a) | KSSEG)
#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
-/*
- * Memory segments (32bit kernel mode addresses)
- * These are the traditional names used in the 32-bit universe.
- */
-#define KUSEG 0x00000000
-#define KSEG0 0x80000000
-#define KSEG1 0xa0000000
-#define KSSEG 0xc0000000
-#define KSEG3 0xe0000000
-
-#define CKUSEG 0x00000000
-#define CKSEG0 0x80000000
-#define CKSEG1 0xa0000000
-#define CKSSEG 0xc0000000
-#define CKSEG3 0xe0000000
+#define CKUSEG KUSEG
+#define CKSEG0 KSEG0
+#define CKSEG1 KSEG1
+#define CKSSEG KSSEG
+#define CKSEG3 KSEG3
#endif
+#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
+#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
+#define CKSSEGADDR(a) (CPHYSADDR(a) | CKSSEG)
+#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
+
#endif /* _ASM_ADDRSPACE_H */
--
2.41.0
More information about the barebox
mailing list