mac_via: fix rtc command decoding for the PRAM seconds registers
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Wed, 21 Jun 2023 08:53:53 +0000 (09:53 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Thu, 22 Jun 2023 07:31:18 +0000 (09:31 +0200)
commit532009054b45d75a3cf7ba9c31921add669d290d
treed1510991b4974fda58fd534ee2d4c42b41126d07
parentce47d531c33c35eca985f2dffc340c09433690fa
mac_via: fix rtc command decoding for the PRAM seconds registers

Analysis of the MacOS toolbox ROM code shows that on startup it attempts 2
separate reads of the seconds registers with commands 0x9d...0x91 followed by
0x8d..0x81 without resetting the command to its initial value. The PRAM seconds
value is only accepted when the values of the 2 separate reads match.

From this we conclude that bit 4 of the rtc command is not decoded or we don't
care about its value when reading the PRAM seconds registers. Implement this
decoding change so that both reads return successfully which allows the MacOS
toolbox ROM to correctly set the date/time.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230621085353.113233-25-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
hw/misc/mac_via.c