xref: /qemu/include/hw/arm/armv7m.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1 /*
2  * ARMv7M CPU object
3  *
4  * Copyright (c) 2017 Linaro Ltd
5  * Written by Peter Maydell <peter.maydell@linaro.org>
6  *
7  * This code is licensed under the GPL version 2 or later.
8  */
9 
10 #ifndef HW_ARM_ARMV7M_H
11 #define HW_ARM_ARMV7M_H
12 
13 #include "hw/sysbus.h"
14 #include "hw/intc/armv7m_nvic.h"
15 #include "target/arm/idau.h"
16 #include "qom/object.h"
17 
18 #define TYPE_BITBAND "ARM,bitband-memory"
19 typedef struct BitBandState BitBandState;
20 #define BITBAND(obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND)
21 
22 struct BitBandState {
23     /*< private >*/
24     SysBusDevice parent_obj;
25     /*< public >*/
26 
27     AddressSpace source_as;
28     MemoryRegion iomem;
29     uint32_t base;
30     MemoryRegion *source_memory;
31 };
32 
33 #define TYPE_ARMV7M "armv7m"
34 typedef struct ARMv7MState ARMv7MState;
35 #define ARMV7M(obj) OBJECT_CHECK(ARMv7MState, (obj), TYPE_ARMV7M)
36 
37 #define ARMV7M_NUM_BITBANDS 2
38 
39 /* ARMv7M container object.
40  * + Unnamed GPIO input lines: external IRQ lines for the NVIC
41  * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
42  *   If this GPIO is not wired up then the NVIC will default to performing
43  *   a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
44  * + Property "cpu-type": CPU type to instantiate
45  * + Property "num-irq": number of external IRQ lines
46  * + Property "memory": MemoryRegion defining the physical address space
47  *   that CPU accesses see. (The NVIC, bitbanding and other CPU-internal
48  *   devices will be automatically layered on top of this view.)
49  * + Property "idau": IDAU interface (forwarded to CPU object)
50  * + Property "init-svtor": secure VTOR reset value (forwarded to CPU object)
51  * + Property "vfp": enable VFP (forwarded to CPU object)
52  * + Property "dsp": enable DSP (forwarded to CPU object)
53  * + Property "enable-bitband": expose bitbanded IO
54  */
55 struct ARMv7MState {
56     /*< private >*/
57     SysBusDevice parent_obj;
58     /*< public >*/
59     NVICState nvic;
60     BitBandState bitband[ARMV7M_NUM_BITBANDS];
61     ARMCPU *cpu;
62 
63     /* MemoryRegion we pass to the CPU, with our devices layered on
64      * top of the ones the board provides in board_memory.
65      */
66     MemoryRegion container;
67 
68     /* Properties */
69     char *cpu_type;
70     /* MemoryRegion the board provides to us (with its devices, RAM, etc) */
71     MemoryRegion *board_memory;
72     Object *idau;
73     uint32_t init_svtor;
74     bool enable_bitband;
75     bool start_powered_off;
76     bool vfp;
77     bool dsp;
78 };
79 
80 #endif
81