ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-xen/evtchn.h @ 8534:da7873110bbb

Tiny bootstrap cleanup.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jan 09 19:46:46 2006 +0100 (2006-01-09)
parents 455b2b93542c
children
line source
1 /******************************************************************************
2 * evtchn.h
3 *
4 * Communication via Xen event channels.
5 * Also definitions for the device that demuxes notifications to userspace.
6 *
7 * Copyright (c) 2004-2005, K A Fraser
8 *
9 * This file may be distributed separately from the Linux kernel, or
10 * incorporated into other software packages, subject to the following license:
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a copy
13 * of this source file (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use, copy, modify,
15 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
16 * and to permit persons to whom the Software is furnished to do so, subject to
17 * the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included in
20 * all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE.
29 */
31 #ifndef __ASM_EVTCHN_H__
32 #define __ASM_EVTCHN_H__
34 #include <linux/config.h>
35 #include <linux/interrupt.h>
36 #include <asm/hypervisor.h>
37 #include <asm/ptrace.h>
38 #include <asm/synch_bitops.h>
39 #include <asm-xen/xen-public/event_channel.h>
40 #include <linux/smp.h>
42 /*
43 * LOW-LEVEL DEFINITIONS
44 */
46 /*
47 * Dynamically bind an event source to an IRQ-like callback handler.
48 * On some platforms this may not be implemented via the Linux IRQ subsystem.
49 * The IRQ argument passed to the callback handler is the same as returned
50 * from the bind call. It may not correspond to a Linux IRQ number.
51 * Returns IRQ or negative errno.
52 * UNBIND: Takes IRQ to unbind from; automatically closes the event channel.
53 */
54 extern int bind_evtchn_to_irqhandler(
55 unsigned int evtchn,
56 irqreturn_t (*handler)(int, void *, struct pt_regs *),
57 unsigned long irqflags,
58 const char *devname,
59 void *dev_id);
60 extern int bind_virq_to_irqhandler(
61 unsigned int virq,
62 unsigned int cpu,
63 irqreturn_t (*handler)(int, void *, struct pt_regs *),
64 unsigned long irqflags,
65 const char *devname,
66 void *dev_id);
67 extern int bind_ipi_to_irqhandler(
68 unsigned int ipi,
69 unsigned int cpu,
70 irqreturn_t (*handler)(int, void *, struct pt_regs *),
71 unsigned long irqflags,
72 const char *devname,
73 void *dev_id);
75 /*
76 * Common unbind function for all event sources. Takes IRQ to unbind from.
77 * Automatically closes the underlying event channel (even for bindings
78 * made with bind_evtchn_to_irqhandler()).
79 */
80 extern void unbind_from_irqhandler(unsigned int irq, void *dev_id);
82 extern void irq_resume(void);
84 /* Entry point for notifications into Linux subsystems. */
85 asmlinkage void evtchn_do_upcall(struct pt_regs *regs);
87 /* Entry point for notifications into the userland character device. */
88 extern void evtchn_device_upcall(int port);
90 extern void mask_evtchn(int port);
91 extern void unmask_evtchn(int port);
93 static inline void clear_evtchn(int port)
94 {
95 shared_info_t *s = HYPERVISOR_shared_info;
96 synch_clear_bit(port, &s->evtchn_pending[0]);
97 }
99 static inline void notify_remote_via_evtchn(int port)
100 {
101 evtchn_op_t op;
102 op.cmd = EVTCHNOP_send,
103 op.u.send.port = port;
104 (void)HYPERVISOR_event_channel_op(&op);
105 }
107 /*
108 * Unlike notify_remote_via_evtchn(), this is safe to use across
109 * save/restore. Notifications on a broken connection are silently dropped.
110 */
111 extern void notify_remote_via_irq(int irq);
113 #endif /* __ASM_EVTCHN_H__ */
115 /*
116 * Local variables:
117 * c-file-style: "linux"
118 * indent-tabs-mode: t
119 * c-indent-level: 8
120 * c-basic-offset: 8
121 * tab-width: 8
122 * End:
123 */