Revision aee1b935 vl.c
b/vl.c | ||
---|---|---|
270 | 270 |
|
271 | 271 |
static int default_serial = 1; |
272 | 272 |
static int default_parallel = 1; |
273 |
static int default_virtcon = 0; |
|
273 | 274 |
static int default_monitor = 1; |
274 | 275 |
static int default_vga = 1; |
275 | 276 |
static int default_drive = 1; |
... | ... | |
280 | 281 |
} default_list[] = { |
281 | 282 |
{ .driver = "isa-serial", .flag = &default_serial }, |
282 | 283 |
{ .driver = "isa-parallel", .flag = &default_parallel }, |
284 |
{ .driver = "virtio-console-pci", .flag = &default_virtcon }, |
|
285 |
{ .driver = "virtio-console-s390", .flag = &default_virtcon }, |
|
283 | 286 |
{ .driver = "VGA", .flag = &default_vga }, |
284 | 287 |
{ .driver = "Cirrus VGA", .flag = &default_vga }, |
285 | 288 |
{ .driver = "QEMUware SVGA", .flag = &default_vga }, |
... | ... | |
4699 | 4702 |
|
4700 | 4703 |
struct device_config { |
4701 | 4704 |
enum { |
4702 |
DEV_USB, /* -usbdevice */ |
|
4703 |
DEV_BT, /* -bt */ |
|
4704 |
DEV_SERIAL, /* -serial */ |
|
4705 |
DEV_PARALLEL, /* -parallel */ |
|
4705 |
DEV_USB, /* -usbdevice */ |
|
4706 |
DEV_BT, /* -bt */ |
|
4707 |
DEV_SERIAL, /* -serial */ |
|
4708 |
DEV_PARALLEL, /* -parallel */ |
|
4709 |
DEV_VIRTCON, /* -virtioconsole */ |
|
4706 | 4710 |
} type; |
4707 | 4711 |
const char *cmdline; |
4708 | 4712 |
QTAILQ_ENTRY(device_config) next; |
... | ... | |
4778 | 4782 |
return 0; |
4779 | 4783 |
} |
4780 | 4784 |
|
4785 |
static int virtcon_parse(const char *devname) |
|
4786 |
{ |
|
4787 |
static int index = 0; |
|
4788 |
char label[32]; |
|
4789 |
|
|
4790 |
if (strcmp(devname, "none") == 0) |
|
4791 |
return 0; |
|
4792 |
if (index == MAX_VIRTIO_CONSOLES) { |
|
4793 |
fprintf(stderr, "qemu: too many virtio consoles\n"); |
|
4794 |
exit(1); |
|
4795 |
} |
|
4796 |
snprintf(label, sizeof(label), "virtcon%d", index); |
|
4797 |
virtcon_hds[index] = qemu_chr_open(label, devname, NULL); |
|
4798 |
if (!virtcon_hds[index]) { |
|
4799 |
fprintf(stderr, "qemu: could not open virtio console '%s': %s\n", |
|
4800 |
devname, strerror(errno)); |
|
4801 |
return -1; |
|
4802 |
} |
|
4803 |
index++; |
|
4804 |
return 0; |
|
4805 |
} |
|
4806 |
|
|
4781 | 4807 |
int main(int argc, char **argv, char **envp) |
4782 | 4808 |
{ |
4783 | 4809 |
const char *gdbstub_dev = NULL; |
... | ... | |
4793 | 4819 |
QemuOpts *hda_opts = NULL, *opts; |
4794 | 4820 |
int optind; |
4795 | 4821 |
const char *r, *optarg; |
4796 |
const char *virtio_consoles[MAX_VIRTIO_CONSOLES]; |
|
4797 |
int virtio_console_index; |
|
4798 | 4822 |
const char *loadvm = NULL; |
4799 | 4823 |
QEMUMachine *machine; |
4800 | 4824 |
const char *cpu_model; |
... | ... | |
4860 | 4884 |
cyls = heads = secs = 0; |
4861 | 4885 |
translation = BIOS_ATA_TRANSLATION_AUTO; |
4862 | 4886 |
|
4863 |
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) |
|
4864 |
virtio_consoles[i] = NULL; |
|
4865 |
virtio_console_index = 0; |
|
4866 |
|
|
4867 | 4887 |
for (i = 0; i < MAX_NODES; i++) { |
4868 | 4888 |
node_mem[i] = 0; |
4869 | 4889 |
node_cpumask[i] = 0; |
... | ... | |
5322 | 5342 |
} |
5323 | 5343 |
break; |
5324 | 5344 |
case QEMU_OPTION_virtiocon: |
5325 |
if (virtio_console_index >= MAX_VIRTIO_CONSOLES) { |
|
5326 |
fprintf(stderr, "qemu: too many virtio consoles\n"); |
|
5327 |
exit(1); |
|
5328 |
} |
|
5329 |
virtio_consoles[virtio_console_index] = optarg; |
|
5330 |
virtio_console_index++; |
|
5345 |
add_device_config(DEV_VIRTCON, optarg); |
|
5346 |
default_virtcon = 0; |
|
5331 | 5347 |
break; |
5332 | 5348 |
case QEMU_OPTION_parallel: |
5333 | 5349 |
add_device_config(DEV_PARALLEL, optarg); |
... | ... | |
5527 | 5543 |
case QEMU_OPTION_nodefaults: |
5528 | 5544 |
default_serial = 0; |
5529 | 5545 |
default_parallel = 0; |
5546 |
default_virtcon = 0; |
|
5530 | 5547 |
default_monitor = 0; |
5531 | 5548 |
default_vga = 0; |
5532 | 5549 |
default_net = 0; |
... | ... | |
5830 | 5847 |
exit(1); |
5831 | 5848 |
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0) |
5832 | 5849 |
exit(1); |
5833 |
|
|
5834 |
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { |
|
5835 |
const char *devname = virtio_consoles[i]; |
|
5836 |
if (devname && strcmp(devname, "none")) { |
|
5837 |
char label[32]; |
|
5838 |
snprintf(label, sizeof(label), "virtcon%d", i); |
|
5839 |
virtcon_hds[i] = qemu_chr_open(label, devname, NULL); |
|
5840 |
if (!virtcon_hds[i]) { |
|
5841 |
fprintf(stderr, "qemu: could not open virtio console '%s': %s\n", |
|
5842 |
devname, strerror(errno)); |
|
5843 |
exit(1); |
|
5844 |
} |
|
5845 |
} |
|
5846 |
} |
|
5850 |
if (foreach_device_config(DEV_VIRTCON, virtcon_parse) < 0) |
|
5851 |
exit(1); |
|
5847 | 5852 |
|
5848 | 5853 |
module_call_init(MODULE_INIT_DEVICE); |
5849 | 5854 |
|
Also available in: Unified diff