[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] XenPvBlk: handle empty cdrom drives
Empty cdroms are not going to connect, avoid waiting for the backend to switch to state 4, which is never going to happen, and return EFI_NO_MEDIA instead. Detect an empty cdrom by looking at the "params" node on xenstore, which is set to "" or "aio:" for empty drives by libxl. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c index 256ac55..5a52a03 100644 --- a/OvmfPkg/XenPvBlkDxe/BlockFront.c +++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c @@ -169,6 +169,8 @@ XenPvBlockFrontInitialization ( XEN_BLOCK_FRONT_DEVICE *Dev; XenbusState State; UINT64 Value; + EFI_STATUS Ret = EFI_DEVICE_ERROR; + CHAR8 *Params; ASSERT (NodeName != NULL); @@ -186,6 +188,17 @@ XenPvBlockFrontInitialization ( } FreePool (DeviceType); + if (Dev->MediaInfo.CdRom) { + XenBusIo->XsBackendRead (XenBusIo, XST_NIL, "params", (VOID**)&Params); + if (AsciiStrLen (Params) == 0 || AsciiStrCmp (Params, "aio:") == 0) { + FreePool (Params); + DEBUG ((EFI_D_INFO, "XenPvBlk: Empty cdrom\n")); + Ret = EFI_NO_MEDIA; + goto Error; + } + FreePool (Params); + } + Status = XenBusReadUint64 (XenBusIo, "backend-id", FALSE, &Value); if (Status != XENSTORE_STATUS_SUCCESS || Value > MAX_UINT16) { DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to get backend-id (%d)\n", @@ -318,7 +331,7 @@ AbortTransaction: XenBusIo->XsTransactionEnd (XenBusIo, &Transaction, TRUE); Error: XenPvBlockFree (Dev); - return EFI_DEVICE_ERROR; + return Ret; } VOID _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |