From 7b74b2b909541a852699e1a6cbbd50273ff71adc Mon Sep 17 00:00:00 2001 From: Shiqing Gao Date: Tue, 27 Nov 2018 14:54:30 +0800 Subject: [PATCH] hv: clean up function definitions in console.h seperate the function definitions into debug/release directories to better distinguish debug/release libraries Tracked-On: #861 Signed-off-by: Shiqing Gao Acked-by: Eddie Dong --- hypervisor/debug/console.c | 10 ++++++++ hypervisor/include/debug/console.h | 39 ++---------------------------- hypervisor/release/console.c | 30 +++++++++++++++++++++++ 3 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 hypervisor/release/console.c diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index 230717bcc..6f00aeb38 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -63,3 +63,13 @@ void console_setup_timer(void) pr_err("Failed to add console kick timer"); } } + +void suspend_console(void) +{ + del_timer(&console_timer); +} + +void resume_console(void) +{ + console_setup_timer(); +} diff --git a/hypervisor/include/debug/console.h b/hypervisor/include/debug/console.h index cae0b4420..90af4e53c 100644 --- a/hypervisor/include/debug/console.h +++ b/hypervisor/include/debug/console.h @@ -10,13 +10,9 @@ /* Switching key combinations for shell and uart console */ #define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */ -#ifdef HV_DEBUG -extern struct hv_timer console_timer; - /** Initializes the console module. * */ - void console_init(void); /** Writes a given number of characters to the console. @@ -27,7 +23,6 @@ void console_init(void); * @return The number of characters written or -1 if an error occurred * and no character was written. */ - size_t console_write(const char *s, size_t len); /** Writes a single character to the console. @@ -37,46 +32,16 @@ size_t console_write(const char *s, size_t len); * @preturn The number of characters written or -1 if an error * occurred before any character was written. */ - void console_putc(const char *ch); char console_getc(void); void console_setup_timer(void); - -static inline void suspend_console(void) -{ - del_timer(&console_timer); -} - -static inline void resume_console(void) -{ - console_setup_timer(); -} void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr); void shell_init(void); void shell_kick(void); -#else -static inline void console_init(void) -{ -} - -static inline size_t console_write(__unused const char *str, - __unused size_t len) -{ - return 0; -} -static inline void console_putc(__unused const char *ch) { } -static inline char console_getc(void) { return '\0'; } -static inline void console_setup_timer(void) {} -static inline void suspend_console(void) {} -static inline void resume_console(void) {} -static inline void uart16550_set_property(__unused bool enabled, - __unused bool port_mapped, __unused uint64_t base_addr) {} - -static inline void shell_init(void) {} -static inline void shell_kick(void) {} -#endif +void suspend_console(void); +void resume_console(void); #endif /* CONSOLE_H */ diff --git a/hypervisor/release/console.c b/hypervisor/release/console.c new file mode 100644 index 000000000..a8b672af8 --- /dev/null +++ b/hypervisor/release/console.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +size_t console_write(__unused const char *str, __unused size_t len) +{ + return 0; +} + +char console_getc(void) +{ + return '\0'; +} + +void console_putc(__unused const char *ch) {} + +void console_init(void) {} +void console_setup_timer(void) {} + +void suspend_console(void) {} +void resume_console(void) {} + +void uart16550_set_property(__unused bool enabled, __unused bool port_mapped, __unused uint64_t base_addr) {} + +void shell_init(void) {} +void shell_kick(void) {}