diff options
-rw-r--r-- | sys/amd64/amd64/amd64-gdbstub.c | 3 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 20 | ||||
-rw-r--r-- | sys/i386/i386/cons.c | 25 | ||||
-rw-r--r-- | sys/i386/i386/cons.h | 33 | ||||
-rw-r--r-- | sys/i386/i386/i386-gdbstub.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 18 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 20 | ||||
-rw-r--r-- | sys/i386/isa/syscons.c | 20 | ||||
-rw-r--r-- | sys/kern/tty_cons.c | 25 | ||||
-rw-r--r-- | sys/sys/cons.h | 33 |
10 files changed, 93 insertions, 107 deletions
diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index 0c5f82b..25e2838 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -153,6 +153,9 @@ strcpy (char *dst, const char *src) /* XXX sio always uses its major with minor 0 no matter what we specify. */ #define REMOTE_DEV 0 +cn_getc_t siocngetc; +cn_putc_t siocnputc; + static int putDebugChar (int c) /* write a single character */ { diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index f26d3b3..fbc0b16 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.287 1998/11/08 12:39:02 dfr Exp $ + * $Id: syscons.c,v 1.288 1998/12/07 21:58:23 archie Exp $ */ #include "sc.h" @@ -301,6 +301,14 @@ static void scsplash_saver(int show); #define scsplash_stick(stick) #endif +static cn_probe_t sccnprobe; +static cn_init_t sccninit; +static cn_getc_t sccngetc; +static cn_checkc_t sccncheckc; +static cn_putc_t sccnputc; + +CONS_DRIVER(sc, sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc); + struct isa_driver scdriver = { scprobe, scattach, "sc", 1 }; @@ -1876,7 +1884,7 @@ scmousestart(struct tty *tp) splx(s); } -void +static void sccnprobe(struct consdev *cp) { struct isa_device *dvp; @@ -1902,13 +1910,13 @@ sccnprobe(struct consdev *cp) sc_kbdc = kbdc_open(sc_port); } -void +static void sccninit(struct consdev *cp) { scinit(); } -void +static void sccnputc(dev_t dev, int c) { u_char buf[1]; @@ -1931,7 +1939,7 @@ sccnputc(dev_t dev, int c) splx(s); } -int +static int sccngetc(dev_t dev) { int s = spltty(); /* block scintr and scrn_timer while we poll */ @@ -1950,7 +1958,7 @@ sccngetc(dev_t dev) return(c); } -int +static int sccncheckc(dev_t dev) { int s = spltty(); /* block scintr and scrn_timer while we poll */ diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index 6d31e94..581ff3f 100644 --- a/sys/i386/i386/cons.c +++ b/sys/i386/i386/cons.c @@ -57,23 +57,6 @@ #include <machine/cpu.h> #include <machine/cons.h> -/* XXX this should be config(8)ed. */ -#include "sc.h" -#include "vt.h" -#include "sio.h" -static struct consdev constab[] = { -#if NSC > 0 - { sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc }, -#endif -#if NVT > 0 - { pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc }, -#endif -#if NSIO > 0 - { siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc }, -#endif - { 0 }, -}; - static d_open_t cnopen; static d_close_t cnclose; static d_read_t cnread; @@ -112,16 +95,22 @@ static struct tty *cn_tp; /* physical console tty struct */ static void *cn_devfs_token; /* represents the devfs entry */ #endif /* DEVFS */ +CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL); + void cninit() { struct consdev *best_cp, *cp; + struct consdev **list; /* * Find the first console with the highest priority. */ best_cp = NULL; - for (cp = constab; cp->cn_probe; cp++) { + list = (struct consdev **)cons_set.ls_items; + while ((cp = *list++) != NULL) { + if (cp->cn_probe == NULL) + continue; (*cp->cn_probe)(cp); if (cp->cn_pri > CN_DEAD && (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h index 76bc073..5d6c426 100644 --- a/sys/i386/i386/cons.h +++ b/sys/i386/i386/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.16 1997/04/01 16:13:31 bde Exp $ + * $Id: cons.h,v 1.17 1997/07/01 00:54:37 bde Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -49,30 +49,6 @@ typedef int cn_getc_t __P((dev_t)); typedef int cn_checkc_t __P((dev_t)); typedef void cn_putc_t __P((dev_t, int)); -#ifdef KERNEL -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ -cn_probe_t pccnprobe; -cn_init_t pccninit; -cn_getc_t pccngetc; -cn_checkc_t pccncheckc; -cn_putc_t pccnputc; - -cn_probe_t sccnprobe; -cn_init_t sccninit; -cn_getc_t sccngetc; -cn_checkc_t sccncheckc; -cn_putc_t sccnputc; - -cn_probe_t siocnprobe; -cn_init_t siocninit; -cn_getc_t siocngetc; -cn_checkc_t siocncheckc; -cn_putc_t siocnputc; -#endif /* KERNEL */ - struct consdev { cn_probe_t *cn_probe; /* probe hardware and fill in consdev info */ @@ -96,8 +72,15 @@ struct consdev { #define CN_REMOTE 3 /* serial interface with remote bit set */ #ifdef KERNEL +extern struct linker_set cons_set; extern int cons_unavail; +#define CONS_DRIVER(name, probe, init, getc, checkc, putc) \ + static struct consdev name##_consdev = { \ + probe, init, getc, checkc, putc \ + }; \ + DATA_SET(cons_set, name##_consdev); + /* Other kernel entry points. */ int cncheckc __P((void)); int cngetc __P((void)); diff --git a/sys/i386/i386/i386-gdbstub.c b/sys/i386/i386/i386-gdbstub.c index 0c5f82b..25e2838 100644 --- a/sys/i386/i386/i386-gdbstub.c +++ b/sys/i386/i386/i386-gdbstub.c @@ -153,6 +153,9 @@ strcpy (char *dst, const char *src) /* XXX sio always uses its major with minor 0 no matter what we specify. */ #define REMOTE_DEV 0 +cn_getc_t siocngetc; +cn_putc_t siocnputc; + static int putDebugChar (int c) /* write a single character */ { diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 99217c0..26c02f3 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -114,6 +114,14 @@ static void vgapelinit(void); /* read initial VGA DAC palette */ static int pcvt_xmode_set(int on, struct proc *p); /* initialize for X mode */ #endif /* XSERVER && !PCVT_USL_VT_COMPAT */ +static cn_probe_t pccnprobe; +static cn_init_t pccninit; +static cn_getc_t pccngetc; +static cn_checkc_t pccncheckc; +static cn_putc_t pccnputc; + +CONS_DRIVER(pc, pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc); + static d_open_t pcopen; static d_close_t pcclose; static d_read_t pcread; @@ -1116,7 +1124,7 @@ consinit() /* init for kernel messages during boot */ #endif /* PCVT_NETBSD */ #if PCVT_FREEBSD > 205 -void +static void #else int #endif @@ -1171,7 +1179,7 @@ pccnprobe(struct consdev *cp) } #if PCVT_FREEBSD > 205 -void +static void #else int #endif @@ -1184,7 +1192,7 @@ pccninit(struct consdev *cp) } #if PCVT_FREEBSD > 205 -void +static void #else int #endif @@ -1218,7 +1226,7 @@ pccnputc(Dev_t dev, U_char c) #endif } -int +static int pccngetc(Dev_t dev) { register int s; @@ -1267,7 +1275,7 @@ pccngetc(Dev_t dev) } #if PCVT_FREEBSD >= 200 -int +static int pccncheckc(Dev_t dev) { char *cp; diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 0b08a86..ae24d4c 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.219 1998/12/07 21:58:22 archie Exp $ + * $Id: sio.c,v 1.220 1998/12/27 12:35:48 phk Exp $ */ #include "opt_comconsole.h" @@ -2485,6 +2485,18 @@ static void siocnclose __P((struct siocnstate *sp)); static void siocnopen __P((struct siocnstate *sp)); static void siocntxwait __P((void)); +/* + * XXX: sciocnget() and sciocnputc() are not declared static, as they are + * referred to from i386/i386/i386-gdbstub.c. + */ +static cn_probe_t siocnprobe; +static cn_init_t siocninit; +static cn_checkc_t siocncheckc; + cn_getc_t siocngetc; + cn_putc_t siocnputc; + +CONS_DRIVER(sio, siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc); + static void siocntxwait() { @@ -2606,7 +2618,7 @@ siocnclose(sp) outb(iobase + com_ier, sp->ier); } -void +static void siocnprobe(cp) struct consdev *cp; { @@ -2672,14 +2684,14 @@ siocnprobe(cp) } } -void +static void siocninit(cp) struct consdev *cp; { comconsole = DEV_TO_UNIT(cp->cn_dev); } -int +static int siocncheckc(dev) dev_t dev; { diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index f26d3b3..fbc0b16 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.287 1998/11/08 12:39:02 dfr Exp $ + * $Id: syscons.c,v 1.288 1998/12/07 21:58:23 archie Exp $ */ #include "sc.h" @@ -301,6 +301,14 @@ static void scsplash_saver(int show); #define scsplash_stick(stick) #endif +static cn_probe_t sccnprobe; +static cn_init_t sccninit; +static cn_getc_t sccngetc; +static cn_checkc_t sccncheckc; +static cn_putc_t sccnputc; + +CONS_DRIVER(sc, sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc); + struct isa_driver scdriver = { scprobe, scattach, "sc", 1 }; @@ -1876,7 +1884,7 @@ scmousestart(struct tty *tp) splx(s); } -void +static void sccnprobe(struct consdev *cp) { struct isa_device *dvp; @@ -1902,13 +1910,13 @@ sccnprobe(struct consdev *cp) sc_kbdc = kbdc_open(sc_port); } -void +static void sccninit(struct consdev *cp) { scinit(); } -void +static void sccnputc(dev_t dev, int c) { u_char buf[1]; @@ -1931,7 +1939,7 @@ sccnputc(dev_t dev, int c) splx(s); } -int +static int sccngetc(dev_t dev) { int s = spltty(); /* block scintr and scrn_timer while we poll */ @@ -1950,7 +1958,7 @@ sccngetc(dev_t dev) return(c); } -int +static int sccncheckc(dev_t dev) { int s = spltty(); /* block scintr and scrn_timer while we poll */ diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 6d31e94..581ff3f 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -57,23 +57,6 @@ #include <machine/cpu.h> #include <machine/cons.h> -/* XXX this should be config(8)ed. */ -#include "sc.h" -#include "vt.h" -#include "sio.h" -static struct consdev constab[] = { -#if NSC > 0 - { sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc }, -#endif -#if NVT > 0 - { pccnprobe, pccninit, pccngetc, pccncheckc, pccnputc }, -#endif -#if NSIO > 0 - { siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc }, -#endif - { 0 }, -}; - static d_open_t cnopen; static d_close_t cnclose; static d_read_t cnread; @@ -112,16 +95,22 @@ static struct tty *cn_tp; /* physical console tty struct */ static void *cn_devfs_token; /* represents the devfs entry */ #endif /* DEVFS */ +CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL); + void cninit() { struct consdev *best_cp, *cp; + struct consdev **list; /* * Find the first console with the highest priority. */ best_cp = NULL; - for (cp = constab; cp->cn_probe; cp++) { + list = (struct consdev **)cons_set.ls_items; + while ((cp = *list++) != NULL) { + if (cp->cn_probe == NULL) + continue; (*cp->cn_probe)(cp); if (cp->cn_pri > CN_DEAD && (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) diff --git a/sys/sys/cons.h b/sys/sys/cons.h index 76bc073..5d6c426 100644 --- a/sys/sys/cons.h +++ b/sys/sys/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.16 1997/04/01 16:13:31 bde Exp $ + * $Id: cons.h,v 1.17 1997/07/01 00:54:37 bde Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -49,30 +49,6 @@ typedef int cn_getc_t __P((dev_t)); typedef int cn_checkc_t __P((dev_t)); typedef void cn_putc_t __P((dev_t, int)); -#ifdef KERNEL -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ -cn_probe_t pccnprobe; -cn_init_t pccninit; -cn_getc_t pccngetc; -cn_checkc_t pccncheckc; -cn_putc_t pccnputc; - -cn_probe_t sccnprobe; -cn_init_t sccninit; -cn_getc_t sccngetc; -cn_checkc_t sccncheckc; -cn_putc_t sccnputc; - -cn_probe_t siocnprobe; -cn_init_t siocninit; -cn_getc_t siocngetc; -cn_checkc_t siocncheckc; -cn_putc_t siocnputc; -#endif /* KERNEL */ - struct consdev { cn_probe_t *cn_probe; /* probe hardware and fill in consdev info */ @@ -96,8 +72,15 @@ struct consdev { #define CN_REMOTE 3 /* serial interface with remote bit set */ #ifdef KERNEL +extern struct linker_set cons_set; extern int cons_unavail; +#define CONS_DRIVER(name, probe, init, getc, checkc, putc) \ + static struct consdev name##_consdev = { \ + probe, init, getc, checkc, putc \ + }; \ + DATA_SET(cons_set, name##_consdev); + /* Other kernel entry points. */ int cncheckc __P((void)); int cngetc __P((void)); |