TianoCore EDK2 master
Loading...
Searching...
No Matches
Xen.c File Reference
#include <PiPei.h>
#include <Library/BaseMemoryLib.h>
#include <Library/CpuLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/LocalApicLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
#include <Library/SafeIntLib.h>
#include <Guid/XenInfo.h>
#include <IndustryStandard/E820.h>
#include <Library/ResourcePublicationLib.h>
#include <Library/MtrrLib.h>
#include <IndustryStandard/PageTable.h>
#include <IndustryStandard/Xen/arch-x86/hvm/start_info.h>
#include <Library/XenHypercallLib.h>
#include <IndustryStandard/Xen/memory.h>
#include "Platform.h"
#include "Xen.h"

Go to the source code of this file.

Functions

EFI_STATUS XenGetE820Map (EFI_E820_ENTRY64 **Entries, UINT32 *Count)
 
EFI_STATUS XenConnect ()
 
BOOLEAN XenDetect (VOID)
 
BOOLEAN XenHvmloaderDetected (VOID)
 
BOOLEAN XenPvhDetected (VOID)
 
VOID XenPublishRamRegions (VOID)
 
EFI_STATUS PhysicalAddressIdentityMapping (IN EFI_PHYSICAL_ADDRESS AddressToMap)
 
STATIC EFI_STATUS MapSharedInfoPage (IN VOID *PagePtr)
 
STATIC VOID UnmapXenPage (IN VOID *PagePtr)
 
STATIC UINT64 GetCpuFreq (IN XEN_VCPU_TIME_INFO *VcpuTime)
 
STATIC VOID XenDelay (IN XEN_VCPU_TIME_INFO *VcpuTimeInfo, IN UINT64 DelayNs)
 
VOID CalibrateLapicTimer (VOID)
 

Variables

STATIC UINT32 mXenLeaf = 0
 
EFI_XEN_INFO mXenInfo
 
EFI_XEN_OVMF_INFOmXenHvmloaderInfo
 
STATIC EFI_E820_ENTRY64 mE820Entries [128]
 
STATIC UINT32 mE820EntriesCount
 

Detailed Description

Xen Platform PEI support

Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
Copyright (c) 2011, Andrei Warkentin andre.nosp@m.iw@m.nosp@m.otoro.nosp@m.la.c.nosp@m.om Copyright (c) 2019, Citrix Systems, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Xen.c.

Function Documentation

◆ CalibrateLapicTimer()

VOID CalibrateLapicTimer ( VOID  )

Calculate the frequency of the Local Apic Timer

Definition at line 553 of file Xen.c.

◆ GetCpuFreq()

STATIC UINT64 GetCpuFreq ( IN XEN_VCPU_TIME_INFO VcpuTime)

Definition at line 472 of file Xen.c.

◆ MapSharedInfoPage()

STATIC EFI_STATUS MapSharedInfoPage ( IN VOID *  PagePtr)

Definition at line 436 of file Xen.c.

◆ PhysicalAddressIdentityMapping()

EFI_STATUS PhysicalAddressIdentityMapping ( IN EFI_PHYSICAL_ADDRESS  AddressToMap)

Definition at line 367 of file Xen.c.

◆ UnmapXenPage()

STATIC VOID UnmapXenPage ( IN VOID *  PagePtr)

Definition at line 457 of file Xen.c.

◆ XenConnect()

EFI_STATUS XenConnect ( )

Connects to the Hypervisor.

Returns
EFI_STATUS

Definition at line 128 of file Xen.c.

◆ XenDelay()

STATIC VOID XenDelay ( IN XEN_VCPU_TIME_INFO VcpuTimeInfo,
IN UINT64  DelayNs 
)

Definition at line 501 of file Xen.c.

◆ XenDetect()

BOOLEAN XenDetect ( VOID  )

Figures out if we are running inside Xen HVM.

Return values
TRUEXen was detected
FALSEXen was not detected

Definition at line 220 of file Xen.c.

◆ XenGetE820Map()

EFI_STATUS XenGetE820Map ( EFI_E820_ENTRY64 **  Entries,
UINT32 *  Count 
)

Returns E820 map provided by Xen

Parameters
EntriesPointer to E820 map
CountNumber of entries
Returns
EFI_STATUS

Definition at line 61 of file Xen.c.

◆ XenHvmloaderDetected()

BOOLEAN XenHvmloaderDetected ( VOID  )

Definition at line 250 of file Xen.c.

◆ XenPublishRamRegions()

VOID XenPublishRamRegions ( VOID  )

Definition at line 271 of file Xen.c.

◆ XenPvhDetected()

BOOLEAN XenPvhDetected ( VOID  )

This function detect if OVMF have started via the PVH entry point.

Return values
TRUEPVH entry point as been used
FALSEOVMF have started via the HVM route

Definition at line 258 of file Xen.c.

Variable Documentation

◆ mE820Entries

STATIC EFI_E820_ENTRY64 mE820Entries[128]

Definition at line 49 of file Xen.c.

◆ mE820EntriesCount

STATIC UINT32 mE820EntriesCount

Definition at line 50 of file Xen.c.

◆ mXenHvmloaderInfo

EFI_XEN_OVMF_INFO* mXenHvmloaderInfo

Definition at line 48 of file Xen.c.

◆ mXenInfo

EFI_XEN_INFO mXenInfo

Definition at line 42 of file Xen.c.

◆ mXenLeaf

STATIC UINT32 mXenLeaf = 0

Definition at line 40 of file Xen.c.