Date: Sun, 22 Dec 2002 11:37:14 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 22628 for review Message-ID: <200212221937.gBMJbEP9016780@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22628 Change 22628 by marcel@marcel_nfs on 2002/12/22 11:36:15 Convert to new sioprobe/sioattach interface. The rclk handling specific to puc(4) is now nothing special anymore... Affected files ... .. //depot/projects/ia64/sys/dev/sio/sio_puc.c#6 edit Differences ... ==== //depot/projects/ia64/sys/dev/sio/sio_puc.c#6 (text+ko) ==== @@ -38,6 +38,8 @@ #include <sys/tty.h> #include <machine/bus.h> #include <sys/timepps.h> +#include <machine/resource.h> +#include <sys/rman.h> #include <dev/pci/pcivar.h> #include <dev/puc/pucvar.h> @@ -58,34 +60,55 @@ static driver_t sio_puc_driver = { sio_driver_name, sio_puc_methods, - 0, + sizeof(struct com_s), }; static int sio_puc_attach(dev) device_t dev; { + struct com_s *com; + struct resource *res; + int error, rid; uintptr_t rclk; - if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ, - &rclk) != 0) - rclk = DEFAULT_RCLK; - return (sioattach(dev, 0, rclk)); + com = device_get_softc(dev); + rid = 0; + res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8, + RF_ACTIVE); + if (res == NULL) + return (ENXIO); + error = sioattach(dev); + if (error) + bus_release_resource(dev, SYS_RES_IOPORT, rid, res); + return (error); } static int sio_puc_probe(dev) device_t dev; { + struct com_s *com; + struct resource *res; + int error, rid; uintptr_t rclk; - if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ, - &rclk) != 0) - rclk = DEFAULT_RCLK; + com = device_get_softc(dev); + rid = 0; + res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 8, + RF_ACTIVE); + if (res == NULL) + return (ENXIO); + com->bsh = rman_get_bushandle(res); + com->bst = rman_get_bustag(res); + if (!BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ, &rclk)) + com->rclk = rclk; #ifdef PC98 SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); #endif - return (sioprobe(dev, 0, rclk, 1)); + error = sioprobe(dev); + bus_release_resource(dev, SYS_RES_IOPORT, rid, res); + return (error); } DRIVER_MODULE(sio, puc, sio_puc_driver, sio_devclass, 0, 0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212221937.gBMJbEP9016780>
