xref: /openbmc/qemu/include/exec/memory_ldst_phys.h.inc (revision fc524567087c2537b5103cdfc1d41e4f442892b6)
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
22static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
23{
24    return glue(address_space_lduw, SUFFIX)(ARG1, addr,
25                                            MEMTXATTRS_UNSPECIFIED, NULL);
26}
27
28static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
29{
30    return glue(address_space_ldl, SUFFIX)(ARG1, addr,
31                                           MEMTXATTRS_UNSPECIFIED, NULL);
32}
33
34static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
35{
36    return glue(address_space_ldq, SUFFIX)(ARG1, addr,
37                                           MEMTXATTRS_UNSPECIFIED, NULL);
38}
39
40static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
41{
42    glue(address_space_stw, SUFFIX)(ARG1, addr, val,
43                                    MEMTXATTRS_UNSPECIFIED, NULL);
44}
45
46static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
47{
48    glue(address_space_stl, SUFFIX)(ARG1, addr, val,
49                                    MEMTXATTRS_UNSPECIFIED, NULL);
50}
51
52static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
53{
54    glue(address_space_stq, SUFFIX)(ARG1, addr, val,
55                                    MEMTXATTRS_UNSPECIFIED, NULL);
56}
57
58static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
59{
60    return glue(address_space_ldub, SUFFIX)(ARG1, addr,
61                                            MEMTXATTRS_UNSPECIFIED, NULL);
62}
63
64static inline uint16_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
65{
66    return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
67                                               MEMTXATTRS_UNSPECIFIED, NULL);
68}
69
70static inline uint16_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
71{
72    return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
73                                               MEMTXATTRS_UNSPECIFIED, NULL);
74}
75
76static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
77{
78    return glue(address_space_ldl_le, SUFFIX)(ARG1, addr,
79                                              MEMTXATTRS_UNSPECIFIED, NULL);
80}
81
82static inline uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
83{
84    return glue(address_space_ldl_be, SUFFIX)(ARG1, addr,
85                                              MEMTXATTRS_UNSPECIFIED, NULL);
86}
87
88static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
89{
90    return glue(address_space_ldq_le, SUFFIX)(ARG1, addr,
91                                              MEMTXATTRS_UNSPECIFIED, NULL);
92}
93
94static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
95{
96    return glue(address_space_ldq_be, SUFFIX)(ARG1, addr,
97                                              MEMTXATTRS_UNSPECIFIED, NULL);
98}
99
100static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val)
101{
102    glue(address_space_stb, SUFFIX)(ARG1, addr, val,
103                                    MEMTXATTRS_UNSPECIFIED, NULL);
104}
105
106static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
107{
108    glue(address_space_stw_le, SUFFIX)(ARG1, addr, val,
109                                       MEMTXATTRS_UNSPECIFIED, NULL);
110}
111
112static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
113{
114    glue(address_space_stw_be, SUFFIX)(ARG1, addr, val,
115                                       MEMTXATTRS_UNSPECIFIED, NULL);
116}
117
118static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
119{
120    glue(address_space_stl_le, SUFFIX)(ARG1, addr, val,
121                                       MEMTXATTRS_UNSPECIFIED, NULL);
122}
123
124static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
125{
126    glue(address_space_stl_be, SUFFIX)(ARG1, addr, val,
127                                       MEMTXATTRS_UNSPECIFIED, NULL);
128}
129
130static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
131{
132    glue(address_space_stq_le, SUFFIX)(ARG1, addr, val,
133                                       MEMTXATTRS_UNSPECIFIED, NULL);
134}
135
136static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
137{
138    glue(address_space_stq_be, SUFFIX)(ARG1, addr, val,
139                                       MEMTXATTRS_UNSPECIFIED, NULL);
140}
141
142#undef ARG1_DECL
143#undef ARG1
144#undef SUFFIX
145