... | ... | ||
---|---|---|---|
27 | the next-cube machine is currently unable to boot anything useful, I don't see | 27 | the next-cube machine is currently unable to boot anything useful, I don't see |
28 | this as an issue. | 28 | this as an issue. |
29 | 29 | ||
30 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 30 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
31 | 31 | ||
32 | [Patches still needing review: 3, 7, 8, 11, 17, 21, 25, 28, 29, 30, 31, 34] | ||
32 | 33 | ||
33 | Mark Cave-Ayland (36): | 34 | v2: |
34 | next-cube: fix up compilation when DEBUG_NEXT is enabled | 35 | - Rebase onto master |
36 | - Drop patches 1 and 4 (these have been merged separately as bugfixes) | ||
37 | - Add R-B tags from Thomas and Phil | ||
38 | - Update commit message in patch 2 | ||
39 | - Add comments containing system register addresses as requested by Thomas in | ||
40 | patch 2 | ||
41 | - Update description for patch 7 explaining that the SCSI CSRs are also now | ||
42 | modelled as standard registers (similar to Previous) | ||
43 | - Update description for patch 8 explaining why the previously hardcoded value | ||
44 | has been dropped | ||
45 | - Add comments suggesting unimplemented devices in patch 14 | ||
46 | - Remove next_rtc_vmstate from next_pc_vmstate in patch 25 | ||
47 | - Fix cut/paste error in patch 30 headline | ||
48 | |||
49 | |||
50 | Mark Cave-Ayland (34): | ||
35 | next-cube: remove 0x14020 dummy value from next_mmio_read() | 51 | next-cube: remove 0x14020 dummy value from next_mmio_read() |
36 | next-cube: remove overlap between next.dma and next.mmio memory | 52 | next-cube: remove overlap between next.dma and next.mmio memory |
37 | regions | 53 | regions |
38 | next-cube: remove cpu parameter from next_scsi_init() | ||
39 | next-cube: create new next.scsi container memory region | 54 | next-cube: create new next.scsi container memory region |
40 | next-cube: move next_scsi_init() to next_pc_realize() | 55 | next-cube: move next_scsi_init() to next_pc_realize() |
41 | next-cube: introduce next_pc_init() object init function | 56 | next-cube: introduce next_pc_init() object init function |
42 | next-cube: introduce next-scsi device | 57 | next-cube: introduce next-scsi device |
43 | next-cube: move SCSI CSRs from next-pc to the next-scsi device | 58 | next-cube: move SCSI CSRs from next-pc to the next-scsi device |
44 | next-cube: move SCSI 4020 logic from next-pc device to next-scsi | 59 | next-cube: move SCSI 4020/4021 logic from next-pc device to next-scsi |
45 | device | 60 | device |
46 | next-cube: move floppy disk MMIO to separate memory region in next-pc | 61 | next-cube: move floppy disk MMIO to separate memory region in next-pc |
47 | next-cube: map ESCC registers as a subregion of the next.scr memory | 62 | next-cube: map ESCC registers as a subregion of the next.scr memory |
48 | region | 63 | region |
49 | next-cube: move ESCC to be QOM child of next-pc device | 64 | next-cube: move ESCC to be QOM child of next-pc device |
... | ... | ||
65 | next-cube: QOMify NeXTRTC | 80 | next-cube: QOMify NeXTRTC |
66 | next-cube: move reset of next-rtc fields from next-pc to next-rtc | 81 | next-cube: move reset of next-rtc fields from next-pc to next-rtc |
67 | next-cube: move rtc-data-in gpio from next-pc to next-rtc device | 82 | next-cube: move rtc-data-in gpio from next-pc to next-rtc device |
68 | next-cube: use named gpio output for next-rtc data | 83 | next-cube: use named gpio output for next-rtc data |
69 | next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine | 84 | next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine |
70 | next-cube: add rtc-power-out named gpio to reset the rtc state machine | 85 | next-cube: add rtc-power-out named gpio to trigger the NEXT_PWR_I |
86 | interrupt | ||
71 | next-cube: move next_rtc_cmd_is_write() and next_rtc_data_in_irq() | 87 | next-cube: move next_rtc_cmd_is_write() and next_rtc_data_in_irq() |
72 | functions | 88 | functions |
73 | next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update() | 89 | next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update() |
74 | next-cube: add my copyright to the top of the file | 90 | next-cube: add my copyright to the top of the file |
75 | next-cube: replace boiler-plate GPL 2.0 or later license text with | 91 | next-cube: replace boiler-plate GPL 2.0 or later license text with |
76 | SPDX identifier | 92 | SPDX identifier |
77 | 93 | ||
78 | hw/m68k/Kconfig | 1 + | 94 | hw/m68k/Kconfig | 1 + |
79 | hw/m68k/next-cube.c | 1025 +++++++++++++++++++++++++++---------------- | 95 | hw/m68k/next-cube.c | 1026 +++++++++++++++++++++++++++---------------- |
80 | 2 files changed, 655 insertions(+), 371 deletions(-) | 96 | 2 files changed, 659 insertions(+), 368 deletions(-) |
81 | 97 | ||
82 | -- | 98 | -- |
83 | 2.39.5 | 99 | 2.39.5 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | These were accidentally introduced by my last series. | ||
2 | 1 | ||
3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
4 | --- | ||
5 | hw/m68k/next-cube.c | 10 +++++----- | ||
6 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
7 | |||
8 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/hw/m68k/next-cube.c | ||
11 | +++ b/hw/m68k/next-cube.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void next_scr_writefn(void *opaque, hwaddr addr, uint64_t val, | ||
13 | |||
14 | switch (addr) { | ||
15 | case 0x14108: | ||
16 | - DPRINTF("FDCSR Write: %x\n", value); | ||
17 | + DPRINTF("FDCSR Write: %"PRIx64 "\n", val); | ||
18 | if (val == 0x0) { | ||
19 | /* qemu_irq_raise(s->fd_irq[0]); */ | ||
20 | } | ||
21 | @@ -XXX,XX +XXX,XX @@ static void next_scr_writefn(void *opaque, hwaddr addr, uint64_t val, | ||
22 | /* int_mask |= 0x1000; */ | ||
23 | /* s->scsi_csr_1 |= 0x80; */ | ||
24 | } | ||
25 | - DPRINTF("SCSICSR Write: %x\n", val); | ||
26 | + DPRINTF("SCSICSR Write: %"PRIx64 "\n", val); | ||
27 | /* s->scsi_csr_1 = val; */ | ||
28 | break; | ||
29 | |||
30 | /* Hardware timer latch - not implemented yet */ | ||
31 | case 0x1a000: | ||
32 | default: | ||
33 | - DPRINTF("BMAP Write @ 0x%x with 0x%x size %u\n", (unsigned int)addr, | ||
34 | - val, size); | ||
35 | + DPRINTF("BMAP Write @ 0x%x with 0x%"PRIx64 " size %u\n", | ||
36 | + (unsigned int)addr, val, size); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | @@ -XXX,XX +XXX,XX @@ static void next_dma_write(void *opaque, hwaddr addr, uint64_t val, | ||
41 | break; | ||
42 | |||
43 | default: | ||
44 | - DPRINTF("DMA write @ %x w/ %x\n", (unsigned)addr, (unsigned)value); | ||
45 | + DPRINTF("DMA write @ %x w/ %x\n", (unsigned)addr, (unsigned)val); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | -- | ||
50 | 2.39.5 | diff view generated by jsdifflib |
1 | This is a dummy value for the SCSI CSR which appears to have no effect when | 1 | This is a dummy value for the SCSI CSR which appears to have no effect when |
---|---|---|---|
2 | removed. Eventually the reads/writes to this register will be directed | 2 | removed. Eventually the reads/writes to this register will be directed |
3 | towards the WIP implementations in next_scr_readfn() and next_scr_writefn(). | 3 | towards the WIP implementations in next_scr_readfn() and next_scr_writefn(). |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/next-cube.c | 4 ---- | 8 | hw/m68k/next-cube.c | 4 ---- |
8 | 1 file changed, 4 deletions(-) | 9 | 1 file changed, 4 deletions(-) |
9 | 10 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 11 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Change the start of the next.mmio memory region so that it follows on directly | 1 | Change the start of the next.mmio memory region so that it follows on directly |
---|---|---|---|
2 | after the next.dma memory region, adjusting the address offsets in | 2 | after the next.dma memory region. Increase the address offsets in |
3 | next_mmio_read() and next_mmio_write() accordingly. | 3 | next_mmio_read() and next_mmio_write(), and reduce the size of the next.mmio |
4 | memory region accordingly. | ||
4 | 5 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 6 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | --- | 8 | --- |
7 | hw/m68k/next-cube.c | 28 ++++++++++++++-------------- | 9 | hw/m68k/next-cube.c | 28 ++++++++++++++-------------- |
8 | 1 file changed, 14 insertions(+), 14 deletions(-) | 10 | 1 file changed, 14 insertions(+), 14 deletions(-) |
9 | 11 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 12 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | ||
14 | @@ -XXX,XX +XXX,XX @@ static uint64_t next_mmio_read(void *opaque, hwaddr addr, unsigned size) | 16 | @@ -XXX,XX +XXX,XX @@ static uint64_t next_mmio_read(void *opaque, hwaddr addr, unsigned size) |
15 | uint64_t val; | 17 | uint64_t val; |
16 | 18 | ||
17 | switch (addr) { | 19 | switch (addr) { |
18 | - case 0x7000: | 20 | - case 0x7000: |
19 | + case 0x2000: | 21 | + case 0x2000: /* 0x2005000 */ |
20 | /* DPRINTF("Read INT status: %x\n", s->int_status); */ | 22 | /* DPRINTF("Read INT status: %x\n", s->int_status); */ |
21 | val = s->int_status; | 23 | val = s->int_status; |
22 | break; | 24 | break; |
23 | 25 | ||
24 | - case 0x7800: | 26 | - case 0x7800: |
25 | + case 0x2800: | 27 | + case 0x2800: /* 0x2007800 */ |
26 | DPRINTF("MMIO Read INT mask: %x\n", s->int_mask); | 28 | DPRINTF("MMIO Read INT mask: %x\n", s->int_mask); |
27 | val = s->int_mask; | 29 | val = s->int_mask; |
28 | break; | 30 | break; |
29 | 31 | ||
30 | - case 0xc000 ... 0xc003: | 32 | - case 0xc000 ... 0xc003: |
31 | - val = extract32(s->scr1, (4 - (addr - 0xc000) - size) << 3, | 33 | - val = extract32(s->scr1, (4 - (addr - 0xc000) - size) << 3, |
32 | + case 0x7000 ... 0x7003: | 34 | + case 0x7000 ... 0x7003: /* 0x200c000 */ |
33 | + val = extract32(s->scr1, (4 - (addr - 0x7000) - size) << 3, | 35 | + val = extract32(s->scr1, (4 - (addr - 0x7000) - size) << 3, |
34 | size << 3); | 36 | size << 3); |
35 | break; | 37 | break; |
36 | 38 | ||
37 | - case 0xd000 ... 0xd003: | 39 | - case 0xd000 ... 0xd003: |
38 | - val = extract32(s->scr2, (4 - (addr - 0xd000) - size) << 3, | 40 | - val = extract32(s->scr2, (4 - (addr - 0xd000) - size) << 3, |
39 | + case 0x8000 ... 0x8003: | 41 | + case 0x8000 ... 0x8003: /* 0x200d000 */ |
40 | + val = extract32(s->scr2, (4 - (addr - 0x8000) - size) << 3, | 42 | + val = extract32(s->scr2, (4 - (addr - 0x8000) - size) << 3, |
41 | size << 3); | 43 | size << 3); |
42 | break; | 44 | break; |
43 | 45 | ||
44 | @@ -XXX,XX +XXX,XX @@ static void next_mmio_write(void *opaque, hwaddr addr, uint64_t val, | 46 | @@ -XXX,XX +XXX,XX @@ static void next_mmio_write(void *opaque, hwaddr addr, uint64_t val, |
45 | NeXTPC *s = NEXT_PC(opaque); | 47 | NeXTPC *s = NEXT_PC(opaque); |
46 | 48 | ||
47 | switch (addr) { | 49 | switch (addr) { |
48 | - case 0x7000: | 50 | - case 0x7000: |
49 | + case 0x2000: | 51 | + case 0x2000: /* 0x2005000 */ |
50 | DPRINTF("INT Status old: %x new: %x\n", s->int_status, | 52 | DPRINTF("INT Status old: %x new: %x\n", s->int_status, |
51 | (unsigned int)val); | 53 | (unsigned int)val); |
52 | s->int_status = val; | 54 | s->int_status = val; |
53 | break; | 55 | break; |
54 | 56 | ||
55 | - case 0x7800: | 57 | - case 0x7800: |
56 | + case 0x2800: | 58 | + case 0x2800: /* 0x2007800 */ |
57 | DPRINTF("INT Mask old: %x new: %x\n", s->int_mask, (unsigned int)val); | 59 | DPRINTF("INT Mask old: %x new: %x\n", s->int_mask, (unsigned int)val); |
58 | s->int_mask = val; | 60 | s->int_mask = val; |
59 | break; | 61 | break; |
60 | 62 | ||
61 | - case 0xc000 ... 0xc003: | 63 | - case 0xc000 ... 0xc003: |
62 | + case 0x7000 ... 0x7003: | 64 | + case 0x7000 ... 0x7003: /* 0x200c000 */ |
63 | DPRINTF("SCR1 Write: %x\n", (unsigned int)val); | 65 | DPRINTF("SCR1 Write: %x\n", (unsigned int)val); |
64 | - s->scr1 = deposit32(s->scr1, (4 - (addr - 0xc000) - size) << 3, | 66 | - s->scr1 = deposit32(s->scr1, (4 - (addr - 0xc000) - size) << 3, |
65 | + s->scr1 = deposit32(s->scr1, (4 - (addr - 0x7000) - size) << 3, | 67 | + s->scr1 = deposit32(s->scr1, (4 - (addr - 0x7000) - size) << 3, |
66 | size << 3, val); | 68 | size << 3, val); |
67 | break; | 69 | break; |
68 | 70 | ||
69 | - case 0xd000 ... 0xd003: | 71 | - case 0xd000 ... 0xd003: |
70 | - s->scr2 = deposit32(s->scr2, (4 - (addr - 0xd000) - size) << 3, | 72 | - s->scr2 = deposit32(s->scr2, (4 - (addr - 0xd000) - size) << 3, |
71 | + case 0x8000 ... 0x8003: | 73 | + case 0x8000 ... 0x8003: /* 0x200d000 */ |
72 | + s->scr2 = deposit32(s->scr2, (4 - (addr - 0x8000) - size) << 3, | 74 | + s->scr2 = deposit32(s->scr2, (4 - (addr - 0x8000) - size) << 3, |
73 | size << 3, val); | 75 | size << 3, val); |
74 | next_scr2_led_update(s); | 76 | next_scr2_led_update(s); |
75 | next_scr2_rtc_update(s); | 77 | next_scr2_rtc_update(s); |
76 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) | 78 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) |
... | ... | ||
91 | 93 | ||
92 | /* BMAP IO - acts as a catch-all for now */ | 94 | /* BMAP IO - acts as a catch-all for now */ |
93 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); | 95 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); |
94 | -- | 96 | -- |
95 | 2.39.5 | 97 | 2.39.5 |
98 | |||
99 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The parameter is not used. | ||
2 | 1 | ||
3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
4 | --- | ||
5 | hw/m68k/next-cube.c | 4 ++-- | ||
6 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
7 | |||
8 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/hw/m68k/next-cube.c | ||
11 | +++ b/hw/m68k/next-cube.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void nextscsi_write(void *opaque, uint8_t *buf, int size) | ||
13 | nextdma_write(opaque, buf, size, NEXTDMA_SCSI); | ||
14 | } | ||
15 | |||
16 | -static void next_scsi_init(DeviceState *pcdev, M68kCPU *cpu) | ||
17 | +static void next_scsi_init(DeviceState *pcdev) | ||
18 | { | ||
19 | struct NeXTPC *next_pc = NEXT_PC(pcdev); | ||
20 | DeviceState *dev; | ||
21 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) | ||
22 | /* TODO: */ | ||
23 | /* Network */ | ||
24 | /* SCSI */ | ||
25 | - next_scsi_init(pcdev, cpu); | ||
26 | + next_scsi_init(pcdev); | ||
27 | |||
28 | /* DMA */ | ||
29 | memory_region_init_io(&m->dmamem, NULL, &next_dma_ops, machine, | ||
30 | -- | ||
31 | 2.39.5 | diff view generated by jsdifflib |
1 | Move the ESP SCSI and SCSI CSR registers to the new next.scsi container memory | 1 | Move the ESP SCSI and SCSI CSR registers to the new next.scsi container memory |
---|---|---|---|
2 | region. | 2 | region. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 8 +++++++- | 6 | hw/m68k/next-cube.c | 8 +++++++- |
7 | 1 file changed, 7 insertions(+), 1 deletion(-) | 7 | 1 file changed, 7 insertions(+), 1 deletion(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { | 13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { |
14 | 14 | ||
15 | MemoryRegion mmiomem; | 15 | MemoryRegion mmiomem; |
16 | MemoryRegion scrmem; | 16 | MemoryRegion scrmem; |
17 | + MemoryRegion scsimem; | 17 | + MemoryRegion scsimem; |
18 | 18 | ||
19 | uint32_t scr1; | 19 | uint32_t scr1; |
20 | uint32_t scr2; | 20 | uint32_t scr2; |
21 | @@ -XXX,XX +XXX,XX @@ static void next_scsi_init(DeviceState *pcdev) | 21 | @@ -XXX,XX +XXX,XX @@ static void next_scsi_init(DeviceState *pcdev) |
22 | sysbusdev = SYS_BUS_DEVICE(dev); | 22 | sysbusdev = SYS_BUS_DEVICE(dev); |
23 | sysbus_realize_and_unref(sysbusdev, &error_fatal); | 23 | sysbus_realize_and_unref(sysbusdev, &error_fatal); |
24 | sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(pcdev, NEXT_SCSI_I)); | 24 | sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(pcdev, NEXT_SCSI_I)); |
25 | - sysbus_mmio_map(sysbusdev, 0, 0x2114000); | 25 | - sysbus_mmio_map(sysbusdev, 0, 0x2114000); |
26 | + | 26 | + |
27 | + memory_region_init(&next_pc->scsimem, OBJECT(next_pc), "next.scsi", 0x40); | 27 | + memory_region_init(&next_pc->scsimem, OBJECT(next_pc), "next.scsi", 0x40); |
28 | + memory_region_add_subregion(&next_pc->scsimem, 0x0, | 28 | + memory_region_add_subregion(&next_pc->scsimem, 0x0, |
29 | + sysbus_mmio_get_region(sysbusdev, 0)); | 29 | + sysbus_mmio_get_region(sysbusdev, 0)); |
30 | + | 30 | + |
31 | + memory_region_add_subregion(&next_pc->scrmem, 0x14000, &next_pc->scsimem); | 31 | + memory_region_add_subregion(&next_pc->scrmem, 0x14000, &next_pc->scsimem); |
32 | 32 | ||
33 | next_pc->scsi_reset = qdev_get_gpio_in(dev, 0); | 33 | next_pc->scsi_reset = qdev_get_gpio_in(dev, 0); |
34 | next_pc->scsi_dma = qdev_get_gpio_in(dev, 1); | 34 | next_pc->scsi_dma = qdev_get_gpio_in(dev, 1); |
35 | -- | 35 | -- |
36 | 2.39.5 | 36 | 2.39.5 | diff view generated by jsdifflib |
1 | This reflects that the SCSI interface exists within the NeXT Peripheral | 1 | This reflects that the SCSI interface exists within the NeXT Peripheral |
---|---|---|---|
2 | Controller (PC). | 2 | Controller (PC). |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 5 +++-- | 7 | hw/m68k/next-cube.c | 5 +++-- |
7 | 1 file changed, 3 insertions(+), 2 deletions(-) | 8 | 1 file changed, 3 insertions(+), 2 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Move initialisation of the memory regions and GPIOs from next_pc_realize() to | 1 | Move initialisation of the memory regions and GPIOs from next_pc_realize() to |
---|---|---|---|
2 | the new next_pc_init() function. | 2 | the new next_pc_init() function. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 17 +++++++++++------ | 7 | hw/m68k/next-cube.c | 17 +++++++++++------ |
7 | 1 file changed, 11 insertions(+), 6 deletions(-) | 8 | 1 file changed, 11 insertions(+), 6 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | This device is intended to hold the ESP SCSI controller and the NeXT SCSI CSRs. | 1 | This device is intended to hold the ESP SCSI controller and the NeXT SCSI CSRs. |
---|---|---|---|
2 | Start by creating the device and moving the ESP SCSI controller to be an | 2 | Start by creating the device and moving the ESP SCSI controller to be an |
3 | embedded child device. | 3 | embedded child device. |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/next-cube.c | 93 ++++++++++++++++++++++++++++++++++++--------- | 8 | hw/m68k/next-cube.c | 93 ++++++++++++++++++++++++++++++++++++--------- |
8 | 1 file changed, 74 insertions(+), 19 deletions(-) | 9 | 1 file changed, 74 insertions(+), 19 deletions(-) |
9 | 10 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 11 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | The SCSI CSRs are located within the SCSI subsystem of the NeXT PC (Peripheral | 1 | The SCSI CSRs are located within the SCSI subsystem of the NeXT PC (Peripheral |
---|---|---|---|
2 | Contoller) which is now modelled as a separate QEMU device. | 2 | Contoller) which is now modelled as a separate QEMU device. Add a new memory |
3 | region subregion to contain the SCSI CSRs that simply store and retrieve the | ||
4 | register values. | ||
3 | 5 | ||
4 | Add a new VMStateDescription for the next-scsi device to enable the SCSI CSRs | 6 | Add a new VMStateDescription for the next-scsi device to enable the SCSI CSRs |
5 | to be migrated. | 7 | to be migrated. |
6 | 8 | ||
7 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 9 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
... | ... | diff view generated by jsdifflib |
1 | The SCSI 4020 logic refers to the offset of the SCSI CSRs within the NeXTCube | 1 | The SCSI 4020/4021 logic refers to the offset of the SCSI CSRs within the NeXTCube |
---|---|---|---|
2 | address space. Due to the previously overlapping memory regions, there were | 2 | address space. Due to the previously overlapping memory regions, there were |
3 | duplicate MMIO accessors in the next.scr memory region for these registers but | 3 | duplicate MMIO accessors in the next.scr memory region for these registers but |
4 | now this has been resolved. This allows us to move the more complex prototype | 4 | this has now been resolved. |
5 | logic into the next-scsi MMIO accessors. | 5 | |
6 | Move the remaining SCSI 4020/4021 logic from the next-pc device to the next-scsi | ||
7 | device, with the exception that the SCSI 4021 register now returns its previous | ||
8 | value like a normal register instead of a hardcoded 0x40 value. This also matches | ||
9 | how the registers are implemented in the Previous emulator. | ||
6 | 10 | ||
7 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 11 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
8 | --- | 12 | --- |
9 | hw/m68k/next-cube.c | 139 ++++++++++++++++++++------------------------ | 13 | hw/m68k/next-cube.c | 139 ++++++++++++++++++++------------------------ |
10 | 1 file changed, 62 insertions(+), 77 deletions(-) | 14 | 1 file changed, 62 insertions(+), 77 deletions(-) |
... | ... | diff view generated by jsdifflib |
1 | The dummy floppy disk device is part of the next-pc device, and not related to | 1 | The dummy floppy disk device is part of the next-pc device, and not related to |
---|---|---|---|
2 | the NeXTCube SCRs. | 2 | the NeXTCube SCRs. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 61 ++++++++++++++++++++++++++++++++++++--------- | 7 | hw/m68k/next-cube.c | 61 ++++++++++++++++++++++++++++++++++++--------- |
7 | 1 file changed, 49 insertions(+), 12 deletions(-) | 8 | 1 file changed, 49 insertions(+), 12 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Since the ESCC device exists within the memory range of the next.scr memory region, map | 1 | Since the ESCC device exists within the memory range of the next.scr memory region, map |
---|---|---|---|
2 | the ESCC device registers as a subregion of the next.scr memory region instead of | 2 | the ESCC device registers as a subregion of the next.scr memory region instead of |
3 | directly to the system address space. | 3 | directly to the system address space. |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/next-cube.c | 5 ++++- | 8 | hw/m68k/next-cube.c | 5 ++++- |
8 | 1 file changed, 4 insertions(+), 1 deletion(-) | 9 | 1 file changed, 4 insertions(+), 1 deletion(-) |
9 | 10 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 11 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Since the ESCC is part of the next-pc device, move the ESCC to be a QOM child | 1 | Since the ESCC is part of the next-pc device, move the ESCC to be a QOM child |
---|---|---|---|
2 | of the next-pc device. | 2 | of the next-pc device. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 54 ++++++++++++++++++++++----------------------- | 6 | hw/m68k/next-cube.c | 54 ++++++++++++++++++++++----------------------- |
7 | 1 file changed, 26 insertions(+), 28 deletions(-) | 7 | 1 file changed, 26 insertions(+), 28 deletions(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { | 13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { |
14 | qemu_irq scsi_reset; | 14 | qemu_irq scsi_reset; |
15 | qemu_irq scsi_dma; | 15 | qemu_irq scsi_dma; |
16 | 16 | ||
17 | + ESCCState escc; | 17 | + ESCCState escc; |
18 | + | 18 | + |
19 | NextRtc rtc; | 19 | NextRtc rtc; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_floppy_ops = { | 22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_floppy_ops = { |
23 | .endianness = DEVICE_BIG_ENDIAN, | 23 | .endianness = DEVICE_BIG_ENDIAN, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | -static void next_escc_init(DeviceState *pcdev) | 26 | -static void next_escc_init(DeviceState *pcdev) |
27 | -{ | 27 | -{ |
28 | - NeXTPC *next_pc = NEXT_PC(pcdev); | 28 | - NeXTPC *next_pc = NEXT_PC(pcdev); |
29 | - DeviceState *dev; | 29 | - DeviceState *dev; |
30 | - SysBusDevice *s; | 30 | - SysBusDevice *s; |
31 | - | 31 | - |
32 | - dev = qdev_new(TYPE_ESCC); | 32 | - dev = qdev_new(TYPE_ESCC); |
33 | - qdev_prop_set_uint32(dev, "disabled", 0); | 33 | - qdev_prop_set_uint32(dev, "disabled", 0); |
34 | - qdev_prop_set_uint32(dev, "frequency", 9600 * 384); | 34 | - qdev_prop_set_uint32(dev, "frequency", 9600 * 384); |
35 | - qdev_prop_set_uint32(dev, "it_shift", 0); | 35 | - qdev_prop_set_uint32(dev, "it_shift", 0); |
36 | - qdev_prop_set_bit(dev, "bit_swap", true); | 36 | - qdev_prop_set_bit(dev, "bit_swap", true); |
37 | - qdev_prop_set_chr(dev, "chrB", serial_hd(1)); | 37 | - qdev_prop_set_chr(dev, "chrB", serial_hd(1)); |
38 | - qdev_prop_set_chr(dev, "chrA", serial_hd(0)); | 38 | - qdev_prop_set_chr(dev, "chrA", serial_hd(0)); |
39 | - qdev_prop_set_uint32(dev, "chnBtype", escc_serial); | 39 | - qdev_prop_set_uint32(dev, "chnBtype", escc_serial); |
40 | - qdev_prop_set_uint32(dev, "chnAtype", escc_serial); | 40 | - qdev_prop_set_uint32(dev, "chnAtype", escc_serial); |
41 | - | 41 | - |
42 | - s = SYS_BUS_DEVICE(dev); | 42 | - s = SYS_BUS_DEVICE(dev); |
43 | - sysbus_realize_and_unref(s, &error_fatal); | 43 | - sysbus_realize_and_unref(s, &error_fatal); |
44 | - sysbus_connect_irq(s, 0, qdev_get_gpio_in(pcdev, NEXT_SCC_I)); | 44 | - sysbus_connect_irq(s, 0, qdev_get_gpio_in(pcdev, NEXT_SCC_I)); |
45 | - sysbus_connect_irq(s, 1, qdev_get_gpio_in(pcdev, NEXT_SCC_DMA_I)); | 45 | - sysbus_connect_irq(s, 1, qdev_get_gpio_in(pcdev, NEXT_SCC_DMA_I)); |
46 | - | 46 | - |
47 | - memory_region_add_subregion(&next_pc->scrmem, 0x18000, | 47 | - memory_region_add_subregion(&next_pc->scrmem, 0x18000, |
48 | - sysbus_mmio_get_region(s, 0)); | 48 | - sysbus_mmio_get_region(s, 0)); |
49 | -} | 49 | -} |
50 | - | 50 | - |
51 | static void next_pc_reset(DeviceState *dev) | 51 | static void next_pc_reset(DeviceState *dev) |
52 | { | 52 | { |
53 | NeXTPC *s = NEXT_PC(dev); | 53 | NeXTPC *s = NEXT_PC(dev); |
54 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) | 54 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) |
55 | /* Floppy */ | 55 | /* Floppy */ |
56 | memory_region_add_subregion(&s->scrmem, 0x14108, | 56 | memory_region_add_subregion(&s->scrmem, 0x14108, |
57 | &s->floppy_mem); | 57 | &s->floppy_mem); |
58 | + | 58 | + |
59 | + /* ESCC */ | 59 | + /* ESCC */ |
60 | + d = DEVICE(object_resolve_path_component(OBJECT(dev), "escc")); | 60 | + d = DEVICE(object_resolve_path_component(OBJECT(dev), "escc")); |
61 | + qdev_prop_set_uint32(d, "disabled", 0); | 61 | + qdev_prop_set_uint32(d, "disabled", 0); |
62 | + qdev_prop_set_uint32(d, "frequency", 9600 * 384); | 62 | + qdev_prop_set_uint32(d, "frequency", 9600 * 384); |
63 | + qdev_prop_set_uint32(d, "it_shift", 0); | 63 | + qdev_prop_set_uint32(d, "it_shift", 0); |
64 | + qdev_prop_set_bit(d, "bit_swap", true); | 64 | + qdev_prop_set_bit(d, "bit_swap", true); |
65 | + qdev_prop_set_chr(d, "chrB", serial_hd(1)); | 65 | + qdev_prop_set_chr(d, "chrB", serial_hd(1)); |
66 | + qdev_prop_set_chr(d, "chrA", serial_hd(0)); | 66 | + qdev_prop_set_chr(d, "chrA", serial_hd(0)); |
67 | + qdev_prop_set_uint32(d, "chnBtype", escc_serial); | 67 | + qdev_prop_set_uint32(d, "chnBtype", escc_serial); |
68 | + qdev_prop_set_uint32(d, "chnAtype", escc_serial); | 68 | + qdev_prop_set_uint32(d, "chnAtype", escc_serial); |
69 | + | 69 | + |
70 | + sbd = SYS_BUS_DEVICE(d); | 70 | + sbd = SYS_BUS_DEVICE(d); |
71 | + if (!sysbus_realize(sbd, errp)) { | 71 | + if (!sysbus_realize(sbd, errp)) { |
72 | + return; | 72 | + return; |
73 | + } | 73 | + } |
74 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(dev, NEXT_SCC_I)); | 74 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(dev, NEXT_SCC_I)); |
75 | + sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(dev, NEXT_SCC_DMA_I)); | 75 | + sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(dev, NEXT_SCC_DMA_I)); |
76 | + | 76 | + |
77 | + memory_region_add_subregion(&s->scrmem, 0x18000, | 77 | + memory_region_add_subregion(&s->scrmem, 0x18000, |
78 | + sysbus_mmio_get_region(sbd, 0)); | 78 | + sysbus_mmio_get_region(sbd, 0)); |
79 | + | 79 | + |
80 | } | 80 | } |
81 | 81 | ||
82 | static void next_pc_init(Object *obj) | 82 | static void next_pc_init(Object *obj) |
83 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) | 83 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) |
84 | 84 | ||
85 | memory_region_init_io(&s->floppy_mem, OBJECT(s), &next_floppy_ops, s, | 85 | memory_region_init_io(&s->floppy_mem, OBJECT(s), &next_floppy_ops, s, |
86 | "next.floppy", 4); | 86 | "next.floppy", 4); |
87 | + | 87 | + |
88 | + object_initialize_child(obj, "escc", &s->escc, TYPE_ESCC); | 88 | + object_initialize_child(obj, "escc", &s->escc, TYPE_ESCC); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* | 91 | /* |
92 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) | 92 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | - /* Serial */ | 96 | - /* Serial */ |
97 | - next_escc_init(pcdev); | 97 | - next_escc_init(pcdev); |
98 | - | 98 | - |
99 | /* TODO: */ | 99 | /* TODO: */ |
100 | /* Network */ | 100 | /* Network */ |
101 | 101 | ||
102 | -- | 102 | -- |
103 | 2.39.5 | 103 | 2.39.5 | diff view generated by jsdifflib |
1 | Move the timer MMIO accesses to a separate memory region on the next-pc device | 1 | Move the timer MMIO accesses to a separate memory region on the next-pc device |
---|---|---|---|
2 | instead of being part of the next.scr MMIO memory region. | 2 | instead of being part of the next.scr MMIO memory region. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 63 +++++++++++++++++++++++++++++++++++---------- | 7 | hw/m68k/next-cube.c | 63 +++++++++++++++++++++++++++++++++++---------- |
7 | 1 file changed, 50 insertions(+), 13 deletions(-) | 8 | 1 file changed, 50 insertions(+), 13 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Move the en ethernet MMIO accesses to a separate memory region on the next-pc | 1 | Move the en ethernet MMIO accesses to a separate memory region on the next-pc |
---|---|---|---|
2 | device instead of being part of the next.scr MMIO memory region. | 2 | device instead of being part of the next.scr MMIO memory region. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 48 +++++++++++++++++++++++++++++++++++++-------- | 7 | hw/m68k/next-cube.c | 48 +++++++++++++++++++++++++++++++++++++-------- |
7 | 1 file changed, 40 insertions(+), 8 deletions(-) | 8 | 1 file changed, 40 insertions(+), 8 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | The next.scr memory is now effectively unused, however there are 3 separate region | 1 | The next.scr memory is now effectively unused, however there are 3 separate region |
---|---|---|---|
2 | accesses still logged that occur when booting a NeXTStep disk image. Use the | 2 | accesses still logged that occur when booting a NeXTStep disk image. Use the |
3 | empty_slot device to capture and ignore memory accesses to these 3 memory regions. | 3 | empty_slot device to capture and ignore memory accesses to these 3 memory regions. |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/Kconfig | 1 + | 8 | hw/m68k/Kconfig | 1 + |
8 | hw/m68k/next-cube.c | 6 ++++++ | 9 | hw/m68k/next-cube.c | 8 ++++++++ |
9 | 2 files changed, 7 insertions(+) | 10 | 2 files changed, 9 insertions(+) |
10 | 11 | ||
11 | diff --git a/hw/m68k/Kconfig b/hw/m68k/Kconfig | 12 | diff --git a/hw/m68k/Kconfig b/hw/m68k/Kconfig |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/m68k/Kconfig | 14 | --- a/hw/m68k/Kconfig |
14 | +++ b/hw/m68k/Kconfig | 15 | +++ b/hw/m68k/Kconfig |
... | ... | ||
34 | #include "qemu/error-report.h" | 35 | #include "qemu/error-report.h" |
35 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) | 36 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) |
36 | /* BMAP IO - acts as a catch-all for now */ | 37 | /* BMAP IO - acts as a catch-all for now */ |
37 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); | 38 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); |
38 | 39 | ||
39 | + /* unknown */ | 40 | + /* unknown: Brightness control register? */ |
40 | + empty_slot_init("next.unknown", 0x02110000, 0x10); | 41 | + empty_slot_init("next.unknown", 0x02110000, 0x10); |
42 | + /* unknown: Magneto-Optical drive controller? */ | ||
41 | + empty_slot_init("next.unknown", 0x02112000, 0x10); | 43 | + empty_slot_init("next.unknown", 0x02112000, 0x10); |
44 | + /* unknown: Serial clock configuration register? */ | ||
42 | + empty_slot_init("next.unknown", 0x02118004, 0x10); | 45 | + empty_slot_init("next.unknown", 0x02118004, 0x10); |
43 | + | 46 | + |
44 | /* BMAP memory */ | 47 | /* BMAP memory */ |
45 | memory_region_init_ram_flags_nomigrate(&m->bmapm1, NULL, "next.bmapmem", | 48 | memory_region_init_ram_flags_nomigrate(&m->bmapm1, NULL, "next.bmapmem", |
46 | 64, RAM_SHARED, &error_fatal); | 49 | 64, RAM_SHARED, &error_fatal); |
47 | -- | 50 | -- |
48 | 2.39.5 | 51 | 2.39.5 | diff view generated by jsdifflib |
1 | Now that the next.scr memory region is unused it can be removed and the next-pc | 1 | Now that the next.scr memory region is unused it can be removed and the next-pc |
---|---|---|---|
2 | devices mapped directly within the machine init function. This is the last | 2 | devices mapped directly within the machine init function. This is the last |
3 | remaining overlapping memory region within the NeXTCube machine. | 3 | remaining overlapping memory region within the NeXTCube machine. |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/next-cube.c | 73 +++++++++++---------------------------------- | 8 | hw/m68k/next-cube.c | 73 +++++++++++++-------------------------------- |
8 | 1 file changed, 18 insertions(+), 55 deletions(-) | 9 | 1 file changed, 21 insertions(+), 52 deletions(-) |
9 | 10 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 11 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
11 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/hw/m68k/next-cube.c | 13 | --- a/hw/m68k/next-cube.c |
13 | +++ b/hw/m68k/next-cube.c | 14 | +++ b/hw/m68k/next-cube.c |
... | ... | ||
123 | + sysbus_init_mmio(sbd, &s->timer_mem); | 124 | + sysbus_init_mmio(sbd, &s->timer_mem); |
124 | } | 125 | } |
125 | 126 | ||
126 | /* | 127 | /* |
127 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) | 128 | @@ -XXX,XX +XXX,XX @@ static void next_cube_init(MachineState *machine) |
128 | /* MMIO */ | 129 | /* BMAP IO - acts as a catch-all for now */ |
129 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 0, 0x02005000); | 130 | sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); |
130 | 131 | ||
131 | - /* BMAP IO - acts as a catch-all for now */ | ||
132 | - sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); | ||
133 | - | ||
134 | + /* en network (dummy) */ | 132 | + /* en network (dummy) */ |
135 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02106000); | 133 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02106000); |
136 | /* unknown */ | 134 | + |
135 | /* unknown: Brightness control register? */ | ||
137 | empty_slot_init("next.unknown", 0x02110000, 0x10); | 136 | empty_slot_init("next.unknown", 0x02110000, 0x10); |
137 | /* unknown: Magneto-Optical drive controller? */ | ||
138 | empty_slot_init("next.unknown", 0x02112000, 0x10); | 138 | empty_slot_init("next.unknown", 0x02112000, 0x10); |
139 | + | ||
139 | + /* SCSI */ | 140 | + /* SCSI */ |
140 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 2, 0x02114000); | 141 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 2, 0x02114000); |
141 | + /* Floppy */ | 142 | + /* Floppy */ |
142 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 3, 0x02114108); | 143 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 3, 0x02114108); |
143 | + /* ESCC */ | 144 | + /* ESCC */ |
144 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 4, 0x02118000); | 145 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 4, 0x02118000); |
145 | + /* unknown */ | 146 | + |
147 | /* unknown: Serial clock configuration register? */ | ||
146 | empty_slot_init("next.unknown", 0x02118004, 0x10); | 148 | empty_slot_init("next.unknown", 0x02118004, 0x10); |
149 | |||
147 | + /* Timer */ | 150 | + /* Timer */ |
148 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 5, 0x0211a000); | 151 | + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 5, 0x0211a000); |
149 | 152 | + | |
150 | /* BMAP memory */ | 153 | /* BMAP memory */ |
151 | memory_region_init_ram_flags_nomigrate(&m->bmapm1, NULL, "next.bmapmem", | 154 | memory_region_init_ram_flags_nomigrate(&m->bmapm1, NULL, "next.bmapmem", |
155 | 64, RAM_SHARED, &error_fatal); | ||
152 | -- | 156 | -- |
153 | 2.39.5 | 157 | 2.39.5 | diff view generated by jsdifflib |
1 | Move the NeXTState, next_dma and TYPE_NEXT_MACHINE definition to the same area | 1 | Move the NeXTState, next_dma and TYPE_NEXT_MACHINE definition to the same area |
---|---|---|---|
2 | at the top of next-cube.c. | 2 | at the top of next-cube.c. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 64 ++++++++++++++++++++++----------------------- | 7 | hw/m68k/next-cube.c | 64 ++++++++++++++++++++++----------------------- |
7 | 1 file changed, 32 insertions(+), 32 deletions(-) | 8 | 1 file changed, 32 insertions(+), 32 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
---|---|---|---|
2 | Acked-by: Thomas Huth <huth@tuxfamily.org> | ||
2 | --- | 3 | --- |
3 | hw/m68k/next-cube.c | 7 ++++--- | 4 | hw/m68k/next-cube.c | 7 ++++--- |
4 | 1 file changed, 4 insertions(+), 3 deletions(-) | 5 | 1 file changed, 4 insertions(+), 3 deletions(-) |
5 | 6 | ||
6 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 7 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | This brings the capitalisation in line with the other NeXTCube definitions. | 1 | This brings the capitalisation in line with the other NeXTCube definitions. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
4 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
4 | --- | 5 | --- |
5 | hw/m68k/next-cube.c | 24 ++++++++++++------------ | 6 | hw/m68k/next-cube.c | 24 ++++++++++++------------ |
6 | 1 file changed, 12 insertions(+), 12 deletions(-) | 7 | 1 file changed, 12 insertions(+), 12 deletions(-) |
7 | 8 | ||
8 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Rather than directly clear bit 3 in int_status in next_scr2_rtc_update(), use | 1 | Rather than directly clear bit 3 in int_status in next_scr2_rtc_update(), use |
---|---|---|---|
2 | a qemu_irq to drive the equivalent NEXT_PWR_I signal. | 2 | a qemu_irq to drive the equivalent NEXT_PWR_I signal. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 5 ++++- | 7 | hw/m68k/next-cube.c | 5 ++++- |
7 | 1 file changed, 4 insertions(+), 1 deletion(-) | 8 | 1 file changed, 4 insertions(+), 1 deletion(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Introduce a new next_rtc_cmd_is_write() function to determine if an rtc command | 1 | Introduce a new next_rtc_cmd_is_write() function to determine if an rtc command |
---|---|---|---|
2 | is a read or write, and start by using it to avoid shifting the rtc input value | 2 | is a read or write, and start by using it to avoid shifting the rtc input value |
3 | if a rtc read command is executed. | 3 | if a rtc read command is executed. |
4 | 4 | ||
5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 5 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
6 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
6 | --- | 7 | --- |
7 | hw/m68k/next-cube.c | 138 ++++++++++++++++++++++++-------------------- | 8 | hw/m68k/next-cube.c | 138 ++++++++++++++++++++++++-------------------- |
8 | 1 file changed, 74 insertions(+), 64 deletions(-) | 9 | 1 file changed, 74 insertions(+), 64 deletions(-) |
9 | 10 | ||
10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 11 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Instead of shifting out rtc read values from individual rtc registers, change | 1 | Instead of shifting out rtc read values from individual rtc registers, change |
---|---|---|---|
2 | the logic so that rtc read commands are executed when the last bit of the rtc | 2 | the logic so that rtc read commands are executed when the last bit of the rtc |
3 | command is received and the result stored in retval. This simplifies the rtc | 3 | command is received and the result stored in retval. This simplifies the rtc |
4 | read logic such that the shift out logic can be consolidated for rtc phases | 4 | read logic such that the shift out logic can be consolidated for rtc phases |
5 | between 8 and 16. | 5 | between 8 and 16. |
6 | 6 | ||
7 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 7 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
8 | --- | 8 | --- |
9 | hw/m68k/next-cube.c | 99 ++++++++++++++++++--------------------------- | 9 | hw/m68k/next-cube.c | 99 ++++++++++++++++++--------------------------- |
10 | 1 file changed, 40 insertions(+), 59 deletions(-) | 10 | 1 file changed, 40 insertions(+), 59 deletions(-) |
11 | 11 | ||
12 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 12 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
13 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/m68k/next-cube.c | 14 | --- a/hw/m68k/next-cube.c |
15 | +++ b/hw/m68k/next-cube.c | 15 | +++ b/hw/m68k/next-cube.c |
16 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_rtc_update(NeXTPC *s) | 16 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_rtc_update(NeXTPC *s) |
17 | if (rtc->phase < 8) { | 17 | if (rtc->phase < 8) { |
18 | rtc->command = (rtc->command << 1) | | 18 | rtc->command = (rtc->command << 1) | |
19 | ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 19 | ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
20 | - } | 20 | - } |
21 | - if (rtc->phase >= 8 && rtc->phase < 16) { | 21 | - if (rtc->phase >= 8 && rtc->phase < 16) { |
22 | - if (next_rtc_cmd_is_write(rtc->command)) { | 22 | - if (next_rtc_cmd_is_write(rtc->command)) { |
23 | - /* Shift in value to write */ | 23 | - /* Shift in value to write */ |
24 | - rtc->value = (rtc->value << 1) | | 24 | - rtc->value = (rtc->value << 1) | |
25 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 25 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
26 | - } else { | 26 | - } else { |
27 | - /* Shift out value to read */ | 27 | - /* Shift out value to read */ |
28 | 28 | ||
29 | - /* if we read RAM register, output RT_DATA bit */ | 29 | - /* if we read RAM register, output RT_DATA bit */ |
30 | - if (rtc->command <= 0x1F) { | 30 | - if (rtc->command <= 0x1F) { |
31 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); | 31 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); |
32 | - if (rtc->ram[rtc->command] & | 32 | - if (rtc->ram[rtc->command] & |
33 | - (0x80 >> (rtc->phase - 8))) { | 33 | - (0x80 >> (rtc->phase - 8))) { |
34 | - scr2_2 |= SCR2_RTDATA; | 34 | - scr2_2 |= SCR2_RTDATA; |
35 | - } | 35 | - } |
36 | - | 36 | - |
37 | - rtc->retval = (rtc->retval << 1) | | 37 | - rtc->retval = (rtc->retval << 1) | |
38 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 38 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
39 | - } | 39 | - } |
40 | - /* read the status 0x30 */ | 40 | - /* read the status 0x30 */ |
41 | - if (rtc->command == 0x30) { | 41 | - if (rtc->command == 0x30) { |
42 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); | 42 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); |
43 | - /* for now status = 0x98 (new rtc + FTU) */ | 43 | - /* for now status = 0x98 (new rtc + FTU) */ |
44 | - if (rtc->status & (0x80 >> (rtc->phase - 8))) { | 44 | - if (rtc->status & (0x80 >> (rtc->phase - 8))) { |
45 | - scr2_2 |= SCR2_RTDATA; | 45 | - scr2_2 |= SCR2_RTDATA; |
46 | - } | 46 | - } |
47 | - | 47 | - |
48 | - rtc->retval = (rtc->retval << 1) | | 48 | - rtc->retval = (rtc->retval << 1) | |
49 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 49 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
50 | - } | 50 | - } |
51 | - /* read the status 0x31 */ | 51 | - /* read the status 0x31 */ |
52 | - if (rtc->command == 0x31) { | 52 | - if (rtc->command == 0x31) { |
53 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); | 53 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); |
54 | - if (rtc->control & (0x80 >> (rtc->phase - 8))) { | 54 | - if (rtc->control & (0x80 >> (rtc->phase - 8))) { |
55 | - scr2_2 |= SCR2_RTDATA; | 55 | - scr2_2 |= SCR2_RTDATA; |
56 | - } | 56 | - } |
57 | - rtc->retval = (rtc->retval << 1) | | 57 | - rtc->retval = (rtc->retval << 1) | |
58 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 58 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
59 | + if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { | 59 | + if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { |
60 | + if (rtc->command <= 0x1f) { | 60 | + if (rtc->command <= 0x1f) { |
61 | + /* RAM registers */ | 61 | + /* RAM registers */ |
62 | + rtc->retval = rtc->ram[rtc->command]; | 62 | + rtc->retval = rtc->ram[rtc->command]; |
63 | } | 63 | } |
64 | - | 64 | - |
65 | if ((rtc->command >= 0x20) && (rtc->command <= 0x2F)) { | 65 | if ((rtc->command >= 0x20) && (rtc->command <= 0x2F)) { |
66 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); | 66 | - scr2_2 = scr2_2 & (~SCR2_RTDATA); |
67 | - /* for now 0x00 */ | 67 | - /* for now 0x00 */ |
68 | + /* RTC */ | 68 | + /* RTC */ |
69 | time_t time_h = time(NULL); | 69 | time_t time_h = time(NULL); |
70 | struct tm *info = localtime(&time_h); | 70 | struct tm *info = localtime(&time_h); |
71 | - int ret = 0; | 71 | - int ret = 0; |
72 | + rtc->retval = 0; | 72 | + rtc->retval = 0; |
73 | 73 | ||
74 | switch (rtc->command) { | 74 | switch (rtc->command) { |
75 | case 0x20: | 75 | case 0x20: |
76 | - ret = SCR2_TOBCD(info->tm_sec); | 76 | - ret = SCR2_TOBCD(info->tm_sec); |
77 | + rtc->retval = SCR2_TOBCD(info->tm_sec); | 77 | + rtc->retval = SCR2_TOBCD(info->tm_sec); |
78 | break; | 78 | break; |
79 | case 0x21: | 79 | case 0x21: |
80 | - ret = SCR2_TOBCD(info->tm_min); | 80 | - ret = SCR2_TOBCD(info->tm_min); |
81 | + rtc->retval = SCR2_TOBCD(info->tm_min); | 81 | + rtc->retval = SCR2_TOBCD(info->tm_min); |
82 | break; | 82 | break; |
83 | case 0x22: | 83 | case 0x22: |
84 | - ret = SCR2_TOBCD(info->tm_hour); | 84 | - ret = SCR2_TOBCD(info->tm_hour); |
85 | + rtc->retval = SCR2_TOBCD(info->tm_hour); | 85 | + rtc->retval = SCR2_TOBCD(info->tm_hour); |
86 | break; | 86 | break; |
87 | case 0x24: | 87 | case 0x24: |
88 | - ret = SCR2_TOBCD(info->tm_mday); | 88 | - ret = SCR2_TOBCD(info->tm_mday); |
89 | + rtc->retval = SCR2_TOBCD(info->tm_mday); | 89 | + rtc->retval = SCR2_TOBCD(info->tm_mday); |
90 | break; | 90 | break; |
91 | case 0x25: | 91 | case 0x25: |
92 | - ret = SCR2_TOBCD((info->tm_mon + 1)); | 92 | - ret = SCR2_TOBCD((info->tm_mon + 1)); |
93 | + rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); | 93 | + rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); |
94 | break; | 94 | break; |
95 | case 0x26: | 95 | case 0x26: |
96 | - ret = SCR2_TOBCD((info->tm_year - 100)); | 96 | - ret = SCR2_TOBCD((info->tm_year - 100)); |
97 | + rtc->retval = SCR2_TOBCD((info->tm_year - 100)); | 97 | + rtc->retval = SCR2_TOBCD((info->tm_year - 100)); |
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | - | 100 | - |
101 | - if (ret & (0x80 >> (rtc->phase - 8))) { | 101 | - if (ret & (0x80 >> (rtc->phase - 8))) { |
102 | - scr2_2 |= SCR2_RTDATA; | 102 | - scr2_2 |= SCR2_RTDATA; |
103 | - } | 103 | - } |
104 | - rtc->retval = (rtc->retval << 1) | | 104 | - rtc->retval = (rtc->retval << 1) | |
105 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 105 | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
106 | + } | 106 | + } |
107 | + if (rtc->command == 0x30) { | 107 | + if (rtc->command == 0x30) { |
108 | + /* read the status 0x30 */ | 108 | + /* read the status 0x30 */ |
109 | + rtc->retval = rtc->status; | 109 | + rtc->retval = rtc->status; |
110 | + } | 110 | + } |
111 | + if (rtc->command == 0x31) { | 111 | + if (rtc->command == 0x31) { |
112 | + /* read the control 0x31 */ | 112 | + /* read the control 0x31 */ |
113 | + rtc->retval = rtc->control; | 113 | + rtc->retval = rtc->control; |
114 | + } | 114 | + } |
115 | + } | 115 | + } |
116 | + } | 116 | + } |
117 | + if (rtc->phase >= 8 && rtc->phase < 16) { | 117 | + if (rtc->phase >= 8 && rtc->phase < 16) { |
118 | + if (next_rtc_cmd_is_write(rtc->command)) { | 118 | + if (next_rtc_cmd_is_write(rtc->command)) { |
119 | + /* Shift in value to write */ | 119 | + /* Shift in value to write */ |
120 | + rtc->value = (rtc->value << 1) | | 120 | + rtc->value = (rtc->value << 1) | |
121 | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); | 121 | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); |
122 | + } else { | 122 | + } else { |
123 | + /* Shift out value to read */ | 123 | + /* Shift out value to read */ |
124 | + if (rtc->retval & (0x80 >> (rtc->phase - 8))) { | 124 | + if (rtc->retval & (0x80 >> (rtc->phase - 8))) { |
125 | + scr2_2 |= SCR2_RTDATA; | 125 | + scr2_2 |= SCR2_RTDATA; |
126 | + } else { | 126 | + } else { |
127 | + scr2_2 &= ~SCR2_RTDATA; | 127 | + scr2_2 &= ~SCR2_RTDATA; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | rtc->phase++; | 132 | rtc->phase++; |
133 | - if (rtc->phase == 16) { | 133 | - if (rtc->phase == 16) { |
134 | - if (rtc->command >= 0x80 && rtc->command <= 0x9F) { | 134 | - if (rtc->command >= 0x80 && rtc->command <= 0x9F) { |
135 | + if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { | 135 | + if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { |
136 | + if (rtc->command >= 0x80 && rtc->command <= 0x9f) { | 136 | + if (rtc->command >= 0x80 && rtc->command <= 0x9f) { |
137 | + /* RAM registers */ | 137 | + /* RAM registers */ |
138 | rtc->ram[rtc->command - 0x80] = rtc->value; | 138 | rtc->ram[rtc->command - 0x80] = rtc->value; |
139 | } | 139 | } |
140 | - /* write to x30 register */ | 140 | - /* write to x30 register */ |
141 | - if (rtc->command == 0xB1) { | 141 | - if (rtc->command == 0xB1) { |
142 | - /* clear FTU */ | 142 | - /* clear FTU */ |
143 | + if (rtc->command == 0xb1) { | 143 | + if (rtc->command == 0xb1) { |
144 | + /* write to 0x30 register */ | 144 | + /* write to 0x30 register */ |
145 | if (rtc->value & 0x04) { | 145 | if (rtc->value & 0x04) { |
146 | + /* clear FTU */ | 146 | + /* clear FTU */ |
147 | rtc->status = rtc->status & (~0x18); | 147 | rtc->status = rtc->status & (~0x18); |
148 | qemu_irq_lower(s->rtc_power_irq); | 148 | qemu_irq_lower(s->rtc_power_irq); |
149 | } | 149 | } |
150 | -- | 150 | -- |
151 | 2.39.5 | 151 | 2.39.5 | diff view generated by jsdifflib |
1 | This is in preparation for moving NeXTRTC to its own separate device. | 1 | This is in preparation for moving NeXTRTC to its own separate device. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
4 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
4 | --- | 5 | --- |
5 | hw/m68k/next-cube.c | 25 +++++++++++++++++++++---- | 6 | hw/m68k/next-cube.c | 25 +++++++++++++++++++++---- |
6 | 1 file changed, 21 insertions(+), 4 deletions(-) | 7 | 1 file changed, 21 insertions(+), 4 deletions(-) |
7 | 8 | ||
8 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | This is in preparation for moving NeXTRTC to its own separate device. | 1 | This is in preparation for moving NeXTRTC to its own separate device. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 3 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
4 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
4 | --- | 5 | --- |
5 | hw/m68k/next-cube.c | 169 ++++++++++++++++++++++++-------------------- | 6 | hw/m68k/next-cube.c | 169 ++++++++++++++++++++++++-------------------- |
6 | 1 file changed, 92 insertions(+), 77 deletions(-) | 7 | 1 file changed, 92 insertions(+), 77 deletions(-) |
7 | 8 | ||
8 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | The rtc phase value of -1 is directly equivalent to using a phase value of 0 so | 1 | The rtc phase value of -1 is directly equivalent to using a phase value of 0 so |
---|---|---|---|
2 | simplify the logic to use an initial rtc phase of 0. | 2 | simplify the logic to use an initial rtc phase of 0. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 5 +---- | 7 | hw/m68k/next-cube.c | 5 +---- |
7 | 1 file changed, 1 insertion(+), 4 deletions(-) | 8 | 1 file changed, 1 insertion(+), 4 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | This is to allow the RTC functionality to be maintained within its own separate | 1 | This is to allow the RTC functionality to be maintained within its own separate |
---|---|---|---|
2 | device. | 2 | device rather than as part of the next-pc device. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 66 ++++++++++++++++++++++++++++++++------------- | 6 | hw/m68k/next-cube.c | 71 +++++++++++++++++++++++++++++++-------------- |
7 | 1 file changed, 48 insertions(+), 18 deletions(-) | 7 | 1 file changed, 50 insertions(+), 21 deletions(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
... | ... | ||
114 | - }, | 114 | - }, |
115 | -}; | 115 | -}; |
116 | - | 116 | - |
117 | static const VMStateDescription next_pc_vmstate = { | 117 | static const VMStateDescription next_pc_vmstate = { |
118 | .name = "next-pc", | 118 | .name = "next-pc", |
119 | .version_id = 3, | 119 | - .version_id = 3, |
120 | - .minimum_version_id = 3, | ||
121 | + .version_id = 4, | ||
122 | + .minimum_version_id = 4, | ||
123 | .fields = (const VMStateField[]) { | ||
124 | VMSTATE_UINT32(scr1, NeXTPC), | ||
125 | VMSTATE_UINT32(scr2, NeXTPC), | ||
126 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription next_pc_vmstate = { | ||
127 | VMSTATE_UINT32(int_mask, NeXTPC), | ||
128 | VMSTATE_UINT32(int_status, NeXTPC), | ||
129 | VMSTATE_UINT32(led, NeXTPC), | ||
130 | - VMSTATE_STRUCT(rtc, NeXTPC, 0, next_rtc_vmstate, NeXTRTC), | ||
131 | VMSTATE_END_OF_LIST() | ||
132 | }, | ||
133 | }; | ||
120 | @@ -XXX,XX +XXX,XX @@ static void next_register_type(void) | 134 | @@ -XXX,XX +XXX,XX @@ static void next_register_type(void) |
121 | type_register_static(&next_typeinfo); | 135 | type_register_static(&next_typeinfo); |
122 | type_register_static(&next_pc_info); | 136 | type_register_static(&next_pc_info); |
123 | type_register_static(&next_scsi_info); | 137 | type_register_static(&next_scsi_info); |
124 | + type_register_static(&next_rtc_info); | 138 | + type_register_static(&next_rtc_info); |
125 | } | 139 | } |
126 | 140 | ||
127 | type_init(next_register_type) | 141 | type_init(next_register_type) |
128 | -- | 142 | -- |
129 | 2.39.5 | 143 | 2.39.5 | diff view generated by jsdifflib |
1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
---|---|---|---|
2 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
2 | --- | 3 | --- |
3 | hw/m68k/next-cube.c | 17 ++++++++++++----- | 4 | hw/m68k/next-cube.c | 17 ++++++++++++----- |
4 | 1 file changed, 12 insertions(+), 5 deletions(-) | 5 | 1 file changed, 12 insertions(+), 5 deletions(-) |
5 | 6 | ||
6 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 7 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Add a new rtc-data-out gpio to the next-pc device and wire it up to the next-rtc | 1 | Add a new rtc-data-out gpio to the next-pc device and wire it up to the next-rtc |
---|---|---|---|
2 | rtc-data-in gpio using the standard qdev gpio APIs. | 2 | rtc-data-in gpio using the standard qdev gpio APIs. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 26 +++++++++++++++++--------- | 7 | hw/m68k/next-cube.c | 26 +++++++++++++++++--------- |
7 | 1 file changed, 17 insertions(+), 9 deletions(-) | 8 | 1 file changed, 17 insertions(+), 9 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Add a named gpio output for the next-rtc data and then update | 1 | Add a named gpio output for the next-rtc data and then update |
---|---|---|---|
2 | next_rtc_data_in_irq() to drive the IRQ directly. This enables the next-rtc to | 2 | next_rtc_data_in_irq() to drive the IRQ directly. This enables the next-rtc to |
3 | next-pc data to be wired up using the standard qdev gpio APIs. | 3 | next-pc data to be wired up using the standard qdev gpio APIs. |
4 | 4 | ||
5 | At the same time rename the pc-rtc-data-in gpio to rtc-data-in which is possible | 5 | At the same time rename the pc-rtc-data-in gpio to rtc-data-in which is possible |
6 | now that the previous rtc-data-in gpio has been moved to the next-rtc device. | 6 | now that the previous rtc-data-in gpio has been moved to the next-rtc device. |
7 | 7 | ||
8 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 8 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
9 | --- | 9 | --- |
10 | hw/m68k/next-cube.c | 19 +++++++++++++------ | 10 | hw/m68k/next-cube.c | 19 +++++++++++++------ |
11 | 1 file changed, 13 insertions(+), 6 deletions(-) | 11 | 1 file changed, 13 insertions(+), 6 deletions(-) |
12 | 12 | ||
13 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 13 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/m68k/next-cube.c | 15 | --- a/hw/m68k/next-cube.c |
16 | +++ b/hw/m68k/next-cube.c | 16 | +++ b/hw/m68k/next-cube.c |
17 | @@ -XXX,XX +XXX,XX @@ struct NeXTRTC { | 17 | @@ -XXX,XX +XXX,XX @@ struct NeXTRTC { |
18 | uint8_t status; | 18 | uint8_t status; |
19 | uint8_t control; | 19 | uint8_t control; |
20 | uint8_t retval; | 20 | uint8_t retval; |
21 | + | 21 | + |
22 | + qemu_irq data_out_irq; | 22 | + qemu_irq data_out_irq; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | #define TYPE_NEXT_SCSI "next-scsi" | 25 | #define TYPE_NEXT_SCSI "next-scsi" |
26 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) | 26 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) |
27 | rtc->value = (rtc->value << 1) | level; | 27 | rtc->value = (rtc->value << 1) | level; |
28 | } else { | 28 | } else { |
29 | /* Shift out value to read */ | 29 | /* Shift out value to read */ |
30 | - qemu_irq rtc_data_in_irq = qdev_get_gpio_in_named( | 30 | - qemu_irq rtc_data_in_irq = qdev_get_gpio_in_named( |
31 | - DEVICE(s), "pc-rtc-data-in", 0); | 31 | - DEVICE(s), "pc-rtc-data-in", 0); |
32 | - | 32 | - |
33 | if (rtc->retval & (0x80 >> (rtc->phase - 8))) { | 33 | if (rtc->retval & (0x80 >> (rtc->phase - 8))) { |
34 | - qemu_irq_raise(rtc_data_in_irq); | 34 | - qemu_irq_raise(rtc_data_in_irq); |
35 | + qemu_irq_raise(rtc->data_out_irq); | 35 | + qemu_irq_raise(rtc->data_out_irq); |
36 | } else { | 36 | } else { |
37 | - qemu_irq_lower(rtc_data_in_irq); | 37 | - qemu_irq_lower(rtc_data_in_irq); |
38 | + qemu_irq_lower(rtc->data_out_irq); | 38 | + qemu_irq_lower(rtc->data_out_irq); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
42 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_reset_hold(Object *obj, ResetType type) | 42 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_reset_hold(Object *obj, ResetType type) |
43 | 43 | ||
44 | static void next_rtc_init(Object *obj) | 44 | static void next_rtc_init(Object *obj) |
45 | { | 45 | { |
46 | + NeXTRTC *rtc = NEXT_RTC(obj); | 46 | + NeXTRTC *rtc = NEXT_RTC(obj); |
47 | + | 47 | + |
48 | qdev_init_gpio_in_named(DEVICE(obj), next_rtc_data_in_irq, | 48 | qdev_init_gpio_in_named(DEVICE(obj), next_rtc_data_in_irq, |
49 | "rtc-data-in", 1); | 49 | "rtc-data-in", 1); |
50 | + qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq, | 50 | + qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq, |
51 | + "rtc-data-out", 1); | 51 | + "rtc-data-out", 1); |
52 | } | 52 | } |
53 | 53 | ||
54 | static const VMStateDescription next_rtc_vmstate = { | 54 | static const VMStateDescription next_rtc_vmstate = { |
55 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) | 55 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) |
56 | /* Data from NeXTPC to RTC */ | 56 | /* Data from NeXTPC to RTC */ |
57 | qdev_connect_gpio_out_named(dev, "rtc-data-out", 0, | 57 | qdev_connect_gpio_out_named(dev, "rtc-data-out", 0, |
58 | qdev_get_gpio_in_named(d, "rtc-data-in", 0)); | 58 | qdev_get_gpio_in_named(d, "rtc-data-in", 0)); |
59 | + /* Data from RTC to NeXTPC */ | 59 | + /* Data from RTC to NeXTPC */ |
60 | + qdev_connect_gpio_out_named(d, "rtc-data-out", 0, | 60 | + qdev_connect_gpio_out_named(d, "rtc-data-out", 0, |
61 | + qdev_get_gpio_in_named(dev, | 61 | + qdev_get_gpio_in_named(dev, |
62 | + "rtc-data-in", 0)); | 62 | + "rtc-data-in", 0)); |
63 | } | 63 | } |
64 | 64 | ||
65 | static void next_pc_init(Object *obj) | 65 | static void next_pc_init(Object *obj) |
66 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) | 66 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) |
67 | 67 | ||
68 | s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I); | 68 | s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I); |
69 | qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq, | 69 | qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq, |
70 | - "pc-rtc-data-in", 1); | 70 | - "pc-rtc-data-in", 1); |
71 | + "rtc-data-in", 1); | 71 | + "rtc-data-in", 1); |
72 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, | 72 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, |
73 | "rtc-data-out", 1); | 73 | "rtc-data-out", 1); |
74 | } | 74 | } |
75 | -- | 75 | -- |
76 | 2.39.5 | 76 | 2.39.5 | diff view generated by jsdifflib |
1 | This allows us to decouple the next-pc and next-rtc devices from each | 1 | This allows us to decouple the next-pc and next-rtc devices from each |
---|---|---|---|
2 | other in next_scr2_rtc_update(). | 2 | other in next_scr2_rtc_update(). |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 23 +++++++++++++++++++---- | 6 | hw/m68k/next-cube.c | 23 +++++++++++++++++++---- |
7 | 1 file changed, 19 insertions(+), 4 deletions(-) | 7 | 1 file changed, 19 insertions(+), 4 deletions(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { | 13 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { |
14 | NeXTRTC rtc; | 14 | NeXTRTC rtc; |
15 | qemu_irq rtc_power_irq; | 15 | qemu_irq rtc_power_irq; |
16 | qemu_irq rtc_data_irq; | 16 | qemu_irq rtc_data_irq; |
17 | + qemu_irq rtc_cmd_reset_irq; | 17 | + qemu_irq rtc_cmd_reset_irq; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | typedef struct next_dma { | 20 | typedef struct next_dma { |
21 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) | 21 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) |
22 | static void next_scr2_rtc_update(NeXTPC *s) | 22 | static void next_scr2_rtc_update(NeXTPC *s) |
23 | { | 23 | { |
24 | uint8_t old_scr2, scr2_2; | 24 | uint8_t old_scr2, scr2_2; |
25 | - NeXTRTC *rtc = &s->rtc; | 25 | - NeXTRTC *rtc = &s->rtc; |
26 | 26 | ||
27 | old_scr2 = extract32(s->old_scr2, 8, 8); | 27 | old_scr2 = extract32(s->old_scr2, 8, 8); |
28 | scr2_2 = extract32(s->scr2, 8, 8); | 28 | scr2_2 = extract32(s->scr2, 8, 8); |
29 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_rtc_update(NeXTPC *s) | 29 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_rtc_update(NeXTPC *s) |
30 | } | 30 | } |
31 | } else { | 31 | } else { |
32 | /* else end or abort */ | 32 | /* else end or abort */ |
33 | - rtc->phase = 0; | 33 | - rtc->phase = 0; |
34 | - rtc->command = 0; | 34 | - rtc->command = 0; |
35 | - rtc->value = 0; | 35 | - rtc->value = 0; |
36 | + qemu_irq_raise(s->rtc_cmd_reset_irq); | 36 | + qemu_irq_raise(s->rtc_cmd_reset_irq); |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_dummy_en_ops = { | 40 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_dummy_en_ops = { |
41 | .endianness = DEVICE_BIG_ENDIAN, | 41 | .endianness = DEVICE_BIG_ENDIAN, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | +static void next_rtc_cmd_reset_irq(void *opaque, int n, int level) | 44 | +static void next_rtc_cmd_reset_irq(void *opaque, int n, int level) |
45 | +{ | 45 | +{ |
46 | + NeXTRTC *rtc = NEXT_RTC(opaque); | 46 | + NeXTRTC *rtc = NEXT_RTC(opaque); |
47 | + | 47 | + |
48 | + if (level) { | 48 | + if (level) { |
49 | + rtc->phase = 0; | 49 | + rtc->phase = 0; |
50 | + rtc->command = 0; | 50 | + rtc->command = 0; |
51 | + rtc->value = 0; | 51 | + rtc->value = 0; |
52 | + } | 52 | + } |
53 | +} | 53 | +} |
54 | + | 54 | + |
55 | static void next_rtc_reset_hold(Object *obj, ResetType type) | 55 | static void next_rtc_reset_hold(Object *obj, ResetType type) |
56 | { | 56 | { |
57 | NeXTRTC *rtc = NEXT_RTC(obj); | 57 | NeXTRTC *rtc = NEXT_RTC(obj); |
58 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_init(Object *obj) | 58 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_init(Object *obj) |
59 | "rtc-data-in", 1); | 59 | "rtc-data-in", 1); |
60 | qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq, | 60 | qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq, |
61 | "rtc-data-out", 1); | 61 | "rtc-data-out", 1); |
62 | + qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq, | 62 | + qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq, |
63 | + "rtc-cmd-reset", 1); | 63 | + "rtc-cmd-reset", 1); |
64 | } | 64 | } |
65 | 65 | ||
66 | static const VMStateDescription next_rtc_vmstate = { | 66 | static const VMStateDescription next_rtc_vmstate = { |
67 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) | 67 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) |
68 | qdev_connect_gpio_out_named(d, "rtc-data-out", 0, | 68 | qdev_connect_gpio_out_named(d, "rtc-data-out", 0, |
69 | qdev_get_gpio_in_named(dev, | 69 | qdev_get_gpio_in_named(dev, |
70 | "rtc-data-in", 0)); | 70 | "rtc-data-in", 0)); |
71 | + qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0, | 71 | + qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0, |
72 | + qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0)); | 72 | + qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0)); |
73 | } | 73 | } |
74 | 74 | ||
75 | static void next_pc_init(Object *obj) | 75 | static void next_pc_init(Object *obj) |
76 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) | 76 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) |
77 | "rtc-data-in", 1); | 77 | "rtc-data-in", 1); |
78 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, | 78 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, |
79 | "rtc-data-out", 1); | 79 | "rtc-data-out", 1); |
80 | + qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_cmd_reset_irq, | 80 | + qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_cmd_reset_irq, |
81 | + "rtc-cmd-reset", 1); | 81 | + "rtc-cmd-reset", 1); |
82 | } | 82 | } |
83 | 83 | ||
84 | /* | 84 | /* |
85 | -- | 85 | -- |
86 | 2.39.5 | 86 | 2.39.5 | diff view generated by jsdifflib |
1 | This allows us to decouple the next-pc and next-rtc devices from each | 1 | This allows us to decouple the next-pc and next-rtc devices from each |
---|---|---|---|
2 | other in next_rtc_data_in_irq(). | 2 | other in next_rtc_data_in_irq(). |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 10 ++++++---- | 6 | hw/m68k/next-cube.c | 10 ++++++---- |
7 | 1 file changed, 6 insertions(+), 4 deletions(-) | 7 | 1 file changed, 6 insertions(+), 4 deletions(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
13 | @@ -XXX,XX +XXX,XX @@ struct NeXTRTC { | 13 | @@ -XXX,XX +XXX,XX @@ struct NeXTRTC { |
14 | uint8_t retval; | 14 | uint8_t retval; |
15 | 15 | ||
16 | qemu_irq data_out_irq; | 16 | qemu_irq data_out_irq; |
17 | + qemu_irq power_irq; | 17 | + qemu_irq power_irq; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | #define TYPE_NEXT_SCSI "next-scsi" | 20 | #define TYPE_NEXT_SCSI "next-scsi" |
21 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { | 21 | @@ -XXX,XX +XXX,XX @@ struct NeXTPC { |
22 | ESCCState escc; | 22 | ESCCState escc; |
23 | 23 | ||
24 | NeXTRTC rtc; | 24 | NeXTRTC rtc; |
25 | - qemu_irq rtc_power_irq; | 25 | - qemu_irq rtc_power_irq; |
26 | qemu_irq rtc_data_irq; | 26 | qemu_irq rtc_data_irq; |
27 | qemu_irq rtc_cmd_reset_irq; | 27 | qemu_irq rtc_cmd_reset_irq; |
28 | }; | 28 | }; |
29 | @@ -XXX,XX +XXX,XX @@ static bool next_rtc_cmd_is_write(uint8_t cmd) | 29 | @@ -XXX,XX +XXX,XX @@ static bool next_rtc_cmd_is_write(uint8_t cmd) |
30 | static void next_rtc_data_in_irq(void *opaque, int n, int level) | 30 | static void next_rtc_data_in_irq(void *opaque, int n, int level) |
31 | { | 31 | { |
32 | NeXTRTC *rtc = NEXT_RTC(opaque); | 32 | NeXTRTC *rtc = NEXT_RTC(opaque); |
33 | - NeXTPC *s = NEXT_PC(container_of(rtc, NeXTPC, rtc)); | 33 | - NeXTPC *s = NEXT_PC(container_of(rtc, NeXTPC, rtc)); |
34 | 34 | ||
35 | if (rtc->phase < 8) { | 35 | if (rtc->phase < 8) { |
36 | rtc->command = (rtc->command << 1) | level; | 36 | rtc->command = (rtc->command << 1) | level; |
37 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) | 37 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_data_in_irq(void *opaque, int n, int level) |
38 | if (rtc->value & 0x04) { | 38 | if (rtc->value & 0x04) { |
39 | /* clear FTU */ | 39 | /* clear FTU */ |
40 | rtc->status = rtc->status & (~0x18); | 40 | rtc->status = rtc->status & (~0x18); |
41 | - qemu_irq_lower(s->rtc_power_irq); | 41 | - qemu_irq_lower(s->rtc_power_irq); |
42 | + qemu_irq_lower(rtc->power_irq); | 42 | + qemu_irq_lower(rtc->power_irq); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } |
46 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_init(Object *obj) | 46 | @@ -XXX,XX +XXX,XX @@ static void next_rtc_init(Object *obj) |
47 | "rtc-data-out", 1); | 47 | "rtc-data-out", 1); |
48 | qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq, | 48 | qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq, |
49 | "rtc-cmd-reset", 1); | 49 | "rtc-cmd-reset", 1); |
50 | + qdev_init_gpio_out_named(DEVICE(obj), &rtc->power_irq, | 50 | + qdev_init_gpio_out_named(DEVICE(obj), &rtc->power_irq, |
51 | + "rtc-power-out", 1); | 51 | + "rtc-power-out", 1); |
52 | } | 52 | } |
53 | 53 | ||
54 | static const VMStateDescription next_rtc_vmstate = { | 54 | static const VMStateDescription next_rtc_vmstate = { |
55 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) | 55 | @@ -XXX,XX +XXX,XX @@ static void next_pc_realize(DeviceState *dev, Error **errp) |
56 | "rtc-data-in", 0)); | 56 | "rtc-data-in", 0)); |
57 | qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0, | 57 | qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0, |
58 | qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0)); | 58 | qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0)); |
59 | + qdev_connect_gpio_out_named(d, "rtc-power-out", 0, | 59 | + qdev_connect_gpio_out_named(d, "rtc-power-out", 0, |
60 | + qdev_get_gpio_in(dev, NEXT_PWR_I)); | 60 | + qdev_get_gpio_in(dev, NEXT_PWR_I)); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void next_pc_init(Object *obj) | 63 | static void next_pc_init(Object *obj) |
64 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) | 64 | @@ -XXX,XX +XXX,XX @@ static void next_pc_init(Object *obj) |
65 | 65 | ||
66 | object_initialize_child(obj, "rtc", &s->rtc, TYPE_NEXT_RTC); | 66 | object_initialize_child(obj, "rtc", &s->rtc, TYPE_NEXT_RTC); |
67 | 67 | ||
68 | - s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I); | 68 | - s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I); |
69 | qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq, | 69 | qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq, |
70 | "rtc-data-in", 1); | 70 | "rtc-data-in", 1); |
71 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, | 71 | qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq, |
72 | -- | 72 | -- |
73 | 2.39.5 | 73 | 2.39.5 | diff view generated by jsdifflib |
1 | Move these functions in next-cube.c so that they are with the rest of the | 1 | Move these functions in next-cube.c so that they are with the rest of the |
---|---|---|---|
2 | next-rtc functions. | 2 | next-rtc functions. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | --- | 5 | --- |
6 | hw/m68k/next-cube.c | 172 ++++++++++++++++++++++---------------------- | 6 | hw/m68k/next-cube.c | 172 ++++++++++++++++++++++---------------------- |
7 | 1 file changed, 86 insertions(+), 86 deletions(-) | 7 | 1 file changed, 86 insertions(+), 86 deletions(-) |
8 | 8 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
10 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/m68k/next-cube.c | 11 | --- a/hw/m68k/next-cube.c |
12 | +++ b/hw/m68k/next-cube.c | 12 | +++ b/hw/m68k/next-cube.c |
13 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_led_update(NeXTPC *s) | 13 | @@ -XXX,XX +XXX,XX @@ static void next_scr2_led_update(NeXTPC *s) |
14 | } | 14 | } |
15 | } | 15 | } |
16 | 16 | ||
17 | -static bool next_rtc_cmd_is_write(uint8_t cmd) | 17 | -static bool next_rtc_cmd_is_write(uint8_t cmd) |
18 | -{ | 18 | -{ |
19 | - return (cmd >= 0x80 && cmd <= 0x9f) || | 19 | - return (cmd >= 0x80 && cmd <= 0x9f) || |
20 | - (cmd == 0xb1); | 20 | - (cmd == 0xb1); |
21 | -} | 21 | -} |
22 | - | 22 | - |
23 | -static void next_rtc_data_in_irq(void *opaque, int n, int level) | 23 | -static void next_rtc_data_in_irq(void *opaque, int n, int level) |
24 | -{ | 24 | -{ |
25 | - NeXTRTC *rtc = NEXT_RTC(opaque); | 25 | - NeXTRTC *rtc = NEXT_RTC(opaque); |
26 | - | 26 | - |
27 | - if (rtc->phase < 8) { | 27 | - if (rtc->phase < 8) { |
28 | - rtc->command = (rtc->command << 1) | level; | 28 | - rtc->command = (rtc->command << 1) | level; |
29 | - | 29 | - |
30 | - if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { | 30 | - if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { |
31 | - if (rtc->command <= 0x1f) { | 31 | - if (rtc->command <= 0x1f) { |
32 | - /* RAM registers */ | 32 | - /* RAM registers */ |
33 | - rtc->retval = rtc->ram[rtc->command]; | 33 | - rtc->retval = rtc->ram[rtc->command]; |
34 | - } | 34 | - } |
35 | - if ((rtc->command >= 0x20) && (rtc->command <= 0x2f)) { | 35 | - if ((rtc->command >= 0x20) && (rtc->command <= 0x2f)) { |
36 | - /* RTC */ | 36 | - /* RTC */ |
37 | - time_t time_h = time(NULL); | 37 | - time_t time_h = time(NULL); |
38 | - struct tm *info = localtime(&time_h); | 38 | - struct tm *info = localtime(&time_h); |
39 | - rtc->retval = 0; | 39 | - rtc->retval = 0; |
40 | - | 40 | - |
41 | - switch (rtc->command) { | 41 | - switch (rtc->command) { |
42 | - case 0x20: | 42 | - case 0x20: |
43 | - rtc->retval = SCR2_TOBCD(info->tm_sec); | 43 | - rtc->retval = SCR2_TOBCD(info->tm_sec); |
44 | - break; | 44 | - break; |
45 | - case 0x21: | 45 | - case 0x21: |
46 | - rtc->retval = SCR2_TOBCD(info->tm_min); | 46 | - rtc->retval = SCR2_TOBCD(info->tm_min); |
47 | - break; | 47 | - break; |
48 | - case 0x22: | 48 | - case 0x22: |
49 | - rtc->retval = SCR2_TOBCD(info->tm_hour); | 49 | - rtc->retval = SCR2_TOBCD(info->tm_hour); |
50 | - break; | 50 | - break; |
51 | - case 0x24: | 51 | - case 0x24: |
52 | - rtc->retval = SCR2_TOBCD(info->tm_mday); | 52 | - rtc->retval = SCR2_TOBCD(info->tm_mday); |
53 | - break; | 53 | - break; |
54 | - case 0x25: | 54 | - case 0x25: |
55 | - rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); | 55 | - rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); |
56 | - break; | 56 | - break; |
57 | - case 0x26: | 57 | - case 0x26: |
58 | - rtc->retval = SCR2_TOBCD((info->tm_year - 100)); | 58 | - rtc->retval = SCR2_TOBCD((info->tm_year - 100)); |
59 | - break; | 59 | - break; |
60 | - } | 60 | - } |
61 | - } | 61 | - } |
62 | - if (rtc->command == 0x30) { | 62 | - if (rtc->command == 0x30) { |
63 | - /* read the status 0x30 */ | 63 | - /* read the status 0x30 */ |
64 | - rtc->retval = rtc->status; | 64 | - rtc->retval = rtc->status; |
65 | - } | 65 | - } |
66 | - if (rtc->command == 0x31) { | 66 | - if (rtc->command == 0x31) { |
67 | - /* read the control 0x31 */ | 67 | - /* read the control 0x31 */ |
68 | - rtc->retval = rtc->control; | 68 | - rtc->retval = rtc->control; |
69 | - } | 69 | - } |
70 | - } | 70 | - } |
71 | - } | 71 | - } |
72 | - if (rtc->phase >= 8 && rtc->phase < 16) { | 72 | - if (rtc->phase >= 8 && rtc->phase < 16) { |
73 | - if (next_rtc_cmd_is_write(rtc->command)) { | 73 | - if (next_rtc_cmd_is_write(rtc->command)) { |
74 | - /* Shift in value to write */ | 74 | - /* Shift in value to write */ |
75 | - rtc->value = (rtc->value << 1) | level; | 75 | - rtc->value = (rtc->value << 1) | level; |
76 | - } else { | 76 | - } else { |
77 | - /* Shift out value to read */ | 77 | - /* Shift out value to read */ |
78 | - if (rtc->retval & (0x80 >> (rtc->phase - 8))) { | 78 | - if (rtc->retval & (0x80 >> (rtc->phase - 8))) { |
79 | - qemu_irq_raise(rtc->data_out_irq); | 79 | - qemu_irq_raise(rtc->data_out_irq); |
80 | - } else { | 80 | - } else { |
81 | - qemu_irq_lower(rtc->data_out_irq); | 81 | - qemu_irq_lower(rtc->data_out_irq); |
82 | - } | 82 | - } |
83 | - } | 83 | - } |
84 | - } | 84 | - } |
85 | - | 85 | - |
86 | - rtc->phase++; | 86 | - rtc->phase++; |
87 | - if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { | 87 | - if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { |
88 | - if (rtc->command >= 0x80 && rtc->command <= 0x9f) { | 88 | - if (rtc->command >= 0x80 && rtc->command <= 0x9f) { |
89 | - /* RAM registers */ | 89 | - /* RAM registers */ |
90 | - rtc->ram[rtc->command - 0x80] = rtc->value; | 90 | - rtc->ram[rtc->command - 0x80] = rtc->value; |
91 | - } | 91 | - } |
92 | - if (rtc->command == 0xb1) { | 92 | - if (rtc->command == 0xb1) { |
93 | - /* write to 0x30 register */ | 93 | - /* write to 0x30 register */ |
94 | - if (rtc->value & 0x04) { | 94 | - if (rtc->value & 0x04) { |
95 | - /* clear FTU */ | 95 | - /* clear FTU */ |
96 | - rtc->status = rtc->status & (~0x18); | 96 | - rtc->status = rtc->status & (~0x18); |
97 | - qemu_irq_lower(rtc->power_irq); | 97 | - qemu_irq_lower(rtc->power_irq); |
98 | - } | 98 | - } |
99 | - } | 99 | - } |
100 | - } | 100 | - } |
101 | -} | 101 | -} |
102 | - | 102 | - |
103 | static void next_scr2_rtc_update(NeXTPC *s) | 103 | static void next_scr2_rtc_update(NeXTPC *s) |
104 | { | 104 | { |
105 | uint8_t old_scr2, scr2_2; | 105 | uint8_t old_scr2, scr2_2; |
106 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_dummy_en_ops = { | 106 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps next_dummy_en_ops = { |
107 | .endianness = DEVICE_BIG_ENDIAN, | 107 | .endianness = DEVICE_BIG_ENDIAN, |
108 | }; | 108 | }; |
109 | 109 | ||
110 | +static bool next_rtc_cmd_is_write(uint8_t cmd) | 110 | +static bool next_rtc_cmd_is_write(uint8_t cmd) |
111 | +{ | 111 | +{ |
112 | + return (cmd >= 0x80 && cmd <= 0x9f) || | 112 | + return (cmd >= 0x80 && cmd <= 0x9f) || |
113 | + (cmd == 0xb1); | 113 | + (cmd == 0xb1); |
114 | +} | 114 | +} |
115 | + | 115 | + |
116 | +static void next_rtc_data_in_irq(void *opaque, int n, int level) | 116 | +static void next_rtc_data_in_irq(void *opaque, int n, int level) |
117 | +{ | 117 | +{ |
118 | + NeXTRTC *rtc = NEXT_RTC(opaque); | 118 | + NeXTRTC *rtc = NEXT_RTC(opaque); |
119 | + | 119 | + |
120 | + if (rtc->phase < 8) { | 120 | + if (rtc->phase < 8) { |
121 | + rtc->command = (rtc->command << 1) | level; | 121 | + rtc->command = (rtc->command << 1) | level; |
122 | + | 122 | + |
123 | + if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { | 123 | + if (rtc->phase == 7 && !next_rtc_cmd_is_write(rtc->command)) { |
124 | + if (rtc->command <= 0x1f) { | 124 | + if (rtc->command <= 0x1f) { |
125 | + /* RAM registers */ | 125 | + /* RAM registers */ |
126 | + rtc->retval = rtc->ram[rtc->command]; | 126 | + rtc->retval = rtc->ram[rtc->command]; |
127 | + } | 127 | + } |
128 | + if ((rtc->command >= 0x20) && (rtc->command <= 0x2f)) { | 128 | + if ((rtc->command >= 0x20) && (rtc->command <= 0x2f)) { |
129 | + /* RTC */ | 129 | + /* RTC */ |
130 | + time_t time_h = time(NULL); | 130 | + time_t time_h = time(NULL); |
131 | + struct tm *info = localtime(&time_h); | 131 | + struct tm *info = localtime(&time_h); |
132 | + rtc->retval = 0; | 132 | + rtc->retval = 0; |
133 | + | 133 | + |
134 | + switch (rtc->command) { | 134 | + switch (rtc->command) { |
135 | + case 0x20: | 135 | + case 0x20: |
136 | + rtc->retval = SCR2_TOBCD(info->tm_sec); | 136 | + rtc->retval = SCR2_TOBCD(info->tm_sec); |
137 | + break; | 137 | + break; |
138 | + case 0x21: | 138 | + case 0x21: |
139 | + rtc->retval = SCR2_TOBCD(info->tm_min); | 139 | + rtc->retval = SCR2_TOBCD(info->tm_min); |
140 | + break; | 140 | + break; |
141 | + case 0x22: | 141 | + case 0x22: |
142 | + rtc->retval = SCR2_TOBCD(info->tm_hour); | 142 | + rtc->retval = SCR2_TOBCD(info->tm_hour); |
143 | + break; | 143 | + break; |
144 | + case 0x24: | 144 | + case 0x24: |
145 | + rtc->retval = SCR2_TOBCD(info->tm_mday); | 145 | + rtc->retval = SCR2_TOBCD(info->tm_mday); |
146 | + break; | 146 | + break; |
147 | + case 0x25: | 147 | + case 0x25: |
148 | + rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); | 148 | + rtc->retval = SCR2_TOBCD((info->tm_mon + 1)); |
149 | + break; | 149 | + break; |
150 | + case 0x26: | 150 | + case 0x26: |
151 | + rtc->retval = SCR2_TOBCD((info->tm_year - 100)); | 151 | + rtc->retval = SCR2_TOBCD((info->tm_year - 100)); |
152 | + break; | 152 | + break; |
153 | + } | 153 | + } |
154 | + } | 154 | + } |
155 | + if (rtc->command == 0x30) { | 155 | + if (rtc->command == 0x30) { |
156 | + /* read the status 0x30 */ | 156 | + /* read the status 0x30 */ |
157 | + rtc->retval = rtc->status; | 157 | + rtc->retval = rtc->status; |
158 | + } | 158 | + } |
159 | + if (rtc->command == 0x31) { | 159 | + if (rtc->command == 0x31) { |
160 | + /* read the control 0x31 */ | 160 | + /* read the control 0x31 */ |
161 | + rtc->retval = rtc->control; | 161 | + rtc->retval = rtc->control; |
162 | + } | 162 | + } |
163 | + } | 163 | + } |
164 | + } | 164 | + } |
165 | + if (rtc->phase >= 8 && rtc->phase < 16) { | 165 | + if (rtc->phase >= 8 && rtc->phase < 16) { |
166 | + if (next_rtc_cmd_is_write(rtc->command)) { | 166 | + if (next_rtc_cmd_is_write(rtc->command)) { |
167 | + /* Shift in value to write */ | 167 | + /* Shift in value to write */ |
168 | + rtc->value = (rtc->value << 1) | level; | 168 | + rtc->value = (rtc->value << 1) | level; |
169 | + } else { | 169 | + } else { |
170 | + /* Shift out value to read */ | 170 | + /* Shift out value to read */ |
171 | + if (rtc->retval & (0x80 >> (rtc->phase - 8))) { | 171 | + if (rtc->retval & (0x80 >> (rtc->phase - 8))) { |
172 | + qemu_irq_raise(rtc->data_out_irq); | 172 | + qemu_irq_raise(rtc->data_out_irq); |
173 | + } else { | 173 | + } else { |
174 | + qemu_irq_lower(rtc->data_out_irq); | 174 | + qemu_irq_lower(rtc->data_out_irq); |
175 | + } | 175 | + } |
176 | + } | 176 | + } |
177 | + } | 177 | + } |
178 | + | 178 | + |
179 | + rtc->phase++; | 179 | + rtc->phase++; |
180 | + if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { | 180 | + if (rtc->phase == 16 && next_rtc_cmd_is_write(rtc->command)) { |
181 | + if (rtc->command >= 0x80 && rtc->command <= 0x9f) { | 181 | + if (rtc->command >= 0x80 && rtc->command <= 0x9f) { |
182 | + /* RAM registers */ | 182 | + /* RAM registers */ |
183 | + rtc->ram[rtc->command - 0x80] = rtc->value; | 183 | + rtc->ram[rtc->command - 0x80] = rtc->value; |
184 | + } | 184 | + } |
185 | + if (rtc->command == 0xb1) { | 185 | + if (rtc->command == 0xb1) { |
186 | + /* write to 0x30 register */ | 186 | + /* write to 0x30 register */ |
187 | + if (rtc->value & 0x04) { | 187 | + if (rtc->value & 0x04) { |
188 | + /* clear FTU */ | 188 | + /* clear FTU */ |
189 | + rtc->status = rtc->status & (~0x18); | 189 | + rtc->status = rtc->status & (~0x18); |
190 | + qemu_irq_lower(rtc->power_irq); | 190 | + qemu_irq_lower(rtc->power_irq); |
191 | + } | 191 | + } |
192 | + } | 192 | + } |
193 | + } | 193 | + } |
194 | +} | 194 | +} |
195 | + | 195 | + |
196 | static void next_rtc_cmd_reset_irq(void *opaque, int n, int level) | 196 | static void next_rtc_cmd_reset_irq(void *opaque, int n, int level) |
197 | { | 197 | { |
198 | NeXTRTC *rtc = NEXT_RTC(opaque); | 198 | NeXTRTC *rtc = NEXT_RTC(opaque); |
199 | -- | 199 | -- |
200 | 2.39.5 | 200 | 2.39.5 | diff view generated by jsdifflib |
1 | Rename them to old_scr2_rtc and scr2_rtc to reflect that they contain the previous | 1 | Rename them to old_scr2_rtc and scr2_rtc to reflect that they contain the previous |
---|---|---|---|
2 | and current values of the SCR2 RTC bits. | 2 | and current values of the SCR2 RTC bits. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 14 +++++++------- | 7 | hw/m68k/next-cube.c | 14 +++++++------- |
7 | 1 file changed, 7 insertions(+), 7 deletions(-) | 8 | 1 file changed, 7 insertions(+), 7 deletions(-) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | This series has involved rewriting and/or updating a considerable part of the | 1 | This series has involved rewriting and/or updating a considerable part of the |
---|---|---|---|
2 | next-cube emulation so update the copyright in next-cube.c to reflect this. | 2 | next-cube emulation so update the copyright in next-cube.c to reflect this. |
3 | 3 | ||
4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 4 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
5 | Reviewed-by: Thomas Huth <huth@tuxfamily.org> | ||
5 | --- | 6 | --- |
6 | hw/m68k/next-cube.c | 1 + | 7 | hw/m68k/next-cube.c | 1 + |
7 | 1 file changed, 1 insertion(+) | 8 | 1 file changed, 1 insertion(+) |
8 | 9 | ||
9 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 10 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
... | ... | diff view generated by jsdifflib |
1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 1 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> |
---|---|---|---|
2 | --- | 2 | --- |
3 | hw/m68k/next-cube.c | 5 +---- | 3 | hw/m68k/next-cube.c | 5 +---- |
4 | 1 file changed, 1 insertion(+), 4 deletions(-) | 4 | 1 file changed, 1 insertion(+), 4 deletions(-) |
5 | 5 | ||
6 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c | 6 | diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c |
7 | index XXXXXXX..XXXXXXX 100644 | 7 | index XXXXXXX..XXXXXXX 100644 |
8 | --- a/hw/m68k/next-cube.c | 8 | --- a/hw/m68k/next-cube.c |
9 | +++ b/hw/m68k/next-cube.c | 9 | +++ b/hw/m68k/next-cube.c |
10 | @@ -XXX,XX +XXX,XX @@ | 10 | @@ -XXX,XX +XXX,XX @@ |
11 | * Copyright (c) 2011 Bryce Lanham | 11 | * Copyright (c) 2011 Bryce Lanham |
12 | * Copyright (c) 2024 Mark Cave-Ayland | 12 | * Copyright (c) 2024 Mark Cave-Ayland |
13 | * | 13 | * |
14 | - * This code is free software; you can redistribute it and/or modify | 14 | - * This code is free software; you can redistribute it and/or modify |
15 | - * it under the terms of the GNU General Public License as published | 15 | - * it under the terms of the GNU General Public License as published |
16 | - * by the Free Software Foundation; either version 2 of the License, | 16 | - * by the Free Software Foundation; either version 2 of the License, |
17 | - * or (at your option) any later version. | 17 | - * or (at your option) any later version. |
18 | + * SPDX-License-Identifier: GPL-2.0-or-later | 18 | + * SPDX-License-Identifier: GPL-2.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "qemu/osdep.h" | 21 | #include "qemu/osdep.h" |
22 | -- | 22 | -- |
23 | 2.39.5 | 23 | 2.39.5 | diff view generated by jsdifflib |