diff mbox series

[4/4] hw/isa/i82378.c: use 1900 as a base year

Message ID 1555103178-21894-5-git-send-email-atar4qemu@gmail.com (mailing list archive)
State New, archived
Headers show
Series Improve 40p, make AIX 5.1 boot | expand

Commit Message

Artyom Tarasenko April 12, 2019, 9:06 p.m. UTC
AIX 5.1 expects the base year to be 1900. Adjust accordingly.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 hw/isa/i82378.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Hervé Poussineau April 14, 2019, 5:01 p.m. UTC | #1
Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
> AIX 5.1 expects the base year to be 1900. Adjust accordingly.
> 
> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
>   hw/isa/i82378.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> index a5d67bc..546c928 100644
> --- a/hw/isa/i82378.c
> +++ b/hw/isa/i82378.c
> @@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>       isa = isa_create_simple(isabus, "i82374");
>   
>       /* timer */
> -    isa_create_simple(isabus, TYPE_MC146818_RTC);
> +    isa = isa_create(isabus, TYPE_MC146818_RTC);
> +    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
> +    qdev_init_nofail(DEVICE(isa));

I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.
Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias?
Then, change 40p machine to set it to 1900, without changing it for prep machine.

>   }
>   
>   static void i82378_init(Object *obj)
> 

Hervé
Artyom Tarasenko April 14, 2019, 6:53 p.m. UTC | #2
On Sun, Apr 14, 2019 at 7:01 PM Hervé Poussineau <hpoussin@reactos.org> wrote:
>
> Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
> > AIX 5.1 expects the base year to be 1900. Adjust accordingly.
> >
> > Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> > ---
> >   hw/isa/i82378.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> > index a5d67bc..546c928 100644
> > --- a/hw/isa/i82378.c
> > +++ b/hw/isa/i82378.c
> > @@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
> >       isa = isa_create_simple(isabus, "i82374");
> >
> >       /* timer */
> > -    isa_create_simple(isabus, TYPE_MC146818_RTC);
> > +    isa = isa_create(isabus, TYPE_MC146818_RTC);
> > +    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
> > +    qdev_init_nofail(DEVICE(isa));
>
> I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.

I doubt it to be honest. How would it work in the hardware? Is there a
pin which would switch a year?
I do believe the different i823xx may have the different base years though.

> Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias?
> Then, change 40p machine to set it to 1900, without changing it for prep machine.

Were you not going to drop the -M prep ? Because I sort of dropped the
support for it in OFW.
I had a branch were I added some registers to -M prep  enough that it
would be able to turn itself out as a PowerStack II Utah,
but then again I couldn't find any advantage of having two PReP machines.
AFAIK, the only OS which can run on Powerstack, but not on 40p is Motorola AIX.
But since we can have IBM AIX, I don't see why would we want to keep -M prep.

On the other hand, if you plan to revive it, I'll think about adding
the support for it to OFW.
PowerStack had a Cirrus VGA which we already have.

> >   }
> >
> >   static void i82378_init(Object *obj)
> >
>
> Hervé
Hervé Poussineau April 14, 2019, 9:24 p.m. UTC | #3
Le 14/04/2019 à 20:53, Artyom Tarasenko a écrit :
> On Sun, Apr 14, 2019 at 7:01 PM Hervé Poussineau <hpoussin@reactos.org> wrote:
>>
>> Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
>>> AIX 5.1 expects the base year to be 1900. Adjust accordingly.
>>>
>>> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
>>> ---
>>>    hw/isa/i82378.c | 4 +++-
>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
>>> index a5d67bc..546c928 100644
>>> --- a/hw/isa/i82378.c
>>> +++ b/hw/isa/i82378.c
>>> @@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>>>        isa = isa_create_simple(isabus, "i82374");
>>>
>>>        /* timer */
>>> -    isa_create_simple(isabus, TYPE_MC146818_RTC);
>>> +    isa = isa_create(isabus, TYPE_MC146818_RTC);
>>> +    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
>>> +    qdev_init_nofail(DEVICE(isa));
>>
>> I am not sure the base_year should be hardcoded in i82378. I can assume other machines with a i82378 can have another base_year.
> 
> I doubt it to be honest. How would it work in the hardware? Is there a
> pin which would switch a year?
> I do believe the different i823xx may have the different base years though.

OK, I don't really know. So, your patch looks fine.

Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>

> 
>> Maybe you can you add a base_year property to i82378, and forward it to mc146818 with object_property_add_alias?
>> Then, change 40p machine to set it to 1900, without changing it for prep machine.
> 
> Were you not going to drop the -M prep ? Because I sort of dropped the
> support for it in OFW.
> I had a branch were I added some registers to -M prep  enough that it
> would be able to turn itself out as a PowerStack II Utah,
> but then again I couldn't find any advantage of having two PReP machines.
> AFAIK, the only OS which can run on Powerstack, but not on 40p is Motorola AIX.
> But since we can have IBM AIX, I don't see why would we want to keep -M prep.

I really want to drop support for prep. But, as long as prep is in code base, we shouldn't regress it too much.

> 
> On the other hand, if you plan to revive it, I'll think about adding
> the support for it to OFW.
> PowerStack had a Cirrus VGA which we already have.
> 
>>>    }
>>>
>>>    static void i82378_init(Object *obj)
>>>
>>
>> Hervé
> 
> 
>
Philippe Mathieu-Daudé April 15, 2019, 10:36 a.m. UTC | #4
On 4/14/19 11:24 PM, Hervé Poussineau wrote:
> Le 14/04/2019 à 20:53, Artyom Tarasenko a écrit :
>> On Sun, Apr 14, 2019 at 7:01 PM Hervé Poussineau
>> <hpoussin@reactos.org> wrote:
>>>
>>> Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
>>>> AIX 5.1 expects the base year to be 1900. Adjust accordingly.
>>>>
>>>> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
>>>> ---
>>>>    hw/isa/i82378.c | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
>>>> index a5d67bc..546c928 100644
>>>> --- a/hw/isa/i82378.c
>>>> +++ b/hw/isa/i82378.c
>>>> @@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error
>>>> **errp)
>>>>        isa = isa_create_simple(isabus, "i82374");
>>>>
>>>>        /* timer */
>>>> -    isa_create_simple(isabus, TYPE_MC146818_RTC);
>>>> +    isa = isa_create(isabus, TYPE_MC146818_RTC);
>>>> +    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
>>>> +    qdev_init_nofail(DEVICE(isa));
>>>
>>> I am not sure the base_year should be hardcoded in i82378. I can
>>> assume other machines with a i82378 can have another base_year.
>>
>> I doubt it to be honest. How would it work in the hardware? Is there a
>> pin which would switch a year?
>> I do believe the different i823xx may have the different base years
>> though.

There is no RTC on the i82378, this should be moved to the board code
and set the date there. Do you want me to send this patch?

Regards,

Phil.
Artyom Tarasenko April 15, 2019, 10:45 a.m. UTC | #5
On Mon, Apr 15, 2019 at 12:36 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> On 4/14/19 11:24 PM, Hervé Poussineau wrote:
> > Le 14/04/2019 à 20:53, Artyom Tarasenko a écrit :
> >> On Sun, Apr 14, 2019 at 7:01 PM Hervé Poussineau
> >> <hpoussin@reactos.org> wrote:
> >>>
> >>> Le 12/04/2019 à 23:06, Artyom Tarasenko a écrit :
> >>>> AIX 5.1 expects the base year to be 1900. Adjust accordingly.
> >>>>
> >>>> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> >>>> ---
> >>>>    hw/isa/i82378.c | 4 +++-
> >>>>    1 file changed, 3 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> >>>> index a5d67bc..546c928 100644
> >>>> --- a/hw/isa/i82378.c
> >>>> +++ b/hw/isa/i82378.c
> >>>> @@ -107,7 +107,9 @@ static void i82378_realize(PCIDevice *pci, Error
> >>>> **errp)
> >>>>        isa = isa_create_simple(isabus, "i82374");
> >>>>
> >>>>        /* timer */
> >>>> -    isa_create_simple(isabus, TYPE_MC146818_RTC);
> >>>> +    isa = isa_create(isabus, TYPE_MC146818_RTC);
> >>>> +    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
> >>>> +    qdev_init_nofail(DEVICE(isa));
> >>>
> >>> I am not sure the base_year should be hardcoded in i82378. I can
> >>> assume other machines with a i82378 can have another base_year.
> >>
> >> I doubt it to be honest. How would it work in the hardware? Is there a
> >> pin which would switch a year?
> >> I do believe the different i823xx may have the different base years
> >> though.
>
> There is no RTC on the i82378, this should be moved to the board code
> and set the date there. Do you want me to send this patch?

Please do. I won't have a chance to get to it till the next weekend.

Artyom
diff mbox series

Patch

diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index a5d67bc..546c928 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -107,7 +107,9 @@  static void i82378_realize(PCIDevice *pci, Error **errp)
     isa = isa_create_simple(isabus, "i82374");
 
     /* timer */
-    isa_create_simple(isabus, TYPE_MC146818_RTC);
+    isa = isa_create(isabus, TYPE_MC146818_RTC);
+    qdev_prop_set_int32(DEVICE(isa), "base_year", 1900);
+    qdev_init_nofail(DEVICE(isa));
 }
 
 static void i82378_init(Object *obj)