diff options
author | peter <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-04-16 21:22:55 +0000 |
commit | 087d4857e56f150a8f549600150404f273efb895 (patch) | |
tree | cf4e27432c59d956f4e5784207180115ee8fef9d /sys/dev/sio/sio.c | |
parent | c5fe612b8411a32a8e6e426fc1a70cba0cca3d31 (diff) | |
download | FreeBSD-src-087d4857e56f150a8f549600150404f273efb895.zip FreeBSD-src-087d4857e56f150a8f549600150404f273efb895.tar.gz |
Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.
(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)
This is a checkpoint of work-in-progress, but is quite functional.
The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.
Approved by: core
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r-- | sys/dev/sio/sio.c | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index ee031b4..1a40360 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.220 1999/01/19 00:21:47 peter Exp $ + * $Id: sio.c,v 1.221 1999/01/30 12:17:35 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.215 */ @@ -68,6 +68,7 @@ #include <sys/syslog.h> #include <sys/sysctl.h> #include <sys/bus.h> +#include <machine/bus.h> #include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> @@ -103,8 +104,10 @@ #endif +#ifndef __i386__ #define disable_intr() 0 #define enable_intr() 0 +#endif #ifdef SMP #define disable_intr() COM_DISABLE_INTR() @@ -2607,6 +2610,21 @@ static void siocnclose __P((struct siocnstate *sp, Port_t iobase)); static void siocnopen __P((struct siocnstate *sp, Port_t iobase, int speed)); static void siocntxwait __P((Port_t iobase)); +#ifdef __i386__ +/* + * 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); + +#endif + static void siocntxwait(iobase) Port_t iobase; @@ -2731,11 +2749,9 @@ void siocnprobe(cp) struct consdev *cp; { -#if 0 speed_t boot_speed; u_char cfcr; - struct isa_device *dvp; - int s; + int s, unit; struct siocnstate sp; /* @@ -2753,10 +2769,16 @@ siocnprobe(cp) * don't need to probe. */ cp->cn_pri = CN_DEAD; - for (dvp = isa_devtab_tty; dvp->id_driver != NULL; dvp++) - if (dvp->id_driver == &siodriver && dvp->id_enabled - && COM_CONSOLE(dvp)) { - siocniobase = dvp->id_iobase; + + for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */ + int flags; + if (resource_int_value("sio", unit, "flags", &flags)) + continue; + if (COM_CONSOLE(flags)) { + int port; + if (resource_int_value("sio", unit, "port", &port)) + continue; + siocniobase = port; s = spltty(); if (boothowto & RB_SERIAL) { boot_speed = siocngetspeed(siocniobase, @@ -2784,17 +2806,19 @@ siocnprobe(cp) siocnopen(&sp, siocniobase, comdefaultrate); splx(s); - if (!COM_LLCONSOLE(dvp)) { - cp->cn_dev = makedev(CDEV_MAJOR, dvp->id_unit); - cp->cn_pri = COM_FORCECONSOLE(dvp) + if (!COM_LLCONSOLE(flags)) { + cp->cn_dev = makedev(CDEV_MAJOR, unit); + cp->cn_pri = COM_FORCECONSOLE(flags) || boothowto & RB_SERIAL ? CN_REMOTE : CN_NORMAL; } break; } -#endif + } } +#ifdef __alpha__ + struct consdev siocons = { NULL, NULL, siocngetc, siocncheckc, siocnputc, NULL, makedev(CDEV_MAJOR, 0), CN_NORMAL, @@ -2877,6 +2901,8 @@ siogdbattach(port, speed) return 0; } +#endif + void siocninit(cp) struct consdev *cp; @@ -3158,7 +3184,6 @@ static void siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) { struct pnp_cinfo d; - struct isa_device *dvp; if (dev->id_unit >= NSIOTOT) return; @@ -3180,9 +3205,7 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) if (dev->id_driver == NULL) { dev->id_driver = &siodriver; - dvp = find_isadev(isa_devtab_tty, &siodriver, 0); - if (dvp != NULL) - dev->id_id = dvp->id_id; + dev->id_id = isa_compat_nextid(); } if ((dev->id_alive = sioprobe(dev)) != 0) |