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
This commit is contained in:
Bjoern A. Zeeb 2022-09-21 19:55:47 +00:00
parent 7105f0d967
commit 046b82842c

View File

@ -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,