diff options
author | Michael Neuling <mikey@neuling.org> | 2016-11-02 18:07:37 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-11-02 18:24:09 +1100 |
commit | 76c5eb99a6e8356ffd7479ec810d48c466dd6907 (patch) | |
tree | 9a6a7f41b88928f344b6f1c0cbdc5b789526e016 | |
parent | e6f180d10a6f09f9dcde28629a691debf2284169 (diff) | |
download | skiboot-76c5eb99a6e8356ffd7479ec810d48c466dd6907.zip skiboot-76c5eb99a6e8356ffd7479ec810d48c466dd6907.tar.gz skiboot-76c5eb99a6e8356ffd7479ec810d48c466dd6907.tar.bz2 |
mambo: Convert console read/write from asm to C
Also changes the function name:
mambo_read/write() -> mambo_console_read/write()
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | asm/misc.S | 18 | ||||
-rw-r--r-- | core/console.c | 6 | ||||
-rw-r--r-- | include/console.h | 4 | ||||
-rw-r--r-- | platforms/mambo/mambo.c | 12 |
4 files changed, 17 insertions, 23 deletions
@@ -51,24 +51,6 @@ _mcount: b __mcount_stack_check #endif -.global mambo_read -mambo_read: -#define SIM_READ_CONSOLE_CODE 60 - li %r3,SIM_READ_CONSOLE_CODE - .long 0x000eaeb0 - extsw %r3,%r3 - blr - -.global mambo_write -mambo_write: -#define SIM_WRITE_CONSOLE_CODE 0 - li %r6,0 - mr %r5,%r4 - mr %r4,%r3 - li %r3,SIM_WRITE_CONSOLE_CODE - .long 0x000eaeb0 - blr - .global mambo_get_time mambo_get_time: #define SIM_GET_TIME_CODE 70 diff --git a/core/console.c b/core/console.c index 1bdb0a7..f76ed40 100644 --- a/core/console.c +++ b/core/console.c @@ -67,7 +67,7 @@ static int mambo_char = -1; static bool mambo_con_poll_read(void) { if (mambo_char < 0) - mambo_char = mambo_read(); + mambo_char = mambo_console_read(); return mambo_char >= 0; } @@ -87,7 +87,7 @@ static size_t mambo_con_read(char *buf, size_t len) static size_t mambo_con_write(const char *buf, size_t len) { - mambo_write(buf, len); + mambo_console_write(buf, len); return len; } @@ -243,7 +243,7 @@ static size_t inmem_read(char *buf, size_t req) static void write_char(char c) { #ifdef MAMBO_DEBUG_CONSOLE - mambo_write(&c, 1); + mambo_console_write(&c, 1); #endif inmem_write(c); } diff --git a/include/console.h b/include/console.h index b6fc8bf..5cb1227 100644 --- a/include/console.h +++ b/include/console.h @@ -64,8 +64,8 @@ extern void set_console(struct con_ops *driver); extern void console_complete_flush(void); -extern int mambo_read(void); -extern void mambo_write(const char *buf, size_t count); +extern int mambo_console_read(void); +extern void mambo_console_write(const char *buf, size_t count); extern void enable_mambo_console(void); ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count); diff --git a/platforms/mambo/mambo.c b/platforms/mambo/mambo.c index 5207ecb..5eaa52f 100644 --- a/platforms/mambo/mambo.c +++ b/platforms/mambo/mambo.c @@ -96,7 +96,9 @@ static inline unsigned long callthru3(int command, unsigned long arg1, #define BD_SECT_SZ 512 +#define SIM_WRITE_CONSOLE_CODE 0 #define SIM_EXIT_CODE 31 +#define SIM_READ_CONSOLE_CODE 60 #define BOGUS_DISK_READ 116 #define BOGUS_DISK_WRITE 117 #define BOGUS_DISK_INFO 118 @@ -247,6 +249,16 @@ static void bogus_disk_flash_init(void) } } +int mambo_console_read(void) +{ + return callthru0(SIM_READ_CONSOLE_CODE); +} + +void mambo_console_write(const char *buf, size_t count) +{ + callthru2(SIM_WRITE_CONSOLE_CODE, (unsigned long)buf, count); +} + static void mambo_platform_init(void) { force_dummy_console(); |