ia64/xen-unstable

view linux-2.6.7-xen-sparse/include/asm-xen/evtchn.h @ 1820:3d4f8eb89670

bitkeeper revision 1.1106.1.2 (40faa780dekT3E5arFwcbQDu1MbX6g)

Cleaned up Xen's instruction emulator.
author kaf24@scramble.cl.cam.ac.uk
date Sun Jul 18 16:38:24 2004 +0000 (2004-07-18)
parents 002fc84add90
children 6f08c0b6c8cd 3b0ab2e570a0 dae98734f12e
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, K A Fraser
8 */
10 #ifndef __ASM_EVTCHN_H__
11 #define __ASM_EVTCHN_H__
13 #include <linux/config.h>
14 #include <asm/hypervisor.h>
15 #include <asm/ptrace.h>
16 #include <asm/synch_bitops.h>
17 #include <asm/hypervisor-ifs/event_channel.h>
19 /*
20 * LOW-LEVEL DEFINITIONS
21 */
23 /* Entry point for notifications into Linux subsystems. */
24 void evtchn_do_upcall(struct pt_regs *regs);
26 /* Entry point for notifications into the userland character device. */
27 void evtchn_device_upcall(int port);
29 static inline void mask_evtchn(int port)
30 {
31 shared_info_t *s = HYPERVISOR_shared_info;
32 synch_set_bit(port, &s->evtchn_mask[0]);
33 }
35 static inline void unmask_evtchn(int port)
36 {
37 shared_info_t *s = HYPERVISOR_shared_info;
39 synch_clear_bit(port, &s->evtchn_mask[0]);
41 /*
42 * The following is basically the equivalent of 'hw_resend_irq'. Just like
43 * a real IO-APIC we 'lose the interrupt edge' if the channel is masked.
44 */
45 if ( synch_test_bit (port, &s->evtchn_pending[0]) &&
46 !synch_test_and_set_bit(port>>5, &s->evtchn_pending_sel) )
47 {
48 s->vcpu_data[0].evtchn_upcall_pending = 1;
49 if ( !s->vcpu_data[0].evtchn_upcall_mask )
50 evtchn_do_upcall(NULL);
51 }
52 }
54 static inline void clear_evtchn(int port)
55 {
56 shared_info_t *s = HYPERVISOR_shared_info;
57 synch_clear_bit(port, &s->evtchn_pending[0]);
58 }
60 static inline void notify_via_evtchn(int port)
61 {
62 evtchn_op_t op;
63 op.cmd = EVTCHNOP_send;
64 op.u.send.local_port = port;
65 (void)HYPERVISOR_event_channel_op(&op);
66 }
68 /*
69 * CHARACTER-DEVICE DEFINITIONS
70 */
72 /* /dev/xen/evtchn resides at device number major=10, minor=200 */
73 #define EVTCHN_MINOR 200
75 /* /dev/xen/evtchn ioctls: */
76 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
77 #define EVTCHN_RESET _IO('E', 1)
78 /* EVTCHN_BIND: Bind to teh specified event-channel port. */
79 #define EVTCHN_BIND _IO('E', 2)
80 /* EVTCHN_UNBIND: Unbind from the specified event-channel port. */
81 #define EVTCHN_UNBIND _IO('E', 3)
83 #endif /* __ASM_EVTCHN_H__ */