From 193a6144b9612bafde9b4382a221e917496b8601 Mon Sep 17 00:00:00 2001 From: marcel Date: Fri, 28 Apr 2006 21:21:53 +0000 Subject: 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. --- sys/dev/sio/sio_puc.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'sys/dev/sio') 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 #include -#include -#include +#include + #include #include @@ -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); -- cgit v1.1