fix...
This commit is contained in:
parent
715df05ee9
commit
cb13999c4c
@ -14,14 +14,14 @@ config EXPERIMENTAL
|
||||
positive and negative). But do so only if you know how to
|
||||
recover your device in case of flashing potentially non-working
|
||||
firmware.
|
||||
|
||||
|
||||
If you plan to use this build in production, say NO!
|
||||
|
||||
menu "Global build settings"
|
||||
|
||||
config JSON_OVERVIEW_IMAGE_INFO
|
||||
bool "Create JSON info file overview per target"
|
||||
default BUILDBOT
|
||||
default y
|
||||
help
|
||||
Create a JSON info file called profiles.json in the target
|
||||
directory containing machine readable list of built profiles
|
||||
@ -111,7 +111,7 @@ menu "Global build settings"
|
||||
default n
|
||||
help
|
||||
This makes file checksums part of package metadata. It increases size
|
||||
but provides you with pkg_check command to check for flash coruptions.
|
||||
but provides you with pkg_check command to check for flash corruptions.
|
||||
|
||||
config INCLUDE_CONFIG
|
||||
bool "Include build configuration in firmware" if DEVEL
|
||||
@ -154,17 +154,12 @@ menu "Global build settings"
|
||||
Adds -g3 to the CFLAGS.
|
||||
|
||||
config IPV6
|
||||
bool
|
||||
prompt "Enable IPv6 support in packages"
|
||||
default y
|
||||
help
|
||||
Enables IPv6 support in kernel (builtin) and packages.
|
||||
def_bool y
|
||||
|
||||
comment "Stripping options"
|
||||
|
||||
choice
|
||||
prompt "Binary stripping method"
|
||||
default USE_STRIP if EXTERNAL_TOOLCHAIN
|
||||
default USE_STRIP if USE_GLIBC
|
||||
default USE_SSTRIP
|
||||
help
|
||||
@ -221,20 +216,6 @@ menu "Global build settings"
|
||||
make the system libraries incompatible with most of the packages that are
|
||||
not selected during the build process.
|
||||
|
||||
choice
|
||||
prompt "Preferred standard C++ library"
|
||||
default USE_LIBSTDCXX if USE_GLIBC
|
||||
default USE_UCLIBCXX
|
||||
help
|
||||
Select the preferred standard C++ library for all packages that support this.
|
||||
|
||||
config USE_UCLIBCXX
|
||||
bool "uClibc++"
|
||||
|
||||
config USE_LIBSTDCXX
|
||||
bool "libstdc++"
|
||||
endchoice
|
||||
|
||||
comment "Hardening build options"
|
||||
|
||||
config PKG_CHECK_FORMAT_SECURITY
|
||||
@ -390,4 +371,16 @@ menu "Global build settings"
|
||||
|
||||
endchoice
|
||||
|
||||
config SECCOMP
|
||||
bool "Enable SECCOMP"
|
||||
select KERNEL_SECCOMP
|
||||
select PACKAGE_procd-seccomp
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
|
||||
depends on !TARGET_uml
|
||||
default y
|
||||
help
|
||||
This option enables seccomp kernel features to safely
|
||||
execute untrusted bytecode and selects the seccomp-variants
|
||||
of procd
|
||||
|
||||
endmenu
|
||||
|
@ -95,6 +95,11 @@ menuconfig DEVEL
|
||||
Store ccache in this directory.
|
||||
If not set, uses './.ccache'
|
||||
|
||||
config KERNEL_CFLAGS
|
||||
string "Kernel extra CFLAGS" if DEVEL
|
||||
default "-falign-functions=32" if TARGET_bcm53xx
|
||||
default ""
|
||||
|
||||
config EXTERNAL_KERNEL_TREE
|
||||
string "Use external kernel tree" if DEVEL
|
||||
default ""
|
||||
|
@ -48,6 +48,7 @@ menu "Target Images"
|
||||
bool "xz"
|
||||
|
||||
config TARGET_INITRAMFS_COMPRESSION_ZSTD
|
||||
depends on !LINUX_5_4
|
||||
bool "zstd"
|
||||
endchoice
|
||||
|
||||
@ -151,7 +152,7 @@ menu "Target Images"
|
||||
bool "squashfs"
|
||||
default y if USES_SQUASHFS
|
||||
help
|
||||
Build a squashfs-lzma root filesystem.
|
||||
Build a squashfs root filesystem.
|
||||
|
||||
config TARGET_SQUASHFS_BLOCK_SIZE
|
||||
int "Block size (in KiB)"
|
||||
@ -159,6 +160,9 @@ menu "Target Images"
|
||||
default 64 if LOW_MEMORY_FOOTPRINT
|
||||
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
|
||||
default 1024
|
||||
help
|
||||
Select squashfs block size, must be one of:
|
||||
4, 8, 16, 32, 64, 128, 256, 512, 1024
|
||||
|
||||
menuconfig TARGET_ROOTFS_UBIFS
|
||||
bool "ubifs"
|
||||
@ -293,7 +297,7 @@ menu "Target Images"
|
||||
source "target/linux/*/image/Config.in"
|
||||
|
||||
config TARGET_KERNEL_PARTSIZE
|
||||
int "Kernel partition size (in MB)"
|
||||
int "Kernel partition size (in MiB)"
|
||||
depends on USES_BOOT_PART
|
||||
default 8 if TARGET_apm821xx_sata
|
||||
default 64 if TARGET_bcm27xx
|
||||
@ -301,8 +305,8 @@ menu "Target Images"
|
||||
default 16
|
||||
|
||||
config TARGET_ROOTFS_PARTSIZE
|
||||
int "Root filesystem partition size (in MB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml
|
||||
int "Root filesystem partition size (in MiB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
|
||||
default 400
|
||||
help
|
||||
Select the root filesystem partition size.
|
||||
|
@ -24,11 +24,6 @@ config KERNEL_PRINTK
|
||||
bool "Enable support for printk"
|
||||
default y
|
||||
|
||||
config KERNEL_CRASHLOG
|
||||
bool "Crash logging"
|
||||
depends on !(arm || powerpc || sparc || TARGET_uml || i386 || x86_64)
|
||||
default y
|
||||
|
||||
config KERNEL_SWAP
|
||||
bool "Support for paging of anonymous memory (swap)"
|
||||
default y if !SMALL_FLASH
|
||||
@ -48,8 +43,7 @@ config KERNEL_DEBUG_FS
|
||||
|
||||
config KERNEL_MIPS_FP_SUPPORT
|
||||
bool
|
||||
default y
|
||||
depends on (mips || mipsel || mips64 || mips64el)
|
||||
default y if TARGET_pistachio
|
||||
|
||||
config KERNEL_ARM_PMU
|
||||
bool
|
||||
@ -87,6 +81,11 @@ config KERNEL_PROFILING
|
||||
Enable the extended profiling support mechanisms used by profilers such
|
||||
as OProfile.
|
||||
|
||||
config KERNEL_RPI_AXIPERF
|
||||
bool "Compile the kernel with RaspberryPi AXI Performance monitors"
|
||||
default y
|
||||
depends on KERNEL_PERF_EVENTS && TARGET_bcm27xx
|
||||
|
||||
config KERNEL_UBSAN
|
||||
bool "Compile the kernel with undefined behaviour sanity checker"
|
||||
help
|
||||
@ -115,6 +114,16 @@ config KERNEL_UBSAN_ALIGNMENT
|
||||
Enabling this option on architectures that support unaligned
|
||||
accesses may produce a lot of false positives.
|
||||
|
||||
config KERNEL_UBSAN_BOUNDS
|
||||
bool "Perform array index bounds checking"
|
||||
depends on KERNEL_UBSAN
|
||||
help
|
||||
This option enables detection of directly indexed out of bounds array
|
||||
accesses, where the array size is known at compile time. Note that
|
||||
this does not protect array overflows via bad calls to the
|
||||
{str,mem}*cpy() family of functions (that is addressed by
|
||||
FORTIFY_SOURCE).
|
||||
|
||||
config KERNEL_UBSAN_NULL
|
||||
bool "Enable checking of null pointers"
|
||||
depends on KERNEL_UBSAN
|
||||
@ -122,6 +131,19 @@ config KERNEL_UBSAN_NULL
|
||||
This option enables detection of memory accesses via a
|
||||
null pointer.
|
||||
|
||||
config KERNEL_UBSAN_TRAP
|
||||
bool "On Sanitizer warnings, abort the running kernel code"
|
||||
depends on KERNEL_UBSAN
|
||||
help
|
||||
Building kernels with Sanitizer features enabled tends to grow the
|
||||
kernel size by around 5%, due to adding all the debugging text on
|
||||
failure paths. To avoid this, Sanitizer instrumentation can just
|
||||
issue a trap. This reduces the kernel size overhead but turns all
|
||||
warnings (including potentially harmless conditions) into full
|
||||
exceptions that abort the running kernel code (regardless of context,
|
||||
locks held, etc), which may destabilize the system. For some system
|
||||
builders this is an acceptable trade-off.
|
||||
|
||||
config KERNEL_KASAN
|
||||
bool "Compile the kernel with KASan: runtime memory debugger"
|
||||
select KERNEL_SLUB_DEBUG
|
||||
@ -148,6 +170,30 @@ config KERNEL_KASAN_EXTRA
|
||||
compile time.
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
|
||||
|
||||
config KERNEL_KASAN_VMALLOC
|
||||
bool "Back mappings in vmalloc space with real shadow memory"
|
||||
depends on KERNEL_KASAN
|
||||
help
|
||||
By default, the shadow region for vmalloc space is the read-only
|
||||
zero page. This means that KASAN cannot detect errors involving
|
||||
vmalloc space.
|
||||
|
||||
Enabling this option will hook in to vmap/vmalloc and back those
|
||||
mappings with real shadow memory allocated on demand. This allows
|
||||
for KASAN to detect more sorts of errors (and to support vmapped
|
||||
stacks), but at the cost of higher memory usage.
|
||||
|
||||
This option depends on HAVE_ARCH_KASAN_VMALLOC, but we can't
|
||||
depend on that in here, so it is possible that enabling this
|
||||
will have no effect.
|
||||
|
||||
if KERNEL_KASAN
|
||||
config KERNEL_KASAN_GENERIC
|
||||
def_bool y
|
||||
|
||||
config KERNEL_KASAN_SW_TAGS
|
||||
def_bool n
|
||||
endif
|
||||
|
||||
choice
|
||||
prompt "Instrumentation type"
|
||||
@ -303,6 +349,19 @@ config KERNEL_PREEMPT_TRACER
|
||||
enabled. This option and the irqs-off timing option can be
|
||||
used together or separately.)
|
||||
|
||||
config KERNEL_HIST_TRIGGERS
|
||||
bool "Histogram triggers"
|
||||
depends on KERNEL_FTRACE
|
||||
help
|
||||
Hist triggers allow one or more arbitrary trace event fields to be
|
||||
aggregated into hash tables and dumped to stdout by reading a
|
||||
debugfs/tracefs file. They're useful for gathering quick and dirty
|
||||
(though precise) summaries of event activity as an initial guide for
|
||||
further investigation using more advanced tools.
|
||||
|
||||
Inter-event tracing of quantities such as latencies is also
|
||||
supported using hist triggers under this option.
|
||||
|
||||
config KERNEL_DEBUG_KERNEL
|
||||
bool
|
||||
default n
|
||||
@ -314,6 +373,34 @@ config KERNEL_DEBUG_INFO
|
||||
help
|
||||
This will compile your kernel and modules with debug information.
|
||||
|
||||
config KERNEL_DEBUG_INFO_BTF
|
||||
|
||||
bool "Enable additional BTF type information"
|
||||
default n
|
||||
depends on !HOST_OS_MACOS
|
||||
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
|
||||
select DWARVES
|
||||
help
|
||||
Generate BPF Type Format (BTF) information from DWARF debug info.
|
||||
Turning this on expects presence of pahole tool, which will convert
|
||||
DWARF type info into equivalent deduplicated BTF type info.
|
||||
|
||||
Required to run BPF CO-RE applications.
|
||||
|
||||
config KERNEL_DEBUG_INFO_REDUCED
|
||||
bool "Reduce debugging information"
|
||||
default y
|
||||
depends on KERNEL_DEBUG_INFO
|
||||
help
|
||||
If you say Y here gcc is instructed to generate less debugging
|
||||
information for structure types. This means that tools that
|
||||
need full debugging information (like kgdb or systemtap) won't
|
||||
be happy. But if you merely need debugging information to
|
||||
resolve line numbers there is no loss. Advantage is that
|
||||
build directory object sizes shrink dramatically over a full
|
||||
DEBUG_INFO build and compile times are reduced too.
|
||||
Only works with newer gcc versions.
|
||||
|
||||
config KERNEL_DEBUG_LL_UART_NONE
|
||||
bool
|
||||
default n
|
||||
@ -327,6 +414,14 @@ config KERNEL_DEBUG_LL
|
||||
help
|
||||
ARM low level debugging.
|
||||
|
||||
config KERNEL_DEBUG_VIRTUAL
|
||||
bool "Compile the kernel with VM translations debugging"
|
||||
select KERNEL_DEBUG_KERNEL
|
||||
default n
|
||||
help
|
||||
Enable checks sanity checks to catch invalid uses of
|
||||
virt_to_phys()/phys_to_virt() against the non-linear address space.
|
||||
|
||||
config KERNEL_DYNAMIC_DEBUG
|
||||
bool "Compile the kernel with dynamic printk"
|
||||
select KERNEL_DEBUG_FS
|
||||
@ -368,6 +463,21 @@ config KERNEL_KPROBE_EVENTS
|
||||
bool
|
||||
default y if KERNEL_KPROBES
|
||||
|
||||
config KERNEL_BPF_EVENTS
|
||||
bool "Compile the kernel with BPF event support"
|
||||
default n
|
||||
select KERNEL_KPROBES
|
||||
help
|
||||
Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
|
||||
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
|
||||
for sending data from BPF programs to user-space for post-processing
|
||||
or logging.
|
||||
|
||||
config KERNEL_BPF_KPROBE_OVERRIDE
|
||||
bool
|
||||
default n
|
||||
depends on KERNEL_KPROBES
|
||||
|
||||
config KERNEL_AIO
|
||||
bool "Compile the kernel with asynchronous IO support"
|
||||
default y if !SMALL_FLASH
|
||||
@ -437,34 +547,22 @@ config KERNEL_PROVE_LOCKING
|
||||
select KERNEL_DEBUG_KERNEL
|
||||
default n
|
||||
|
||||
config KERNEL_LOCKUP_DETECTOR
|
||||
bool "Compile the kernel with detect Hard and Soft Lockups"
|
||||
config KERNEL_SOFTLOCKUP_DETECTOR
|
||||
bool "Compile the kernel with detect Soft Lockups"
|
||||
depends on KERNEL_DEBUG_KERNEL
|
||||
help
|
||||
Say Y here to enable the kernel to act as a watchdog to detect
|
||||
hard and soft lockups.
|
||||
soft lockups.
|
||||
|
||||
Softlockups are bugs that cause the kernel to loop in kernel
|
||||
mode for more than 20 seconds, without giving other tasks a
|
||||
chance to run. The current stack trace is displayed upon
|
||||
detection and the system will stay locked up.
|
||||
|
||||
Hardlockups are bugs that cause the CPU to loop in kernel mode
|
||||
for more than 10 seconds, without letting other interrupts have a
|
||||
chance to run. The current stack trace is displayed upon detection
|
||||
and the system will stay locked up.
|
||||
|
||||
The overhead should be minimal. A periodic hrtimer runs to
|
||||
generate interrupts and kick the watchdog task every 4 seconds.
|
||||
An NMI is generated every 10 seconds or so to check for hardlockups.
|
||||
|
||||
The frequency of hrtimer and NMI events and the soft and hard lockup
|
||||
thresholds can be controlled through the sysctl watchdog_thresh.
|
||||
|
||||
config KERNEL_DETECT_HUNG_TASK
|
||||
bool "Compile the kernel with detect Hung Tasks"
|
||||
depends on KERNEL_DEBUG_KERNEL
|
||||
default KERNEL_LOCKUP_DETECTOR
|
||||
default KERNEL_SOFTLOCKUP_DETECTOR
|
||||
help
|
||||
Say Y here to enable the kernel to detect "hung tasks",
|
||||
which are bugs that cause the task to be stuck in
|
||||
@ -944,6 +1042,19 @@ config KERNEL_IP_MROUTE
|
||||
Multicast routing requires a multicast routing daemon in
|
||||
addition to kernel support.
|
||||
|
||||
if KERNEL_IP_MROUTE
|
||||
|
||||
config KERNEL_IP_MROUTE_MULTIPLE_TABLES
|
||||
def_bool y
|
||||
|
||||
config KERNEL_IP_PIMSM_V1
|
||||
def_bool y
|
||||
|
||||
config KERNEL_IP_PIMSM_V2
|
||||
def_bool y
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# IPv6 configuration
|
||||
#
|
||||
@ -966,8 +1077,15 @@ if KERNEL_IPV6
|
||||
Multicast routing requires a multicast routing daemon in
|
||||
addition to kernel support.
|
||||
|
||||
config KERNEL_IPV6_PIMSM_V2
|
||||
def_bool n
|
||||
if KERNEL_IPV6_MROUTE
|
||||
|
||||
config KERNEL_IPV6_MROUTE_MULTIPLE_TABLES
|
||||
def_bool y
|
||||
|
||||
config KERNEL_IPV6_PIMSM_V2
|
||||
def_bool y
|
||||
|
||||
endif
|
||||
|
||||
config KERNEL_IPV6_SEG6_LWTUNNEL
|
||||
bool "Enable support for lightweight tunnels"
|
||||
@ -980,6 +1098,16 @@ if KERNEL_IPV6
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Miscellaneous network configuration
|
||||
#
|
||||
|
||||
config KERNEL_NET_L3_MASTER_DEV
|
||||
bool "L3 Master device support"
|
||||
help
|
||||
This module provides glue between core networking code and device
|
||||
drivers to support L3 master devices like VRF.
|
||||
|
||||
#
|
||||
# NFS related symbols
|
||||
#
|
||||
@ -1125,7 +1253,7 @@ config KERNEL_SQUASHFS_XATTR
|
||||
bool "Squashfs XATTR support"
|
||||
|
||||
#
|
||||
# compile optimiziation setting
|
||||
# compile optimization setting
|
||||
#
|
||||
choice
|
||||
prompt "Compiler optimization level"
|
||||
|
@ -1,7 +1,9 @@
|
||||
src-git packages https://github.com/DHDAXCW/packages
|
||||
src-git luci https://github.com/DHDAXCW/luci
|
||||
src-git packages https://github.com/coolsnowwolf/packages
|
||||
src-git luci https://github.com/coolsnowwolf/luci
|
||||
src-git routing https://github.com/coolsnowwolf/routing
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git
|
||||
#src-git helloworld https://github.com/fw876/helloworld.git
|
||||
#src-git oui https://github.com/zhaojh329/oui.git
|
||||
#src-git video https://github.com/openwrt/video.git
|
||||
#src-git targets https://github.com/openwrt/targets.git
|
||||
#src-git oldpackages http://git.openwrt.org/packages.git
|
||||
|
@ -35,7 +35,7 @@ define autoreconf
|
||||
$(patsubst %,rm -f %;,$(2)) \
|
||||
$(foreach p,$(3), \
|
||||
if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
|
||||
[ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
|
||||
[ -d $(p)/autom4te.cache ] && rm -rf $(p)/autom4te.cache; \
|
||||
[ -e $(p)/config.rpath ] || \
|
||||
ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
|
||||
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
|
||||
|
@ -64,14 +64,14 @@ BPF_CFLAGS := \
|
||||
-O2 -emit-llvm -Xclang -disable-llvm-passes
|
||||
|
||||
ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),)
|
||||
ifeq ($(DUMP),)
|
||||
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
|
||||
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
|
||||
ifeq ($(CLANG_VER_VALID),)
|
||||
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
|
||||
endif
|
||||
ifeq ($(DUMP),)
|
||||
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
|
||||
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
|
||||
ifeq ($(CLANG_VER_VALID),)
|
||||
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
define CompileBPF
|
||||
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
|
||||
|
@ -53,6 +53,7 @@ define Build/append-image-stage
|
||||
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
|
||||
fwtool -s /dev/null -t "$@.stripmeta" || :
|
||||
fwtool -i /dev/null -t "$@.stripmeta" || :
|
||||
mkdir -p "$(STAGING_DIR_IMAGE)"
|
||||
dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
|
||||
dd if="$@.stripmeta" >> "$@"
|
||||
rm "$@.stripmeta"
|
||||
@ -305,8 +306,13 @@ define Build/fit
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/libdeflate-gzip
|
||||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/gzip
|
||||
gzip -f -9n -c $@ $(1) > $@.new
|
||||
$(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
|
@ -520,6 +520,7 @@ define Device/Build/compile
|
||||
$$(_COMPILE_TARGET): $(KDIR)/$(1)
|
||||
$(eval $(call Device/Export,$(KDIR)/$(1)))
|
||||
$(KDIR)/$(1): FORCE
|
||||
rm -f $(KDIR)/$(1)
|
||||
$$(call concat_cmd,$(COMPILE/$(1)))
|
||||
|
||||
endef
|
||||
|
@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.10 = .142
|
||||
LINUX_KERNEL_HASH-5.10.142 = 3f47ebdb9afe152a0c32c1157336ef13fa5cc08ac6d884dfc1f6ddc2b7dba268
|
||||
LINUX_VERSION-5.10 = .164
|
||||
LINUX_KERNEL_HASH-5.10.164 = 0c7eaaa87b012c6662440f4ce2ea6e1bb961c1845cafd102eab08a57efeb8278
|
||||
|
@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .67
|
||||
LINUX_KERNEL_HASH-5.15.67 = da47d9a80b694548835ccb553b6eb1a1f3f5d5cddd9e2bd6f4886b99ca14f940
|
||||
LINUX_VERSION-5.15 = .89
|
||||
LINUX_KERNEL_HASH-5.15.89 = e7311b874e014bb6d37c051319bd6a4a4e3d05a1c32546522deabbfd2d752fe8
|
||||
|
@ -130,7 +130,7 @@ ifneq ($(HOST_OS),Linux)
|
||||
export SKIP_STACK_VALIDATION:=1
|
||||
endif
|
||||
|
||||
KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
|
||||
KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
|
||||
|
||||
ifdef CONFIG_USE_SPARSE
|
||||
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
|
||||
|
@ -230,11 +230,6 @@ $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_IRC, $(P_XT)nf_connt
|
||||
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_IRC, $(P_XT)nf_nat_irc))
|
||||
|
||||
|
||||
# ulog
|
||||
|
||||
$(eval $(call nf_add,IPT_ULOG,CONFIG_IP_NF_TARGET_ULOG, $(P_V4)ipt_ULOG))
|
||||
|
||||
|
||||
# nflog
|
||||
|
||||
$(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG))
|
||||
@ -321,7 +316,6 @@ $(eval $(call nf_add,EBTABLES_IP4,CONFIG_BRIDGE_EBT_SNAT, $(P_EBT)ebt_snat))
|
||||
|
||||
# watchers
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_LOG, $(P_EBT)ebt_log))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_ULOG, $(P_EBT)ebt_ulog))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFLOG, $(P_EBT)ebt_nflog))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nfqueue))
|
||||
|
||||
@ -393,7 +387,6 @@ IPT_BUILTIN += $(IPT_NAT6-y)
|
||||
IPT_BUILTIN += $(IPT_NAT_EXTRA-y)
|
||||
IPT_BUILTIN += $(NF_NATHELPER-y)
|
||||
IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y)
|
||||
IPT_BUILTIN += $(IPT_ULOG-y)
|
||||
IPT_BUILTIN += $(IPT_TPROXY-y)
|
||||
IPT_BUILTIN += $(NFNETLINK-y)
|
||||
IPT_BUILTIN += $(NFNETLINK_LOG-y)
|
||||
|
@ -9,13 +9,13 @@ ifeq ($(CONFIG_BUILD_NLS),y)
|
||||
|
||||
INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full
|
||||
INTL_FULL:=1
|
||||
|
||||
|
||||
CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(ICONV_PREFIX);$(INTL_PREFIX)"
|
||||
else
|
||||
ICONV_PREFIX:=
|
||||
ICONV_FULL:=
|
||||
|
||||
INTL_PREFIX:=$
|
||||
INTL_PREFIX:=
|
||||
INTL_FULL:=
|
||||
endif
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (C) 2006-2020 OpenWrt.org
|
||||
|
||||
PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
|
||||
PKG_DEFAULT_DEPENDS = +libc
|
||||
|
||||
ifneq ($(PKG_NAME),toolchain)
|
||||
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
|
||||
|
@ -233,6 +233,7 @@ ifeq ($(DUMP),1)
|
||||
ifeq ($(ARCH),powerpc)
|
||||
CPU_CFLAGS_603e:=-mcpu=603e
|
||||
CPU_CFLAGS_8540:=-mcpu=8540
|
||||
CPU_CFLAGS_8548:=-mcpu=8548
|
||||
CPU_CFLAGS_405:=-mcpu=405
|
||||
CPU_CFLAGS_440:=-mcpu=440
|
||||
CPU_CFLAGS_464fp:=-mcpu=464fp
|
||||
|
@ -1,5 +1,5 @@
|
||||
PKG_NAME ?= trusted-firmware-a
|
||||
PKG_CPE_ID ?= cpe:/a:arm:arm_trusted_firmware
|
||||
PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
|
||||
|
||||
ifndef PKG_SOURCE_PROTO
|
||||
PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz
|
||||
@ -81,6 +81,7 @@ define Build/Compile/Trusted-Firmware-A
|
||||
$(if $(DTC),DTC="$(DTC)") \
|
||||
PLAT=$(PLAT) \
|
||||
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \
|
||||
$(TFA_MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
|
@ -1,16 +1,2 @@
|
||||
ifndef DUMP
|
||||
ifdef __package_mk
|
||||
$(error uclibc++.mk must be included before package.mk)
|
||||
endif
|
||||
endif
|
||||
|
||||
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
|
||||
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
|
||||
|
||||
ifneq ($(CONFIG_USE_UCLIBCXX),)
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CXX_NOCACHE=g++-uc
|
||||
else
|
||||
TARGET_CXX=g++-uc
|
||||
endif
|
||||
endif
|
||||
$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS)
|
||||
CXX_DEPENDS = +libstdcpp
|
||||
|
@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=bcm27xx-gpu-fw
|
||||
PKG_VERSION:=2021-02-16
|
||||
PKG_RELEASE:=ba6259246c702b04ea56ff1034325e476d460ae8
|
||||
PKG_VERSION:=2022-05-16
|
||||
PKG_RELEASE:=3673be308132de102fdff491d1333d9d0f823557
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE)
|
||||
|
||||
@ -26,7 +26,7 @@ define Download/bootcode_bin
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=bootcode.bin
|
||||
HASH:=92fd15eb2468187b69d15a9482d7e8cee3704993c53bb5ba55afe550723c5975
|
||||
HASH:=69309823da13dc96b89e3d82b44f820e4f84efa79d207adad2c8784559794f03
|
||||
endef
|
||||
$(eval $(call Download,bootcode_bin))
|
||||
|
||||
@ -34,7 +34,7 @@ define Download/fixup_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup.dat
|
||||
HASH:=3daaf175decee44347fb97ece7738edf230b6fe3a86a8f521652e0052d5b3d6a
|
||||
HASH:=921f56c62ad1995addb984b156c869202dc5d46bbe9ebcbd02c20f0def9058e3
|
||||
endef
|
||||
$(eval $(call Download,fixup_dat))
|
||||
|
||||
@ -42,7 +42,7 @@ define Download/fixup_cd_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup_cd.dat
|
||||
HASH:=399b10509877cc7cbbaae25757ff44ee9f666931dd5c0996b48d170735a668b0
|
||||
HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c
|
||||
endef
|
||||
$(eval $(call Download,fixup_cd_dat))
|
||||
|
||||
@ -50,7 +50,7 @@ define Download/fixup_x_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup_x.dat
|
||||
HASH:=3c2a71f349bbc97bc3d9f7592bdd3f06d3d67e1ccd581cbdbb91b67a16304d76
|
||||
HASH:=8b00b00678adafe01e087240d156dbc87822e745b269be4f282596b69265cd1e
|
||||
endef
|
||||
$(eval $(call Download,fixup_x_dat))
|
||||
|
||||
@ -58,7 +58,7 @@ define Download/fixup4_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup4.dat
|
||||
HASH:=68e9112ac7907af51cbf7f458d241e6136af1be4e968909e34cbffb70f9536b4
|
||||
HASH:=ef2b5d2a0a95ca48e00a1ce78b7650ee9e947cc1c588704c8ae30c1623122e2f
|
||||
endef
|
||||
$(eval $(call Download,fixup4_dat))
|
||||
|
||||
@ -66,7 +66,7 @@ define Download/fixup4cd_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup4cd.dat
|
||||
HASH:=399b10509877cc7cbbaae25757ff44ee9f666931dd5c0996b48d170735a668b0
|
||||
HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c
|
||||
endef
|
||||
$(eval $(call Download,fixup4cd_dat))
|
||||
|
||||
@ -74,7 +74,7 @@ define Download/fixup4x_dat
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=fixup4x.dat
|
||||
HASH:=62c0ff21c06a28c24fc537bd1d23625b3452170fbb9fbd950b67a393929c2768
|
||||
HASH:=a6c4e30ada5a00fe7de83c460638ca824647651bb4a3644b8c65d7ba1d9f2d2b
|
||||
endef
|
||||
$(eval $(call Download,fixup4x_dat))
|
||||
|
||||
@ -82,7 +82,7 @@ define Download/start_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start.elf
|
||||
HASH:=3cc30fc07a6ad99bdd14e6319ed84b6c8813e8cb08bc5fff488c33abb163f746
|
||||
HASH:=5455c148f4b8b04c553809bd22b995ee49ba5279ca3848df8bde6f80a388f7e0
|
||||
endef
|
||||
$(eval $(call Download,start_elf))
|
||||
|
||||
@ -90,7 +90,7 @@ define Download/start_cd_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start_cd.elf
|
||||
HASH:=a4ae5a07b036bd82136373f2ce8a9ad01e41938884568b57c53e4be4c08d0dda
|
||||
HASH:=168c0a9178d5a3b4bd89ef770826a85b4ea3132560ba3600c212c0cec4c575c6
|
||||
endef
|
||||
$(eval $(call Download,start_cd_elf))
|
||||
|
||||
@ -98,7 +98,7 @@ define Download/start_x_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start_x.elf
|
||||
HASH:=b566fc8bc4cd1699f40fc73aa72910915421764933f2f2a7ba517b6b14339d09
|
||||
HASH:=30c6a7f32a25185053ca3ca9e4bcfe932246ed42a1b7c37f8803209f93d86404
|
||||
endef
|
||||
$(eval $(call Download,start_x_elf))
|
||||
|
||||
@ -106,7 +106,7 @@ define Download/start4_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start4.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start4.elf
|
||||
HASH:=abafb4d39c2708389e1421443fdd5e8a86e03bef6ad5282c0b5836587860cc5c
|
||||
HASH:=be8bbff41dba2749b7b0e812f0a9d87a9122d18508f7b5ff3cd20f303d15bc07
|
||||
endef
|
||||
$(eval $(call Download,start4_elf))
|
||||
|
||||
@ -114,7 +114,7 @@ define Download/start4cd_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start4cd.elf
|
||||
HASH:=6df423f4fa82c58efef6db1cf20c4fcbd92465a7fe91f40548c8534c1b5ef7fd
|
||||
HASH:=000372e9cf6815ade595948dbd6328665f2a535eeee44e74b0ec8e56b6fbbf90
|
||||
endef
|
||||
$(eval $(call Download,start4cd_elf))
|
||||
|
||||
@ -122,7 +122,7 @@ define Download/start4x_elf
|
||||
FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf
|
||||
URL:=$(RPI_FIRMWARE_URL)
|
||||
URL_FILE:=start4x.elf
|
||||
HASH:=4060e9fedfa99ff91549c8f4324a18417db785d99054ac7fe7d1b5dd5ef232f1
|
||||
HASH:=48895858f7936570dfab44c67bdcb0357ac8fcd630162c36ac9ed8f2de85c038
|
||||
endef
|
||||
$(eval $(call Download,start4x_elf))
|
||||
|
||||
|
@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=bcm63xx-cfe
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/bcm63xx-cfe.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-03-05
|
||||
PKG_SOURCE_VERSION:=d03501629fc8b1ba8f9b0961d543c256a3d0098f
|
||||
PKG_MIRROR_HASH:=b32a6f68d59c8f4534def7ec2568ad7da7a612a605b9406328309c78115ee88d
|
||||
PKG_SOURCE_DATE:=2021-06-22
|
||||
PKG_SOURCE_VERSION:=e5050f37150b34deb547b50feccd0e7439cb5bd7
|
||||
PKG_MIRROR_HASH:=85fed9f4bdf23cf7d33a02f549ffe9073666890f786d5ffa484c0368552b75ae
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
|
@ -99,8 +99,7 @@ define Package/nas/description
|
||||
proprietary Broadcom wl driver.
|
||||
endef
|
||||
|
||||
MAKE_KMOD := $(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
MAKE_KMOD := $(KERNEL_MAKE) \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
M="$(PKG_BUILD_DIR)/kmod" \
|
||||
|
||||
|
@ -32,14 +32,8 @@ define KernelPackage/gpio-button-hotplug/description
|
||||
an overkill for OpenWrt simple needs.
|
||||
endef
|
||||
|
||||
MAKE_OPTS:= \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)"
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(MAKE_OPTS) \
|
||||
modules
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,gpio-button-hotplug))
|
||||
|
@ -107,7 +107,7 @@ static struct bh_map button_map[] = {
|
||||
static __printf(3, 4)
|
||||
int bh_event_add_var(struct bh_event *event, int argv, const char *format, ...)
|
||||
{
|
||||
static char buf[128];
|
||||
char buf[128];
|
||||
char *s;
|
||||
va_list args;
|
||||
int len;
|
||||
|
@ -29,22 +29,9 @@ define KernelPackage/gpio-nct5104d/description
|
||||
Support for GPIO functionality of NCT5104D super I/O chip.
|
||||
endef
|
||||
|
||||
EXTRA_KCONFIG:= \
|
||||
CONFIG_GPIO_NCT5104D=m
|
||||
|
||||
EXTRA_CFLAGS:= \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \
|
||||
|
||||
MAKE_OPTS:= \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
$(EXTRA_KCONFIG)
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(MAKE_OPTS) \
|
||||
$(KERNEL_MAKE) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
config GPIO_NCT5104D
|
||||
tristate "NCT5104D GPIO support"
|
||||
depends on GENERIC_GPIO
|
||||
help
|
||||
Say yes here to support GPIO functionality of NCT5104D super I/O chip
|
@ -1 +1 @@
|
||||
obj-${CONFIG_GPIO_NCT5104D} += gpio-nct5104d.o
|
||||
obj-m += gpio-nct5104d.o
|
||||
|
@ -19,8 +19,7 @@ define KernelPackage/hwmon-gsc/description
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(KERNEL_MAKE) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
|
34
package/kernel/leds-ws2812b/Makefile
Normal file
34
package/kernel/leds-ws2812b/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2008-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=leds-ws2812b
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/leds-ws2812b
|
||||
SUBMENU:=LED modules
|
||||
TITLE:=Worldsemi WS2812B (NeoPixel) LED support
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/leds-ws2812b.ko
|
||||
AUTOLOAD:=$(call AutoProbe,leds-ws2812b,1)
|
||||
DEPENDS:=@TARGET_mediatek_filogic
|
||||
endef
|
||||
|
||||
define KernelPackage/leds-ws2812b/description
|
||||
LED support for driving WS2812B (NeoPixel) using SPI MOSI.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,leds-ws2812b))
|
1
package/kernel/leds-ws2812b/src/Makefile
Normal file
1
package/kernel/leds-ws2812b/src/Makefile
Normal file
@ -0,0 +1 @@
|
||||
obj-m := leds-ws2812b.o
|
233
package/kernel/leds-ws2812b/src/leds-ws2812b.c
Normal file
233
package/kernel/leds-ws2812b/src/leds-ws2812b.c
Normal file
@ -0,0 +1,233 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* WorldSemi WS2812B individually-addressable LED driver using SPI
|
||||
*
|
||||
* Copyright 2022 Chuanhong Guo <gch981213@gmail.com>
|
||||
*
|
||||
* This driver simulates WS2812B protocol using SPI MOSI pin. A one pulse
|
||||
* is transferred as 3'b110 and a zero pulse is 3'b100. For this driver to
|
||||
* work properly, the SPI frequency should be 2.105MHz~2.85MHz and it needs
|
||||
* to transfer all the bytes continuously.
|
||||
*/
|
||||
|
||||
#include <linux/led-class-multicolor.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#define WS2812B_BYTES_PER_COLOR 3
|
||||
#define WS2812B_NUM_COLORS 3
|
||||
/* A continuous 0 for 50us+ as the 'reset' signal */
|
||||
#define WS2812B_RESET_LEN 18
|
||||
|
||||
struct ws2812b_led {
|
||||
struct led_classdev_mc mc_cdev;
|
||||
struct mc_subled subled[WS2812B_NUM_COLORS];
|
||||
int cascade;
|
||||
};
|
||||
|
||||
struct ws2812b_priv {
|
||||
struct led_classdev ldev;
|
||||
struct spi_device *spi;
|
||||
struct mutex mutex;
|
||||
int num_leds;
|
||||
size_t data_len;
|
||||
u8 *data_buf;
|
||||
struct ws2812b_led leds[];
|
||||
};
|
||||
|
||||
/**
|
||||
* ws2812b_set_byte - convert a byte of data to 3-byte SPI data for pulses
|
||||
* @priv: pointer to the private data structure
|
||||
* @offset: offset of the target byte in the data stream
|
||||
* @val: 1-byte data to be set
|
||||
*
|
||||
* WS2812B receives a stream of bytes from DI, takes the first 3 byte as LED
|
||||
* brightness and pases the rest to the next LED through the DO pin.
|
||||
* This function assembles a single byte of data to the LED:
|
||||
* A bit is represented with a pulse of specific length. A long pulse is a 1
|
||||
* and a short pulse is a 0.
|
||||
* SPI transfers data continuously, MSB first. We can send 3'b100 to create a
|
||||
* 0 pulse and 3'b110 for a 1 pulse. In this way, a byte of data takes up 3
|
||||
* bytes in a SPI transfer:
|
||||
* 1x0 1x0 1x0 1x0 1x0 1x0 1x0 1x0
|
||||
* Let's rearrange it in 8 bits:
|
||||
* 1x01x01x 01x01x01 x01x01x0
|
||||
* The higher 3 bits, middle 2 bits and lower 3 bits are represented with the
|
||||
* 1st, 2nd and 3rd byte in the SPI transfer respectively.
|
||||
* There are only 8 combinations for 3 bits and 4 for 2 bits, so we can create
|
||||
* a lookup table for the 3 bytes.
|
||||
* e.g. For 0x6b -> 2'b01101011:
|
||||
* Bit 7-5: 3'b011 -> 10011011 -> 0x9b
|
||||
* Bit 4-3: 2'b01 -> 01001101 -> 0x4d
|
||||
* Bit 2-0: 3'b011 -> 00110110 -> 0x36
|
||||
*/
|
||||
static void ws2812b_set_byte(struct ws2812b_priv *priv, size_t offset, u8 val)
|
||||
{
|
||||
/* The lookup table for Bit 7-5 4-3 2-0 */
|
||||
const u8 h3b[] = { 0x92, 0x93, 0x9a, 0x9b, 0xd2, 0xd3, 0xda, 0xdb };
|
||||
const u8 m2b[] = { 0x49, 0x4d, 0x69, 0x6d };
|
||||
const u8 l3b[] = { 0x24, 0x26, 0x34, 0x36, 0xa4, 0xa6, 0xb4, 0xb6 };
|
||||
u8 *p = priv->data_buf + WS2812B_RESET_LEN + (offset * WS2812B_BYTES_PER_COLOR);
|
||||
|
||||
p[0] = h3b[val >> 5]; /* Bit 7-5 */
|
||||
p[1] = m2b[(val >> 3) & 0x3]; /* Bit 4-3 */
|
||||
p[2] = l3b[val & 0x7]; /* Bit 2-0 */
|
||||
}
|
||||
|
||||
static int ws2812b_set(struct led_classdev *cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct led_classdev_mc *mc_cdev = lcdev_to_mccdev(cdev);
|
||||
struct ws2812b_led *led =
|
||||
container_of(mc_cdev, struct ws2812b_led, mc_cdev);
|
||||
struct ws2812b_priv *priv = dev_get_drvdata(cdev->dev->parent);
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
led_mc_calc_color_components(mc_cdev, brightness);
|
||||
|
||||
mutex_lock(&priv->mutex);
|
||||
for (i = 0; i < WS2812B_NUM_COLORS; i++)
|
||||
ws2812b_set_byte(priv, led->cascade * WS2812B_NUM_COLORS + i,
|
||||
led->subled[i].brightness);
|
||||
ret = spi_write(priv->spi, priv->data_buf, priv->data_len);
|
||||
mutex_unlock(&priv->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ws2812b_probe(struct spi_device *spi)
|
||||
{
|
||||
struct device *dev = &spi->dev;
|
||||
int cur_led = 0;
|
||||
struct ws2812b_priv *priv;
|
||||
struct fwnode_handle *led_node;
|
||||
int num_leds, i, cnt, ret;
|
||||
|
||||
num_leds = device_get_child_node_count(dev);
|
||||
|
||||
priv = devm_kzalloc(dev, struct_size(priv, leds, num_leds), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
priv->data_len =
|
||||
num_leds * WS2812B_BYTES_PER_COLOR * WS2812B_NUM_COLORS +
|
||||
WS2812B_RESET_LEN;
|
||||
priv->data_buf = kzalloc(priv->data_len, GFP_KERNEL);
|
||||
if (!priv->data_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < num_leds * WS2812B_NUM_COLORS; i++)
|
||||
ws2812b_set_byte(priv, i, 0);
|
||||
|
||||
mutex_init(&priv->mutex);
|
||||
priv->num_leds = num_leds;
|
||||
priv->spi = spi;
|
||||
|
||||
device_for_each_child_node(dev, led_node) {
|
||||
struct led_init_data init_data = {
|
||||
.fwnode = led_node,
|
||||
};
|
||||
/* WS2812B LEDs usually come with GRB color */
|
||||
u32 color_idx[WS2812B_NUM_COLORS] = {
|
||||
LED_COLOR_ID_GREEN,
|
||||
LED_COLOR_ID_RED,
|
||||
LED_COLOR_ID_BLUE,
|
||||
};
|
||||
u32 cascade;
|
||||
|
||||
ret = fwnode_property_read_u32(led_node, "reg", &cascade);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to obtain numerical LED index for %s",
|
||||
fwnode_get_name(led_node));
|
||||
goto ERR_UNREG_LEDS;
|
||||
}
|
||||
if (cascade >= num_leds) {
|
||||
dev_err(dev, "LED index of %s is larger than the number of LEDs.",
|
||||
fwnode_get_name(led_node));
|
||||
ret = -EINVAL;
|
||||
goto ERR_UNREG_LEDS;
|
||||
}
|
||||
|
||||
cnt = fwnode_property_count_u32(led_node, "color-index");
|
||||
if (cnt > 0 && cnt <= WS2812B_NUM_COLORS)
|
||||
fwnode_property_read_u32_array(led_node, "color-index",
|
||||
color_idx, (size_t)cnt);
|
||||
|
||||
priv->leds[cur_led].mc_cdev.subled_info =
|
||||
priv->leds[cur_led].subled;
|
||||
priv->leds[cur_led].mc_cdev.num_colors = WS2812B_NUM_COLORS;
|
||||
priv->leds[cur_led].mc_cdev.led_cdev.max_brightness = 255;
|
||||
priv->leds[cur_led].mc_cdev.led_cdev.brightness_set_blocking = ws2812b_set;
|
||||
|
||||
for (i = 0; i < WS2812B_NUM_COLORS; i++) {
|
||||
priv->leds[cur_led].subled[i].color_index = color_idx[i];
|
||||
priv->leds[cur_led].subled[i].intensity = 255;
|
||||
}
|
||||
|
||||
priv->leds[cur_led].cascade = cascade;
|
||||
|
||||
ret = led_classdev_multicolor_register_ext(
|
||||
dev, &priv->leds[cur_led].mc_cdev, &init_data);
|
||||
if (ret) {
|
||||
dev_err(dev, "registration of %s failed.",
|
||||
fwnode_get_name(led_node));
|
||||
goto ERR_UNREG_LEDS;
|
||||
}
|
||||
cur_led++;
|
||||
}
|
||||
|
||||
spi_set_drvdata(spi, priv);
|
||||
|
||||
return 0;
|
||||
ERR_UNREG_LEDS:
|
||||
for (; cur_led >= 0; cur_led--)
|
||||
led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev);
|
||||
mutex_destroy(&priv->mutex);
|
||||
kfree(priv->data_buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ws2812b_remove(struct spi_device *spi)
|
||||
{
|
||||
struct ws2812b_priv *priv = spi_get_drvdata(spi);
|
||||
int cur_led;
|
||||
|
||||
for (cur_led = priv->num_leds - 1; cur_led >= 0; cur_led--)
|
||||
led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev);
|
||||
kfree(priv->data_buf);
|
||||
mutex_destroy(&priv->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id ws2812b_spi_ids[] = {
|
||||
{ "ws2812b" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, ws2812b_spi_ids);
|
||||
|
||||
static const struct of_device_id ws2812b_dt_ids[] = {
|
||||
{ .compatible = "worldsemi,ws2812b" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, ws2812b_dt_ids);
|
||||
|
||||
static struct spi_driver ws2812b_driver = {
|
||||
.probe = ws2812b_probe,
|
||||
.remove = ws2812b_remove,
|
||||
.id_table = ws2812b_spi_ids,
|
||||
.driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.of_match_table = ws2812b_dt_ids,
|
||||
},
|
||||
};
|
||||
|
||||
module_spi_driver(ws2812b_driver);
|
||||
|
||||
MODULE_AUTHOR("Chuanhong Guo <gch981213@gmail.com>");
|
||||
MODULE_DESCRIPTION("WS2812B LED driver using SPI");
|
||||
MODULE_LICENSE("GPL");
|
17
package/kernel/mtk-eip93/Config.in
Normal file
17
package/kernel/mtk-eip93/Config.in
Normal file
@ -0,0 +1,17 @@
|
||||
if PACKAGE_kmod-crypto-hw-eip93
|
||||
|
||||
config MTK_EIP93_GENERIC_SW_MAX_LEN
|
||||
int "Max skcipher software fallback length"
|
||||
default 256
|
||||
help
|
||||
Max length of crypt request which
|
||||
will fallback to software crypt of skcipher *except* AES-128.
|
||||
|
||||
config MTK_EIP93_AES_128_SW_MAX_LEN
|
||||
int "Max AES-128 skcipher software fallback length"
|
||||
default 512
|
||||
help
|
||||
Max length of crypt request which
|
||||
will fallback to software crypt of AES-128 skcipher.
|
||||
|
||||
endif
|
68
package/kernel/mtk-eip93/Makefile
Normal file
68
package/kernel/mtk-eip93/Makefile
Normal file
@ -0,0 +1,68 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mtk-eip93
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/vschagen/mtk-eip93.git
|
||||
PKG_SOURCE_VERSION:=ca08387bf8352652129019bb19e2423ab313d5cb
|
||||
PKG_MIRROR_HASH:=4505ee2a175a6cf77a1a3b4fa7bf188da8f8b47894e5afa62c8cb008fbfa15ed
|
||||
|
||||
MAKE_PATH:=crypto/mtk-eip93
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/crypto-hw-eip93
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Cryptographic API modules
|
||||
DEPENDS:= \
|
||||
@TARGET_ramips_mt7621 \
|
||||
+kmod-crypto-authenc \
|
||||
+kmod-crypto-des \
|
||||
+kmod-crypto-md5 \
|
||||
+kmod-crypto-sha1 \
|
||||
+kmod-crypto-sha256
|
||||
TITLE:=MTK EIP93 crypto module.
|
||||
FILES:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/crypto-hw-eip93.ko
|
||||
AUTOLOAD:=$(call AutoProbe,crypto-hw-eip93)
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-hw-eip93/description
|
||||
Kernel module to enable EIP-93 Crypto engine as found
|
||||
in the Mediatek MT7621 SoC.
|
||||
It enables DES/3DES/AES ECB/CBC/CTR and
|
||||
IPSEC offload with authenc(hmac(sha1/sha256), aes/cbc/rfc3686)
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-hw-eip93/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
EIP93_EXTRA_CFLAGS:= \
|
||||
-D CONFIG_CRYPTO_DEV_EIP93_SKCIPHER=1 \
|
||||
-D CONFIG_CRYPTO_DEV_EIP93_HMAC=1 \
|
||||
-D CONFIG_CRYPTO_DEV_EIP93_AES=1 \
|
||||
-D CONFIG_CRYPTO_DEV_EIP93_DES=1 \
|
||||
-D CONFIG_CRYPTO_DEV_EIP93_AEAD=1 \
|
||||
-D CONFIG_MTK_EIP93_GENERIC_SW_MAX_LEN=$(CONFIG_MTK_EIP93_GENERIC_SW_MAX_LEN) \
|
||||
-D CONFIG_MTK_EIP93_AES_128_SW_MAX_LEN=$(CONFIG_MTK_EIP93_AES_128_SW_MAX_LEN)
|
||||
EIP93_MAKE_FLAGS:= \
|
||||
EXTRA_CFLAGS="$(EIP93_EXTRA_CFLAGS)" \
|
||||
CONFIG_CRYPTO_DEV_EIP93=m \
|
||||
CONFIG_CRYPTO_DEV_EIP93_SKCIPHER=y \
|
||||
CONFIG_CRYPTO_DEV_EIP93_AEAD=y
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(EIP93_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/$(MAKE_PATH)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,crypto-hw-eip93))
|
@ -0,0 +1,177 @@
|
||||
From f39ee05bedc68cf80e76c69692f87b96bf5a3b51 Mon Sep 17 00:00:00 2001
|
||||
From: Aviana Cruz <gwencroft@proton.me>
|
||||
Date: Tue, 21 Jun 2022 10:47:10 +0800
|
||||
Subject: [PATCH] crypto: use AES fallback for small requests
|
||||
|
||||
Signed-off-by: Aviana Cruz <gwencroft@proton.me>
|
||||
---
|
||||
crypto/mtk-eip93/eip93-aead.c | 2 -
|
||||
crypto/mtk-eip93/eip93-cipher.c | 66 ++++++++++++++++++++++++++++++---
|
||||
crypto/mtk-eip93/eip93-cipher.h | 3 ++
|
||||
3 files changed, 63 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/crypto/mtk-eip93/eip93-aead.c
|
||||
+++ b/crypto/mtk-eip93/eip93-aead.c
|
||||
@@ -77,8 +77,6 @@ static int mtk_aead_cra_init(struct cryp
|
||||
u32 flags = tmpl->flags;
|
||||
char *alg_base;
|
||||
|
||||
- memset(ctx, 0, sizeof(*ctx));
|
||||
-
|
||||
crypto_aead_set_reqsize(__crypto_aead_cast(tfm),
|
||||
sizeof(struct mtk_cipher_reqctx));
|
||||
|
||||
--- a/crypto/mtk-eip93/eip93-cipher.c
|
||||
+++ b/crypto/mtk-eip93/eip93-cipher.c
|
||||
@@ -31,6 +31,13 @@ void mtk_skcipher_handle_result(struct c
|
||||
skcipher_request_complete(req, err);
|
||||
}
|
||||
|
||||
+static inline bool mtk_skcipher_is_fallback(const struct crypto_tfm *tfm,
|
||||
+ u32 flags)
|
||||
+{
|
||||
+ return (tfm->__crt_alg->cra_flags & CRYPTO_ALG_NEED_FALLBACK) &&
|
||||
+ !IS_RFC3686(flags);
|
||||
+}
|
||||
+
|
||||
static int mtk_skcipher_send_req(struct crypto_async_request *async)
|
||||
{
|
||||
struct skcipher_request *req = skcipher_request_cast(async);
|
||||
@@ -53,11 +60,21 @@ static int mtk_skcipher_cra_init(struct
|
||||
struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm);
|
||||
struct mtk_alg_template *tmpl = container_of(tfm->__crt_alg,
|
||||
struct mtk_alg_template, alg.skcipher.base);
|
||||
+ bool fallback = mtk_skcipher_is_fallback(tfm, tmpl->flags);
|
||||
+
|
||||
+ if (fallback) {
|
||||
+ ctx->fallback = crypto_alloc_skcipher(
|
||||
+ crypto_tfm_alg_name(tfm), 0, CRYPTO_ALG_NEED_FALLBACK);
|
||||
+ if (IS_ERR(ctx->fallback))
|
||||
+ return PTR_ERR(ctx->fallback);
|
||||
+ }
|
||||
|
||||
- crypto_skcipher_set_reqsize(__crypto_skcipher_cast(tfm),
|
||||
- sizeof(struct mtk_cipher_reqctx));
|
||||
+ crypto_skcipher_set_reqsize(
|
||||
+ __crypto_skcipher_cast(tfm),
|
||||
+ sizeof(struct mtk_cipher_reqctx) +
|
||||
+ (fallback ? crypto_skcipher_reqsize(ctx->fallback) :
|
||||
+ 0));
|
||||
|
||||
- memset(ctx, 0, sizeof(*ctx));
|
||||
ctx->mtk = tmpl->mtk;
|
||||
|
||||
ctx->sa_in = kzalloc(sizeof(struct saRecord_s), GFP_KERNEL);
|
||||
@@ -86,6 +103,8 @@ static void mtk_skcipher_cra_exit(struct
|
||||
sizeof(struct saRecord_s), DMA_TO_DEVICE);
|
||||
kfree(ctx->sa_in);
|
||||
kfree(ctx->sa_out);
|
||||
+
|
||||
+ crypto_free_skcipher(ctx->fallback);
|
||||
}
|
||||
|
||||
static int mtk_skcipher_setkey(struct crypto_skcipher *ctfm, const u8 *key,
|
||||
@@ -105,6 +124,8 @@ static int mtk_skcipher_setkey(struct cr
|
||||
if (!key || !keylen)
|
||||
return err;
|
||||
|
||||
+ ctx->keylen = keylen;
|
||||
+
|
||||
#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES)
|
||||
if (IS_RFC3686(flags)) {
|
||||
if (len < CTR_RFC3686_NONCE_SIZE)
|
||||
@@ -128,6 +149,14 @@ static int mtk_skcipher_setkey(struct cr
|
||||
#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES)
|
||||
if (flags & MTK_ALG_AES) {
|
||||
struct crypto_aes_ctx aes;
|
||||
+ bool fallback = mtk_skcipher_is_fallback(tfm, flags);
|
||||
+
|
||||
+ if (fallback && !IS_RFC3686(flags)) {
|
||||
+ err = crypto_skcipher_setkey(ctx->fallback, key,
|
||||
+ keylen);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
|
||||
ctx->blksize = AES_BLOCK_SIZE;
|
||||
err = aes_expandkey(&aes, key, keylen);
|
||||
@@ -160,16 +189,41 @@ static int mtk_skcipher_setkey(struct cr
|
||||
return err;
|
||||
}
|
||||
|
||||
-static int mtk_skcipher_crypt(struct skcipher_request *req)
|
||||
+static int mtk_skcipher_crypt(struct skcipher_request *req, bool encrypt)
|
||||
{
|
||||
struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req);
|
||||
struct crypto_async_request *async = &req->base;
|
||||
struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
|
||||
struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
|
||||
+ bool fallback = mtk_skcipher_is_fallback(req->base.tfm, rctx->flags);
|
||||
|
||||
if (!req->cryptlen)
|
||||
return 0;
|
||||
|
||||
+ /*
|
||||
+ * ECB and CBC algorithms require message lengths to be
|
||||
+ * multiples of block size.
|
||||
+ */
|
||||
+ if (IS_ECB(rctx->flags) || IS_CBC(rctx->flags))
|
||||
+ if (!IS_ALIGNED(req->cryptlen,
|
||||
+ crypto_skcipher_blocksize(skcipher)))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (fallback &&
|
||||
+ req->cryptlen <= (AES_KEYSIZE_128 ?
|
||||
+ CONFIG_MTK_EIP93_AES_128_SW_MAX_LEN :
|
||||
+ CONFIG_MTK_EIP93_GENERIC_SW_MAX_LEN)) {
|
||||
+ skcipher_request_set_tfm(&rctx->fallback_req, ctx->fallback);
|
||||
+ skcipher_request_set_callback(&rctx->fallback_req,
|
||||
+ req->base.flags,
|
||||
+ req->base.complete,
|
||||
+ req->base.data);
|
||||
+ skcipher_request_set_crypt(&rctx->fallback_req, req->src,
|
||||
+ req->dst, req->cryptlen, req->iv);
|
||||
+ return encrypt ? crypto_skcipher_encrypt(&rctx->fallback_req) :
|
||||
+ crypto_skcipher_decrypt(&rctx->fallback_req);
|
||||
+ }
|
||||
+
|
||||
rctx->assoclen = 0;
|
||||
rctx->textsize = req->cryptlen;
|
||||
rctx->authsize = 0;
|
||||
@@ -195,7 +249,7 @@ static int mtk_skcipher_encrypt(struct s
|
||||
rctx->flags |= MTK_ENCRYPT;
|
||||
rctx->saRecord_base = ctx->sa_base_out;
|
||||
|
||||
- return mtk_skcipher_crypt(req);
|
||||
+ return mtk_skcipher_crypt(req, true);
|
||||
}
|
||||
|
||||
static int mtk_skcipher_decrypt(struct skcipher_request *req)
|
||||
@@ -209,7 +263,7 @@ static int mtk_skcipher_decrypt(struct s
|
||||
rctx->flags |= MTK_DECRYPT;
|
||||
rctx->saRecord_base = ctx->sa_base_in;
|
||||
|
||||
- return mtk_skcipher_crypt(req);
|
||||
+ return mtk_skcipher_crypt(req, false);
|
||||
}
|
||||
|
||||
/* Available algorithms in this module */
|
||||
--- a/crypto/mtk-eip93/eip93-cipher.h
|
||||
+++ b/crypto/mtk-eip93/eip93-cipher.h
|
||||
@@ -24,6 +24,8 @@ struct mtk_crypto_ctx {
|
||||
bool in_first;
|
||||
bool out_first;
|
||||
struct crypto_shash *shash;
|
||||
+ unsigned int keylen;
|
||||
+ struct crypto_skcipher *fallback;
|
||||
};
|
||||
|
||||
struct mtk_cipher_reqctx {
|
||||
@@ -45,6 +47,7 @@ struct mtk_cipher_reqctx {
|
||||
struct saState_s *saState_ctr;
|
||||
dma_addr_t saState_base_ctr;
|
||||
uint32_t saState_ctr_idx;
|
||||
+ struct skcipher_request fallback_req; // keep at the end
|
||||
};
|
||||
|
||||
int check_valid_request(struct mtk_cipher_reqctx *rctx);
|
@ -0,0 +1,48 @@
|
||||
--- a/crypto/mtk-eip93/eip93-aead.c
|
||||
+++ b/crypto/mtk-eip93/eip93-aead.c
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <crypto/internal/aead.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/null.h>
|
||||
-#include <crypto/sha1.h>
|
||||
-#include <crypto/sha2.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES)
|
||||
#include <crypto/internal/des.h>
|
||||
@@ -22,6 +20,14 @@
|
||||
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
+#include <linux/version.h>
|
||||
+
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
|
||||
+#include <crypto/sha.h>
|
||||
+#else
|
||||
+#include <crypto/sha1.h>
|
||||
+#include <crypto/sha2.h>
|
||||
+#endif
|
||||
|
||||
#include "eip93-aead.h"
|
||||
#include "eip93-cipher.h"
|
||||
--- a/crypto/mtk-eip93/eip93-common.c
|
||||
+++ b/crypto/mtk-eip93/eip93-common.c
|
||||
@@ -8,11 +8,17 @@
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/ctr.h>
|
||||
#include <crypto/hmac.h>
|
||||
-#include <crypto/sha1.h>
|
||||
-#include <crypto/sha2.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/scatterlist.h>
|
||||
+#include <linux/version.h>
|
||||
+
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
|
||||
+#include <crypto/sha.h>
|
||||
+#else
|
||||
+#include <crypto/sha1.h>
|
||||
+#include <crypto/sha2.h>
|
||||
+#endif
|
||||
|
||||
#include "eip93-cipher.h"
|
||||
#include "eip93-common.h"
|
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mwlwifi
|
||||
PKG_RELEASE=1
|
||||
PKG_RELEASE=3
|
||||
|
||||
PKG_LICENSE:=ISC
|
||||
PKG_LICENSE_FILES:=
|
||||
@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define KernelPackage/mwlwifi
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=Marvell 88W8864/88W8897/88W8964/88W8997 wireless driver
|
||||
DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT @TARGET_mvebu
|
||||
DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @PCI_SUPPORT @TARGET_mvebu
|
||||
FILES:=$(PKG_BUILD_DIR)/mwlwifi.ko
|
||||
AUTOLOAD:=$(call AutoLoad,50,mwlwifi)
|
||||
endef
|
||||
@ -44,8 +44,7 @@ NOSTDINC_FLAGS := \
|
||||
-include backport/backport.h
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/core.c
|
||||
+++ b/core.c
|
||||
@@ -982,7 +982,7 @@ struct ieee80211_hw *mwl_alloc_hw(int bu
|
||||
priv->use_short_preamble = false;
|
||||
priv->disable_2g = false;
|
||||
priv->disable_5g = false;
|
||||
- priv->tx_amsdu = true;
|
||||
+ priv->tx_amsdu = false;
|
||||
priv->hif.bus = bus_type;
|
||||
priv->hif.ops = ops;
|
||||
priv->hif.priv = (char *)priv + ALIGN(sizeof(*priv), NETDEV_ALIGN);
|
@ -0,0 +1,32 @@
|
||||
From 392f8e9d798acff3079e753dd881e272f6150d74 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Wed, 30 Mar 2022 19:32:38 +0200
|
||||
Subject: [PATCH] mwlwifi: remove MODULE_SUPPORTED_DEVICE
|
||||
|
||||
Kernel 5.12 finally removed all MODULE_SUPPORTED_DEVICE references and
|
||||
support for it as it was never actually implemented and was safe to
|
||||
drop it completely.
|
||||
|
||||
So, do the same in order to compile in 5.12 and newer.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
hif/pcie/pcie.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/hif/pcie/pcie.c
|
||||
+++ b/hif/pcie/pcie.c
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "hif/pcie/rx_ndp.h"
|
||||
|
||||
#define PCIE_DRV_DESC "Marvell Mac80211 Wireless PCIE Network Driver"
|
||||
-#define PCIE_DEV_NAME "Marvell 802.11ac PCIE Adapter"
|
||||
|
||||
#define MAX_WAIT_FW_COMPLETE_ITERATIONS 10000
|
||||
#define CHECK_BA_TRAFFIC_TIME 300 /* msec */
|
||||
@@ -1641,5 +1640,4 @@ MODULE_DESCRIPTION(PCIE_DRV_DESC);
|
||||
MODULE_VERSION(PCIE_DRV_VERSION);
|
||||
MODULE_AUTHOR("Marvell Semiconductor, Inc.");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
-MODULE_SUPPORTED_DEVICE(PCIE_DEV_NAME);
|
||||
MODULE_DEVICE_TABLE(pci, pcie_id_tbl);
|
@ -0,0 +1,39 @@
|
||||
From 16e51cb83f9fa1717383c9d67f5531df7348347c Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Wed, 30 Mar 2022 19:51:56 +0200
|
||||
Subject: [PATCH] mwlwifi: replace get/set_fs() calls
|
||||
|
||||
Since kernel 5.9 the get/set_fs() call implementation have started to get
|
||||
dropped from individual architectures, ARM64 one got dropped in 5.11.
|
||||
|
||||
Replace the get/set_fs() calls with force_uaccess_begin/end() to allow
|
||||
compiling on newer kernels.
|
||||
There is no need to add kernel version checks as the replacement functions
|
||||
are available since kernel 5.9.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
hif/pcie/pcie.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/hif/pcie/pcie.c
|
||||
+++ b/hif/pcie/pcie.c
|
||||
@@ -1293,8 +1293,7 @@ static void pcie_bf_mimo_ctrl_decode(str
|
||||
char *buf = &str_buf[0];
|
||||
mm_segment_t oldfs;
|
||||
|
||||
- oldfs = get_fs();
|
||||
- set_fs(KERNEL_DS);
|
||||
+ oldfs = force_uaccess_begin();
|
||||
|
||||
buf += sprintf(buf, "\nMAC: %pM\n", bf_mimo_ctrl->rec_mac);
|
||||
buf += sprintf(buf, "SU_0_MU_1: %d\n", bf_mimo_ctrl->type);
|
||||
@@ -1314,7 +1313,7 @@ static void pcie_bf_mimo_ctrl_decode(str
|
||||
filename, (unsigned int)fp_data);
|
||||
}
|
||||
|
||||
- set_fs(oldfs);
|
||||
+ force_uaccess_end(oldfs);
|
||||
}
|
||||
|
||||
static void pcie_process_account(struct ieee80211_hw *hw)
|
@ -0,0 +1,31 @@
|
||||
From 8e809b241695252e397bf0d7fc5f36e115c38831 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marko <robert.marko@sartura.hr>
|
||||
Date: Fri, 5 Mar 2021 11:47:59 +0100
|
||||
Subject: [PATCH] mwlwifi: fix PCIe DT node null pointer dereference
|
||||
|
||||
pci_bus_to_OF_node() used to get the PCI bus DT node
|
||||
returns node if found or NULL if none is found.
|
||||
|
||||
Since the return of pci_bus_to_OF_node() is not checked in
|
||||
the DT node name print it will cause a null pointer
|
||||
dereference and crash the kernel.
|
||||
|
||||
So first check whether the node is not NULL and then print.
|
||||
|
||||
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
---
|
||||
hif/pcie/pcie.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/hif/pcie/pcie.c
|
||||
+++ b/hif/pcie/pcie.c
|
||||
@@ -570,7 +570,8 @@ static struct device_node *pcie_get_devi
|
||||
struct device_node *dev_node;
|
||||
|
||||
dev_node = pci_bus_to_OF_node(pcie_priv->pdev->bus);
|
||||
- wiphy_info(priv->hw->wiphy, "device node: %s\n", dev_node->full_name);
|
||||
+ if (dev_node)
|
||||
+ wiphy_info(priv->hw->wiphy, "device node: %s\n", dev_node->full_name);
|
||||
|
||||
return dev_node;
|
||||
}
|
@ -3,11 +3,11 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=nat46
|
||||
|
||||
PKG_MIRROR_HASH:=3b424241de42b96d47217decf6f9071153cd0c11651f1ee006700836c6660fe8
|
||||
PKG_MIRROR_HASH:=c26b8c60aa991a087011b8b6492e43a6749f0a5d9dc79ffcfd352da5fa20b78d
|
||||
PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
|
||||
PKG_SOURCE_DATE:=2021-05-17
|
||||
PKG_SOURCE_DATE:=2022-03-30
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0d5860d63a8037e001e293091ebf6219cc2f9255
|
||||
PKG_SOURCE_VERSION:=95ca1c3b99376da2d0306919f2df4a8d3c9bb78b
|
||||
|
||||
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
@ -22,8 +22,7 @@ define KernelPackage/rtc-rv5c386a
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(KERNEL_MAKE) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
|
@ -1,79 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2020 stepheny
|
||||
# <https://github.com/aircrack-ng/rtl8812au/pull/619>
|
||||
#
|
||||
# Copyright (C) 2021-2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rtl8812au-ac
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/aircrack-ng/rtl8812au.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-05-22
|
||||
PKG_SOURCE_VERSION:=0b87ed921a8682856aed5a3e68344b0087f3c93c
|
||||
PKG_MIRROR_HASH:=f351622acacda52580d5983f5fa6130f625c80f9ee7500543ff8333d57ec3b74
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Marty Jones <mj8263788@gmail.com>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/rtl8812au-ac
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=Realtek RTL8812AU/21AU wireless drivers
|
||||
DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
|
||||
FILES:=$(PKG_BUILD_DIR)/rtl8812au.ko
|
||||
AUTOLOAD:=$(call AutoProbe,rtl8812au)
|
||||
CONFLICTS:=kmod-rtl8812au-ct
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(PKG_BUILD_DIR)/include \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h
|
||||
|
||||
EXTRA_KCONFIG:= \
|
||||
CONFIG_88XXAU=m \
|
||||
USER_MODULE_NAME=rtl8812au
|
||||
|
||||
EXTRA_CFLAGS:= \
|
||||
-DRTW_SINGLE_WIPHY \
|
||||
-DRTW_USE_CFG80211_STA_EVENT \
|
||||
-DCONFIG_IOCTL_CFG80211 \
|
||||
-DCONFIG_CONCURRENT_MODE \
|
||||
-DBUILD_OPENWRT
|
||||
|
||||
ifeq ($(CONFIG_BIG_ENDIAN),y)
|
||||
EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
|
||||
else
|
||||
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
|
||||
endif
|
||||
|
||||
MAKE_OPTS:= \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
USER_EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
$(EXTRA_KCONFIG)
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(MAKE_OPTS) \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,rtl8812au-ac))
|
@ -1,15 +0,0 @@
|
||||
Fix compile problem when rtw_byteorder.h and asm/byteorder.h gets
|
||||
included in addition for example indirectly, do not use realtek own copy
|
||||
of the byteorder headers.
|
||||
|
||||
--- a/include/drv_types.h
|
||||
+++ b/include/drv_types.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <drv_conf.h>
|
||||
#include <basic_types.h>
|
||||
#include <osdep_service.h>
|
||||
-#include <rtw_byteorder.h>
|
||||
+#include <asm/byteorder.h>
|
||||
#include <wlan_bssdef.h>
|
||||
#include <wifi.h>
|
||||
#include <ieee80211.h>
|
@ -1,11 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -92,7 +92,7 @@ CONFIG_RTW_SDIO_PM_KEEP_POWER = y
|
||||
###################### MP HW TX MODE FOR VHT #######################
|
||||
CONFIG_MP_VHT_HW_TX_MODE = n
|
||||
###################### Platform Related #######################
|
||||
-CONFIG_PLATFORM_I386_PC = y
|
||||
+CONFIG_PLATFORM_I386_PC = n
|
||||
CONFIG_PLATFORM_ANDROID_ARM64 = n
|
||||
CONFIG_PLATFORM_ARM_RPI = n
|
||||
CONFIG_PLATFORM_ARM64_RPI = n
|
@ -1,20 +0,0 @@
|
||||
--- a/os_dep/linux/os_intfs.c
|
||||
+++ b/os_dep/linux/os_intfs.c
|
||||
@@ -254,7 +254,7 @@ int rtw_bfee_rf_number = 0; /*BeamformeeCapRfNum Rf path number, 0 for auto, ot
|
||||
#endif /* CONFIG_80211N_HT */
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
-int rtw_vht_enable = 1; /* 0:disable, 1:enable, 2:force auto enable */
|
||||
+int rtw_vht_enable = 2; /* 0:disable, 1:enable, 2:force auto enable */
|
||||
module_param(rtw_vht_enable, int, 0644);
|
||||
|
||||
int rtw_ampdu_factor = 7;
|
||||
@@ -324,7 +324,7 @@ int rtw_drv_ant_band_switch = 1; /* 0:OFF , 1:ON, Driver control antenna band sw
|
||||
int rtw_single_ant_path; /*0:main ant , 1:aux ant , Fixed single antenna path, default main ant*/
|
||||
|
||||
/* 0: doesn't switch, 1: switch from usb2.0 to usb 3.0 2: switch from usb3.0 to usb 2.0 */
|
||||
-int rtw_switch_usb_mode = 0;
|
||||
+int rtw_switch_usb_mode = 1;
|
||||
|
||||
#ifdef CONFIG_USB_AUTOSUSPEND
|
||||
int rtw_enusbss = 1;/* 0:disable,1:enable */
|
@ -1,10 +0,0 @@
|
||||
--- a/os_dep/linux/os_intfs.c
|
||||
+++ b/os_dep/linux/os_intfs.c
|
||||
@@ -2803,6 +2803,7 @@ static int netdev_vir_if_close(struct net_device *pnetdev)
|
||||
{
|
||||
_adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev);
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
+ struct wireless_dev *wdev = padapter->rtw_wdev;
|
||||
|
||||
RTW_INFO(FUNC_NDEV_FMT" , bup=%d\n", FUNC_NDEV_ARG(pnetdev), padapter->bup);
|
||||
padapter->net_closed = _TRUE;
|
@ -1,20 +0,0 @@
|
||||
--- a/os_dep/linux/ioctl_cfg80211.c
|
||||
+++ b/os_dep/linux/ioctl_cfg80211.c
|
||||
@@ -7733,7 +7733,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) || defined(BUILD_OPENWRT)
|
||||
static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
struct mgmt_frame_regs *upd)
|
||||
@@ -10185,7 +10185,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
.mgmt_tx = cfg80211_rtw_mgmt_tx,
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) || defined(BUILD_OPENWRT)
|
||||
.update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_register,
|
||||
#else
|
||||
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
|
@ -7,10 +7,10 @@ PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git
|
||||
PKG_MIRROR_HASH:=aee819df4ba83251b59bd1d4f412287b27105e5de9284bb09579f0e1a1538328
|
||||
PKG_MIRROR_HASH:=31e658df3e4d4c18c396259c2e0bef2bfc44a4aa870931f031a31e948be98af4
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2020-12-07
|
||||
PKG_SOURCE_VERSION:=1e9689c89fa627d2d764ba0e8359fd444fe8458f
|
||||
PKG_SOURCE_DATE:=2021-11-07
|
||||
PKG_SOURCE_VERSION:=39df55967b7de9f6c9600017b724303f95a8b9e2
|
||||
|
||||
PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
@ -44,8 +44,7 @@ NOSTDINC_FLAGS := \
|
||||
NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
|
@ -0,0 +1,24 @@
|
||||
--- a/include/ieee80211.h
|
||||
+++ b/include/ieee80211.h
|
||||
@@ -1313,18 +1313,18 @@ enum ieee80211_state {
|
||||
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
|
||||
(((Addr[5]) & 0xff) == 0xff))
|
||||
#else
|
||||
-extern __inline int is_multicast_mac_addr(const u8 *addr)
|
||||
+__inline static int is_multicast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] != 0xff) && (0x01 & addr[0]));
|
||||
}
|
||||
|
||||
-extern __inline int is_broadcast_mac_addr(const u8 *addr)
|
||||
+__inline static int is_broadcast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||
}
|
||||
|
||||
-extern __inline int is_zero_mac_addr(const u8 *addr)
|
||||
+__inline static int is_zero_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
132
package/kernel/rtw88-usb/Makefile
Normal file
132
package/kernel/rtw88-usb/Makefile
Normal file
@ -0,0 +1,132 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rtw88-usb
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-07-06
|
||||
PKG_SOURCE_URL:=https://github.com/ulli-kroll/rtw88-usb.git
|
||||
PKG_SOURCE_VERSION:=dd05eec8e5ac934b3d8e67e8008228f842b4ce1c
|
||||
PKG_MIRROR_HASH:=9932f69573a3469d1eba403c7964a9472530fcfa1c29356babeecdad8d9c6991
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/rtw88-default
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=Realtek rtw88 family usb driver
|
||||
DEPENDS:=+kmod-mac80211 +kmod-usb-core \
|
||||
+@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
|
||||
endef
|
||||
|
||||
define KernelPackage/rtw88-usb
|
||||
$(KernelPackage/rtw88-default)
|
||||
HIDDEN:=1
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/rtw88_usb.ko \
|
||||
$(PKG_BUILD_DIR)/rtw88_core.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/rtl8723du
|
||||
$(KernelPackage/rtw88-default)
|
||||
TITLE:=Realtek RTL8723DU support
|
||||
DEPENDS+=+kmod-rtw88-usb +rtl8723du-firmware
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/rtw88_8723d.ko \
|
||||
$(PKG_BUILD_DIR)/rtw88_8723du.ko
|
||||
AUTOLOAD:=$(call AutoProbe,rtw88_8723du)
|
||||
endef
|
||||
|
||||
define KernelPackage/rtl8821cu
|
||||
$(KernelPackage/rtw88-default)
|
||||
TITLE:=Realtek RTL8821CU support
|
||||
DEPENDS+=+kmod-rtw88-usb +rtl8821ce-firmware
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/rtw88_8821c.ko \
|
||||
$(PKG_BUILD_DIR)/rtw88_8821cu.ko
|
||||
AUTOLOAD:=$(call AutoProbe,rtw88_8821cu)
|
||||
endef
|
||||
|
||||
define KernelPackage/rtl8822bu
|
||||
$(KernelPackage/rtw88-default)
|
||||
TITLE:=Realtek RTL8822BU support
|
||||
DEPENDS+=+kmod-rtw88-usb +rtl8822be-firmware
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/rtw88_8822b.ko \
|
||||
$(PKG_BUILD_DIR)/rtw88_8822bu.ko
|
||||
AUTOLOAD:=$(call AutoProbe,rtw88_8822bu)
|
||||
endef
|
||||
|
||||
define KernelPackage/rtl8822cu
|
||||
$(KernelPackage/rtw88-default)
|
||||
TITLE:=Realtek RTL8822CU support
|
||||
DEPENDS+=+kmod-rtw88-usb +rtl8822ce-firmware
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/rtw88_8822c.ko \
|
||||
$(PKG_BUILD_DIR)/rtw88_8822cu.ko
|
||||
AUTOLOAD:=$(call AutoProbe,rtw88_8822cu)
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS := \
|
||||
$(KERNEL_NOSTDINC_FLAGS) \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h
|
||||
|
||||
ifdef CONFIG_PACKAGE_kmod-rtw88-usb
|
||||
PKG_MAKE_FLAGS += \
|
||||
CONFIG_RTW88_USB=m \
|
||||
CONFIG_RTW88_CORE=m
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-rtl8723du
|
||||
PKG_MAKE_FLAGS += \
|
||||
CONFIG_RTW88_8723D=m \
|
||||
CONFIG_RTW88_8723DU=m
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-rtl8821cu
|
||||
PKG_MAKE_FLAGS += \
|
||||
CONFIG_RTW88_8821C=m \
|
||||
CONFIG_RTW88_8821CU=m
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-rtl8822bu
|
||||
PKG_MAKE_FLAGS += \
|
||||
CONFIG_RTW88_8822B=m \
|
||||
CONFIG_RTW88_8822BU=m
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-rtl8822cu
|
||||
PKG_MAKE_FLAGS += \
|
||||
CONFIG_RTW88_8822C=m \
|
||||
CONFIG_RTW88_8822CU=m
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(PKG_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,rtw88-usb))
|
||||
$(eval $(call KernelPackage,rtl8723du))
|
||||
$(eval $(call KernelPackage,rtl8821cu))
|
||||
$(eval $(call KernelPackage,rtl8822bu))
|
||||
$(eval $(call KernelPackage,rtl8822cu))
|
391
package/kernel/rtw88-usb/patches/001-sync-upstream-regd.patch
Normal file
391
package/kernel/rtw88-usb/patches/001-sync-upstream-regd.patch
Normal file
@ -0,0 +1,391 @@
|
||||
--- a/debug.c
|
||||
+++ b/debug.c
|
||||
@@ -868,37 +868,6 @@ static int rtw_debugfs_get_coex_enable(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static ssize_t rtw_debugfs_set_edcca_enable(struct file *filp,
|
||||
- const char __user *buffer,
|
||||
- size_t count, loff_t *loff)
|
||||
-{
|
||||
- struct seq_file *seqpriv = (struct seq_file *)filp->private_data;
|
||||
- struct rtw_debugfs_priv *debugfs_priv = seqpriv->private;
|
||||
- struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
|
||||
- char tmp[32 + 1];
|
||||
- int err;
|
||||
-
|
||||
- rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
|
||||
-
|
||||
- err = kstrtobool(tmp, &rtw_edcca_enabled);
|
||||
- if (err)
|
||||
- return err;
|
||||
- rtw_phy_adaptivity_set_mode(rtwdev);
|
||||
-
|
||||
- return count;
|
||||
-}
|
||||
-
|
||||
-static int rtw_debugfs_get_edcca_enable(struct seq_file *m, void *v)
|
||||
-{
|
||||
- struct rtw_debugfs_priv *debugfs_priv = m->private;
|
||||
- struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
|
||||
- struct rtw_dm_info *dm_info = &rtwdev->dm_info;
|
||||
-
|
||||
- seq_printf(m, "EDCCA mode %d\n", dm_info->edcca_mode);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static ssize_t rtw_debugfs_set_fw_crash(struct file *filp,
|
||||
const char __user *buffer,
|
||||
size_t count, loff_t *loff)
|
||||
@@ -1118,11 +1087,6 @@ static struct rtw_debugfs_priv rtw_debug_priv_coex_info = {
|
||||
.cb_read = rtw_debugfs_get_coex_info,
|
||||
};
|
||||
|
||||
-static struct rtw_debugfs_priv rtw_debug_priv_edcca_enable = {
|
||||
- .cb_write = rtw_debugfs_set_edcca_enable,
|
||||
- .cb_read = rtw_debugfs_get_edcca_enable,
|
||||
-};
|
||||
-
|
||||
static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = {
|
||||
.cb_write = rtw_debugfs_set_fw_crash,
|
||||
.cb_read = rtw_debugfs_get_fw_crash,
|
||||
@@ -1209,7 +1173,6 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev)
|
||||
rtw_debugfs_add_r(tx_pwr_tbl);
|
||||
rtw_debugfs_add_rw(fw_crash);
|
||||
rtw_debugfs_add_rw(dm_cap);
|
||||
- rtw_debugfs_add_rw(edcca_enable);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RTW88_DEBUGFS */
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "fw.h"
|
||||
#include "phy.h"
|
||||
#include "debug.h"
|
||||
-#include "regd.h"
|
||||
|
||||
struct phy_cfg_pair {
|
||||
u32 addr;
|
||||
@@ -121,58 +120,6 @@ static void rtw_phy_cck_pd_init(struct rtw_dev *rtwdev)
|
||||
dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
|
||||
}
|
||||
|
||||
-void rtw_phy_set_edcca_th(struct rtw_dev *rtwdev, u8 l2h, u8 h2l)
|
||||
-{
|
||||
- struct rtw_hw_reg_offset *edcca_th = rtwdev->chip->edcca_th;
|
||||
-
|
||||
- rtw_write32_mask(rtwdev,
|
||||
- edcca_th[EDCCA_TH_L2H_IDX].hw_reg.addr,
|
||||
- edcca_th[EDCCA_TH_L2H_IDX].hw_reg.mask,
|
||||
- l2h + edcca_th[EDCCA_TH_L2H_IDX].offset);
|
||||
- rtw_write32_mask(rtwdev,
|
||||
- edcca_th[EDCCA_TH_H2L_IDX].hw_reg.addr,
|
||||
- edcca_th[EDCCA_TH_H2L_IDX].hw_reg.mask,
|
||||
- h2l + edcca_th[EDCCA_TH_H2L_IDX].offset);
|
||||
-}
|
||||
-EXPORT_SYMBOL(rtw_phy_set_edcca_th);
|
||||
-
|
||||
-void rtw_phy_adaptivity_set_mode(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw_chip_info *chip = rtwdev->chip;
|
||||
- struct rtw_dm_info *dm_info = &rtwdev->dm_info;
|
||||
-
|
||||
- /* turn off in debugfs for debug usage */
|
||||
- if (!rtw_edcca_enabled) {
|
||||
- dm_info->edcca_mode = RTW_EDCCA_NORMAL;
|
||||
- rtw_dbg(rtwdev, RTW_DBG_PHY, "EDCCA disabled, cannot be set\n");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- switch (rtwdev->regd.region) {
|
||||
- case NL80211_DFS_ETSI:
|
||||
- dm_info->edcca_mode = RTW_EDCCA_ADAPTIVITY;
|
||||
- dm_info->l2h_th_ini = chip->l2h_th_ini_ad;
|
||||
- break;
|
||||
- case NL80211_DFS_JP:
|
||||
- dm_info->edcca_mode = RTW_EDCCA_ADAPTIVITY;
|
||||
- dm_info->l2h_th_ini = chip->l2h_th_ini_cs;
|
||||
- break;
|
||||
- default:
|
||||
- dm_info->edcca_mode = RTW_EDCCA_NORMAL;
|
||||
- break;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static void rtw_phy_adaptivity_init(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw_chip_info *chip = rtwdev->chip;
|
||||
-
|
||||
- rtw_regd_init_dfs_region(rtwdev, rtwdev->regd.region);
|
||||
- rtw_phy_adaptivity_set_mode(rtwdev);
|
||||
- if (chip->ops->adaptivity_init)
|
||||
- chip->ops->adaptivity_init(rtwdev);
|
||||
-}
|
||||
-
|
||||
static void rtw_phy_cfo_init(struct rtw_dev *rtwdev)
|
||||
{
|
||||
struct rtw_chip_info *chip = rtwdev->chip;
|
||||
@@ -202,8 +149,6 @@ void rtw_phy_init(struct rtw_dev *rtwdev)
|
||||
rtw_phy_cck_pd_init(rtwdev);
|
||||
|
||||
dm_info->iqk.done = false;
|
||||
- dm_info->iqk.done = false;
|
||||
- rtw_phy_adaptivity_init(rtwdev);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_phy_init);
|
||||
|
||||
--- a/phy.h
|
||||
+++ b/phy.h
|
||||
@@ -61,8 +61,6 @@ void rtw_phy_config_swing_table(struct rtw_dev *rtwdev,
|
||||
struct rtw_swing_table *swing_table);
|
||||
void rtw_phy_parsing_cfo(struct rtw_dev *rtwdev,
|
||||
struct rtw_rx_pkt_stat *pkt_stat);
|
||||
-void rtw_phy_set_edcca_th(struct rtw_dev *rtwdev, u8 l2h, u8 h2l);
|
||||
-void rtw_phy_adaptivity_set_mode(struct rtw_dev *rtwdev);
|
||||
|
||||
struct rtw_txpwr_lmt_cfg_pair {
|
||||
u8 regd;
|
||||
--- a/regd.c
|
||||
+++ b/regd.c
|
||||
@@ -7,18 +7,6 @@
|
||||
#include "debug.h"
|
||||
#include "phy.h"
|
||||
|
||||
-static const struct ieee80211_regdomain rtw88_world_regdom = {
|
||||
- .n_reg_rules = 5,
|
||||
- .alpha2 = "99",
|
||||
- .reg_rules = {
|
||||
- REG_RULE(2412 - 10, 2462 + 10, 40, 0, 20, 0),
|
||||
- REG_RULE(2467 - 10, 2484 + 10, 40, 0, 20, NL80211_RRF_NO_IR),
|
||||
- REG_RULE(5180 - 10, 5240 + 10, 80, 0, 20, NL80211_RRF_NO_IR),
|
||||
- REG_RULE(5260 - 10, 5700 + 10, 80, 0, 20,
|
||||
- NL80211_RRF_NO_IR | NL80211_RRF_DFS),
|
||||
- REG_RULE(5745 - 10, 5825 + 10, 80, 0, 20, NL80211_RRF_NO_IR),
|
||||
- }
|
||||
-};
|
||||
#define COUNTRY_CHPLAN_ENT(_alpha2, _chplan, _txpwr_regd) \
|
||||
{.alpha2 = (_alpha2), \
|
||||
.chplan = (_chplan), \
|
||||
@@ -351,73 +339,28 @@ static struct rtw_regulatory rtw_regd_find_reg_by_name(char *alpha2)
|
||||
return rtw_defined_chplan;
|
||||
}
|
||||
|
||||
-static bool rtw_regd_is_ww(struct rtw_regulatory *reg)
|
||||
-{
|
||||
- if (reg->txpwr_regd == RTW_REGD_WW)
|
||||
- return true;
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
-void rtw_regd_init_dfs_region(struct rtw_dev *rtwdev,
|
||||
- enum nl80211_dfs_regions curr_region)
|
||||
-{
|
||||
- struct ieee80211_hw *hw = rtwdev->hw;
|
||||
- const struct ieee80211_regdomain *wiphy_regd = NULL;
|
||||
-
|
||||
- if (curr_region != RTW_REGION_INVALID)
|
||||
- return;
|
||||
-
|
||||
- rcu_read_lock();
|
||||
- wiphy_regd = rcu_dereference(hw->wiphy->regd);
|
||||
- if (wiphy_regd)
|
||||
- rtwdev->regd.region = wiphy_regd->dfs_region;
|
||||
- rcu_read_unlock();
|
||||
-}
|
||||
-
|
||||
static int rtw_regd_notifier_apply(struct rtw_dev *rtwdev,
|
||||
struct wiphy *wiphy,
|
||||
struct regulatory_request *request)
|
||||
{
|
||||
- if (request->initiator == NL80211_REGDOM_SET_BY_DRIVER)
|
||||
- return -ENOTSUPP;
|
||||
- if (request->initiator == NL80211_REGDOM_SET_BY_USER &&
|
||||
- !IS_ENABLED(CONFIG_RTW88_REGD_USER_REG_HINTS))
|
||||
- return -EPERM;
|
||||
- if (request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
|
||||
- !rtw_regd_is_ww(&rtwdev->regd))
|
||||
- return -EINVAL;
|
||||
- if (request->initiator == NL80211_REGDOM_SET_BY_CORE &&
|
||||
- !rtwdev->efuse.country_worldwide) {
|
||||
- rtwdev->regd =
|
||||
- rtw_regd_find_reg_by_name(rtwdev->efuse.country_code);
|
||||
- /* return to the efuse setting */
|
||||
- rtw_regd_init_dfs_region(rtwdev, RTW_REGION_INVALID);
|
||||
+ if (request->initiator == NL80211_REGDOM_SET_BY_USER)
|
||||
return 0;
|
||||
- }
|
||||
rtwdev->regd = rtw_regd_find_reg_by_name(request->alpha2);
|
||||
rtw_regd_apply_world_flags(wiphy, request->initiator);
|
||||
- rtwdev->regd.region = request->dfs_region;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
-rtw_regd_init_wiphy(struct rtw_dev *rtwdev, struct wiphy *wiphy,
|
||||
+rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy,
|
||||
void (*reg_notifier)(struct wiphy *wiphy,
|
||||
struct regulatory_request *request))
|
||||
{
|
||||
- struct rtw_regulatory *reg = &rtwdev->regd;
|
||||
-
|
||||
wiphy->reg_notifier = reg_notifier;
|
||||
|
||||
- if (rtw_regd_is_ww(reg)) {
|
||||
- rtwdev->efuse.country_worldwide = true;
|
||||
- wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
|
||||
- wiphy_apply_custom_regulatory(wiphy, &rtw88_world_regdom);
|
||||
- } else {
|
||||
- rtwdev->efuse.country_worldwide = false;
|
||||
- }
|
||||
- wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
|
||||
+ wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
|
||||
+ wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG;
|
||||
+ wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS;
|
||||
|
||||
rtw_regd_apply_hw_cap_flags(wiphy);
|
||||
|
||||
@@ -434,8 +377,7 @@ int rtw_regd_init(struct rtw_dev *rtwdev,
|
||||
return -EINVAL;
|
||||
|
||||
rtwdev->regd = rtw_regd_find_reg_by_name(rtwdev->efuse.country_code);
|
||||
- rtw_regd_init_wiphy(rtwdev, wiphy, reg_notifier);
|
||||
- rtwdev->regd.region = RTW_REGION_INVALID;
|
||||
+ rtw_regd_init_wiphy(&rtwdev->regd, wiphy, reg_notifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -445,21 +387,12 @@ void rtw_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request)
|
||||
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
|
||||
struct rtw_dev *rtwdev = hw->priv;
|
||||
struct rtw_hal *hal = &rtwdev->hal;
|
||||
- int ret;
|
||||
|
||||
- ret = rtw_regd_notifier_apply(rtwdev, wiphy, request);
|
||||
- if (ret) {
|
||||
- rtw_warn(rtwdev, "failed to apply regulatory from initiator %d: %d\n",
|
||||
- request->initiator, ret);
|
||||
- return;
|
||||
- }
|
||||
+ rtw_regd_notifier_apply(rtwdev, wiphy, request);
|
||||
rtw_dbg(rtwdev, RTW_DBG_REGD,
|
||||
"get alpha2 %c%c from initiator %d, mapping to chplan 0x%x, txregd %d\n",
|
||||
- request->alpha2[0], request->alpha2[1],
|
||||
- request->initiator, rtwdev->regd.chplan,
|
||||
- rtwdev->regd.txpwr_regd);
|
||||
-
|
||||
- rtw_phy_adaptivity_set_mode(rtwdev);
|
||||
+ request->alpha2[0], request->alpha2[1], request->initiator,
|
||||
+ rtwdev->regd.chplan, rtwdev->regd.txpwr_regd);
|
||||
|
||||
rtw_phy_set_tx_power_level(rtwdev, hal->current_channel);
|
||||
}
|
||||
--- a/regd.h
|
||||
+++ b/regd.h
|
||||
@@ -68,6 +68,4 @@ int rtw_regd_init(struct rtw_dev *rtwdev,
|
||||
void (*reg_notifier)(struct wiphy *wiphy,
|
||||
struct regulatory_request *request));
|
||||
void rtw_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request);
|
||||
-void rtw_regd_init_dfs_region(struct rtw_dev *rtwdev,
|
||||
- enum nl80211_dfs_regions curr_region);
|
||||
#endif
|
||||
--- a/rtw8822b.c
|
||||
+++ b/rtw8822b.c
|
||||
@@ -1561,37 +1561,6 @@ static void rtw8822b_bf_config_bfee(struct rtw_dev *rtwdev, struct rtw_vif *vif,
|
||||
rtw_warn(rtwdev, "wrong bfee role\n");
|
||||
}
|
||||
|
||||
-static void rtw8822b_adaptivity_init(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- rtw_phy_set_edcca_th(rtwdev, 0x7f, 0x7f);
|
||||
- /* mac edcca state setting */
|
||||
- rtw_write32_mask(rtwdev, REG_TX_PTCL_CTRL, BIT_DIS_EDCCA, 0);
|
||||
- rtw_write32_mask(rtwdev, REG_RD_CTRL, BIT_EDCCA_MSK_CNTDOWN_EN, 1);
|
||||
-
|
||||
- rtw_write32_mask(rtwdev, REG_EDCCA_SOURCE, BIT_SOURCE_OPTION, 1);
|
||||
- rtw_write32_mask(rtwdev, REG_EDCCA_POW_MA, BIT_MA_LEVEL, 0);
|
||||
- /* edcca decistion opt */
|
||||
- rtw_write32_mask(rtwdev, REG_EDCCA_DECISION, BIT_EDCCA_OPTION, 1);
|
||||
-}
|
||||
-
|
||||
-static void rtw8822b_adaptivity(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw_dm_info *dm_info = &rtwdev->dm_info;
|
||||
- s8 l2h, h2l;
|
||||
- u8 igi;
|
||||
-
|
||||
- igi = dm_info->igi_history[0];
|
||||
- if (dm_info->edcca_mode == RTW_EDCCA_NORMAL) {
|
||||
- l2h = max_t(s8, igi + EDCCA_IGI_L2H_DIFF, EDCCA_TH_L2H_LB);
|
||||
- h2l = l2h - EDCCA_L2H_H2L_DIFF_NORMAL;
|
||||
- } else {
|
||||
- l2h = min_t(s8, igi, dm_info->l2h_th_ini);
|
||||
- h2l = l2h - EDCCA_L2H_H2L_DIFF;
|
||||
- }
|
||||
-
|
||||
- rtw_phy_set_edcca_th(rtwdev, l2h, h2l);
|
||||
-}
|
||||
-
|
||||
static void rtw8822b_fill_txdesc_checksum(struct rtw_dev *rtwdev,
|
||||
struct rtw_tx_pkt_info *pkt_info,
|
||||
u8 *txdesc)
|
||||
@@ -2174,8 +2143,6 @@ static struct rtw_chip_ops rtw8822b_ops = {
|
||||
.config_bfee = rtw8822b_bf_config_bfee,
|
||||
.set_gid_table = rtw_bf_set_gid_table,
|
||||
.cfg_csi_rate = rtw_bf_cfg_csi_rate,
|
||||
- .adaptivity_init = rtw8822b_adaptivity_init,
|
||||
- .adaptivity = rtw8822b_adaptivity,
|
||||
.fill_txdesc_checksum = rtw8822b_fill_txdesc_checksum,
|
||||
|
||||
.coex_set_init = rtw8822b_coex_cfg_init,
|
||||
--- a/rtw8822c.c
|
||||
+++ b/rtw8822c.c
|
||||
@@ -4442,37 +4442,6 @@ static void rtw8822c_pwr_track(struct rtw_dev *rtwdev)
|
||||
dm_info->pwr_trk_triggered = false;
|
||||
}
|
||||
|
||||
-static void rtw8822c_adaptivity_init(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- rtw_phy_set_edcca_th(rtwdev, 0x7f, 0x7f);
|
||||
- /* mac edcca state setting */
|
||||
- rtw_write32_mask(rtwdev, REG_TX_PTCL_CTRL, BIT_DIS_EDCCA, 0);
|
||||
- rtw_write32_mask(rtwdev, REG_RD_CTRL, BIT_EDCCA_MSK_CNTDOWN_EN, 1);
|
||||
- /* edcca decistion opt */
|
||||
- rtw_write32_mask(rtwdev, REG_EDCCA_DECISION, BIT_EDCCA_OPTION, 0);
|
||||
-}
|
||||
-
|
||||
-static void rtw8822c_adaptivity(struct rtw_dev *rtwdev)
|
||||
-{
|
||||
- struct rtw_dm_info *dm_info = &rtwdev->dm_info;
|
||||
- s8 l2h, h2l;
|
||||
- u8 igi;
|
||||
-
|
||||
- igi = dm_info->igi_history[0];
|
||||
- if (dm_info->edcca_mode == RTW_EDCCA_NORMAL) {
|
||||
- l2h = max_t(s8, igi + EDCCA_IGI_L2H_DIFF, EDCCA_TH_L2H_LB);
|
||||
- h2l = l2h - EDCCA_L2H_H2L_DIFF_NORMAL;
|
||||
- } else {
|
||||
- if (igi < dm_info->l2h_th_ini - EDCCA_ADC_BACKOFF)
|
||||
- l2h = igi + EDCCA_ADC_BACKOFF;
|
||||
- else
|
||||
- l2h = dm_info->l2h_th_ini;
|
||||
- h2l = l2h - EDCCA_L2H_H2L_DIFF;
|
||||
- }
|
||||
-
|
||||
- rtw_phy_set_edcca_th(rtwdev, l2h, h2l);
|
||||
-}
|
||||
-
|
||||
static void rtw8822c_fill_txdesc_checksum(struct rtw_dev *rtwdev,
|
||||
struct rtw_tx_pkt_info *pkt_info,
|
||||
u8 *txdesc)
|
||||
@@ -4903,8 +4872,6 @@ static struct rtw_chip_ops rtw8822c_ops = {
|
||||
.cfg_csi_rate = rtw_bf_cfg_csi_rate,
|
||||
.cfo_init = rtw8822c_cfo_init,
|
||||
.cfo_track = rtw8822c_cfo_track,
|
||||
- .adaptivity_init = rtw8822c_adaptivity_init,
|
||||
- .adaptivity = rtw8822c_adaptivity,
|
||||
.fill_txdesc_checksum = rtw8822c_fill_txdesc_checksum,
|
||||
|
||||
.coex_set_init = rtw8822c_coex_cfg_init,
|
124
package/kernel/rtw88-usb/patches/002-drop-rf_lock.patch
Normal file
124
package/kernel/rtw88-usb/patches/002-drop-rf_lock.patch
Normal file
@ -0,0 +1,124 @@
|
||||
From d57ca103e54e2b3eea7e2603548c58bcc4155541 Mon Sep 17 00:00:00 2001
|
||||
From: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Date: Fri, 2 Dec 2022 09:12:16 +0100
|
||||
Subject: [PATCH] wifi: rtw88: Drop rf_lock
|
||||
|
||||
The rtwdev->rf_lock spinlock protects the rf register accesses in
|
||||
rtw_read_rf() and rtw_write_rf(). Most callers of these functions hold
|
||||
rtwdev->mutex already with the exception of the callsites in the debugfs
|
||||
code. The debugfs code doesn't justify an extra lock, so acquire the mutex
|
||||
there as well before calling rf register accessors and drop the now
|
||||
unnecessary spinlock.
|
||||
|
||||
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
---
|
||||
|
||||
--- a/debug.c
|
||||
+++ b/debug.c
|
||||
@@ -144,7 +144,9 @@ static int rtw_debugfs_get_rf_read(struct seq_file *m, void *v)
|
||||
addr = debugfs_priv->rf_addr;
|
||||
mask = debugfs_priv->rf_mask;
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
val = rtw_read_rf(rtwdev, path, addr, mask);
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
seq_printf(m, "rf_read path:%d addr:0x%08x mask:0x%08x val=0x%08x\n",
|
||||
path, addr, mask, val);
|
||||
@@ -418,7 +420,9 @@ static ssize_t rtw_debugfs_set_rf_write(struct file *filp,
|
||||
return count;
|
||||
}
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
rtw_write_rf(rtwdev, path, addr, mask, val);
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
rtw_dbg(rtwdev, RTW_DBG_DEBUGFS,
|
||||
"write_rf path:%d addr:0x%08x mask:0x%08x, val:0x%08x\n",
|
||||
path, addr, mask, val);
|
||||
@@ -523,6 +527,8 @@ static int rtw_debug_get_rf_dump(struct seq_file *m, void *v)
|
||||
u32 addr, offset, data;
|
||||
u8 path;
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
+
|
||||
for (path = 0; path < rtwdev->hal.rf_path_num; path++) {
|
||||
seq_printf(m, "RF path:%d\n", path);
|
||||
for (addr = 0; addr < 0x100; addr += 4) {
|
||||
@@ -537,6 +543,8 @@ static int rtw_debug_get_rf_dump(struct seq_file *m, void *v)
|
||||
seq_puts(m, "\n");
|
||||
}
|
||||
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1027,6 +1035,8 @@ static void dump_gapk_status(struct rtw_dev *rtwdev, struct seq_file *m)
|
||||
dm_info->dm_flags & BIT(RTW_DM_CAP_TXGAPK) ? '-' : '+',
|
||||
rtw_dm_cap_strs[RTW_DM_CAP_TXGAPK]);
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
+
|
||||
for (path = 0; path < rtwdev->hal.rf_path_num; path++) {
|
||||
val = rtw_read_rf(rtwdev, path, RF_GAINTX, RFREG_MASK);
|
||||
seq_printf(m, "path %d:\n0x%x = 0x%x\n", path, RF_GAINTX, val);
|
||||
@@ -1036,6 +1046,7 @@ static void dump_gapk_status(struct rtw_dev *rtwdev, struct seq_file *m)
|
||||
txgapk->rf3f_fs[path][i], i);
|
||||
seq_puts(m, "\n");
|
||||
}
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
static int rtw_debugfs_get_dm_cap(struct seq_file *m, void *v)
|
||||
--- a/hci.h
|
||||
+++ b/hci.h
|
||||
@@ -166,12 +166,11 @@ static inline u32
|
||||
rtw_read_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
|
||||
u32 addr, u32 mask)
|
||||
{
|
||||
- unsigned long flags;
|
||||
u32 val;
|
||||
|
||||
- spin_lock_irqsave(&rtwdev->rf_lock, flags);
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
+
|
||||
val = rtwdev->chip->ops->read_rf(rtwdev, rf_path, addr, mask);
|
||||
- spin_unlock_irqrestore(&rtwdev->rf_lock, flags);
|
||||
|
||||
return val;
|
||||
}
|
||||
@@ -180,11 +179,9 @@ static inline void
|
||||
rtw_write_rf(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
|
||||
u32 addr, u32 mask, u32 data)
|
||||
{
|
||||
- unsigned long flags;
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
|
||||
- spin_lock_irqsave(&rtwdev->rf_lock, flags);
|
||||
rtwdev->chip->ops->write_rf(rtwdev, rf_path, addr, mask, data);
|
||||
- spin_unlock_irqrestore(&rtwdev->rf_lock, flags);
|
||||
}
|
||||
|
||||
static inline u32
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -1994,7 +1994,6 @@ int rtw_core_init(struct rtw_dev *rtwdev)
|
||||
skb_queue_head_init(&rtwdev->coex.queue);
|
||||
skb_queue_head_init(&rtwdev->tx_report.queue);
|
||||
|
||||
- spin_lock_init(&rtwdev->rf_lock);
|
||||
spin_lock_init(&rtwdev->h2c.lock);
|
||||
spin_lock_init(&rtwdev->txq_lock);
|
||||
spin_lock_init(&rtwdev->tx_report.q_lock);
|
||||
--- a/main.h
|
||||
+++ b/main.h
|
||||
@@ -1994,9 +1994,6 @@ struct rtw_dev {
|
||||
/* ensures exclusive access from mac80211 callbacks */
|
||||
struct mutex mutex;
|
||||
|
||||
- /* read/write rf register */
|
||||
- spinlock_t rf_lock;
|
||||
-
|
||||
/* watch dog every 2 sec */
|
||||
struct delayed_work watch_dog_work;
|
||||
u32 watch_dog_cnt;
|
103
package/kernel/rtw88-usb/patches/003-drop-h2c-lock.patch
Normal file
103
package/kernel/rtw88-usb/patches/003-drop-h2c-lock.patch
Normal file
@ -0,0 +1,103 @@
|
||||
From 1e2701f4079a7906ff3fb43a315925d303e289d8 Mon Sep 17 00:00:00 2001
|
||||
From: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Date: Fri, 2 Dec 2022 09:12:17 +0100
|
||||
Subject: [PATCH] wifi: rtw88: Drop h2c.lock
|
||||
|
||||
The h2c.lock spinlock is used in rtw_fw_send_h2c_command() and
|
||||
rtw_fw_send_h2c_packet(). Most callers call this with rtwdev->mutex
|
||||
held, except from one callsite in the debugfs code. The debugfs code
|
||||
alone doesn't justify the extra lock, so acquire rtwdev->mutex in
|
||||
debugfs and drop the now unnecessary spinlock.
|
||||
|
||||
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
---
|
||||
|
||||
--- a/debug.c
|
||||
+++ b/debug.c
|
||||
@@ -396,7 +396,9 @@ static ssize_t rtw_debugfs_set_h2c(struct file *filp,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
rtw_fw_h2c_cmd_dbg(rtwdev, param);
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
return count;
|
||||
}
|
||||
--- a/fw.c
|
||||
+++ b/fw.c
|
||||
@@ -320,7 +320,7 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev,
|
||||
h2c[3], h2c[2], h2c[1], h2c[0],
|
||||
h2c[7], h2c[6], h2c[5], h2c[4]);
|
||||
|
||||
- spin_lock(&rtwdev->h2c.lock);
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
|
||||
box = rtwdev->h2c.last_box_num;
|
||||
switch (box) {
|
||||
@@ -342,7 +342,7 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev,
|
||||
break;
|
||||
default:
|
||||
WARN(1, "invalid h2c mail box number\n");
|
||||
- goto out;
|
||||
+ return;
|
||||
}
|
||||
|
||||
ret = read_poll_timeout_atomic(rtw_read8, box_state,
|
||||
@@ -351,7 +351,7 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev,
|
||||
|
||||
if (ret) {
|
||||
rtw_err(rtwdev, "failed to send h2c command\n");
|
||||
- goto out;
|
||||
+ return;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < 4; idx++)
|
||||
@@ -361,9 +361,6 @@ static void rtw_fw_send_h2c_command(struct rtw_dev *rtwdev,
|
||||
|
||||
if (++rtwdev->h2c.last_box_num >= 4)
|
||||
rtwdev->h2c.last_box_num = 0;
|
||||
-
|
||||
-out:
|
||||
- spin_unlock(&rtwdev->h2c.lock);
|
||||
}
|
||||
|
||||
void rtw_fw_h2c_cmd_dbg(struct rtw_dev *rtwdev, u8 *h2c)
|
||||
@@ -375,15 +372,13 @@ static void rtw_fw_send_h2c_packet(struct rtw_dev *rtwdev, u8 *h2c_pkt)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- spin_lock(&rtwdev->h2c.lock);
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
|
||||
FW_OFFLOAD_H2C_SET_SEQ_NUM(h2c_pkt, rtwdev->h2c.seq);
|
||||
ret = rtw_hci_write_data_h2c(rtwdev, h2c_pkt, H2C_PKT_SIZE);
|
||||
if (ret)
|
||||
rtw_err(rtwdev, "failed to send h2c packet\n");
|
||||
rtwdev->h2c.seq++;
|
||||
-
|
||||
- spin_unlock(&rtwdev->h2c.lock);
|
||||
}
|
||||
|
||||
void
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -1994,7 +1994,6 @@ int rtw_core_init(struct rtw_dev *rtwdev)
|
||||
skb_queue_head_init(&rtwdev->coex.queue);
|
||||
skb_queue_head_init(&rtwdev->tx_report.queue);
|
||||
|
||||
- spin_lock_init(&rtwdev->h2c.lock);
|
||||
spin_lock_init(&rtwdev->txq_lock);
|
||||
spin_lock_init(&rtwdev->tx_report.q_lock);
|
||||
|
||||
--- a/main.h
|
||||
+++ b/main.h
|
||||
@@ -2018,8 +2018,6 @@ struct rtw_dev {
|
||||
struct {
|
||||
/* incicate the mail box to use with fw */
|
||||
u8 last_box_num;
|
||||
- /* protect to send h2c to fw */
|
||||
- spinlock_t lock;
|
||||
u32 seq;
|
||||
} h2c;
|
||||
|
74
package/kernel/rtw88-usb/patches/004-drop-coex-mutex.patch
Normal file
74
package/kernel/rtw88-usb/patches/004-drop-coex-mutex.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From 8647f7f0b9080bc2d2f6e02524782f2f02f159bc Mon Sep 17 00:00:00 2001
|
||||
From: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Date: Fri, 2 Dec 2022 09:12:18 +0100
|
||||
Subject: [PATCH] wifi: rtw88: Drop coex mutex
|
||||
|
||||
coex->mutex is used in rtw_coex_info_request() only. Most callers of this
|
||||
function hold rtwdev->mutex already, except for one callsite in the
|
||||
debugfs code. The debugfs code alone doesn't justify the extra lock, so
|
||||
acquire rtwdev->mutex there as well and drop the now unnecessary
|
||||
spinlock.
|
||||
|
||||
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
---
|
||||
|
||||
--- a/coex.c
|
||||
+++ b/coex.c
|
||||
@@ -633,7 +633,7 @@ static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev,
|
||||
struct rtw_coex *coex = &rtwdev->coex;
|
||||
struct sk_buff *skb_resp = NULL;
|
||||
|
||||
- mutex_lock(&coex->mutex);
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
|
||||
rtw_fw_query_bt_mp_info(rtwdev, req);
|
||||
|
||||
@@ -650,7 +650,6 @@ static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev,
|
||||
}
|
||||
|
||||
out:
|
||||
- mutex_unlock(&coex->mutex);
|
||||
return skb_resp;
|
||||
}
|
||||
|
||||
--- a/debug.c
|
||||
+++ b/debug.c
|
||||
@@ -842,7 +842,9 @@ static int rtw_debugfs_get_coex_info(struct seq_file *m, void *v)
|
||||
struct rtw_debugfs_priv *debugfs_priv = m->private;
|
||||
struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
|
||||
|
||||
+ mutex_lock(&rtwdev->mutex);
|
||||
rtw_coex_display_coex_info(rtwdev, m);
|
||||
+ mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -1998,7 +1998,6 @@ int rtw_core_init(struct rtw_dev *rtwdev)
|
||||
spin_lock_init(&rtwdev->tx_report.q_lock);
|
||||
|
||||
mutex_init(&rtwdev->mutex);
|
||||
- mutex_init(&rtwdev->coex.mutex);
|
||||
mutex_init(&rtwdev->hal.tx_power_mutex);
|
||||
|
||||
init_waitqueue_head(&rtwdev->coex.wait);
|
||||
@@ -2066,7 +2065,6 @@ void rtw_core_deinit(struct rtw_dev *rtwdev)
|
||||
}
|
||||
|
||||
mutex_destroy(&rtwdev->mutex);
|
||||
- mutex_destroy(&rtwdev->coex.mutex);
|
||||
mutex_destroy(&rtwdev->hal.tx_power_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_core_deinit);
|
||||
--- a/main.h
|
||||
+++ b/main.h
|
||||
@@ -1507,8 +1507,6 @@ struct rtw_coex_stat {
|
||||
};
|
||||
|
||||
struct rtw_coex {
|
||||
- /* protects coex info request section */
|
||||
- struct mutex mutex;
|
||||
struct sk_buff_head queue;
|
||||
wait_queue_head_t wait;
|
||||
|
@ -0,0 +1,196 @@
|
||||
From 78d5bf925f30bf9f79a69ce77386902672defe68 Mon Sep 17 00:00:00 2001
|
||||
From: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Date: Fri, 2 Dec 2022 09:12:19 +0100
|
||||
Subject: [PATCH] wifi: rtw88: iterate over vif/sta list non-atomically
|
||||
|
||||
The driver uses ieee80211_iterate_active_interfaces_atomic()
|
||||
and ieee80211_iterate_stations_atomic() in several places and does
|
||||
register accesses in the iterators. This doesn't cope with upcoming
|
||||
USB support as registers can only be accessed non-atomically.
|
||||
|
||||
Split these into a two stage process: First use the atomic iterator
|
||||
functions to collect all active interfaces or stations on a list, then
|
||||
iterate over the list non-atomically and call the iterator on each
|
||||
entry.
|
||||
|
||||
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Suggested-by: Ping-Ke shih <pkshih@realtek.com>
|
||||
---
|
||||
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -300,7 +300,7 @@ static void rtw_phy_stat_rssi(struct rtw_dev *rtwdev)
|
||||
|
||||
data.rtwdev = rtwdev;
|
||||
data.min_rssi = U8_MAX;
|
||||
- rtw_iterate_stas_atomic(rtwdev, rtw_phy_stat_rssi_iter, &data);
|
||||
+ rtw_iterate_stas(rtwdev, rtw_phy_stat_rssi_iter, &data);
|
||||
|
||||
dm_info->pre_min_rssi = dm_info->min_rssi;
|
||||
dm_info->min_rssi = data.min_rssi;
|
||||
@@ -544,7 +544,7 @@ static void rtw_phy_ra_info_update(struct rtw_dev *rtwdev)
|
||||
if (rtwdev->watch_dog_cnt & 0x3)
|
||||
return;
|
||||
|
||||
- rtw_iterate_stas_atomic(rtwdev, rtw_phy_ra_info_update_iter, rtwdev);
|
||||
+ rtw_iterate_stas(rtwdev, rtw_phy_ra_info_update_iter, rtwdev);
|
||||
}
|
||||
|
||||
static u32 rtw_phy_get_rrsr_mask(struct rtw_dev *rtwdev, u8 rate_idx)
|
||||
@@ -597,7 +597,7 @@ static void rtw_phy_rrsr_update(struct rtw_dev *rtwdev)
|
||||
struct rtw_dm_info *dm_info = &rtwdev->dm_info;
|
||||
|
||||
dm_info->rrsr_mask_min = RRSR_RATE_ORDER_MAX;
|
||||
- rtw_iterate_stas_atomic(rtwdev, rtw_phy_rrsr_mask_min_iter, rtwdev);
|
||||
+ rtw_iterate_stas(rtwdev, rtw_phy_rrsr_mask_min_iter, rtwdev);
|
||||
rtw_write32(rtwdev, REG_RRSR, dm_info->rrsr_val_init & dm_info->rrsr_mask_min);
|
||||
}
|
||||
|
||||
--- a/ps.c
|
||||
+++ b/ps.c
|
||||
@@ -58,7 +58,7 @@ int rtw_leave_ips(struct rtw_dev *rtwdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- rtw_iterate_vifs_atomic(rtwdev, rtw_restore_port_cfg_iter, rtwdev);
|
||||
+ rtw_iterate_vifs(rtwdev, rtw_restore_port_cfg_iter, rtwdev);
|
||||
|
||||
rtw_coex_ips_notify(rtwdev, COEX_IPS_LEAVE);
|
||||
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -105,3 +105,106 @@ void rtw_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss)
|
||||
*mcs = rate - DESC_RATEMCS0;
|
||||
}
|
||||
}
|
||||
+
|
||||
+struct rtw_stas_entry {
|
||||
+ struct list_head list;
|
||||
+ struct ieee80211_sta *sta;
|
||||
+};
|
||||
+
|
||||
+struct rtw_iter_stas_data {
|
||||
+ struct rtw_dev *rtwdev;
|
||||
+ struct list_head list;
|
||||
+};
|
||||
+
|
||||
+static void rtw_collect_sta_iter(void *data, struct ieee80211_sta *sta)
|
||||
+{
|
||||
+ struct rtw_iter_stas_data *iter_stas = data;
|
||||
+ struct rtw_stas_entry *stas_entry;
|
||||
+
|
||||
+ stas_entry = kmalloc(sizeof(*stas_entry), GFP_ATOMIC);
|
||||
+ if (!stas_entry)
|
||||
+ return;
|
||||
+
|
||||
+ stas_entry->sta = sta;
|
||||
+ list_add_tail(&stas_entry->list, &iter_stas->list);
|
||||
+}
|
||||
+
|
||||
+void rtw_iterate_stas(struct rtw_dev *rtwdev,
|
||||
+ void (*iterator)(void *data,
|
||||
+ struct ieee80211_sta *sta),
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct rtw_iter_stas_data iter_data;
|
||||
+ struct rtw_stas_entry *sta_entry, *tmp;
|
||||
+
|
||||
+ /* &rtwdev->mutex makes sure no stations can be removed between
|
||||
+ * collecting the stations and iterating over them.
|
||||
+ */
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
+
|
||||
+ iter_data.rtwdev = rtwdev;
|
||||
+ INIT_LIST_HEAD(&iter_data.list);
|
||||
+
|
||||
+ ieee80211_iterate_stations_atomic(rtwdev->hw, rtw_collect_sta_iter,
|
||||
+ &iter_data);
|
||||
+
|
||||
+ list_for_each_entry_safe(sta_entry, tmp, &iter_data.list,
|
||||
+ list) {
|
||||
+ list_del_init(&sta_entry->list);
|
||||
+ iterator(data, sta_entry->sta);
|
||||
+ kfree(sta_entry);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+struct rtw_vifs_entry {
|
||||
+ struct list_head list;
|
||||
+ struct ieee80211_vif *vif;
|
||||
+ u8 mac[ETH_ALEN];
|
||||
+};
|
||||
+
|
||||
+struct rtw_iter_vifs_data {
|
||||
+ struct rtw_dev *rtwdev;
|
||||
+ struct list_head list;
|
||||
+};
|
||||
+
|
||||
+void rtw_collect_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
|
||||
+{
|
||||
+ struct rtw_iter_vifs_data *iter_stas = data;
|
||||
+ struct rtw_vifs_entry *vifs_entry;
|
||||
+
|
||||
+ vifs_entry = kmalloc(sizeof(*vifs_entry), GFP_ATOMIC);
|
||||
+ if (!vifs_entry)
|
||||
+ return;
|
||||
+
|
||||
+ vifs_entry->vif = vif;
|
||||
+ ether_addr_copy(vifs_entry->mac, mac);
|
||||
+ list_add_tail(&vifs_entry->list, &iter_stas->list);
|
||||
+}
|
||||
+
|
||||
+void rtw_iterate_vifs(struct rtw_dev *rtwdev,
|
||||
+ void (*iterator)(void *data, u8 *mac,
|
||||
+ struct ieee80211_vif *vif),
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct rtw_iter_vifs_data iter_data;
|
||||
+ struct rtw_vifs_entry *vif_entry, *tmp;
|
||||
+
|
||||
+ /* &rtwdev->mutex makes sure no interfaces can be removed between
|
||||
+ * collecting the interfaces and iterating over them.
|
||||
+ */
|
||||
+ lockdep_assert_held(&rtwdev->mutex);
|
||||
+
|
||||
+ iter_data.rtwdev = rtwdev;
|
||||
+ INIT_LIST_HEAD(&iter_data.list);
|
||||
+
|
||||
+ ieee80211_iterate_active_interfaces_atomic(rtwdev->hw,
|
||||
+ IEEE80211_IFACE_ITER_NORMAL,
|
||||
+ rtw_collect_vif_iter, &iter_data);
|
||||
+
|
||||
+ list_for_each_entry_safe(vif_entry, tmp, &iter_data.list,
|
||||
+ list) {
|
||||
+ list_del_init(&vif_entry->list);
|
||||
+ iterator(data, vif_entry->mac, vif_entry->vif);
|
||||
+ kfree(vif_entry);
|
||||
+ }
|
||||
+}
|
||||
--- a/util.h
|
||||
+++ b/util.h
|
||||
@@ -7,9 +7,6 @@
|
||||
|
||||
struct rtw_dev;
|
||||
|
||||
-#define rtw_iterate_vifs(rtwdev, iterator, data) \
|
||||
- ieee80211_iterate_active_interfaces(rtwdev->hw, \
|
||||
- IEEE80211_IFACE_ITER_NORMAL, iterator, data)
|
||||
#define rtw_iterate_vifs_atomic(rtwdev, iterator, data) \
|
||||
ieee80211_iterate_active_interfaces_atomic(rtwdev->hw, \
|
||||
IEEE80211_IFACE_ITER_NORMAL, iterator, data)
|
||||
@@ -20,6 +17,15 @@ struct rtw_dev;
|
||||
#define rtw_iterate_keys_rcu(rtwdev, vif, iterator, data) \
|
||||
ieee80211_iter_keys_rcu((rtwdev)->hw, vif, iterator, data)
|
||||
|
||||
+void rtw_iterate_vifs(struct rtw_dev *rtwdev,
|
||||
+ void (*iterator)(void *data, u8 *mac,
|
||||
+ struct ieee80211_vif *vif),
|
||||
+ void *data);
|
||||
+void rtw_iterate_stas(struct rtw_dev *rtwdev,
|
||||
+ void (*iterator)(void *data,
|
||||
+ struct ieee80211_sta *sta),
|
||||
+ void *data);
|
||||
+
|
||||
static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr)
|
||||
{
|
||||
__le16 fc = hdr->frame_control;
|
25
package/kernel/rtw88-usb/patches/100-update-makefile.patch
Normal file
25
package/kernel/rtw88-usb/patches/100-update-makefile.patch
Normal file
@ -0,0 +1,25 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -2,22 +2,6 @@
|
||||
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
|
||||
PWD := $(shell pwd)
|
||||
|
||||
-CONFIG_RTW88_CORE=m
|
||||
-CONFIG_RTW88_PCI=m
|
||||
-CONFIG_RTW88_USB=m
|
||||
-CONFIG_RTW88_8822BE=m
|
||||
-CONFIG_RTW88_8822BU=m
|
||||
-CONFIG_RTW88_8822B=m
|
||||
-CONFIG_RTW88_8821CE=m
|
||||
-CONFIG_RTW88_8821CU=m
|
||||
-CONFIG_RTW88_8821C=m
|
||||
-CONFIG_RTW88_8822CE=m
|
||||
-CONFIG_RTW88_8822CU=m
|
||||
-CONFIG_RTW88_8822C=m
|
||||
-CONFIG_RTW88_8723DE=m
|
||||
-CONFIG_RTW88_8723DU=m
|
||||
-CONFIG_RTW88_8723D=m
|
||||
-
|
||||
ifneq ($(CONFIG_RTW88_8822BE),m)
|
||||
ccflags-y += -DCONFIG_RTW88_8822BE=y
|
||||
endif
|
14
package/kernel/rtw88-usb/patches/101-wireless-5.14.patch
Normal file
14
package/kernel/rtw88-usb/patches/101-wireless-5.14.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/mac80211.c
|
||||
+++ b/mac80211.c
|
||||
@@ -614,7 +614,11 @@ static void rtw_ops_sw_scan_complete(struct ieee80211_hw *hw,
|
||||
|
||||
static void rtw_ops_mgd_prepare_tx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0))
|
||||
+ struct ieee80211_prep_tx_info *info)
|
||||
+#else
|
||||
u16 duration)
|
||||
+#endif
|
||||
{
|
||||
struct rtw_dev *rtwdev = hw->priv;
|
||||
|
34
package/kernel/ubnt-ledbar/Makefile
Normal file
34
package/kernel/ubnt-ledbar/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Copyright (C) 2008-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ubnt-ledbar
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/leds-ubnt-ledbar
|
||||
SUBMENU:=LED modules
|
||||
TITLE:=Ubiquiti UniFi 6 LR LED support
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/leds-ubnt-ledbar.ko
|
||||
AUTOLOAD:=$(call AutoProbe,leds-ubnt-ledbar,1)
|
||||
DEPENDS:=+kmod-i2c-core
|
||||
endef
|
||||
|
||||
define KernelPackage/leds-ubnt-ledbar/description
|
||||
LED support for some Ubiquiti UniFi access points.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,leds-ubnt-ledbar))
|
1
package/kernel/ubnt-ledbar/src/Makefile
Normal file
1
package/kernel/ubnt-ledbar/src/Makefile
Normal file
@ -0,0 +1 @@
|
||||
obj-m := leds-ubnt-ledbar.o
|
255
package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c
Normal file
255
package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c
Normal file
@ -0,0 +1,255 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
|
||||
/**
|
||||
* Driver for the Ubiquiti RGB LED controller (LEDBAR).
|
||||
* This Controller is based on a Holtek HT32F52241 and connected
|
||||
* via I2C.
|
||||
*
|
||||
* - The Controller needs an enable signal set to high when
|
||||
* performing a transaction. On the U6-LR, this is located
|
||||
* at Pin 18 (R6902)
|
||||
*
|
||||
* - The Pin is also printed when calling the "usetled" function
|
||||
* contained in the ubntapp bootloader application.
|
||||
*/
|
||||
|
||||
#define UBNT_LEDBAR_MAX_BRIGHTNESS 0xff
|
||||
|
||||
#define UBNT_LEDBAR_TRANSACTION_LENGTH 8
|
||||
#define UBNT_LEDBAR_TRANSACTION_SUCCESS (char) 0xaa
|
||||
|
||||
#define UBNT_LEDBAR_TRANSACTION_BLUE_IDX 2
|
||||
#define UBNT_LEDBAR_TRANSACTION_GREEN_IDX 3
|
||||
#define UBNT_LEDBAR_TRANSACTION_RED_IDX 4
|
||||
#define UBNT_LEDBAR_TRANSACTION_LED_COUNT_IDX 6
|
||||
|
||||
struct ubnt_ledbar {
|
||||
struct mutex lock;
|
||||
u32 led_count;
|
||||
struct i2c_client *client;
|
||||
struct led_classdev led_red;
|
||||
struct led_classdev led_green;
|
||||
struct led_classdev led_blue;
|
||||
struct gpio_desc *enable_gpio;
|
||||
struct gpio_desc *reset_gpio;
|
||||
};
|
||||
|
||||
static void ubnt_ledbar_perform_transaction(struct ubnt_ledbar *ledbar,
|
||||
const char *transaction, int len,
|
||||
char *result, int result_len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
i2c_smbus_write_byte(ledbar->client, transaction[i]);
|
||||
|
||||
for (i = 0; i < result_len; i++)
|
||||
result[i] = i2c_smbus_read_byte(ledbar->client);
|
||||
}
|
||||
|
||||
static int ubnt_ledbar_apply_state(struct ubnt_ledbar *ledbar)
|
||||
{
|
||||
char setup_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x11};
|
||||
char led_msg[UBNT_LEDBAR_TRANSACTION_LENGTH] = {0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
char i2c_response;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ledbar->lock);
|
||||
|
||||
led_msg[UBNT_LEDBAR_TRANSACTION_BLUE_IDX] = ledbar->led_blue.brightness;
|
||||
led_msg[UBNT_LEDBAR_TRANSACTION_GREEN_IDX] = ledbar->led_green.brightness;
|
||||
led_msg[UBNT_LEDBAR_TRANSACTION_RED_IDX] = ledbar->led_red.brightness;
|
||||
led_msg[UBNT_LEDBAR_TRANSACTION_LED_COUNT_IDX] = ledbar->led_count;
|
||||
|
||||
gpiod_set_value(ledbar->enable_gpio, 1);
|
||||
|
||||
msleep(10);
|
||||
|
||||
ubnt_ledbar_perform_transaction(ledbar, setup_msg, sizeof(setup_msg), &i2c_response, sizeof(i2c_response));
|
||||
if (i2c_response != UBNT_LEDBAR_TRANSACTION_SUCCESS) {
|
||||
dev_err(&ledbar->client->dev, "Error initializing LED transaction: %02hhx\n", i2c_response);
|
||||
ret = -EINVAL;
|
||||
goto out_gpio;
|
||||
}
|
||||
|
||||
ubnt_ledbar_perform_transaction(ledbar, led_msg, sizeof(led_msg), &i2c_response, sizeof(i2c_response));
|
||||
if (i2c_response != UBNT_LEDBAR_TRANSACTION_SUCCESS) {
|
||||
dev_err(&ledbar->client->dev, "Failed LED transaction: %02hhx\n", i2c_response);
|
||||
ret = -EINVAL;
|
||||
goto out_gpio;
|
||||
}
|
||||
|
||||
msleep(10);
|
||||
out_gpio:
|
||||
gpiod_set_value(ledbar->enable_gpio, 0);
|
||||
|
||||
mutex_unlock(&ledbar->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ubnt_ledbar_reset(struct ubnt_ledbar *ledbar)
|
||||
{
|
||||
static const char init_msg[16] = {0x02, 0x81, 0xfd, 0x7e,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
char init_response[4];
|
||||
|
||||
if (!ledbar->reset_gpio)
|
||||
return;
|
||||
|
||||
mutex_lock(&ledbar->lock);
|
||||
|
||||
gpiod_set_value(ledbar->reset_gpio, 1);
|
||||
msleep(10);
|
||||
gpiod_set_value(ledbar->reset_gpio, 0);
|
||||
|
||||
msleep(10);
|
||||
|
||||
gpiod_set_value(ledbar->enable_gpio, 1);
|
||||
msleep(10);
|
||||
ubnt_ledbar_perform_transaction(ledbar, init_msg, sizeof(init_msg), init_response, sizeof(init_response));
|
||||
msleep(10);
|
||||
gpiod_set_value(ledbar->enable_gpio, 0);
|
||||
|
||||
mutex_unlock(&ledbar->lock);
|
||||
}
|
||||
|
||||
#define UBNT_LEDBAR_CONTROL_RGBS(name) \
|
||||
static int ubnt_ledbar_set_##name##_brightness(struct led_classdev *led_cdev,\
|
||||
enum led_brightness value) \
|
||||
{ \
|
||||
struct ubnt_ledbar *ledbar = \
|
||||
container_of(led_cdev, struct ubnt_ledbar, led_##name); \
|
||||
int ret; \
|
||||
led_cdev->brightness = value; \
|
||||
ret = ubnt_ledbar_apply_state(ledbar); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
UBNT_LEDBAR_CONTROL_RGBS(red);
|
||||
UBNT_LEDBAR_CONTROL_RGBS(green);
|
||||
UBNT_LEDBAR_CONTROL_RGBS(blue);
|
||||
|
||||
|
||||
static int ubnt_ledbar_init_led(struct device_node *np, struct ubnt_ledbar *ledbar,
|
||||
struct led_classdev *led_cdev)
|
||||
{
|
||||
struct led_init_data init_data = {};
|
||||
int ret;
|
||||
|
||||
if (!np)
|
||||
return 0;
|
||||
|
||||
init_data.fwnode = of_fwnode_handle(np);
|
||||
|
||||
led_cdev->max_brightness = UBNT_LEDBAR_MAX_BRIGHTNESS;
|
||||
|
||||
ret = devm_led_classdev_register_ext(&ledbar->client->dev, led_cdev,
|
||||
&init_data);
|
||||
if (ret)
|
||||
dev_err(&ledbar->client->dev, "led register err: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int ubnt_ledbar_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct device_node *np = client->dev.of_node;
|
||||
struct ubnt_ledbar *ledbar;
|
||||
int ret;
|
||||
|
||||
ledbar = devm_kzalloc(&client->dev, sizeof(*ledbar), GFP_KERNEL);
|
||||
if (!ledbar)
|
||||
return -ENOMEM;
|
||||
|
||||
ledbar->enable_gpio = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
|
||||
|
||||
if (IS_ERR(ledbar->enable_gpio)) {
|
||||
ret = PTR_ERR(ledbar->enable_gpio);
|
||||
dev_err(&client->dev, "Failed to get enable gpio: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ledbar->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
|
||||
|
||||
if (IS_ERR(ledbar->reset_gpio)) {
|
||||
ret = PTR_ERR(ledbar->reset_gpio);
|
||||
dev_err(&client->dev, "Failed to get reset gpio: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ledbar->led_count = 1;
|
||||
of_property_read_u32(np, "led-count", &ledbar->led_count);
|
||||
|
||||
ledbar->client = client;
|
||||
|
||||
mutex_init(&ledbar->lock);
|
||||
|
||||
i2c_set_clientdata(client, ledbar);
|
||||
|
||||
// Reset and initialize the MCU
|
||||
ubnt_ledbar_reset(ledbar);
|
||||
|
||||
ledbar->led_red.brightness_set_blocking = ubnt_ledbar_set_red_brightness;
|
||||
ubnt_ledbar_init_led(of_get_child_by_name(np, "red"), ledbar, &ledbar->led_red);
|
||||
|
||||
ledbar->led_green.brightness_set_blocking = ubnt_ledbar_set_green_brightness;
|
||||
ubnt_ledbar_init_led(of_get_child_by_name(np, "green"), ledbar, &ledbar->led_green);
|
||||
|
||||
ledbar->led_blue.brightness_set_blocking = ubnt_ledbar_set_blue_brightness;
|
||||
ubnt_ledbar_init_led(of_get_child_by_name(np, "blue"), ledbar, &ledbar->led_blue);
|
||||
|
||||
return ubnt_ledbar_apply_state(ledbar);
|
||||
}
|
||||
|
||||
static int ubnt_ledbar_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ubnt_ledbar *ledbar = i2c_get_clientdata(client);
|
||||
|
||||
mutex_destroy(&ledbar->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ubnt_ledbar_id[] = {
|
||||
{ "ubnt-ledbar", 0 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ubnt_ledbar_id);
|
||||
|
||||
static const struct of_device_id of_ubnt_ledbar_match[] = {
|
||||
{ .compatible = "ubnt,ledbar", },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_ubnt_ledbar_match);
|
||||
|
||||
static struct i2c_driver ubnt_ledbar_driver = {
|
||||
.driver = {
|
||||
.name = "ubnt-ledbar",
|
||||
.of_match_table = of_ubnt_ledbar_match,
|
||||
},
|
||||
.probe = ubnt_ledbar_probe,
|
||||
.remove = ubnt_ledbar_remove,
|
||||
.id_table = ubnt_ledbar_id,
|
||||
};
|
||||
module_i2c_driver(ubnt_ledbar_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Ubiquiti LEDBAR driver");
|
||||
MODULE_AUTHOR("David Bauer <mail@david-bauer.net>");
|
||||
MODULE_LICENSE("GPL v2");
|
32
package/kernel/xr-usb-serial/Makefile
Normal file
32
package/kernel/xr-usb-serial/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright (C) Chen Yijun
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=xr-usb-serial
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/$(PKG_NAME)
|
||||
SUBMENU:=USB Support
|
||||
DEPENDS:=@GPIO_SUPPORT +kmod-usb-serial +kmod-usb2
|
||||
TITLE:=Driver for XR21V141x (used in HUAWEI UPS)
|
||||
AUTOLOAD:=$(call AutoLoad,30,xr_usb_serial_common,1)
|
||||
FILES:=$(PKG_BUILD_DIR)/xr_usb_serial_common.ko
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,$(PKG_NAME)))
|
10
package/kernel/xr-usb-serial/src/Makefile
Normal file
10
package/kernel/xr-usb-serial/src/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright (C) Chen Yijun
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
obj-m := xr_usb_serial_common.o
|
||||
|
||||
EXTRA_CFLAGS := -DDEBUG=0
|
2086
package/kernel/xr-usb-serial/src/xr_usb_serial_common.c
Normal file
2086
package/kernel/xr-usb-serial/src/xr_usb_serial_common.c
Normal file
File diff suppressed because it is too large
Load Diff
197
package/kernel/xr-usb-serial/src/xr_usb_serial_common.h
Normal file
197
package/kernel/xr-usb-serial/src/xr_usb_serial_common.h
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* CMSPAR, some architectures can't have space and mark parity.
|
||||
*/
|
||||
|
||||
#ifndef CMSPAR
|
||||
#define CMSPAR 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Major and minor numbers.
|
||||
*/
|
||||
|
||||
#define XR_USB_SERIAL_TTY_MAJOR 266
|
||||
#define XR_USB_SERIAL_TTY_MINORS 32
|
||||
|
||||
/*
|
||||
* Requests.
|
||||
*/
|
||||
|
||||
#define USB_RT_XR_USB_SERIAL (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
|
||||
|
||||
/*
|
||||
* Output control lines.
|
||||
*/
|
||||
|
||||
#define XR_USB_SERIAL_CTRL_DTR 0x01
|
||||
#define XR_USB_SERIAL_CTRL_RTS 0x02
|
||||
|
||||
/*
|
||||
* Input control lines and line errors.
|
||||
*/
|
||||
|
||||
#define XR_USB_SERIAL_CTRL_DCD 0x01
|
||||
#define XR_USB_SERIAL_CTRL_DSR 0x02
|
||||
#define XR_USB_SERIAL_CTRL_BRK 0x04
|
||||
#define XR_USB_SERIAL_CTRL_RI 0x08
|
||||
|
||||
#define XR_USB_SERIAL_CTRL_FRAMING 0x10
|
||||
#define XR_USB_SERIAL_CTRL_PARITY 0x20
|
||||
#define XR_USB_SERIAL_CTRL_OVERRUN 0x40
|
||||
|
||||
/*
|
||||
* Internal driver structures.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The only reason to have several buffers is to accommodate assumptions
|
||||
* in line disciplines. They ask for empty space amount, receive our URB size,
|
||||
* and proceed to issue several 1-character writes, assuming they will fit.
|
||||
* The very first write takes a complete URB. Fortunately, this only happens
|
||||
* when processing onlcr, so we only need 2 buffers. These values must be
|
||||
* powers of 2.
|
||||
*/
|
||||
#define XR_USB_SERIAL_NW 16
|
||||
#define XR_USB_SERIAL_NR 16
|
||||
|
||||
#define RAMCTL_BUFFER_PARITY 0x1
|
||||
#define RAMCTL_BUFFER_BREAK 0x2
|
||||
#define RAMCTL_BUFFER_FRAME 0x4
|
||||
#define RAMCTL_BUFFER_OVERRUN 0x8
|
||||
|
||||
struct xr_usb_serial_wb {
|
||||
unsigned char *buf;
|
||||
dma_addr_t dmah;
|
||||
int len;
|
||||
int use;
|
||||
struct urb *urb;
|
||||
struct xr_usb_serial *instance;
|
||||
};
|
||||
|
||||
struct xr_usb_serial_rb {
|
||||
int size;
|
||||
unsigned char *base;
|
||||
dma_addr_t dma;
|
||||
int index;
|
||||
struct xr_usb_serial *instance;
|
||||
};
|
||||
|
||||
struct reg_addr_map {
|
||||
unsigned int uart_enable_addr;
|
||||
unsigned int uart_format_addr;
|
||||
unsigned int uart_flow_addr;
|
||||
unsigned int uart_loopback_addr;
|
||||
unsigned int uart_xon_char_addr;
|
||||
unsigned int uart_xoff_char_addr;
|
||||
unsigned int uart_gpio_mode_addr;
|
||||
unsigned int uart_gpio_dir_addr;
|
||||
unsigned int uart_gpio_set_addr;
|
||||
unsigned int uart_gpio_clr_addr;
|
||||
unsigned int uart_gpio_status_addr;
|
||||
unsigned int tx_break_addr;
|
||||
unsigned int uart_custom_driver;
|
||||
unsigned int uart_low_latency;
|
||||
};
|
||||
|
||||
struct xr_usb_serial {
|
||||
struct usb_device *dev; /* the corresponding usb device */
|
||||
struct usb_interface *control; /* control interface */
|
||||
struct usb_interface *data; /* data interface */
|
||||
struct tty_port port; /* our tty port data */
|
||||
struct urb *ctrlurb; /* urbs */
|
||||
u8 *ctrl_buffer; /* buffers of urbs */
|
||||
dma_addr_t ctrl_dma; /* dma handles of buffers */
|
||||
u8 *country_codes; /* country codes from device */
|
||||
unsigned int country_code_size; /* size of this buffer */
|
||||
unsigned int country_rel_date; /* release date of version */
|
||||
struct xr_usb_serial_wb wb[XR_USB_SERIAL_NW];
|
||||
unsigned long read_urbs_free;
|
||||
struct urb *read_urbs[XR_USB_SERIAL_NR];
|
||||
struct xr_usb_serial_rb read_buffers[XR_USB_SERIAL_NR];
|
||||
int rx_buflimit;
|
||||
int rx_endpoint;
|
||||
spinlock_t read_lock;
|
||||
int write_used; /* number of non-empty write buffers */
|
||||
int transmitting;
|
||||
spinlock_t write_lock;
|
||||
struct mutex mutex;
|
||||
bool disconnected;
|
||||
struct usb_cdc_line_coding line; /* bits, stop, parity */
|
||||
struct work_struct work; /* work queue entry for line discipline waking up */
|
||||
unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */
|
||||
unsigned int ctrlout; /* output control lines (DTR, RTS) */
|
||||
unsigned int writesize; /* max packet size for the output bulk endpoint */
|
||||
unsigned int readsize,ctrlsize; /* buffer sizes for freeing */
|
||||
unsigned int minor; /* xr_usb_serial minor number */
|
||||
unsigned char clocal; /* termios CLOCAL */
|
||||
unsigned int ctrl_caps; /* control capabilities from the class specific header */
|
||||
unsigned int susp_count; /* number of suspended interfaces */
|
||||
unsigned int combined_interfaces:1; /* control and data collapsed */
|
||||
unsigned int is_int_ep:1; /* interrupt endpoints contrary to spec used */
|
||||
unsigned int throttled:1; /* actually throttled */
|
||||
unsigned int throttle_req:1; /* throttle requested */
|
||||
u8 bInterval;
|
||||
struct xr_usb_serial_wb *delayed_wb; /* write queued for a device about to be woken */
|
||||
unsigned int channel;
|
||||
int preciseflags; /* USB: wide mode, TTY: flags per character */
|
||||
int trans9; /* USB: wide mode, serial 9N1 */
|
||||
int have_extra_byte;
|
||||
int extra_byte;
|
||||
|
||||
unsigned short DeviceVendor;
|
||||
unsigned short DeviceProduct;
|
||||
struct reg_addr_map reg_map;
|
||||
#ifdef CONFIG_GPIOLIB
|
||||
struct gpio_chip xr_gpio;
|
||||
int rv_gpio_created;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define CDC_DATA_INTERFACE_TYPE 0x0a
|
||||
|
||||
/* constants describing various quirks and errors */
|
||||
#define NO_UNION_NORMAL 1
|
||||
#define SINGLE_RX_URB 2
|
||||
#define NO_CAP_LINE 4
|
||||
#define NOT_A_MODEM 8
|
||||
#define NO_DATA_INTERFACE 16
|
||||
#define IGNORE_DEVICE 32
|
||||
|
||||
|
||||
#define UART_ENABLE_TX 1
|
||||
#define UART_ENABLE_RX 2
|
||||
|
||||
#define UART_GPIO_CLR_DTR 0x8
|
||||
#define UART_GPIO_SET_DTR 0x8
|
||||
#define UART_GPIO_CLR_RTS 0x20
|
||||
#define UART_GPIO_SET_RTS 0x20
|
||||
|
||||
#define LOOPBACK_ENABLE_TX_RX 1
|
||||
#define LOOPBACK_ENABLE_RTS_CTS 2
|
||||
#define LOOPBACK_ENABLE_DTR_DSR 4
|
||||
|
||||
#define UART_FLOW_MODE_NONE 0x0
|
||||
#define UART_FLOW_MODE_HW 0x1
|
||||
#define UART_FLOW_MODE_SW 0x2
|
||||
|
||||
#define UART_GPIO_MODE_SEL_GPIO 0x0
|
||||
#define UART_GPIO_MODE_SEL_RTS_CTS 0x1
|
||||
|
||||
#define XR2280x_FUNC_MGR_OFFSET 0x40
|
||||
|
821
package/kernel/xr-usb-serial/src/xr_usb_serial_hal.c
Normal file
821
package/kernel/xr-usb-serial/src/xr_usb_serial_hal.c
Normal file
@ -0,0 +1,821 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define XR_SET_MAP_XR2280X 5
|
||||
#define XR_GET_MAP_XR2280X 5
|
||||
|
||||
#define XR_SET_MAP_XR21B142X 0
|
||||
#define XR_GET_MAP_XR21B142X 0
|
||||
|
||||
#define XR_SET_MAP_XR21V141X 0
|
||||
#define XR_GET_MAP_XR21V141X 1
|
||||
|
||||
#define XR_SET_MAP_XR21B1411 0
|
||||
#define XR_GET_MAP_XR21B1411 1
|
||||
|
||||
|
||||
int xr_usb_serial_set_reg(struct xr_usb_serial *xr_usb_serial,int regnum, int value)
|
||||
{
|
||||
int result;
|
||||
int channel = 0;
|
||||
//dev_info(&xr_usb_serial->control->dev, "%s Channel:%d 0x%02x = 0x%02x\n", __func__,channel,regnum, value);
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
int XR2280xaddr = XR2280x_FUNC_MGR_OFFSET + regnum;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR2280X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR, /* request_type */
|
||||
value, /* request value */
|
||||
XR2280xaddr, /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
if(xr_usb_serial->channel)
|
||||
channel = xr_usb_serial->channel - 1;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21V141X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR, /* request_type */
|
||||
value, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21B1411, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR, /* request_type */
|
||||
value, /* request value */
|
||||
regnum , /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
channel = (xr_usb_serial->channel - 4)*2;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21B142X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR | 1, /* request_type */
|
||||
value, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
if(result < 0)
|
||||
dev_err(&xr_usb_serial->control->dev, "%s Error:%d\n", __func__,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int xr_usb_serial_set_reg_ext(struct xr_usb_serial *xr_usb_serial,int channel,int regnum, int value)
|
||||
{
|
||||
int result;
|
||||
int XR2280xaddr = XR2280x_FUNC_MGR_OFFSET + regnum;
|
||||
//dev_info(&xr_usb_serial->control->dev, "%s channel:%d 0x%02x = 0x%02x\n", __func__,channel,regnum, value);
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR2280X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR, /* request_type */
|
||||
value, /* request value */
|
||||
XR2280xaddr, /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21V141X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR, /* request_type */
|
||||
value, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21B1411, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR , /* request_type */
|
||||
value, /* request value */
|
||||
regnum , /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_sndctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_SET_MAP_XR21B142X, /* request */
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR | 1, /* request_type */
|
||||
value, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
NULL, /* data */
|
||||
0, /* size */
|
||||
5000); /* timeout */
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
if(result < 0)
|
||||
dev_err(&xr_usb_serial->control->dev, "%s Error:%d\n", __func__,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int xr_usb_serial_get_reg(struct xr_usb_serial *xr_usb_serial,int regnum, short *value)
|
||||
{
|
||||
int result;
|
||||
int channel = 0;
|
||||
short *dmadata;
|
||||
|
||||
/* Use dynamic memory instead of statically allocated buffer
|
||||
This is to avoid Error -11 (EAGAIN) for Kernel no longer accept static allocated buffer after 4.9 */
|
||||
dmadata = kmalloc(2, GFP_KERNEL);
|
||||
|
||||
if (!dmadata)
|
||||
{
|
||||
dev_err(&xr_usb_serial->control->dev, "[func:%s,line:%d] error no memory allocated!! \n", __func__,__LINE__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
int XR2280xaddr = XR2280x_FUNC_MGR_OFFSET + regnum;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR2280X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR , /* request_type */
|
||||
0, /* request value */
|
||||
XR2280xaddr, /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
if(xr_usb_serial->channel)
|
||||
channel = xr_usb_serial->channel -1;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21V141X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR, /* request_type */
|
||||
0, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
dmadata, /* data */
|
||||
1, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 1);
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21B1411, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR, /* request_type */
|
||||
0, /* request value */
|
||||
regnum, /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
channel = (xr_usb_serial->channel -4)*2;
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21B142X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR | 1, /* request_type */
|
||||
0, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
|
||||
if(result < 0)
|
||||
dev_err(&xr_usb_serial->control->dev, "%s channel:%d Reg 0x%x Error:%d\n", __func__,channel,regnum,result);
|
||||
//else
|
||||
//dev_info(&xr_usb_serial->control->dev, "%s channel:%d 0x%x = 0x%04x\n", __func__,channel,regnum, *value);
|
||||
|
||||
kfree(dmadata);
|
||||
return result;
|
||||
}
|
||||
|
||||
int xr_usb_serial_get_reg_ext(struct xr_usb_serial *xr_usb_serial,int channel,int regnum, short *value)
|
||||
{
|
||||
int result;
|
||||
int XR2280xaddr = XR2280x_FUNC_MGR_OFFSET + regnum;
|
||||
short *dmadata;
|
||||
|
||||
/* Use dynamic memory instead of statically allocated buffer
|
||||
This is to avoid Error -11 (EAGAIN) for Kernel no longer accept static allocated buffer after 4.9 */
|
||||
dmadata = kmalloc(2, GFP_KERNEL);
|
||||
|
||||
if (!dmadata)
|
||||
{
|
||||
dev_err(&xr_usb_serial->control->dev, "[func:%s,line:%d] error no memory allocated!! \n", __func__,__LINE__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR2280X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR , /* request_type */
|
||||
0, /* request value */
|
||||
XR2280xaddr, /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21V141X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR, /* request_type */
|
||||
0, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
dmadata, /* data */
|
||||
1, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 1);
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21B1411, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR , /* request_type */
|
||||
0, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
result = usb_control_msg(xr_usb_serial->dev, /* usb device */
|
||||
usb_rcvctrlpipe(xr_usb_serial->dev, 0), /* endpoint pipe */
|
||||
XR_GET_MAP_XR21B142X, /* request */
|
||||
USB_DIR_IN | USB_TYPE_VENDOR | 1, /* request_type */
|
||||
0, /* request value */
|
||||
regnum | (channel << 8), /* index */
|
||||
dmadata, /* data */
|
||||
2, /* size */
|
||||
5000); /* timeout */
|
||||
memcpy(value, dmadata, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
|
||||
if(result < 0)
|
||||
dev_err(&xr_usb_serial->control->dev, "%s Error:%d\n", __func__,result);
|
||||
//else
|
||||
//dev_info(&xr_usb_serial->control->dev, "%s channel:%d 0x%x = 0x%04x\n", __func__,channel,regnum, *value);
|
||||
|
||||
kfree(dmadata);
|
||||
return result;
|
||||
}
|
||||
|
||||
struct xr21v141x_baud_rate
|
||||
{
|
||||
unsigned int tx;
|
||||
unsigned int rx0;
|
||||
unsigned int rx1;
|
||||
};
|
||||
|
||||
static struct xr21v141x_baud_rate xr21v141x_baud_rates[] = {
|
||||
{ 0x000, 0x000, 0x000 },
|
||||
{ 0x000, 0x000, 0x000 },
|
||||
{ 0x100, 0x000, 0x100 },
|
||||
{ 0x020, 0x400, 0x020 },
|
||||
{ 0x010, 0x100, 0x010 },
|
||||
{ 0x208, 0x040, 0x208 },
|
||||
{ 0x104, 0x820, 0x108 },
|
||||
{ 0x844, 0x210, 0x884 },
|
||||
{ 0x444, 0x110, 0x444 },
|
||||
{ 0x122, 0x888, 0x224 },
|
||||
{ 0x912, 0x448, 0x924 },
|
||||
{ 0x492, 0x248, 0x492 },
|
||||
{ 0x252, 0x928, 0x292 },
|
||||
{ 0X94A, 0X4A4, 0XA52 },
|
||||
{ 0X52A, 0XAA4, 0X54A },
|
||||
{ 0XAAA, 0x954, 0X4AA },
|
||||
{ 0XAAA, 0x554, 0XAAA },
|
||||
{ 0x555, 0XAD4, 0X5AA },
|
||||
{ 0XB55, 0XAB4, 0X55A },
|
||||
{ 0X6B5, 0X5AC, 0XB56 },
|
||||
{ 0X5B5, 0XD6C, 0X6D6 },
|
||||
{ 0XB6D, 0XB6A, 0XDB6 },
|
||||
{ 0X76D, 0X6DA, 0XBB6 },
|
||||
{ 0XEDD, 0XDDA, 0X76E },
|
||||
{ 0XDDD, 0XBBA, 0XEEE },
|
||||
{ 0X7BB, 0XF7A, 0XDDE },
|
||||
{ 0XF7B, 0XEF6, 0X7DE },
|
||||
{ 0XDF7, 0XBF6, 0XF7E },
|
||||
{ 0X7F7, 0XFEE, 0XEFE },
|
||||
{ 0XFDF, 0XFBE, 0X7FE },
|
||||
{ 0XF7F, 0XEFE, 0XFFE },
|
||||
{ 0XFFF, 0XFFE, 0XFFD },
|
||||
};
|
||||
#define UART_CLOCK_DIVISOR_0 0x004
|
||||
#define UART_CLOCK_DIVISOR_1 0x005
|
||||
#define UART_CLOCK_DIVISOR_2 0x006
|
||||
#define UART_TX_CLOCK_MASK_0 0x007
|
||||
#define UART_TX_CLOCK_MASK_1 0x008
|
||||
#define UART_RX_CLOCK_MASK_0 0x009
|
||||
#define UART_RX_CLOCK_MASK_1 0x00a
|
||||
|
||||
static int xr21v141x_set_baud_rate(struct xr_usb_serial *xr_usb_serial, unsigned int rate)
|
||||
{
|
||||
unsigned int divisor = 48000000 / rate;
|
||||
unsigned int i = ((32 * 48000000) / rate) & 0x1f;
|
||||
unsigned int tx_mask = xr21v141x_baud_rates[i].tx;
|
||||
unsigned int rx_mask = (divisor & 1) ? xr21v141x_baud_rates[i].rx1 : xr21v141x_baud_rates[i].rx0;
|
||||
|
||||
//dev_info(&xr_usb_serial->control->dev, "Setting baud rate to %d: i=%u div=%u tx=%03x rx=%03x\n", rate, i, divisor, tx_mask, rx_mask);
|
||||
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_CLOCK_DIVISOR_0, (divisor >> 0) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_CLOCK_DIVISOR_1, (divisor >> 8) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_CLOCK_DIVISOR_2, (divisor >> 16) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_TX_CLOCK_MASK_0, (tx_mask >> 0) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_TX_CLOCK_MASK_1, (tx_mask >> 8) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_RX_CLOCK_MASK_0, (rx_mask >> 0) & 0xff);
|
||||
xr_usb_serial_set_reg(xr_usb_serial,UART_RX_CLOCK_MASK_1, (rx_mask >> 8) & 0xff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* devices aren't required to support these requests.
|
||||
* the cdc xr_usb_serial descriptor tells whether they do...
|
||||
*/
|
||||
int xr_usb_serial_set_control(struct xr_usb_serial *xr_usb_serial, unsigned int control)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
if (control & XR_USB_SERIAL_CTRL_DTR)
|
||||
xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_gpio_clr_addr, 0x08);
|
||||
else
|
||||
xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_gpio_set_addr, 0x08);
|
||||
|
||||
if (control & XR_USB_SERIAL_CTRL_RTS)
|
||||
xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_gpio_clr_addr, 0x20);
|
||||
else
|
||||
xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_gpio_set_addr, 0x20);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = xr_usb_serial_ctrl_msg(xr_usb_serial, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xr_usb_serial_set_line(struct xr_usb_serial *xr_usb_serial, struct usb_cdc_line_coding* line)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int format_size;
|
||||
unsigned int format_parity;
|
||||
unsigned int format_stop;
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
xr21v141x_set_baud_rate(xr_usb_serial,le32_to_cpu(line->dwDTERate));
|
||||
format_size = line->bDataBits;
|
||||
format_parity = line->bParityType;
|
||||
format_stop = line->bCharFormat;
|
||||
xr_usb_serial_set_reg(xr_usb_serial,
|
||||
xr_usb_serial->reg_map.uart_format_addr,
|
||||
(format_size << 0) | (format_parity << 4) | (format_stop << 7) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = xr_usb_serial_ctrl_msg(xr_usb_serial, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xr_usb_serial_set_flow_mode(struct xr_usb_serial *xr_usb_serial, struct tty_struct *tty, unsigned int cflag)
|
||||
{
|
||||
unsigned int flow;
|
||||
unsigned int gpio_mode;
|
||||
|
||||
if (cflag & CRTSCTS)
|
||||
{
|
||||
//dev_dbg(&xr_usb_serial->control->dev, "xr_usb_serial_set_flow_mode:hardware\n");
|
||||
flow = UART_FLOW_MODE_HW;
|
||||
gpio_mode = UART_GPIO_MODE_SEL_RTS_CTS;
|
||||
}
|
||||
else if (I_IXOFF(tty) || I_IXON(tty))
|
||||
{
|
||||
unsigned char start_char = START_CHAR(tty);
|
||||
unsigned char stop_char = STOP_CHAR(tty);
|
||||
//dev_dbg(&xr_usb_serial->control->dev, "xr_usb_serial_set_flow_mode:software\n");
|
||||
flow = UART_FLOW_MODE_SW;
|
||||
gpio_mode = UART_GPIO_MODE_SEL_GPIO;
|
||||
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_xon_char_addr, start_char);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_xoff_char_addr, stop_char);
|
||||
}
|
||||
else
|
||||
{
|
||||
//dev_dbg(&xr_usb_serial->control->dev, "xr_usb_serial_set_flow_mode:none\n");
|
||||
flow = UART_FLOW_MODE_NONE;
|
||||
gpio_mode = UART_GPIO_MODE_SEL_GPIO;
|
||||
}
|
||||
|
||||
if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
//Add support for the TXT and RXT function for 0x1420, 0x1422, 0x1424, by setting GPIO_MODE [9:8] = '11'
|
||||
gpio_mode |= 0x300;
|
||||
}
|
||||
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_flow_addr, flow);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_mode_addr, gpio_mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xr_usb_serial_send_break(struct xr_usb_serial *xr_usb_serial, int state)
|
||||
{
|
||||
int ret = 0;
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
if(state)
|
||||
ret = xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.tx_break_addr,0xffff);
|
||||
else
|
||||
ret = xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.tx_break_addr,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = xr_usb_serial_ctrl_msg(xr_usb_serial, USB_CDC_REQ_SEND_BREAK, state, NULL, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define URM_REG_BLOCK 4
|
||||
#define URM_ENABLE_BASE 0x010
|
||||
#define URM_ENABLE_0_TX 0x001
|
||||
#define URM_ENABLE_0_RX 0x002
|
||||
#define URM_RESET_RX_FIFO_BASE 0x018
|
||||
#define URM_RESET_TX_FIFO_BASE 0x01C
|
||||
|
||||
int xr_usb_serial_enable(struct xr_usb_serial *xr_usb_serial)
|
||||
{
|
||||
int ret = 0;
|
||||
int channel = xr_usb_serial->channel;
|
||||
//dev_info(&xr_usb_serial->control->dev, "xr_usb_serial_enable channel=%d\n",channel);
|
||||
if(channel)
|
||||
channel--;
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,URM_REG_BLOCK,URM_ENABLE_BASE + channel,URM_ENABLE_0_TX);
|
||||
ret = xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_enable_addr,UART_ENABLE_TX | UART_ENABLE_RX);
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,URM_REG_BLOCK,URM_ENABLE_BASE + channel,URM_ENABLE_0_TX | URM_ENABLE_0_RX);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_enable_addr,UART_ENABLE_TX | UART_ENABLE_RX);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xr_usb_serial_fifo_reset(struct xr_usb_serial *xr_usb_serial)
|
||||
{
|
||||
int ret = 0;
|
||||
int channel = xr_usb_serial->channel;
|
||||
|
||||
if(channel) channel--;
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,URM_REG_BLOCK,URM_RESET_RX_FIFO_BASE + channel,0xff);
|
||||
ret |= xr_usb_serial_set_reg_ext(xr_usb_serial,URM_REG_BLOCK,URM_RESET_TX_FIFO_BASE + channel,0xff);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xr_usb_serial_disable(struct xr_usb_serial *xr_usb_serial)
|
||||
{
|
||||
int ret = 0;
|
||||
int channel = xr_usb_serial->channel;
|
||||
//dev_info(&xr_usb_serial->control->dev, "xr_usb_serial_disable channel=%d\n",channel);
|
||||
if(channel) channel--;
|
||||
ret = xr_usb_serial_set_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_enable_addr,0);
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,URM_REG_BLOCK,URM_ENABLE_BASE + channel,URM_ENABLE_0_TX);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xr_usb_serial_set_loopback(struct xr_usb_serial *xr_usb_serial, int channel)
|
||||
{
|
||||
int ret = 0;
|
||||
xr_usb_serial_disable(xr_usb_serial);
|
||||
|
||||
if((xr_usb_serial->DeviceProduct == 0x1410) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412) ||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
switch (channel)
|
||||
{
|
||||
case 0:
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,channel,
|
||||
xr_usb_serial->reg_map.uart_loopback_addr,0x40);
|
||||
break;
|
||||
case 1:
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,channel,
|
||||
xr_usb_serial->reg_map.uart_loopback_addr,0x41);
|
||||
break;
|
||||
case 2:
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,channel,
|
||||
xr_usb_serial->reg_map.uart_loopback_addr,0x42);
|
||||
break;
|
||||
case 3:
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,channel,
|
||||
xr_usb_serial->reg_map.uart_loopback_addr,0x43);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
ret = xr_usb_serial_set_reg_ext(xr_usb_serial,channel,
|
||||
xr_usb_serial->reg_map.uart_loopback_addr,0x07);
|
||||
}
|
||||
xr_usb_serial_enable(xr_usb_serial);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define XR21V1414_WIDE_MODE_OFFSET 3
|
||||
#define XR21B142X_WIDE_MODE_TX_OFFSET 0x42
|
||||
#define XR21B142X_WIDE_MODE_RX_OFFSET 0x45
|
||||
/* XR2280x_FUNC_MGR_OFFSET will be included in xr_usb_serial_set_reg */
|
||||
#define XR21B140X_WIDE_MODE_TX_OFFSET 0x22
|
||||
#define XR21B140X_WIDE_MODE_RX_OFFSET 0x25
|
||||
int xr_usb_serial_set_wide_mode(struct xr_usb_serial *xr_usb_serial, int preciseflags)
|
||||
{
|
||||
int ret = 0;
|
||||
int channel = xr_usb_serial->channel;
|
||||
xr_usb_serial_disable(xr_usb_serial);
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
xr_usb_serial_set_reg(xr_usb_serial, XR21B140X_WIDE_MODE_TX_OFFSET, preciseflags);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, XR21B140X_WIDE_MODE_RX_OFFSET, preciseflags);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
if(channel) channel--;
|
||||
xr_usb_serial_set_reg_ext(xr_usb_serial, 0x66, channel*8 + XR21V1414_WIDE_MODE_OFFSET, preciseflags);
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
xr_usb_serial_set_reg(xr_usb_serial,0xd02, preciseflags);
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
xr_usb_serial_set_reg(xr_usb_serial, XR21B142X_WIDE_MODE_TX_OFFSET, preciseflags);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, XR21B142X_WIDE_MODE_RX_OFFSET, preciseflags);
|
||||
}
|
||||
xr_usb_serial_enable(xr_usb_serial);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int xr_usb_serial_tiocmget(struct xr_usb_serial *xr_usb_serial)
|
||||
{
|
||||
short data;
|
||||
int result;
|
||||
result = xr_usb_serial_get_reg(xr_usb_serial,xr_usb_serial->reg_map.uart_gpio_status_addr, &data);
|
||||
//dev_info(&xr_usb_serial->control->dev, "xr_usb_serial_tiocmget uart_gpio_status_addr:0x%04x\n",data);
|
||||
if (result)
|
||||
return ((data & 0x8) ? 0: TIOCM_DTR) | ((data & 0x20) ? 0:TIOCM_RTS ) | ((data & 0x4) ? 0:TIOCM_DSR) | ((data & 0x1) ? 0 : TIOCM_RI) | ((data & 0x2) ? 0:TIOCM_CD) | ((data & 0x10) ? 0 : TIOCM_CTS);
|
||||
else
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
static int xr_usb_serial_tiocmset(struct xr_usb_serial *xr_usb_serial,
|
||||
unsigned int set, unsigned int clear)
|
||||
{
|
||||
unsigned int newctrl = 0;
|
||||
newctrl = xr_usb_serial->ctrlout;
|
||||
|
||||
set = (set & TIOCM_DTR ? XR_USB_SERIAL_CTRL_DTR : 0) | (set & TIOCM_RTS ? XR_USB_SERIAL_CTRL_RTS : 0);
|
||||
|
||||
clear = (clear & TIOCM_DTR ? XR_USB_SERIAL_CTRL_DTR : 0) | (clear & TIOCM_RTS ? XR_USB_SERIAL_CTRL_RTS : 0);
|
||||
|
||||
newctrl = (newctrl & ~clear) | set;
|
||||
|
||||
if (xr_usb_serial->ctrlout == newctrl)
|
||||
return 0;
|
||||
|
||||
xr_usb_serial->ctrlout = newctrl;
|
||||
|
||||
if (newctrl & XR_USB_SERIAL_CTRL_DTR)
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_clr_addr, 0x08);
|
||||
else
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_set_addr, 0x08);
|
||||
|
||||
if (newctrl & XR_USB_SERIAL_CTRL_RTS)
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_clr_addr, 0x20);
|
||||
else
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_set_addr, 0x20);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct reg_addr_map xr21b140x_reg_map;
|
||||
static struct reg_addr_map xr21b1411_reg_map;
|
||||
static struct reg_addr_map xr21v141x_reg_map;
|
||||
static struct reg_addr_map xr21b142x_reg_map;
|
||||
|
||||
static void init_xr21b140x_reg_map(void)
|
||||
{
|
||||
xr21b140x_reg_map.uart_enable_addr = 0x00;
|
||||
xr21b140x_reg_map.uart_format_addr = 0x05;
|
||||
xr21b140x_reg_map.uart_flow_addr = 0x06;
|
||||
xr21b140x_reg_map.uart_loopback_addr = 0x16;
|
||||
xr21b140x_reg_map.uart_xon_char_addr = 0x07;
|
||||
xr21b140x_reg_map.uart_xoff_char_addr = 0x08;
|
||||
xr21b140x_reg_map.uart_gpio_mode_addr = 0x0c;
|
||||
xr21b140x_reg_map.uart_gpio_dir_addr = 0x0d;
|
||||
xr21b140x_reg_map.uart_gpio_set_addr = 0x0e;
|
||||
xr21b140x_reg_map.uart_gpio_clr_addr = 0x0f;
|
||||
xr21b140x_reg_map.uart_gpio_status_addr = 0x10;
|
||||
xr21b140x_reg_map.tx_break_addr = 0x0a;
|
||||
xr21b140x_reg_map.uart_custom_driver = 0x41;
|
||||
}
|
||||
|
||||
static void init_xr21b1411_reg_map(void)
|
||||
{
|
||||
xr21b1411_reg_map.uart_enable_addr = 0xc00;
|
||||
xr21b1411_reg_map.uart_flow_addr = 0xc06;
|
||||
xr21b1411_reg_map.uart_loopback_addr = 0xc16;
|
||||
xr21b1411_reg_map.uart_xon_char_addr = 0xc07;
|
||||
xr21b1411_reg_map.uart_xoff_char_addr = 0xc08;
|
||||
xr21b1411_reg_map.uart_gpio_mode_addr = 0xc0c;
|
||||
xr21b1411_reg_map.uart_gpio_dir_addr = 0xc0d;
|
||||
xr21b1411_reg_map.uart_gpio_set_addr = 0xc0e;
|
||||
xr21b1411_reg_map.uart_gpio_clr_addr = 0xc0f;
|
||||
xr21b1411_reg_map.uart_gpio_status_addr = 0xc10;
|
||||
xr21b1411_reg_map.tx_break_addr = 0xc0a;
|
||||
xr21b1411_reg_map.uart_custom_driver = 0x20d;
|
||||
}
|
||||
|
||||
static void init_xr21v141x_reg_map(void)
|
||||
{
|
||||
xr21v141x_reg_map.uart_enable_addr = 0x03;
|
||||
xr21v141x_reg_map.uart_format_addr = 0x0b;
|
||||
xr21v141x_reg_map.uart_flow_addr = 0x0c;
|
||||
xr21v141x_reg_map.uart_loopback_addr = 0x12;
|
||||
xr21v141x_reg_map.uart_xon_char_addr = 0x10;
|
||||
xr21v141x_reg_map.uart_xoff_char_addr = 0x11;
|
||||
xr21v141x_reg_map.uart_gpio_mode_addr = 0x1a;
|
||||
xr21v141x_reg_map.uart_gpio_dir_addr = 0x1b;
|
||||
xr21v141x_reg_map.uart_gpio_set_addr = 0x1d;
|
||||
xr21v141x_reg_map.uart_gpio_clr_addr = 0x1e;
|
||||
xr21v141x_reg_map.uart_gpio_status_addr = 0x1f;
|
||||
xr21v141x_reg_map.tx_break_addr = 0x14;
|
||||
}
|
||||
|
||||
static void init_xr21b142x_reg_map(void)
|
||||
{
|
||||
xr21b142x_reg_map.uart_enable_addr = 0x00;
|
||||
xr21b142x_reg_map.uart_flow_addr = 0x06;
|
||||
xr21b142x_reg_map.uart_loopback_addr = 0x16;
|
||||
xr21b142x_reg_map.uart_xon_char_addr = 0x07;
|
||||
xr21b142x_reg_map.uart_xoff_char_addr = 0x08;
|
||||
xr21b142x_reg_map.uart_gpio_mode_addr = 0x0c;
|
||||
xr21b142x_reg_map.uart_gpio_dir_addr = 0x0d;
|
||||
xr21b142x_reg_map.uart_gpio_set_addr = 0x0e;
|
||||
xr21b142x_reg_map.uart_gpio_clr_addr = 0x0f;
|
||||
xr21b142x_reg_map.uart_gpio_status_addr = 0x10;
|
||||
xr21b142x_reg_map.tx_break_addr = 0x0a;
|
||||
xr21b142x_reg_map.uart_custom_driver = 0x60;
|
||||
xr21b142x_reg_map.uart_low_latency = 0x46;
|
||||
}
|
||||
|
||||
int xr_usb_serial_pre_setup(struct xr_usb_serial *xr_usb_serial)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
init_xr21b140x_reg_map();
|
||||
init_xr21b1411_reg_map();
|
||||
init_xr21v141x_reg_map();
|
||||
init_xr21b142x_reg_map();
|
||||
if((xr_usb_serial->DeviceProduct&0xfff0) == 0x1400)
|
||||
{
|
||||
memcpy(&(xr_usb_serial->reg_map),&xr21b140x_reg_map,sizeof(struct reg_addr_map));
|
||||
}
|
||||
else if(xr_usb_serial->DeviceProduct == 0x1411)
|
||||
{
|
||||
memcpy(&(xr_usb_serial->reg_map),&xr21b1411_reg_map,sizeof(struct reg_addr_map));
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1410)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1412)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1414))
|
||||
{
|
||||
memcpy(&(xr_usb_serial->reg_map),&xr21v141x_reg_map,sizeof(struct reg_addr_map));
|
||||
}
|
||||
else if((xr_usb_serial->DeviceProduct == 0x1420)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1422)||
|
||||
(xr_usb_serial->DeviceProduct == 0x1424))
|
||||
{
|
||||
memcpy(&(xr_usb_serial->reg_map),&xr21b142x_reg_map,sizeof(struct reg_addr_map));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
if(xr_usb_serial->reg_map.uart_custom_driver)
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_custom_driver, 1);
|
||||
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_mode_addr, 0);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_dir_addr, 0x28);
|
||||
xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_set_addr, UART_GPIO_SET_DTR | UART_GPIO_SET_RTS);
|
||||
|
||||
return ret;
|
||||
}
|
35
package/kernel/xr-usb-serial/src/xr_usb_serial_ioctl.h
Normal file
35
package/kernel/xr-usb-serial/src/xr_usb_serial_ioctl.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define XR_USB_SERIAL_IOC_MAGIC 'v'
|
||||
|
||||
#define XR_USB_SERIAL_GET_REG _IOWR(XR_USB_SERIAL_IOC_MAGIC, 1, int)
|
||||
#define XR_USB_SERIAL_SET_REG _IOWR(XR_USB_SERIAL_IOC_MAGIC, 2, int)
|
||||
#define XR_USB_SERIAL_SET_ADDRESS_MATCH _IO(XR_USB_SERIAL_IOC_MAGIC, 3)
|
||||
#define XR_USB_SERIAL_SET_PRECISE_FLAGS _IO(XR_USB_SERIAL_IOC_MAGIC, 4)
|
||||
#define XR_USB_SERIAL_TEST_MODE _IO(XR_USB_SERIAL_IOC_MAGIC, 5)
|
||||
#define XR_USB_SERIAL_LOOPBACK _IO(XR_USB_SERIAL_IOC_MAGIC, 6)
|
||||
#define XR_USB_SERIAL_SET_GPIO_MODE_REG _IO(XR_USB_SERIAL_IOC_MAGIC, 9)
|
||||
#define XR_USB_SERIAL_GET_GPIO_MODE_REG _IO(XR_USB_SERIAL_IOC_MAGIC, 10)
|
||||
#define XRIOC_SET_ANY_BAUD_RATE _IO(XR_USB_SERIAL_IOC_MAGIC, 11)
|
||||
#define XRIOC_SET_PRECISE_FLAGS _IO(XR_USB_SERIAL_IOC_MAGIC, 12)
|
||||
|
||||
#define VZ_ADDRESS_UNICAST_S 0
|
||||
#define VZ_ADDRESS_BROADCAST_S 8
|
||||
#define VZ_ADDRESS_MATCH(U, B) (0x8000000 | ((B) << VZ_ADDRESS_BROADCAST_S) | ((U) << VZ_ADDRESS_UNICAST_S))
|
||||
#define VZ_ADDRESS_MATCH_DISABLE 0
|
@ -5,71 +5,35 @@ START=99
|
||||
|
||||
start()
|
||||
{
|
||||
sysctl -w net.netfilter.nf_conntrack_max=6553500 >/dev/null
|
||||
sysctl -w net.netfilter.nf_conntrack_tcp_timeout_established=7440 >/dev/null
|
||||
sysctl -w net.netfilter.nf_conntrack_udp_timeout=60 >/dev/null
|
||||
sysctl -w net.netfilter.nf_conntrack_udp_timeout_stream=180 >/dev/null
|
||||
sysctl -w fs.nr_open=65535000 >/dev/null
|
||||
sysctl -w net.core.netdev_budget=5000 >/dev/null
|
||||
sysctl -w net.core.netdev_budget_usecs=50000 >/dev/null
|
||||
sysctl -w net.netfilter.nf_conntrack_max=629536 >/dev/null
|
||||
sysctl -w net.netfilter.nf_conntrack_buckets=65535 >/dev/null
|
||||
sysctl -w net.core.somaxconn=32768 >/dev/null
|
||||
sysctl -w net.core.netdev_max_backlog=52768 >/dev/null
|
||||
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo $cc > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
a=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq)
|
||||
b=$(echo -n ' : ')
|
||||
c=$(cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l)
|
||||
d=$(echo -n ' Core ')
|
||||
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
|
||||
f=$(echo -n ' Thread ')
|
||||
g=$(cat /proc/cpuinfo |grep -m1 'model name'|awk -F: '{print $2$3}')
|
||||
g=$(cat /tmp/sysinfo/model)
|
||||
h=${g}' - '${a}${b}${c}${d}${e}${f}
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
echo $h > /tmp/sysinfo/model
|
||||
|
||||
uci get network.@globals[0].packet_steering >/dev/null 2>&1
|
||||
if [[ $? != 0 ]];then
|
||||
sysctl -w net.core.rps_sock_flow_entries=32768 >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo 0 > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo 0 > $fileRfc
|
||||
done
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=32768 >/dev/null
|
||||
cflag="0"
|
||||
cc=`expr $cc - 1`
|
||||
for z in `seq $cc`
|
||||
do
|
||||
cflag="1${cflag}"
|
||||
done
|
||||
cc=`echo "ibase=2;obase=10000;$cflag"|bc`
|
||||
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo $cc > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
for i in $(seq 1 $b)
|
||||
@ -82,9 +46,8 @@ start()
|
||||
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
|
||||
ethtool -K $c gso on >/dev/null 2>&1
|
||||
ethtool -K $c tso on >/dev/null 2>&1
|
||||
ethtool -K $c tso on sg on tx on >/dev/null 2>&1
|
||||
ethtool -K $c ufo on >/dev/null 2>&1
|
||||
done
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ enable_domain() {
|
||||
# 获取子域名解析记录列表
|
||||
describe_domain() {
|
||||
local count value; local ret=0
|
||||
aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" || write_log 14 "服务器通信失败"
|
||||
aliyun_transfer "Action=DescribeSubDomainRecords" "SubDomain=${__HOST}.${__DOMAIN}" "DomainName=${__DOMAIN}" || write_log 14 "服务器通信失败"
|
||||
write_log 7 "获取到解析记录: $(cat "$DATFILE" 2> /dev/null)"
|
||||
json_cleanup; json_load "$(cat "$DATFILE" 2> /dev/null)" >/dev/null 2>&1
|
||||
json_get_var count "TotalCount"
|
||||
|
9
package/qat/firmware/quickassist-c2xxx/Config.in
Normal file
9
package/qat/firmware/quickassist-c2xxx/Config.in
Normal file
@ -0,0 +1,9 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_kmod-crypto-qat-c2xxx
|
||||
|
||||
config CRYPTO_QAT_DEBUG
|
||||
bool
|
||||
default n
|
||||
prompt "Build with debugging support enabled"
|
||||
|
||||
endmenu
|
160
package/qat/firmware/quickassist-c2xxx/Makefile
Normal file
160
package/qat/firmware/quickassist-c2xxx/Makefile
Normal file
@ -0,0 +1,160 @@
|
||||
#
|
||||
# Copyright (C) DL <revelstone@yahoo.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickassist-c2xxx
|
||||
|
||||
PKG_VERSION:=1.5
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_VERSION:=1.5.l.1.13.0-19
|
||||
PKG_SOURCE:=qat$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://01.org/sites/default/files/downloads/intel-quickassist-technology/
|
||||
PKG_HASH:=afe8339edbbf05099e79c256191584aabf30b564f89a553b9585b2f8e18bee17
|
||||
|
||||
PKG_LICENSE:=GPL v3
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_PARALLEL:=0
|
||||
|
||||
define Package/quickassist-c2xxx
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
TITLE:=Intel Quick Assist meta-package for c2xxx
|
||||
DEPENDS:= \
|
||||
@TARGET_x86_64 \
|
||||
@LINUX_4_14 \
|
||||
+libopenssl \
|
||||
+kmod-crypto-qat-c2xxx \
|
||||
+kmod-crypto-qat-c2xxx-usdm
|
||||
endef
|
||||
|
||||
define Package/quickassist-c2xxx/config
|
||||
depends on !quickassist-c3xxx-enabled
|
||||
config quickassist-c2xxx-enabled
|
||||
bool
|
||||
default y if PACKAGE_quickassist-c2xxx
|
||||
default n
|
||||
endef
|
||||
|
||||
define Package/quickassist-c2xxx/description
|
||||
Intel Quick Assist v1.5 utilities and firmware for c2xxx series SoCs
|
||||
endef
|
||||
|
||||
#
|
||||
# QAT 1.5 kernel driver
|
||||
#
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Intel Quick Assist Technology Drivers
|
||||
DEPENDS:= \
|
||||
@TARGET_x86_64 \
|
||||
@LINUX_4_14 \
|
||||
+libc \
|
||||
+libpthread \
|
||||
+libopenssl \
|
||||
+kmod-crypto-manager \
|
||||
+kmod-crypto-cbc \
|
||||
+kmod-crypto-sha1 \
|
||||
+kmod-crypto-sha256 \
|
||||
+kmod-crypto-sha512
|
||||
FILES:=$(PKG_BUILD_DIR)/build/icp_qa_al.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx/description
|
||||
Kernel driver for Intel Quick Assist Technology c2xxx
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx/config
|
||||
depends on quickassist-c2xxx-enabled
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
#
|
||||
# QAT 1.7 contiguous pinned memory driver
|
||||
#
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx-usdm
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Quick Assist Pinned Memory Driver
|
||||
DEPENDS:= \
|
||||
@TARGET_x86_64 \
|
||||
@LINUX_4_14
|
||||
FILES:=$(PKG_BUILD_DIR)/build/usdm_drv.ko
|
||||
AUTOLOAD:=$(call AutoProbe,usdm_drv)
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx-usdm/config
|
||||
depends on quickassist-c2xxx-enabled
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c2xxx-usdm/description
|
||||
Contiguous pinned memory driver for Intel Quick Assist Technology
|
||||
endef
|
||||
|
||||
ICP_ARCH = x86_64
|
||||
MAKE_PATH = quickassist
|
||||
MAKE_FLAGS = ARCH_USER="$(ICP_ARCH)"
|
||||
|
||||
MAKE_VARS += ICP_ROOT="$(PKG_BUILD_DIR)" \
|
||||
CROSS_COMPILE="$(KERNEL_CROSS)" \
|
||||
KERNEL_SOURCE_ROOT="$(LINUX_DIR)" \
|
||||
MACHINE="$(ICP_ARCH)" \
|
||||
ICP_BUILD_OUTPUT="$(PKG_BUILD_DIR)/build" \
|
||||
ICP_ENV_DIR="$(PKG_BUILD_DIR)/quickassist/build_system/build_files/env_files" \
|
||||
ICP_BUILDSYSTEM_PATH="$(PKG_BUILD_DIR)/quickassist/build_system" \
|
||||
ICP_TOOLS_TARGET="accelcomp" \
|
||||
ICP_NONBLOCKING_PARTIALS_PERFORM="1" \
|
||||
ICP_ARCH_USER="$(ICP_ARCH)" \
|
||||
LIB_SHARED_FLAGS="-L$(STAGING_DIR)/usr/lib" \
|
||||
LD_LIBRARY_PATH="$(PKG_BUILD_DIR)/build"
|
||||
|
||||
define Build/Prepare
|
||||
(mkdir -p '$(PKG_BUILD_DIR)' && zcat '$(DL_DIR)/$(PKG_SOURCE)' | tar -C '$(PKG_BUILD_DIR)' -xf -)
|
||||
$(Build/Patch)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default)
|
||||
$(call Build/Compile/Default, -C $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/src/sample_code perf_all)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/icp/quickassist
|
||||
$(INSTALL_DIR) $(1)/usr/icp/build
|
||||
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/include/{*.h,dc,lac} $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/include/*.h $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist $(1)/usr/icp
|
||||
$(CP) $(PKG_BUILD_DIR)/build $(1)/usr/icp
|
||||
endef
|
||||
|
||||
define Package/quickassist/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/lib/firmware
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/quickassist/QAT1.5/config
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/config/* $(1)/usr/share/quickassist/QAT1.5/config
|
||||
$(CP) $(PKG_BUILD_DIR)/build/adf_ctl $(1)/usr/sbin/adf_ctl
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/adf/build/linux_2.6/icp_gige_watchdog $(1)/usr/sbin/icp_gige_watchdog
|
||||
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/*.bin $(1)/lib/firmware/
|
||||
$(CP) ./files/qat.init $(1)/etc/init.d/qat
|
||||
$(CP) ./files/qat_watchdog.init $(1)/etc/init.d/qat_watchdog
|
||||
$(CP) ./files/c2xxx_qa_dev0_single_ae.conf $(1)/etc/c2xxx_qa_dev0.conf
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickassist-c2xxx))
|
||||
$(eval $(call KernelPackage,crypto-qat-c2xxx))
|
||||
$(eval $(call KernelPackage,crypto-qat-c2xxx-usdm))
|
@ -0,0 +1,175 @@
|
||||
#########################################################################
|
||||
#
|
||||
# @par
|
||||
# # This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
# redistributing this file, you may do so under either license.
|
||||
#
|
||||
# GPL LICENSE SUMMARY
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# The full GNU General Public License is included in this distribution
|
||||
# in the file called LICENSE.GPL.
|
||||
#
|
||||
# Contact Information:
|
||||
# Intel Corporation
|
||||
#
|
||||
# BSD LICENSE
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Intel Corporation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
#
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
########################################################
|
||||
# General Section
|
||||
##############################################
|
||||
|
||||
[GENERAL]
|
||||
ServicesEnabled = cy0
|
||||
|
||||
# Use version 2 of the config file
|
||||
ConfigVersion = 2
|
||||
|
||||
# Look Aside Cryptographic Configuration
|
||||
cyHmacAuthMode = 1
|
||||
|
||||
# Firmware Location Configuration
|
||||
Firmware_MofPath = mof_firmware_c2xxx.bin
|
||||
Firmware_MmpPath = mmp_firmware_c2xxx.bin
|
||||
|
||||
#Default values for number of concurrent requests*/
|
||||
CyNumConcurrentSymRequests = 512
|
||||
CyNumConcurrentAsymRequests = 64
|
||||
|
||||
#Statistics, valid values: 1,0
|
||||
statsGeneral = 1
|
||||
statsDh = 1
|
||||
statsDrbg = 1
|
||||
statsDsa = 1
|
||||
statsEcc = 1
|
||||
statsKeyGen = 1
|
||||
statsLn = 1
|
||||
statsPrime = 1
|
||||
statsRsa = 1
|
||||
statsSym = 1
|
||||
|
||||
#Debug feature, if set to 1 it enables additional entries in /proc filesystem
|
||||
ProcDebug = 1
|
||||
|
||||
|
||||
#######################################################
|
||||
# Wireless Section
|
||||
#######################################################
|
||||
[WIRELESS]
|
||||
NumProcesses = 0
|
||||
|
||||
#######################################################
|
||||
#
|
||||
# Logical Instances Section
|
||||
# A logical instance allows each address domain
|
||||
# (kernel space and individual user space processes)
|
||||
# to configure rings (i.e. hardware assisted queues)
|
||||
# to be used by that address domain and to define the
|
||||
# behavior of that ring.
|
||||
#
|
||||
# The address domains are in the following format
|
||||
# - For kernel address domains
|
||||
# [KERNEL]
|
||||
# - For user process address domains
|
||||
# [xxxxx]
|
||||
# Where xxxxx may be any ascii value which uniquely identifies
|
||||
# the user mode process.
|
||||
# To allow the driver correctly configure the
|
||||
# logical instances associated with this user process,
|
||||
# the process must call the icp_sal_userStart(...)
|
||||
# passing the xxxxx string during process initialisation.
|
||||
# When the user space process is finish it must call
|
||||
# icp_sal_userStop(...) to free resources.
|
||||
# NumProcesses will indicate the maximum number of processes
|
||||
# that can call icp_sal_userStart on this instance.
|
||||
# Warning: the ressources are preallocated: if NumProcesses
|
||||
# is too high, the driver will fail to load
|
||||
#
|
||||
# Items configurable by a logical instance are:
|
||||
# - Name of the logical instance
|
||||
# - The accelerator associated with this logical
|
||||
# instance
|
||||
# - The core the instance is affinitized to (optional)
|
||||
#
|
||||
# Note: Logical instances may not share the same ring, but
|
||||
# may share a ring bank.
|
||||
#
|
||||
# The format of the logical instances are:
|
||||
# - For crypto:
|
||||
# Cy<n>Name = "xxxx"
|
||||
# Cy<n>AcceleratorNumber = 0-1
|
||||
# Cy<n>CoreAffinity = 0-7
|
||||
#
|
||||
# Note: for user space processes, a list of values can be specified for
|
||||
# the core affinity: for example
|
||||
# Cy0CoreAffinity = 0,2,4
|
||||
#
|
||||
# Where:
|
||||
# - n is the number of this logical instance starting at 0.
|
||||
# - xxxx may be any ascii value which identifies the logical instance.
|
||||
#
|
||||
########################################################
|
||||
|
||||
##############################################
|
||||
# Kernel Instances Section
|
||||
##############################################
|
||||
[KERNEL]
|
||||
NumberCyInstances = 0
|
||||
|
||||
##############################################
|
||||
# Compression multi thread/process section
|
||||
##############################################
|
||||
[SHIM]
|
||||
NumberCyInstances = 1
|
||||
NumProcesses = 8
|
||||
LimitDevAccess = 1
|
||||
|
||||
# Crypto - User space
|
||||
Cy0Name = "UserCY0"
|
||||
Cy0AcceleratorNumber = 0
|
||||
Cy0IsPolled = 1
|
||||
Cy0CoreAffinity = 0
|
140
package/qat/firmware/quickassist-c2xxx/files/qat.init
Executable file
140
package/qat/firmware/quickassist-c2xxx/files/qat.init
Executable file
@ -0,0 +1,140 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Adapted from Intel QAT1.5 qat_service. Portions copyright Intel Corporation
|
||||
|
||||
#################################################################
|
||||
#
|
||||
# This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
# redistributing this file, you may do so under either license.
|
||||
#
|
||||
# GPL LICENSE SUMMARY
|
||||
#
|
||||
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# The full GNU General Public License is included in this distribution
|
||||
# in the file called LICENSE.GPL.
|
||||
#
|
||||
# Contact Information:
|
||||
# Intel Corporation
|
||||
#
|
||||
# BSD LICENSE
|
||||
#
|
||||
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Intel Corporation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
#
|
||||
#
|
||||
# version: QAT1.5.L.1.10.0-80
|
||||
#
|
||||
#################################################################
|
||||
|
||||
# qat Start/Stop the Intel QAT.
|
||||
#
|
||||
# description: modprobe the QAT icp_qa_al.ko, which loads dependant \
|
||||
# modules, before calling the user space \
|
||||
# utility to pass configuration parameters
|
||||
|
||||
START=29
|
||||
STOP=99
|
||||
|
||||
PROG=/usr/sbin/adf_ctl
|
||||
KMOD=icp_qa_al
|
||||
NETKEY=icp_qat_netkey.ko
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Show the status of the qat device"
|
||||
|
||||
status() {
|
||||
|
||||
${PROG} status
|
||||
if [ "$?" -ne 0 ]
|
||||
then
|
||||
echo "No devices found. Please start the driver using:"
|
||||
echo "$0 start"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
# First check if the modules are already installed
|
||||
# install them as necessary and if they are LKMs
|
||||
# and not built-in kernel modules
|
||||
|
||||
if [ `lsmod | grep -c "sha512"` == 0 ]; then
|
||||
if [ `cat /proc/kallsyms |grep -c sha512_generic` == 0 ]; then
|
||||
`modprobe sha512`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ `lsmod | grep -c "sha256"` == 0 ]; then
|
||||
if [ `cat /proc/kallsyms |grep -c sha256_generic` == 0 ]; then
|
||||
`modprobe sha256`
|
||||
fi
|
||||
fi
|
||||
|
||||
lsmod | grep ${KMOD} >/dev/null 2>&1 || modprobe ${KMOD}
|
||||
|
||||
# Check device status, try to turn it on only if driver is loaded
|
||||
|
||||
${PROG} $2 status | grep state=down >/dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
${PROG} $2 up
|
||||
fi
|
||||
|
||||
# lsmod | grep ${NETKEY} >/dev/null 2>&1 || modprobe ${NETKEY} 2> /dev/null
|
||||
|
||||
# Show device status
|
||||
|
||||
${PROG} $2 status
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
${PROG} $2 down
|
||||
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
||||
${PROG} $2 down && ${PROG} $2 up
|
||||
|
||||
}
|
||||
|
119
package/qat/firmware/quickassist-c2xxx/files/qat_watchdog.init
Executable file
119
package/qat/firmware/quickassist-c2xxx/files/qat_watchdog.init
Executable file
@ -0,0 +1,119 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
|
||||
#################################################################
|
||||
#
|
||||
# This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
# redistributing this file, you may do so under either license.
|
||||
#
|
||||
# GPL LICENSE SUMMARY
|
||||
#
|
||||
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# The full GNU General Public License is included in this distribution
|
||||
# in the file called LICENSE.GPL.
|
||||
#
|
||||
# Contact Information:
|
||||
# Intel Corporation
|
||||
#
|
||||
# BSD LICENSE
|
||||
#
|
||||
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Intel Corporation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
#
|
||||
#
|
||||
# version: QAT1.5.L.1.10.0-80
|
||||
#
|
||||
#################################################################
|
||||
|
||||
|
||||
|
||||
START=99
|
||||
STOP=99
|
||||
|
||||
PROG=/usr/sbin/icp_gige_watchdog
|
||||
PID="`ps | grep ${PROG} | grep -v grep | awk '{print $1}'`"
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Show the status of the qat device"
|
||||
|
||||
status() {
|
||||
|
||||
if [ -z "$PID" ]
|
||||
then
|
||||
echo "${PROG} not running"
|
||||
else
|
||||
echo "${PROG} running: ${PID}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
if [ -z "$PID" ]
|
||||
then
|
||||
${PROG} &
|
||||
else
|
||||
echo "Already running pid: ${PID}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
if [ -z "$PID" ]
|
||||
then
|
||||
echo "${PROG} not running"
|
||||
else
|
||||
kill -USR1 ${PID}
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
||||
stop
|
||||
start
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,360 @@
|
||||
--- a/quickassist/adf/accel_mgr/src/adf_cfg.c
|
||||
+++ b/quickassist/adf/accel_mgr/src/adf_cfg.c
|
||||
@@ -545,9 +545,10 @@ CpaStatus adf_cfgAddKeyValueParam(icp_ac
|
||||
}
|
||||
else if(ADF_HEX == type)
|
||||
{
|
||||
- value_addr = (Cpa64U *)val;
|
||||
- snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
|
||||
- "0x%p", value_addr);
|
||||
+// value_addr = (Cpa64U *)val;
|
||||
+// snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
|
||||
+// "0x%p", value_addr);
|
||||
+ snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,"0x%lx", (uintptr_t)val);
|
||||
}
|
||||
else
|
||||
{
|
||||
--- a/quickassist/adf/accelengine/src/adf_ae.c
|
||||
+++ b/quickassist/adf/accelengine/src/adf_ae.c
|
||||
@@ -222,6 +222,7 @@ CpaStatus adf_aeFwLoad(icp_accel_dev_t *
|
||||
/* Get the UoF FW and Map the memory to the AEs */
|
||||
status = adf_aefwGetFirmware(pAccelDev, ADF_FW_UOF_TYPE, &addr, &size);
|
||||
ICP_CHECK_STATUS(status);
|
||||
+
|
||||
/* load ucode for patching, ucode_map */
|
||||
status = adf_aeUcodeMap(pAccelDev, addr, size);
|
||||
if (CPA_STATUS_SUCCESS != status)
|
||||
--- a/quickassist/adf/accelengine/src/adf_ae_fw.c
|
||||
+++ b/quickassist/adf/accelengine/src/adf_ae_fw.c
|
||||
@@ -147,7 +147,6 @@ CpaStatus adf_aefwLoadFirmware(icp_accel
|
||||
return CPA_STATUS_FAIL;
|
||||
}
|
||||
ICP_MEMCPY(pUofFwAddr, pFwAddr, fwSize);
|
||||
-
|
||||
/*
|
||||
* Add the local copies to the config table.
|
||||
* When the memory address is needed again it can be queried from
|
||||
@@ -356,14 +355,13 @@ CpaStatus adf_aefwGetFirmware(icp_accel_
|
||||
status_addr = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
|
||||
ICP_CFG_UOF_ADDRESS_KEY, config_value);
|
||||
*pAddr = (void *)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_HEX);
|
||||
- status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
|
||||
+ status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
|
||||
ICP_CFG_UOF_SIZE_BYTES_KEY, config_value);
|
||||
*pSize = (Cpa32U)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_DEC);
|
||||
break;
|
||||
case ADF_FW_MMP_TYPE:
|
||||
status_addr = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
|
||||
ICP_CFG_MMP_ADDRESS_KEY, config_value);
|
||||
- *pAddr = (void *)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_HEX);
|
||||
status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
|
||||
ICP_CFG_MMP_SIZE_BYTES_KEY, config_value);
|
||||
*pSize = (Cpa32U)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_DEC);
|
||||
--- a/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_drv.c
|
||||
+++ b/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_drv.c
|
||||
@@ -911,7 +911,7 @@ int adf_restore_dev(icp_accel_dev_t *acc
|
||||
ADF_ERROR("Can not issue secondary bus reset\n");
|
||||
ADF_ERROR("Trying FLR\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
|
||||
- ret = __pci_reset_function(pdev);
|
||||
+ ret = pci_reset_function(pdev);
|
||||
if (ret) {
|
||||
ADF_ERROR("Could not reset device\n");
|
||||
return ret;
|
||||
--- a/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_isr.c
|
||||
+++ b/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_isr.c
|
||||
@@ -214,7 +214,7 @@ STATIC int adf_enable_msix(icp_accel_dev
|
||||
(hw_data->msix.aeVectorStart - hw_data->msix.banksVectorNum);
|
||||
}
|
||||
|
||||
- stat = pci_enable_msix(pci_dev_info->pDev,
|
||||
+ stat = pci_enable_msix_exact(pci_dev_info->pDev,
|
||||
pci_dev_info->msixEntries.value,
|
||||
msix_num_entries);
|
||||
if (SUCCESS != stat){
|
||||
--- a/quickassist/adf/drivers/common/linux/src/adf_dev_csr.c
|
||||
+++ b/quickassist/adf/drivers/common/linux/src/adf_dev_csr.c
|
||||
@@ -80,6 +80,7 @@
|
||||
#include "adf_dev_csr.h"
|
||||
#include "adf_platform.h"
|
||||
#include <linux/mutex.h>
|
||||
+#include <linux/sched/signal.h>
|
||||
|
||||
#define ADF_DEV_CSR_NAME ("icp_dev_csr")
|
||||
#define ADF_DEV_CSR_MAX_MINOR (255)
|
||||
--- a/quickassist/adf/drivers/common/linux/src/adf_dev_ring.c
|
||||
+++ b/quickassist/adf/drivers/common/linux/src/adf_dev_ring.c
|
||||
@@ -87,6 +87,7 @@
|
||||
#include "icp_adf_init.h"
|
||||
#include "icp_adf_cfg.h"
|
||||
#include "adf_proc_debug.h"
|
||||
+#include <linux/sched/signal.h>
|
||||
|
||||
#define ADF_DEV_RING_NAME ("icp_dev_ring")
|
||||
#define ADF_DEV_RING_MAX_MINOR (255)
|
||||
--- a/quickassist/adf/drivers/common/linux/src/adf_gige_wd_drv.c
|
||||
+++ b/quickassist/adf/drivers/common/linux/src/adf_gige_wd_drv.c
|
||||
@@ -76,6 +76,8 @@
|
||||
#include "adf_platform.h"
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/completion.h>
|
||||
+#include <linux/sched/signal.h>
|
||||
+
|
||||
/* Character Device Driver Name */
|
||||
#define DEVICE_NAME "icp_adf_gige_wd"
|
||||
#define COMPLETION_TIME 5000
|
||||
--- a/quickassist/adf/drivers/common/linux/src/adf_proc_debug.c
|
||||
+++ b/quickassist/adf/drivers/common/linux/src/adf_proc_debug.c
|
||||
@@ -132,17 +132,13 @@ static int adf_debug_show(struct seq_fil
|
||||
{
|
||||
debug_file_info_t* file_info = sfile->private;
|
||||
if (file_info && file_info->seq_read && file_info->page) {
|
||||
- int ret = 0, old_offset = file_info->offset;
|
||||
- file_info->offset =
|
||||
- file_info->seq_read(file_info->private_data,
|
||||
- file_info->page, PAGE_SIZE - 1,
|
||||
- file_info->offset);
|
||||
- ret = seq_puts(sfile, (char*)file_info->page);
|
||||
- if (ret) {
|
||||
- /* run out of space - need to reprint */
|
||||
- file_info->offset = old_offset;
|
||||
- }
|
||||
+ file_info->offset =
|
||||
+ file_info->seq_read(file_info->private_data,
|
||||
+ file_info->page, PAGE_SIZE - 1,
|
||||
+ file_info->offset);
|
||||
+ seq_puts(sfile, (char*)file_info->page);
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/quickassist/adf/include/icp_adf_transport_dp.h
|
||||
+++ b/quickassist/adf/include/icp_adf_transport_dp.h
|
||||
@@ -79,7 +79,7 @@
|
||||
* Data plain support function - returns the pointer to next message on the ring
|
||||
* or NULL if there is not enough space.
|
||||
*/
|
||||
-inline void icp_adf_getQueueMemory(icp_comms_trans_handle trans_handle,
|
||||
+void icp_adf_getQueueMemory(icp_comms_trans_handle trans_handle,
|
||||
Cpa32U numberRequests,
|
||||
void** pCurrentQatMsg);
|
||||
/*
|
||||
@@ -87,7 +87,7 @@ inline void icp_adf_getQueueMemory(icp_c
|
||||
* Data plain support function - returns the pointer to next message on the ring
|
||||
* or NULL if there is not enough space - it also updates the shadow tail copy.
|
||||
*/
|
||||
-inline void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_handle,
|
||||
+void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_handle,
|
||||
void** pCurrentQatMsg);
|
||||
|
||||
/*
|
||||
@@ -95,26 +95,26 @@ inline void icp_adf_getSingleQueueAddr(i
|
||||
* Data plain support function - increments the tail pointer and returns
|
||||
* the pointer to next message on the ring.
|
||||
*/
|
||||
-inline void icp_adf_getQueueNext(icp_comms_trans_handle trans_handle,
|
||||
+void icp_adf_getQueueNext(icp_comms_trans_handle trans_handle,
|
||||
void** pCurrentQatMsg);
|
||||
|
||||
/*
|
||||
* icp_adf_updateQueueTail
|
||||
* Data plain support function - Writes the tail shadow copy to the device.
|
||||
*/
|
||||
-inline void icp_adf_updateQueueTail(icp_comms_trans_handle trans_handle);
|
||||
+void icp_adf_updateQueueTail(icp_comms_trans_handle trans_handle);
|
||||
|
||||
/*
|
||||
* icp_adf_isRingEmpty
|
||||
* Data plain support function - check if the ring is empty
|
||||
*/
|
||||
-inline CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_handle);
|
||||
+CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_handle);
|
||||
|
||||
/*
|
||||
* icp_adf_pollQueue
|
||||
* Data plain support function - Poll messages from the queue.
|
||||
*/
|
||||
-inline CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_handle,
|
||||
+CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_handle,
|
||||
Cpa32U response_quota);
|
||||
|
||||
/*
|
||||
@@ -123,6 +123,6 @@ inline CpaStatus icp_adf_pollQueue(icp_c
|
||||
* send. This should only be called on request rings. If the function returns
|
||||
* true then it is ok to call icp_adf_updateQueueTail() function on this ring.
|
||||
*/
|
||||
-inline CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd);
|
||||
+CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd);
|
||||
|
||||
#endif /* ICP_ADF_TRANSPORT_DP_H */
|
||||
--- a/quickassist/adf/include/icp_platform_linux.h
|
||||
+++ b/quickassist/adf/include/icp_platform_linux.h
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/cdev.h>
|
||||
-#include <asm/uaccess.h>
|
||||
+#include <linux/uaccess.h>
|
||||
|
||||
#include "Osal.h"
|
||||
|
||||
--- a/quickassist/adf/user/user_proxy/src/adf_user_ETring_mgr_dp.c
|
||||
+++ b/quickassist/adf/user/user_proxy/src/adf_user_ETring_mgr_dp.c
|
||||
@@ -84,7 +84,7 @@
|
||||
* Data plain support function - returns the pointer to next message on the ring
|
||||
* or NULL if there is not enough space.
|
||||
*/
|
||||
-inline void icp_adf_getQueueMemory(icp_comms_trans_handle trans_hnd,
|
||||
+void icp_adf_getQueueMemory(icp_comms_trans_handle trans_hnd,
|
||||
Cpa32U numberRequests,
|
||||
void** pCurrentQatMsg)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ inline void icp_adf_getQueueMemory(icp_c
|
||||
* Data plane support function - returns the pointer to next message on the ring
|
||||
* or NULL if there is not enough space - it also updates the shadow tail copy.
|
||||
*/
|
||||
-inline void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_hnd,
|
||||
+void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_hnd,
|
||||
void** pCurrentQatMsg)
|
||||
{
|
||||
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
@@ -147,7 +147,7 @@ inline void icp_adf_getSingleQueueAddr(i
|
||||
* Data plain support function - increments the tail pointer and returns
|
||||
* the pointer to next message on the ring.
|
||||
*/
|
||||
-inline void icp_adf_getQueueNext(icp_comms_trans_handle trans_hnd,
|
||||
+void icp_adf_getQueueNext(icp_comms_trans_handle trans_hnd,
|
||||
void** pCurrentQatMsg)
|
||||
{
|
||||
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
@@ -168,7 +168,7 @@ inline void icp_adf_getQueueNext(icp_com
|
||||
* icp_adf_updateQueueTail
|
||||
* Data plain support function - Writes the tail shadow copy to the device.
|
||||
*/
|
||||
-inline void icp_adf_updateQueueTail(icp_comms_trans_handle trans_hnd)
|
||||
+void icp_adf_updateQueueTail(icp_comms_trans_handle trans_hnd)
|
||||
{
|
||||
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
icp_accel_dev_t *accel_dev = (icp_accel_dev_t*) pRingHandle->accel_dev;
|
||||
@@ -183,7 +183,7 @@ inline void icp_adf_updateQueueTail(icp_
|
||||
* icp_adf_isRingEmpty
|
||||
* Data plain support function - check if the ring is empty
|
||||
*/
|
||||
-inline CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_hnd)
|
||||
+CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_hnd)
|
||||
{
|
||||
Cpa32U mask = 0;
|
||||
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
@@ -205,7 +205,7 @@ inline CpaBoolean icp_adf_isRingEmpty(ic
|
||||
* * icp_adf_pollQueue
|
||||
* * Data plain support function - Poll messages from the queue.
|
||||
* */
|
||||
-inline CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_hnd,
|
||||
+CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_hnd,
|
||||
Cpa32U response_quota)
|
||||
{
|
||||
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
@@ -260,7 +260,7 @@ inline CpaStatus icp_adf_pollQueue(icp_c
|
||||
* send. This should only be called on request rings. If the function returns
|
||||
* true then it is ok to call icp_adf_updateQueueTail() function on this ring.
|
||||
*/
|
||||
-inline CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd)
|
||||
+CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd)
|
||||
{
|
||||
adf_dev_ring_handle_t *ringData = (adf_dev_ring_handle_t *)trans_hnd;
|
||||
icp_accel_dev_t *accel_dev = (icp_accel_dev_t*) ringData->accel_dev;
|
||||
--- a/quickassist/build_system/build_files/OS/linux_2.6_kernel_space_rules.mk
|
||||
+++ b/quickassist/build_system/build_files/OS/linux_2.6_kernel_space_rules.mk
|
||||
@@ -73,15 +73,15 @@ endif
|
||||
$(LIB_STATIC): dirs
|
||||
@echo 'Creating static library ${LIB_STATIC}'; \
|
||||
$(MAKE) -C $(KERNEL_SOURCE_ROOT)/ M=$(PWD) obj-m=""; \
|
||||
- echo 'Copying outputs';\
|
||||
+ echo 'Copying outputs $(OBJ)';\
|
||||
+ test -f lib.a && (ar -t lib.a | xargs ar -rcsD $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC)); \
|
||||
mv -f $(OBJ) $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
|
||||
test -f built-in.o && mv -f built-in.o $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
|
||||
- test -f lib.a && mv lib.a $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC);\
|
||||
+ test -f $($(PROG_ACY)_FINAL_OUTPUT_DIR)/lib.a && mv $($(PROG_ACY)_FINAL_OUTPUT_DIR)/lib.a $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC);\
|
||||
test -f $(OUTPUT_NAME).ko && mv -f $(OUTPUT_NAME).ko $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
|
||||
test -f $(OUTPUT_NAME).o && mv -f $(OUTPUT_NAME).o $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
|
||||
$(RM) -rf *.mod.* .*.cmd;
|
||||
|
||||
-
|
||||
$(MODULENAME): dirs
|
||||
@echo 'Creating kernel module'; \
|
||||
$(MAKE) -C $(KERNEL_SOURCE_ROOT)/ M=$(PWD); \
|
||||
--- a/quickassist/lookaside/access_layer/src/sample_code/fips/cpa_fips_sample.h
|
||||
+++ b/quickassist/lookaside/access_layer/src/sample_code/fips/cpa_fips_sample.h
|
||||
@@ -109,7 +109,7 @@ extern "C"
|
||||
#include <linux/string.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/sched.h>
|
||||
-#include <asm/uaccess.h>
|
||||
+#include <linux/uaccess.h>
|
||||
#else /*KERNEL_SPACE*/
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
--- a/quickassist/lookaside/access_layer/src/sample_code/performance/qae/linux/kernel_space/qae_mem_drv.c
|
||||
+++ b/quickassist/lookaside/access_layer/src/sample_code/performance/qae/linux/kernel_space/qae_mem_drv.c
|
||||
@@ -85,7 +85,7 @@
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
||||
-#include <asm/uaccess.h>
|
||||
+#include <linux/uaccess.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
--- a/quickassist/utilities/downloader/Target_CoreLibs/halAe/icp_firml_interface.c
|
||||
+++ b/quickassist/utilities/downloader/Target_CoreLibs/halAe/icp_firml_interface.c
|
||||
@@ -185,7 +185,7 @@ icp_FirmLoader_MapMofAddr(void *handle,
|
||||
int status = ICP_FIRMLOADER_SUCCESS;
|
||||
|
||||
myHandle = (icp_firml_handle_t *)handle;
|
||||
-
|
||||
+
|
||||
status = UcLo_MapMofAddr(myHandle, filePtr, fileSize,
|
||||
uofName, (char **)uofPtr, uofSize);
|
||||
|
||||
--- a/quickassist/utilities/downloader/Target_CoreLibs/uclo/uclo_mof.c
|
||||
+++ b/quickassist/utilities/downloader/Target_CoreLibs/uclo/uclo_mof.c
|
||||
@@ -582,6 +582,7 @@ UcLo_MapMofAddr (icp_firml_handle_t *han
|
||||
/* UOF_FID (0xc6c2) for uof object
|
||||
* SUOF_FID for suof object
|
||||
*/
|
||||
+
|
||||
if ((((uof_fileHdr_T *) mofPtr)->fileId == UOF_FID) ||
|
||||
(((suof_fileHdr_T *) mofPtr)->fileId == SUOF_FID))
|
||||
{
|
||||
@@ -599,7 +600,6 @@ UcLo_MapMofAddr (icp_firml_handle_t *han
|
||||
/* return BADOBJ if neither UOF/SUOF nor MOF */
|
||||
else if (((mof_fileHdr_T *)mofPtr)->fileId != MOF_FID)
|
||||
{
|
||||
- PRINTF("unsupported file format\n");
|
||||
return (UCLO_BADOBJ);
|
||||
}
|
||||
|
||||
--- a/quickassist/utilities/osal/src/linux/kernel_space/OsalUsrKrlProxy.c
|
||||
+++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalUsrKrlProxy.c
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
-#include <asm/uaccess.h>
|
||||
+#include <linux/uaccess.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
--- a/quickassist/utilities/osal/src/linux/user_space/OsalCryptoInterface.c
|
||||
+++ b/quickassist/utilities/osal/src/linux/user_space/OsalCryptoInterface.c
|
||||
@@ -78,7 +78,7 @@ OSAL_STATUS
|
||||
osalHashSHA1(UINT8 *in, UINT8 *out)
|
||||
{
|
||||
SHA_CTX ctx;
|
||||
- if(!SHA_Init(&ctx))
|
||||
+ if(!SHA1_Init(&ctx))
|
||||
{
|
||||
return OSAL_FAIL;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
104
package/qat/firmware/quickassist-c3xxx/Config.in
Normal file
104
package/qat/firmware/quickassist-c3xxx/Config.in
Normal file
@ -0,0 +1,104 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_quickassist-c3xxx
|
||||
|
||||
config QAT_C3XXX_KERNEL_OPTIONS
|
||||
bool
|
||||
default y
|
||||
prompt "Required kernel options for Quickassist"
|
||||
select KERNEL_ASN1
|
||||
select KERNEL_CRYPTO_AKCIPHER
|
||||
select KERNEL_CRYPTO_AKCIPHER2
|
||||
select KERNEL_CRYPTO_DH
|
||||
select KERNEL_CRYPTO_HW
|
||||
select KERNEL_CRYPTO_KPP
|
||||
select KERNEL_CRYPTO_KPP2
|
||||
select KERNEL_CRYPTO_RSA
|
||||
select KERNEL_UIO
|
||||
select KERNEL_PCI_IOV
|
||||
select KERNEL_HUGETLBFS
|
||||
select KERNEL_HUGETLB_PAGE
|
||||
help
|
||||
These kernel options are required for successful compilation and runtime functionality.
|
||||
|
||||
config QAT_DEBUG
|
||||
bool
|
||||
default n
|
||||
prompt "Build with debugging support enabled"
|
||||
|
||||
config QAT_DISABLE_STATS
|
||||
bool
|
||||
default n
|
||||
prompt "Disable statistics collection"
|
||||
help
|
||||
Disable for performance optimization
|
||||
|
||||
config QAT_LOG_SYSLOG
|
||||
bool
|
||||
default y
|
||||
prompt "Debug to syslog instead of stdout"
|
||||
|
||||
config QAT_PARAM_CHECK
|
||||
bool
|
||||
default y
|
||||
prompt "Enable parameter checking in the top-level APIs"
|
||||
help
|
||||
Disable for performance optimization
|
||||
|
||||
config QAT_NONBLOCKING_PARTIALS
|
||||
bool
|
||||
default y
|
||||
prompt "Partial operation results are non-blocking"
|
||||
help
|
||||
Disable for performance optimization
|
||||
|
||||
config QAT_DC_ONLY
|
||||
bool
|
||||
default n
|
||||
prompt "Build acceleration only for compression"
|
||||
help
|
||||
Optimize for size if using only compression
|
||||
|
||||
config QAT_DC_SYM_ONLY
|
||||
bool
|
||||
default n
|
||||
prompt "Build acceleration only for compression and symmetric ciphers"
|
||||
help
|
||||
Optimize for size if using only compression and symmetric ciphers
|
||||
|
||||
config QAT_DC_COUNTER_ERROR
|
||||
bool
|
||||
default n
|
||||
prompt "Update counters when encountering an error"
|
||||
help
|
||||
Enables updates of consumed/produced results in case
|
||||
of error during compression or decompression operations
|
||||
|
||||
config QAT_DISABLE_INLINE
|
||||
bool
|
||||
default n
|
||||
prompt "Disable functioning inlining for functions that cannot be inlined by the compiler"
|
||||
help
|
||||
Use where kernel does not support CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING to allow building
|
||||
|
||||
config QAT_HB_FAIL
|
||||
bool
|
||||
default n
|
||||
prompt "Enable heartbeat failure simulation"
|
||||
|
||||
config QAT_COEXIST
|
||||
bool
|
||||
default n
|
||||
prompt "Enable legacy and upstream driver coexistence"
|
||||
|
||||
config QAT_LKCF
|
||||
bool
|
||||
default y
|
||||
prompt "Enable QAT registration with Linux Kernel Crypto Framework"
|
||||
|
||||
config QAT_DISABLE_STRICT
|
||||
bool
|
||||
default n
|
||||
prompt "Disable strict mode for data compression"
|
||||
|
||||
endmenu
|
||||
|
97
package/qat/firmware/quickassist-c3xxx/Config.kernel
Normal file
97
package/qat/firmware/quickassist-c3xxx/Config.kernel
Normal file
@ -0,0 +1,97 @@
|
||||
config KERNEL_ASN1
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_AKCIPHER
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_AKCIPHER2
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_DH
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_KPP
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_KPP2
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_RSA
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_HUGETLBFS
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_HUGETLB_PAGE
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_CRYPTO_HW
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_PCI_IOV
|
||||
bool
|
||||
default n
|
||||
|
||||
# CONFIG_UIO is not set in generic and x86 kernels
|
||||
# Avoid prompting the user for input of dependent symbols
|
||||
|
||||
config KERNEL_UIO_CIF
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_PDRV_GENIRQ
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_DMEM_GENIRQ
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_AEC
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_SERCOS3
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_PCI_GENERIC
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_NETX
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_PRUSS
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_MF624
|
||||
bool
|
||||
default n
|
||||
|
||||
config KERNEL_UIO_HV_GENERIC
|
||||
bool
|
||||
default n
|
||||
|
||||
# CONFIG_STAGING is set in generic
|
||||
# CONFIG_KPC2000 depends on PCI and UIO
|
||||
|
||||
config KERNEL_KPC2000
|
||||
bool
|
||||
default n
|
236
package/qat/firmware/quickassist-c3xxx/Makefile
Normal file
236
package/qat/firmware/quickassist-c3xxx/Makefile
Normal file
@ -0,0 +1,236 @@
|
||||
#
|
||||
# Copyright (C) Ian Cooper <iancooper@hotmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=quickassist-c3xxx
|
||||
|
||||
PKG_VERSION:=1.7
|
||||
PKG_MINOR_VERSION:=L.4.17.0-00002
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=QAT.$(PKG_MINOR_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloadmirror.intel.com/727448/
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL v3
|
||||
|
||||
PKG_BUILD_DEPENDS:=eudev openssl
|
||||
QAT_DEFAULT_DEPENDS:= @TARGET_x86_64
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_BUILD_PARALLEL:=0
|
||||
|
||||
QAT_BUILD = $(PKG_BUILD_DIR)/build
|
||||
QAT_BLDSYS = $(PKG_BUILD_DIR)/quickassist/build_system
|
||||
QAT_OOT = $(PKG_BUILD_DIR)/quickassist/qat
|
||||
QAT_ADF = $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl
|
||||
QAT_ENV = $(PKG_BUILD_DIR)/quickassist/build_system/build_files/env_files
|
||||
|
||||
define Package/quickassist-c3xxx
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
TITLE:=Intel Quick Assist Technology for c3xxx SoC
|
||||
DEPENDS:= \
|
||||
$(QAT_DEFAULT_DEPENDS) \
|
||||
$(PKG_DEFAULT_DEPENDS) \
|
||||
+libopenssl \
|
||||
+libstdcpp \
|
||||
+eudev \
|
||||
+kmod-itco-wdt \
|
||||
+kmod-crypto-manager \
|
||||
+kmod-crypto-sha1 \
|
||||
+kmod-crypto-sha256 \
|
||||
+kmod-crypto-sha512 \
|
||||
+kmod-crypto-cbc \
|
||||
+kmod-crypto-qat-c3xxx \
|
||||
+kmod-crypto-qat-usdm \
|
||||
+kmod-crypto-qat-common \
|
||||
+kmod-crypto-qat-api
|
||||
USERID:=qat=555:qat=555
|
||||
endef
|
||||
|
||||
define Package/quickassist-c3xxx/description
|
||||
Intel Quick Assist v1.7 drivers and utilities for c3xxx series SoCs
|
||||
endef
|
||||
|
||||
define Package/quickassist-c3xxx/config
|
||||
source "$(SOURCE)/Config.kernel"
|
||||
source "$(SOURCE)/Config.in"
|
||||
config quickassist-c3xxx-enabled
|
||||
bool
|
||||
default y if PACKAGE_quickassist-c3xxx
|
||||
default n
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c3xxx
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Intel Quick Assist Technology Driver
|
||||
DEPENDS:= \
|
||||
$(QAT_DEFAULT_DEPENDS) \
|
||||
kmod-crypto-qat-common
|
||||
FILES:=$(QAT_OOT)/drivers/crypto/qat/qat_c3xxx/qat_c3xxx.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-c3xxx/description
|
||||
Kernel driver for Intel Quick Assist Technology c3xxx
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-common
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Intel Quick Assist Common Driver
|
||||
DEPENDS:= \
|
||||
$(QAT_DEFAULT_DEPENDS) \
|
||||
+kmod-crypto-authenc \
|
||||
+kmod-crypto-kpp
|
||||
FILES:=$(QAT_OOT)/drivers/crypto/qat/qat_common/intel_qat.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-common/description
|
||||
Kernel driver shared layer for Intel Quick Assist Technology c3xxx
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-common/config
|
||||
depends on quickassist-c3xxx-enabled
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-api
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Intel Quick Assist Kernel API
|
||||
DEPENDS:= \
|
||||
$(QAT_DEFAULT_DEPENDS) \
|
||||
kmod-crypto-qat-common
|
||||
FILES:=$(QAT_BUILD)/qat_api.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-api/description
|
||||
Kernel API for Intel Quick Assist Technology c3xxx
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-usdm
|
||||
SUBMENU:=Cryptographic API modules
|
||||
TITLE:=Intel Quick Assist Pinned Memory Driver
|
||||
DEPENDS:= \
|
||||
$(QAT_DEFAULT_DEPENDS) \
|
||||
kmod-crypto-qat-common
|
||||
FILES:=$(QAT_BUILD)/usdm_drv.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/crypto-qat-usdm/description
|
||||
Contiguous pinned memory driver for Intel Quick Assist Technology
|
||||
endef
|
||||
|
||||
ICP_ARCH = x86_64
|
||||
MAKE_PATH = quickassist
|
||||
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DEBUG) ,ICP_DEBUG="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_STATS) ,DISABLE_STATS="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_LOG_SYSLOG) ,ICP_LOG_SYSLOG="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_PARAM_CHECK) ,ICP_PARAM_CHECK="y",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_NONBLOCKING_PARTIALS) ,ICP_NONBLOCKING_PARTIALS_PERFORM="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DC_ONLY) ,ICP_DC_ONLY="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DC_ONLY) ,DO_CRYPTO="0",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DC_SYM_ONLY) ,ICP_DC_SYM_ONLY_AM="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DC_COUNTER_ERROR) ,ICP_DC_RETURN_COUNTERS_ON_ERROR="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_INLINE) ,ICP_DISABLE_INLINE="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_HB_FAIL) ,ICP_HB_FAIL_SYM="y",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_COEXIST) ,QAT_COEXISTENCE="y",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_LKCF) ,QAT_NO_LKCF="n",)
|
||||
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_STRICT) ,CNV_STRICT_MODE="1",)
|
||||
QAT_CONFIG += $(if $(CONFIG_PKG_CC_STACKPROTECTOR_NONE) ,ICP_DEFENSES_ENABLED="n",ICP_DEFENSES_ENABLED="y")
|
||||
|
||||
MAKE_VARS += ICP_ROOT="$(PKG_BUILD_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
CXX="$(TARGET_CXX)" \
|
||||
KERNEL_SOURCE_ROOT="$(LINUX_DIR)" \
|
||||
KERNEL_SOURCE_DIR="$(QAT_OOT)" \
|
||||
KDIR="$(LINUX_DIR)" \
|
||||
MACHINE="$(ICP_ARCH)" \
|
||||
USE_OPENSSL="1" \
|
||||
ICP_BUILD_OUTPUT="$(QAT_BUILD)" \
|
||||
ICP_ENV_DIR="$(QAT_ENV)" \
|
||||
ICP_BUILDSYSTEM_PATH="$(QAT_BLDSYS)" \
|
||||
ICP_TOOLS_TARGET="accelcomp" \
|
||||
$(QAT_CONFIG) \
|
||||
ICP_KAPI_M="1" \
|
||||
ICP_CORE="ia" \
|
||||
ICP_OS="linux_2.6" \
|
||||
ICP_ARCH_USER="$(ICP_ARCH)" \
|
||||
ICP_DEFENSES_ENABLED="n" \
|
||||
LIB_SHARED_FLAGS="-L $(STAGING_DIR)/lib -L $(STAGING_DIR)/usr/lib" \
|
||||
LD_LIBRARY_PATH="$(PKG_BUILD_DIR)/build"
|
||||
|
||||
# ICP_DEFENSES_ENABLED="$(ICP_DEFENSES_ENABLED)" \
|
||||
|
||||
define Build/Prepare
|
||||
(mkdir -p '$(PKG_BUILD_DIR)' && zcat '$(DL_DIR)/$(PKG_SOURCE)' | tar -C '$(PKG_BUILD_DIR)' -xf -)
|
||||
$(Build/Patch)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
# The shipped configure script is hopelessly broken for cross compilation environments
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@echo "QAT Build Configuration: $(QAT_CONFIG)"
|
||||
$(call Build/Compile/Default, -C $(QAT_OOT))
|
||||
$(call Build/Compile/Default, lac_kernel lac_user)
|
||||
$(call Build/Compile/Default, -C $(QAT_ADF))
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/icp/quickassist
|
||||
$(INSTALL_DIR) $(1)/usr/icp/build
|
||||
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/include/{*.h,dc,lac} $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/include/*.h $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist $(1)/usr/icp
|
||||
$(CP) $(PKG_BUILD_DIR)/build $(1)/usr/icp
|
||||
endef
|
||||
|
||||
define Package/quickassist-c3xxx/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d
|
||||
$(INSTALL_DIR) $(1)/etc/sysctl.d
|
||||
$(INSTALL_DIR) $(1)/lib/firmware
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/quickassist/QAT1.7/config
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl/conf_files/c3xxx* $(1)/usr/share/quickassist/QAT1.7/config
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl/adf_ctl $(1)/usr/sbin/adf_ctl
|
||||
$(CP) $(PKG_BUILD_DIR)/build/*.so* $(1)/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/quickassist/qat/fw/qat_c3xxx* $(1)/lib/firmware/
|
||||
$(CP) ./files/qat.init $(1)/etc/init.d/qat
|
||||
$(CP) ./files/hotplug.d $(1)/etc
|
||||
$(CP) ./files/sysctl.d $(1)/etc
|
||||
$(CP) ./files/c3xxx_dev0.conf $(1)/etc/c3xxx_dev0.conf
|
||||
$(CP) ./files/c3xxx_dev0.conf.multi $(1)/etc/c3xxx_dev0.conf.multi
|
||||
endef
|
||||
|
||||
define Package/quickassist-c3xxx/postinst
|
||||
#!/bin/sh
|
||||
[ -n "$${IPKG_INSTROOT}" ] && exit 0
|
||||
[ "$${PKG_UPGRADE}" = "1" ] && exit 0
|
||||
sysctl -p /etc/sysctl.d/12-hugepages.conf
|
||||
/etc/init.d/qat enable
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/quickassist-c3xxx/prerm
|
||||
#!/bin/sh
|
||||
[ -n "$${IPKG_INSTROOT}" ] && exit 0
|
||||
/etc/init.d/qat stop
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,quickassist-c3xxx))
|
||||
$(eval $(call KernelPackage,crypto-qat-c3xxx))
|
||||
$(eval $(call KernelPackage,crypto-qat-common))
|
||||
$(eval $(call KernelPackage,crypto-qat-api))
|
||||
$(eval $(call KernelPackage,crypto-qat-usdm))
|
121
package/qat/firmware/quickassist-c3xxx/files/c3xxx_dev0.conf
Normal file
121
package/qat/firmware/quickassist-c3xxx/files/c3xxx_dev0.conf
Normal file
@ -0,0 +1,121 @@
|
||||
################################################################
|
||||
# This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
# redistributing this file, you may do so under either license.
|
||||
#
|
||||
# GPL LICENSE SUMMARY
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# The full GNU General Public License is included in this distribution
|
||||
# in the file called LICENSE.GPL.
|
||||
#
|
||||
# Contact Information:
|
||||
# Intel Corporation
|
||||
#
|
||||
# BSD LICENSE
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Intel Corporation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
#
|
||||
#
|
||||
################################################################
|
||||
[GENERAL]
|
||||
ServicesEnabled = cy
|
||||
|
||||
# Set the service profile to determine available features
|
||||
# =====================================================================
|
||||
# DEFAULT CRYPTO COMPRESSION CUSTOM1
|
||||
# Asymmetric Crypto * * *
|
||||
# Symmetric Crypto * * *
|
||||
# MGF KeyGen * *
|
||||
# SSL/TLS KeyGen * * *
|
||||
# HKDF * *
|
||||
# Compression * * *
|
||||
# Decompression (stateless) * * *
|
||||
# Decompression (stateful) * *
|
||||
# Service Chaining *
|
||||
# Device Utilization * *
|
||||
# Rate Limiting * *
|
||||
# =====================================================================
|
||||
ServicesProfile = DEFAULT
|
||||
|
||||
ConfigVersion = 2
|
||||
|
||||
#Default values for number of concurrent requests*/
|
||||
CyNumConcurrentSymRequests = 512
|
||||
CyNumConcurrentAsymRequests = 64
|
||||
|
||||
#Statistics, valid values: 1,0
|
||||
statsGeneral = 1
|
||||
statsDh = 1
|
||||
statsDrbg = 1
|
||||
statsDsa = 1
|
||||
statsEcc = 1
|
||||
statsKeyGen = 1
|
||||
statsDc = 1
|
||||
statsLn = 1
|
||||
statsPrime = 1
|
||||
statsRsa = 1
|
||||
statsSym = 1
|
||||
|
||||
# This flag is to enable device auto reset on heartbeat error
|
||||
AutoResetOnError = 0
|
||||
|
||||
##############################################
|
||||
# Kernel Instances Section
|
||||
##############################################
|
||||
[KERNEL]
|
||||
NumberCyInstances = 0
|
||||
NumberDcInstances = 0
|
||||
|
||||
##############################################
|
||||
# User Process Instance Section
|
||||
##############################################
|
||||
[SHIM]
|
||||
NumberCyInstances = 1
|
||||
NumberDcInstances = 0
|
||||
NumProcesses = 32
|
||||
LimitDevAccess = 1
|
||||
|
||||
# Crypto - User instance #0
|
||||
Cy0Name = "UserCY0"
|
||||
Cy0IsPolled = 1
|
||||
# List of core affinities
|
||||
Cy0CoreAffinity = 0
|
@ -0,0 +1,127 @@
|
||||
################################################################
|
||||
# This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
# redistributing this file, you may do so under either license.
|
||||
#
|
||||
# GPL LICENSE SUMMARY
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
# The full GNU General Public License is included in this distribution
|
||||
# in the file called LICENSE.GPL.
|
||||
#
|
||||
# Contact Information:
|
||||
# Intel Corporation
|
||||
#
|
||||
# BSD LICENSE
|
||||
#
|
||||
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Intel Corporation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
#
|
||||
#
|
||||
################################################################
|
||||
[GENERAL]
|
||||
ServicesEnabled = cy
|
||||
|
||||
# Set the service profile to determine available features
|
||||
# =====================================================================
|
||||
# DEFAULT CRYPTO COMPRESSION CUSTOM1
|
||||
# Asymmetric Crypto * * *
|
||||
# Symmetric Crypto * * *
|
||||
# MGF KeyGen * *
|
||||
# SSL/TLS KeyGen * * *
|
||||
# HKDF * *
|
||||
# Compression * * *
|
||||
# Decompression (stateless) * * *
|
||||
# Decompression (stateful) * *
|
||||
# Service Chaining *
|
||||
# Device Utilization * *
|
||||
# Rate Limiting * *
|
||||
# =====================================================================
|
||||
ServicesProfile = DEFAULT
|
||||
|
||||
ConfigVersion = 2
|
||||
|
||||
#Default values for number of concurrent requests*/
|
||||
CyNumConcurrentSymRequests = 512
|
||||
CyNumConcurrentAsymRequests = 64
|
||||
|
||||
#Statistics, valid values: 1,0
|
||||
statsGeneral = 1
|
||||
statsDh = 1
|
||||
statsDrbg = 1
|
||||
statsDsa = 1
|
||||
statsEcc = 1
|
||||
statsKeyGen = 1
|
||||
statsDc = 1
|
||||
statsLn = 1
|
||||
statsPrime = 1
|
||||
statsRsa = 1
|
||||
statsSym = 1
|
||||
|
||||
# This flag is to enable device auto reset on heartbeat error
|
||||
AutoResetOnError = 0
|
||||
|
||||
##############################################
|
||||
# Kernel Instances Section
|
||||
##############################################
|
||||
[KERNEL]
|
||||
NumberCyInstances = 0
|
||||
NumberDcInstances = 0
|
||||
|
||||
##############################################
|
||||
# User Process Instance Section
|
||||
##############################################
|
||||
[SHIM]
|
||||
NumberCyInstances = 2
|
||||
NumberDcInstances = 0
|
||||
NumProcesses = 4
|
||||
LimitDevAccess = 0
|
||||
|
||||
# Crypto - User instance #0
|
||||
Cy0Name = "UserCY0"
|
||||
Cy0IsPolled = 1
|
||||
# List of core affinities
|
||||
Cy0CoreAffinity = 0
|
||||
|
||||
# Crypto - User instance #1
|
||||
Cy1Name = "UserCY1"
|
||||
Cy1IsPolled = 1
|
||||
# List of core affinities
|
||||
Cy1CoreAffinity = 0
|
32
package/qat/firmware/quickassist-c3xxx/files/hotplug.d/module/01-usdm
Executable file
32
package/qat/firmware/quickassist-c3xxx/files/hotplug.d/module/01-usdm
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
HUGE_PAGE_DIR="/dev/hugepages"
|
||||
|
||||
[ "$DEVICENAME" != "usdm_drv" ] && exit 0
|
||||
|
||||
[ "$ACTION" == "add" ] && {
|
||||
|
||||
if [ -d ${HUGE_PAGE_DIR} ]; then
|
||||
|
||||
mkdir ${HUGE_PAGE_DIR}/qat 2> /dev/null
|
||||
|
||||
if [ $? -ne 0]; then
|
||||
logger -t "quickassist(usdm_drv): error creating ${HUGE_PAGE_DIR}/qat"
|
||||
else
|
||||
chgrp qat ${HUGE_PAGE_DIR}/qat
|
||||
chmod 0770 ${HUGE_PAGE_DIR}/qat
|
||||
fi
|
||||
|
||||
else
|
||||
logger -t "quickassist(usdm_drv): ${HUGE_PAGE_DIR} not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
[ "$ACTION" == "remove" ] && {
|
||||
|
||||
rmdir ${HUGE_PAGE_DIR}/qat
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$DEVICENAME" != "qat_adf_ctl" ] && [ "$ACTION" != "add" ]; then exit 0; fi
|
||||
|
||||
chgrp qat /dev/qat_adf_ctl
|
||||
chmod 0660 /dev/qat_adf_ctl
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$DEVICENAME" != "qat_dev_processes" ] && [ "$ACTION" != "add" ]; then exit 0; fi
|
||||
|
||||
chgrp qat /dev/qat_dev_processes
|
||||
chmod 0660 /dev/qat_dev_processes
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$ACTION" != "add" ] && [ "$MAJOR" != "249" ]; then exit 0; fi
|
||||
|
||||
chgrp qat /dev/${DEVICENAME}
|
||||
chmod 0660 /dev/${DEVICENAME}
|
||||
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$DEVICENAME" != "usdm_drv" ] && [ "$ACTION" != "add" ]; then exit 0; fi
|
||||
|
||||
chgrp qat /dev/usdm_drv
|
||||
chmod 0660 /dev/usdm_drv
|
||||
|
||||
|
175
package/qat/firmware/quickassist-c3xxx/files/qat.init
Executable file
175
package/qat/firmware/quickassist-c3xxx/files/qat.init
Executable file
@ -0,0 +1,175 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
#################################################################
|
||||
|
||||
# qat Start/Stop the Intel QAT.
|
||||
#
|
||||
|
||||
START=29
|
||||
STOP=99
|
||||
|
||||
ADF_CTL=/usr/sbin/adf_ctl
|
||||
QAT_GID=200
|
||||
INTEL_VENDORID="8086"
|
||||
C3XX_DEVICE_PCI_ID="19e2"
|
||||
NUM_C3XXX_DEVICES=$(lspci -n | egrep -c "$INTEL_VENDORID:$C3XX_DEVICE_PCI_ID")
|
||||
HUGE_PAGE_DIR=/dev/hugepages
|
||||
HUGE_PAGE_MOUNT=$(mount | grep hugetlbfs | awk '{print $3}')
|
||||
MAX_HUGE_PAGES=200
|
||||
MAX_HUGE_PAGES_PER_PROCESS=10
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Show the status of the qat device"
|
||||
|
||||
|
||||
qat_started() {
|
||||
|
||||
${ADF_CTL} status > /dev/null 2>&1
|
||||
return $?
|
||||
|
||||
}
|
||||
|
||||
|
||||
status() {
|
||||
|
||||
${ADF_CTL} status
|
||||
if [ "$?" -ne 0 ]
|
||||
then
|
||||
echo "No devices found. Please start the driver using:"
|
||||
echo "$0 start"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
insert_digest_modules() {
|
||||
|
||||
if [ $(lsmod | grep -c "sha512") == 0 ]; then
|
||||
|
||||
if [ $(cat /proc/kallsyms |grep -c sha512_) == 0 ]; then
|
||||
modprobe sha512_ssse3
|
||||
else
|
||||
echo "$0 no sha512_ssse3 module to load"
|
||||
return 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ $(lsmod | grep -c "sha256") == 0 ]; then
|
||||
|
||||
if [ $(cat /proc/kallsyms |grep -c sha256_) == 0 ]; then
|
||||
modprobe sha256_ssse3
|
||||
else
|
||||
echo "$0 no sha256_ssse3 module to load"
|
||||
return 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
mount_hugetlbfs() {
|
||||
|
||||
if [ "${HUGE_PAGE_MOUNT}" != "${HUGE_PAGE_DIR}" ]; then
|
||||
|
||||
[ ! -d ${HUGE_PAGE_DIR} ] && mkdir ${HUGE_PAGE_DIR}
|
||||
|
||||
mount -t hugetlbfs hugetlbfs ${HUGE_PAGE_DIR} -o mode=1770 -o gid=${QAT_GID}
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$0: error mounting hugetlbfs on ${HUGE_PAGE_DIR}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
insert_modules() {
|
||||
|
||||
# common functions kernel module
|
||||
|
||||
if [ $(lsmod | grep "intel_qat" | wc -l) == "0" ]; then
|
||||
modprobe intel_qat
|
||||
fi
|
||||
|
||||
[ $? -ne 0 ] && return 1
|
||||
|
||||
# contiguous pinned memory driver
|
||||
# requires huge pages support in the kernel
|
||||
|
||||
if [ $(lsmod | grep "usdm_drv" | wc -l) == "0" ]; then
|
||||
modprobe usdm_drv max_huge_pages=${MAX_HUGE_PAGES} max_huge_pages_per_process=${MAX_HUGE_PAGES_PER_PROCESS}
|
||||
fi
|
||||
|
||||
[ $? -ne 0 ] && return 1
|
||||
|
||||
# qat device driver
|
||||
|
||||
if [ $(lsmod | grep "qat_c3xxx" | wc -l) == "0" ]; then
|
||||
modprobe qat_c3xxx
|
||||
fi
|
||||
|
||||
[ $? -ne 0 ] && return 1
|
||||
|
||||
# qat kernel api
|
||||
|
||||
if [ $(lsmod | grep "qat_api" | wc -l) == "0" ]; then
|
||||
modprobe qat_api
|
||||
fi
|
||||
|
||||
return $?
|
||||
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
/sbin/depmod -a 2> /dev/null
|
||||
|
||||
qat_started
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
insert_digest_modules && [ $? -eq 0 ] && mount_hugetlbfs
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
if [ ${NUM_C3XXX_DEVICES} != 0 ]; then
|
||||
insert_modules
|
||||
[ $? -eq 0 ] && ${ADF_CTL} restart
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
else echo "QAT already started $?"; fi
|
||||
|
||||
${ADF_CTL} status
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
qat_started
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
${ADF_CTL} down
|
||||
rmmod usdm_drv
|
||||
rmmod qat_api
|
||||
rmmod qat_c3xxx
|
||||
rmmod intel_qat
|
||||
umount ${HUGE_PAGE_DIR}
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
||||
${ADF_CTL} restart
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
# setup huge page maximums
|
||||
# default size is 2MB
|
||||
|
||||
vm.nr_hugepages=256
|
||||
vm.hugetlb_shm_group=200
|
@ -0,0 +1,32 @@
|
||||
From 5a59b3e55b45d9ca6b7f96f3d6a30406aa1b715f Mon Sep 17 00:00:00 2001
|
||||
From: W_Y_CPP <383152993@qq.com>
|
||||
Date: Sun, 24 Apr 2022 02:53:15 -0400
|
||||
Subject: [PATCH] fix build
|
||||
|
||||
---
|
||||
quickassist/utilities/osal/src/linux/user_space/OsalServices.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/quickassist/utilities/osal/src/linux/user_space/OsalServices.c b/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
|
||||
index e650330e7..aae8c3040 100644
|
||||
--- a/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
|
||||
+++ b/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
|
||||
@@ -360,6 +360,7 @@ OSAL_PUBLIC UINT64 osalTimestampGet(void)
|
||||
OSAL_PUBLIC UINT64 osalTimestampGetNs(void)
|
||||
{
|
||||
OsalTimeval ptime;
|
||||
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
#if __GLIBC_PREREQ(2, 17)
|
||||
struct timespec tspec;
|
||||
|
||||
@@ -372,6 +373,7 @@ OSAL_PUBLIC UINT64 osalTimestampGetNs(void)
|
||||
OSAL_LOG_DEV_STDOUT,
|
||||
"osalTimestampGetNs(): clock_gettime(CLOCK_REALTIME) system call "
|
||||
"failed. Invoking osalTimeGet() as fallback\n");
|
||||
+#endif
|
||||
#endif
|
||||
ptime.secs = 0;
|
||||
ptime.nsecs = 0;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,15 @@
|
||||
--- a/quickassist/build_system/build_files/env_files/environment.mk
|
||||
+++ b/quickassist/build_system/build_files/env_files/environment.mk
|
||||
@@ -59,11 +59,7 @@ DIRECT_PATH=$(ICP_ROOT)/quickassist/look
|
||||
KERNEL_PATH=$(ICP_ROOT)/quickassist/lookaside/access_layer/src/qat_kernel/
|
||||
CMN_MEM_PATH=$(ICP_ROOT)/quickassist/utilities/libusdm_drv
|
||||
ICP_DEFENSES_ENABLED ?= y
|
||||
-ifeq ($(shell cat /proc/kallsyms | grep -w "__stack_chk_fail" | wc -l), 1)
|
||||
-KERNEL_DEFENSES_STACK_PROTECTION = y
|
||||
-else
|
||||
-KERNEL_DEFENSES_STACK_PROTECTION = n
|
||||
-endif
|
||||
+KERNEL_DEFENSES_STACK_PROTECTION ?= n
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# ADF paths
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user