Skip to content

Commit feed38f

Browse files
fyin1lijinxia
authored andcommitted
hv: add suspend/resume callback for console
To handle s3 enter/exit for console Signed-off-by: Zheng Gen <gen.zheng@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 8eaf4d2 commit feed38f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

hypervisor/debug/console.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
static spinlock_t lock;
1111

1212
static uint32_t serial_handle = SERIAL_INVALID_HANDLE;
13+
struct timer console_timer;
1314

1415
#define CONSOLE_KICK_TIMER_TIMEOUT 40 /* timeout is 40ms*/
1516

@@ -198,7 +199,6 @@ static int console_timer_callback(__unused void *data)
198199

199200
void console_setup_timer(void)
200201
{
201-
static struct timer console_timer;
202202
uint64_t period_in_cycle, fire_tsc;
203203

204204
if (serial_handle == SERIAL_INVALID_HANDLE) {

hypervisor/include/debug/console.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define CONSOLE_H
99

1010
#ifdef HV_DEBUG
11+
extern struct timer console_timer;
12+
1113
/** Initializes the console module.
1214
*
1315
* @param cdev A pointer to the character device to use for the console.
@@ -62,6 +64,17 @@ void console_dump_bytes(const void *p, unsigned int len);
6264
void console_setup_timer(void);
6365

6466
uint32_t get_serial_handle(void);
67+
68+
static inline void suspend_console(void)
69+
{
70+
del_timer(&console_timer);
71+
}
72+
73+
static inline void resume_console_enable(void)
74+
{
75+
console_setup_timer();
76+
}
77+
6578
#else
6679
static inline int console_init(void)
6780
{
@@ -86,6 +99,9 @@ static inline void console_dump_bytes(__unused const void *p,
8699
}
87100
static inline void console_setup_timer(void) {}
88101
static inline uint32_t get_serial_handle(void) { return 0; }
102+
103+
void suspend_console(void) {}
104+
void resume_console_enable(void) {}
89105
#endif
90106

91107
#endif /* CONSOLE_H */

0 commit comments

Comments
 (0)