summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/XenPvBlkDxe
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2015-10-21 12:44:12 +0000
committerlersek <lersek@Edk2>2015-10-21 12:44:12 +0000
commit0f34a051104e2b1b9123d56d48673de4b21bc533 (patch)
treeb9255bc9612b39cfb764ca7e150f4cac7bda8907 /OvmfPkg/XenPvBlkDxe
parentf4c3c92396c9b146bc99dcba80001591cc45ba3e (diff)
downloadedk2-0f34a051104e2b1b9123d56d48673de4b21bc533.tar.gz
edk2-0f34a051104e2b1b9123d56d48673de4b21bc533.tar.bz2
edk2-0f34a051104e2b1b9123d56d48673de4b21bc533.zip
OvmfPkg: XenPvBlkDxe: 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 error instead from XenPvBlockFrontInitialization(). 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@eu.citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18651 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/XenPvBlkDxe')
-rw-r--r--OvmfPkg/XenPvBlkDxe/BlockFront.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
index 256ac55f25..d07e980990 100644
--- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
+++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
@@ -169,6 +169,7 @@ XenPvBlockFrontInitialization (
XEN_BLOCK_FRONT_DEVICE *Dev;
XenbusState State;
UINT64 Value;
+ CHAR8 *Params;
ASSERT (NodeName != NULL);
@@ -186,6 +187,20 @@ XenPvBlockFrontInitialization (
}
FreePool (DeviceType);
+ if (Dev->MediaInfo.CdRom) {
+ Status = XenBusIo->XsBackendRead (XenBusIo, XST_NIL, "params", (VOID**)&Params);
+ if (Status != XENSTORE_STATUS_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "%a: Failed to read params (%d)\n", __FUNCTION__, Status));
+ goto Error;
+ }
+ if (AsciiStrLen (Params) == 0 || AsciiStrCmp (Params, "aio:") == 0) {
+ FreePool (Params);
+ DEBUG ((EFI_D_INFO, "%a: Empty cdrom\n", __FUNCTION__));
+ 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",