[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/34] next-cube: move floppy disk MMIO to separate memory reg
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 09/34] next-cube: move floppy disk MMIO to separate memory region in next-pc |
Date: |
Thu, 12 Dec 2024 11:45:55 +0000 |
The dummy floppy disk device is part of the next-pc device, and not related to
the NeXTCube SCRs.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
---
hw/m68k/next-cube.c | 61 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 12 deletions(-)
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index ea1006efb3..d08026ccf9 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -108,6 +108,7 @@ struct NeXTPC {
M68kCPU *cpu;
+ MemoryRegion floppy_mem;
MemoryRegion mmiomem;
MemoryRegion scrmem;
@@ -368,11 +369,6 @@ static uint64_t next_scr_readfn(void *opaque, hwaddr addr,
unsigned size)
uint64_t val;
switch (addr) {
- case 0x14108:
- DPRINTF("FD read @ %x\n", (unsigned int)addr);
- val = 0x40 | 0x04 | 0x2 | 0x1;
- break;
-
/*
* These 4 registers are the hardware timer, not sure which register
* is the latch instead of data, but no problems so far.
@@ -402,13 +398,6 @@ static void next_scr_writefn(void *opaque, hwaddr addr,
uint64_t val,
unsigned size)
{
switch (addr) {
- case 0x14108:
- DPRINTF("FDCSR Write: %"PRIx64 "\n", val);
- if (val == 0x0) {
- /* qemu_irq_raise(s->fd_irq[0]); */
- }
- break;
-
/* Hardware timer latch - not implemented yet */
case 0x1a000:
default:
@@ -948,6 +937,47 @@ static const TypeInfo next_scsi_info = {
.class_init = next_scsi_class_init,
};
+static void next_floppy_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned size)
+{
+ switch (addr) {
+ case 0:
+ DPRINTF("FDCSR Write: %"PRIx64 "\n", val);
+ if (val == 0x0) {
+ /* qemu_irq_raise(s->fd_irq[0]); */
+ }
+ break;
+
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static uint64_t next_floppy_read(void *opaque, hwaddr addr, unsigned size)
+{
+ uint64_t val;
+
+ switch (addr) {
+ case 0:
+ DPRINTF("FD read @ %x\n", (unsigned int)addr);
+ val = 0x40 | 0x04 | 0x2 | 0x1;
+ break;
+
+ default:
+ g_assert_not_reached();
+ }
+
+ return val;
+}
+
+static const MemoryRegionOps next_floppy_ops = {
+ .read = next_floppy_read,
+ .write = next_floppy_write,
+ .valid.min_access_size = 1,
+ .valid.max_access_size = 4,
+ .endianness = DEVICE_BIG_ENDIAN,
+};
+
static void next_escc_init(DeviceState *pcdev)
{
DeviceState *dev;
@@ -1006,6 +1036,10 @@ static void next_pc_realize(DeviceState *dev, Error
**errp)
s->scsi_reset = qdev_get_gpio_in(d, 0);
s->scsi_dma = qdev_get_gpio_in(d, 1);
+
+ /* Floppy */
+ memory_region_add_subregion(&s->scrmem, 0x14108,
+ &s->floppy_mem);
}
static void next_pc_init(Object *obj)
@@ -1024,6 +1058,9 @@ static void next_pc_init(Object *obj)
sysbus_init_mmio(sbd, &s->scrmem);
object_initialize_child(obj, "next-scsi", &s->next_scsi, TYPE_NEXT_SCSI);
+
+ memory_region_init_io(&s->floppy_mem, OBJECT(s), &next_floppy_ops, s,
+ "next.floppy", 4);
}
/*
--
2.39.5
- [PATCH v2 03/34] next-cube: create new next.scsi container memory region, (continued)
- [PATCH v2 03/34] next-cube: create new next.scsi container memory region, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 02/34] next-cube: remove overlap between next.dma and next.mmio memory regions, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 04/34] next-cube: move next_scsi_init() to next_pc_realize(), Mark Cave-Ayland, 2024/12/12
- [PATCH v2 05/34] next-cube: introduce next_pc_init() object init function, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 07/34] next-cube: move SCSI CSRs from next-pc to the next-scsi device, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 09/34] next-cube: move floppy disk MMIO to separate memory region in next-pc,
Mark Cave-Ayland <=
- [PATCH v2 08/34] next-cube: move SCSI 4020/4021 logic from next-pc device to next-scsi device, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 06/34] next-cube: introduce next-scsi device, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 12/34] next-cube: move timer MMIO to separate memory region on next-pc device, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 10/34] next-cube: map ESCC registers as a subregion of the next.scr memory region, Mark Cave-Ayland, 2024/12/12
- [PATCH v2 11/34] next-cube: move ESCC to be QOM child of next-pc device, Mark Cave-Ayland, 2024/12/12