Revision: 16970
http://sourceforge.net/p/edk2/code/16970
Author: lersek
Date: 2015-02-28 20:32:39 +0000 (Sat, 28 Feb 2015)
Log Message:
-----------
Ovmf/Xen: move XenBusDxe hypercall code to separate library
This moves all of the Xen hypercall code that was private to XenBusDxe
to a new library class XenHypercallLib. This will allow us to reimplement
it for ARM, and to export the Xen hypercall functionality to other parts
of the code, such as a Xen console SerialPortLib driver.
Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Anthony PERARD <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/OvmfPkg/OvmfPkg.dec
trunk/edk2/OvmfPkg/OvmfPkgIa32.dsc
trunk/edk2/OvmfPkg/OvmfPkgIa32X64.dsc
trunk/edk2/OvmfPkg/OvmfPkgX64.dsc
trunk/edk2/OvmfPkg/XenBusDxe/EventChannel.c
trunk/edk2/OvmfPkg/XenBusDxe/GrantTable.c
trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.c
trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.inf
trunk/edk2/OvmfPkg/XenBusDxe/XenStore.c
Added Paths:
-----------
trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h
trunk/edk2/OvmfPkg/Library/XenHypercallLib/
trunk/edk2/OvmfPkg/Library/XenHypercallLib/Ia32/
trunk/edk2/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm
trunk/edk2/OvmfPkg/Library/XenHypercallLib/X64/
trunk/edk2/OvmfPkg/Library/XenHypercallLib/X64/hypercall.nasm
trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercall.c
trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallIntel.c
trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
Removed Paths:
-------------
trunk/edk2/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm
trunk/edk2/OvmfPkg/XenBusDxe/X64/hypercall.nasm
trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.c
trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.h
Copied: trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h (from rev 16969,
trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.h)
===================================================================
--- trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h
(rev 0)
+++ trunk/edk2/OvmfPkg/Include/Library/XenHypercallLib.h 2015-02-28
20:32:39 UTC (rev 16970)
@@ -0,0 +1,79 @@
+/** @file
+ Functions declarations to make Xen hypercalls.
+
+ Copyright (C) 2014, Citrix Ltd.
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD
License
+ which accompanies this distribution. The full text of the license may be
found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __XEN_HYPERCALL_LIB_H__
+#define __XEN_HYPERCALL_LIB_H__
+
+/**
+ This function will put the two arguments in the right place (registers) and
+ invoke the hypercall identified by HypercallID.
+
+ @param HypercallID The symbolic ID of the hypercall to be invoked
+ @param Arg1 First argument.
+ @param Arg2 Second argument.
+
+ @return Return 0 if success otherwise it return an errno.
+**/
+INTN
+EFIAPI
+XenHypercall2 (
+ IN UINTN HypercallID,
+ IN OUT INTN Arg1,
+ IN OUT INTN Arg2
+ );
+
+/**
+ Return the value of the HVM parameter Index.
+
+ @param Index The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.
+
+ @return The value of the asked parameter or 0 in case of error.
+**/
+UINT64
+XenHypercallHvmGetParam (
+ UINT32 Index
+ );
+
+/**
+ Hypercall to do different operation on the memory.
+
+ @param Operation The operation number, e.g. XENMEM_add_to_physmap.
+ @param Arguments The arguments associated to the operation.
+
+ @return Return the return value from the hypercall, 0 in case of success
+ otherwise, an error code.
+**/
+INTN
+XenHypercallMemoryOp (
+ IN UINTN Operation,
+ IN OUT VOID *Arguments
+ );
+
+/**
+ Do an operation on the event channels.
+
+ @param Operation The operation number, e.g. EVTCHNOP_send.
+ @param Arguments The argument associated to the operation.
+
+ @return Return the return value from the hypercall, 0 in case of success
+ otherwise, an error code.
+**/
+INTN
+XenHypercallEventChannelOp (
+ IN INTN Operation,
+ IN OUT VOID *Arguments
+ );
+
+#endif
Copied: trunk/edk2/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm (from
rev 16969, trunk/edk2/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm)
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm
(rev 0)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/Ia32/hypercall.nasm
2015-02-28 20:32:39 UTC (rev 16970)
@@ -0,0 +1,25 @@
+SECTION .text
+
+; INTN
+; EFIAPI
+; __XenHypercall2 (
+; IN VOID *HypercallAddr,
+; IN OUT INTN Arg1,
+; IN OUT INTN Arg2
+; );
+global ASM_PFX(__XenHypercall2)
+ASM_PFX(__XenHypercall2):
+ ; Save only ebx, ecx is supposed to be a scratch register and needs to be
+ ; saved by the caller
+ push ebx
+ ; Copy HypercallAddr to eax
+ mov eax, [esp + 8]
+ ; Copy Arg1 to the register expected by Xen
+ mov ebx, [esp + 12]
+ ; Copy Arg2 to the register expected by Xen
+ mov ecx, [esp + 16]
+ ; Call HypercallAddr
+ call eax
+ pop ebx
+ ret
+
Copied: trunk/edk2/OvmfPkg/Library/XenHypercallLib/X64/hypercall.nasm (from rev
16969, trunk/edk2/OvmfPkg/XenBusDxe/X64/hypercall.nasm)
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/X64/hypercall.nasm
(rev 0)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/X64/hypercall.nasm
2015-02-28 20:32:39 UTC (rev 16970)
@@ -0,0 +1,26 @@
+DEFAULT REL
+SECTION .text
+
+; INTN
+; EFIAPI
+; __XenHypercall2 (
+; IN VOID *HypercallAddr,
+; IN OUT INTN Arg1,
+; IN OUT INTN Arg2
+; );
+global ASM_PFX(__XenHypercall2)
+ASM_PFX(__XenHypercall2):
+ push rdi
+ push rsi
+ ; Copy HypercallAddr to rax
+ mov rax, rcx
+ ; Copy Arg1 to the register expected by Xen
+ mov rdi, rdx
+ ; Copy Arg2 to the register expected by Xen
+ mov rsi, r8
+ ; Call HypercallAddr
+ call rax
+ pop rsi
+ pop rdi
+ ret
+
Copied: trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercall.c (from rev
16969, trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.c)
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercall.c
(rev 0)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercall.c 2015-02-28
20:32:39 UTC (rev 16970)
@@ -0,0 +1,63 @@
+/** @file
+ Functions to make Xen hypercalls.
+
+ Copyright (C) 2014, Citrix Ltd.
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD
License
+ which accompanies this distribution. The full text of the license may be
found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <PiDxe.h>
+
+#include <IndustryStandard/Xen/hvm/params.h>
+#include <IndustryStandard/Xen/memory.h>
+
+#include <Library/DebugLib.h>
+#include <Library/XenHypercallLib.h>
+
+UINT64
+XenHypercallHvmGetParam (
+ IN UINT32 Index
+ )
+{
+ xen_hvm_param_t Parameter;
+ INTN Error;
+
+ Parameter.domid = DOMID_SELF;
+ Parameter.index = Index;
+ Error = XenHypercall2 (__HYPERVISOR_hvm_op,
+ HVMOP_get_param, (INTN) &Parameter);
+ if (Error != 0) {
+ DEBUG ((EFI_D_ERROR,
+ "XenHypercall: Error %d trying to get HVM parameter %d\n",
+ Error, Index));
+ return 0;
+ }
+ return Parameter.value;
+}
+
+INTN
+XenHypercallMemoryOp (
+ IN UINTN Operation,
+ IN OUT VOID *Arguments
+ )
+{
+ return XenHypercall2 (__HYPERVISOR_memory_op,
+ Operation, (INTN) Arguments);
+}
+
+INTN
+XenHypercallEventChannelOp (
+ IN INTN Operation,
+ IN OUT VOID *Arguments
+ )
+{
+ return XenHypercall2 (__HYPERVISOR_event_channel_op,
+ Operation, (INTN) Arguments);
+}
Added: trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallIntel.c
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallIntel.c
(rev 0)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallIntel.c
2015-02-28 20:32:39 UTC (rev 16970)
@@ -0,0 +1,77 @@
+/** @file
+ Xen Hypercall Library implementation for Intel architecture
+
+Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <PiDxe.h>
+#include <Library/HobLib.h>
+#include <Library/DebugLib.h>
+#include <Guid/XenInfo.h>
+
+STATIC VOID *HyperPage;
+
+//
+// Interface exposed by the ASM implementation of the core hypercall
+//
+INTN
+EFIAPI
+__XenHypercall2 (
+ IN VOID *HypercallAddr,
+ IN OUT INTN Arg1,
+ IN OUT INTN Arg2
+ );
+
+/**
+ Library constructor: retrieves the Hyperpage address
+ from the gEfiXenInfoGuid HOB
+**/
+
+RETURN_STATUS
+EFIAPI
+XenHypercallLibIntelInit (
+ VOID
+ )
+{
+ EFI_HOB_GUID_TYPE *GuidHob;
+ EFI_XEN_INFO *XenInfo;
+
+ GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
+ if (GuidHob == NULL) {
+ return RETURN_NOT_FOUND;
+ }
+ XenInfo = (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob);
+ HyperPage = XenInfo->HyperPages;
+ return RETURN_SUCCESS;
+}
+
+/**
+ This function will put the two arguments in the right place (registers) and
+ invoke the hypercall identified by HypercallID.
+
+ @param HypercallID The symbolic ID of the hypercall to be invoked
+ @param Arg1 First argument.
+ @param Arg2 Second argument.
+
+ @return Return 0 if success otherwise it return an errno.
+**/
+INTN
+EFIAPI
+XenHypercall2 (
+ IN UINTN HypercallID,
+ IN OUT INTN Arg1,
+ IN OUT INTN Arg2
+ )
+{
+ ASSERT (HyperPage != NULL);
+
+ return __XenHypercall2 ((UINT8*)HyperPage + HypercallID * 32, Arg1, Arg2);
+}
Added: trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
===================================================================
--- trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
(rev 0)
+++ trunk/edk2/OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
2015-02-28 20:32:39 UTC (rev 16970)
@@ -0,0 +1,52 @@
+## @file
+# Xen Hypercall abstraction lib for Intel architecture
+#
+# Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD
License
+# which accompanies this distribution. The full text of the license may be
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = XenHypercallLibIntel
+ FILE_GUID = B5EE9A32-CA5A-49A8-82E3-ADA4CCB77C7C
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = XenHypercallLib|DXE_DRIVER UEFI_DRIVER
+ CONSTRUCTOR = XenHypercallLibIntelInit
+
+#
+# The following information is for reference only and not required by the
build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ XenHypercallIntel.c
+
+[Sources.IA32]
+ Ia32/hypercall.nasm
+
+[Sources.X64]
+ X64/hypercall.nasm
+
+[Sources]
+ XenHypercall.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ HobLib
+ DebugLib
+
+[Guids]
+ gEfiXenInfoGuid
Modified: trunk/edk2/OvmfPkg/OvmfPkg.dec
===================================================================
--- trunk/edk2/OvmfPkg/OvmfPkg.dec 2015-02-28 20:32:27 UTC (rev 16969)
+++ trunk/edk2/OvmfPkg/OvmfPkg.dec 2015-02-28 20:32:39 UTC (rev 16970)
@@ -44,6 +44,10 @@
#
SerializeVariablesLib|Include/Library/SerializeVariablesLib.h
+ ## @libraryclass Invoke Xen hypercalls
+ #
+ XenHypercallLib|Include/Library/XenHypercallLib.h
+
[Guids]
gUefiOvmfPkgTokenSpaceGuid = {0x93bb96af, 0xb9f2, 0x4eb8, {0x94, 0x62,
0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}}
gEfiXenInfoGuid = {0xd3b46f3b, 0xd441, 0x1244, {0x9a, 0x12,
0x0, 0x12, 0x27, 0x3f, 0xc1, 0x4d}}
Modified: trunk/edk2/OvmfPkg/OvmfPkgIa32.dsc
===================================================================
--- trunk/edk2/OvmfPkg/OvmfPkgIa32.dsc 2015-02-28 20:32:27 UTC (rev 16969)
+++ trunk/edk2/OvmfPkg/OvmfPkgIa32.dsc 2015-02-28 20:32:39 UTC (rev 16970)
@@ -128,6 +128,7 @@
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
+ XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
[LibraryClasses.common]
!if $(SECURE_BOOT_ENABLE) == TRUE
Modified: trunk/edk2/OvmfPkg/OvmfPkgIa32X64.dsc
===================================================================
--- trunk/edk2/OvmfPkg/OvmfPkgIa32X64.dsc 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/OvmfPkgIa32X64.dsc 2015-02-28 20:32:39 UTC (rev
16970)
@@ -133,6 +133,7 @@
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
+ XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
[LibraryClasses.common]
!if $(SECURE_BOOT_ENABLE) == TRUE
Modified: trunk/edk2/OvmfPkg/OvmfPkgX64.dsc
===================================================================
--- trunk/edk2/OvmfPkg/OvmfPkgX64.dsc 2015-02-28 20:32:27 UTC (rev 16969)
+++ trunk/edk2/OvmfPkg/OvmfPkgX64.dsc 2015-02-28 20:32:39 UTC (rev 16970)
@@ -133,6 +133,7 @@
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
+ XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLibIntel.inf
[LibraryClasses.common]
!if $(SECURE_BOOT_ENABLE) == TRUE
Modified: trunk/edk2/OvmfPkg/XenBusDxe/EventChannel.c
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/EventChannel.c 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/EventChannel.c 2015-02-28 20:32:39 UTC (rev
16970)
@@ -16,8 +16,9 @@
**/
#include "EventChannel.h"
-#include "XenHypercall.h"
+#include <Library/XenHypercallLib.h>
+
UINT32
XenEventChannelNotify (
IN XENBUS_DEVICE *Dev,
Modified: trunk/edk2/OvmfPkg/XenBusDxe/GrantTable.c
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/GrantTable.c 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/GrantTable.c 2015-02-28 20:32:39 UTC (rev
16970)
@@ -34,7 +34,7 @@
#include <IndustryStandard/Xen/memory.h>
-#include "XenHypercall.h"
+#include <Library/XenHypercallLib.h>
#include "GrantTable.h"
#include "InterlockedCompareExchange16.h"
Deleted: trunk/edk2/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm 2015-02-28 20:32:27 UTC
(rev 16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm 2015-02-28 20:32:39 UTC
(rev 16970)
@@ -1,25 +0,0 @@
-SECTION .text
-
-; INTN
-; EFIAPI
-; __XenHypercall2 (
-; IN VOID *HypercallAddr,
-; IN OUT INTN Arg1,
-; IN OUT INTN Arg2
-; );
-global ASM_PFX(__XenHypercall2)
-ASM_PFX(__XenHypercall2):
- ; Save only ebx, ecx is supposed to be a scratch register and needs to be
- ; saved by the caller
- push ebx
- ; Copy HypercallAddr to eax
- mov eax, [esp + 8]
- ; Copy Arg1 to the register expected by Xen
- mov ebx, [esp + 12]
- ; Copy Arg2 to the register expected by Xen
- mov ecx, [esp + 16]
- ; Call HypercallAddr
- call eax
- pop ebx
- ret
-
Deleted: trunk/edk2/OvmfPkg/XenBusDxe/X64/hypercall.nasm
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/X64/hypercall.nasm 2015-02-28 20:32:27 UTC
(rev 16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/X64/hypercall.nasm 2015-02-28 20:32:39 UTC
(rev 16970)
@@ -1,26 +0,0 @@
-DEFAULT REL
-SECTION .text
-
-; INTN
-; EFIAPI
-; __XenHypercall2 (
-; IN VOID *HypercallAddr,
-; IN OUT INTN Arg1,
-; IN OUT INTN Arg2
-; );
-global ASM_PFX(__XenHypercall2)
-ASM_PFX(__XenHypercall2):
- push rdi
- push rsi
- ; Copy HypercallAddr to rax
- mov rax, rcx
- ; Copy Arg1 to the register expected by Xen
- mov rdi, rdx
- ; Copy Arg2 to the register expected by Xen
- mov rsi, r8
- ; Call HypercallAddr
- call rax
- pop rsi
- pop rdi
- ret
-
Modified: trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.c
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.c 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.c 2015-02-28 20:32:39 UTC (rev
16970)
@@ -26,10 +26,10 @@
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/Acpi.h>
#include <Library/DebugLib.h>
+#include <Library/XenHypercallLib.h>
#include "XenBusDxe.h"
-#include "XenHypercall.h"
#include "GrantTable.h"
#include "XenStore.h"
#include "XenBus.h"
@@ -390,13 +390,6 @@
MmioAddr = BarDesc->AddrRangeMin;
FreePool (BarDesc);
- Status = XenHyperpageInit ();
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "XenBus: Unable to retrieve the hyperpage.\n"));
- Status = EFI_UNSUPPORTED;
- goto ErrorAllocated;
- }
-
Status = XenGetSharedInfoPage (Dev);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "XenBus: Unable to get the shared info page.\n"));
Modified: trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.inf
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.inf 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/XenBusDxe.inf 2015-02-28 20:32:39 UTC (rev
16970)
@@ -34,8 +34,6 @@
DriverBinding.h
ComponentName.c
ComponentName.h
- XenHypercall.c
- XenHypercall.h
InterlockedCompareExchange16.c
InterlockedCompareExchange16.h
GrantTable.c
@@ -49,12 +47,10 @@
Helpers.c
[Sources.IA32]
- Ia32/hypercall.nasm
Ia32/InterlockedCompareExchange16.nasm
Ia32/TestAndClearBit.nasm
[Sources.X64]
- X64/hypercall.nasm
X64/InterlockedCompareExchange16.nasm
X64/TestAndClearBit.nasm
@@ -67,9 +63,8 @@
UefiLib
DevicePathLib
DebugLib
- HobLib
+ XenHypercallLib
-
[Protocols]
gEfiDriverBindingProtocolGuid
gEfiPciIoProtocolGuid
@@ -77,7 +72,3 @@
gEfiComponentNameProtocolGuid
gXenBusProtocolGuid
-
-[Guids]
- gEfiXenInfoGuid
-
Deleted: trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.c
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.c 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.c 2015-02-28 20:32:39 UTC (rev
16970)
@@ -1,107 +0,0 @@
-/** @file
- Functions to make Xen hypercalls.
-
- Copyright (C) 2014, Citrix Ltd.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD
License
- which accompanies this distribution. The full text of the license may be
found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <PiDxe.h>
-#include <Library/HobLib.h>
-#include <Guid/XenInfo.h>
-
-#include "XenBusDxe.h"
-#include "XenHypercall.h"
-
-#include <IndustryStandard/Xen/hvm/params.h>
-#include <IndustryStandard/Xen/memory.h>
-
-STATIC VOID *HyperPage;
-
-//
-// Interface exposed by the ASM implementation of the core hypercall
-//
-INTN
-EFIAPI
-__XenHypercall2 (
- IN VOID *HypercallAddr,
- IN OUT INTN Arg1,
- IN OUT INTN Arg2
- );
-
-EFI_STATUS
-XenHyperpageInit (
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- EFI_XEN_INFO *XenInfo;
-
- GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
- if (GuidHob == NULL) {
- return EFI_NOT_FOUND;
- }
- XenInfo = (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob);
- HyperPage = XenInfo->HyperPages;
- return EFI_SUCCESS;
-}
-
-UINT64
-XenHypercallHvmGetParam (
- IN UINT32 Index
- )
-{
- xen_hvm_param_t Parameter;
- INTN Error;
-
- Parameter.domid = DOMID_SELF;
- Parameter.index = Index;
- Error = XenHypercall2 (__HYPERVISOR_hvm_op,
- HVMOP_get_param, (INTN) &Parameter);
- if (Error != 0) {
- DEBUG ((EFI_D_ERROR,
- "XenHypercall: Error %d trying to get HVM parameter %d\n",
- Error, Index));
- return 0;
- }
- return Parameter.value;
-}
-
-INTN
-XenHypercallMemoryOp (
- IN UINTN Operation,
- IN OUT VOID *Arguments
- )
-{
- return XenHypercall2 (__HYPERVISOR_memory_op,
- Operation, (INTN) Arguments);
-}
-
-INTN
-XenHypercallEventChannelOp (
- IN INTN Operation,
- IN OUT VOID *Arguments
- )
-{
- return XenHypercall2 (__HYPERVISOR_event_channel_op,
- Operation, (INTN) Arguments);
-}
-
-INTN
-EFIAPI
-XenHypercall2 (
- IN UINTN HypercallID,
- IN OUT INTN Arg1,
- IN OUT INTN Arg2
- )
-{
- ASSERT (HyperPage != NULL);
-
- return __XenHypercall2 ((UINT8*)HyperPage + HypercallID * 32, Arg1, Arg2);
-}
Deleted: trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.h
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.h 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/XenHypercall.h 2015-02-28 20:32:39 UTC (rev
16970)
@@ -1,91 +0,0 @@
-/** @file
- Functions declarations to make Xen hypercalls.
-
- Copyright (C) 2014, Citrix Ltd.
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD
License
- which accompanies this distribution. The full text of the license may be
found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __XENBUS_DXE_HYPERCALL_H__
-#define __XENBUS_DXE_HYPERCALL_H__
-
-/**
- This function will put the two arguments in the right place (registers) and
- invoke the hypercall identified by HypercallID.
-
- @param HypercallID The symbolic ID of the hypercall to be invoked
- @param Arg1 First argument.
- @param Arg2 Second argument.
-
- @return Return 0 if success otherwise it return an errno.
-**/
-INTN
-EFIAPI
-XenHypercall2 (
- IN INTN HypercallID,
- IN OUT INTN Arg1,
- IN OUT INTN Arg2
- );
-
-/**
- Get the page where all hypercall are from the XenInfo hob.
-
- @param Dev A XENBUS_DEVICE instance.
-
- @retval EFI_NOT_FOUND hyperpage could not be found.
- @retval EFI_SUCCESS Successfully retrieve the hyperpage pointer.
-**/
-EFI_STATUS
-XenHyperpageInit (
- );
-
-/**
- Return the value of the HVM parameter Index.
-
- @param Index The parameter to get, e.g. HVM_PARAM_STORE_EVTCHN.
-
- @return The value of the asked parameter or 0 in case of error.
-**/
-UINT64
-XenHypercallHvmGetParam (
- UINT32 Index
- );
-
-/**
- Hypercall to do different operation on the memory.
-
- @param Operation The operation number, e.g. XENMEM_add_to_physmap.
- @param Arguments The arguments associated to the operation.
-
- @return Return the return value from the hypercall, 0 in case of success
- otherwise, an error code.
-**/
-INTN
-XenHypercallMemoryOp (
- IN UINTN Operation,
- IN OUT VOID *Arguments
- );
-
-/**
- Do an operation on the event channels.
-
- @param Operation The operation number, e.g. EVTCHNOP_send.
- @param Arguments The argument associated to the operation.
-
- @return Return the return value from the hypercall, 0 in case of success
- otherwise, an error code.
-**/
-INTN
-XenHypercallEventChannelOp (
- IN INTN Operation,
- IN OUT VOID *Arguments
- );
-
-#endif
Modified: trunk/edk2/OvmfPkg/XenBusDxe/XenStore.c
===================================================================
--- trunk/edk2/OvmfPkg/XenBusDxe/XenStore.c 2015-02-28 20:32:27 UTC (rev
16969)
+++ trunk/edk2/OvmfPkg/XenBusDxe/XenStore.c 2015-02-28 20:32:39 UTC (rev
16970)
@@ -60,8 +60,8 @@
#include <IndustryStandard/Xen/hvm/params.h>
-#include "XenHypercall.h"
#include "EventChannel.h"
+#include <Library/XenHypercallLib.h>
//
// Private Data Structures
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits