mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 22:18:17 +00:00
DM: add deinit function for bvmcons
Move the bvmcons enable flag from main.c to consport.c. So we don't need the flag in main.c for bvmcons. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
86d2c137a8
commit
70ef778d94
@ -43,6 +43,7 @@
|
||||
#define BVM_CONSOLE_PORT 0x220
|
||||
#define BVM_CONS_SIG ('b' << 8 | 'v')
|
||||
|
||||
static bool bvmcons_enabled = false;
|
||||
static struct termios tio_orig, tio_new;
|
||||
|
||||
static void
|
||||
@ -147,7 +148,23 @@ static struct inout_port consport = {
|
||||
};
|
||||
|
||||
void
|
||||
enable_bvmcons(void)
|
||||
{
|
||||
bvmcons_enabled = true;
|
||||
}
|
||||
|
||||
int
|
||||
init_bvmcons(void)
|
||||
{
|
||||
register_inout(&consport);
|
||||
if (bvmcons_enabled)
|
||||
register_inout(&consport);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
deinit_bvmcons(void)
|
||||
{
|
||||
if (bvmcons_enabled)
|
||||
unregister_inout(&consport);
|
||||
}
|
||||
|
11
core/main.c
11
core/main.c
@ -585,7 +585,7 @@ static struct option long_options[] = {
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c, error, gdb_port, err, bvmcons;
|
||||
int c, error, gdb_port, err;
|
||||
int max_vcpus, mptgen, memflags;
|
||||
int rtc_localtime;
|
||||
struct vmctx *ctx;
|
||||
@ -593,7 +593,6 @@ main(int argc, char *argv[])
|
||||
char *optstr;
|
||||
int option_idx = 0;
|
||||
|
||||
bvmcons = 0;
|
||||
progname = basename(argv[0]);
|
||||
gdb_port = 0;
|
||||
guest_ncpus = 1;
|
||||
@ -617,7 +616,7 @@ main(int argc, char *argv[])
|
||||
acpi = 1;
|
||||
break;
|
||||
case 'b':
|
||||
bvmcons = 1;
|
||||
enable_bvmcons();
|
||||
break;
|
||||
case 'p':
|
||||
if (pincpu_parse(optarg) != 0) {
|
||||
@ -793,6 +792,7 @@ main(int argc, char *argv[])
|
||||
|
||||
vrtc_init(ctx, rtc_localtime);
|
||||
sci_init(ctx);
|
||||
init_bvmcons();
|
||||
monitor_init(ctx);
|
||||
|
||||
/*
|
||||
@ -806,9 +806,6 @@ main(int argc, char *argv[])
|
||||
if (gdb_port != 0)
|
||||
fprintf(stderr, "dbgport not supported\n");
|
||||
|
||||
if (bvmcons)
|
||||
init_bvmcons();
|
||||
|
||||
/*
|
||||
* build the guest tables, MP etc.
|
||||
*/
|
||||
@ -860,6 +857,7 @@ main(int argc, char *argv[])
|
||||
pci_irq_deinit(ctx);
|
||||
deinit_pci(ctx);
|
||||
monitor_close();
|
||||
deinit_bvmcons();
|
||||
vrtc_deinit(ctx);
|
||||
atkbdc_deinit(ctx);
|
||||
vm_unsetup_memory(ctx);
|
||||
@ -875,6 +873,7 @@ vm_fail:
|
||||
deinit_pci(ctx);
|
||||
pci_fail:
|
||||
monitor_close();
|
||||
deinit_bvmcons();
|
||||
vrtc_deinit(ctx);
|
||||
atkbdc_deinit(ctx);
|
||||
mevent_fail:
|
||||
|
@ -75,6 +75,8 @@ int emulate_inout(struct vmctx *ctx, int *pvcpu, struct pio_request *req,
|
||||
int strict);
|
||||
int register_inout(struct inout_port *iop);
|
||||
int unregister_inout(struct inout_port *iop);
|
||||
void init_bvmcons(void);
|
||||
int init_bvmcons(void);
|
||||
void deinit_bvmcons(void);
|
||||
void enable_bvmcons(void);
|
||||
|
||||
#endif /* _INOUT_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user