]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/XenPlatformLib/XenPlatformLib.c
2 Get information about Xen
4 This library simply allow to find out if OVMF is running under Xen and
5 allow to get more information when it is the case.
7 Copyright (c) 2019, Citrix Systems, Inc.
9 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <Library/HobLib.h>
15 #include <Library/XenPlatformLib.h>
18 This function return a pointer to the XenInfo HOB.
20 @return XenInfo pointer or NULL if not available
28 EFI_HOB_GUID_TYPE
*GuidHob
;
29 STATIC BOOLEAN Cached
= FALSE
;
30 STATIC EFI_XEN_INFO
*XenInfo
;
33 // Return the cached result for the benefit of XenDetected that can be
40 GuidHob
= GetFirstGuidHob (&gEfiXenInfoGuid
);
41 if (GuidHob
== NULL
) {
44 XenInfo
= (EFI_XEN_INFO
*)GET_GUID_HOB_DATA (GuidHob
);
52 This function detects if OVMF is running on Xen.
54 @retval TRUE OVMF is running on Xen
55 @retval FALSE Xen has not been detected
63 return (XenGetInfoHOB () != NULL
);
67 This function detect if OVMF have started via the PVH entry point.
69 @retval TRUE PVH entry point as been used
70 @retval FALSE OVMF have started via the HVM route
78 EFI_XEN_INFO
*XenInfo
;
80 XenInfo
= XenGetInfoHOB ();
81 return (XenInfo
!= NULL
&& XenInfo
->RsdpPvh
!= NULL
);