evtchn_impl.h revision 349b53dd4e695e3d833b5380540385145b2d3ae8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* evtchn.h (renamed to evtchn_impl.h)
*
* Communication via Xen event channels.
* Also definitions for the device that demuxes notifications to userspace.
*
* Copyright (c) 2004-2005, K A Fraser
*
* This file may be distributed separately from the Linux kernel, or
* incorporated into other software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify,
* and to permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef _SYS_EVTCHN_H
#define _SYS_EVTCHN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/privregs.h>
#include <sys/traptrace.h>
#include <sys/ddi_intr.h>
#include <sys/ddi_intr_impl.h>
#include <sys/hypervisor.h>
/* evtchn binding types */
#define IRQT_UNBOUND 0 /* unassigned irq */
/* Xen will never allocate port zero for any purpose. */
#define INVALID_EVTCHN 0
/* XXPV - should these defines be somewhere else? xenos.h perhaps? */
#define IPL_CONS 9
#define IPL_VIF 6
#define IPL_VBD 5
#define IPL_EVTCHN 1
#define PIRQ_BASE 0 /* base of pirq range */
#if defined(_LP64)
#else
#endif
#define INVALID_IRQ -1
extern int ec_dev_irq;
typedef struct mec_info {
short mi_irq; /* the IRQ, or INVALID_IRQ */
char mi_shared; /* one evtchn for all CPUs? */
} mec_info_t;
/*
* Careful: ii_ipl is /only/ set if there's a handler for this IRQ.
*/
typedef struct irq_info {
union {
} ii_u;
union {
} ii_u2;
} irq_info_t;
extern int ec_is_edge_pirq(int);
extern int ec_init(void);
extern void ec_init_debug_irq(void);
extern void ec_suspend(void);
extern void ec_resume(void);
extern void ec_wait_on_evtchn(int, int (*)(void *), void *);
extern void ec_wait_on_ipi(int, int (*)(void *), void *);
extern void ec_setup_pirq(int, int, cpuset_t *);
extern void ec_set_irq_affinity(int, cpuset_t);
extern int ec_set_irq_priority(int, int);
extern int ec_bind_ipi_to_irq(int, int);
extern void ec_bind_cpu_ipis(int);
extern int ec_bind_evtchn_to_irq(int);
extern int ec_bind_virq_to_irq(int, int);
extern void ec_unbind_irq(int irq);
extern void ec_send_ipi(int, int);
extern void ec_try_ipi(int, int);
extern void ec_clear_irq(int);
extern void ec_unmask_irq(int);
extern void ec_try_unmask_irq(int);
extern int ec_block_irq(int);
extern void ec_unpend_irq(int);
extern int ec_irq_needs_rebind(int, int);
extern int ec_irq_rebindable(int);
extern int ec_pending_irq(unsigned int);
extern void ec_enable_irq(unsigned int);
extern void ec_disable_irq(unsigned int);
extern int xen_bind_interdomain(int, int, int *);
extern int xen_bind_virq(unsigned int, processorid_t, int *);
extern int xen_alloc_unbound_evtchn(int, int *);
extern void ec_bind_vcpu(int, int);
extern int ec_mask_evtchn(unsigned int);
extern void ec_unmask_evtchn(unsigned int);
extern void ec_clear_evtchn(unsigned int);
extern void ec_notify_via_evtchn(unsigned int);
/*
*/
extern void ec_irq_add_evtchn(int, int);
extern void ec_irq_rm_evtchn(int, int);
extern int ec_dev_alloc_irq(void);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_EVTCHN_H */