Discussion:
timecounter changes for newsmips
Garrett D'Amore
2006-09-12 22:21:44 UTC
Permalink
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.

-- 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
Izumi Tsutsui
2006-09-13 14:23:19 UTC
Permalink
Post by Garrett D'Amore
I wrote the following patch which converts newsmips to tc.
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
(***@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
***@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
Garrett D'Amore
2006-09-13 14:29:22 UTC
Permalink
Post by Izumi Tsutsui
Post by Garrett D'Amore
I wrote the following patch which converts newsmips to tc.
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
---
NetBSD/newsmips Primary Boot
NetBSD/newsmips Secondary Boot, Revision 1.7
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
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()
---
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
Izumi Tsutsui
2006-09-13 14:54:30 UTC
Permalink
Post by Garrett D'Amore
I agree. If you're happy with your changes, can you commit them?
Done. Thank you for your efforts :-)
---
Izumi Tsutsui
Garrett D'Amore
2006-09-13 14:56:48 UTC
Permalink
Post by Izumi Tsutsui
Post by Garrett D'Amore
I agree. If you're happy with your changes, can you commit them?
Done. Thank you for your efforts :-)
---
Izumi Tsutsui
Thanks. You want to update src/doc/CHANGES as well? Or I can.
--
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
Izumi Tsutsui
2006-09-13 15:12:08 UTC
Permalink
Post by Garrett D'Amore
Thanks. You want to update src/doc/CHANGES as well? Or I can.
Also done, but I'm behind you for feature table ;-)
---
Izumi Tsutsui
Garrett D'Amore
2006-09-13 15:28:23 UTC
Permalink
Post by Izumi Tsutsui
Post by Garrett D'Amore
Thanks. You want to update src/doc/CHANGES as well? Or I can.
Also done, but I'm behind you for feature table ;-)
---
Izumi Tsutsui
Maybe you can regenerate the table though? They updated the XML, it
needs perl now to rebuild.
--
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
Izumi Tsutsui
2006-09-13 15:38:20 UTC
Permalink
Post by Garrett D'Amore
Maybe you can regenerate the table though? They updated the XML, it
needs perl now to rebuild.
For features index, I guess "make index.html" will just work
because it hasn't been xml'ized yet (but I could be wrong).
---
Izumi Tsutsui

Loading...