forked from tianocore/edk2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OvmfPkg: Introduce XenIoPvhDxe to initialize Grant Tables
XenIoPvhDxe use XenIoMmioLib to reserve some space to be use by the Grant Tables. The call is only done if it is necessary, we simply detect if the guest is PVH, as in this case there is currently no PCI bus, and no PCI Xen platform device which would start the XenIoPciDxe and allocate the space for the Grant Tables. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD <[email protected]> Reviewed-by: Laszlo Ersek <[email protected]> Message-Id: <[email protected]>
- Loading branch information
1 parent
8f39d79
commit 833cd3e
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** @file | ||
Driver for the XenIo protocol | ||
This driver simply allocate space for the grant tables. | ||
Copyright (c) 2019, Citrix Systems, Inc. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <Library/MemoryAllocationLib.h> | ||
#include <Library/PcdLib.h> | ||
#include <Library/XenIoMmioLib.h> | ||
#include <Library/XenPlatformLib.h> | ||
|
||
EFI_STATUS | ||
EFIAPI | ||
InitializeXenIoPvhDxe ( | ||
IN EFI_HANDLE ImageHandle, | ||
IN EFI_SYSTEM_TABLE *SystemTable | ||
) | ||
{ | ||
VOID *Allocation; | ||
EFI_STATUS Status; | ||
EFI_HANDLE XenIoHandle; | ||
|
||
Allocation = NULL; | ||
XenIoHandle = NULL; | ||
|
||
if (!XenPvhDetected ()) { | ||
return EFI_UNSUPPORTED; | ||
} | ||
|
||
Allocation = AllocateReservedPages (FixedPcdGet32 (PcdXenGrantFrames)); | ||
if (Allocation == NULL) { | ||
Status = EFI_OUT_OF_RESOURCES; | ||
goto Error; | ||
} | ||
|
||
Status = XenIoMmioInstall (&XenIoHandle, (UINTN) Allocation); | ||
if (EFI_ERROR (Status)) { | ||
goto Error; | ||
} | ||
|
||
return EFI_SUCCESS; | ||
|
||
Error: | ||
if (Allocation != NULL) { | ||
FreePages (Allocation, FixedPcdGet32 (PcdXenGrantFrames)); | ||
} | ||
return Status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## @file | ||
# Driver for the XenIo protocol | ||
# | ||
# Copyright (c) 2019, Citrix Systems, Inc. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = XenIoPvhDxe | ||
FILE_GUID = 7a567cc4-0e75-4d7a-a305-c3db109b53ad | ||
MODULE_TYPE = DXE_DRIVER | ||
VERSION_STRING = 1.0 | ||
ENTRY_POINT = InitializeXenIoPvhDxe | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
OvmfPkg/OvmfPkg.dec | ||
|
||
[Sources] | ||
XenIoPvhDxe.c | ||
|
||
[LibraryClasses] | ||
MemoryAllocationLib | ||
PcdLib | ||
UefiDriverEntryPoint | ||
XenIoMmioLib | ||
XenPlatformLib | ||
|
||
[FixedPcd] | ||
gUefiOvmfPkgTokenSpaceGuid.PcdXenGrantFrames | ||
|
||
[Depex] | ||
TRUE |