Merge "[rdkb][ccn34][crypto][Change eip-related packages to meta-filogic]"
diff --git a/recipes-netsys/crypto-safexcel/crypto-safexcel.bb b/recipes-netsys/crypto-safexcel/crypto-safexcel.bb
new file mode 100644
index 0000000..4ae56fe
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/crypto-safexcel.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Firmwares for EIP-197 Upstream Lookaside Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+SRC_URI = " \
+ file://src/firmware/ipue.bin \
+ file://src/firmware/ifpp.bin \
+ "
+
+S = "${WORKDIR}"
+
+inherit allarch
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+ # Module
+ install -d ${D}/${base_libdir}/firmware/inside-secure/eip197_minifw
+ install -m 0755 ${THISDIR}/files/src/firmware/ipue.bin ${D}/${base_libdir}/firmware/inside-secure/eip197_minifw/
+ install -m 0755 ${THISDIR}/files/src/firmware/ifpp.bin ${D}/${base_libdir}/firmware/inside-secure/eip197_minifw/
+}
+
+FILES_${PN} += "${base_libdir}/firmware/inside-secure/eip197_minifw/*"
diff --git a/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.service b/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.service
new file mode 100644
index 0000000..9aed56d
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=safexcel_insmod
+After=tops_insmod.service
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh /usr/sbin/safexcel_insmod.sh
+ExecStartPost=/bin/sh -c '(/bin/touch /tmp/safexcel_initialized)'
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.sh b/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.sh
new file mode 100644
index 0000000..4fda33d
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/files/init/safexcel_insmod.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# insmod eip-197 driver
+echo insmod EIP-197 lookaside driver
+
+#modprobe crypto-eip-inline
+modprobe crypto_safexcel
diff --git a/recipes-netsys/crypto-safexcel/files/src/firmware/ifpp.bin b/recipes-netsys/crypto-safexcel/files/src/firmware/ifpp.bin
new file mode 100644
index 0000000..b4a8322
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/files/src/firmware/ifpp.bin
Binary files differ
diff --git a/recipes-netsys/crypto-safexcel/files/src/firmware/ipue.bin b/recipes-netsys/crypto-safexcel/files/src/firmware/ipue.bin
new file mode 100644
index 0000000..2f54999
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/files/src/firmware/ipue.bin
Binary files differ
diff --git a/recipes-netsys/crypto-safexcel/safexcel-insmod.bb b/recipes-netsys/crypto-safexcel/safexcel-insmod.bb
new file mode 100644
index 0000000..2dec63d
--- /dev/null
+++ b/recipes-netsys/crypto-safexcel/safexcel-insmod.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Bringup scripts for EIP-197 Upstream Lookaside Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/init:"
+
+S = "${WORKDIR}/init"
+
+inherit systemd
+
+SRC_URI = "file://init"
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = " safexcel_insmod.service"
+FILES_${PN} += "{systemd_unitdir}/system/safexcel_insmod.service"
+
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+do_install() {
+ install -d ${D}${sbindir}
+ install -m 0755 ${S}/safexcel_insmod.sh ${D}${sbindir}/safexcel_insmod.sh
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${S}/safexcel_insmod.service ${D}${systemd_unitdir}/system
+}
diff --git a/recipes-netsys/eip-197/eip-197-insmod.bb b/recipes-netsys/eip-197/eip-197-insmod.bb
new file mode 100644
index 0000000..4da5b11
--- /dev/null
+++ b/recipes-netsys/eip-197/eip-197-insmod.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Bring up scripts for Mediatek EIP-197 Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/init:"
+
+S = "${WORKDIR}/init"
+
+inherit systemd
+
+SRC_URI = "file://init"
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = " eip-197_insmod.service"
+FILES_${PN} += "{systemd_unitdir}/system/eip-197_insmod.service"
+
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+do_install() {
+ install -d ${D}${sbindir}
+ install -m 0755 ${S}/eip-197_insmod.sh ${D}${sbindir}/eip-197_insmod.sh
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${S}/eip-197_insmod.service ${D}${systemd_unitdir}/system
+}
diff --git a/recipes-netsys/eip-197/eip-197.bb b/recipes-netsys/eip-197/eip-197.bb
new file mode 100644
index 0000000..bc246b9
--- /dev/null
+++ b/recipes-netsys/eip-197/eip-197.bb
@@ -0,0 +1,95 @@
+SUMMARY = "Mediatek EIP-197 Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit module
+
+SRC_URI = "git://gerrit.mediatek.inc/openwrt/feeds/mtk_openwrt_feeds;protocol=https;branch=master;destsuffix=git"
+SRCREV = "${AUTOREV}"
+
+S = "${WORKDIR}/git/feed/kernel/crypto-eip/src"
+
+DEPENDS += "pce"
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'capwap-dtls', 'tops', '', d)}"
+
+do_configure[noexec] = "1"
+
+# Include Paths
+INCLUDE_FLAGS_ALL=" \
+ -I${S}/ddk/inc \
+ -I${S}/ddk/inc/crypto-eip/ddk \
+ -I${S}/ddk/inc/crypto-eip/ddk/configs \
+ -I${S}/ddk/inc/crypto-eip/ddk/device \
+ -I${S}/ddk/inc/crypto-eip/ddk/device/lkm \
+ -I${S}/ddk/inc/crypto-eip/ddk/device/lkm/of \
+ -I${S}/ddk/inc/crypto-eip/ddk/dmares \
+ -I${S}/ddk/inc/crypto-eip/ddk/firmware_api \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/builder/sa \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/builder/token \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/eip197 \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/iotoken \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/list \
+ -I${S}/ddk/inc/crypto-eip/ddk/kit/ring \
+ -I${S}/ddk/inc/crypto-eip/ddk/libc \
+ -I${S}/ddk/inc/crypto-eip/ddk/log \
+ -I${S}/ddk/inc/crypto-eip/ddk/shdevxs \
+ -I${S}/ddk/inc/crypto-eip/ddk/slad \
+ -I${S}/ddk/inc/crypto-eip/ddk/slad/lkm \
+ -I${STAGING_KERNEL_BUILDDIR}/source/drivers/net/ethernet/mediatek/ \
+ -I${STAGING_KERNEL_BUILDDIR}/source/include \
+ "
+
+PKG_MAKE_FLAGS = " \
+ CONFIG_MTK_CRYPTO_EIP_INLINE=m \
+ CONFIG_RAMBUS_DDK=m \
+ CONFIG_CRYPTO_XFRM_OFFLOAD_MTK_PCE=y \
+ CONFIG_CRYPTO_OFFLOAD_INLINE=y \
+ CONFIG_INET_ESP_OFFLOAD=y \
+ CONFIG_CRYPTO_HW=y \
+ CONFIG_CRYPTO_AUTHENC=y \
+ CONFIG_CRYPTO_AES=y \
+ CONFIG_CRYPTO_AEAD=y \
+ CONFIG_CRYPTO_DES=y \
+ CONFIG_CRYPTO_MD5=y \
+ CONFIG_CRYPTO_SHA1=y \
+ CONFIG_CRYPTO_SHA256=y \
+ CONFIG_CRYPTO_SHA512=y \
+ CONFIG_CRYPTO_SHA3=y \
+ CONFIG_CRYPTO_HMAC=y \
+ CONFIG_INET_ESP=y \
+ "
+
+EXTRA_CFLAGS+=" \
+ ${INCLUDE_FLAGS_ALL} \
+ -DEIP197_BUS_VERSION_AXI3 \
+ -DDRIVER_64BIT_HOST \
+ -DDRIVER_64BIT_DEVICE \
+ -DADAPTER_AUTO_TOKENBUILDER \
+ -DCONFIG_XFRM_OFFLOAD \
+ -DCONFIG_CRYPTO_XFRM_OFFLOAD_MTK_PCE \
+ -DMODULE \
+ "
+
+include ${@bb.utils.contains('DISTRO_FEATURES', 'capwap-dtls', 'files/custom/eip-197-capwap-dtls.inc', '', d)}
+
+EXTRA_OEMAKE = " \
+ -C ${STAGING_KERNEL_BUILDDIR}/ \
+ M=${S} \
+ ${PKG_MAKE_FLAGS} \
+ EXTRA_CFLAGS='${EXTRA_CFLAGS}' \
+ modules \
+ "
+
+do_install_append() {
+ install -d ${D}/${base_libdir}/modules/${KERNEL_VERSION}/extra/
+ install -m 0755 ${S}/crypto-eip-inline.ko ${D}/${base_libdir}/modules/${KERNEL_VERSION}/
+ install -m 0755 ${S}/ddk/crypto-eip-ddk.ko ${D}/${base_libdir}/modules/${KERNEL_VERSION}/
+ # copy firmware and install
+ install -d ${D}/${base_libdir}/firmware
+ install -m 0755 ${S}/../firmware/bin/firmware_eip207_ifpp.bin ${D}/${base_libdir}/firmware/
+ install -m 0755 ${S}/../firmware/bin/firmware_eip207_ipue.bin ${D}/${base_libdir}/firmware/
+ install -m 0755 ${S}/../firmware/bin/firmware_eip207_ofpp.bin ${D}/${base_libdir}/firmware/
+ install -m 0755 ${S}/../firmware/bin/firmware_eip207_opue.bin ${D}/${base_libdir}/firmware/
+}
+
+FILES_${PN} += "${base_libdir}/firmware/*"
diff --git a/recipes-netsys/eip-197/files/custom/eip-197-capwap-dtls.inc b/recipes-netsys/eip-197/files/custom/eip-197-capwap-dtls.inc
new file mode 100644
index 0000000..b02b701
--- /dev/null
+++ b/recipes-netsys/eip-197/files/custom/eip-197-capwap-dtls.inc
@@ -0,0 +1,8 @@
+PKG_MAKE_FLAGS_append= " \
+ CONFIG_MTK_TOPS_CAPWAP_DTLS=y \
+ "
+
+EXTRA_CFLAGS_append= " \
+ -DCONFIG_TOPS_TNL_NUM=32 \
+ -DCONFIG_MTK_TOPS_CAPWAP_DTLS \
+ "
\ No newline at end of file
diff --git a/recipes-netsys/eip-197/files/init/eip-197_insmod.service b/recipes-netsys/eip-197/files/init/eip-197_insmod.service
new file mode 100644
index 0000000..74c4d8e
--- /dev/null
+++ b/recipes-netsys/eip-197/files/init/eip-197_insmod.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=eip197_insmod
+After=tops_insmod.service
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh /usr/sbin/eip-197_insmod.sh
+ExecStartPost=/bin/sh -c '(/bin/touch /tmp/eip197_initialized)'
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-netsys/eip-197/files/init/eip-197_insmod.sh b/recipes-netsys/eip-197/files/init/eip-197_insmod.sh
new file mode 100644
index 0000000..0fa481d
--- /dev/null
+++ b/recipes-netsys/eip-197/files/init/eip-197_insmod.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# insmod eip-197 driver
+echo insmod EIP-197 driver
+
+#modprobe crypto-eip-inline
diff --git a/recipes-netsys/pce/files/init/pce_insmod.service b/recipes-netsys/pce/files/init/pce_insmod.service
new file mode 100644
index 0000000..1b258b8
--- /dev/null
+++ b/recipes-netsys/pce/files/init/pce_insmod.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=pce_insmod
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh /usr/sbin/pce_insmod.sh
+ExecStartPost=/bin/sh -c '(/bin/touch /tmp/pce_initialized)'
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/recipes-netsys/pce/files/init/pce_insmod.sh b/recipes-netsys/pce/files/init/pce_insmod.sh
new file mode 100644
index 0000000..9239c93
--- /dev/null
+++ b/recipes-netsys/pce/files/init/pce_insmod.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# insmod pce driver
+echo insmod PCE driver
+
+modprobe pce
+
diff --git a/recipes-netsys/pce/pce-insmod.bb b/recipes-netsys/pce/pce-insmod.bb
new file mode 100644
index 0000000..aae8c60
--- /dev/null
+++ b/recipes-netsys/pce/pce-insmod.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Bring up scripts for Mediatek PCE Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit systemd
+
+SRC_URI = " file://init "
+
+S = "${WORKDIR}/init"
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "pce_insmod.service"
+FILES_${PN} += "{systemd_unitdir}/system/pce_insmod.service"
+
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+do_install() {
+ install -d ${D}${sbindir}/
+ install -m 0755 ${S}/pce_insmod.sh ${D}${sbindir}
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${S}/pce_insmod.service ${D}${systemd_unitdir}/system
+}
diff --git a/recipes-netsys/pce/pce.bb b/recipes-netsys/pce/pce.bb
new file mode 100644
index 0000000..a48aa08
--- /dev/null
+++ b/recipes-netsys/pce/pce.bb
@@ -0,0 +1,40 @@
+SUMMARY = "Mediatek PCE Driver"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit module
+
+DEPENDS += "virtual/kernel"
+
+SRC_URI = "git://gerrit.mediatek.inc/openwrt/feeds/mtk_openwrt_feeds;protocol=https;branch=master;destsuffix=git"
+SRCREV = "${AUTOREV}"
+
+S = "${WORKDIR}/git/feed/kernel/pce/src"
+
+PKG_MAKE_FLAGS = " \
+ CONFIG_MTK_PCE=m \
+ "
+
+EXTRA_CFLAGS += " \
+ -Wall -Werror \
+ -I${S}/inc \
+ "
+
+EXTRA_OEMAKE = " \
+ -C ${STAGING_KERNEL_BUILDDIR}/ \
+ M=${S} \
+ ${PKG_MAKE_FLAGS} \
+ EXTRA_CFLAGS='${EXTRA_CFLAGS}' \
+ "
+
+do_configure[noexec] = "1"
+MAKE_TARGETS = "modules"
+do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
+
+do_install_append() {
+ # Install header files for depedency modules
+ cp -r ${S}/inc/pce ${STAGING_KERNEL_BUILDDIR}/source/include
+
+ # Module
+ cat ${D}/usr/include/pce/Module.symvers >> ${TMPDIR}/work-shared/${MACHINE}/kernel-build-artifacts/Module.symvers
+}