svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

Zbigniew Bodek zbb at semihalf.com
Wed May 18 15:15:32 UTC 2016


2016-05-18 17:05 GMT+02:00 Andrew Turner <andrew at freebsd.org>:

> Author: andrew
> Date: Wed May 18 15:05:44 2016
> New Revision: 300149
> URL: https://svnweb.freebsd.org/changeset/base/300149
>
> Log:
>   Return the struct intr_pic pointer from intr_pic_register. This will be
>   needed in later changes where we may not be able to lock the pic list
> lock
>   to perform a lookup, e.g. from within interrupt context.
>
>   Obtained from:        ABT Systems Ltd
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm/allwinner/a10/a10_intc.c
>   head/sys/arm/allwinner/aw_nmi.c
>   head/sys/arm/arm/gic.c
>   head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
>   head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
>   head/sys/arm/broadcom/bcm2835/bcm2836.c
>   head/sys/arm/mv/mpic.c
>   head/sys/arm/nvidia/tegra_gpio.c
>   head/sys/arm/nvidia/tegra_lic.c
>   head/sys/arm/ti/aintc.c
>   head/sys/arm/ti/omap4/omap4_wugen.c
>   head/sys/arm/ti/ti_gpio.c
>   head/sys/arm64/arm64/gic_v3_fdt.c
>   head/sys/kern/subr_intr.c
>   head/sys/mips/mediatek/mtk_gpio_v1.c
>   head/sys/mips/mediatek/mtk_gpio_v2.c
>   head/sys/mips/mediatek/mtk_intr_gic.c
>   head/sys/mips/mediatek/mtk_intr_v1.c
>   head/sys/mips/mediatek/mtk_intr_v2.c
>   head/sys/mips/mediatek/mtk_pcie.c
>   head/sys/mips/mips/mips_pic.c
>   head/sys/sys/intr.h
>
> Modified: head/sys/arm/allwinner/a10/a10_intc.c
>
> ==============================================================================
> --- head/sys/arm/allwinner/a10/a10_intc.c       Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/arm/allwinner/a10/a10_intc.c       Wed May 18 15:05:44 2016
>       (r300149)
> @@ -250,6 +250,7 @@ a10_intr(void *arg)
>  static int
>  a10_intr_pic_attach(struct a10_aintc_softc *sc)
>  {
> +       struct intr_pic *pic;
>         int error;
>         uint32_t irq;
>         const char *name;
> @@ -266,9 +267,9 @@ a10_intr_pic_attach(struct a10_aintc_sof
>         }
>
>         xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev));
> -       error = intr_pic_register(sc->sc_dev, xref);
> -       if (error != 0)
> -               return (error);
> +       pic = intr_pic_register(sc->sc_dev, xref);
> +       if (pic == NULL)
> +               return (ENXIO);
>
>         return (intr_pic_claim_root(sc->sc_dev, xref, a10_intr, sc, 0));
>  }
>
> Modified: head/sys/arm/allwinner/aw_nmi.c
>
> ==============================================================================
> --- head/sys/arm/allwinner/aw_nmi.c     Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm/allwinner/aw_nmi.c     Wed May 18 15:05:44 2016
> (r300149)
> @@ -362,7 +362,7 @@ aw_nmi_attach(device_t dev)
>               device_get_nameunit(sc->dev), sc->intr.irq) != 0)
>                 goto error;
>
> -       if (intr_pic_register(dev, (intptr_t)xref) != 0) {
> +       if (intr_pic_register(dev, (intptr_t)xref) == NULL) {
>                 device_printf(dev, "could not register pic\n");
>                 goto error;
>         }
>
> Modified: head/sys/arm/arm/gic.c
>
> ==============================================================================
> --- head/sys/arm/arm/gic.c      Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/arm/arm/gic.c      Wed May 18 15:05:44 2016        (r300149)
> @@ -711,7 +711,7 @@ arm_gic_attach(device_t dev)
>          * Now, when everything is initialized, it's right time to
>          * register interrupt controller to interrupt framefork.
>          */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup;
>         }
>
> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
>
> ==============================================================================
> --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c        Wed May 18
> 14:43:17 2016        (r300148)
> +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c        Wed May 18
> 15:05:44 2016        (r300149)
> @@ -1045,8 +1045,11 @@ bcm_gpio_pic_attach(struct bcm_gpio_soft
>                 if (error != 0)
>                         return (error); /* XXX deregister ISRCs */
>         }
> -       return (intr_pic_register(sc->sc_dev,
> -           OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))));
> +       if (intr_pic_register(sc->sc_dev,
> +           OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL)
> +               return (ENXIO);
> +
> +       return (0);
>  }
>
>  static int
>
> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
>
> ==============================================================================
> --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c        Wed May 18
> 14:43:17 2016        (r300148)
> +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c        Wed May 18
> 15:05:44 2016        (r300149)
> @@ -341,7 +341,10 @@ bcm_intc_pic_register(struct bcm_intc_so
>                 if (error != 0)
>                         return (error);
>         }
> -       return (intr_pic_register(sc->sc_dev, xref));
> +       if (intr_pic_register(sc->sc_dev, xref) == NULL)
> +               return (ENXIO);
> +
> +       return (0);
>  }
>  #endif
>
>
> Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c
>
> ==============================================================================
> --- head/sys/arm/broadcom/bcm2835/bcm2836.c     Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/arm/broadcom/bcm2835/bcm2836.c     Wed May 18 15:05:44 2016
>       (r300149)
> @@ -598,6 +598,7 @@ static int
>  bcm_lintc_pic_attach(struct bcm_lintc_softc *sc)
>  {
>         struct bcm_lintc_irqsrc *bisrcs;
> +       struct intr_pic *pic;
>         int error;
>         u_int flags;
>         uint32_t irq;
> @@ -653,9 +654,9 @@ bcm_lintc_pic_attach(struct bcm_lintc_so
>         }
>
>         xref = OF_xref_from_node(ofw_bus_get_node(sc->bls_dev));
> -       error = intr_pic_register(sc->bls_dev, xref);
> -       if (error != 0)
> -               return (error);
> +       pic = intr_pic_register(sc->bls_dev, xref);
> +       if (pic == NULL)
> +               return (ENXIO);
>
>         return (intr_pic_claim_root(sc->bls_dev, xref, bcm_lintc_intr, sc,
> 0));
>  }
>
> Modified: head/sys/arm/mv/mpic.c
>
> ==============================================================================
> --- head/sys/arm/mv/mpic.c      Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/arm/mv/mpic.c      Wed May 18 15:05:44 2016        (r300149)
> @@ -274,7 +274,7 @@ mv_mpic_attach(device_t dev)
>                 bus_release_resources(dev, mv_mpic_spec, sc->mpic_res);
>                 return (ENXIO);
>         }
> -       if (intr_pic_register(dev, OF_xref_from_device(dev)) != 0) {
> +       if (intr_pic_register(dev, OF_xref_from_device(dev)) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 bus_release_resources(dev, mv_mpic_spec, sc->mpic_res);
>                 return (ENXIO);
>
> Modified: head/sys/arm/nvidia/tegra_gpio.c
>
> ==============================================================================
> --- head/sys/arm/nvidia/tegra_gpio.c    Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm/nvidia/tegra_gpio.c    Wed May 18 15:05:44 2016
> (r300149)
> @@ -452,8 +452,11 @@ tegra_gpio_pic_attach(struct tegra_gpio_
>                 if (error != 0)
>                         return (error); /* XXX deregister ISRCs */
>         }
> -       return (intr_pic_register(sc->dev,
> -           OF_xref_from_node(ofw_bus_get_node(sc->dev))));
> +       if (intr_pic_register(sc->dev,
> +           OF_xref_from_node(ofw_bus_get_node(sc->dev))) == NULL)
> +               return (ENXIO);
> +
> +       return (0);
>  }
>
>  static int
>
> Modified: head/sys/arm/nvidia/tegra_lic.c
>
> ==============================================================================
> --- head/sys/arm/nvidia/tegra_lic.c     Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm/nvidia/tegra_lic.c     Wed May 18 15:05:44 2016
> (r300149)
> @@ -233,7 +233,7 @@ tegra_lic_attach(device_t dev)
>         }
>
>
> -       if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) {
> +       if (intr_pic_register(dev, OF_xref_from_node(node)) == NULL) {
>                 device_printf(dev, "Cannot register PIC\n");
>                 goto fail;
>         }
>
> Modified: head/sys/arm/ti/aintc.c
>
> ==============================================================================
> --- head/sys/arm/ti/aintc.c     Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/arm/ti/aintc.c     Wed May 18 15:05:44 2016        (r300149)
> @@ -220,6 +220,7 @@ ti_aintc_post_filter(device_t dev, struc
>  static int
>  ti_aintc_pic_attach(struct ti_aintc_softc *sc)
>  {
> +       struct intr_pic *pic;
>         int error;
>         uint32_t irq;
>         const char *name;
> @@ -236,9 +237,9 @@ ti_aintc_pic_attach(struct ti_aintc_soft
>         }
>
>         xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev));
> -       error = intr_pic_register(sc->sc_dev, xref);
> -       if (error != 0)
> -               return (error);
> +       pic = intr_pic_register(sc->sc_dev, xref);
> +       if (pic == NULL)
> +               return (ENXIO);
>
>         return (intr_pic_claim_root(sc->sc_dev, xref, ti_aintc_intr, sc,
> 0));
>  }
>
> Modified: head/sys/arm/ti/omap4/omap4_wugen.c
>
> ==============================================================================
> --- head/sys/arm/ti/omap4/omap4_wugen.c Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm/ti/omap4/omap4_wugen.c Wed May 18 15:05:44 2016
> (r300149)
> @@ -210,7 +210,7 @@ omap4_wugen_attach(device_t dev)
>                 return (ENXIO);
>         }
>
> -       if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) {
> +       if (intr_pic_register(dev, OF_xref_from_node(node)) == NULL) {
>                 device_printf(dev, "can't register PIC\n");
>                 goto fail;
>         }
>
> Modified: head/sys/arm/ti/ti_gpio.c
>
> ==============================================================================
> --- head/sys/arm/ti/ti_gpio.c   Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/arm/ti/ti_gpio.c   Wed May 18 15:05:44 2016        (r300149)
> @@ -904,8 +904,11 @@ ti_gpio_pic_attach(struct ti_gpio_softc
>                 if (error != 0)
>                         return (error); /* XXX deregister ISRCs */
>         }
> -       return (intr_pic_register(sc->sc_dev,
> -           OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))));
> +       if (intr_pic_register(sc->sc_dev,
> +           OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL)
> +               return (ENXIO);
> +
> +       return (0);
>  }
>
>  static int
>
> Modified: head/sys/arm64/arm64/gic_v3_fdt.c
>
> ==============================================================================
> --- head/sys/arm64/arm64/gic_v3_fdt.c   Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm64/arm64/gic_v3_fdt.c   Wed May 18 15:05:44 2016
> (r300149)
> @@ -139,7 +139,7 @@ gic_v3_fdt_attach(device_t dev)
>
>  #ifdef INTRNG
>         xref = OF_xref_from_node(ofw_bus_get_node(dev));
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto error;
>         }
> @@ -172,7 +172,7 @@ error:
>         /* Failure so free resources */
>         gic_v3_detach(dev);
>
> -       return (err);
> +       return (ENXIO);
>


Few line above we have:
err = gic_v3_attach(dev);
if (err != 0)
goto error;

So now we would not return error code from gic_v3_attach() but always
ENXIO...


>  }
>
>  /* OFW bus interface */
>
> Modified: head/sys/kern/subr_intr.c
>
> ==============================================================================
> --- head/sys/kern/subr_intr.c   Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/kern/subr_intr.c   Wed May 18 15:05:44 2016        (r300149)
> @@ -911,22 +911,22 @@ pic_destroy(device_t dev, intptr_t xref)
>  /*
>   *  Register interrupt controller.
>   */
> -int
> +struct intr_pic *
>  intr_pic_register(device_t dev, intptr_t xref)
>  {
>         struct intr_pic *pic;
>
>         if (dev == NULL)
> -               return (EINVAL);
> +               return (NULL);
>         pic = pic_create(dev, xref);
>         if (pic == NULL)
> -               return (ENOMEM);
> +               return (NULL);
>
>         pic->pic_flags |= FLAG_PIC;
>
>         debugf("PIC %p registered for %s <dev %p, xref %x>\n", pic,
>             device_get_nameunit(dev), dev, xref);
> -       return (0);
> +       return (pic);
>  }
>
>  /*
>
> Modified: head/sys/mips/mediatek/mtk_gpio_v1.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_gpio_v1.c        Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/mips/mediatek/mtk_gpio_v1.c        Wed May 18 15:05:44 2016
>       (r300149)
> @@ -308,7 +308,7 @@ mtk_gpio_attach(device_t dev)
>                 goto fail;
>         }
>
> -       if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) {
> +       if (intr_pic_register(dev, OF_xref_from_node(node)) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto fail;
>         }
>
> Modified: head/sys/mips/mediatek/mtk_gpio_v2.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_gpio_v2.c        Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/mips/mediatek/mtk_gpio_v2.c        Wed May 18 15:05:44 2016
>       (r300149)
> @@ -299,7 +299,7 @@ mtk_gpio_attach(device_t dev)
>                 goto fail;
>         }
>
> -       if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) {
> +       if (intr_pic_register(dev, OF_xref_from_node(node)) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto fail;
>         }
>
> Modified: head/sys/mips/mediatek/mtk_intr_gic.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_intr_gic.c       Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/mips/mediatek/mtk_intr_gic.c       Wed May 18 15:05:44 2016
>       (r300149)
> @@ -213,7 +213,7 @@ mtk_gic_attach(device_t dev)
>          * Now, when everything is initialized, it's right time to
>          * register interrupt controller to interrupt framefork.
>          */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup;
>         }
>
> Modified: head/sys/mips/mediatek/mtk_intr_v1.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_intr_v1.c        Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/mips/mediatek/mtk_intr_v1.c        Wed May 18 15:05:44 2016
>       (r300149)
> @@ -201,7 +201,7 @@ mtk_pic_attach(device_t dev)
>          * Now, when everything is initialized, it's right time to
>          * register interrupt controller to interrupt framefork.
>          */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup;
>         }
>
> Modified: head/sys/mips/mediatek/mtk_intr_v2.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_intr_v2.c        Wed May 18 14:43:17 2016
>       (r300148)
> +++ head/sys/mips/mediatek/mtk_intr_v2.c        Wed May 18 15:05:44 2016
>       (r300149)
> @@ -196,7 +196,7 @@ mtk_pic_attach(device_t dev)
>          * Now, when everything is initialized, it's right time to
>          * register interrupt controller to interrupt framefork.
>          */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup;
>         }
>
> Modified: head/sys/mips/mediatek/mtk_pcie.c
>
> ==============================================================================
> --- head/sys/mips/mediatek/mtk_pcie.c   Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/mips/mediatek/mtk_pcie.c   Wed May 18 15:05:44 2016
> (r300149)
> @@ -319,7 +319,7 @@ mtk_pci_attach(device_t dev)
>         }
>
>         /* Register ourselves as an interrupt controller */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup_rman;
>         }
>
> Modified: head/sys/mips/mips/mips_pic.c
>
> ==============================================================================
> --- head/sys/mips/mips/mips_pic.c       Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/mips/mips/mips_pic.c       Wed May 18 15:05:44 2016
> (r300149)
> @@ -223,7 +223,7 @@ mips_pic_attach(device_t dev)
>          * Now, when everything is initialized, it's right time to
>          * register interrupt controller to interrupt framefork.
>          */
> -       if (intr_pic_register(dev, xref) != 0) {
> +       if (intr_pic_register(dev, xref) == NULL) {
>                 device_printf(dev, "could not register PIC\n");
>                 goto cleanup;
>         }
>
> Modified: head/sys/sys/intr.h
>
> ==============================================================================
> --- head/sys/sys/intr.h Wed May 18 14:43:17 2016        (r300148)
> +++ head/sys/sys/intr.h Wed May 18 15:05:44 2016        (r300149)
> @@ -110,7 +110,7 @@ bool intr_isrc_init_on_cpu(struct intr_i
>  int intr_isrc_dispatch(struct intr_irqsrc *, struct trapframe *);
>  u_int intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask);
>
> -int intr_pic_register(device_t, intptr_t);
> +struct intr_pic *intr_pic_register(device_t, intptr_t);
>  int intr_pic_deregister(device_t, intptr_t);
>  int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *,
> u_int);
>
> _______________________________________________
> svn-src-all at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"
>


More information about the svn-src-all mailing list