[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [pushed] [ppc] OF write method does not handle carriage return
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |