Revision 6a5e8b0e vl.c
b/vl.c | ||
---|---|---|
272 | 272 |
static void *boot_set_opaque; |
273 | 273 |
|
274 | 274 |
static int default_serial = 1; |
275 |
static int default_parallel = 1; |
|
275 | 276 |
|
276 | 277 |
static struct { |
277 | 278 |
const char *driver; |
278 | 279 |
int *flag; |
279 | 280 |
} default_list[] = { |
280 |
{ .driver = "isa-serial", .flag = &default_serial }, |
|
281 |
{ .driver = "isa-serial", .flag = &default_serial }, |
|
282 |
{ .driver = "isa-parallel", .flag = &default_parallel }, |
|
281 | 283 |
}; |
282 | 284 |
|
283 | 285 |
static int default_driver_check(QemuOpts *opts, void *opaque) |
... | ... | |
4625 | 4627 |
DEV_USB, /* -usbdevice */ |
4626 | 4628 |
DEV_BT, /* -bt */ |
4627 | 4629 |
DEV_SERIAL, /* -serial */ |
4630 |
DEV_PARALLEL, /* -parallel */ |
|
4628 | 4631 |
} type; |
4629 | 4632 |
const char *cmdline; |
4630 | 4633 |
QTAILQ_ENTRY(device_config) next; |
... | ... | |
4700 | 4703 |
return 0; |
4701 | 4704 |
} |
4702 | 4705 |
|
4706 |
static int parallel_parse(const char *devname) |
|
4707 |
{ |
|
4708 |
static int index = 0; |
|
4709 |
char label[32]; |
|
4710 |
|
|
4711 |
if (strcmp(devname, "none") == 0) |
|
4712 |
return 0; |
|
4713 |
if (index == MAX_PARALLEL_PORTS) { |
|
4714 |
fprintf(stderr, "qemu: too many parallel ports\n"); |
|
4715 |
exit(1); |
|
4716 |
} |
|
4717 |
snprintf(label, sizeof(label), "parallel%d", index); |
|
4718 |
parallel_hds[index] = qemu_chr_open(label, devname, NULL); |
|
4719 |
if (!parallel_hds[index]) { |
|
4720 |
fprintf(stderr, "qemu: could not open parallel device '%s': %s\n", |
|
4721 |
devname, strerror(errno)); |
|
4722 |
return -1; |
|
4723 |
} |
|
4724 |
index++; |
|
4725 |
return 0; |
|
4726 |
} |
|
4727 |
|
|
4703 | 4728 |
int main(int argc, char **argv, char **envp) |
4704 | 4729 |
{ |
4705 | 4730 |
const char *gdbstub_dev = NULL; |
... | ... | |
4718 | 4743 |
CharDriverState *monitor_hds[MAX_MONITOR_DEVICES]; |
4719 | 4744 |
const char *monitor_devices[MAX_MONITOR_DEVICES]; |
4720 | 4745 |
int monitor_device_index; |
4721 |
const char *parallel_devices[MAX_PARALLEL_PORTS]; |
|
4722 |
int parallel_device_index; |
|
4723 | 4746 |
const char *virtio_consoles[MAX_VIRTIO_CONSOLES]; |
4724 | 4747 |
int virtio_console_index; |
4725 | 4748 |
const char *loadvm = NULL; |
... | ... | |
4787 | 4810 |
cyls = heads = secs = 0; |
4788 | 4811 |
translation = BIOS_ATA_TRANSLATION_AUTO; |
4789 | 4812 |
|
4790 |
parallel_devices[0] = "vc:80Cx24C"; |
|
4791 |
for(i = 1; i < MAX_PARALLEL_PORTS; i++) |
|
4792 |
parallel_devices[i] = NULL; |
|
4793 |
parallel_device_index = 0; |
|
4794 |
|
|
4795 | 4813 |
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) |
4796 | 4814 |
virtio_consoles[i] = NULL; |
4797 | 4815 |
virtio_console_index = 0; |
... | ... | |
5260 | 5278 |
virtio_console_index++; |
5261 | 5279 |
break; |
5262 | 5280 |
case QEMU_OPTION_parallel: |
5263 |
if (parallel_device_index >= MAX_PARALLEL_PORTS) { |
|
5264 |
fprintf(stderr, "qemu: too many parallel ports\n"); |
|
5265 |
exit(1); |
|
5266 |
} |
|
5267 |
parallel_devices[parallel_device_index] = optarg; |
|
5268 |
parallel_device_index++; |
|
5281 |
add_device_config(DEV_PARALLEL, optarg); |
|
5282 |
default_parallel = 0; |
|
5269 | 5283 |
break; |
5270 | 5284 |
case QEMU_OPTION_loadvm: |
5271 | 5285 |
loadvm = optarg; |
... | ... | |
5541 | 5555 |
if (display_type == DT_NOGRAPHIC) { |
5542 | 5556 |
if (default_serial) |
5543 | 5557 |
add_device_config(DEV_SERIAL, "stdio"); |
5544 |
if (parallel_device_index == 0)
|
|
5545 |
parallel_devices[0] = "null";
|
|
5558 |
if (default_parallel)
|
|
5559 |
add_device_config(DEV_PARALLEL, "null");
|
|
5546 | 5560 |
if (strncmp(monitor_devices[0], "vc", 2) == 0) { |
5547 | 5561 |
monitor_devices[0] = "stdio"; |
5548 | 5562 |
} |
5549 | 5563 |
} else { |
5550 | 5564 |
if (default_serial) |
5551 | 5565 |
add_device_config(DEV_SERIAL, "vc:80Cx24C"); |
5566 |
if (default_parallel) |
|
5567 |
add_device_config(DEV_PARALLEL, "vc:80Cx24C"); |
|
5552 | 5568 |
} |
5553 | 5569 |
|
5554 | 5570 |
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0) |
... | ... | |
5764 | 5780 |
|
5765 | 5781 |
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0) |
5766 | 5782 |
exit(1); |
5767 |
|
|
5768 |
for(i = 0; i < MAX_PARALLEL_PORTS; i++) { |
|
5769 |
const char *devname = parallel_devices[i]; |
|
5770 |
if (devname && strcmp(devname, "none")) { |
|
5771 |
char label[32]; |
|
5772 |
snprintf(label, sizeof(label), "parallel%d", i); |
|
5773 |
parallel_hds[i] = qemu_chr_open(label, devname, NULL); |
|
5774 |
if (!parallel_hds[i]) { |
|
5775 |
fprintf(stderr, "qemu: could not open parallel device '%s': %s\n", |
|
5776 |
devname, strerror(errno)); |
|
5777 |
exit(1); |
|
5778 |
} |
|
5779 |
} |
|
5780 |
} |
|
5783 |
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0) |
|
5784 |
exit(1); |
|
5781 | 5785 |
|
5782 | 5786 |
for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { |
5783 | 5787 |
const char *devname = virtio_consoles[i]; |
Also available in: Unified diff