The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=046b82842c61c2d5d1648b5024958827e0a85725

commit 046b82842c61c2d5d1648b5024958827e0a85725
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2022-09-21 19:55:47 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2022-09-22 15:10:04 +0000

    LinuxKPI: io.h constify arguments and add more functions
    
    Constify "*from" arguments and add __ioread32_copy() and
    __ioread64_copy() based on the already existing implementations.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      7 days
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D36657
---
 sys/compat/linuxkpi/common/include/linux/io.h | 34 +++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/io.h 
b/sys/compat/linuxkpi/common/include/linux/io.h
index e12f9b36a9a1..64e8b294eeff 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -433,9 +433,9 @@ void iounmap(void *addr);
 #define        memcpy_toio(a, b, c)    memcpy((a), (b), (c))
 
 static inline void
-__iowrite32_copy(void *to, void *from, size_t count)
+__iowrite32_copy(void *to, const void *from, size_t count)
 {
-       uint32_t *src;
+       const uint32_t *src;
        uint32_t *dst;
        int i;
 
@@ -444,10 +444,10 @@ __iowrite32_copy(void *to, void *from, size_t count)
 }
 
 static inline void
-__iowrite64_copy(void *to, void *from, size_t count)
+__iowrite64_copy(void *to, const void *from, size_t count)
 {
 #ifdef __LP64__
-       uint64_t *src;
+       const uint64_t *src;
        uint64_t *dst;
        int i;
 
@@ -458,6 +458,32 @@ __iowrite64_copy(void *to, void *from, size_t count)
 #endif
 }
 
+static inline void
+__ioread32_copy(void *to, const void *from, size_t count)
+{
+       const uint32_t *src;
+       uint32_t *dst;
+       int i;
+
+       for (i = 0, src = from, dst = to; i < count; i++, src++, dst++)
+               *dst = __raw_readl(src);
+}
+
+static inline void
+__ioread64_copy(void *to, const void *from, size_t count)
+{
+#ifdef __LP64__
+       const uint64_t *src;
+       uint64_t *dst;
+       int i;
+
+       for (i = 0, src = from, dst = to; i < count; i++, src++, dst++)
+               *dst = __raw_readq(src);
+#else
+       __ioread32_copy(to, from, count * 2);
+#endif
+}
+
 enum {
        MEMREMAP_WB = 1 << 0,
        MEMREMAP_WT = 1 << 1,

Reply via email to