]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/XenHypercallLib/X86XenHypercall.c
OvmfPkg: XenHypercallLib: add empty constructor for ARM & AARCH64
[mirror_edk2.git] / OvmfPkg / Library / XenHypercallLib / X86XenHypercall.c
CommitLineData
cd8ff8fd
AB
1/** @file\r
2 Xen Hypercall Library implementation for Intel architecture\r
3\r
4Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>\r
5This program and the accompanying materials are licensed and made available under\r
6the terms and conditions of the BSD License that accompanies this distribution.\r
7The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php.\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiDxe.h>\r
16#include <Library/HobLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Guid/XenInfo.h>\r
19\r
20STATIC VOID *HyperPage;\r
21\r
22//\r
23// Interface exposed by the ASM implementation of the core hypercall\r
24//\r
25INTN\r
26EFIAPI\r
27__XenHypercall2 (\r
28 IN VOID *HypercallAddr,\r
29 IN OUT INTN Arg1,\r
30 IN OUT INTN Arg2\r
31 );\r
32\r
33/**\r
34 Library constructor: retrieves the Hyperpage address\r
35 from the gEfiXenInfoGuid HOB\r
36**/\r
37\r
38RETURN_STATUS\r
39EFIAPI\r
df040c00 40XenHypercallLibInit (\r
cd8ff8fd
AB
41 VOID\r
42 )\r
43{\r
44 EFI_HOB_GUID_TYPE *GuidHob;\r
45 EFI_XEN_INFO *XenInfo;\r
46\r
47 GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);\r
48 if (GuidHob == NULL) {\r
49 return RETURN_NOT_FOUND;\r
50 }\r
51 XenInfo = (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob);\r
52 HyperPage = XenInfo->HyperPages;\r
53 return RETURN_SUCCESS;\r
54}\r
55\r
56/**\r
57 This function will put the two arguments in the right place (registers) and\r
58 invoke the hypercall identified by HypercallID.\r
59\r
60 @param HypercallID The symbolic ID of the hypercall to be invoked\r
61 @param Arg1 First argument.\r
62 @param Arg2 Second argument.\r
63\r
64 @return Return 0 if success otherwise it return an errno.\r
65**/\r
66INTN\r
67EFIAPI\r
68XenHypercall2 (\r
69 IN UINTN HypercallID,\r
70 IN OUT INTN Arg1,\r
71 IN OUT INTN Arg2\r
72 )\r
73{\r
74 ASSERT (HyperPage != NULL);\r
75\r
76 return __XenHypercall2 ((UINT8*)HyperPage + HypercallID * 32, Arg1, Arg2);\r
77}\r