xref: /openbmc/qemu/target/arm/idau.h (revision 6016b7b4)
1 /*
2  * QEMU ARM CPU -- interface for the Arm v8M IDAU
3  *
4  * Copyright (c) 2018 Linaro Ltd
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <http://www.gnu.org/licenses/gpl-2.0.html>
19  *
20  * In the v8M architecture, the IDAU is a small piece of hardware
21  * typically implemented in the SoC which provides board or SoC
22  * specific security attribution information for each address that
23  * the CPU performs MPU/SAU checks on. For QEMU, we model this with a
24  * QOM interface which is implemented by the board or SoC object and
25  * connected to the CPU using a link property.
26  */
27 
28 #ifndef TARGET_ARM_IDAU_H
29 #define TARGET_ARM_IDAU_H
30 
31 #include "qom/object.h"
32 
33 #define TYPE_IDAU_INTERFACE "idau-interface"
34 #define IDAU_INTERFACE(obj) \
35     INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
36 typedef struct IDAUInterfaceClass IDAUInterfaceClass;
37 DECLARE_CLASS_CHECKERS(IDAUInterfaceClass, IDAU_INTERFACE,
38                        TYPE_IDAU_INTERFACE)
39 
40 typedef struct IDAUInterface IDAUInterface;
41 
42 #define IREGION_NOTVALID -1
43 
44 struct IDAUInterfaceClass {
45     InterfaceClass parent;
46 
47     /* Check the specified address and return the IDAU security information
48      * for it by filling in iregion, exempt, ns and nsc:
49      *  iregion: IDAU region number, or IREGION_NOTVALID if not valid
50      *  exempt: true if address is exempt from security attribution
51      *  ns: true if the address is NonSecure
52      *  nsc: true if the address is NonSecure-callable
53      */
54     void (*check)(IDAUInterface *ii, uint32_t address, int *iregion,
55                   bool *exempt, bool *ns, bool *nsc);
56 };
57 
58 #endif
59