mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +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_CONSOLE_PORT 0x220
|
||||||
#define BVM_CONS_SIG ('b' << 8 | 'v')
|
#define BVM_CONS_SIG ('b' << 8 | 'v')
|
||||||
|
|
||||||
|
static bool bvmcons_enabled = false;
|
||||||
static struct termios tio_orig, tio_new;
|
static struct termios tio_orig, tio_new;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -147,7 +148,23 @@ static struct inout_port consport = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
enable_bvmcons(void)
|
||||||
|
{
|
||||||
|
bvmcons_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
init_bvmcons(void)
|
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
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c, error, gdb_port, err, bvmcons;
|
int c, error, gdb_port, err;
|
||||||
int max_vcpus, mptgen, memflags;
|
int max_vcpus, mptgen, memflags;
|
||||||
int rtc_localtime;
|
int rtc_localtime;
|
||||||
struct vmctx *ctx;
|
struct vmctx *ctx;
|
||||||
@ -593,7 +593,6 @@ main(int argc, char *argv[])
|
|||||||
char *optstr;
|
char *optstr;
|
||||||
int option_idx = 0;
|
int option_idx = 0;
|
||||||
|
|
||||||
bvmcons = 0;
|
|
||||||
progname = basename(argv[0]);
|
progname = basename(argv[0]);
|
||||||
gdb_port = 0;
|
gdb_port = 0;
|
||||||
guest_ncpus = 1;
|
guest_ncpus = 1;
|
||||||
@ -617,7 +616,7 @@ main(int argc, char *argv[])
|
|||||||
acpi = 1;
|
acpi = 1;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
bvmcons = 1;
|
enable_bvmcons();
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (pincpu_parse(optarg) != 0) {
|
if (pincpu_parse(optarg) != 0) {
|
||||||
@ -793,6 +792,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
vrtc_init(ctx, rtc_localtime);
|
vrtc_init(ctx, rtc_localtime);
|
||||||
sci_init(ctx);
|
sci_init(ctx);
|
||||||
|
init_bvmcons();
|
||||||
monitor_init(ctx);
|
monitor_init(ctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -806,9 +806,6 @@ main(int argc, char *argv[])
|
|||||||
if (gdb_port != 0)
|
if (gdb_port != 0)
|
||||||
fprintf(stderr, "dbgport not supported\n");
|
fprintf(stderr, "dbgport not supported\n");
|
||||||
|
|
||||||
if (bvmcons)
|
|
||||||
init_bvmcons();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build the guest tables, MP etc.
|
* build the guest tables, MP etc.
|
||||||
*/
|
*/
|
||||||
@ -860,6 +857,7 @@ main(int argc, char *argv[])
|
|||||||
pci_irq_deinit(ctx);
|
pci_irq_deinit(ctx);
|
||||||
deinit_pci(ctx);
|
deinit_pci(ctx);
|
||||||
monitor_close();
|
monitor_close();
|
||||||
|
deinit_bvmcons();
|
||||||
vrtc_deinit(ctx);
|
vrtc_deinit(ctx);
|
||||||
atkbdc_deinit(ctx);
|
atkbdc_deinit(ctx);
|
||||||
vm_unsetup_memory(ctx);
|
vm_unsetup_memory(ctx);
|
||||||
@ -875,6 +873,7 @@ vm_fail:
|
|||||||
deinit_pci(ctx);
|
deinit_pci(ctx);
|
||||||
pci_fail:
|
pci_fail:
|
||||||
monitor_close();
|
monitor_close();
|
||||||
|
deinit_bvmcons();
|
||||||
vrtc_deinit(ctx);
|
vrtc_deinit(ctx);
|
||||||
atkbdc_deinit(ctx);
|
atkbdc_deinit(ctx);
|
||||||
mevent_fail:
|
mevent_fail:
|
||||||
|
@ -75,6 +75,8 @@ int emulate_inout(struct vmctx *ctx, int *pvcpu, struct pio_request *req,
|
|||||||
int strict);
|
int strict);
|
||||||
int register_inout(struct inout_port *iop);
|
int register_inout(struct inout_port *iop);
|
||||||
int unregister_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_ */
|
#endif /* _INOUT_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user