hw/ppc/40p: Move the MC146818 RTC to the board where it belongs
cover hw/ppc/40p: Move the MC146818 RTC to the board where it belongs
Hi,
This series is to properly do the fix sent by Artyom here:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg02264.html
There is no RTC on the i82378, move it to the board code, set the base year there.
Regards,
Phil.
Artyom Tarasenko (1):
hw/ppc/40p: use 1900 as a base year
Philippe Mathieu-Daudé (2):
hw/ppc/prep: use TYPE_MC146818_RTC instead of a hardcoded string hw/ppc/40p: Move the MC146818 RTC to the board where it belongs
hw/isa/i82378.c | 4 ---- hw/ppc/prep.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/3 hw/ppc/prep: use TYPE_MC146818_RTC instead of a hardcoded string
--- hw/ppc/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/prep.c +1 -1
@@ -601,7 +601,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)uint16_t checksum = *(uint16_t *)opaque;ISADevice *rtc; -if (object_dynamic_cast (OBJECT (dev),"mc146818rtc" )) { +if (object_dynamic_cast (OBJECT (dev),TYPE_MC146818_RTC )) { rtc =ISA_DEVICE (dev);rtc_set_memory (rtc,0x2e , checksum &0xff );rtc_set_memory (rtc,0x3e , checksum &0xff );
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH 1/3] hw/ppc/prep: use TYPE_MC146818_RTC instead of a hardcoded string
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Certainly a good fix, but looks like there's places in hw/timer/mc146818rtc.c itself and in vl.c which could also do with this.
Quoted 17 lines
--- hw/ppc/prep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/prep.c +1
-1@@ -601,7 +601,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)uint16_t checksum = *(uint16_t *)opaque;ISADevice *rtc; -if (object_dynamic_cast (OBJECT (dev),"mc146818rtc" )) { +if (object_dynamic_cast (OBJECT (dev),TYPE_MC146818_RTC )) { rtc =ISA_DEVICE (dev);rtc_set_memory (rtc,0x2e , checksum &0xff );rtc_set_memory (rtc,0x3e , checksum &0xff );
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 2/3 hw/ppc/40p: Move the MC146818 RTC to the board where it belongs
In reply to Philippe Mathieu-DaudéThe MC146818 RTC was incorrectly added to the i82378 chipset in commit a04ff940974a. In the next commit (506b7ddf8893) the PReP machine use the i82378.
Since the MC146818 is specific to the PReP machine, move its use there.
--- hw/isa/i82378.c | 4 ---- hw/ppc/prep.c | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-)
hw/isa/i82378.c +0 -4
@@ -21,7 +21,6 @@#include "hw/pci/pci.h" #include "hw/i386/pc.h" #include "hw/timer/i8254.h" -#include "hw/timer/mc146818rtc.h" #include "hw/audio/pcspk.h" #define TYPE_I82378 "i82378"
@@ -105,9 +104,6 @@ static void i82378_realize(PCIDevice *pci, Error **errp)/* 2 82C37 (dma) */ isa =isa_create_simple (isabus,"i82374" ); - -/* timer */ -isa_create_simple (isabus,TYPE_MC146818_RTC ); }static void i82378_init (Object *obj)
hw/ppc/prep.c +3 -0
@@ -675,6 +675,9 @@ static void ibm_40p_init(MachineState *machine)qdev_prop_set_uint32 (dev,"ram-size" , machine->ram_size);qdev_init_nofail (dev); +/* RTC */ +isa_create_simple (isa_bus,TYPE_MC146818_RTC ); +/* initialize CMOS checksums */ cmos_checksum =0x6aa9 ; qbus_walk_children(BUS(isa_bus), prep_set_cmos_checksum, NULL, NULL, NULL,
Signature · 1 line
2.20.1
PATCH 3/3 hw/ppc/40p: use 1900 as a base year
In reply to Philippe Mathieu-DaudéFrom: Artyom Tarasenko <[email protected]>
AIX 5.1 expects the base year to be 1900. Adjust accordingly.
--- hw/ppc/prep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/prep.c +3 -1
@@ -676,7 +676,9 @@ static void ibm_40p_init(MachineState *machine)qdev_init_nofail (dev);/* RTC */ -isa_create_simple (isa_bus,TYPE_MC146818_RTC ); + dev =DEVICE (isa_create (isa_bus,TYPE_MC146818_RTC )); +qdev_prop_set_int32 (dev,"base_year" ,1900 ); +qdev_init_nofail (dev);/* initialize CMOS checksums */ cmos_checksum =0x6aa9 ;
Signature · 1 line
2.20.1
David Gibson
AppliedQuoted 7 lines · Philippe Mathieu-Daudé
Hi,
This series is to properly do the fix sent by Artyom here:
https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg02264.htmlThere is no RTC on the i82378, move it to the board code, set the base year there.
Applied to ppc-for-4.1, although see comment for a possible followup.
Quoted 16 lines
Regards,
Phil.
Artyom Tarasenko (1):
hw/ppc/40p: use 1900 as a base yearPhilippe Mathieu-Daudé (2):
hw/ppc/prep: useTYPE_MC146818_RTCinstead of a hardcoded string hw/ppc/40p: Move the MC146818 RTC to the board where it belongshw/isa/i82378.c | 4 ---- hw/ppc/prep.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson