DM: add option to show which virtio-blk is boot device.

Now, we could use option:
 -s 3,virtio-blk,/XXXX_vdisk_file,b
to show this virtio device is boot device for guest.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yin Fengwei 2018-03-21 16:09:15 +08:00 committed by Jack Ren
parent 53b89b91de
commit 0d9d628d9a
1 changed files with 13 additions and 1 deletions

View File

@ -48,6 +48,7 @@
#include "pci_core.h"
#include "irq.h"
#include "lpc.h"
#include "sw_load.h"
#define CONF1_ADDR_PORT 0x0cf8
#define CONF1_DATA_PORT 0x0cfc
@ -161,7 +162,7 @@ pci_parse_slot(char *opt)
{
struct businfo *bi;
struct slotinfo *si;
char *emul, *config, *str, *cp;
char *emul, *config, *str, *cp, *b = NULL;
int error, bnum, snum, fnum;
error = -1;
@ -180,6 +181,11 @@ pci_parse_slot(char *opt)
if (cp != NULL) {
*cp = '\0';
config = cp + 1;
cp = strchr(config, ',');
if (cp != NULL) {
*cp = '\0';
b = cp + 1;
}
}
} else {
pci_parse_slot_usage(opt);
@ -227,6 +233,12 @@ pci_parse_slot(char *opt)
/* saved fi param in case reboot */
si->si_funcs[fnum].fi_param_saved = config;
if (b != NULL) {
if ((strcmp("virtio-blk", emul) == 0) && (b != NULL) &&
(strchr(b, 'b') != NULL)) {
vsbl_set_bdf(bnum, snum, fnum);
}
}
done:
if (error)
free(str);