On Sat, 23 Sep 2000 [EMAIL PROTECTED] wrote:
> Bruce Evans <[EMAIL PROTECTED]> wrote:
> >It needs locking changes to be exportable:
> >
> >1) splhigh()/splx(), at least in RELENG_4 where there is no giant lock
> > and spl*() has a non-null effect, so that callers don't need to know
> > that it must be called at splsoftclock() or higher.
> >2) Honor the current locking protocol acquire_timer2()/release_timer2()
> > -- don't do anything if (!beeping).
>
> Hum, is below code which was from PAO3 good for FreeBSD tree?
>
> # But I think it has still has 1) problem....... Do you have any
> # idea about this melody patch...
Yes, it has (1) (sysbeep_cancel() must be called at splsoftlock() or maybe
at splclock(), while sysbeep() can be called at any ipl). sysbeep_cancel()
is a little cleaner -- sysbeepstop() is the timeout routine and calling it
directly is a hack.
sysbeep_ch could probably be avoided by letting the timeout expire and
doing nothing if !beeping.
Bruce
> --- sys/i386/isa/clock.c.org Mon Jan 3 10:46:36 2000
> +++ sys/i386/isa/clock.c Mon Jan 3 10:47:52 2000
> @@ -188,6 +188,9 @@
> SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
> &tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
>
> +static struct callout_handle sysbeep_ch
> + = CALLOUT_HANDLE_INITIALIZER(&sysbeep_ch);
> +
> static struct timecounter i8254_timecounter = {
> i8254_get_timecount, /* get_timecount */
> 0, /* no poll_pps */
> @@ -536,10 +539,21 @@
> /* enable counter2 output to speaker */
> outb(IO_PPI, inb(IO_PPI) | 3);
> beeping = period;
> - timeout(sysbeepstop, (void *)NULL, period);
> + sysbeep_ch = timeout(sysbeepstop, (void *)NULL, period);
> }
> splx(x);
> return (0);
> +}
> +
> +int
> +sysbeep_cancel(void)
> +{
> + if (beeping) {
> + untimeout(sysbeepstop, (void *)NULL, sysbeep_ch);
> + sysbeepstop((void *)NULL);
> + return 0;
> + }
> + return -1;
> }
>
> /*
> --- sys/i386/include/clock.h.org Mon Jan 3 10:58:30 2000
> +++ sys/i386/include/clock.h Mon Jan 3 10:59:13 2000
> @@ -44,6 +44,7 @@
> int release_timer1 __P((void));
> #endif
> int sysbeep __P((int pitch, int period));
> +int sysbeep_cancel __P((void));
> void i8254_restore __P((void));
>
> #endif /* _KERNEL */
>
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message