Browse Source
Like we do for other LD/ST APIs, use one template to declare and define all endianness variants of the address_space_ldst[W] methods. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260109165058.59144-8-philmd@linaro.org>pull/316/head
7 changed files with 135 additions and 90 deletions
@ -0,0 +1,25 @@ |
|||
/* |
|||
* Physical memory access endian templates |
|||
* |
|||
* Copyright (c) 2003 Fabrice Bellard |
|||
* Copyright (c) 2015 Linaro, Inc. |
|||
* Copyright (c) 2016 Red Hat, Inc. |
|||
* Copyright (c) 2025 Linaro Ltd. |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#define ADDRESS_SPACE_LD(size) \ |
|||
glue(glue(address_space_ld, size), glue(ENDIANNESS, SUFFIX)) |
|||
#define ADDRESS_SPACE_ST(size) \ |
|||
glue(glue(address_space_st, size), glue(ENDIANNESS, SUFFIX)) |
|||
|
|||
uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, |
|||
MemTxAttrs attrs, MemTxResult *result); |
|||
void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, |
|||
MemTxAttrs attrs, MemTxResult *result); |
|||
|
|||
#undef ADDRESS_SPACE_LD |
|||
#undef ADDRESS_SPACE_ST |
|||
|
|||
#undef ENDIANNESS |
|||
@ -0,0 +1,37 @@ |
|||
/* |
|||
* Physical memory access endian templates |
|||
* |
|||
* Copyright (c) 2003 Fabrice Bellard |
|||
* Copyright (c) 2015 Linaro, Inc. |
|||
* Copyright (c) 2016 Red Hat, Inc. |
|||
* Copyright (c) 2025 Linaro Ltd. |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#define LD_PHYS(size) \ |
|||
glue(glue(ld, size), glue(ENDIANNESS, glue(_phys, SUFFIX))) |
|||
#define ADDRESS_SPACE_LD(size) \ |
|||
glue(glue(address_space_ld, size), glue(ENDIANNESS, SUFFIX)) |
|||
|
|||
#define ST_PHYS(size) \ |
|||
glue(glue(st, size), glue(ENDIANNESS, glue(_phys, SUFFIX))) |
|||
#define ADDRESS_SPACE_ST(size) \ |
|||
glue(glue(address_space_st, size), glue(ENDIANNESS, SUFFIX)) |
|||
|
|||
static inline uint16_t LD_PHYS(uw)(ARG1_DECL, hwaddr addr) |
|||
{ |
|||
return ADDRESS_SPACE_LD(uw)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); |
|||
} |
|||
|
|||
static inline void ST_PHYS(w)(ARG1_DECL, hwaddr addr, uint16_t val) |
|||
{ |
|||
ADDRESS_SPACE_ST(w)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); |
|||
} |
|||
|
|||
#undef LD_PHYS |
|||
#undef ST_PHYS |
|||
#undef ADDRESS_SPACE_LD |
|||
#undef ADDRESS_SPACE_ST |
|||
|
|||
#undef ENDIANNESS |
|||
@ -0,0 +1,42 @@ |
|||
/* |
|||
* Physical memory access endian templates |
|||
* |
|||
* Copyright (c) 2003 Fabrice Bellard |
|||
* Copyright (c) 2015 Linaro, Inc. |
|||
* Copyright (c) 2016 Red Hat, Inc. |
|||
* Copyright (c) 2025 Linaro Ltd. |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#define ADDRESS_SPACE_LD(size) \ |
|||
glue(glue(address_space_ld, size), glue(ENDIANNESS, SUFFIX)) |
|||
#define ADDRESS_SPACE_LD_INTERNAL(size) \ |
|||
glue(glue(address_space_ld, size), glue(_internal, SUFFIX)) |
|||
|
|||
#define ADDRESS_SPACE_ST(size) \ |
|||
glue(glue(address_space_st, size), glue(ENDIANNESS, SUFFIX)) |
|||
#define ADDRESS_SPACE_ST_INTERNAL(size) \ |
|||
glue(glue(address_space_st, size), glue(_internal, SUFFIX)) |
|||
|
|||
uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, |
|||
MemTxAttrs attrs, MemTxResult *result) |
|||
{ |
|||
return ADDRESS_SPACE_LD_INTERNAL(uw)(ARG1, addr, attrs, result, |
|||
DEVICE_ENDIANNESS); |
|||
} |
|||
|
|||
void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, |
|||
MemTxAttrs attrs, MemTxResult *result) |
|||
{ |
|||
ADDRESS_SPACE_ST_INTERNAL(w)(ARG1, addr, val, attrs, result, |
|||
DEVICE_ENDIANNESS); |
|||
} |
|||
|
|||
#undef ADDRESS_SPACE_LD |
|||
#undef ADDRESS_SPACE_LD_INTERNAL |
|||
#undef ADDRESS_SPACE_ST |
|||
#undef ADDRESS_SPACE_ST_INTERNAL |
|||
|
|||
#undef ENDIANNESS |
|||
#undef DEVICE_ENDIANNESS |
|||
Loading…
Reference in new issue