TianoCore EDK2 master
Loading...
Searching...
No Matches
XenIoPvhDxe.c
Go to the documentation of this file.
1
14#include <Library/PcdLib.h>
17
19EFIAPI
20InitializeXenIoPvhDxe (
21 IN EFI_HANDLE ImageHandle,
22 IN EFI_SYSTEM_TABLE *SystemTable
23 )
24{
25 VOID *Allocation;
26 EFI_STATUS Status;
27 EFI_HANDLE XenIoHandle;
28
29 Allocation = NULL;
30 XenIoHandle = NULL;
31
32 if (!XenPvhDetected ()) {
33 return EFI_UNSUPPORTED;
34 }
35
36 Allocation = AllocateReservedPages (FixedPcdGet32 (PcdXenGrantFrames));
37 if (Allocation == NULL) {
38 Status = EFI_OUT_OF_RESOURCES;
39 goto Error;
40 }
41
42 Status = XenIoMmioInstall (&XenIoHandle, (UINTN)Allocation);
43 if (EFI_ERROR (Status)) {
44 goto Error;
45 }
46
47 return EFI_SUCCESS;
48
49Error:
50 if (Allocation != NULL) {
51 FreePages (Allocation, FixedPcdGet32 (PcdXenGrantFrames));
52 }
53
54 return Status;
55}
UINT64 UINTN
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
VOID *EFIAPI AllocateReservedPages(IN UINTN Pages)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define FixedPcdGet32(TokenName)
Definition: PcdLib.h:92
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS XenIoMmioInstall(IN OUT EFI_HANDLE *Handle, IN EFI_PHYSICAL_ADDRESS GrantTableAddress)
Definition: XenIoMmioLib.c:68
BOOLEAN EFIAPI XenPvhDetected(VOID)