]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/XenBusDxe/XenBusDxe.c
OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ ones
[mirror_edk2.git] / OvmfPkg / XenBusDxe / XenBusDxe.c
index 2c4a08673ce64ff8a81c721ae4ee34cfa7d23a33..1f5628ad83426ffe67ad5bc4c16794ea44a6ac8b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This driver produces XenBus Protocol instances for each Xen PV devices.\r
 \r
-  This XenBus bus driver will first initialize differente services in order to\r
+  This XenBus bus driver will first initialize different services in order to\r
   enumerate the ParaVirtualized devices available.\r
 \r
   Those services are:\r
 \r
   Copyright (C) 2014, Citrix Ltd.\r
 \r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -165,6 +159,7 @@ XenBusDxeUnload (
   @param  SystemTable           A pointer to the EFI System Table.\r
 \r
   @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_ABORTED           Xen hypercalls are not available.\r
   @retval Others                An unexpected error occurred.\r
 **/\r
 EFI_STATUS\r
@@ -176,6 +171,10 @@ XenBusDxeDriverEntryPoint (
 {\r
   EFI_STATUS  Status;\r
 \r
+  if (! XenHypercallIsAvailable ()) {\r
+    return EFI_ABORTED;\r
+  }\r
+\r
   //\r
   // Install UEFI Driver Model protocol(s).\r
   //\r
@@ -298,8 +297,8 @@ NotifyExitBoot (
   @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.\r
   @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.\r
   @retval EFI_UNSUPPORTED          Something is missing on the system that\r
-                                   prevent to start the edvice.\r
-  @retval Others                   The driver failded to start the device.\r
+                                   prevent to start the device.\r
+  @retval Others                   The driver failed to start the device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -363,7 +362,7 @@ XenBusDxeDriverBindingStart (
 \r
   Status = XenGetSharedInfoPage (Dev);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "XenBus: Unable to get the shared info page.\n"));\r
+    DEBUG ((DEBUG_ERROR, "XenBus: Unable to get the shared info page.\n"));\r
     Status = EFI_UNSUPPORTED;\r
     goto ErrorAllocated;\r
   }\r
@@ -443,16 +442,14 @@ XenBusDxeDriverBindingStop (
                ControllerHandle,\r
                EFI_OPEN_PROTOCOL_GET_PROTOCOL);\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((EFI_D_ERROR, "XenBusDxe: get children protocol failed: %r\n", Status));\r
+      DEBUG ((DEBUG_ERROR, "XenBusDxe: get children protocol failed: %r\n", Status));\r
       continue;\r
     }\r
     ChildData = XENBUS_PRIVATE_DATA_FROM_THIS (XenBusIo);\r
-    Status = gBS->DisconnectController (ChildData->Handle, NULL, NULL);\r
-    if (EFI_ERROR (Status)) {\r
-      DEBUG ((EFI_D_ERROR, "XenBusDxe: error disconnecting child: %r\n",\r
-              Status));\r
-      continue;\r
-    }\r
+\r
+    Status = gBS->CloseProtocol (Dev->ControllerHandle, &gXenIoProtocolGuid,\r
+                    Dev->This->DriverBindingHandle, ChildData->Handle);\r
+    ASSERT_EFI_ERROR (Status);\r
 \r
     Status = gBS->UninstallMultipleProtocolInterfaces (\r
                ChildData->Handle,\r