The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/arm64/arm64/gic_v3_var.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2015 The FreeBSD Foundation
    3  * All rights reserved.
    4  *
    5  * This software was developed by Semihalf under
    6  * the sponsorship of the FreeBSD Foundation.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * $FreeBSD: releng/11.2/sys/arm64/arm64/gic_v3_var.h 305529 2016-09-07 12:10:30Z andrew $
   30  */
   31 
   32 #ifndef _GIC_V3_VAR_H_
   33 #define _GIC_V3_VAR_H_
   34 
   35 #define GIC_V3_DEVSTR   "ARM Generic Interrupt Controller v3.0"
   36 
   37 DECLARE_CLASS(gic_v3_driver);
   38 
   39 struct gic_v3_irqsrc;
   40 
   41 struct redist_lpis {
   42         vm_offset_t             conf_base;
   43         vm_offset_t             pend_base[MAXCPU];
   44         uint64_t                flags;
   45 };
   46 
   47 struct gic_redists {
   48         /*
   49          * Re-Distributor region description.
   50          * We will have few of those depending
   51          * on the #redistributor-regions property in FDT.
   52          */
   53         struct resource **      regions;
   54         /* Number of Re-Distributor regions */
   55         u_int                   nregions;
   56         /* Per-CPU Re-Distributor handler */
   57         struct resource *       pcpu[MAXCPU];
   58         /* LPIs data */
   59         struct redist_lpis      lpis;
   60 };
   61 
   62 struct gic_v3_softc {
   63         device_t                dev;
   64         struct resource **      gic_res;
   65         struct mtx              gic_mtx;
   66         /* Distributor */
   67         struct resource *       gic_dist;
   68         /* Re-Distributors */
   69         struct gic_redists      gic_redists;
   70 
   71         u_int                   gic_nirqs;
   72         u_int                   gic_idbits;
   73 
   74         boolean_t               gic_registered;
   75 
   76         int                     gic_nchildren;
   77         device_t                *gic_children;
   78         struct intr_pic         *gic_pic;
   79         struct gic_v3_irqsrc    *gic_irqs;
   80 };
   81 
   82 #define GIC_INTR_ISRC(sc, irq)  (&sc->gic_irqs[irq].gi_isrc)
   83 
   84 MALLOC_DECLARE(M_GIC_V3);
   85 
   86 /* ivars */
   87 enum {
   88         GICV3_IVAR_NIRQS,
   89         GICV3_IVAR_REDIST_VADDR,
   90 };
   91 
   92 __BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int);
   93 __BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *);
   94 
   95 /* Device methods */
   96 int gic_v3_attach(device_t dev);
   97 int gic_v3_detach(device_t dev);
   98 int arm_gic_v3_intr(void *);
   99 
  100 uint32_t gic_r_read_4(device_t, bus_size_t);
  101 uint64_t gic_r_read_8(device_t, bus_size_t);
  102 void gic_r_write_4(device_t, bus_size_t, uint32_t var);
  103 void gic_r_write_8(device_t, bus_size_t, uint64_t var);
  104 
  105 /*
  106  * GIC Distributor accessors.
  107  * Notice that only GIC sofc can be passed.
  108  */
  109 #define gic_d_read(sc, len, reg)                \
  110 ({                                              \
  111         bus_read_##len(sc->gic_dist, reg);      \
  112 })
  113 
  114 #define gic_d_write(sc, len, reg, val)          \
  115 ({                                              \
  116         bus_write_##len(sc->gic_dist, reg, val);\
  117 })
  118 
  119 /* GIC Re-Distributor accessors (per-CPU) */
  120 #define gic_r_read(sc, len, reg)                \
  121 ({                                              \
  122         u_int cpu = PCPU_GET(cpuid);            \
  123                                                 \
  124         bus_read_##len(                         \
  125             sc->gic_redists.pcpu[cpu],          \
  126             reg);                               \
  127 })
  128 
  129 #define gic_r_write(sc, len, reg, val)          \
  130 ({                                              \
  131         u_int cpu = PCPU_GET(cpuid);            \
  132                                                 \
  133         bus_write_##len(                        \
  134             sc->gic_redists.pcpu[cpu],          \
  135             reg, val);                          \
  136 })
  137 
  138 #endif /* _GIC_V3_VAR_H_ */

Cache object: 23ae2f9acac0b60a5ed3ff45e9d22a65


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.