1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

Add variable `idelayed' and macros setdelayed() and schedsofttty()

to access it.  setdelayed() actually ORs the bits in `idelayed' into
`ipending' and clears `idelayed'.

Call setdelayed() every (normal) clock tick to convert delayed
interrupts into pending ones.

Drivers can set bits in `idelayed' at any time to schedule an interrupt
at the next clock tick.  This is more efficient than calling timeout().
Currently only software interrupts can be scheduled.
This commit is contained in:
Bruce Evans 1995-05-11 07:44:40 +00:00
parent c77a009363
commit d81fba0cda
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8448
6 changed files with 40 additions and 6 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $
* $Id: clock.c,v 1.32 1995/03/16 18:11:58 bde Exp $
*/
/*
@ -92,6 +92,7 @@
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
u_int idelayed;
#ifdef I586_CPU
int pentium_mhz;
#endif
@ -124,6 +125,7 @@ void
clkintr(struct clockframe frame)
{
hardclock(&frame);
setdelayed();
}
#else
void
@ -132,15 +134,18 @@ clkintr(struct clockframe frame)
timer_func(&frame);
switch (timer0_state) {
case 0:
setdelayed();
break;
case 1:
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_prescaler_count -= hardclock_max_count;
}
break;
case 2:
setdelayed();
timer0_max_count = TIMER_DIV(new_rate);
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;
@ -157,6 +162,7 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $
* $Id: clock.c,v 1.32 1995/03/16 18:11:58 bde Exp $
*/
/*
@ -92,6 +92,7 @@
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
u_int idelayed;
#ifdef I586_CPU
int pentium_mhz;
#endif
@ -124,6 +125,7 @@ void
clkintr(struct clockframe frame)
{
hardclock(&frame);
setdelayed();
}
#else
void
@ -132,15 +134,18 @@ clkintr(struct clockframe frame)
timer_func(&frame);
switch (timer0_state) {
case 0:
setdelayed();
break;
case 1:
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_prescaler_count -= hardclock_max_count;
}
break;
case 2:
setdelayed();
timer0_max_count = TIMER_DIV(new_rate);
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;
@ -157,6 +162,7 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $
* $Id: clock.c,v 1.32 1995/03/16 18:11:58 bde Exp $
*/
/*
@ -92,6 +92,7 @@
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
u_int idelayed;
#ifdef I586_CPU
int pentium_mhz;
#endif
@ -124,6 +125,7 @@ void
clkintr(struct clockframe frame)
{
hardclock(&frame);
setdelayed();
}
#else
void
@ -132,15 +134,18 @@ clkintr(struct clockframe frame)
timer_func(&frame);
switch (timer0_state) {
case 0:
setdelayed();
break;
case 1:
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_prescaler_count -= hardclock_max_count;
}
break;
case 2:
setdelayed();
timer0_max_count = TIMER_DIV(new_rate);
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;
@ -157,6 +162,7 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: spl.h,v 1.6 1994/12/30 12:42:15 bde Exp $
* $Id: spl.h,v 1.7 1995/05/11 00:13:01 wollman Exp $
*/
#ifndef _MACHINE_IPL_H_
@ -74,6 +74,7 @@
extern unsigned bio_imask; /* group of interrupts masked with splbio() */
extern unsigned cpl; /* current priority level mask */
extern volatile unsigned idelayed; /* interrupts to become pending */
extern volatile unsigned ipending; /* active interrupts masked by cpl */
extern unsigned net_imask; /* group of interrupts masked with splimp() */
extern unsigned stat_imask; /* interrupts masked with splstatclock() */
@ -85,11 +86,14 @@ extern unsigned tty_imask; /* group of interrupts masked with spltty() */
* it is changed. Pretending that ipending is a plain int happens to give
* suitable atomic code for "ipending |= constant;".
*/
#define setdelayed() (*(unsigned *)&ipending |= loadandclear(&idelayed))
#define setsoftast() (*(unsigned *)&ipending |= SWI_AST_PENDING)
#define setsoftclock() (*(unsigned *)&ipending |= SWI_CLOCK_PENDING)
#define setsoftnet() (*(unsigned *)&ipending |= SWI_NET_PENDING)
#define setsofttty() (*(unsigned *)&ipending |= SWI_TTY_PENDING)
#define schedsofttty() (*(unsigned *)&idelayed |= SWI_TTY_PENDING)
void unpend_V __P((void));
#ifdef __GNUC__

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $
* $Id: clock.c,v 1.32 1995/03/16 18:11:58 bde Exp $
*/
/*
@ -92,6 +92,7 @@
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
u_int idelayed;
#ifdef I586_CPU
int pentium_mhz;
#endif
@ -124,6 +125,7 @@ void
clkintr(struct clockframe frame)
{
hardclock(&frame);
setdelayed();
}
#else
void
@ -132,15 +134,18 @@ clkintr(struct clockframe frame)
timer_func(&frame);
switch (timer0_state) {
case 0:
setdelayed();
break;
case 1:
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_prescaler_count -= hardclock_max_count;
}
break;
case 2:
setdelayed();
timer0_max_count = TIMER_DIV(new_rate);
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;
@ -157,6 +162,7 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $
* $Id: clock.c,v 1.32 1995/03/16 18:11:58 bde Exp $
*/
/*
@ -92,6 +92,7 @@
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
u_int idelayed;
#ifdef I586_CPU
int pentium_mhz;
#endif
@ -124,6 +125,7 @@ void
clkintr(struct clockframe frame)
{
hardclock(&frame);
setdelayed();
}
#else
void
@ -132,15 +134,18 @@ clkintr(struct clockframe frame)
timer_func(&frame);
switch (timer0_state) {
case 0:
setdelayed();
break;
case 1:
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_prescaler_count -= hardclock_max_count;
}
break;
case 2:
setdelayed();
timer0_max_count = TIMER_DIV(new_rate);
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;
@ -157,6 +162,7 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
timer0_overflow_threshold =
timer0_max_count - TIMER0_LATCH_COUNT;