Date: Tue, 15 Dec 2009 22:53:01 GMT From: Rafal Jaworowski <raj@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 171823 for review Message-ID: <200912152253.nBFMr1oX074313@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=171823 Change 171823 by raj@raj_fdt on 2009/12/15 22:52:31 Convert sec(4) driver to FDT/simplebus convention. Affected files ... .. //depot/projects/fdt/sys/dev/sec/sec.c#2 edit Differences ... ==== //depot/projects/fdt/sys/dev/sec/sec.c#2 (text+ko) ==== @@ -45,12 +45,12 @@ #include <sys/rman.h> #include <machine/bus.h> -#include <machine/ocpbus.h> #include <machine/resource.h> #include <opencrypto/cryptodev.h> #include "cryptodev_if.h" +#include <dev/ofw/ofw_bus_subr.h> #include <dev/sec/sec.h> static int sec_probe(device_t dev); @@ -153,7 +153,7 @@ }; static devclass_t sec_devclass; -DRIVER_MODULE(sec, ocpbus, sec_driver, sec_devclass, 0, 0); +DRIVER_MODULE(sec, simplebus, sec_driver, sec_devclass, 0, 0); MODULE_DEPEND(sec, crypto, 1, 1, 1); static struct sec_eu_methods sec_eus[] = { @@ -201,24 +201,16 @@ sec_probe(device_t dev) { struct sec_softc *sc; - device_t parent; - uintptr_t devtype; uint64_t id; - int error; - parent = device_get_parent(dev); - error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype); - if (error) - return (error); - - if (devtype != OCPBUS_DEVTYPE_SEC) + if (!ofw_bus_is_compatible(dev, "fsl,sec2.0")) return (ENXIO); sc = device_get_softc(dev); sc->sc_rrid = 0; - sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid, - 0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, + RF_ACTIVE); if (sc->sc_rres == NULL) return (ENXIO); @@ -276,8 +268,8 @@ /* Allocate I/O memory for SEC registers */ sc->sc_rrid = 0; - sc->sc_rres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->sc_rrid, - 0ul, ~0ul, SEC_IO_SIZE, RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, + RF_ACTIVE); if (sc->sc_rres == NULL) { device_printf(dev, "could not allocate I/O memory!\n"); @@ -295,12 +287,15 @@ if (error) goto fail2; - sc->sc_sec_irid = 1; - error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand, - &sc->sc_sec_irid, sec_secondary_intr, "secondary"); + + if (sc->sc_version == 3) { + sc->sc_sec_irid = 1; + error = sec_setup_intr(sc, &sc->sc_sec_ires, &sc->sc_sec_ihand, + &sc->sc_sec_irid, sec_secondary_intr, "secondary"); - if (error) - goto fail3; + if (error) + goto fail3; + } /* Alloc DMA memory for descriptors and link tables */ error = sec_alloc_dma_mem(sc, &(sc->sc_desc_dmem),
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912152253.nBFMr1oX074313>