^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * OpenRISC Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Linux architectural port borrowing liberally from similar works of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * others. All original copyrights apply as per the original source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * declaration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * OpenRISC implementation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * et al.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifndef __ASM_OPENRISC_UNALIGNED_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define __ASM_OPENRISC_UNALIGNED_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * This is copied from the generic implementation and the C-struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * variant replaced with the memmove variant. The GCC compiler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * for the OR32 arch optimizes too aggressively for the C-struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * variant to work, so use the memmove variant instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * It may be worth considering implementing the unaligned access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * exception handler and allowing unaligned accesses (access_ok.h)...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * not sure if it would be much of a performance win without further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * investigation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #if defined(__LITTLE_ENDIAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) # include <linux/unaligned/le_memmove.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) # include <linux/unaligned/be_byteshift.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) # include <linux/unaligned/generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) # define get_unaligned __get_unaligned_le
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) # define put_unaligned __put_unaligned_le
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #elif defined(__BIG_ENDIAN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) # include <linux/unaligned/be_memmove.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) # include <linux/unaligned/le_byteshift.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) # include <linux/unaligned/generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) # define get_unaligned __get_unaligned_be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) # define put_unaligned __put_unaligned_be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) # error need to define endianess
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #endif /* __ASM_OPENRISC_UNALIGNED_H */