Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136947247
D21439.id61355.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D21439.id61355.diff
View Options
Index: sys/arm64/arm64/smccc-call.S
===================================================================
--- /dev/null
+++ sys/arm64/arm64/smccc-call.S
@@ -0,0 +1,58 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ruslan Bukin <br@bsdpad.com>
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * uint64_t arm_smccc_hvc(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
+ * uint64_t, uint64_t, uint64_t, uint64_t *res)
+ */
+ENTRY(arm_smccc_hvc)
+ hvc #0
+ ldr x4, [sp]
+ stp x0, x1, [x4, #16 * 0]
+ stp x2, x3, [x4, #16 * 1]
+ ret
+END(arm_smccc_hvc)
+
+/*
+ * uint64_t arm_smccc_smc(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
+ * uint64_t, uint64_t, uint64_t, uint64_t *res)
+ */
+ENTRY(arm_smccc_smc)
+ smc #0
+ ldr x4, [sp]
+ stp x0, x1, [x4, #16 * 0]
+ stp x2, x3, [x4, #16 * 1]
+ ret
+END(arm_smccc_smc)
Index: sys/arm64/include/arm-smccc.h
===================================================================
--- /dev/null
+++ sys/arm64/include/arm-smccc.h
@@ -0,0 +1,72 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 Andrew Turner
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_SMCCC_H_
+#define _MACHINE_SMCCC_H_
+
+#define SMCCC_VERSION_MAJOR(ver) (((ver) >> 16) & 0x7fff)
+#define SMCCC_VERSION_MINOR(ver) ((ver) & 0xffff)
+
+#define SMCCC_FUNC_ID(type, call_conv, range, func) \
+ (((type) << 31) | \
+ ((call_conv) << 30) | \
+ (((range) & 0x3f) << 24) | \
+ ((func) & 0xffff))
+
+#define SMCCC_YIELDING_CALL 0
+#define SMCCC_FAST_CALL 1
+
+#define SMCCC_32BIT_CALL 0
+#define SMCCC_64BIT_CALL 1
+
+#define SMCCC_ARM_ARCH_CALLS 0
+#define SMCCC_CPU_SERVICE_CALLS 1
+#define SMCCC_SIP_SERVICE_CALLS 2
+#define SMCCC_OEM_SERVICE_CALLS 3
+#define SMCCC_STD_SECURE_SERVICE_CALLS 4
+#define SMCCC_STD_HYP_SERVICE_CALLS 5
+#define SMCCC_VENDOR_HYP_SERVICE_CALLS 6
+
+struct arm_smccc_res {
+ uint64_t a0;
+ uint64_t a1;
+ uint64_t a2;
+ uint64_t a3;
+};
+
+uint64_t arm_smccc_smc(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
+ uint64_t, uint64_t, uint64_t, struct arm_smccc_res *res);
+uint64_t arm_smccc_hvc(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
+ uint64_t, uint64_t, uint64_t, struct arm_smccc_res *res);
+
+#endif /* !_MACHINE_SMCCC_H_ */
Index: sys/conf/files.arm64
===================================================================
--- sys/conf/files.arm64
+++ sys/conf/files.arm64
@@ -149,6 +149,7 @@
arm64/arm64/nexus.c standard
arm64/arm64/ofw_machdep.c optional fdt
arm64/arm64/pmap.c standard
+arm64/arm64/smccc-call.S standard
arm64/arm64/stack_machdep.c optional ddb | stack
arm64/arm64/support.S standard
arm64/arm64/swtch.S standard
Index: sys/dev/psci/smccc.h
===================================================================
--- sys/dev/psci/smccc.h
+++ sys/dev/psci/smccc.h
@@ -34,20 +34,7 @@
#ifndef _PSCI_SMCCC_H_
#define _PSCI_SMCCC_H_
-#define SMCCC_VERSION_MAJOR(ver) (((ver) >> 16) & 0x7fff)
-#define SMCCC_VERSION_MINOR(ver) ((ver) & 0xffff)
-
-#define SMCCC_FUNC_ID(type, call_conv, range, func) \
- (((type) << 31) | \
- ((call_conv) << 30) | \
- (((range) & 0x3f) << 24) | \
- ((func) & 0xffff))
-
-#define SMCCC_YIELDING_CALL 0
-#define SMCCC_FAST_CALL 1
-
-#define SMCCC_32BIT_CALL 0
-#define SMCCC_64BIT_CALL 1
+#include <machine/arm-smccc.h>
/*
* Arm Architecture Calls.
@@ -71,5 +58,4 @@
int smccc_arch_workaround_1(void);
int smccc_arch_workaround_2(int);
-
#endif /* _PSCI_SMCCC_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 21, 7:21 PM (46 m, 53 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25791375
Default Alt Text
D21439.id61355.diff (6 KB)
Attached To
Mode
D21439: Generic SMCCC
Attached
Detach File
Event Timeline
Log In to Comment