Allow FreeBSD to be booted from CDROM media on XenServer 6.2 and
prior releases. Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Reviewed by: gibbs Approved by: re (gjb) sys/dev/xen/blkfront/blkfront.c: On XenServer versions up to an including 6.2, paravirtualized CDROM support is broken. When running in an HVM domain, ignore paravirtualized instances of CDROM media, and instead rely on native drivers attaching to emulated hardware. This functions correctly on all currently known Xen based platforms.
This commit is contained in:
parent
83b1e9e4bb
commit
7a5016ea2d
@ -1381,14 +1381,42 @@ xbd_closing(device_t dev)
|
||||
static int
|
||||
xbd_probe(device_t dev)
|
||||
{
|
||||
if (strcmp(xenbus_get_type(dev), "vbd") != 0)
|
||||
return (ENXIO);
|
||||
|
||||
if (!strcmp(xenbus_get_type(dev), "vbd")) {
|
||||
device_set_desc(dev, "Virtual Block Device");
|
||||
device_quiet(dev);
|
||||
return (0);
|
||||
if (xen_hvm_domain()) {
|
||||
int error;
|
||||
char *type;
|
||||
|
||||
/*
|
||||
* When running in an HVM domain, IDE disk emulation is
|
||||
* disabled early in boot so that native drivers will
|
||||
* not see emulated hardware. However, CDROM device
|
||||
* emulation cannot be disabled.
|
||||
*
|
||||
* Through use of FreeBSD's vm_guest and xen_hvm_domain()
|
||||
* APIs, we could modify the native CDROM driver to fail its
|
||||
* probe when running under Xen. Unfortunatlely, the PV
|
||||
* CDROM support in XenServer (up through at least version
|
||||
* 6.2) isn't functional, so we instead rely on the emulated
|
||||
* CDROM instance, and fail to attach the PV one here in
|
||||
* the blkfront driver.
|
||||
*/
|
||||
error = xs_read(XST_NIL, xenbus_get_node(dev),
|
||||
"device-type", NULL, (void **) &type);
|
||||
if (error)
|
||||
return (ENXIO);
|
||||
|
||||
if (strncmp(type, "cdrom", 5) == 0) {
|
||||
free(type, M_XENSTORE);
|
||||
return (ENXIO);
|
||||
}
|
||||
free(type, M_XENSTORE);
|
||||
}
|
||||
|
||||
return (ENXIO);
|
||||
device_set_desc(dev, "Virtual Block Device");
|
||||
device_quiet(dev);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user