]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/XenPvBlkDxe/BlockFront.c
OvmfPkg/XenSupport: remove usage of prefetchable PCI host bridge aperture
[mirror_edk2.git] / OvmfPkg / XenPvBlkDxe / BlockFront.c
index 256ac55f251538f0a089b4cfc029757a5f83f2ba..8dca4c82f08a98888a9d6fb4ee78069b1ca22455 100644 (file)
@@ -5,26 +5,7 @@
   Copyright (C) 2014, Citrix Ltd.\r
   Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
 \r
-  Redistribution and use in source and binary forms, with or without\r
-  modification, are permitted provided that the following conditions\r
-  are met:\r
-  1. Redistributions of source code must retain the above copyright\r
-     notice, this list of conditions and the following disclaimer.\r
-  2. Redistributions in binary form must reproduce the above copyright\r
-     notice, this list of conditions and the following disclaimer in the\r
-     documentation and/or other materials provided with the distribution.\r
-\r
-  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
-  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
-  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\r
-  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
-  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
-  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
-  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
-  SUCH DAMAGE.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
 #include <Library/PrintLib.h>\r
@@ -169,6 +150,7 @@ XenPvBlockFrontInitialization (
   XEN_BLOCK_FRONT_DEVICE *Dev;\r
   XenbusState State;\r
   UINT64 Value;\r
+  CHAR8 *Params;\r
 \r
   ASSERT (NodeName != NULL);\r
 \r
@@ -186,6 +168,20 @@ XenPvBlockFrontInitialization (
   }\r
   FreePool (DeviceType);\r
 \r
+  if (Dev->MediaInfo.CdRom) {\r
+    Status = XenBusIo->XsBackendRead (XenBusIo, XST_NIL, "params", (VOID**)&Params);\r
+    if (Status != XENSTORE_STATUS_SUCCESS) {\r
+      DEBUG ((EFI_D_ERROR, "%a: Failed to read params (%d)\n", __FUNCTION__, Status));\r
+      goto Error;\r
+    }\r
+    if (AsciiStrLen (Params) == 0 || AsciiStrCmp (Params, "aio:") == 0) {\r
+      FreePool (Params);\r
+      DEBUG ((EFI_D_INFO, "%a: Empty cdrom\n", __FUNCTION__));\r
+      goto Error;\r
+    }\r
+    FreePool (Params);\r
+  }\r
+\r
   Status = XenBusReadUint64 (XenBusIo, "backend-id", FALSE, &Value);\r
   if (Status != XENSTORE_STATUS_SUCCESS || Value > MAX_UINT16) {\r
     DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to get backend-id (%d)\n",\r