summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-08 08:10:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-12 10:00:32 +0200
commit356b1b8516bc16467feacf54ad0b602bee8261d1 (patch)
treec64d1322767f58712ad777e5a966e1db0b72b2a7 /c
parentbsp/qoriq: Import ePAPR hcalls from Linux 4.12 (diff)
downloadrtems-356b1b8516bc16467feacf54ad0b602bee8261d1.tar.bz2
bsp/qoriq: Port ePAPR hcall interface to RTEMS
Update #3085.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/Makefile.am10
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/include/asm/epapr_hcalls.h22
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/include/asm/fsl_hcalls.h6
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/preinstall.am22
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/startup/epapr_hcalls.S26
5 files changed, 70 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
index 4bb0453ad8..b2c778bb07 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
@@ -3,6 +3,8 @@ ACLOCAL_AMFLAGS = -I ../../../../aclocal
include $(top_srcdir)/../../../../automake/compile.am
include_bspdir = $(includedir)/bsp
+include_asmdir = $(includedir)/asm
+include_uapi_asmdir = $(includedir)/uapi/asm
dist_project_lib_DATA = bsp_specs
@@ -32,6 +34,13 @@ include_bsp_HEADERS = include/irq.h \
include/uart-bridge.h \
include/qoriq.h
+include_asm_HEADERS =
+include_asm_HEADERS += include/asm/epapr_hcalls.h
+include_asm_HEADERS += include/asm/fsl_hcalls.h
+
+include_uapi_asm_HEADERS =
+include_uapi_asm_HEADERS += include/uapi/asm/epapr_hcalls.h
+
noinst_LIBRARIES = libbspstart.a
libbspstart_a_SOURCES = start/start.S
project_lib_DATA = start.$(OBJEXT)
@@ -64,6 +73,7 @@ libbsp_a_SOURCES += \
../shared/src/tictac.c \
../shared/src/bsp-start-zero.S \
../shared/startup/bspidle.c \
+ startup/epapr_hcalls.S \
startup/l1cache.S \
startup/l2cache.S \
startup/mmu.c \
diff --git a/c/src/lib/libbsp/powerpc/qoriq/include/asm/epapr_hcalls.h b/c/src/lib/libbsp/powerpc/qoriq/include/asm/epapr_hcalls.h
index 334459ad14..3d87cca611 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/include/asm/epapr_hcalls.h
+++ b/c/src/lib/libbsp/powerpc/qoriq/include/asm/epapr_hcalls.h
@@ -53,9 +53,7 @@
#include <uapi/asm/epapr_hcalls.h>
#ifndef __ASSEMBLY__
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <asm/byteorder.h>
+#include <sys/endian.h>
/*
* Hypercall register clobber list
@@ -103,7 +101,7 @@
#define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
extern bool epapr_paravirt_enabled;
-extern u32 epapr_hypercall_start[];
+extern uint32_t epapr_hypercall_start[];
#ifdef CONFIG_EPAPR_PARAVIRT
int __init epapr_paravirt_early_init(void);
@@ -294,10 +292,10 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_SEND);
r3 = handle;
r4 = *count;
- r5 = be32_to_cpu(p[0]);
- r6 = be32_to_cpu(p[1]);
- r7 = be32_to_cpu(p[2]);
- r8 = be32_to_cpu(p[3]);
+ r5 = be32toh(p[0]);
+ r6 = be32toh(p[1]);
+ r7 = be32toh(p[2]);
+ r8 = be32toh(p[3]);
asm volatile("bl epapr_hypercall_start"
: "+r" (r11), "+r" (r3),
@@ -345,10 +343,10 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
);
*count = r4;
- p[0] = cpu_to_be32(r5);
- p[1] = cpu_to_be32(r6);
- p[2] = cpu_to_be32(r7);
- p[3] = cpu_to_be32(r8);
+ p[0] = htobe32(r5);
+ p[1] = htobe32(r6);
+ p[2] = htobe32(r7);
+ p[3] = htobe32(r8);
return r3;
}
diff --git a/c/src/lib/libbsp/powerpc/qoriq/include/asm/fsl_hcalls.h b/c/src/lib/libbsp/powerpc/qoriq/include/asm/fsl_hcalls.h
index b889d13547..ba76c132aa 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/include/asm/fsl_hcalls.h
+++ b/c/src/lib/libbsp/powerpc/qoriq/include/asm/fsl_hcalls.h
@@ -40,9 +40,7 @@
#ifndef _FSL_HCALLS_H
#define _FSL_HCALLS_H
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <asm/byteorder.h>
+#include <stdint.h>
#include <asm/epapr_hcalls.h>
#define FH_API_VERSION 1
@@ -355,7 +353,7 @@ struct fh_sg_list {
* Returns 0 for success, or an error code.
*/
static inline unsigned int fh_partition_memcpy(unsigned int source,
- unsigned int target, phys_addr_t sg_list, unsigned int count)
+ unsigned int target, uint64_t sg_list, unsigned int count)
{
register uintptr_t r11 __asm__("r11");
register uintptr_t r3 __asm__("r3");
diff --git a/c/src/lib/libbsp/powerpc/qoriq/preinstall.am b/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
index 6b6ac4bf5c..24113fb698 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
+++ b/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
@@ -33,6 +33,16 @@ $(PROJECT_INCLUDE)/bsp/$(dirstamp):
@: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+$(PROJECT_INCLUDE)/asm/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_INCLUDE)/asm
+ @: > $(PROJECT_INCLUDE)/asm/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/asm/$(dirstamp)
+
+$(PROJECT_INCLUDE)/uapi/asm/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_INCLUDE)/uapi/asm
+ @: > $(PROJECT_INCLUDE)/uapi/asm/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/uapi/asm/$(dirstamp)
+
$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
@@ -105,6 +115,18 @@ $(PROJECT_INCLUDE)/bsp/qoriq.h: include/qoriq.h $(PROJECT_INCLUDE)/bsp/$(dirstam
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/qoriq.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/qoriq.h
+$(PROJECT_INCLUDE)/asm/epapr_hcalls.h: include/asm/epapr_hcalls.h $(PROJECT_INCLUDE)/asm/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/asm/epapr_hcalls.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/asm/epapr_hcalls.h
+
+$(PROJECT_INCLUDE)/asm/fsl_hcalls.h: include/asm/fsl_hcalls.h $(PROJECT_INCLUDE)/asm/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/asm/fsl_hcalls.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/asm/fsl_hcalls.h
+
+$(PROJECT_INCLUDE)/uapi/asm/epapr_hcalls.h: include/uapi/asm/epapr_hcalls.h $(PROJECT_INCLUDE)/uapi/asm/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/uapi/asm/epapr_hcalls.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/uapi/asm/epapr_hcalls.h
+
$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/epapr_hcalls.S b/c/src/lib/libbsp/powerpc/qoriq/startup/epapr_hcalls.S
new file mode 100644
index 0000000000..b019e5d710
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/epapr_hcalls.S
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <libcpu/powerpc-utility.h>
+
+ .text
+
+ .global epapr_hypercall_start
+epapr_hypercall_start:
+
+ sc 1
+ nop
+ nop
+ nop
+ blr