[Skiboot] [PATCH v3 04/10] mambo: move callouts into separate header file

Oliver O'Halloran oohall at gmail.com
Wed Dec 21 15:52:26 AEDT 2016


This just moves the mambo callout handlers into a private header file so
we don't have to continue junking up the main platform file.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
 platforms/mambo/mambo.c | 41 ++--------------------------------
 platforms/mambo/mambo.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 39 deletions(-)
 create mode 100644 platforms/mambo/mambo.h

diff --git a/platforms/mambo/mambo.c b/platforms/mambo/mambo.c
index 8d4820f1bbfe..a5788b872585 100644
--- a/platforms/mambo/mambo.c
+++ b/platforms/mambo/mambo.c
@@ -24,6 +24,8 @@
 #include <time-utils.h>
 #include <time.h>
 
+#include "mambo.h"
+
 static bool mambo_probe(void)
 {
 	if (!dt_find_by_path(dt_root, "/mambo"))
@@ -32,35 +34,6 @@ static bool mambo_probe(void)
 	return true;
 }
 
-static inline unsigned long callthru0(int command)
-{
-	register uint64_t c asm("r3") = command;
-	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c));
-	return (c);
-}
-
-static inline unsigned long callthru2(int command, unsigned long arg1,
-				      unsigned long arg2)
-{
-	register unsigned long c asm("r3") = command;
-	register unsigned long a1 asm("r4") = arg1;
-	register unsigned long a2 asm("r5") = arg2;
-	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c), "r"(a1), "r"(a2));
-	return (c);
-}
-
-static inline unsigned long callthru3(int command, unsigned long arg1,
-				      unsigned long arg2, unsigned long arg3)
-{
-	register unsigned long c asm("r3") = command;
-	register unsigned long a1 asm("r4") = arg1;
-	register unsigned long a2 asm("r5") = arg2;
-	register unsigned long a3 asm("r6") = arg3;
-	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c), "r"(a1), "r"(a2),
-		      "r"(a3));
-	return (c);
-}
-
 #define BD_INFO_SYNC		0
 #define BD_INFO_STATUS		1
 #define BD_INFO_BLKSZ		2
@@ -69,16 +42,6 @@ static inline unsigned long callthru3(int command, unsigned long arg1,
 
 #define BD_SECT_SZ		512
 
-/* Mambo callthru commands */
-#define SIM_WRITE_CONSOLE_CODE	0
-#define SIM_EXIT_CODE		31
-#define SIM_READ_CONSOLE_CODE	60
-#define SIM_GET_TIME_CODE	70
-#define SIM_CALL_TCL		86
-#define SIM_BOGUS_DISK_READ	116
-#define SIM_BOGUS_DISK_WRITE	117
-#define SIM_BOGUS_DISK_INFO	118
-
 static inline int callthru_disk_read(int id, void *buf, unsigned long sect,
 				     unsigned long nrsect)
 {
diff --git a/platforms/mambo/mambo.h b/platforms/mambo/mambo.h
new file mode 100644
index 000000000000..bce3e8704992
--- /dev/null
+++ b/platforms/mambo/mambo.h
@@ -0,0 +1,59 @@
+/* Copyright 2016 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 	http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAMBO_H__
+#define __MAMBO_H__
+
+static inline unsigned long callthru0(int command)
+{
+	register uint64_t c asm("r3") = command;
+	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c));
+	return c;
+}
+
+static inline unsigned long callthru2(int command, unsigned long arg1,
+				      unsigned long arg2)
+{
+	register unsigned long c asm("r3") = command;
+	register unsigned long a1 asm("r4") = arg1;
+	register unsigned long a2 asm("r5") = arg2;
+	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c), "r"(a1), "r"(a2));
+	return c;
+}
+
+static inline unsigned long callthru3(int command, unsigned long arg1,
+				      unsigned long arg2, unsigned long arg3)
+{
+	register unsigned long c asm("r3") = command;
+	register unsigned long a1 asm("r4") = arg1;
+	register unsigned long a2 asm("r5") = arg2;
+	register unsigned long a3 asm("r6") = arg3;
+	asm volatile (".long 0x000eaeb0":"=r" (c):"r"(c), "r"(a1), "r"(a2),
+		      "r"(a3));
+	return c;
+}
+
+/* Mambo callthru commands */
+#define SIM_WRITE_CONSOLE_CODE	0
+#define SIM_EXIT_CODE		31
+#define SIM_READ_CONSOLE_CODE	60
+#define SIM_GET_TIME_CODE	70
+#define SIM_CALL_TCL		86
+#define SIM_BOGUS_DISK_READ	116
+#define SIM_BOGUS_DISK_WRITE	117
+#define SIM_BOGUS_DISK_INFO	118
+
+#endif /* __MAMBO_H__ */
-- 
2.7.4



More information about the Skiboot mailing list