summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-04-28 21:21:53 +0000
committermarcel <marcel@FreeBSD.org>2006-04-28 21:21:53 +0000
commit193a6144b9612bafde9b4382a221e917496b8601 (patch)
tree5e43b7350101e478e59289d09768df4e1a830e0d /sys/dev/uart
parentca65c8d400f4a855b84394629b8695274cf7bfb4 (diff)
downloadFreeBSD-src-193a6144b9612bafde9b4382a221e917496b8601.zip
FreeBSD-src-193a6144b9612bafde9b4382a221e917496b8601.tar.gz
Rewrite of puc(4). Significant changes are:
o Properly use rman(9) to manage resources. This eliminates the need to puc-specific hacks to rman. It also allows devinfo(8) to be used to find out the specific assignment of resources to serial/parallel ports. o Compress the PCI device "database" by optimizing for the common case and to use a procedural interface to handle the exceptions. The procedural interface also generalizes the need to setup the hardware (program chipsets, program clock frequencies). o Eliminate the need for PUC_FASTINTR. Serdev devices are fast by default and non-serdev devices are handled by the bus. o Use the serdev I/F to collect interrupt status and to handle interrupts across ports in priority order. o Sync the PCI device configuration to include devices found in NetBSD and not yet merged to FreeBSD. o Add support for Quatech 2, 4 and 8 port UARTs. o Add support for a couple dozen Timedia serial cards as found in Linux.
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_bus_puc.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/sys/dev/uart/uart_bus_puc.c b/sys/dev/uart/uart_bus_puc.c
index 7277df9..dff35b3 100644
--- a/sys/dev/uart/uart_bus_puc.c
+++ b/sys/dev/uart/uart_bus_puc.c
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2006 Marcel Moolenaar. All rights reserved.
* Copyright (c) 2002 JF Hay. All rights reserved.
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
*
@@ -32,12 +33,12 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/module.h>
+
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
-#include <dev/pci/pcivar.h>
-#include <dev/puc/pucvar.h>
+#include <dev/puc/puc_bus.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_bus.h>
@@ -49,6 +50,9 @@ static device_method_t uart_puc_methods[] = {
DEVMETHOD(device_probe, uart_puc_probe),
DEVMETHOD(device_attach, uart_bus_attach),
DEVMETHOD(device_detach, uart_bus_detach),
+ /* Serdev interface */
+ DEVMETHOD(serdev_ihand, uart_bus_ihand),
+ DEVMETHOD(serdev_ipend, uart_bus_ipend),
{ 0, 0 }
};
@@ -63,37 +67,21 @@ uart_puc_probe(device_t dev)
{
device_t parent;
struct uart_softc *sc;
- uintptr_t port, rclk, regshft, type;
+ uintptr_t rclk, type;
parent = device_get_parent(dev);
sc = device_get_softc(dev);
- if (BUS_READ_IVAR(parent, dev, PUC_IVAR_SUBTYPE, &type))
+ if (BUS_READ_IVAR(parent, dev, PUC_IVAR_TYPE, &type))
return (ENXIO);
- switch (type) {
- case PUC_PORT_UART_NS8250:
- sc->sc_class = &uart_ns8250_class;
- port = 0;
- break;
- case PUC_PORT_UART_SAB82532:
- sc->sc_class = &uart_sab82532_class;
- if (BUS_READ_IVAR(parent, dev, PUC_IVAR_PORT, &port))
- port = 0;
- break;
- case PUC_PORT_UART_Z8530:
- sc->sc_class = &uart_z8530_class;
- if (BUS_READ_IVAR(parent, dev, PUC_IVAR_PORT, &port))
- port = 0;
- break;
- default:
+ if (type != PUC_TYPE_SERIAL)
return (ENXIO);
- }
- if (BUS_READ_IVAR(parent, dev, PUC_IVAR_FREQ, &rclk))
+ sc->sc_class = &uart_ns8250_class;
+
+ if (BUS_READ_IVAR(parent, dev, PUC_IVAR_CLOCK, &rclk))
rclk = 0;
- if (BUS_READ_IVAR(parent, dev, PUC_IVAR_REGSHFT, &regshft))
- regshft = 0;
- return (uart_bus_probe(dev, regshft, rclk, 0, port));
+ return (uart_bus_probe(dev, 0, rclk, 0, 0));
}
DRIVER_MODULE(uart, puc, uart_puc_driver, uart_devclass, 0, 0);
OpenPOWER on IntegriCloud