From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LhfFb-00077K-8B for qemu-devel@nongnu.org; Thu, 12 Mar 2009 03:22:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LhfFY-000763-6M for qemu-devel@nongnu.org; Thu, 12 Mar 2009 03:22:42 -0400 Received: from [199.232.76.173] (port=35195 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhfFY-00075v-1P for qemu-devel@nongnu.org; Thu, 12 Mar 2009 03:22:40 -0400 Received: from mail-bw0-f171.google.com ([209.85.218.171]:34193) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LhfFX-0006d2-HP for qemu-devel@nongnu.org; Thu, 12 Mar 2009 03:22:39 -0400 Received: by bwz19 with SMTP id 19so251744bwz.34 for ; Thu, 12 Mar 2009 00:22:36 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 12 Mar 2009 08:22:36 +0100 Message-ID: <47d9bb870903120022i6cb74249l2040da3287075a36@mail.gmail.com> From: Robert Niemi Content-Type: multipart/alternative; boundary=001636c5a5013a6f9e0464e6d997 Subject: [Qemu-devel] Patch: Integrator/CP reference clock cycle counter Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --001636c5a5013a6f9e0464e6d997 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Below is a patch to the integrator/cp implementation, adding support for CM_REFCNT. The behaviour is not strictly correct, since the counter should be zeroed upon reset. But it wraps fairly often so this flaw shouldn't really affect anyone. BTW, is this the correct place to submit patches? /Rob --- qemu_svn/trunk/hw/integratorcp.c 2009-03-12 07:10:23.000000000 +0100 +++ qemu/hw/integratorcp.c 2009-03-12 07:22:34.000000000 +0100 @@ -14,6 +14,7 @@ #include "boards.h" #include "arm-misc.h" #include "net.h" +#include "qemu-timer.h" typedef struct { uint32_t flash_offset; @@ -71,8 +72,7 @@ static uint32_t integratorcm_read(void * case 9: /* CM_INIT */ return s->cm_init; case 10: /* CM_REFCT */ - /* ??? High frequency timer. */ - cpu_abort(cpu_single_env, "integratorcm_read: CM_REFCT"); + return muldiv64(qemu_get_clock(vm_clock), 24000000, ticks_per_sec); case 12: /* CM_FLAGS */ return s->cm_flags; case 14: /* CM_NVFLAGS */ --001636c5a5013a6f9e0464e6d997 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Below is a patch to the integrator/cp implementation, adding support for CM= _REFCNT.
The behaviour is not strictly correct, since the counter shoul= d be zeroed upon reset. But it wraps fairly often so this flaw shouldn'= t really affect anyone.
BTW, is this the correct place to submit patches?

/Rob

--- qe= mu_svn/trunk/hw/integratorcp.c=C2=A0=C2=A0=C2=A0 2009-03-12 07:10:23.000000= 000 +0100
+++ qemu/hw/integratorcp.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 2009-= 03-12 07:22:34.000000000 +0100
@@ -14,6 +14,7 @@
=C2=A0#include "boards.h"
=C2=A0#include "arm-misc.h"= ;
=C2=A0#include "net.h"
+#include "qemu-timer.h"=
=C2=A0
=C2=A0typedef struct {
=C2=A0=C2=A0=C2=A0=C2=A0 uint32_t f= lash_offset;
@@ -71,8 +72,7 @@ static uint32_t integratorcm_read(void *<= br> =C2=A0=C2=A0=C2=A0=C2=A0 case 9: /* CM_INIT */
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 return s->cm_init;
=C2=A0=C2=A0=C2=A0=C2=A0 = case 10: /* CM_REFCT */
-=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* ?= ?? High frequency timer.=C2=A0 */
-=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 cpu_abort(cpu_single_env, "integratorcm_read: CM_REFCT");<= br> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 return muldiv64(qemu_get_clock(vm_clock), 24000000, ticks_per_= sec);
=C2=A0=C2=A0=C2=A0=C2=A0 case 12: /* CM_FLAGS */
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return s->cm_flags;
=C2=A0=C2=A0= =C2=A0=C2=A0 case 14: /* CM_NVFLAGS */

--001636c5a5013a6f9e0464e6d997--