]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] ppc64: move hypervisor console code into its own file
authorAndrew Morton <akpm@osdl.org>
Thu, 5 Feb 2004 05:18:34 +0000 (21:18 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 5 Feb 2004 05:18:34 +0000 (21:18 -0800)
From: anton@samba.org

From: Hollis Blanchard <hollisb@us.ibm.com>

move hypervisor console code into its own file

arch/ppc64/kernel/Makefile
arch/ppc64/kernel/hvconsole.c [new file with mode: 0644]
arch/ppc64/kernel/pSeries_lpar.c
include/asm-ppc64/hvconsole.h [new file with mode: 0644]

index 4a6797c917ff7e99ee5a7fc496ccb17e8a53c9bf..b347188c36c8d6fc130cb6070fe05f6ff7fa2fe9 100644 (file)
@@ -39,6 +39,6 @@ obj-$(CONFIG_PPC_RTAS)                += rtas-proc.o
 obj-$(CONFIG_SCANLOG)          += scanlog.o
 obj-$(CONFIG_VIOPATH)          += viopath.o
 obj-$(CONFIG_LPARCFG)          += lparcfg.o
-
+obj-$(CONFIG_HVC_CONSOLE)   += hvconsole.o
 
 CFLAGS_ioctl32.o += -Ifs/
diff --git a/arch/ppc64/kernel/hvconsole.c b/arch/ppc64/kernel/hvconsole.c
new file mode 100644 (file)
index 0000000..101e079
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * hvconsole.c
+ * Copyright (C) 2004 Hollis Blanchard, IBM Corporation
+ *
+ * LPAR console support.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <asm/hvcall.h>
+#include <asm/prom.h>
+#include <asm/hvconsole.h>
+
+int hvc_get_chars(int index, char *buf, int count)
+{
+       unsigned long got;
+
+       if (plpar_hcall(H_GET_TERM_CHAR, index, 0, 0, 0, &got,
+               (unsigned long *)buf, (unsigned long *)buf+1) == H_Success) {
+               /*
+                * Work around a HV bug where it gives us a null
+                * after every \r.  -- paulus
+                */
+               if (got > 0) {
+                       int i;
+                       for (i = 1; i < got; ++i) {
+                               if (buf[i] == 0 && buf[i-1] == '\r') {
+                                       --got;
+                                       if (i < got)
+                                               memmove(&buf[i], &buf[i+1],
+                                                       got - i);
+                               }
+                       }
+               }
+               return got;
+       }
+       return 0;
+}
+
+int hvc_put_chars(int index, const char *buf, int count)
+{
+       unsigned long *lbuf = (unsigned long *) buf;
+       long ret;
+
+       ret = plpar_hcall_norets(H_PUT_TERM_CHAR, index, count, lbuf[0],
+                                lbuf[1]);
+       if (ret == H_Success)
+               return count;
+       if (ret == H_Busy)
+               return 0;
+       return -1;
+}
+
+/* return the number of client vterms present */
+/* XXX this requires an interface change to handle multiple discontiguous
+ * vterms */
+int hvc_count(int *start_termno)
+{
+       struct device_node *vty;
+       int num_found = 0;
+
+       /* consider only the first vty node.
+        * we should _always_ be able to find one. */
+       vty = of_find_node_by_name(NULL, "vty");
+       if (vty && device_is_compatible(vty, "hvterm1")) {
+               u32 *termno = (u32 *)get_property(vty, "reg", 0);
+
+               if (termno && start_termno)
+                       *start_termno = *termno;
+               num_found = 1;
+               of_node_put(vty);
+       }
+
+       return num_found;
+}
index 23c75ac575430f7e5d80e3c3aa2190ac1eb3d486..c92ce2707666445c7eb1fb82454a4de8bfe1f214 100644 (file)
@@ -313,69 +313,6 @@ void pSeriesLP_init_early(void)
        }
 }
 
-int hvc_get_chars(int index, char *buf, int count)
-{
-       unsigned long got;
-
-       if (plpar_hcall(H_GET_TERM_CHAR, index, 0, 0, 0, &got,
-               (unsigned long *)buf, (unsigned long *)buf+1) == H_Success) {
-               /*
-                * Work around a HV bug where it gives us a null
-                * after every \r.  -- paulus
-                */
-               if (got > 0) {
-                       int i;
-                       for (i = 1; i < got; ++i) {
-                               if (buf[i] == 0 && buf[i-1] == '\r') {
-                                       --got;
-                                       if (i < got)
-                                               memmove(&buf[i], &buf[i+1],
-                                                       got - i);
-                               }
-                       }
-               }
-               return got;
-       }
-       return 0;
-}
-
-int hvc_put_chars(int index, const char *buf, int count)
-{
-       unsigned long *lbuf = (unsigned long *) buf;
-       long ret;
-
-       ret = plpar_hcall_norets(H_PUT_TERM_CHAR, index, count, lbuf[0],
-                                lbuf[1]);
-       if (ret == H_Success)
-               return count;
-       if (ret == H_Busy)
-               return 0;
-       return -1;
-}
-
-/* return the number of client vterms present */
-/* XXX this requires an interface change to handle multiple discontiguous
- * vterms */
-int hvc_count(int *start_termno)
-{
-       struct device_node *vty;
-       int num_found = 0;
-
-       /* consider only the first vty node.
-        * we should _always_ be able to find one. */
-       vty = of_find_node_by_name(NULL, "vty");
-       if (vty && device_is_compatible(vty, "hvterm1")) {
-               u32 *termno = (u32 *)get_property(vty, "reg", 0);
-
-               if (termno && start_termno)
-                       *start_termno = *termno;
-               num_found = 1;
-               of_node_put(vty);
-       }
-
-       return num_found;
-}
-
 long pSeries_lpar_hpte_insert(unsigned long hpte_group,
                              unsigned long va, unsigned long prpn,
                              int secondary, unsigned long hpteflags,
diff --git a/include/asm-ppc64/hvconsole.h b/include/asm-ppc64/hvconsole.h
new file mode 100644 (file)
index 0000000..1715486
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * hvconsole.h
+ * Copyright (C) 2004 Ryan S Arnold, IBM Corporation
+ *
+ * LPAR console support.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef _PPC64_HVCONSOLE_H
+#define _PPC64_HVCONSOLE_H
+
+extern int hvc_get_chars(int index, char *buf, int count);
+extern int hvc_put_chars(int index, const char *buf, int count);
+extern int hvc_count(int *start_termno);
+
+#endif /* _PPC64_HVCONSOLE_H */
+