Skip to content

Commit eb1f036

Browse files
mcaylandhuth
authored andcommitted
next-cube: add rtc-power-out named gpio to trigger the NEXT_PWR_I interrupt
This allows us to decouple the next-pc and next-rtc devices from each other in next_rtc_data_in_irq(). Signed-off-by: Mark Cave-Ayland <[email protected]> Message-ID: <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent c1322be commit eb1f036

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

hw/m68k/next-cube.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct NeXTRTC {
5858
uint8_t retval;
5959

6060
qemu_irq data_out_irq;
61+
qemu_irq power_irq;
6162
};
6263

6364
#define TYPE_NEXT_SCSI "next-scsi"
@@ -106,7 +107,6 @@ struct NeXTPC {
106107
ESCCState escc;
107108

108109
NeXTRTC rtc;
109-
qemu_irq rtc_power_irq;
110110
qemu_irq rtc_data_irq;
111111
qemu_irq rtc_cmd_reset_irq;
112112
};
@@ -184,7 +184,6 @@ static bool next_rtc_cmd_is_write(uint8_t cmd)
184184
static void next_rtc_data_in_irq(void *opaque, int n, int level)
185185
{
186186
NeXTRTC *rtc = NEXT_RTC(opaque);
187-
NeXTPC *s = NEXT_PC(container_of(rtc, NeXTPC, rtc));
188187

189188
if (rtc->phase < 8) {
190189
rtc->command = (rtc->command << 1) | level;
@@ -256,7 +255,7 @@ static void next_rtc_data_in_irq(void *opaque, int n, int level)
256255
if (rtc->value & 0x04) {
257256
/* clear FTU */
258257
rtc->status = rtc->status & (~0x18);
259-
qemu_irq_lower(s->rtc_power_irq);
258+
qemu_irq_lower(rtc->power_irq);
260259
}
261260
}
262261
}
@@ -1044,6 +1043,8 @@ static void next_rtc_init(Object *obj)
10441043
"rtc-data-out", 1);
10451044
qdev_init_gpio_in_named(DEVICE(obj), next_rtc_cmd_reset_irq,
10461045
"rtc-cmd-reset", 1);
1046+
qdev_init_gpio_out_named(DEVICE(obj), &rtc->power_irq,
1047+
"rtc-power-out", 1);
10471048
}
10481049

10491050
static const VMStateDescription next_rtc_vmstate = {
@@ -1156,6 +1157,8 @@ static void next_pc_realize(DeviceState *dev, Error **errp)
11561157
"rtc-data-in", 0));
11571158
qdev_connect_gpio_out_named(dev, "rtc-cmd-reset", 0,
11581159
qdev_get_gpio_in_named(d, "rtc-cmd-reset", 0));
1160+
qdev_connect_gpio_out_named(d, "rtc-power-out", 0,
1161+
qdev_get_gpio_in(dev, NEXT_PWR_I));
11591162
}
11601163

11611164
static void next_pc_init(Object *obj)
@@ -1191,7 +1194,6 @@ static void next_pc_init(Object *obj)
11911194

11921195
object_initialize_child(obj, "rtc", &s->rtc, TYPE_NEXT_RTC);
11931196

1194-
s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I);
11951197
qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq,
11961198
"rtc-data-in", 1);
11971199
qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq,

0 commit comments

Comments
 (0)