arch: um: Mock the _relaxed versions for read*/write*
This change adds mocks the _relaxed versions of the read/write{b,w,l,q}
functions for user-mode Linux (UML). This allows these to be used in
KUnit tests.
Change-Id: I78242f2a25b99fb6d73a6d7e0e6b1209572b7d4c
Signed-off-by: David Gow <davidgow@google.com>
Google-Bug-Id: 136604342
diff --git a/arch/um/include/asm/io-mock-shared.h b/arch/um/include/asm/io-mock-shared.h
index 6baf59cb..2e189e0 100644
--- a/arch/um/include/asm/io-mock-shared.h
+++ b/arch/um/include/asm/io-mock-shared.h
@@ -30,4 +30,34 @@
void writeq(u64, const volatile void __iomem *);
#endif /* CONFIG_64BIT */
+
+
+#define readb_relaxed readb_relaxed
+u8 readb_relaxed(const volatile void __iomem *);
+
+#define readw_relaxed readw_relaxed
+u16 readw_relaxed(const volatile void __iomem *);
+
+#define readl_relaxed readl_relaxed
+u32 readl_relaxed(const volatile void __iomem *);
+
+#ifdef CONFIG_64BIT
+#define readq_relaxed readq_relaxed
+u64 readq_relaxed(const volatile void __iomem *);
+#endif /* CONFIG_64BIT */
+
+#define writeb_relaxed writeb_relaxed
+void writeb_relaxed(u8, const volatile void __iomem *);
+
+#define writew_relaxed writew_relaxed
+void writew_relaxed(u16, const volatile void __iomem *);
+
+#define writel_relaxed writel_relaxed
+void writel_relaxed(u32, const volatile void __iomem *);
+
+#ifdef CONFIG_64BIT
+#define writeq_relaxed writeq_relaxed
+void writeq_relaxed(u64, const volatile void __iomem *);
+#endif /* CONFIG_64BIT */
+
#endif /* _ASM_UM_IO_MOCK_SHARED_H */
diff --git a/arch/um/include/asm/io-mock.h b/arch/um/include/asm/io-mock.h
index d1a0f80..fb664ea 100644
--- a/arch/um/include/asm/io-mock.h
+++ b/arch/um/include/asm/io-mock.h
@@ -40,4 +40,35 @@
PARAMS(u64, const volatile void __iomem *));
#endif /* CONFIG_64BIT */
+
+
+DECLARE_FUNCTION_MOCK(readb_relaxed,
+ RETURNS(u8), PARAMS(const volatile void __iomem *));
+
+DECLARE_FUNCTION_MOCK(readw_relaxed,
+ RETURNS(u16), PARAMS(const volatile void __iomem *));
+
+DECLARE_FUNCTION_MOCK(readl_relaxed,
+ RETURNS(u32), PARAMS(const volatile void __iomem *));
+
+#ifdef CONFIG_64BIT
+DECLARE_FUNCTION_MOCK(readq_relaxed,
+ RETURNS(u64), PARAMS(const volatile void __iomem *));
+#endif /* CONFIG_64BIT */
+
+DECLARE_FUNCTION_MOCK_VOID_RETURN(writeb_relaxed,
+ PARAMS(u8, const volatile void __iomem *));
+
+DECLARE_FUNCTION_MOCK_VOID_RETURN(writew_relaxed,
+ PARAMS(u16, const volatile void __iomem *));
+
+DECLARE_FUNCTION_MOCK_VOID_RETURN(writel_relaxed,
+ PARAMS(u32, const volatile void __iomem *));
+
+#ifdef CONFIG_64BIT
+DECLARE_FUNCTION_MOCK_VOID_RETURN(writeq_relaxed,
+ PARAMS(u64, const volatile void __iomem *));
+#endif /* CONFIG_64BIT */
+
+
#endif /* _ASM_UM_IO_MOCK_H */