]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/XenPvBlkDxe/BlockFront.c
MdeModulePkg SectionExtractionPei: remove the hard code alignment adjustment
[mirror_edk2.git] / OvmfPkg / XenPvBlkDxe / BlockFront.c
index afaa95983b5d48837bea6ab1dd060833c2edcd49..d07e980990562ed56c39b901abdeee2594373433 100644 (file)
@@ -169,6 +169,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 +187,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
@@ -278,7 +293,7 @@ Again:
     //\r
     // This is not supported by the driver.\r
     //\r
-    DEBUG ((EFI_D_ERROR, "XenPvBlk: Unsupported sector-size value %d, "\r
+    DEBUG ((EFI_D_ERROR, "XenPvBlk: Unsupported sector-size value %Lu, "\r
             "it must be a multiple of 512\n", Value));\r
     goto Error2;\r
   }\r
@@ -384,7 +399,7 @@ XenPvBlockFrontShutdown (
       break;\r
     }\r
     DEBUG ((EFI_D_INFO,\r
-            "XenPvBlk: waiting backend state %d, current: %d\n",\r
+            "XenPvBlk: waiting backend state %d, current: %Lu\n",\r
             XenbusStateInitWait, Value));\r
     XenBusIo->WaitForWatch (XenBusIo, Dev->StateWatchToken);\r
   }\r
@@ -596,11 +611,11 @@ XenPvBlockAsyncIoPoll (
           if (Status != BLKIF_RSP_OKAY) {\r
             DEBUG ((EFI_D_ERROR,\r
                     "XenPvBlk: "\r
-                    "%a error %d on %a at sector %p, num bytes %p\n",\r
+                    "%a error %d on %a at sector %Lx, num bytes %Lx\n",\r
                     Response->operation == BLKIF_OP_READ ? "read" : "write",\r
                     Status, IoData->Dev->NodeName,\r
-                    IoData->Sector,\r
-                    IoData->Size));\r
+                    (UINT64)IoData->Sector,\r
+                    (UINT64)IoData->Size));\r
           }\r
 \r
           for (Index = 0; Index < IoData->NumRef; Index++) {\r