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 | #define IDAU_INTERFACE_CLASS(class) \ |
37 | OBJECT_CLASS_CHECK(IDAUInterfaceClass, (class), TYPE_IDAU_INTERFACE) |
38 | #define IDAU_INTERFACE_GET_CLASS(obj) \ |
39 | OBJECT_GET_CLASS(IDAUInterfaceClass, (obj), TYPE_IDAU_INTERFACE) |
40 | |
41 | typedef struct IDAUInterface IDAUInterface; |
42 | |
43 | #define IREGION_NOTVALID -1 |
44 | |
45 | typedef struct IDAUInterfaceClass { |
46 | InterfaceClass parent; |
47 | |
48 | /* Check the specified address and return the IDAU security information |
49 | * for it by filling in iregion, exempt, ns and nsc: |
50 | * iregion: IDAU region number, or IREGION_NOTVALID if not valid |
51 | * exempt: true if address is exempt from security attribution |
52 | * ns: true if the address is NonSecure |
53 | * nsc: true if the address is NonSecure-callable |
54 | */ |
55 | void (*check)(IDAUInterface *ii, uint32_t address, int *iregion, |
56 | bool *exempt, bool *ns, bool *nsc); |
57 | } IDAUInterfaceClass; |
58 | |
59 | #endif |
60 | |