mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-11 06:55:11 +07:00
![Greg Ungerer](/assets/img/avatar_default.png)
There is nothing really special about the non-MMU m68k IO access functions. So we can easily switch to using the asm-generic/io.h functions. The only thing we do need to handle is that historically the m68k IO access functions for readw/readl/writew/writel use native CPU endian ordering. So for us on m68k/ColdFire that means they are big-endian. Leave the existing set of _raw_read/__raw_write and read/write macros in place to deal with them. (They are ripe for later cleanup, but that is for another patch). Signed-off-by: Greg Ungerer <gerg@linux-m68k.org> Reviewed-by: Angelo Dureghello <angelo@sysam.it> Tested-by: Angelo Dureghello <angelo@sysam.it>
32 lines
1.0 KiB
C
32 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _M68KNOMMU_IO_H
|
|
#define _M68KNOMMU_IO_H
|
|
|
|
/*
|
|
* The non-MMU m68k and ColdFire IO and memory mapped hardware access
|
|
* functions have always worked in CPU native endian. We need to define
|
|
* that behavior here first before we include asm-generic/io.h.
|
|
*/
|
|
#define readb(addr) \
|
|
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
|
|
#define readw(addr) \
|
|
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
|
|
#define readl(addr) \
|
|
({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
|
|
|
|
#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
|
|
#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
|
|
#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
|
|
|
|
#define __raw_readb readb
|
|
#define __raw_readw readw
|
|
#define __raw_readl readl
|
|
#define __raw_writeb writeb
|
|
#define __raw_writew writew
|
|
#define __raw_writel writel
|
|
|
|
#include <asm/virtconvert.h>
|
|
#include <asm-generic/io.h>
|
|
|
|
#endif /* _M68KNOMMU_IO_H */
|