Last change
on this file was 108794, checked in by vboxsync, 4 weeks ago |
Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643
|
-
Property svn:eol-style
set to
native
|
File size:
1.9 KB
|
Line | |
---|
1 | /** @file
|
---|
2 | Functions to make Xen hypercalls.
|
---|
3 |
|
---|
4 | Copyright (C) 2014, Citrix Ltd.
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #include <PiDxe.h>
|
---|
11 |
|
---|
12 | #include <IndustryStandard/Xen/hvm/params.h>
|
---|
13 | #include <IndustryStandard/Xen/memory.h>
|
---|
14 |
|
---|
15 | #include <Library/DebugLib.h>
|
---|
16 | #include <Library/XenHypercallLib.h>
|
---|
17 |
|
---|
18 | RETURN_STATUS
|
---|
19 | EFIAPI
|
---|
20 | XenHypercallLibConstruct (
|
---|
21 | VOID
|
---|
22 | )
|
---|
23 | {
|
---|
24 | XenHypercallLibInit ();
|
---|
25 | //
|
---|
26 | // We don't fail library construction, since that has catastrophic
|
---|
27 | // consequences for client modules (whereas those modules may easily be
|
---|
28 | // running on a non-Xen platform). Instead, XenHypercallIsAvailable()
|
---|
29 | // will return FALSE.
|
---|
30 | //
|
---|
31 | return RETURN_SUCCESS;
|
---|
32 | }
|
---|
33 |
|
---|
34 | UINT64
|
---|
35 | EFIAPI
|
---|
36 | XenHypercallHvmGetParam (
|
---|
37 | IN UINT32 Index
|
---|
38 | )
|
---|
39 | {
|
---|
40 | xen_hvm_param_t Parameter;
|
---|
41 | INTN Error;
|
---|
42 |
|
---|
43 | Parameter.domid = DOMID_SELF;
|
---|
44 | Parameter.index = Index;
|
---|
45 | Error = XenHypercall2 (
|
---|
46 | __HYPERVISOR_hvm_op,
|
---|
47 | HVMOP_get_param,
|
---|
48 | (INTN)&Parameter
|
---|
49 | );
|
---|
50 | if (Error != 0) {
|
---|
51 | DEBUG ((
|
---|
52 | DEBUG_ERROR,
|
---|
53 | "XenHypercall: Error %Ld trying to get HVM parameter %d\n",
|
---|
54 | (INT64)Error,
|
---|
55 | Index
|
---|
56 | ));
|
---|
57 | return 0;
|
---|
58 | }
|
---|
59 |
|
---|
60 | return Parameter.value;
|
---|
61 | }
|
---|
62 |
|
---|
63 | INTN
|
---|
64 | EFIAPI
|
---|
65 | XenHypercallMemoryOp (
|
---|
66 | IN UINTN Operation,
|
---|
67 | IN OUT VOID *Arguments
|
---|
68 | )
|
---|
69 | {
|
---|
70 | return XenHypercall2 (
|
---|
71 | __HYPERVISOR_memory_op,
|
---|
72 | Operation,
|
---|
73 | (INTN)Arguments
|
---|
74 | );
|
---|
75 | }
|
---|
76 |
|
---|
77 | INTN
|
---|
78 | EFIAPI
|
---|
79 | XenHypercallEventChannelOp (
|
---|
80 | IN INTN Operation,
|
---|
81 | IN OUT VOID *Arguments
|
---|
82 | )
|
---|
83 | {
|
---|
84 | return XenHypercall2 (
|
---|
85 | __HYPERVISOR_event_channel_op,
|
---|
86 | Operation,
|
---|
87 | (INTN)Arguments
|
---|
88 | );
|
---|
89 | }
|
---|
90 |
|
---|
91 | INTN
|
---|
92 | EFIAPI
|
---|
93 | XenHypercallSchedOp (
|
---|
94 | IN INTN Operation,
|
---|
95 | IN OUT VOID *Arguments
|
---|
96 | )
|
---|
97 | {
|
---|
98 | return XenHypercall2 (
|
---|
99 | __HYPERVISOR_sched_op,
|
---|
100 | Operation,
|
---|
101 | (INTN)Arguments
|
---|
102 | );
|
---|
103 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.