static void
xc_cnprobe(struct consdev *cp)
{
+#if defined(__arm__)
+ if (!xen_domain())
+ return;
+#else
if (!xen_pv_domain())
return;
+#endif
cp->cn_pri = CN_REMOTE;
sprintf(cp->cn_name, "%s0", driver_name);
{
device_t child;
+#if defined(__arm__)
+ if (!xen_domain())
+ return;
+#else
if (!xen_pv_domain())
return;
+#endif
child = BUS_ADD_CHILD(parent, 0, driver_name, 0);
}
callout_init(&xc_callout, 0);
- xencons_ring_init();
+ error = xencons_ring_init();
+
+ if (error != 0) {
+ printf("xencons: unable to initialize the ring (%d)\n",
+ error);
+ return error;
+ }
cnsl_evt_reg = true;
callout_reset(&xc_callout, XC_POLLTIME, xc_timeout, xccons);
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
printf("xencons: shutdown event registration failed!\n");
+
return (0);
}
#include <sys/bus.h>
#include <sys/cons.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
#include <machine/stdarg.h>
#include <xen/xen-os.h>
#include <dev/xen/console/xencons_ring.h>
#include <xen/evtchn.h>
#include <xen/interface/io/console.h>
+#include <xen/hvm.h>
#define console_evtchn console.domU.evtchn
xen_intr_handle_t console_handle;
};
intf = xencons_interface();
+
+ if (!intf)
+ return 0;
+
cons = intf->out_cons;
prod = intf->out_prod;
sent = 0;
xencons_receiver = f;
}
+/* HVM code */
int
xencons_ring_init(void)
{
int err;
-
- if (HYPERVISOR_start_info->console_evtchn == 0)
- return 0;
-
- err = xen_intr_bind_local_port(xencons_dev,
- HYPERVISOR_start_info->console_evtchn, NULL, xencons_handle_input, NULL,
- INTR_TYPE_MISC | INTR_MPSAFE, &console_handle);
- if (err) {
- return err;
- }
+ evtchn_port_t evtchn;
+ xen_pfn_t pfn;
+
+ if (xen_hvm_domain()) {
+ evtchn = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN);
+ pfn = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN);
+ if (!pfn)
+ return (ENODEV);
+ console_page = xen_pmap(pfn << PAGE_SHIFT, PAGE_SIZE);
+ } else
+ evtchn = HYPERVISOR_start_info->console_evtchn;
+
+ if (!evtchn)
+ return (ENODEV);
+
+ err = xen_intr_bind_local_port(xencons_dev, evtchn, NULL,
+ xencons_handle_input, NULL,
+ INTR_TYPE_MISC | INTR_MPSAFE,
+ &console_handle);
+ if (err != 0)
+ return (err);
+
+ console_page = xen_pmap(pfn << PAGE_SHIFT, PAGE_SIZE);
return 0;
}