ia64/xen-unstable

view linux-2.6.7-xen-sparse/include/asm-xen/ctrl_if.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 * ctrl_if.h
3 *
4 * Management functions for special interface to the domain controller.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
9 #ifndef __ASM_XEN__CTRL_IF_H__
10 #define __ASM_XEN__CTRL_IF_H__
12 #include <asm/hypervisor.h>
14 typedef control_msg_t ctrl_msg_t;
16 /*
17 * Callback function type. Called for asynchronous processing of received
18 * request messages, and responses to previously-transmitted request messages.
19 * The parameters are (@msg, @id).
20 * @msg: Original request/response message (not a copy). The message can be
21 * modified in-place by the handler (e.g., a response callback can
22 * turn a request message into a response message in place). The message
23 * is no longer accessible after the callback handler returns -- if the
24 * message is required to persist for longer then it must be copied.
25 * @id: (Response callbacks only) The 'id' that was specified when the
26 * original request message was queued for transmission.
27 */
28 typedef void (*ctrl_msg_handler_t)(ctrl_msg_t *, unsigned long);
30 /*
31 * Send @msg to the domain controller. Execute @hnd when a response is
32 * received, passing the response message and the specified @id. This
33 * operation will not block: it will return -EAGAIN if there is no space.
34 * Notes:
35 * 1. The @msg is copied if it is transmitted and so can be freed after this
36 * function returns.
37 * 2. If @hnd is NULL then no callback is executed.
38 */
39 int ctrl_if_send_message_noblock(
40 ctrl_msg_t *msg,
41 ctrl_msg_handler_t hnd,
42 unsigned long id);
44 /*
45 * Send @msg to the domain controller. Execute @hnd when a response is
46 * received, passing the response message and the specified @id. This
47 * operation will block until the message is sent, or a signal is received
48 * for the calling process (unless @wait_state is TASK_UNINTERRUPTIBLE).
49 * Notes:
50 * 1. The @msg is copied if it is transmitted and so can be freed after this
51 * function returns.
52 * 2. If @hnd is NULL then no callback is executed.
53 */
54 int ctrl_if_send_message_block(
55 ctrl_msg_t *msg,
56 ctrl_msg_handler_t hnd,
57 unsigned long id,
58 long wait_state);
60 /*
61 * Request a callback when there is /possibly/ space to immediately send a
62 * message to the domain controller. This function returns 0 if there is
63 * already space to trasnmit a message --- in this case the callback task /may/
64 * still be executed. If this function returns 1 then the callback /will/ be
65 * executed when space becomes available.
66 */
67 int ctrl_if_enqueue_space_callback(struct work_struct *task);
69 /*
70 * Send a response (@msg) to a message from the domain controller. This will
71 * never block.
72 * Notes:
73 * 1. The @msg is copied and so can be freed after this function returns.
74 * 2. The @msg may be the original request message, modified in-place.
75 */
76 void ctrl_if_send_response(ctrl_msg_t *msg);
78 /*
79 * Register a receiver for typed messages from the domain controller. The
80 * handler (@hnd) is called for every received message of specified @type.
81 * Returns TRUE (non-zero) if the handler was successfully registered.
82 * If CALLBACK_IN_BLOCKING CONTEXT is specified in @flags then callbacks will
83 * occur in a context in which it is safe to yield (i.e., process context).
84 */
85 #define CALLBACK_IN_BLOCKING_CONTEXT 1
86 int ctrl_if_register_receiver(
87 u8 type,
88 ctrl_msg_handler_t hnd,
89 unsigned int flags);
91 /*
92 * Unregister a receiver for typed messages from the domain controller. The
93 * handler (@hnd) will not be executed after this function returns.
94 */
95 void ctrl_if_unregister_receiver(u8 type, ctrl_msg_handler_t hnd);
97 /* Suspend/resume notifications. */
98 void ctrl_if_suspend(void);
99 void ctrl_if_resume(void);
101 /* Start-of-day setup. */
102 void ctrl_if_init(void);
104 /*
105 * Returns TRUE if there are no outstanding message requests at the domain
106 * controller. This can be used to ensure that messages have really flushed
107 * through when it is not possible to use the response-callback interface.
108 * WARNING: If other subsystems are using the control interface then this
109 * function might never return TRUE!
110 */
111 int ctrl_if_transmitter_empty(void); /* !! DANGEROUS FUNCTION !! */
113 /*
114 * Manually discard response messages from the domain controller.
115 * WARNING: This is usually done automatically -- this function should only
116 * be called when normal interrupt mechanisms are disabled!
117 */
118 void ctrl_if_discard_responses(void); /* !! DANGEROUS FUNCTION !! */
120 #endif /* __ASM_XEN__CONTROL_IF_H__ */