1/*
2 *  Physical memory access templates
3 *
4 *  Copyright (c) 2003 Fabrice Bellard
5 *  Copyright (c) 2015 Linaro, Inc.
6 *  Copyright (c) 2016 Red Hat, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifdef TARGET_ENDIANNESS
23static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
24{
25    return glue(address_space_lduw, SUFFIX)(ARG1, addr,
26                                            MEMTXATTRS_UNSPECIFIED, NULL);
27}
28
29static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
30{
31    return glue(address_space_ldl, SUFFIX)(ARG1, addr,
32                                           MEMTXATTRS_UNSPECIFIED, NULL);
33}
34
35static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
36{
37    return glue(address_space_ldq, SUFFIX)(ARG1, addr,
38                                           MEMTXATTRS_UNSPECIFIED, NULL);
39}
40
41static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
42{
43    glue(address_space_stw, SUFFIX)(ARG1, addr, val,
44                                    MEMTXATTRS_UNSPECIFIED, NULL);
45}
46
47static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
48{
49    glue(address_space_stl, SUFFIX)(ARG1, addr, val,
50                                    MEMTXATTRS_UNSPECIFIED, NULL);
51}
52
53static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
54{
55    glue(address_space_stq, SUFFIX)(ARG1, addr, val,
56                                    MEMTXATTRS_UNSPECIFIED, NULL);
57}
58#else
59static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
60{
61    return glue(address_space_ldub, SUFFIX)(ARG1, addr,
62                                            MEMTXATTRS_UNSPECIFIED, NULL);
63}
64
65static inline uint16_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
66{
67    return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
68                                               MEMTXATTRS_UNSPECIFIED, NULL);
69}
70
71static inline uint16_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
72{
73    return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
74                                               MEMTXATTRS_UNSPECIFIED, NULL);
75}
76
77static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
78{
79    return glue(address_space_ldl_le, SUFFIX)(ARG1, addr,
80                                              MEMTXATTRS_UNSPECIFIED, NULL);
81}
82
83static inline uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
84{
85    return glue(address_space_ldl_be, SUFFIX)(ARG1, addr,
86                                              MEMTXATTRS_UNSPECIFIED, NULL);
87}
88
89static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
90{
91    return glue(address_space_ldq_le, SUFFIX)(ARG1, addr,
92                                              MEMTXATTRS_UNSPECIFIED, NULL);
93}
94
95static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
96{
97    return glue(address_space_ldq_be, SUFFIX)(ARG1, addr,
98                                              MEMTXATTRS_UNSPECIFIED, NULL);
99}
100
101static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val)
102{
103    glue(address_space_stb, SUFFIX)(ARG1, addr, val,
104                                    MEMTXATTRS_UNSPECIFIED, NULL);
105}
106
107static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
108{
109    glue(address_space_stw_le, SUFFIX)(ARG1, addr, val,
110                                       MEMTXATTRS_UNSPECIFIED, NULL);
111}
112
113static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
114{
115    glue(address_space_stw_be, SUFFIX)(ARG1, addr, val,
116                                       MEMTXATTRS_UNSPECIFIED, NULL);
117}
118
119static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
120{
121    glue(address_space_stl_le, SUFFIX)(ARG1, addr, val,
122                                       MEMTXATTRS_UNSPECIFIED, NULL);
123}
124
125static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
126{
127    glue(address_space_stl_be, SUFFIX)(ARG1, addr, val,
128                                       MEMTXATTRS_UNSPECIFIED, NULL);
129}
130
131static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
132{
133    glue(address_space_stq_le, SUFFIX)(ARG1, addr, val,
134                                       MEMTXATTRS_UNSPECIFIED, NULL);
135}
136
137static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
138{
139    glue(address_space_stq_be, SUFFIX)(ARG1, addr, val,
140                                       MEMTXATTRS_UNSPECIFIED, NULL);
141}
142#endif
143
144#undef ARG1_DECL
145#undef ARG1
146#undef SUFFIX
147#undef TARGET_ENDIANNESS
148