aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-06-23 21:49:32 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-06-26 10:13:52 +0100
commit378a50347931e71b15aaec44c4dc0f9adfa346bf (patch)
treecde9c336d2be4336645738ec976307f4feae8352 /hw
parentcf093b0772ad43538ba45c1dececec7113ab3d03 (diff)
downloadqemu-378a50347931e71b15aaec44c4dc0f9adfa346bf.zip
qemu-378a50347931e71b15aaec44c4dc0f9adfa346bf.tar.gz
qemu-378a50347931e71b15aaec44c4dc0f9adfa346bf.tar.bz2
mac_via: move VIA1 portB write logic into mos6522_q800_via1_write()
Currently the logic is split between the mos6522 portB_write() callback and the memory region used to capture the VIA1 MMIO accesses. Move everything into the latter mos6522_q800_via1_write() function to keep all the logic in one place to make it easier to follow. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Finn Thain <fthain@telegraphics.com.au> Acked-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200623204936.24064-19-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw')
-rw-r--r--hw/misc/mac_via.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
index 7a28bb3..a1dc00d 100644
--- a/hw/misc/mac_via.c
+++ b/hw/misc/mac_via.c
@@ -801,11 +801,21 @@ static void mos6522_q800_via1_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
MOS6522Q800VIA1State *v1s = MOS6522_Q800_VIA1(opaque);
+ MacVIAState *m = container_of(v1s, MacVIAState, mos6522_via1);
MOS6522State *ms = MOS6522(v1s);
addr = (addr >> 9) & 0xf;
mos6522_write(ms, addr, val, size);
+ switch (addr) {
+ case VIA_REG_B:
+ via1_rtc_update(m);
+ via1_adb_update(m);
+
+ v1s->last_b = ms->b;
+ break;
+ }
+
via1_one_second_update(v1s);
via1_VBL_update(v1s);
}
@@ -1037,18 +1047,6 @@ static TypeInfo mac_via_info = {
};
/* VIA 1 */
-static void mos6522_q800_via1_portB_write(MOS6522State *s)
-{
- MOS6522Q800VIA1State *v1s = container_of(s, MOS6522Q800VIA1State,
- parent_obj);
- MacVIAState *m = container_of(v1s, MacVIAState, mos6522_via1);
-
- via1_rtc_update(m);
- via1_adb_update(m);
-
- v1s->last_b = s->b;
-}
-
static void mos6522_q800_via1_reset(DeviceState *dev)
{
MOS6522State *ms = MOS6522(dev);
@@ -1071,10 +1069,8 @@ static void mos6522_q800_via1_init(Object *obj)
static void mos6522_q800_via1_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
- MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc);
dc->reset = mos6522_q800_via1_reset;
- mdc->portB_write = mos6522_q800_via1_portB_write;
}
static const TypeInfo mos6522_q800_via1_type_info = {