Skip to content

Commit 7b74b2b

Browse files
shiqingglijinxia
authored andcommitted
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 <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 649d0e3 commit 7b74b2b

File tree

3 files changed

+42
-37
lines changed

3 files changed

+42
-37
lines changed

hypervisor/debug/console.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,13 @@ void console_setup_timer(void)
6363
pr_err("Failed to add console kick timer");
6464
}
6565
}
66+
67+
void suspend_console(void)
68+
{
69+
del_timer(&console_timer);
70+
}
71+
72+
void resume_console(void)
73+
{
74+
console_setup_timer();
75+
}

hypervisor/include/debug/console.h

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
/* Switching key combinations for shell and uart console */
1111
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
1212

13-
#ifdef HV_DEBUG
14-
extern struct hv_timer console_timer;
15-
1613
/** Initializes the console module.
1714
*
1815
*/
19-
2016
void console_init(void);
2117

2218
/** Writes a given number of characters to the console.
@@ -27,7 +23,6 @@ void console_init(void);
2723
* @return The number of characters written or -1 if an error occurred
2824
* and no character was written.
2925
*/
30-
3126
size_t console_write(const char *s, size_t len);
3227

3328
/** Writes a single character to the console.
@@ -37,46 +32,16 @@ size_t console_write(const char *s, size_t len);
3732
* @preturn The number of characters written or -1 if an error
3833
* occurred before any character was written.
3934
*/
40-
4135
void console_putc(const char *ch);
4236
char console_getc(void);
4337

4438
void console_setup_timer(void);
45-
46-
static inline void suspend_console(void)
47-
{
48-
del_timer(&console_timer);
49-
}
50-
51-
static inline void resume_console(void)
52-
{
53-
console_setup_timer();
54-
}
5539
void uart16550_set_property(bool enabled, bool port_mapped, uint64_t base_addr);
5640

5741
void shell_init(void);
5842
void shell_kick(void);
5943

60-
#else
61-
static inline void console_init(void)
62-
{
63-
}
64-
65-
static inline size_t console_write(__unused const char *str,
66-
__unused size_t len)
67-
{
68-
return 0;
69-
}
70-
static inline void console_putc(__unused const char *ch) { }
71-
static inline char console_getc(void) { return '\0'; }
72-
static inline void console_setup_timer(void) {}
73-
static inline void suspend_console(void) {}
74-
static inline void resume_console(void) {}
75-
static inline void uart16550_set_property(__unused bool enabled,
76-
__unused bool port_mapped, __unused uint64_t base_addr) {}
77-
78-
static inline void shell_init(void) {}
79-
static inline void shell_kick(void) {}
80-
#endif
44+
void suspend_console(void);
45+
void resume_console(void);
8146

8247
#endif /* CONSOLE_H */

hypervisor/release/console.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#include <hypervisor.h>
8+
9+
size_t console_write(__unused const char *str, __unused size_t len)
10+
{
11+
return 0;
12+
}
13+
14+
char console_getc(void)
15+
{
16+
return '\0';
17+
}
18+
19+
void console_putc(__unused const char *ch) {}
20+
21+
void console_init(void) {}
22+
void console_setup_timer(void) {}
23+
24+
void suspend_console(void) {}
25+
void resume_console(void) {}
26+
27+
void uart16550_set_property(__unused bool enabled, __unused bool port_mapped, __unused uint64_t base_addr) {}
28+
29+
void shell_init(void) {}
30+
void shell_kick(void) {}

0 commit comments

Comments
 (0)