From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: [PATCH][XEN][POWERPC] add alloc_real_mode_area to python xc object Date: Fri, 08 Dec 2006 14:25:25 -0600 Message-ID: <1165609526.23364.19.camel@basalt> References: <1165535272.8900.60.camel@basalt> Reply-To: Hollis Blanchard Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0066217510==" Return-path: In-Reply-To: <1165535272.8900.60.camel@basalt> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-ppc-devel-bounces@lists.xensource.com Errors-To: xen-ppc-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel , xen-ppc-devel List-Id: xen-devel@lists.xenproject.org --===============0066217510== Content-Type: multipart/alternative; boundary="=-4iuOyAa6c9c78OsybVHl" --=-4iuOyAa6c9c78OsybVHl Content-Type: text/plain Content-Transfer-Encoding: 7bit Export PowerPC-specific alloc_real_mode_area() via the 'xc' Python object. As suggested, the function is prefixed with "arch_" to easily distinguish it from general xc functions. Signed-off-by: Hollis Blanchard diff -r 9d83185b4c37 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri Dec 01 19:11:02 2006 -0500 +++ b/tools/libxc/xenctrl.h Thu Dec 07 17:45:36 2006 -0600 @@ -439,6 +439,10 @@ int xc_domain_memory_populate_physmap(in unsigned int address_bits, xen_pfn_t *extent_start); +int xc_alloc_real_mode_area(int xc_handle, + uint32_t domid, + unsigned int log); + int xc_domain_ioport_permission(int xc_handle, uint32_t domid, uint32_t first_port, diff -r 9d83185b4c37 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Fri Dec 01 19:11:02 2006 -0500 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu Dec 07 17:45:38 2006 -0600 @@ -809,6 +809,28 @@ static PyObject *pyxc_domain_memory_incr return zero; } +#ifdef __powerpc__ +static PyObject *pyxc_alloc_real_mode_area(XcObject *self, + PyObject *args, + PyObject *kwds) +{ + uint32_t dom; + unsigned int log; + + static char *kwd_list[] = { "dom", "log", NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, + &dom, &log) ) + return NULL; + + if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) ) + return PyErr_SetFromErrno(xc_error); + + Py_INCREF(zero); + return zero; +} +#endif + static PyObject *pyxc_domain_ioport_permission(XcObject *self, PyObject *args, PyObject *kwds) @@ -1184,6 +1206,16 @@ static PyMethodDef pyxc_methods[] = { " dom [int]: Identifier of domain.\n" " mem_kb [long]: .\n" "Returns: [int] 0 on success; -1 on error.\n" }, + +#ifdef __powerpc__ + { "arch_alloc_real_mode_area", + (PyCFunction)pyxc_alloc_real_mode_area, + METH_VARARGS | METH_KEYWORDS, "\n" + "Allocate a domain's real mode area.\n" + " dom [int]: Identifier of domain.\n" + " log [int]: Specifies the area's size.\n" + "Returns: [int] 0 on success; -1 on error.\n" }, +#endif { "domain_ioport_permission", (PyCFunction)pyxc_domain_ioport_permission, -- Hollis Blanchard IBM Linux Technology Center --=-4iuOyAa6c9c78OsybVHl Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Export PowerPC-specific alloc_real_mode_area() via the 'xc' Python object. As suggested, the function is prefixed with "arch_" to easily distinguish it from general xc functions.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff -r 9d83185b4c37 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/libxc/xenctrl.h	Thu Dec 07 17:45:36 2006 -0600
@@ -439,6 +439,10 @@ int xc_domain_memory_populate_physmap(in
                                       unsigned int address_bits,
                                       xen_pfn_t *extent_start);
 
+int xc_alloc_real_mode_area(int xc_handle,
+                            uint32_t domid,
+                            unsigned int log);
+
 int xc_domain_ioport_permission(int xc_handle,
                                 uint32_t domid,
                                 uint32_t first_port,
diff -r 9d83185b4c37 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Dec 07 17:45:38 2006 -0600
@@ -809,6 +809,28 @@ static PyObject *pyxc_domain_memory_incr
     return zero;
 }
 
+#ifdef __powerpc__
+static PyObject *pyxc_alloc_real_mode_area(XcObject *self,
+                                           PyObject *args,
+                                           PyObject *kwds)
+{
+    uint32_t dom;
+    unsigned int log;
+
+    static char *kwd_list[] = { "dom", "log", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
+                                      &dom, &log) )
+        return NULL;
+
+    if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) )
+        return PyErr_SetFromErrno(xc_error);
+
+    Py_INCREF(zero);
+    return zero;
+}
+#endif
+
 static PyObject *pyxc_domain_ioport_permission(XcObject *self,
                                                PyObject *args,
                                                PyObject *kwds)
@@ -1184,6 +1206,16 @@ static PyMethodDef pyxc_methods[] = {
       " dom [int]: Identifier of domain.\n"
       " mem_kb [long]: .\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
+
+#ifdef __powerpc__
+    { "arch_alloc_real_mode_area", 
+      (PyCFunction)pyxc_alloc_real_mode_area, 
+      METH_VARARGS | METH_KEYWORDS, "\n"
+      "Allocate a domain's real mode area.\n"
+      " dom [int]: Identifier of domain.\n"
+      " log [int]: Specifies the area's size.\n"
+      "Returns: [int] 0 on success; -1 on error.\n" },
+#endif
 
     { "domain_ioport_permission",
       (PyCFunction)pyxc_domain_ioport_permission,


-- 
Hollis Blanchard
IBM Linux Technology Center

--=-4iuOyAa6c9c78OsybVHl-- --===============0066217510== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@lists.xensource.com http://lists.xensource.com/xen-ppc-devel --===============0066217510==--