ia64/xen-unstable

changeset 1449:7ae55a8c64e4

bitkeeper revision 1.949 (40c849bbwzGqdgyEGz_X9EcI9GanBw)

Plumb bind_virq Xen command thru to Python.
author kaf24@scramble.cl.cam.ac.uk
date Thu Jun 10 11:44:59 2004 +0000 (2004-06-10)
parents 5913b86987c3
children 5bfc0d01717c
files tools/xc/lib/xc.h tools/xc/lib/xc_evtchn.c tools/xc/py/Xc.c
line diff
     1.1 --- a/tools/xc/lib/xc.h	Thu Jun 10 11:36:49 2004 +0000
     1.2 +++ b/tools/xc/lib/xc.h	Thu Jun 10 11:44:59 2004 +0000
     1.3 @@ -229,6 +229,9 @@ int xc_evtchn_bind_interdomain(int xc_ha
     1.4                                 u32 dom2,   /* may be DOMID_SELF */
     1.5                                 int *port1,
     1.6                                 int *port2);
     1.7 +int xc_evtchn_bind_virq(int xc_handle,
     1.8 +                        int virq,
     1.9 +                        int *port);
    1.10  int xc_evtchn_close(int xc_handle,
    1.11                      u32 dom,   /* may be DOMID_SELF */
    1.12                      int port);
     2.1 --- a/tools/xc/lib/xc_evtchn.c	Thu Jun 10 11:36:49 2004 +0000
     2.2 +++ b/tools/xc/lib/xc_evtchn.c	Thu Jun 10 11:44:59 2004 +0000
     2.3 @@ -8,6 +8,7 @@
     2.4  
     2.5  #include "xc_private.h"
     2.6  
     2.7 +
     2.8  static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
     2.9  {
    2.10      int ret = -1;
    2.11 @@ -29,6 +30,7 @@ static int do_evtchn_op(int xc_handle, e
    2.12   out1: return ret;
    2.13  }
    2.14  
    2.15 +
    2.16  int xc_evtchn_bind_interdomain(int xc_handle,
    2.17                                 u32 dom1,
    2.18                                 u32 dom2,
    2.19 @@ -54,6 +56,26 @@ int xc_evtchn_bind_interdomain(int xc_ha
    2.20  }
    2.21  
    2.22  
    2.23 +int xc_evtchn_bind_virq(int xc_handle,
    2.24 +                        int virq,
    2.25 +                        int *port)
    2.26 +{
    2.27 +    evtchn_op_t op;
    2.28 +    int         rc;
    2.29 +
    2.30 +    op.cmd = EVTCHNOP_bind_virq;
    2.31 +    op.u.bind_virq.virq = (u32)virq;
    2.32 +   
    2.33 +    if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
    2.34 +    {
    2.35 +        if ( port != NULL )
    2.36 +            *port = op.u.bind_virq.port;
    2.37 +    }
    2.38 +    
    2.39 +    return rc;
    2.40 +}
    2.41 +
    2.42 +
    2.43  int xc_evtchn_close(int xc_handle,
    2.44                      u32 dom,
    2.45                      int port)
     3.1 --- a/tools/xc/py/Xc.c	Thu Jun 10 11:36:49 2004 +0000
     3.2 +++ b/tools/xc/py/Xc.c	Thu Jun 10 11:44:59 2004 +0000
     3.3 @@ -1050,6 +1050,25 @@ static PyObject *pyxc_evtchn_bind_interd
     3.4                           "port2", port2);
     3.5  }
     3.6  
     3.7 +static PyObject *pyxc_evtchn_bind_virq(PyObject *self,
     3.8 +                                       PyObject *args,
     3.9 +                                       PyObject *kwds)
    3.10 +{
    3.11 +    XcObject *xc = (XcObject *)self;
    3.12 +
    3.13 +    int virq, port;
    3.14 +
    3.15 +    static char *kwd_list[] = { "virq", NULL };
    3.16 +
    3.17 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &virq) )
    3.18 +        return NULL;
    3.19 +
    3.20 +    if ( xc_evtchn_bind_virq(xc->xc_handle, virq, &port) != 0 )
    3.21 +        return PyErr_SetFromErrno(xc_error);
    3.22 +
    3.23 +    return PyInt_FromLong(port);
    3.24 +}
    3.25 +
    3.26  static PyObject *pyxc_evtchn_close(PyObject *self,
    3.27                                     PyObject *args,
    3.28                                     PyObject *kwds)
    3.29 @@ -1648,6 +1667,13 @@ static PyMethodDef pyxc_methods[] = {
    3.30        " port1 [int]: Port-id for endpoint at dom1.\n"
    3.31        " port2 [int]: Port-id for endpoint at dom2.\n" },
    3.32  
    3.33 +    { "evtchn_bind_virq", 
    3.34 +      (PyCFunction)pyxc_evtchn_bind_virq, 
    3.35 +      METH_VARARGS | METH_KEYWORDS, "\n"
    3.36 +      "Bind an event channel to the specified VIRQ.\n"
    3.37 +      " virq [int]: VIRQ to bind.\n\n"
    3.38 +      "Returns: [int] Bound event-channel port.\n" },
    3.39 +
    3.40      { "evtchn_close", 
    3.41        (PyCFunction)pyxc_evtchn_close, 
    3.42        METH_VARARGS | METH_KEYWORDS, "\n"