@@ -13,7 +13,6 @@ lib-$(CONFIG_SPARC32) += mp.o
lib-$(CONFIG_SPARC32) += palloc.o
lib-$(CONFIG_SPARC32) += ranges.o
lib-$(CONFIG_SPARC32) += segment.o
-lib-y += console_$(BITS).o
lib-y += printf.o
lib-y += tree_$(BITS).o
lib-$(CONFIG_SPARC64) += p1275.o
deleted file mode 100644
@@ -1,56 +0,0 @@
-/*
- * console.c: Routines that deal with sending and receiving IO
- * to/from the current console device using the PROM.
- *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 1998 Pete Zaitcev <zaitcev@yahoo.com>
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <asm/openprom.h>
-#include <asm/oplib.h>
-#include <asm/system.h>
-#include <linux/string.h>
-
-extern void restore_current(void);
-
-/* Non blocking put character to console device, returns -1 if
- * unsuccessful.
- */
-static int prom_nbputchar(const char *buf)
-{
- unsigned long flags;
- int i = -1;
-
- spin_lock_irqsave(&prom_lock, flags);
- switch(prom_vers) {
- case PROM_V0:
- if ((*(romvec->pv_nbputchar))(*buf))
- i = 1;
- break;
- case PROM_V2:
- case PROM_V3:
- if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout,
- buf, 0x1) == 1)
- i = 1;
- break;
- default:
- break;
- };
- restore_current();
- spin_unlock_irqrestore(&prom_lock, flags);
- return i; /* Ugh, we could spin forever on unsupported proms ;( */
-}
-
-void prom_console_write_buf(const char *buf, int len)
-{
- while (len) {
- int n = prom_nbputchar(buf);
- if (n < 0)
- continue;
- len -= n;
- buf += n;
- }
-}
deleted file mode 100644
@@ -1,48 +0,0 @@
-/* console.c: Routines that deal with sending and receiving IO
- * to/from the current console device using the PROM.
- *
- * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
- * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <asm/openprom.h>
-#include <asm/oplib.h>
-#include <asm/system.h>
-#include <linux/string.h>
-
-extern int prom_stdout;
-
-static int __prom_console_write_buf(const char *buf, int len)
-{
- unsigned long args[7];
- int ret;
-
- args[0] = (unsigned long) "write";
- args[1] = 3;
- args[2] = 1;
- args[3] = (unsigned int) prom_stdout;
- args[4] = (unsigned long) buf;
- args[5] = (unsigned int) len;
- args[6] = (unsigned long) -1;
-
- p1275_cmd_direct(args);
-
- ret = (int) args[6];
- if (ret < 0)
- return -1;
- return ret;
-}
-
-void prom_console_write_buf(const char *buf, int len)
-{
- while (len) {
- int n = __prom_console_write_buf(buf, len);
- if (n < 0)
- continue;
- len -= n;
- buf += n;
- }
-}
@@ -2,8 +2,8 @@
* printf.c: Internal prom library printf facility.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
+ * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ * Copyright (c) 1998,2002 Pete Zaitcev (zaitcev@yahoo.com)
*
* We used to warn all over the code: DO NOT USE prom_printf(),
* and yet people do. Anton's banking code was outputting banks
@@ -26,6 +26,73 @@ static char ppbuf[1024];
static char console_write_buf[CONSOLE_WRITE_BUF_SIZE];
static DEFINE_RAW_SPINLOCK(console_write_lock);
+#ifdef CONFIG_SPARC32
+
+extern void restore_current(void);
+
+static int __prom_console_write_buf(const char *buf, int len)
+{
+ unsigned long flags;
+ int i = -1;
+
+ spin_lock_irqsave(&prom_lock, flags);
+ switch(prom_vers) {
+ case PROM_V0:
+ if ((*(romvec->pv_nbputchar))(*buf))
+ i = 1;
+ break;
+ case PROM_V2:
+ case PROM_V3:
+ if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout,
+ buf, 0x1) == 1)
+ i = 1;
+ break;
+ default:
+ break;
+ };
+ restore_current();
+ spin_unlock_irqrestore(&prom_lock, flags);
+ return i; /* Ugh, we could spin forever on unsupported proms ;( */
+}
+
+#else
+
+extern int prom_stdout;
+
+static int __prom_console_write_buf(const char *buf, int len)
+{
+ unsigned long args[7];
+ int ret;
+
+ args[0] = (unsigned long) "write";
+ args[1] = 3;
+ args[2] = 1;
+ args[3] = (unsigned int) prom_stdout;
+ args[4] = (unsigned long) buf;
+ args[5] = (unsigned int) len;
+ args[6] = (unsigned long) -1;
+
+ p1275_cmd_direct(args);
+
+ ret = (int) args[6];
+ if (ret < 0)
+ return -1;
+ return ret;
+}
+
+#endif
+
+void prom_console_write_buf(const char *buf, int len)
+{
+ while (len) {
+ int n = __prom_console_write_buf(buf, len);
+ if (n < 0)
+ continue;
+ len -= n;
+ buf += n;
+ }
+}
+
void notrace prom_write(const char *buf, unsigned int n)
{
unsigned int dest_len;
prom_console_write_buf() is only used in prom/printf.c, so as it's the only remaining function in console_*.c, let's merge console_*.c into printf.c. We'll also rename prom_nbputchar() to __prom_console_write_buf() and merge the definitions of prom_console_write_buf() as they're identical. Signed-off-by: Julian Calaby <julian.calaby@gmail.com> --- arch/sparc/prom/Makefile | 1 - arch/sparc/prom/console_32.c | 56 --------------------------------- arch/sparc/prom/console_64.c | 48 ---------------------------- arch/sparc/prom/printf.c | 71 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 69 insertions(+), 107 deletions(-) delete mode 100644 arch/sparc/prom/console_32.c delete mode 100644 arch/sparc/prom/console_64.c -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html