diff options
author | jhb <jhb@FreeBSD.org> | 2000-10-25 05:19:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-10-25 05:19:40 +0000 |
commit | ff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f (patch) | |
tree | d0f426694e386a2b666529e1e1ad06938c3d7e83 /sys/dev/cy | |
parent | 08451a100d3bc5d4373e28f7acd976df25f3f785 (diff) | |
download | FreeBSD-src-ff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f.zip FreeBSD-src-ff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f.tar.gz |
- Overhaul the software interrupt code to use interrupt threads for each
type of software interrupt. Roughly, what used to be a bit in spending
now maps to a swi thread. Each thread can have multiple handlers, just
like a hardware interrupt thread.
- Instead of using a bitmask of pending interrupts, we schedule the specific
software interrupt thread to run, so spending, NSWI, and the shandlers
array are no longer needed. We can now have an arbitrary number of
software interrupt threads. When you register a software interrupt
thread via sinthand_add(), you get back a struct intrhand that you pass
to sched_swi() when you wish to schedule your swi thread to run.
- Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit
more intuitive. Also, prefix all the members of struct intrhand with
'ih_'.
- Make swi_net() a MI function since there is now no point in it being
MD.
Submitted by: cp
Diffstat (limited to 'sys/dev/cy')
-rw-r--r-- | sys/dev/cy/cy.c | 31 | ||||
-rw-r--r-- | sys/dev/cy/cy_isa.c | 31 |
2 files changed, 32 insertions, 30 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 8b49cfa..3cd2b6f 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -133,7 +133,7 @@ #define siosetwater cysetwater #define comstop cystop #define siowrite cywrite -#define sio_registered cy_registered +#define sio_irec cy_irec #define sio_timeout cy_timeout #define sio_timeout_handle cy_timeout_handle #define sio_timeouts_until_log cy_timeouts_until_log @@ -391,7 +391,7 @@ static struct cdevsw sio_cdevsw = { static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ -static bool_t sio_registered; +static struct intrhand *sio_ih; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -607,10 +607,10 @@ cyattach_common(cy_iobase, cy_align) com_addr(unit) = com; splx(s); - if (!sio_registered) { + if (sio_ih == NULL) cdevsw_add(&sio_cdevsw); - register_swi(SWI_TTY, siopoll); - sio_registered = TRUE; + sio_ih = sinthand_add("tty:sio", &tty_ithd, siopoll, NULL, + SWI_TTY, 0); } make_dev(&sio_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, "ttyc%r%r", adapter, @@ -1174,7 +1174,8 @@ siointr(unit) #ifndef SOFT_HOTCHAR if (line_status & CD1400_RDSR_SPECIAL && com->hotchar != 0) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); + #endif #if 1 /* XXX "intelligent" PFO error handling would break O error handling */ if (line_status & (LSR_PE|LSR_FE|LSR_BI)) { @@ -1201,7 +1202,7 @@ siointr(unit) ++com->bytes_in; #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr = com->iptr; if (ioptr >= com->ibufend) @@ -1251,7 +1252,7 @@ siointr(unit) if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr[0] = recv_data; ioptr[com->ierroff] = 0; @@ -1266,7 +1267,7 @@ siointr(unit) #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif } while (--count != 0); } else { @@ -1291,7 +1292,7 @@ siointr(unit) #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr[0] = recv_data; ioptr[com->ierroff] = 0; @@ -1356,7 +1357,7 @@ cont: if (!(com->state & CS_CHECKMSR)) { com_events += LOTS_OF_EVENTS; com->state |= CS_CHECKMSR; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } #ifdef SOFT_CTS_OFLOW @@ -1487,7 +1488,7 @@ cont: if (!(com->state & CS_ODONE)) { com_events += LOTS_OF_EVENTS; com->state |= CS_ODONE; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } break; case ETC_BREAK_ENDED: @@ -1501,7 +1502,7 @@ cont: if (!(com->extra_state & CSE_ODONE)) { com_events += LOTS_OF_EVENTS; com->extra_state |= CSE_ODONE; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } cd_outb(iobase, CD1400_SRER, cy_align, com->intr_enable @@ -1559,7 +1560,7 @@ cont: com->state |= CS_ODONE; /* handle at high level ASAP */ - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } } } @@ -1579,7 +1580,7 @@ terminate_tx_service: /* ensure an edge for the next interrupt */ cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); - schedsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); COM_UNLOCK(); } diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 8b49cfa..3cd2b6f 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -133,7 +133,7 @@ #define siosetwater cysetwater #define comstop cystop #define siowrite cywrite -#define sio_registered cy_registered +#define sio_irec cy_irec #define sio_timeout cy_timeout #define sio_timeout_handle cy_timeout_handle #define sio_timeouts_until_log cy_timeouts_until_log @@ -391,7 +391,7 @@ static struct cdevsw sio_cdevsw = { static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ -static bool_t sio_registered; +static struct intrhand *sio_ih; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -607,10 +607,10 @@ cyattach_common(cy_iobase, cy_align) com_addr(unit) = com; splx(s); - if (!sio_registered) { + if (sio_ih == NULL) cdevsw_add(&sio_cdevsw); - register_swi(SWI_TTY, siopoll); - sio_registered = TRUE; + sio_ih = sinthand_add("tty:sio", &tty_ithd, siopoll, NULL, + SWI_TTY, 0); } make_dev(&sio_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, "ttyc%r%r", adapter, @@ -1174,7 +1174,8 @@ siointr(unit) #ifndef SOFT_HOTCHAR if (line_status & CD1400_RDSR_SPECIAL && com->hotchar != 0) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); + #endif #if 1 /* XXX "intelligent" PFO error handling would break O error handling */ if (line_status & (LSR_PE|LSR_FE|LSR_BI)) { @@ -1201,7 +1202,7 @@ siointr(unit) ++com->bytes_in; #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr = com->iptr; if (ioptr >= com->ibufend) @@ -1251,7 +1252,7 @@ siointr(unit) if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr[0] = recv_data; ioptr[com->ierroff] = 0; @@ -1266,7 +1267,7 @@ siointr(unit) #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif } while (--count != 0); } else { @@ -1291,7 +1292,7 @@ siointr(unit) #ifdef SOFT_HOTCHAR if (com->hotchar != 0 && recv_data == com->hotchar) - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); #endif ioptr[0] = recv_data; ioptr[com->ierroff] = 0; @@ -1356,7 +1357,7 @@ cont: if (!(com->state & CS_CHECKMSR)) { com_events += LOTS_OF_EVENTS; com->state |= CS_CHECKMSR; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } #ifdef SOFT_CTS_OFLOW @@ -1487,7 +1488,7 @@ cont: if (!(com->state & CS_ODONE)) { com_events += LOTS_OF_EVENTS; com->state |= CS_ODONE; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } break; case ETC_BREAK_ENDED: @@ -1501,7 +1502,7 @@ cont: if (!(com->extra_state & CSE_ODONE)) { com_events += LOTS_OF_EVENTS; com->extra_state |= CSE_ODONE; - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } cd_outb(iobase, CD1400_SRER, cy_align, com->intr_enable @@ -1559,7 +1560,7 @@ cont: com->state |= CS_ODONE; /* handle at high level ASAP */ - setsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); } } } @@ -1579,7 +1580,7 @@ terminate_tx_service: /* ensure an edge for the next interrupt */ cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); - schedsofttty(); + sched_swi(sio_ih, SWI_NOSWITCH); COM_UNLOCK(); } |