Subject: Re: timecounter changes for newsmips
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: port-newsmips
Date: 09/13/2006 07:29:22
Izumi Tsutsui wrote:
> garrett_damore@tadpole.com wrote:
>
>
>> I wrote the following patch which converts newsmips to tc.
>>
>> In this change:
>>
>> 1) only NWS-5000 has a high resolution timer
>> 2) the timer NEWS5000_FREERUN is assumed to tick once per usec. That
>> seems what the current code.
>> 3) I assume it wraps on a 32-bit boundary (i.e counts 0-ffffffff)
>>
>> If these assumptions are good, then the code should run. I don't have
>> news docs, so I'm just interpreting the pre-existing code. I'd
>> appreciate it if folks can test, and commit as appropriate.
>>
>
> I've just tried it, but it looks news5000_init() is too early
> to call tc_init(), because news5000_init() is called from
> mach_init(), before main() (though it seems to work):
>
> ---
> NetBSD/newsmips Primary Boot
> NetBSD/newsmips Secondary Boot, Revision 1.7
> (tsutsui@mirage, Sun Aug 27 19:42:01 JST 2006)
> Booting scsi(0,0)
> 2711984+184448 [94576+84133]=0x2ef014
>
> timecounter: Timecounter "news5000_freerun" frequency 1000000 Hz quality 100
> timecounter: selected timecounter "news5000_freerun" frequency 1000000 Hz quality 100
> Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
> The NetBSD Foundation, Inc. All rights reserved.
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
>
> NetBSD 4.99.1 (GENERIC) #12: Wed Sep 13 22:07:32 JST 2006
> tsutsui@mirage:/usr/src/sys/arch/newsmips/compile/GENERIC
> total memory = 127 MB
> avail memory = 120 MB
> timecounter: Timecounters tick every 10.000 msec
> SONY NET WORK STATION, Model NWS-5000, Machine ID #14668
> mainbus0 (root)
> :
> ---
>
> I think it's better to move tc_init() in news5000.c from news5000_init()
> to news5000_enable_timer() (before enabling timer interrupt):
>
> ---
> :
> scsibus0 at spifi0: 8 targets, 8 luns per target
> spifi1 at ap0 slot0 addr 0xbe380000: SCSI ID = 7, using dmac1
> scsibus1 at spifi1: 8 targets, 8 luns per target
> xb at ap0 slot0 addr 0xb4900000 not configured
> timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
> timecounter: selected timecounter "clockinterrupt" frequency 100 Hz quality 0
> timecounter: Timecounter "news5000_freerun" frequency 1000000 Hz quality 100
> timecounter: selected timecounter "news5000_freerun" frequency 1000000 Hz quality 100
> scsibus0: waiting 2 seconds for devices to settle...
> scsibus1: waiting 2 seconds for devices to settle...
> sd0 at scsibus0 target 0 lun 0: <SEAGATE, ST12550N, 0013> disk fixed
> sd0: 2040 MB, 2708 cyl, 19 head, 81 sec, 512 bytes/sect x 4178874 sectors
> ---
>
> On regressions, both sleeping and time just work successfully,
> and ping(8) also shows reasonable time.
>
> I have not tested it on NWS-3470D, but "clockinterrupt" should just work..
> ---
> Izumi Tsutsui
>
I agree. If you're happy with your changes, can you commit them?
-- Garrett
--
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134 Fax: 951 325-2191