summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio
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/sio
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/sio')
-rw-r--r--sys/dev/sio/sio_puc.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/dev/sio/sio_puc.c b/sys/dev/sio/sio_puc.c
index dd80e68..0ae0e7d 100644
--- a/sys/dev/sio/sio_puc.c
+++ b/sys/dev/sio/sio_puc.c
@@ -39,8 +39,8 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <sys/timepps.h>
-#include <dev/pci/pcivar.h>
-#include <dev/puc/pucvar.h>
+#include <dev/puc/puc_bus.h>
+
#include <dev/sio/siovar.h>
#include <dev/sio/sioreg.h>
@@ -63,30 +63,37 @@ static driver_t sio_puc_driver = {
};
static int
-sio_puc_attach(dev)
- device_t dev;
+sio_puc_attach(device_t dev)
{
uintptr_t rclk;
- if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
+ if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_CLOCK,
&rclk) != 0)
rclk = DEFAULT_RCLK;
return (sioattach(dev, 0, rclk));
}
static int
-sio_puc_probe(dev)
- device_t dev;
+sio_puc_probe(device_t dev)
{
- uintptr_t rclk;
+ device_t parent;
+ uintptr_t rclk, type;
+ int error;
- if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
- &rclk) != 0)
+ parent = device_get_parent(dev);
+
+ if (BUS_READ_IVAR(parent, dev, PUC_IVAR_TYPE, &type))
+ return (ENXIO);
+ if (type != PUC_TYPE_SERIAL)
+ return (ENXIO);
+
+ if (BUS_READ_IVAR(parent, dev, PUC_IVAR_CLOCK, &rclk))
rclk = DEFAULT_RCLK;
#ifdef PC98
SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550));
#endif
- return (sioprobe(dev, 0, rclk, 1));
+ error = sioprobe(dev, 0, rclk, 1);
+ return ((error > 0) ? error : BUS_PROBE_LOW_PRIORITY);
}
DRIVER_MODULE(sio, puc, sio_puc_driver, sio_devclass, 0, 0);
OpenPOWER on IntegriCloud