Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / boot / compressed / misc.c
index 23434b5..ace3fb5 100644 (file)
@@ -20,24 +20,45 @@ unsigned int __machine_arch_type;
 
 #include <linux/string.h>
 
-#include <asm/arch/uncompress.h>
-
 #ifdef STANDALONE_DEBUG
 #define putstr printf
-#endif
+#else
+
+static void putstr(const char *ptr);
+
+#include <linux/compiler.h>
+#include <asm/arch/uncompress.h>
 
 #ifdef CONFIG_DEBUG_ICEDCC
-#define putstr icedcc_putstr
-#define putc icedcc_putc
+static void icedcc_putc(int ch)
+{
+       int status, i = 0x4000000;
+
+       do {
+               if (--i < 0)
+                       return;
 
-extern void idedcc_putc(int ch);
+               asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
+       } while (status & 2);
 
-static void
-icedcc_putstr(const char *ptr)
+       asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch));
+}
+
+#define putc(ch)       icedcc_putc(ch)
+#define flush()        do { } while (0)
+#endif
+
+static void putstr(const char *ptr)
 {
-       for (; *ptr != '\0'; ptr++) {
-               icedcc_putc(*ptr);
+       char c;
+
+       while ((c = *ptr++) != '\0') {
+               if (c == '\n')
+                       putc('\r');
+               putc(c);
        }
+
+       flush();
 }
 
 #endif
@@ -283,8 +304,14 @@ void flush_window(void)
        putstr(".");
 }
 
+#ifndef arch_error
+#define arch_error(x)
+#endif
+
 static void error(char *x)
 {
+       arch_error(x);
+
        putstr("\n\n");
        putstr(x);
        putstr("\n\n -- System halted");