]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / XenIoPvhDxe / XenIoPvhDxe.c
CommitLineData
833cd3e0
AP
1/** @file\r
2\r
3 Driver for the XenIo protocol\r
4\r
5 This driver simply allocate space for the grant tables.\r
6\r
7 Copyright (c) 2019, Citrix Systems, Inc.\r
8\r
9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11**/\r
12\r
13#include <Library/MemoryAllocationLib.h>\r
14#include <Library/PcdLib.h>\r
15#include <Library/XenIoMmioLib.h>\r
16#include <Library/XenPlatformLib.h>\r
17\r
18EFI_STATUS\r
19EFIAPI\r
20InitializeXenIoPvhDxe (\r
ac0a286f
MK
21 IN EFI_HANDLE ImageHandle,\r
22 IN EFI_SYSTEM_TABLE *SystemTable\r
833cd3e0
AP
23 )\r
24{\r
ac0a286f
MK
25 VOID *Allocation;\r
26 EFI_STATUS Status;\r
27 EFI_HANDLE XenIoHandle;\r
833cd3e0 28\r
ac0a286f 29 Allocation = NULL;\r
833cd3e0
AP
30 XenIoHandle = NULL;\r
31\r
32 if (!XenPvhDetected ()) {\r
33 return EFI_UNSUPPORTED;\r
34 }\r
35\r
36 Allocation = AllocateReservedPages (FixedPcdGet32 (PcdXenGrantFrames));\r
37 if (Allocation == NULL) {\r
38 Status = EFI_OUT_OF_RESOURCES;\r
39 goto Error;\r
40 }\r
41\r
ac0a286f 42 Status = XenIoMmioInstall (&XenIoHandle, (UINTN)Allocation);\r
833cd3e0
AP
43 if (EFI_ERROR (Status)) {\r
44 goto Error;\r
45 }\r
46\r
47 return EFI_SUCCESS;\r
48\r
49Error:\r
50 if (Allocation != NULL) {\r
51 FreePages (Allocation, FixedPcdGet32 (PcdXenGrantFrames));\r
52 }\r
ac0a286f 53\r
833cd3e0
AP
54 return Status;\r
55}\r