]> git.proxmox.com Git - qemu.git/blobdiff - hw/xen_console.c
ds1225y: convert to qdev device, and use it in MIPS Jazz emulation
[qemu.git] / hw / xen_console.c
index c6c81638135baa924722f9f7e0d5099a42bcfbad..8ef104c9acdcb83fcea4cc2028814c2328348034 100644 (file)
@@ -179,7 +179,9 @@ static void xencons_send(struct XenConsole *con)
 static int con_init(struct XenDevice *xendev)
 {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
-    char *type, *dom;
+    char *type, *dom, label[32];
+    int ret = 0;
+    const char *output;
 
     /* setup */
     dom = xs_get_domain_path(xenstore, con->xendev.dom);
@@ -189,16 +191,25 @@ static int con_init(struct XenDevice *xendev)
     type = xenstore_read_str(con->console, "type");
     if (!type || strcmp(type, "ioemu") != 0) {
        xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);
-       return -1;
+        ret = -1;
+        goto out;
     }
 
-    if (!serial_hds[con->xendev.dev])
-       xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n",
-                      con->xendev.dev);
-    else
+    output = xenstore_read_str(con->console, "output");
+
+    /* no Xen override, use qemu output device */
+    if (output == NULL) {
         con->chr = serial_hds[con->xendev.dev];
+    } else {
+        snprintf(label, sizeof(label), "xencons%d", con->xendev.dev);
+        con->chr = qemu_chr_open(label, output, NULL);
+    }
 
-    return 0;
+    xenstore_store_pv_console_info(con->xendev.dev, con->chr);
+
+out:
+    qemu_free(type);
+    return ret;
 }
 
 static int con_connect(struct XenDevice *xendev)