]>
Commit | Line | Data |
---|---|---|
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 | |
18 | EFI_STATUS\r | |
19 | EFIAPI\r | |
20 | InitializeXenIoPvhDxe (\r | |
21 | IN EFI_HANDLE ImageHandle,\r | |
22 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
23 | )\r | |
24 | {\r | |
25 | VOID *Allocation;\r | |
26 | EFI_STATUS Status;\r | |
27 | EFI_HANDLE XenIoHandle;\r | |
28 | \r | |
29 | Allocation = NULL;\r | |
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 | |
42 | Status = XenIoMmioInstall (&XenIoHandle, (UINTN) Allocation);\r | |
43 | if (EFI_ERROR (Status)) {\r | |
44 | goto Error;\r | |
45 | }\r | |
46 | \r | |
47 | return EFI_SUCCESS;\r | |
48 | \r | |
49 | Error:\r | |
50 | if (Allocation != NULL) {\r | |
51 | FreePages (Allocation, FixedPcdGet32 (PcdXenGrantFrames));\r | |
52 | }\r | |
53 | return Status;\r | |
54 | }\r |