ia64/xen-unstable

changeset 10849:98a802d25848

[MINI-OS] Clean up event channel types in mini-os.

Signed-off-by: John D. Ramsdell <ramsdell@mitre.org>
Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author sos22@douglas.cl.cam.ac.uk
date Fri Jul 28 14:02:49 2006 +0100 (2006-07-28)
parents a10d02d20b31
children 97ffb7856239
files extras/mini-os/console/xencons_ring.c extras/mini-os/events.c extras/mini-os/include/events.h extras/mini-os/time.c extras/mini-os/xenbus/xenbus.c
line diff
     1.1 --- a/extras/mini-os/console/xencons_ring.c	Fri Jul 28 14:00:37 2006 +0100
     1.2 +++ b/extras/mini-os/console/xencons_ring.c	Fri Jul 28 14:02:49 2006 +0100
     1.3 @@ -53,7 +53,7 @@ int xencons_ring_send(const char *data, 
     1.4  
     1.5  
     1.6  
     1.7 -static void handle_input(int port, struct pt_regs *regs, void *ign)
     1.8 +static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *ign)
     1.9  {
    1.10  	struct xencons_interface *intf = xencons_interface();
    1.11  	XENCONS_RING_IDX cons, prod;
     2.1 --- a/extras/mini-os/events.c	Fri Jul 28 14:00:37 2006 +0100
     2.2 +++ b/extras/mini-os/events.c	Fri Jul 28 14:02:49 2006 +0100
     2.3 @@ -26,20 +26,20 @@
     2.4  
     2.5  /* this represents a event handler. Chaining or sharing is not allowed */
     2.6  typedef struct _ev_action_t {
     2.7 -	void (*handler)(int, struct pt_regs *, void *);
     2.8 +	evtchn_handler_t handler;
     2.9  	void *data;
    2.10      u32 count;
    2.11  } ev_action_t;
    2.12  
    2.13  
    2.14  static ev_action_t ev_actions[NR_EVS];
    2.15 -void default_handler(int port, struct pt_regs *regs, void *data);
    2.16 +void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
    2.17  
    2.18  
    2.19  /*
    2.20   * Demux events to different handlers.
    2.21   */
    2.22 -int do_event(u32 port, struct pt_regs *regs)
    2.23 +int do_event(evtchn_port_t port, struct pt_regs *regs)
    2.24  {
    2.25      ev_action_t  *action;
    2.26      if (port >= NR_EVS) {
    2.27 @@ -60,8 +60,8 @@ int do_event(u32 port, struct pt_regs *r
    2.28  
    2.29  }
    2.30  
    2.31 -int bind_evtchn( u32 port, void (*handler)(int, struct pt_regs *, void *),
    2.32 -				 void *data )
    2.33 +evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
    2.34 +						  void *data)
    2.35  {
    2.36   	if(ev_actions[port].handler != default_handler)
    2.37          printk("WARN: Handler for port %d already registered, replacing\n",
    2.38 @@ -77,7 +77,7 @@ int bind_evtchn( u32 port, void (*handle
    2.39  	return port;
    2.40  }
    2.41  
    2.42 -void unbind_evtchn( u32 port )
    2.43 +void unbind_evtchn(evtchn_port_t port )
    2.44  {
    2.45  	if (ev_actions[port].handler == default_handler)
    2.46  		printk("WARN: No handler for port %d when unbinding\n", port);
    2.47 @@ -86,8 +86,7 @@ void unbind_evtchn( u32 port )
    2.48  	ev_actions[port].data = NULL;
    2.49  }
    2.50  
    2.51 -int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
    2.52 -			   void *data)
    2.53 +int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data)
    2.54  {
    2.55  	evtchn_op_t op;
    2.56  
    2.57 @@ -137,7 +136,7 @@ void init_events(void)
    2.58      }
    2.59  }
    2.60  
    2.61 -void default_handler(int port, struct pt_regs *regs, void *ignore)
    2.62 +void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ignore)
    2.63  {
    2.64      printk("[Port %d] - event received\n", port);
    2.65  }
    2.66 @@ -145,11 +144,9 @@ void default_handler(int port, struct pt
    2.67  /* Unfortunate confusion of terminology: the port is unbound as far
    2.68     as Xen is concerned, but we automatically bind a handler to it
    2.69     from inside mini-os. */
    2.70 -int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
    2.71 -										 void *data),
    2.72 -						 void *data)
    2.73 +evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler, void *data)
    2.74  {
    2.75 -	u32 port;
    2.76 +	evtchn_port_t port;
    2.77  	evtchn_op_t op;
    2.78  	int err;
    2.79  
     3.1 --- a/extras/mini-os/include/events.h	Fri Jul 28 14:00:37 2006 +0100
     3.2 +++ b/extras/mini-os/include/events.h	Fri Jul 28 14:02:49 2006 +0100
     3.3 @@ -22,19 +22,19 @@
     3.4  #include<traps.h>
     3.5  #include <xen/event_channel.h>
     3.6  
     3.7 +typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);
     3.8 +
     3.9  /* prototypes */
    3.10 -int do_event(u32 port, struct pt_regs *regs);
    3.11 -int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
    3.12 -			   void *data);
    3.13 -int bind_evtchn( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
    3.14 -				 void *data );
    3.15 -void unbind_evtchn( u32 port );
    3.16 +int do_event(evtchn_port_t port, struct pt_regs *regs);
    3.17 +int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
    3.18 +evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
    3.19 +						  void *data);
    3.20 +void unbind_evtchn(evtchn_port_t port);
    3.21  void init_events(void);
    3.22 -int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
    3.23 -										 void *data),
    3.24 -						 void *data);
    3.25 +evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler,
    3.26 +								   void *data);
    3.27  
    3.28 -static inline int notify_remote_via_evtchn(int port)
    3.29 +static inline int notify_remote_via_evtchn(evtchn_port_t port)
    3.30  {
    3.31      evtchn_op_t op;
    3.32      op.cmd = EVTCHNOP_send;
     4.1 --- a/extras/mini-os/time.c	Fri Jul 28 14:00:37 2006 +0100
     4.2 +++ b/extras/mini-os/time.c	Fri Jul 28 14:02:49 2006 +0100
     4.3 @@ -215,7 +215,7 @@ void block_domain(u32 millisecs)
     4.4  /*
     4.5   * Just a dummy 
     4.6   */
     4.7 -static void timer_handler(int ev, struct pt_regs *regs, void *ign)
     4.8 +static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
     4.9  {
    4.10      static int i;
    4.11  
     5.1 --- a/extras/mini-os/xenbus/xenbus.c	Fri Jul 28 14:00:37 2006 +0100
     5.2 +++ b/extras/mini-os/xenbus/xenbus.c	Fri Jul 28 14:02:49 2006 +0100
     5.3 @@ -112,7 +112,8 @@ static void xenbus_thread_func(void *ign
     5.4      }
     5.5  }
     5.6  
     5.7 -static void xenbus_evtchn_handler(int port, struct pt_regs *regs, void *ign)
     5.8 +static void xenbus_evtchn_handler(evtchn_port_t port, struct pt_regs *regs,
     5.9 +				  void *ign)
    5.10  {
    5.11      wake_up(&xb_waitq);
    5.12  }