#include <linux/string.h>
-#include <asm/arch/uncompress.h>
-
#ifdef STANDALONE_DEBUG
-#define puts printf
-#endif
+#define putstr printf
+#else
+
+static void putstr(const char *ptr);
+
+#include <linux/compiler.h>
+#include <asm/arch/uncompress.h>
#ifdef CONFIG_DEBUG_ICEDCC
-#define puts icedcc_puts
-#define putc icedcc_putc
-extern void idedcc_putc(int ch);
+#ifdef CONFIG_CPU_V6
+
+static void icedcc_putc(int ch)
+{
+ int status, i = 0x4000000;
+
+ do {
+ if (--i < 0)
+ return;
+
+ asm volatile ("mrc p14, 0, %0, c0, c1, 0" : "=r" (status));
+ } while (status & (1 << 29));
+
+ asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch));
+}
+
+#else
+
+static void icedcc_putc(int ch)
+{
+ int status, i = 0x4000000;
+
+ do {
+ if (--i < 0)
+ return;
+
+ asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
+ } while (status & 2);
+
+ asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch));
+}
+
+#endif
-static void
-icedcc_puts(const char *ptr)
+#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
static void gzip_mark(void **);
static void gzip_release(void **);
-static void puts(const char *);
+static void putstr(const char *);
extern int end;
static ulg free_mem_ptr;
bytes_out += (ulg)outcnt;
output_ptr += (ulg)outcnt;
outcnt = 0;
- puts(".");
+ putstr(".");
}
+#ifndef arch_error
+#define arch_error(x)
+#endif
+
static void error(char *x)
{
- puts("\n\n");
- puts(x);
- puts("\n\n -- System halted");
+ arch_error(x);
+
+ putstr("\n\n");
+ putstr(x);
+ putstr("\n\n -- System halted");
while(1); /* Halt */
}
arch_decomp_setup();
makecrc();
- puts("Uncompressing Linux...");
+ putstr("Uncompressing Linux...");
gunzip();
- puts(" done, booting the kernel.\n");
+ putstr(" done, booting the kernel.\n");
return output_ptr;
}
#else
output_data = output_buffer;
makecrc();
- puts("Uncompressing Linux...");
+ putstr("Uncompressing Linux...");
gunzip();
- puts("done.\n");
+ putstr("done.\n");
return 0;
}
#endif