summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-06-25 07:53:58 +0100
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-07-02 17:35:08 +0200
commit846feac2ae1d1dab08c0048807ce802a256179fd (patch)
tree61bbe426e00f3c35b82d5d3c05ead161feee63ed
parentdb1ffc32dd0d32ef476c00637efc888ecea8466c (diff)
downloadfocaccia-qemu-846feac2ae1d1dab08c0048807ce802a256179fd.tar.gz
focaccia-qemu-846feac2ae1d1dab08c0048807ce802a256179fd.zip
hw/m68k/q800: fix PROM checksum and MAC address storage
The checksum used by MacOS to validate the PROM content is an exclusive-OR
rather than a sum over the corresponding bytes. In addition the MAC address
must be stored in bit-reversed format as indicated in comments in Linux's
macsonic.c.

With the PROM contents fixed MacOS starts to probe the device registers
when AppleTalk is enabled in the Control Panel.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Finn Thain <fthain@linux-m68k.org>
Message-Id: <20210625065401.30170-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--hw/m68k/q800.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 491f283a17..6817c8b5d1 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -334,11 +334,8 @@ static void q800_init(MachineState *machine)
     prom = memory_region_get_ram_ptr(dp8393x_prom);
     checksum = 0;
     for (i = 0; i < 6; i++) {
-        prom[i] = nd_table[0].macaddr.a[i];
-        checksum += prom[i];
-        if (checksum > 0xff) {
-            checksum = (checksum + 1) & 0xff;
-        }
+        prom[i] = bitrev8(nd_table[0].macaddr.a[i]);
+        checksum ^= prom[i];
     }
     prom[7] = 0xff - checksum;