xref: /qemu/target/arm/idau.h (revision 8110fa1d)
1181962fdSPeter Maydell /*
2181962fdSPeter Maydell  * QEMU ARM CPU -- interface for the Arm v8M IDAU
3181962fdSPeter Maydell  *
4181962fdSPeter Maydell  * Copyright (c) 2018 Linaro Ltd
5181962fdSPeter Maydell  *
6181962fdSPeter Maydell  * This program is free software; you can redistribute it and/or
7181962fdSPeter Maydell  * modify it under the terms of the GNU General Public License
8181962fdSPeter Maydell  * as published by the Free Software Foundation; either version 2
9181962fdSPeter Maydell  * of the License, or (at your option) any later version.
10181962fdSPeter Maydell  *
11181962fdSPeter Maydell  * This program is distributed in the hope that it will be useful,
12181962fdSPeter Maydell  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13181962fdSPeter Maydell  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14181962fdSPeter Maydell  * GNU General Public License for more details.
15181962fdSPeter Maydell  *
16181962fdSPeter Maydell  * You should have received a copy of the GNU General Public License
17181962fdSPeter Maydell  * along with this program; if not, see
18181962fdSPeter Maydell  * <http://www.gnu.org/licenses/gpl-2.0.html>
19181962fdSPeter Maydell  *
20181962fdSPeter Maydell  * In the v8M architecture, the IDAU is a small piece of hardware
21181962fdSPeter Maydell  * typically implemented in the SoC which provides board or SoC
22181962fdSPeter Maydell  * specific security attribution information for each address that
23181962fdSPeter Maydell  * the CPU performs MPU/SAU checks on. For QEMU, we model this with a
24181962fdSPeter Maydell  * QOM interface which is implemented by the board or SoC object and
25181962fdSPeter Maydell  * connected to the CPU using a link property.
26181962fdSPeter Maydell  */
27181962fdSPeter Maydell 
28181962fdSPeter Maydell #ifndef TARGET_ARM_IDAU_H
29181962fdSPeter Maydell #define TARGET_ARM_IDAU_H
30181962fdSPeter Maydell 
31181962fdSPeter Maydell #include "qom/object.h"
32181962fdSPeter Maydell 
33181962fdSPeter Maydell #define TYPE_IDAU_INTERFACE "idau-interface"
34181962fdSPeter Maydell #define IDAU_INTERFACE(obj) \
35181962fdSPeter Maydell     INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
36db1015e9SEduardo Habkost typedef struct IDAUInterfaceClass IDAUInterfaceClass;
37*8110fa1dSEduardo Habkost DECLARE_CLASS_CHECKERS(IDAUInterfaceClass, IDAU_INTERFACE,
38*8110fa1dSEduardo Habkost                        TYPE_IDAU_INTERFACE)
39181962fdSPeter Maydell 
40aa1b35b9SMarc-André Lureau typedef struct IDAUInterface IDAUInterface;
41181962fdSPeter Maydell 
42181962fdSPeter Maydell #define IREGION_NOTVALID -1
43181962fdSPeter Maydell 
44db1015e9SEduardo Habkost struct IDAUInterfaceClass {
45181962fdSPeter Maydell     InterfaceClass parent;
46181962fdSPeter Maydell 
47181962fdSPeter Maydell     /* Check the specified address and return the IDAU security information
48181962fdSPeter Maydell      * for it by filling in iregion, exempt, ns and nsc:
49181962fdSPeter Maydell      *  iregion: IDAU region number, or IREGION_NOTVALID if not valid
50181962fdSPeter Maydell      *  exempt: true if address is exempt from security attribution
51181962fdSPeter Maydell      *  ns: true if the address is NonSecure
52181962fdSPeter Maydell      *  nsc: true if the address is NonSecure-callable
53181962fdSPeter Maydell      */
54181962fdSPeter Maydell     void (*check)(IDAUInterface *ii, uint32_t address, int *iregion,
55181962fdSPeter Maydell                   bool *exempt, bool *ns, bool *nsc);
56db1015e9SEduardo Habkost };
57181962fdSPeter Maydell 
58181962fdSPeter Maydell #endif
59