static int con_init(struct XenDevice *xendev)
{
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
- char *type, *dom;
+ char *type, *dom, *output, label[32];
/* setup */
dom = xs_get_domain_path(xenstore, con->xendev.dom);
}
qemu_free(type);
- if (!serial_hds[con->xendev.dev])
- xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n",
- con->xendev.dev);
- else
- con->chr = serial_hds[con->xendev.dev];
+ output = xenstore_read_str(con->console, "output");
+ /* output is a pty by default */
+ if (output == NULL)
+ output = "pty";
+ snprintf(label, sizeof(label), "xencons%d", con->xendev.dev);
+ con->chr = qemu_chr_open(label, output, NULL);
+ xenstore_store_pv_console_info(con->xendev.dev, con->chr, output);
return 0;
}
#include "exec-all.h"
#include "qemu-xen.h"
#include "qemu-aio.h"
+#include "xen_backend.h"
#include <xen/hvm/params.h>
#include <sys/mman.h>
timeoffset_get();
+ /* Initialize backend core & drivers */
+ if (xen_be_init() != 0) {
+ fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
+ exit(1);
+ }
+ xen_be_register("console", &xen_console_ops);
pc_machine.init(ram_size, vga_ram_size, boot_device,
kernel_filename, kernel_cmdline, initrd_filename,
struct CharDriverState;
void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
const char *devname);
+void xenstore_store_pv_console_info(int i, struct CharDriverState *chr,
+ const char *devname);
extern unsigned int xen_logdirty_enable;
snprintf(buf, sizeof(buf), "/serial/%d", i);
store_dev_info(devname, domid, chr, buf);
- if (i == 0) /* serial 0 is also called the console */
- store_dev_info(devname, domid, chr, "/console");
+}
+
+void xenstore_store_pv_console_info(int i, CharDriverState *chr,
+ const char *devname) {
+ char buf[32];
+
+ if (i == 0) {
+ snprintf(buf, sizeof(buf), "/console", i);
+ store_dev_info(devname, domid, chr, buf);
+ } else {
+ snprintf(buf, sizeof(buf), "/device/console/%d", i);
+ store_dev_info(devname, domid, chr, buf);
+ }
}
char *xenstore_dom_read(int domid, const char *key, unsigned int *len)