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-ppc-devel

[XenPPC] [pushed] [ppc] OF write method does not handle carriage return

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [pushed] [ppc] OF write method does not handle carriage return
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Tue, 25 Apr 2006 14:14:09 -0400
Delivery-date: Tue, 25 Apr 2006 12:19:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
changeset:   9945:89fe455f6461cbc0ae0c346dcdf010659ed6ec30
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Tue Apr 18 13:04:01 2006 -0400
files:       xen/arch/ppc/boot_of.c
description:
[ppc] OF write method does not handle carriage return


diff -r e0f71307b61dca9087d0dfb22b4d64b470f9bc5f -r 
89fe455f6461cbc0ae0c346dcdf010659ed6ec30 xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c    Tue Apr 11 11:51:04 2006 -0400
+++ b/xen/arch/ppc/boot_of.c    Tue Apr 18 13:04:01 2006 -0400
@@ -94,14 +94,48 @@ static int __init of_call(
 }
 
 /* popular OF methods */
+static int __init _of_write(int ih, const char *addr, u32 len)
+{
+    int rets[1] = { OF_FAILURE };
+    if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) {
+        return OF_FAILURE;
+    }
+    return rets[0];
+}
+
+/* popular OF methods */
 static int __init of_write(int ih, const char *addr, u32 len)
 {
-    int rets[1] = { OF_FAILURE };
-
-    if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) {
-        return OF_FAILURE;
-    }
-    return rets[0];
+    int rc;
+    int i = 0;
+    int sum = 0;
+
+    while (i < len) {
+        if (addr[i] == '\n') {
+            int l = len - i - 1;
+            if (l > 0) {
+                rc = _of_write(ih, addr, len - i - 1);
+                if (rc == OF_FAILURE) return rc;
+                sum += rc;
+            }
+            rc = _of_write(ih, "\r\n", 2);
+            if (rc == OF_FAILURE) return rc;
+            sum += rc;
+            i++;
+            addr += i;
+            len -= i;
+            i = 0;
+            continue;
+        }
+        i++;
+    }
+    if (len > 0) {
+        rc = _of_write(ih, addr, len);
+        if (rc == OF_FAILURE) return rc;
+        sum += rc;
+    }
+            
+    return sum;
 }
 
 static int of_printf(const char *fmt, ...)



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