Message ID | 1327310329-15294-1-git-send-email-hpoussin@reactos.org |
---|---|
State | New |
Headers | show |
On 2012-01-23 10:18, Hervé Poussineau wrote: > rtc instanciated with -device has now a working irq line That makes no sense. The mc146818rtc is no_user - for a reason. What is the use case you are trying to address? Jan > > Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> > --- > hw/mc146818rtc.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c > index 657fa10..3067022 100644 > --- a/hw/mc146818rtc.c > +++ b/hw/mc146818rtc.c > @@ -672,6 +672,7 @@ static int rtc_initfn(ISADevice *dev) > > memory_region_init_io(&s->io, &cmos_ops, s, "rtc", 2); > isa_register_ioport(dev, &s->io, base); > + isa_init_irq(dev, &s->irq, RTC_ISA_IRQ); > > qdev_set_legacy_instance_id(&dev->qdev, base, 2); > qemu_register_reset(rtc_reset, s); > @@ -692,9 +693,8 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) > qdev_prop_set_int32(&dev->qdev, "base_year", base_year); > qdev_init_nofail(&dev->qdev); > if (intercept_irq) { > + /* Use provided IRQ instead of default one */ > s->irq = intercept_irq; > - } else { > - isa_init_irq(dev, &s->irq, RTC_ISA_IRQ); > } > return dev; > }
Jan Kiszka a écrit : > On 2012-01-23 10:18, Hervé Poussineau wrote: >> rtc instanciated with -device has now a working irq line > > That makes no sense. The mc146818rtc is no_user - for a reason. > > What is the use case you are trying to address? > I wanted to be able to instanciate it with isa_create_simple(isa_bus, "mc146818rtc") in machine init code. I don't see any good reason why a rtc created this way can't work. The commit message can be changed to: "rtc: initialize irq even if caller doesn't use rtc_init() function rtc instancianted with isa_create_simple() has now a working irq line" if you prefer... Hervé
On 2012-01-23 13:00, Hervé Poussineau wrote: > Jan Kiszka a écrit : >> On 2012-01-23 10:18, Hervé Poussineau wrote: >>> rtc instanciated with -device has now a working irq line >> >> That makes no sense. The mc146818rtc is no_user - for a reason. >> >> What is the use case you are trying to address? >> > > I wanted to be able to instanciate it with isa_create_simple(isa_bus, > "mc146818rtc") in machine init code. Why? > I don't see any good reason why a rtc created this way can't work. You will still need to set the base year then, manually. And your machine has no legacy RTC replacement logic like the PC? I just don't get the benefit. Jan
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 657fa10..3067022 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -672,6 +672,7 @@ static int rtc_initfn(ISADevice *dev) memory_region_init_io(&s->io, &cmos_ops, s, "rtc", 2); isa_register_ioport(dev, &s->io, base); + isa_init_irq(dev, &s->irq, RTC_ISA_IRQ); qdev_set_legacy_instance_id(&dev->qdev, base, 2); qemu_register_reset(rtc_reset, s); @@ -692,9 +693,8 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq) qdev_prop_set_int32(&dev->qdev, "base_year", base_year); qdev_init_nofail(&dev->qdev); if (intercept_irq) { + /* Use provided IRQ instead of default one */ s->irq = intercept_irq; - } else { - isa_init_irq(dev, &s->irq, RTC_ISA_IRQ); } return dev; }
rtc instanciated with -device has now a working irq line Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> --- hw/mc146818rtc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)