mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-target-arm-20250128-1' of https://git.linaro.org/people/pmaydell/qemu-arm into staging
target-arm queue: * hw/arm: Remove various uses of first_cpu global * hw/char/imx_serial: Fix reset value of UFCR register * hw/char/imx_serial: Update all state before restarting ageing timer * hw/pci-host/designware: Expose MSI IRQ * hw/arm/stellaris: refactoring, cleanup * hw/arm/stellaris: map both I2C controllers * tests/functional: Add a test for the arm microbit machine * target/arm: arm_reset_sve_state() should set FPSR, not FPCR * target/arm: refactorings preparatory to FEAT_AFP implementation * fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed * fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed * hw/usb/canokey: Fix buffer overflow for OUT packet # -----BEGIN PGP SIGNATURE----- # # iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmeZOi0ZHHBldGVyLm1h # eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3sUeEACwDhM4ldn/gVZgVN7nf42a # /CLD/qJx1vqi5bAB5zkY1bSCR9hS2IkhTBoQQH9Ng6ztG1IRpT/tKXDJAemWty70 # XgExdl4yjdwXMQK4JKU9qSfaBTuX7Z8Hz+nA1AnblO/4H+XpVNVJzp8Ee/uWTyEd # BKPBpwqbIXNwUWEqkzDok074Q05rHlhsJD2DsoJTcmtpROhLHLATwQDZGGFuf56H # LVcdx6GRP+/mWEGWLtj19mvaR/2cn4rQf+I1MACZ81nRjQCHbCohNAMr2wFsKg1+ # 2jYk9uHdFoambJ5+mFuC55Efk+QJaP4vDR0Gf3jLloFr+rS/5h3HiUuD8dUWOwFd # mPWXsjwYzqBW2knt1nfq1ByzYWZ8rVQEn5G53dX/eoNXuDGsonZxPnevgmv5kIUc # /W618Jez1nu9RDtNKccobHEtTGlGInJxJ7YzkU7Q6FO80IAqSdV7t9v7uPLJwcnz # nQz+wVzb4oOmwMzn3BpKY7N/S7IZOSy3ASNHj8o4yCHMJT8Ki0/N4bl0k0DLxJ0T # RiNCsV9c7MJfo9a+pbOnu0Lc3SjjropdvHYU+bB7R0mgd8ysN+Tou0dpa+i7tUTu # DHWqs2/+UApHKBiC+DSynPjjRR2aT/5lYFncGaiEVoEQttPLka3SAzgHPVQZs1zD # bxZkEAFktAFGIjU70fYNkg== # =H4p7 # -----END PGP SIGNATURE----- # gpg: Signature made Tue 28 Jan 2025 15:12:29 EST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [full] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full] # gpg: aka "Peter Maydell <peter@archaic.org.uk>" [unknown] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * tag 'pull-target-arm-20250128-1' of https://git.linaro.org/people/pmaydell/qemu-arm: (36 commits) hw/usb/canokey: Fix buffer overflow for OUT packet target/arm: Use FPST_A64_F16 for halfprec-to-other conversions target/arm: Remove redundant advsimd float16 helpers fpu: Fix a comment in softfloat-types.h fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed target/arm: Remove now-unused vfp.fp_status_f16 and FPST_FPCR_F16 target/arm: Use FPST_A64_F16 in A64 decoder target/arm: Use FPST_A32_F16 in A32 decoder target/arm: Use fp_status_f16_a64 in AArch64-only helpers target/arm: Use fp_status_f16_a32 in AArch32-only helpers target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64 target/arm: Remove now-unused vfp.fp_status and FPST_FPCR target/arm: Use FPST_A64 in A64 decoder target/arm: Use FPST_A32 in A32 decoder target/arm: Use fp_status_a32 in vfp_cmp helpers target/arm: Use fp_status_a32 in vjvct helper target/arm: Use fp_status_a64 or fp_status_a32 in is_ebf() target/arm: Use vfp.fp_status_a64 in A64-only helper functions target/arm: Define new fp_status_a32 and fp_status_a64 ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -1157,6 +1157,7 @@ F: hw/*/microbit*.c
|
||||
F: include/hw/*/nrf51*.h
|
||||
F: include/hw/*/microbit*.h
|
||||
F: tests/qtest/microbit-test.c
|
||||
F: tests/functional/test_arm_microbit.py
|
||||
F: docs/system/arm/nrf.rst
|
||||
|
||||
ARM PL011 Rust device
|
||||
|
||||
@@ -198,7 +198,7 @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status,
|
||||
if (likely(frac_eqz(p))) {
|
||||
p->cls = float_class_zero;
|
||||
} else if (status->flush_inputs_to_zero) {
|
||||
float_raise(float_flag_input_denormal, status);
|
||||
float_raise(float_flag_input_denormal_flushed, status);
|
||||
p->cls = float_class_zero;
|
||||
frac_clear(p);
|
||||
} else {
|
||||
@@ -334,7 +334,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
|
||||
}
|
||||
frac_shr(p, frac_shift);
|
||||
} else if (s->flush_to_zero) {
|
||||
flags |= float_flag_output_denormal;
|
||||
flags |= float_flag_output_denormal_flushed;
|
||||
p->cls = float_class_zero;
|
||||
exp = 0;
|
||||
frac_clear(p);
|
||||
|
||||
+3
-3
@@ -132,7 +132,7 @@ this code that are retained.
|
||||
if (unlikely(soft_t ## _is_denormal(*a))) { \
|
||||
*a = soft_t ## _set_sign(soft_t ## _zero, \
|
||||
soft_t ## _is_neg(*a)); \
|
||||
float_raise(float_flag_input_denormal, s); \
|
||||
float_raise(float_flag_input_denormal_flushed, s); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -4848,7 +4848,7 @@ float128 float128_silence_nan(float128 a, float_status *status)
|
||||
static bool parts_squash_denormal(FloatParts64 p, float_status *status)
|
||||
{
|
||||
if (p.exp == 0 && p.frac != 0) {
|
||||
float_raise(float_flag_input_denormal, status);
|
||||
float_raise(float_flag_input_denormal_flushed, status);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5017,7 +5017,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
|
||||
}
|
||||
if ( zExp <= 0 ) {
|
||||
if (status->flush_to_zero) {
|
||||
float_raise(float_flag_output_denormal, status);
|
||||
float_raise(float_flag_output_denormal_flushed, status);
|
||||
return packFloatx80(zSign, 0, 0);
|
||||
}
|
||||
isTiny = status->tininess_before_rounding
|
||||
|
||||
@@ -516,6 +516,7 @@ config FSL_IMX6
|
||||
select PL310 # cache controller
|
||||
select PCI_EXPRESS_DESIGNWARE
|
||||
select SDHCI
|
||||
select OR_IRQ
|
||||
|
||||
config ASPEED_SOC
|
||||
bool
|
||||
@@ -573,6 +574,7 @@ config FSL_IMX7
|
||||
select WDT_IMX2
|
||||
select PCI_EXPRESS_DESIGNWARE
|
||||
select SDHCI
|
||||
select OR_IRQ
|
||||
select UNIMP
|
||||
|
||||
config ARM_SMMUV3
|
||||
|
||||
@@ -82,7 +82,7 @@ static void bl475e_init(MachineState *machine)
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
|
||||
|
||||
sc = STM32L4X5_SOC_GET_CLASS(&s->soc);
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 0,
|
||||
armv7m_load_kernel(s->soc.armv7m.cpu, machine->kernel_filename, 0,
|
||||
sc->flash_size);
|
||||
|
||||
if (object_class_by_name(TYPE_DM163)) {
|
||||
|
||||
+12
-1
@@ -106,6 +106,8 @@ static void fsl_imx6_init(Object *obj)
|
||||
object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET);
|
||||
|
||||
object_initialize_child(obj, "pcie", &s->pcie, TYPE_DESIGNWARE_PCIE_HOST);
|
||||
object_initialize_child(obj, "pcie4-msi-irq", &s->pcie4_msi_irq,
|
||||
TYPE_OR_IRQ);
|
||||
}
|
||||
|
||||
static void fsl_imx6_realize(DeviceState *dev, Error **errp)
|
||||
@@ -435,14 +437,23 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->pcie), &error_abort);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcie), 0, FSL_IMX6_PCIe_REG_ADDR);
|
||||
|
||||
object_property_set_int(OBJECT(&s->pcie4_msi_irq), "num-lines", 2,
|
||||
&error_abort);
|
||||
qdev_realize(DEVICE(&s->pcie4_msi_irq), NULL, &error_abort);
|
||||
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE4_MSI_IRQ);
|
||||
qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq);
|
||||
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE1_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE2_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE3_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE4_IRQ);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 1);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 4, irq);
|
||||
|
||||
/*
|
||||
* PCIe PHY
|
||||
|
||||
+12
-1
@@ -150,6 +150,8 @@ static void fsl_imx7_init(Object *obj)
|
||||
* PCIE
|
||||
*/
|
||||
object_initialize_child(obj, "pcie", &s->pcie, TYPE_DESIGNWARE_PCIE_HOST);
|
||||
object_initialize_child(obj, "pcie4-msi-irq", &s->pcie4_msi_irq,
|
||||
TYPE_OR_IRQ);
|
||||
|
||||
/*
|
||||
* USBs
|
||||
@@ -597,14 +599,23 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->pcie), &error_abort);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcie), 0, FSL_IMX7_PCIE_REG_ADDR);
|
||||
|
||||
object_property_set_int(OBJECT(&s->pcie4_msi_irq), "num-lines", 2,
|
||||
&error_abort);
|
||||
qdev_realize(DEVICE(&s->pcie4_msi_irq), NULL, &error_abort);
|
||||
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_MSI_IRQ);
|
||||
qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq);
|
||||
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTA_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTB_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTC_IRQ);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_IRQ);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
|
||||
irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 1);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 4, irq);
|
||||
|
||||
/*
|
||||
* USBs
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ static void microbit_init(MachineState *machine)
|
||||
memory_region_add_subregion_overlap(&s->nrf51.container, NRF51_TWI_BASE,
|
||||
mr, -1);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(s->nrf51.armv7m.cpu, machine->kernel_filename,
|
||||
0, s->nrf51.flash_size);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1211,7 +1211,7 @@ static void mps2tz_common_init(MachineState *machine)
|
||||
mms->remap_irq);
|
||||
}
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(mms->iotkit.armv7m[0].cpu, machine->kernel_filename,
|
||||
0, boot_ram_size(mms));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -460,7 +460,7 @@ static void mps2_common_init(MachineState *machine)
|
||||
qdev_get_gpio_in(armv7m,
|
||||
mmc->fpga_type == FPGA_AN511 ? 47 : 13));
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(mms->armv7m.cpu, machine->kernel_filename,
|
||||
0, 0x400000);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
|
||||
cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&soc->spi[0]), 1, cs_line);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(soc->armv7m.cpu, machine->kernel_filename,
|
||||
0, soc->envm_size);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -590,7 +590,7 @@ static void musca_init(MachineState *machine)
|
||||
"cfg_sec_resp", 0));
|
||||
}
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(mms->sse.armv7m[0].cpu, machine->kernel_filename,
|
||||
0, 0x2000000);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ static void netduino2_init(MachineState *machine)
|
||||
qdev_connect_clock_in(dev, "sysclk", sysclk);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
|
||||
armv7m_load_kernel(STM32F205_SOC(dev)->armv7m.cpu, machine->kernel_filename,
|
||||
0, FLASH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ static void netduinoplus2_init(MachineState *machine)
|
||||
qdev_connect_clock_in(dev, "sysclk", sysclk);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu),
|
||||
armv7m_load_kernel(STM32F405_SOC(dev)->armv7m.cpu,
|
||||
machine->kernel_filename,
|
||||
0, FLASH_SIZE);
|
||||
}
|
||||
|
||||
+9
-9
@@ -76,16 +76,16 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
}
|
||||
/* This clock doesn't need migration because it is fixed-frequency */
|
||||
clock_set_hz(s->sysclk, HCLK_FRQ);
|
||||
qdev_connect_clock_in(DEVICE(&s->cpu), "cpuclk", s->sysclk);
|
||||
qdev_connect_clock_in(DEVICE(&s->armv7m), "cpuclk", s->sysclk);
|
||||
/*
|
||||
* This SoC has no systick device, so don't connect refclk.
|
||||
* TODO: model the lack of systick (currently the armv7m object
|
||||
* will always provide one).
|
||||
*/
|
||||
|
||||
object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
|
||||
object_property_set_link(OBJECT(&s->armv7m), "memory", OBJECT(&s->container),
|
||||
&error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->armv7m), errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0);
|
||||
memory_region_add_subregion_overlap(&s->container, NRF51_UART_BASE, mr, 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart), 0,
|
||||
qdev_get_gpio_in(DEVICE(&s->cpu),
|
||||
qdev_get_gpio_in(DEVICE(&s->armv7m),
|
||||
BASE_TO_IRQ(NRF51_UART_BASE)));
|
||||
|
||||
/* RNG */
|
||||
@@ -115,7 +115,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0);
|
||||
memory_region_add_subregion_overlap(&s->container, NRF51_RNG_BASE, mr, 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng), 0,
|
||||
qdev_get_gpio_in(DEVICE(&s->cpu),
|
||||
qdev_get_gpio_in(DEVICE(&s->armv7m),
|
||||
BASE_TO_IRQ(NRF51_RNG_BASE)));
|
||||
|
||||
/* UICR, FICR, NVMC, FLASH */
|
||||
@@ -161,7 +161,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->timer[i]), 0, base_addr);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer[i]), 0,
|
||||
qdev_get_gpio_in(DEVICE(&s->cpu),
|
||||
qdev_get_gpio_in(DEVICE(&s->armv7m),
|
||||
BASE_TO_IRQ(base_addr)));
|
||||
}
|
||||
|
||||
@@ -185,10 +185,10 @@ static void nrf51_soc_init(Object *obj)
|
||||
|
||||
memory_region_init(&s->container, obj, "nrf51-container", UINT64_MAX);
|
||||
|
||||
object_initialize_child(OBJECT(s), "armv6m", &s->cpu, TYPE_ARMV7M);
|
||||
qdev_prop_set_string(DEVICE(&s->cpu), "cpu-type",
|
||||
object_initialize_child(OBJECT(s), "armv6m", &s->armv7m, TYPE_ARMV7M);
|
||||
qdev_prop_set_string(DEVICE(&s->armv7m), "cpu-type",
|
||||
ARM_CPU_TYPE_NAME("cortex-m0"));
|
||||
qdev_prop_set_uint32(DEVICE(&s->cpu), "num-irq", 32);
|
||||
qdev_prop_set_uint32(DEVICE(&s->armv7m), "num-irq", 32);
|
||||
|
||||
object_initialize_child(obj, "uart", &s->uart, TYPE_NRF51_UART);
|
||||
object_property_add_alias(obj, "serial0", OBJECT(&s->uart), "chardev");
|
||||
|
||||
@@ -51,7 +51,7 @@ static void olimex_stm32_h405_init(MachineState *machine)
|
||||
qdev_connect_clock_in(dev, "sysclk", sysclk);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu),
|
||||
armv7m_load_kernel(STM32F405_SOC(dev)->armv7m.cpu,
|
||||
machine->kernel_filename,
|
||||
0, FLASH_SIZE);
|
||||
}
|
||||
|
||||
+78
-40
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/core/split-irq.h"
|
||||
#include "hw/sysbus.h"
|
||||
@@ -49,6 +50,31 @@
|
||||
#define NUM_IRQ_LINES 64
|
||||
#define NUM_PRIO_BITS 3
|
||||
|
||||
#define NUM_GPIO 7
|
||||
#define NUM_UART 4
|
||||
#define NUM_GPTM 4
|
||||
#define NUM_I2C 2
|
||||
|
||||
/*
|
||||
* See Stellaris Data Sheet chapter 5.2.5 "System Control",
|
||||
* Register 13 .. 17: Device Capabilities 0 .. 4 (DC0 .. DC4).
|
||||
*/
|
||||
#define DC1_WDT 3
|
||||
#define DC1_HIB 6
|
||||
#define DC1_MPU 7
|
||||
#define DC1_ADC 16
|
||||
#define DC1_PWM 20
|
||||
#define DC2_UART(n) (n)
|
||||
#define DC2_SSI 4
|
||||
#define DC2_QEI(n) (8 + n)
|
||||
#define DC2_I2C(n) (12 + 2 * n)
|
||||
#define DC2_GPTM(n) (16 + n)
|
||||
#define DC2_COMP(n) (24 + n)
|
||||
#define DC4_GPIO(n) (n)
|
||||
#define DC4_EMAC 28
|
||||
|
||||
#define DEV_CAP(_dc, _cap) extract32(board->dc##_dc, DC##_dc##_##_cap, 1)
|
||||
|
||||
typedef const struct {
|
||||
const char *name;
|
||||
uint32_t did0;
|
||||
@@ -101,7 +127,7 @@ static void ssys_update(ssys_state *s)
|
||||
qemu_set_irq(s->irq, (s->int_status & s->int_mask) != 0);
|
||||
}
|
||||
|
||||
static uint32_t pllcfg_sandstorm[16] = {
|
||||
static const uint32_t pllcfg_sandstorm[16] = {
|
||||
0x31c0, /* 1 Mhz */
|
||||
0x1ae0, /* 1.8432 Mhz */
|
||||
0x18c0, /* 2 Mhz */
|
||||
@@ -120,7 +146,7 @@ static uint32_t pllcfg_sandstorm[16] = {
|
||||
0x585b /* 8.192 Mhz */
|
||||
};
|
||||
|
||||
static uint32_t pllcfg_fury[16] = {
|
||||
static const uint32_t pllcfg_fury[16] = {
|
||||
0x3200, /* 1 Mhz */
|
||||
0x1b20, /* 1.8432 Mhz */
|
||||
0x1900, /* 2 Mhz */
|
||||
@@ -964,7 +990,7 @@ static void stellaris_adc_init(Object *obj)
|
||||
}
|
||||
|
||||
/* Board init. */
|
||||
static stellaris_board_info stellaris_boards[] = {
|
||||
static const stellaris_board_info stellaris_boards[] = {
|
||||
{ "LM3S811EVB",
|
||||
0,
|
||||
0x0032000e,
|
||||
@@ -989,19 +1015,20 @@ static stellaris_board_info stellaris_boards[] = {
|
||||
|
||||
static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
{
|
||||
static const int uart_irq[] = {5, 6, 33, 34};
|
||||
static const int timer_irq[] = {19, 21, 23, 35};
|
||||
static const uint32_t gpio_addr[7] =
|
||||
static const int uart_irq[NUM_UART] = {5, 6, 33, 34};
|
||||
static const int timer_irq[NUM_GPTM] = {19, 21, 23, 35};
|
||||
static const uint32_t gpio_addr[NUM_GPIO] =
|
||||
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
|
||||
0x40024000, 0x40025000, 0x40026000};
|
||||
static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31};
|
||||
static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
|
||||
static const uint32_t i2c_addr[NUM_I2C] = {0x40020000, 0x40021000};
|
||||
static const int i2c_irq[NUM_I2C] = {8, 37};
|
||||
|
||||
/* Memory map of SoC devices, from
|
||||
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
|
||||
* http://www.ti.com/lit/ds/symlink/lm3s6965.pdf
|
||||
*
|
||||
* 40000000 wdtimer
|
||||
* 40002000 i2c (unimplemented)
|
||||
* 40004000 GPIO
|
||||
* 40005000 GPIO
|
||||
* 40006000 GPIO
|
||||
@@ -1031,13 +1058,13 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
*/
|
||||
|
||||
Object *soc_container;
|
||||
DeviceState *gpio_dev[7], *nvic;
|
||||
qemu_irq gpio_in[7][8];
|
||||
qemu_irq gpio_out[7][8];
|
||||
DeviceState *gpio_dev[NUM_GPIO], *armv7m, *nvic;
|
||||
qemu_irq gpio_in[NUM_GPIO][8];
|
||||
qemu_irq gpio_out[NUM_GPIO][8];
|
||||
qemu_irq adc;
|
||||
int sram_size;
|
||||
int flash_size;
|
||||
I2CBus *i2c;
|
||||
DeviceState *i2c_dev[NUM_I2C] = { };
|
||||
DeviceState *dev;
|
||||
DeviceState *ssys_dev;
|
||||
int i;
|
||||
@@ -1095,25 +1122,26 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
qdev_prop_set_uint32(ssys_dev, "dc4", board->dc4);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
|
||||
|
||||
nvic = qdev_new(TYPE_ARMV7M);
|
||||
object_property_add_child(soc_container, "v7m", OBJECT(nvic));
|
||||
qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
|
||||
qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
|
||||
qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
|
||||
qdev_prop_set_bit(nvic, "enable-bitband", true);
|
||||
qdev_connect_clock_in(nvic, "cpuclk",
|
||||
armv7m = qdev_new(TYPE_ARMV7M);
|
||||
object_property_add_child(soc_container, "v7m", OBJECT(armv7m));
|
||||
qdev_prop_set_uint32(armv7m, "num-irq", NUM_IRQ_LINES);
|
||||
qdev_prop_set_uint8(armv7m, "num-prio-bits", NUM_PRIO_BITS);
|
||||
qdev_prop_set_string(armv7m, "cpu-type", ms->cpu_type);
|
||||
qdev_prop_set_bit(armv7m, "enable-bitband", true);
|
||||
qdev_connect_clock_in(armv7m, "cpuclk",
|
||||
qdev_get_clock_out(ssys_dev, "SYSCLK"));
|
||||
/* This SoC does not connect the systick reference clock */
|
||||
object_property_set_link(OBJECT(nvic), "memory",
|
||||
object_property_set_link(OBJECT(armv7m), "memory",
|
||||
OBJECT(get_system_memory()), &error_abort);
|
||||
/* This will exit with an error if the user passed us a bad cpu_type */
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(armv7m), &error_fatal);
|
||||
nvic = armv7m;
|
||||
|
||||
/* Now we can wire up the IRQ and MMIO of the system registers */
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(ssys_dev), 0, 0x400fe000);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(ssys_dev), 0, qdev_get_gpio_in(nvic, 28));
|
||||
|
||||
if (board->dc1 & (1 << 16)) {
|
||||
if (DEV_CAP(1, ADC)) {
|
||||
dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
|
||||
qdev_get_gpio_in(nvic, 14),
|
||||
qdev_get_gpio_in(nvic, 15),
|
||||
@@ -1124,8 +1152,8 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
} else {
|
||||
adc = NULL;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (board->dc2 & (0x10000 << i)) {
|
||||
for (i = 0; i < NUM_GPTM; i++) {
|
||||
if (DEV_CAP(2, GPTM(i))) {
|
||||
SysBusDevice *sbd;
|
||||
|
||||
dev = qdev_new(TYPE_STELLARIS_GPTM);
|
||||
@@ -1142,7 +1170,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
}
|
||||
}
|
||||
|
||||
if (board->dc1 & (1 << 3)) { /* watchdog present */
|
||||
if (DEV_CAP(1, WDT)) {
|
||||
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
|
||||
object_property_add_child(soc_container, "wdg", OBJECT(dev));
|
||||
qdev_connect_clock_in(dev, "WDOGCLK",
|
||||
@@ -1158,8 +1186,8 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (board->dc4 & (1 << i)) {
|
||||
for (i = 0; i < NUM_GPIO; i++) {
|
||||
if (DEV_CAP(4, GPIO(i))) {
|
||||
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
|
||||
qdev_get_gpio_in(nvic,
|
||||
gpio_irq[i]));
|
||||
@@ -1170,17 +1198,21 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
}
|
||||
}
|
||||
|
||||
if (board->dc2 & (1 << 12)) {
|
||||
dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000,
|
||||
qdev_get_gpio_in(nvic, 8));
|
||||
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
|
||||
if (board->peripherals & BP_OLED_I2C) {
|
||||
i2c_slave_create_simple(i2c, "ssd0303", 0x3d);
|
||||
for (i = 0; i < NUM_I2C; i++) {
|
||||
if (DEV_CAP(2, I2C(i))) {
|
||||
i2c_dev[i] = sysbus_create_simple(TYPE_STELLARIS_I2C, i2c_addr[i],
|
||||
qdev_get_gpio_in(nvic,
|
||||
i2c_irq[i]));
|
||||
}
|
||||
}
|
||||
if (board->peripherals & BP_OLED_I2C) {
|
||||
I2CBus *bus = (I2CBus *)qdev_get_child_bus(i2c_dev[0], "i2c");
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (board->dc2 & (1 << i)) {
|
||||
i2c_slave_create_simple(bus, "ssd0303", 0x3d);
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_UART; i++) {
|
||||
if (DEV_CAP(2, UART(i))) {
|
||||
SysBusDevice *sbd;
|
||||
|
||||
dev = qdev_new("pl011_luminary");
|
||||
@@ -1192,7 +1224,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(nvic, uart_irq[i]));
|
||||
}
|
||||
}
|
||||
if (board->dc2 & (1 << 4)) {
|
||||
if (DEV_CAP(2, SSI)) {
|
||||
dev = sysbus_create_simple("pl022", 0x40008000,
|
||||
qdev_get_gpio_in(nvic, 7));
|
||||
if (board->peripherals & BP_OLED_SSI) {
|
||||
@@ -1301,7 +1333,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
qemu_irq_raise(gpio_out[GPIO_D][0]);
|
||||
}
|
||||
}
|
||||
if (board->dc4 & (1 << 28)) {
|
||||
if (DEV_CAP(4, EMAC)) {
|
||||
DeviceState *enet;
|
||||
|
||||
enet = qdev_new("stellaris_enet");
|
||||
@@ -1356,8 +1388,6 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
/* Add dummy regions for the devices we don't implement yet,
|
||||
* so guest accesses don't cause unlogged crashes.
|
||||
*/
|
||||
create_unimplemented_device("i2c-0", 0x40002000, 0x1000);
|
||||
create_unimplemented_device("i2c-2", 0x40021000, 0x1000);
|
||||
create_unimplemented_device("PWM", 0x40028000, 0x1000);
|
||||
create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
|
||||
create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
|
||||
@@ -1365,7 +1395,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
|
||||
create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
|
||||
create_unimplemented_device("flash-control", 0x400fd000, 0x1000);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu), ms->kernel_filename, 0, flash_size);
|
||||
armv7m_load_kernel(ARMV7M(armv7m)->cpu, ms->kernel_filename, 0, flash_size);
|
||||
}
|
||||
|
||||
/* FIXME: Figure out how to generate these from stellaris_boards. */
|
||||
@@ -1379,6 +1409,10 @@ static void lm3s6965evb_init(MachineState *machine)
|
||||
stellaris_init(machine, &stellaris_boards[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stellaris LM3S811 Evaluation Board Schematics:
|
||||
* https://www.ti.com/lit/ug/symlink/spmu030.pdf
|
||||
*/
|
||||
static void lm3s811evb_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
@@ -1395,6 +1429,10 @@ static const TypeInfo lm3s811evb_type = {
|
||||
.class_init = lm3s811evb_class_init,
|
||||
};
|
||||
|
||||
/*
|
||||
* Stellaris: LM3S6965 Evaluation Board Schematics:
|
||||
* https://www.ti.com/lit/ug/symlink/spmu029.pdf
|
||||
*/
|
||||
static void lm3s6965evb_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
|
||||
@@ -51,7 +51,7 @@ static void stm32vldiscovery_init(MachineState *machine)
|
||||
qdev_connect_clock_in(dev, "sysclk", sysclk);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
|
||||
armv7m_load_kernel(ARM_CPU(first_cpu),
|
||||
armv7m_load_kernel(STM32F100_SOC(dev)->armv7m.cpu,
|
||||
machine->kernel_filename,
|
||||
0, FLASH_SIZE);
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ static void imx_serial_reset(IMXSerialState *s)
|
||||
s->ucr3 = 0x700;
|
||||
s->ubmr = 0;
|
||||
s->ubrc = 4;
|
||||
s->ufcr = BIT(11) | BIT(0);
|
||||
|
||||
fifo32_reset(&s->rx_fifo);
|
||||
timer_del(&s->ageing_timer);
|
||||
@@ -400,14 +401,14 @@ static void imx_put_data(void *opaque, uint32_t value)
|
||||
if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
|
||||
s->usr1 |= USR1_RRDY;
|
||||
}
|
||||
|
||||
imx_serial_rx_fifo_ageing_timer_restart(s);
|
||||
|
||||
s->usr2 |= USR2_RDR;
|
||||
s->uts1 &= ~UTS1_RXEMPTY;
|
||||
if (value & URXD_BRK) {
|
||||
s->usr2 |= USR2_BRCD;
|
||||
}
|
||||
|
||||
imx_serial_rx_fifo_ageing_timer_restart(s);
|
||||
|
||||
imx_update(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
#define DESIGNWARE_PCIE_ATU_DEVFN(x) (((x) >> 16) & 0xff)
|
||||
#define DESIGNWARE_PCIE_ATU_UPPER_TARGET 0x91C
|
||||
|
||||
#define DESIGNWARE_PCIE_IRQ_MSI 3
|
||||
|
||||
static DesignwarePCIEHost *
|
||||
designware_pcie_root_to_host(DesignwarePCIERoot *root)
|
||||
{
|
||||
@@ -90,7 +88,7 @@ static void designware_pcie_root_msi_write(void *opaque, hwaddr addr,
|
||||
root->msi.intr[0].status |= BIT(val) & root->msi.intr[0].enable;
|
||||
|
||||
if (root->msi.intr[0].status & ~root->msi.intr[0].mask) {
|
||||
qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 1);
|
||||
qemu_set_irq(host->pci.msi, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +333,7 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
|
||||
case DESIGNWARE_PCIE_MSI_INTR0_STATUS:
|
||||
root->msi.intr[0].status ^= val;
|
||||
if (!root->msi.intr[0].status) {
|
||||
qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 0);
|
||||
qemu_set_irq(host->pci.msi, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -680,6 +678,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
|
||||
for (i = 0; i < ARRAY_SIZE(s->pci.irqs); i++) {
|
||||
sysbus_init_irq(sbd, &s->pci.irqs[i]);
|
||||
}
|
||||
sysbus_init_irq(sbd, &s->pci.msi);
|
||||
|
||||
memory_region_init_io(&s->mmio,
|
||||
OBJECT(s),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user