WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [POWERPC][FIRMWARE] Firmware can now prov

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [POWERPC][FIRMWARE] Firmware can now provide an RTAS stub
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Jul 2007 04:21:55 -0700
Delivery-date: Mon, 09 Jul 2007 04:20:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Date 1180881571 14400
# Node ID 06a32f040d64a9e26d29f97bd0c48cf25724788a
# Parent  7205c65add2d4270400faf5a19f4e539f7315538
[POWERPC][FIRMWARE] Firmware can now provide an RTAS stub

If the firmwares devtree contains a /rtas node, then firmware will
supply the interfaces that will allow a small RTAS stub to be
instantiated.  The RTAS stub is simply an hvcall that passes the RTAS
command block to the hypervisor.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/arch/powerpc/of_handler/Makefile         |    1 
 xen/arch/powerpc/of_handler/ofh.c            |    1 
 xen/arch/powerpc/of_handler/rtas.c           |   82 +++++++++++++++++++++++++++
 xen/arch/powerpc/of_handler/vdevice.c        |    2 
 xen/arch/powerpc/of_handler/xen_hvcall.S     |   26 ++++++--
 xen/arch/powerpc/powerpc64/hypercall_table.S |    2 
 6 files changed, 107 insertions(+), 7 deletions(-)

diff -r 7205c65add2d -r 06a32f040d64 xen/arch/powerpc/of_handler/Makefile
--- a/xen/arch/powerpc/of_handler/Makefile      Sun Jun 03 10:35:20 2007 -0400
+++ b/xen/arch/powerpc/of_handler/Makefile      Sun Jun 03 10:39:31 2007 -0400
@@ -16,6 +16,7 @@ obj-y += memory.o
 obj-y += memory.o
 obj-y += ofh.o
 obj-y += papr.o
+obj-y += rtas.o
 obj-y += services.o
 obj-y += vdevice.o
 obj-y += xencomm.o
diff -r 7205c65add2d -r 06a32f040d64 xen/arch/powerpc/of_handler/ofh.c
--- a/xen/arch/powerpc/of_handler/ofh.c Sun Jun 03 10:35:20 2007 -0400
+++ b/xen/arch/powerpc/of_handler/ofh.c Sun Jun 03 10:39:31 2007 -0400
@@ -234,6 +234,7 @@ ofh_init(ulong b)
 
     ofh_service_init(b);
     ofh_chosen_init(b);
+       ofh_rtas_init(b);
     ofh_options_init(b);
 }
 
diff -r 7205c65add2d -r 06a32f040d64 xen/arch/powerpc/of_handler/rtas.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/of_handler/rtas.c        Sun Jun 03 10:39:31 2007 -0400
@@ -0,0 +1,82 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2007
+ *
+ * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
+ */
+
+#include "ofh.h"
+#include <stdarg.h>
+#include <xen/lib.h>
+extern char _rtas_image_start[];
+extern char _rtas_image_end[];
+
+static int
+rtas_instantiate_rtas(u32 nargs, u32 nrets, s32 argp[], s32 retp[], ulong b)
+{
+    if (nargs == 1) {
+        if (nrets == 1) {
+            void *rtas_base_address = (void *)(ulong)argp[0];
+            u32 sz = (_rtas_image_end - _rtas_image_start);
+
+            memcpy(rtas_base_address,
+                   DRELA(&_rtas_image_start[0], b), sz);
+            retp[0] = (ulong)rtas_base_address;
+
+            return OF_SUCCESS;
+        }
+    }
+    return OF_FAILURE;
+}
+
+
+static struct ofh_methods _rtas_methods[] = {
+    { "instantiate-rtas", rtas_instantiate_rtas },
+    { NULL, NULL},
+};
+
+static struct ofh_ihandle _ih_rtas = {
+    .ofi_methods = _rtas_methods,
+};
+
+static int rtas_open(u32 b)
+{
+    u32 ih = DRELA((u32)&_ih_rtas, b);
+
+    return ih;
+}
+
+void ofh_rtas_init(ulong b)
+{
+    static const char path[] = "/rtas";
+    ofdn_t n;
+    void *m = ofd_mem(b);
+    u32 sz;
+
+    n = ofd_node_find(m, DRELA(&path[0], b));
+    if (n <= 0)
+        return;
+
+    sz = (_rtas_image_end - _rtas_image_start);
+    /* Round size up to a multiple of 0x1000 */
+    sz = ALIGN_UP(sz, PAGE_SIZE);
+
+    ofd_prop_add(m, n, DRELA((const char *)"rtas-size", b),
+                 &sz, sizeof(sz));
+
+    /* create an IO node */
+    ofd_io_create(m, n, (ulong)rtas_open);
+}
diff -r 7205c65add2d -r 06a32f040d64 xen/arch/powerpc/of_handler/vdevice.c
--- a/xen/arch/powerpc/of_handler/vdevice.c     Sun Jun 03 10:35:20 2007 -0400
+++ b/xen/arch/powerpc/of_handler/vdevice.c     Sun Jun 03 10:39:31 2007 -0400
@@ -36,7 +36,7 @@ ofh_vty_init(ofdn_t chosen, ulong b)
 
     /* find the vty */
     n = ofd_node_find(mem,
-                        DRELA((const char *)"/vdevice/vty", b));
+                      DRELA((const char *)"/vdevice/vty", b));
     if (n > 0) {
         /* PAPR VTERM */
         ret = ofd_getprop(mem, n, DRELA((const char *)"reg", b),
diff -r 7205c65add2d -r 06a32f040d64 xen/arch/powerpc/of_handler/xen_hvcall.S
--- a/xen/arch/powerpc/of_handler/xen_hvcall.S  Sun Jun 03 10:35:20 2007 -0400
+++ b/xen/arch/powerpc/of_handler/xen_hvcall.S  Sun Jun 03 10:39:31 2007 -0400
@@ -1,19 +1,21 @@
 /*
- * Copyright (C) 2005 Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, IBM Corporation
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2005, 2007
+ *
+ * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
  */
 
 #include <asm/config.h>
@@ -26,3 +28,17 @@ _GLOBAL(xen_hvcall)
 _GLOBAL(xen_hvcall)
     HSC
     blr
+
+/* The following stub will get instantiated as RTAS in the guest */    
+#define H_RTAS_PROXY 23
+    .p2align 3
+    .global _rtas_image_start
+    .global _rtas_image_end
+_rtas_image_start:
+    mr r4,r3
+    lis        r3,0xffff
+    ori        r3,r3,H_RTAS_PROXY
+    HSC
+    blr
+    nop
+_rtas_image_end:
diff -r 7205c65add2d -r 06a32f040d64 
xen/arch/powerpc/powerpc64/hypercall_table.S
--- a/xen/arch/powerpc/powerpc64/hypercall_table.S      Sun Jun 03 10:35:20 
2007 -0400
+++ b/xen/arch/powerpc/powerpc64/hypercall_table.S      Sun Jun 03 10:39:31 
2007 -0400
@@ -27,7 +27,7 @@ __hypercall_table:
         .quad do_grant_table_op     /* 20 */
         .quad do_vm_assist
         .quad 0 /* do_update_va_mapping_otherdomain */
-        .quad 0 /* do_switch_vm86 */
+        .quad do_rtas_proxy /* do_switch_vm86 */
         .quad do_vcpu_op
         .quad do_ni_hypercall       /* 25 */
         .quad 0 /* do_mmuext_op */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [POWERPC][FIRMWARE] Firmware can now provide an RTAS stub, Xen patchbot-unstable <=