diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2006-07-26 19:39:55 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2006-07-26 19:39:55 +0000 |
commit | 3c1cfa96bd14e6dc4967a14a9f3af8926c49edaf (patch) | |
tree | 7e34bbad1e3cefeb3680f03b927754d1b3097036 /sys/powerpc | |
parent | 167f7b7e033c9f16d226958e45852b9673f17fb6 (diff) | |
download | src-3c1cfa96bd14e6dc4967a14a9f3af8926c49edaf.tar.gz src-3c1cfa96bd14e6dc4967a14a9f3af8926c49edaf.zip |
Turn this into an uart(4) bus attachment.
Notes
Notes:
svn path=/head/; revision=160722
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/psim/uart_iobus.c | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/sys/powerpc/psim/uart_iobus.c b/sys/powerpc/psim/uart_iobus.c index 1d6c6017cf1c..1768338b9952 100644 --- a/sys/powerpc/psim/uart_iobus.c +++ b/sys/powerpc/psim/uart_iobus.c @@ -47,62 +47,41 @@ #include <dev/ofw/openfirm.h> #include <powerpc/psim/iobusvar.h> -#include <dev/sio/sioreg.h> -#include <dev/sio/siovar.h> +#include <dev/uart/uart.h> +#include <dev/uart/uart_bus.h> -#include <isa/isavar.h> /* for isa_irq_pending() prototype */ +static int uart_iobus_probe(device_t dev); -static int sio_iobus_attach(device_t dev); -static int sio_iobus_probe(device_t dev); - -static device_method_t sio_iobus_methods[] = { +static device_method_t uart_iobus_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, sio_iobus_probe), - DEVMETHOD(device_attach, sio_iobus_attach), + DEVMETHOD(device_probe, uart_iobus_probe), + DEVMETHOD(device_attach, uart_bus_attach), + DEVMETHOD(device_detach, uart_bus_detach), { 0, 0 } }; -static driver_t sio_iobus_driver = { - sio_driver_name, - sio_iobus_methods, - 0, +static driver_t uart_iobus_driver = { + uart_driver_name, + uart_iobus_methods, + sizeof(struct uart_softc), }; static int -sio_iobus_attach(device_t dev) -{ - return (sioattach(dev, 0, DEFAULT_RCLK)); -} - -static int -sio_iobus_probe(device_t dev) +uart_iobus_probe(device_t dev) { - char *type = iobus_get_name(dev); + struct uart_softc *sc; + char *type; + type = iobus_get_name(dev); if (strncmp(type, "com", 3) != 0) return (ENXIO); + sc = device_get_softc(dev); + sc->sc_class = &uart_ns8250_class; device_set_desc(dev, "PSIM serial port"); - - /* - * Call sioprobe with noprobe=1, to avoid hitting a psim bug - */ - return (sioprobe(dev, 0, 0, 1)); + return (uart_bus_probe(dev, 0, 0, 0, 0)); } -DRIVER_MODULE(sio, iobus, sio_iobus_driver, sio_devclass, 0, 0); - -/* - * Stub function. Perhaps a way to get this to work correctly would - * be for child devices to set a field in the dev structure to - * inform the parent that they are isa devices, and then use a - * intr_pending() call which would propagate up to nexus to see - * if the interrupt controller had any intrs in the isa group set - */ -intrmask_t -isa_irq_pending(void) -{ - return (0); -} +DRIVER_MODULE(uart, iobus, uart_iobus_driver, uart_devclass, 0, 0); |