From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMhJX-0004SH-0y for qemu-devel@nongnu.org; Sat, 14 Feb 2015 13:19:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMhJT-00016c-QU for qemu-devel@nongnu.org; Sat, 14 Feb 2015 13:19:34 -0500 Message-ID: <54DF90FE.7030009@reactos.org> Date: Sat, 14 Feb 2015 19:16:30 +0100 From: =?windows-1252?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 References: <1423903949-14487-1-git-send-email-mark.cave-ayland@ilande.co.uk> <1423903949-14487-2-git-send-email-mark.cave-ayland@ilande.co.uk> In-Reply-To: <1423903949-14487-2-git-send-email-mark.cave-ayland@ilande.co.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCHv3 1/2] m48t59: introduce new base_year qdev property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Cave-Ayland , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de, andreas.faerber@web.de, atar4qemu@gmail.com Hi, Le 14/02/2015 09:52, Mark Cave-Ayland a =E9crit : > Currently the m48t59 device uses the hardware model in order to determi= ne > whether the year value is offset from the hardware value. As this will > soon be required by the x59 model, create a qdev base_year property to > represent the base year and update the callers appropriately. > > Signed-off-by: Mark Cave-Ayland > --- > hw/ppc/ppc405_boards.c | 2 +- > hw/ppc/prep.c | 2 +- > hw/sparc/sun4m.c | 2 +- > hw/sparc64/sun4u.c | 2 +- > hw/timer/m48t59.c | 27 +++++++++++++++------------ > include/hw/timer/m48t59.h | 5 +++-- > 6 files changed, 22 insertions(+), 18 deletions(-) > > diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c > index 1dcea77..5019f20 100644 > --- a/hw/ppc/ppc405_boards.c > +++ b/hw/ppc/ppc405_boards.c > @@ -283,7 +283,7 @@ static void ref405ep_init(MachineState *machine) > #ifdef DEBUG_BOARD_INIT > printf("%s: register NVRAM\n", __func__); > #endif > - m48t59_init(NULL, 0xF0000000, 0, 8192, 8); > + m48t59_init(NULL, 0xF0000000, 0, 8192, 2000, 8); > /* Load kernel */ > linux_boot =3D (kernel_filename !=3D NULL); > if (linux_boot) { Before this patch, m48t59 model 8 (ie m48t08) was handled with a base yea= r of 1968 by default. Here, you're changing the behaviour. Is is expected= , or did you meant 1968? > [...] > @@ -387,11 +388,7 @@ static void m48t59_write(M48t59State *NVRAM, uint3= 2_t addr, uint32_t val) > tmp =3D from_bcd(val); > if (tmp >=3D 0 && tmp <=3D 99) { > get_time(NVRAM, &tm); > - if (NVRAM->model =3D=3D 8) { > - tm.tm_year =3D from_bcd(val) + 68; // Base year is 196= 8 > - } else { > - tm.tm_year =3D from_bcd(val); > - } > + tm.tm_year =3D from_bcd(val) + NVRAM->base_year - 1900; > set_time(NVRAM, &tm); > } > break; Here, 1968 was the default base year for m48t08 on writes. > @@ -493,11 +490,7 @@ static uint32_t m48t59_read(M48t59State *NVRAM, ui= nt32_t addr) > case 0x07FF: > /* year */ > get_time(NVRAM, &tm); > - if (NVRAM->model =3D=3D 8) { > - retval =3D to_bcd(tm.tm_year - 68); // Base year is 1968 > - } else { > - retval =3D to_bcd(tm.tm_year); > - } > + retval =3D to_bcd((tm.tm_year + 1900 - NVRAM->base_year) % 100= ); > break; > default: > /* Check lock registers state */ Here, 1968 was the default base year for m48t08 on reads. > [...] > @@ -809,6 +805,7 @@ static void m48txx_isa_toggle_lock(Nvram *obj, int = lock) > } > > static Property m48t59_isa_properties[] =3D { > + DEFINE_PROP_INT32("base_year", M48txxISAState, state.base_year, 0)= , > DEFINE_PROP_UINT32("iobase", M48txxISAState, io_base, 0x74), > DEFINE_PROP_END_OF_LIST(), > }; It seems like tha QEMU way of naming properties is with an hyphen, not wi= th an underscore. So you should use "base-year" instead of "base_year". > @@ -852,6 +849,11 @@ static void m48txx_sysbus_toggle_lock(Nvram *obj, = int lock) > m48t59_toggle_lock(&d->state, lock); > } > > +static Property m48t59_sysbus_properties[] =3D { > + DEFINE_PROP_INT32("base_year", M48txxSysBusState, state.base_year,= 0), > + DEFINE_PROP_END_OF_LIST(), > +}; > + Again here. Regards, Herv=E9