blob: f76564b2f23a8a84bccca7cf29f666a92c3799be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/** @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;
}
|