summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-07-26 19:39:55 +0000
committermarcel <marcel@FreeBSD.org>2006-07-26 19:39:55 +0000
commitc5c9826f14b57d5b97abae613f99a0f03c80ca2e (patch)
tree7e34bbad1e3cefeb3680f03b927754d1b3097036 /sys/powerpc
parent6fc546f8cd4e885b5509e9b43acaa9b0c7abce82 (diff)
downloadFreeBSD-src-c5c9826f14b57d5b97abae613f99a0f03c80ca2e.zip
FreeBSD-src-c5c9826f14b57d5b97abae613f99a0f03c80ca2e.tar.gz
Turn this into an uart(4) bus attachment.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/psim/uart_iobus.c59
1 files changed, 19 insertions, 40 deletions
diff --git a/sys/powerpc/psim/uart_iobus.c b/sys/powerpc/psim/uart_iobus.c
index 1d6c601..1768338 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);
OpenPOWER on IntegriCloud