* [PATCH v3] hw/m68k/mcf5208: add support for reset
@ 2024-03-09 9:34 Angelo Dureghello
2024-03-09 14:47 ` Thomas Huth
2024-03-11 8:36 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Angelo Dureghello @ 2024-03-09 9:34 UTC (permalink / raw)
To: huth; +Cc: qemu-devel, Angelo Dureghello
Add reset support for mcf5208.
Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
---
hw/m68k/mcf5208.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 0cfb806c20..ec14096aa4 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -40,6 +40,8 @@
#define PCSR_PRE_SHIFT 8
#define PCSR_PRE_MASK 0x0f00
+#define RCR_SOFTRST 0x80
+
typedef struct {
MemoryRegion iomem;
qemu_irq irq;
@@ -185,12 +187,50 @@ static const MemoryRegionOps m5208_sys_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
+static uint64_t m5208_rcm_read(void *opaque, hwaddr addr,
+ unsigned size)
+{
+ return 0;
+}
+
+static void m5208_rcm_write(void *opaque, hwaddr addr,
+ uint64_t value, unsigned size)
+{
+ M68kCPU *cpu = opaque;
+ CPUState *cs = CPU(cpu);
+ switch (addr) {
+ case 0x0: /* RCR */
+ if (value & RCR_SOFTRST) {
+ cpu_reset(cs);
+ cpu->env.aregs[7] = ldl_phys(cs->as, 0);
+ cpu->env.pc = ldl_phys(cs->as, 4);
+ }
+ break;
+ default:
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
+ __func__, addr);
+ break;
+ }
+}
+
+static const MemoryRegionOps m5208_rcm_ops = {
+ .read = m5208_rcm_read,
+ .write = m5208_rcm_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
+static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic,
+ M68kCPU *cpu)
{
MemoryRegion *iomem = g_new(MemoryRegion, 1);
+ MemoryRegion *iomem_rcm = g_new(MemoryRegion, 1);
m5208_timer_state *s;
int i;
+ /* RCM */
+ memory_region_init_io(iomem_rcm, NULL, &m5208_rcm_ops, cpu,
+ "m5208-rcm", 0x00000080);
+ memory_region_add_subregion(address_space, 0xfc0a0000, iomem_rcm);
/* SDRAMC. */
memory_region_init_io(iomem, NULL, &m5208_sys_ops, NULL, "m5208-sys", 0x00004000);
memory_region_add_subregion(address_space, 0xfc0a8000, iomem);
@@ -265,7 +305,7 @@ static void mcf5208evb_init(MachineState *machine)
mcf_uart_create_mmap(0xfc064000, pic[27], serial_hd(1));
mcf_uart_create_mmap(0xfc068000, pic[28], serial_hd(2));
- mcf5208_sys_init(address_space_mem, pic);
+ mcf5208_sys_init(address_space_mem, pic, cpu);
mcf_fec_init(address_space_mem, 0xfc030000, pic + 36);
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hw/m68k/mcf5208: add support for reset
2024-03-09 9:34 [PATCH v3] hw/m68k/mcf5208: add support for reset Angelo Dureghello
@ 2024-03-09 14:47 ` Thomas Huth
2024-03-11 8:36 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2024-03-09 14:47 UTC (permalink / raw)
To: Angelo Dureghello; +Cc: qemu-devel
Am Sat, 9 Mar 2024 10:34:59 +0100
schrieb Angelo Dureghello <angelo@kernel-space.org>:
> Add reset support for mcf5208.
>
> Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
> ---
> hw/m68k/mcf5208.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 42 insertions(+), 2 deletions(-)
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hw/m68k/mcf5208: add support for reset
2024-03-09 9:34 [PATCH v3] hw/m68k/mcf5208: add support for reset Angelo Dureghello
2024-03-09 14:47 ` Thomas Huth
@ 2024-03-11 8:36 ` Philippe Mathieu-Daudé
2024-03-11 8:37 ` Angelo Dureghello
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-11 8:36 UTC (permalink / raw)
To: Angelo Dureghello, huth; +Cc: qemu-devel
On 9/3/24 10:34, Angelo Dureghello wrote:
> Add reset support for mcf5208.
>
> Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
> ---
> hw/m68k/mcf5208.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 42 insertions(+), 2 deletions(-)
Thanks, merged as commit d3c79c3974.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hw/m68k/mcf5208: add support for reset
2024-03-11 8:36 ` Philippe Mathieu-Daudé
@ 2024-03-11 8:37 ` Angelo Dureghello
0 siblings, 0 replies; 4+ messages in thread
From: Angelo Dureghello @ 2024-03-11 8:37 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, huth; +Cc: qemu-devel
thanks !
On 11/03/24 9:36 AM, Philippe Mathieu-Daudé wrote:
> On 9/3/24 10:34, Angelo Dureghello wrote:
>> Add reset support for mcf5208.
>>
>> Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
>> ---
>> hw/m68k/mcf5208.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> Thanks, merged as commit d3c79c3974.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-11 8:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-09 9:34 [PATCH v3] hw/m68k/mcf5208: add support for reset Angelo Dureghello
2024-03-09 14:47 ` Thomas Huth
2024-03-11 8:36 ` Philippe Mathieu-Daudé
2024-03-11 8:37 ` Angelo Dureghello
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).