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/xen/xen_intr.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  * xen_intr.h
    3  * 
    4  * APIs for managing Xen event channel, virtual IRQ, and physical IRQ
    5  * notifications.
    6  * 
    7  * Copyright (c) 2004, K A Fraser
    8  * Copyright (c) 2012, Spectra Logic Corporation
    9  *
   10  * This file may be distributed separately from the Linux kernel, or
   11  * incorporated into other software packages, subject to the following license:
   12  *
   13  * Permission is hereby granted, free of charge, to any person obtaining a copy
   14  * of this source file (the "Software"), to deal in the Software without
   15  * restriction, including without limitation the rights to use, copy, modify,
   16  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
   17  * and to permit persons to whom the Software is furnished to do so, subject to
   18  * the following conditions:
   19  * 
   20  * The above copyright notice and this permission notice shall be included in
   21  * all copies or substantial portions of the Software.
   22  * 
   23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   29  * IN THE SOFTWARE.
   30  *
   31  * $FreeBSD$
   32  */
   33 #ifndef _XEN_INTR_H_
   34 #define _XEN_INTR_H_
   35 
   36 #include <contrib/xen/event_channel.h>
   37 
   38 /** Registered Xen interrupt callback handle. */
   39 typedef void * xen_intr_handle_t;
   40 
   41 void xen_intr_handle_upcall(struct trapframe *trap_frame);
   42 
   43 /**
   44  * Associate an already allocated local event channel port an interrupt
   45  * handler.
   46  *
   47  * \param dev         The device making this bind request.
   48  * \param local_port  The event channel to bind.
   49  * \param filter      An interrupt filter handler.  Specify NULL
   50  *                    to always dispatch to the ithread handler.
   51  * \param handler     An interrupt ithread handler.  Optional (can
   52  *                    specify NULL) if all necessary event actions
   53  *                    are performed by filter.
   54  * \param arg         Argument to present to both filter and handler.
   55  * \param irqflags    Interrupt handler flags.  See sys/bus.h.
   56  * \param handlep     Pointer to an opaque handle used to manage this
   57  *                    registration.
   58  *
   59  * \returns  0 on success, otherwise an errno.
   60  */
   61 int xen_intr_bind_local_port(device_t dev, evtchn_port_t local_port,
   62         driver_filter_t filter, driver_intr_t handler, void *arg,
   63         enum intr_type irqflags, xen_intr_handle_t *handlep);
   64 
   65 /**
   66  * Allocate a local event channel port, accessible by the specified
   67  * remote/foreign domain and, if successful, associate the port with
   68  * the specified interrupt handler.
   69  *
   70  * \param dev            The device making this bind request.
   71  * \param remote_domain  Remote domain grant permission to signal the
   72  *                       newly allocated local port.
   73  * \param filter         An interrupt filter handler.  Specify NULL
   74  *                       to always dispatch to the ithread handler.
   75  * \param handler        An interrupt ithread handler.  Optional (can
   76  *                       specify NULL) if all necessary event actions
   77  *                       are performed by filter.
   78  * \param arg            Argument to present to both filter and handler.
   79  * \param irqflags       Interrupt handler flags.  See sys/bus.h.
   80  * \param handlep        Pointer to an opaque handle used to manage this
   81  *                       registration.
   82  *
   83  * \returns  0 on success, otherwise an errno.
   84  */
   85 int xen_intr_alloc_and_bind_local_port(device_t dev,
   86         u_int remote_domain, driver_filter_t filter, driver_intr_t handler,
   87         void *arg, enum intr_type irqflags, xen_intr_handle_t *handlep);
   88 
   89 /**
   90  * Associate the specified interrupt handler with the remote event
   91  * channel port specified by remote_domain and remote_port.
   92  *
   93  * \param dev            The device making this bind request.
   94  * \param remote_domain  The domain peer for this event channel connection.
   95  * \param remote_port    Remote domain's local port number for this event
   96  *                       channel port.
   97  * \param filter         An interrupt filter handler.  Specify NULL
   98  *                       to always dispatch to the ithread handler.
   99  * \param handler        An interrupt ithread handler.  Optional (can
  100  *                       specify NULL) if all necessary event actions
  101  *                       are performed by filter.
  102  * \param arg            Argument to present to both filter and handler.
  103  * \param irqflags       Interrupt handler flags.  See sys/bus.h.
  104  * \param handlep        Pointer to an opaque handle used to manage this
  105  *                       registration.
  106  *
  107  * \returns  0 on success, otherwise an errno.
  108  */
  109 int xen_intr_bind_remote_port(device_t dev, u_int remote_domain,
  110         evtchn_port_t remote_port, driver_filter_t filter,
  111         driver_intr_t handler, void *arg, enum intr_type irqflags,
  112         xen_intr_handle_t *handlep);
  113 
  114 /**
  115  * Associate the specified interrupt handler with the specified Xen
  116  * virtual interrupt source.
  117  *
  118  * \param dev       The device making this bind request.
  119  * \param virq      The Xen virtual IRQ number for the Xen interrupt
  120  *                  source being hooked.
  121  * \param cpu       The cpu on which interrupt events should be delivered. 
  122  * \param filter    An interrupt filter handler.  Specify NULL
  123  *                  to always dispatch to the ithread handler.
  124  * \param handler   An interrupt ithread handler.  Optional (can
  125  *                  specify NULL) if all necessary event actions
  126  *                  are performed by filter.
  127  * \param arg       Argument to present to both filter and handler.
  128  * \param irqflags  Interrupt handler flags.  See sys/bus.h.
  129  * \param handlep   Pointer to an opaque handle used to manage this
  130  *                  registration.
  131  *
  132  * \returns  0 on success, otherwise an errno.
  133  */
  134 int xen_intr_bind_virq(device_t dev, u_int virq, u_int cpu,
  135         driver_filter_t filter, driver_intr_t handler,
  136         void *arg, enum intr_type irqflags, xen_intr_handle_t *handlep);
  137 
  138 /**
  139  * Allocate a local event channel port for servicing interprocessor
  140  * interupts and, if successful, associate the port with the specified
  141  * interrupt handler.
  142  *
  143  * \param cpu       The cpu receiving the IPI.
  144  * \param filter    The interrupt filter servicing this IPI.
  145  * \param irqflags  Interrupt handler flags.  See sys/bus.h.
  146  * \param handlep   Pointer to an opaque handle used to manage this
  147  *                  registration.
  148  *
  149  * \returns  0 on success, otherwise an errno.
  150  */
  151 int xen_intr_alloc_and_bind_ipi(u_int cpu,
  152         driver_filter_t filter, enum intr_type irqflags,
  153         xen_intr_handle_t *handlep);
  154 
  155 /**
  156  * Unbind an interrupt handler from its interrupt source.
  157  *
  158  * \param handlep  A pointer to the opaque handle that was initialized
  159  *                 at the time the interrupt source was bound.
  160  *
  161  * \returns  0 on success, otherwise an errno.
  162  *
  163  * \note  The event channel, if any, that was allocated at bind time is
  164  *        closed upon successful return of this method.
  165  *
  166  * \note  It is always safe to call xen_intr_unbind() on a handle that
  167  *        has been initilized to NULL.
  168  */
  169 void xen_intr_unbind(xen_intr_handle_t *handle);
  170 
  171 /**
  172  * Add a description to an interrupt handler.
  173  *
  174  * \param handle  The opaque handle that was initialized at the time
  175  *                the interrupt source was bound.
  176  *
  177  * \param fmt     The sprintf compatible format string for the description,
  178  *                followed by optional sprintf arguments.
  179  *
  180  * \returns  0 on success, otherwise an errno.
  181  */
  182 int
  183 xen_intr_describe(xen_intr_handle_t port_handle, const char *fmt, ...)
  184         __attribute__((format(printf, 2, 3)));
  185 
  186 /**
  187  * Signal the remote peer of an interrupt source associated with an
  188  * event channel port.
  189  *
  190  * \param handle  The opaque handle that was initialized at the time
  191  *                the interrupt source was bound.
  192  *
  193  * \note  For xen interrupt sources other than event channel ports,
  194  *        this method takes no action.
  195  */
  196 void xen_intr_signal(xen_intr_handle_t handle);
  197 
  198 /**
  199  * Get the local event channel port number associated with this interrupt
  200  * source.
  201  *
  202  * \param handle  The opaque handle that was initialized at the time
  203  *                the interrupt source was bound.
  204  *
  205  * \returns  0 if the handle is invalid, otherwise positive port number.
  206  */
  207 evtchn_port_t xen_intr_port(xen_intr_handle_t handle);
  208 
  209 /**
  210  * Bind an event channel port with a handler
  211  *
  212  * \param dev       The device making this bind request.
  213  * \param filter    An interrupt filter handler.  Specify NULL
  214  *                  to always dispatch to the ithread handler.
  215  * \param handler   An interrupt ithread handler.  Optional (can
  216  *                  specify NULL) if all necessary event actions
  217  *                  are performed by filter.
  218  * \param arg       Argument to present to both filter and handler.
  219  * \param irqflags  Interrupt handler flags.  See sys/bus.h.
  220  * \param handle    Opaque handle used to manage this registration.
  221  *
  222  * \returns  0 on success, otherwise an errno.
  223  */
  224 int xen_intr_add_handler(const char *name, driver_filter_t filter,
  225         driver_intr_t handler, void *arg, enum intr_type flags,
  226         xen_intr_handle_t handle);
  227 
  228 /**
  229  * Get a reference to an event channel port
  230  *
  231  * \param port      Event channel port to which we get a reference.
  232  * \param handlep   Pointer to an opaque handle used to manage this
  233  *                  registration.
  234  *
  235  * \returns  0 on success, otherwise an errno.
  236  */
  237 int xen_intr_get_evtchn_from_port(evtchn_port_t port,
  238         xen_intr_handle_t *handlep);
  239 
  240 #endif /* _XEN_INTR_H_ */

Cache object: a91ff27302753b54fccbde9e152d4d63


[ 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.