Subject: port-sparc/34597: BLINK option again -- implementation details this time
To: None <port-sparc-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Andreas Wiese <bzimage@gmx.net>
List: netbsd-bugs
Date: 09/24/2006 20:40:00
>Number:         34597
>Category:       port-sparc
>Synopsis:       implementing another BLINK behaviour via sysctl -- how to do?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sparc-maintainer
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 24 20:40:00 +0000 2006
>Originator:     Andreas Wiese
>Release:        NetBSD 4.99.2
>Organization:
	BSD-Crew Dresden
>Environment:
System: NetBSD lucy.lan.instandbesetzt.net 4.99.2 NetBSD 4.99.2 (LUCY) #0: =
Thu Sep 21 23:12:25 CEST 2006 root@schroeder.lan.instandbesetzt.net:/home/a=
w/NetBSD/objdir/sys/arch/sparc/compile/LUCY sparc
Architecture: sparc
Machine: sparc
>Description:

Hi folks,

I'm trying to implement the behaviour of the BLINK option I requested in
port-sparc/34585.

I planned to do something like this in sys/arch/sparc/sparc/auxreg.c
(and something equivalent in sys/arch/sparc/dev/ebus.c):

#v+
static void
blink(void *zero)
{
	register int s;

	s =3D splhigh();
	LED_FLIP;
	splx(s);

	/* nothing new yet */
	/* that's new: */
	if(led_blink =3D=3D -1)
		s =3D (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1));
	else
		s =3D ((FSCALE/2) * hz) /
			between(1, (FSCALE/2) * hz, (averunnable.ldavg[0] >> led_blink));
	/* that's all that changed */
	callout_reset(&blink_ch, s, blink, NULL);
}
#v-

led_blink shouuld be an int with the following meaning:
    led_blink =3D=3D -1 -> old behaviour
    led_blink =3D=3D 0  -> duration of one cycle =3D=3D 1/loadavg (so loada=
vg =3D=3D
		    1.0  means blink one time per second)
    led_blink > 0   -> slow down the ascent of blink rate somewhat

I'd like to make this adjustable via sysctl but that's my problem:  I
don't know=20
  - where to take the sysctl node (best would be machdep, IMHO, but
    there's only CPU stuff and therefor the whole subtree is defined in
    'cpu.c', where this realy doesn't belong to.
  - where to define led_blink (it must be accessible from
    sys/arch/sparc/sparc/auxreg.c and sys/arch/sparc/dev/ebus.c

Could someone please help me or perhaps write the sysctl interface?  I'm
not very familiar with kernel hacking and I don't want to mess up with the
tidiness in kernel source.  Would be senseless if I hack this together and
someone else has to touch it for cleaning up...

>How-To-Repeat:
n/a
>Fix:
n/a

HAND & LG -- aw
np: bush (Golden State) -- 02. Golden State
--=20

--xHFwDpU9dbj6ez1V
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iQIVAwUBRRbssCCslUm6YF9JAQIgVBAAhx7LpbexldK83lB2I19uVQEIZOwvae72
SZt+sGCNnGwbuDkcvaBmw3vBFnSRODDrXMCBKmuDGjYLrlUqn46SUAKa1jqcalQH
m7Yi5ri2XzVMcMx4B1uOgh5FLGr4yxaR7YmVD0zGaQ0ZhBM3DwU8GEYWM9T5Urue
7W4yptLbMRsE97o/uKDELNQ2rKsvFgakKezyfVfHY+UpBjRsBRadFdKxqpU2+Ga5
/ZySXbcbXkEd96hFT6/pdbCrVF4Xd7juSuVzlkQZYHWfNhsYn9xSt4nmdM6foiHR
Wsa5AkiLl8i5ohxoiTaAFEKYB0vcGC5ELjYJYS+7UjoZ1i405BuWvvs0hzheT34H
l7m51mx9JAQe97EjYu8CXIjT+jJHLLAeJ6O8ODWgt1WQqkyXrhRtQbd35H4rHvI2
iYUUhCLyZkbrSp3rpkMNmmSfuQ9naGGDcI1ztx1bM+CLv6GAxQNv85IuXrRyn9tx
JwLpwxVifphmJGab2YKutulSjLkXbwXwZt9TkyV42YBXbF3hlNJRHYsJqypuAEGt
yoS0F92VrK+HBAS5gvBnI6RBbKIFQ6JFwb6fxiCJq0kTywXvvV4JadUqLykmTInh
7lZaSzhYGY0m9gbxo/QEjHfr58C8eQ9kMo6xe7GMSPY/Nb5HhAH/aWVK9G+MlH+r
LAuq0qG1EPU=
=RQGV
-----END PGP SIGNATURE-----

--xHFwDpU9dbj6ez1V--

>Unformatted:
 --xHFwDpU9dbj6ez1V
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable