From: AbnerChang <[email protected]>
Add RISC-V Xen definitions.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Abner Chang<[email protected]>
---
.../IndustryStandard/Xen/arch-riscv/xen-riscv128.h | 56 +++++++++++
.../IndustryStandard/Xen/arch-riscv/xen-riscv32.h | 56 +++++++++++
.../IndustryStandard/Xen/arch-riscv/xen-riscv64.h | 56 +++++++++++
.../Include/IndustryStandard/Xen/arch-riscv/xen.h | 111 +++++++++++++++++++++
OvmfPkg/Include/IndustryStandard/Xen/xen.h | 3 +
5 files changed, 282 insertions(+)
create mode 100644
OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv128.h
create mode 100644
OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv32.h
create mode 100644
OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv64.h
create mode 100644 OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen.h
diff --git a/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv128.h
b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv128.h
new file mode 100644
index 0000000..13ba3de
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv128.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * xen-riscv64.h
+ *
+ * Guest OS interface to RISC-V 128-bit Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+ * Copyright (c) 2004-2006, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV128_H__
+#define __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV128_H__
+
+/*
+ * Hypercall interface:
+ * Input: TBD
+ * Output: TBD
+ */
+
+#ifndef __ASSEMBLY__
+
+struct arch_vcpu_info {
+ UINTN pad [4]; /* sizeof(vcpu_info_t) == 64 */
+};
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV128_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv32.h
b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv32.h
new file mode 100644
index 0000000..a20b19f
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv32.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * xen-riscv32.h
+ *
+ * Guest OS interface to RISC-V 32-bit Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+ * Copyright (c) 2004-2007, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV32_H__
+#define __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV32_H__
+
+/*
+ * Hypercall interface:
+ * Input: TBD
+ * Output: TBD
+ */
+
+#ifndef __ASSEMBLY__
+
+struct arch_vcpu_info {
+ UINTN pad [16]; /* sizeof(vcpu_info_t) == 64 */
+};
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV32_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv64.h
b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv64.h
new file mode 100644
index 0000000..8aefa4b
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen-riscv64.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * xen-riscv64.h
+ *
+ * Guest OS interface to RISC-V 64-bit Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+ * Copyright (c) 2004-2006, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV64_H__
+#define __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV64_H__
+
+/*
+ * Hypercall interface:
+ * Input: TBD
+ * Output: TBD
+ */
+
+#ifndef __ASSEMBLY__
+
+struct arch_vcpu_info {
+ UINTN pad [8]; /* sizeof(vcpu_info_t) == 64 */
+};
+typedef struct arch_vcpu_info arch_vcpu_info_t;
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __XEN_PUBLIC_ARCH_RISCV_XEN_RISCV64_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen.h
b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen.h
new file mode 100644
index 0000000..628c761
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Xen/arch-riscv/xen.h
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * arch-riscv/xen.h
+ *
+ * Guest OS interface to x86 and RISC-V Xen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+ * Copyright (c) 2004-2006, K A Fraser
+ */
+
+#include "../xen.h"
+
+#ifndef __XEN_PUBLIC_ARCH_RISCV_XEN_H__
+#define __XEN_PUBLIC_ARCH_RISCV_XEN_H__
+
+/* Structural guest handles introduced in 0x00030201. */
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+ typedef struct { type *p; } __guest_handle_ ## name
+#else
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+ typedef type * __guest_handle_ ## name
+#endif
+
+/*
+ * XEN_GUEST_HANDLE represents a guest pointer, when passed as a field
+ * in a struct in memory.
+ * XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an
+ * hypercall argument.
+ * XEN_GUEST_HANDLE_PARAM and XEN_GUEST_HANDLE are the same on X86 but
+ * they might not be on other architectures.
+ */
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+ ___DEFINE_XEN_GUEST_HANDLE(name, type); \
+ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
+#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
+#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
+#define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name)
+#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
+#ifdef __XEN_TOOLS__
+#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
+#endif
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
+
+#if defined(MDE_CPU_RISCV32)
+#include "xen-riscv32.h"
+#elif defined(MDE_CPU_RISCV64)
+#include "xen-riscv64.h"
+#elif defined(MDE_CPU_RISCV128)
+#include "xen-riscv128.h"
+#endif
+
+#ifndef __ASSEMBLY__
+typedef UINTN xen_pfn_t;
+#define PRI_xen_pfn "lx"
+#endif
+
+#define XEN_HAVE_PV_UPCALL_MASK 1
+
+/* Maximum number of virtual CPUs in legacy multi-processor guests. */
+#define XEN_LEGACY_MAX_VCPUS 32
+
+#ifndef __ASSEMBLY__
+
+typedef UINTN xen_ulong_t;
+#define PRI_xen_ulong "lx"
+
+typedef UINT64 tsc_timestamp_t; /* RDTSC timestamp */
+
+#pragma pack(8)
+struct arch_shared_info {
+ UINTN max_pfn; /* max pfn that appears in table */
+ /* Frame containing list of mfns containing list of mfns containing p2m. */
+ xen_pfn_t pfn_to_mfn_frame_list_list;
+ UINTN nmi_reason;
+ UINT64 pad[32];
+};
+typedef struct arch_shared_info arch_shared_info_t;
+#pragma pack()
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __XEN_PUBLIC_ARCH_RISCV_XEN_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/OvmfPkg/Include/IndustryStandard/Xen/xen.h
b/OvmfPkg/Include/IndustryStandard/Xen/xen.h
index 8596ca1..02c29e0 100644
--- a/OvmfPkg/Include/IndustryStandard/Xen/xen.h
+++ b/OvmfPkg/Include/IndustryStandard/Xen/xen.h
@@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*
* Copyright (c) 2004, K A Fraser
+ * Copyright (c) 2016, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
*/
#ifndef __XEN_PUBLIC_XEN_H__
@@ -38,6 +39,8 @@
#include "arch-x86/xen.h"
#elif defined(__arm__) || defined (__aarch64__)
#include "arch-arm/xen.h"
+#elif defined(MDE_CPU_RISCV32) || defined (MDE_CPU_RISCV64) || defined
(MDE_CPU_RISCV128)
+#include "arch-riscv/xen.h"
#else
#error "Unsupported architecture"
#endif
--
1.9.5.msysgit.0
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel