2017-02-20 16:35:57 +01:00
|
|
|
/*
|
|
|
|
* ARMv7M CPU object
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 Linaro Ltd
|
|
|
|
* Written by Peter Maydell <peter.maydell@linaro.org>
|
|
|
|
*
|
|
|
|
* This code is licensed under the GPL version 2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_ARM_ARMV7M_H
|
|
|
|
#define HW_ARM_ARMV7M_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2017-09-04 16:21:53 +02:00
|
|
|
#include "hw/intc/armv7m_nvic.h"
|
2021-08-12 11:33:32 +02:00
|
|
|
#include "hw/misc/armv7m_ras.h"
|
2018-03-02 11:45:36 +01:00
|
|
|
#include "target/arm/idau.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2017-02-20 16:35:57 +01:00
|
|
|
|
hw: Replace anti-social QOM type names
Several QOM type names contain ',':
ARM,bitband-memory
etraxfs,pic
etraxfs,serial
etraxfs,timer
fsl,imx25
fsl,imx31
fsl,imx6
fsl,imx6ul
fsl,imx7
grlib,ahbpnp
grlib,apbpnp
grlib,apbuart
grlib,gptimer
grlib,irqmp
qemu,register
SUNW,bpp
SUNW,CS4231
SUNW,DBRI
SUNW,DBRI.prom
SUNW,fdtwo
SUNW,sx
SUNW,tcx
xilinx,zynq_slcr
xlnx,zynqmp
xlnx,zynqmp-pmu-soc
xlnx,zynq-xadc
These are all device types. They can't be plugged with -device /
device_add, except for xlnx,zynqmp-pmu-soc, and I doubt that one
actually works.
They *can* be used with -device / device_add to request help.
Usability is poor, though: you have to double the comma, like this:
$ qemu-system-x86_64 -device SUNW,,fdtwo,help
Trap for the unwary. The fact that this was broken in
device-introspect-test for more than six years until commit e27bd49876
fixed it demonstrates that "the unwary" includes seasoned developers.
One QOM type name contains ' ': "ICH9 SMB". Because having to
remember just one way to quote would be too easy.
Rename the "SUNW,FOO types to "sun-FOO". Summarily replace ',' and '
' by '-' in the other type names.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210304140229.575481-2-armbru@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2021-03-04 15:02:28 +01:00
|
|
|
#define TYPE_BITBAND "ARM-bitband-memory"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(BitBandState, BITBAND)
|
2017-02-20 16:35:57 +01:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct BitBandState {
|
2017-02-20 16:35:57 +01:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
2017-09-21 10:51:08 +02:00
|
|
|
AddressSpace source_as;
|
2017-02-20 16:35:57 +01:00
|
|
|
MemoryRegion iomem;
|
|
|
|
uint32_t base;
|
2017-02-20 16:36:01 +01:00
|
|
|
MemoryRegion *source_memory;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2017-02-20 16:35:57 +01:00
|
|
|
|
|
|
|
#define TYPE_ARMV7M "armv7m"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(ARMv7MState, ARMV7M)
|
2017-02-20 16:35:57 +01:00
|
|
|
|
|
|
|
#define ARMV7M_NUM_BITBANDS 2
|
|
|
|
|
|
|
|
/* ARMv7M container object.
|
|
|
|
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
|
2020-08-03 18:55:03 +02:00
|
|
|
* + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
|
|
|
|
* If this GPIO is not wired up then the NVIC will default to performing
|
|
|
|
* a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
|
2017-09-13 18:04:57 +02:00
|
|
|
* + Property "cpu-type": CPU type to instantiate
|
2017-02-20 16:35:57 +01:00
|
|
|
* + Property "num-irq": number of external IRQ lines
|
2017-02-20 16:35:59 +01:00
|
|
|
* + Property "memory": MemoryRegion defining the physical address space
|
|
|
|
* that CPU accesses see. (The NVIC, bitbanding and other CPU-internal
|
|
|
|
* devices will be automatically layered on top of this view.)
|
2018-03-02 11:45:36 +01:00
|
|
|
* + Property "idau": IDAU interface (forwarded to CPU object)
|
2018-03-02 11:45:37 +01:00
|
|
|
* + Property "init-svtor": secure VTOR reset value (forwarded to CPU object)
|
2021-05-20 17:28:40 +02:00
|
|
|
* + Property "init-nsvtor": non-secure VTOR reset value (forwarded to CPU object)
|
2019-05-17 19:40:45 +02:00
|
|
|
* + Property "vfp": enable VFP (forwarded to CPU object)
|
|
|
|
* + Property "dsp": enable DSP (forwarded to CPU object)
|
2018-08-16 15:05:28 +02:00
|
|
|
* + Property "enable-bitband": expose bitbanded IO
|
2017-02-20 16:35:57 +01:00
|
|
|
*/
|
2020-09-03 22:43:22 +02:00
|
|
|
struct ARMv7MState {
|
2017-02-20 16:35:57 +01:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
NVICState nvic;
|
|
|
|
BitBandState bitband[ARMV7M_NUM_BITBANDS];
|
|
|
|
ARMCPU *cpu;
|
2021-08-12 11:33:32 +02:00
|
|
|
ARMv7MRAS ras;
|
2021-08-12 11:33:33 +02:00
|
|
|
SysTickState systick[M_REG_NUM_BANKS];
|
2017-02-20 16:35:57 +01:00
|
|
|
|
2017-02-20 16:35:59 +01:00
|
|
|
/* MemoryRegion we pass to the CPU, with our devices layered on
|
|
|
|
* top of the ones the board provides in board_memory.
|
|
|
|
*/
|
|
|
|
MemoryRegion container;
|
2021-08-12 11:33:33 +02:00
|
|
|
/*
|
|
|
|
* MemoryRegion which passes the transaction to either the S or the
|
|
|
|
* NS systick device depending on the transaction attributes
|
|
|
|
*/
|
|
|
|
MemoryRegion systickmem;
|
|
|
|
/*
|
|
|
|
* MemoryRegion which enforces the S/NS handling of the systick
|
|
|
|
* device NS alias region and passes the transaction to the
|
|
|
|
* NS systick device if appropriate.
|
|
|
|
*/
|
|
|
|
MemoryRegion systick_ns_mem;
|
2021-08-12 11:33:34 +02:00
|
|
|
/* Ditto, for the sysregs region provided by the NVIC */
|
|
|
|
MemoryRegion sysreg_ns_mem;
|
|
|
|
/* MR providing default PPB behaviour */
|
|
|
|
MemoryRegion defaultmem;
|
2017-02-20 16:35:59 +01:00
|
|
|
|
2017-02-20 16:35:57 +01:00
|
|
|
/* Properties */
|
2017-09-13 18:04:57 +02:00
|
|
|
char *cpu_type;
|
2017-02-20 16:35:59 +01:00
|
|
|
/* MemoryRegion the board provides to us (with its devices, RAM, etc) */
|
|
|
|
MemoryRegion *board_memory;
|
2018-03-02 11:45:36 +01:00
|
|
|
Object *idau;
|
2018-03-02 11:45:37 +01:00
|
|
|
uint32_t init_svtor;
|
2021-05-20 17:28:40 +02:00
|
|
|
uint32_t init_nsvtor;
|
2018-08-16 15:05:28 +02:00
|
|
|
bool enable_bitband;
|
2019-02-01 15:55:41 +01:00
|
|
|
bool start_powered_off;
|
2019-05-17 19:40:45 +02:00
|
|
|
bool vfp;
|
|
|
|
bool dsp;
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2017-02-20 16:35:57 +01:00
|
|
|
|
|
|
|
#endif
|