Merge branch 'dey-2.0/master' into dey-2.0/maint

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2016-07-22 10:07:00 +02:00
commit d7f4c86279
142 changed files with 10381 additions and 247 deletions

View File

@ -1,10 +1,15 @@
inherit image_types
def TRUSTFENCE_BOOTIMAGE_DEPENDS(d):
tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or ""
return "%s:do_rootfs" % tf_initramfs if tf_initramfs else ""
IMAGE_DEPENDS_boot.vfat = " \
dosfstools-native:do_populate_sysroot \
mtools-native:do_populate_sysroot \
u-boot:do_deploy \
virtual/kernel:do_deploy \
${@TRUSTFENCE_BOOTIMAGE_DEPENDS(d)} \
"
IMAGE_CMD_boot.vfat() {
@ -22,6 +27,12 @@ IMAGE_CMD_boot.vfat() {
done
fi
# Add Trustfence initramfs if enabled
if [ -n "${TRUSTFENCE_INITRAMFS_IMAGE}" ]; then
BOOTIMG_FILES="${BOOTIMG_FILES} $(readlink -e ${DEPLOY_DIR_IMAGE}/${TRUSTFENCE_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot)"
BOOTIMG_FILES_SYMLINK="${BOOTIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${TRUSTFENCE_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot"
fi
# Size of kernel and device tree + 10% extra space (in bytes)
BOOTIMG_FILES_SIZE="$(expr $(du -bc ${BOOTIMG_FILES} | tail -n1 | cut -f1) \* \( 100 + 10 \) / 100)"
@ -60,6 +71,53 @@ IMAGE_CMD_boot.vfat() {
fi
}
IMAGE_DEPENDS_boot.ubifs = " \
mtd-utils-native:do_populate_sysroot \
u-boot:do_deploy \
virtual/kernel:do_deploy \
"
IMAGE_CMD_boot.ubifs() {
#
# Image generation code for image type 'boot.ubifs'
#
BOOTIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin"
if [ -n "${KERNEL_DEVICETREE}" ]; then
for DTB in ${KERNEL_DEVICETREE}; do
if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" ]; then
BOOTIMG_FILES_SYMLINK="${BOOTIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}"
fi
done
fi
# Create temporary folder
TMP_BOOTDIR="$(mktemp -d ${DEPLOY_DIR_IMAGE}/boot.XXXXXX)"
# Hard-link BOOTIMG_FILES into the temporary folder with the symlink filename
for item in ${BOOTIMG_FILES_SYMLINK}; do
orig="$(readlink -e ${item})"
ln ${orig} ${TMP_BOOTDIR}/$(basename ${item})
done
# Hard-link boot scripts into the temporary folder
for item in ${BOOT_SCRIPTS}; do
src="$(echo ${item} | awk -F':' '{ print $1 }')"
dst="$(echo ${item} | awk -F':' '{ print $2 }')"
ln ${DEPLOY_DIR_IMAGE}/${src} ${TMP_BOOTDIR}/${dst}
done
# Build UBIFS boot image out of temp folder
mkfs.ubifs -r ${TMP_BOOTDIR} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.ubifs ${MKUBIFS_BOOT_ARGS}
# Create the symlink
if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.ubifs ]; then
ln -s ${IMAGE_NAME}.boot.ubifs ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot.ubifs
fi
# Remove the temporary folder
rm -rf ${TMP_BOOTDIR}
}
IMAGE_CMD_rootfs.initramfs() {
#
# Image generation code for image type 'rootfs.initramfs'

View File

@ -27,7 +27,7 @@ KERNEL_DEVICETREE ?= " \
imx6dl-ccimx6sbc-id131.dtb \
"
SERIAL_CONSOLES = "115200;ttymxc3"
SERIAL_CONSOLES ?= "115200;ttymxc3"
# Bluetooth tty
BT_TTY ?= "ttymxc1"

View File

@ -0,0 +1,28 @@
#@TYPE: Machine
#@NAME: Starter Board for ConnectCore for i.MX6UL
#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6UL Starter Board.
# Include the machine configuration for Digi's ConnectCore 6UL.
include conf/machine/include/ccimx6ul.inc
# U-Boot configurations
# Last one is the default (the one the symlinks point at)
UBOOT_CONFIG ??= "ccimx6ulstarter"
UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig"
KERNEL_DEVICETREE ?= " \
imx6ul-ccimx6ulstarter.dtb \
imx6ul-ccimx6ulstarter-wb.dtb \
imx6ul-ccimx6ulstarter-id129.dtb \
"
SERIAL_CONSOLES = "115200;ttymxc4"
# Bluetooth tty
BT_TTY ?= "ttymxc0"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs"

View File

@ -15,7 +15,7 @@ UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
# Wireless external module
WIRELESS_MODULE ?= ""
WIRELESS_MODULE_append = "${@base_contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}"
WIRELESS_MODULE_append = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}"
# Firmware
MACHINE_FIRMWARE ?= ""

View File

@ -30,6 +30,6 @@ MACHINE_EXTRA_RDEPENDS += " \
u-boot-fw-utils \
"
MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}"
MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins"
MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins cryptodev-module rng-tools"
MACHINE_FEATURES += "accel-graphics accel-video wifi bluetooth"

View File

@ -0,0 +1,41 @@
#@TYPE: Machine
#@NAME: ConnectCore for i.MX6UL.
#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6UL.
include conf/machine/include/imx-digi-base.inc
include conf/machine/include/tune-cortexa7.inc
DIGI_FAMILY = "ccimx6ul"
SOC_FAMILY = "mx6ul:${DIGI_FAMILY}"
# Platform u-boot settings
UBOOT_SUFFIX = "imx"
UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
# Wireless external module
WIRELESS_MODULE ?= ""
WIRELESS_MODULE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-qualcomm', '', d)}"
# Firmware
MACHINE_FIRMWARE ?= ""
MACHINE_EXTRA_RDEPENDS += " \
imx-kobs \
mtd-utils-ubifs \
u-boot-fw-utils \
"
MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}"
MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins cryptodev-module"
MACHINE_FEATURES += "wifi bluetooth"
MACHINE_FIRMWARE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'firmware-qualcomm-qca6564-bt', '', d)}"
MACHINE_FIRMWARE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'firmware-qualcomm-qca6564-wifi', '', d)}"
KERNEL_IMAGETYPE = "zImage"
# mkfs.ubifs parameters for boot partition (the one holding kernel and device tree files)
MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 127"
# mkfs.ubifs parameters for rootfs partition
MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 2047"

View File

@ -12,15 +12,16 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg"
# -------------------------------------------------
# ccardimx28 3.10 2013.01
# ccimx6 3.14 2015.04
# ccimx6ul 4.1 2015.04
#
# Help variables used in recipes
HAVE_WIFI = "${@base_contains('MACHINE_FEATURES', 'wifi', '1', '', d)}"
HAVE_EXT_ETH = "${@base_contains('MACHINE_FEATURES', 'ext-eth', '1', '', d)}"
HAVE_BT = "${@base_contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}"
HAVE_1WIRE = "${@base_contains('MACHINE_FEATURES', '1-wire', '1', '', d)}"
HAVE_GUI = "${@base_contains('DISTRO_FEATURES', 'x11', '1', '', d)}"
HAVE_EXAMPLE = "${@base_contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}"
HAVE_WIFI = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', '1', '', d)}"
HAVE_EXT_ETH = "${@bb.utils.contains('MACHINE_FEATURES', 'ext-eth', '1', '', d)}"
HAVE_BT = "${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}"
HAVE_1WIRE = "${@bb.utils.contains('MACHINE_FEATURES', '1-wire', '1', '', d)}"
HAVE_GUI = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '1', '', d)}"
HAVE_EXAMPLE = "${@bb.utils.contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}"
#
# Ethernet configuration used in recipes

View File

@ -0,0 +1,43 @@
pcm.btheadset {
type plug
slave {
pcm {
type bluetooth
device 80:57:19:B2:A1:04
profile "auto"
}
}
hint {
show on
description "BT Headset"
}
}
ctl.btheadset {
type bluetooth
}
pcm.btspeaker {
type plug
slave {
pcm {
type bluetooth
device A0:E9:DB:10:33:58
profile "auto"
}
}
hint {
show on
description "BT Speaker"
}
}
ctl.btspeaker {
type bluetooth
}
pcm.btspeaker_softvol
{
type softvol
slave.pcm "btspeaker"
control.name "Bluetooth"
control.card 0
}

View File

@ -0,0 +1,127 @@
state.sgtl5000audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 144
value.1 144
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 12
value.1 12
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 0
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 105
value.1 105
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 100
dbvalue.1 100
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}
state.imxhdmisoc {
control.1 {
iface MIXER
name 'IEC958 Playback Default'
value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write volatile'
type IEC958
count 1
}
}
}

View File

@ -0,0 +1,127 @@
state.sgtl5000audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 144
value.1 144
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 12
value.1 12
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 0
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 105
value.1 105
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 100
dbvalue.1 100
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value LINE_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}
state.imxhdmisoc {
control.1 {
iface MIXER
name 'IEC958 Playback Default'
value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write volatile'
type IEC958
count 1
}
}
}

View File

@ -0,0 +1,127 @@
state.sgtl5000audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 144
value.1 144
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 12
value.1 12
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 0
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 105
value.1 105
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 100
dbvalue.1 100
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value MIC_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}
state.imxhdmisoc {
control.1 {
iface MIXER
name 'IEC958 Playback Default'
value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write volatile'
type IEC958
count 1
}
}
}

View File

@ -0,0 +1,127 @@
state.sgtl5000audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 144
value.1 144
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 12
value.1 12
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 0
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 105
value.1 105
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 100
dbvalue.1 100
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value MIC_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}
state.imxhdmisoc {
control.1 {
iface MIXER
name 'IEC958 Playback Default'
value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write volatile'
type IEC958
count 1
}
}
}

View File

@ -0,0 +1,127 @@
state.sgtl5000audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 144
value.1 144
comment {
access 'read write'
type INTEGER
count 2
range '0 - 192'
}
}
control.2 {
iface MIXER
name 'Capture Volume'
value.0 12
value.1 12
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.3 {
iface MIXER
name 'Capture Attenuate Switch (-6dB)'
value 1
comment {
access 'read write'
type INTEGER
count 1
range '0 - 2'
dbmin -600
dbmax 600
dbvalue.0 0
}
}
control.4 {
iface MIXER
name 'Capture ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.5 {
iface MIXER
name 'Headphone Playback Volume'
value.0 105
value.1 105
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
dbmin -5150
dbmax 1200
dbvalue.0 100
dbvalue.1 100
}
}
control.6 {
iface MIXER
name 'Headphone Playback ZC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'Mic Volume'
value 2
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
dbmin 0
dbmax 4000
dbvalue.0 3000
}
}
control.8 {
iface MIXER
name 'Headphone Mux'
value DAC
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DAC
item.1 LINE_IN
}
}
control.9 {
iface MIXER
name 'Capture Mux'
value MIC_IN
comment {
access 'read write'
type ENUMERATED
count 1
item.0 MIC_IN
item.1 LINE_IN
}
}
}
state.imxhdmisoc {
control.1 {
iface MIXER
name 'IEC958 Playback Default'
value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write volatile'
type IEC958
count 1
}
}
}

View File

@ -82,4 +82,4 @@ FILES_${PN}-ar3k = "/lib/firmware/ar3k"
FILES_${PN}-ath6kl = "/lib/firmware/ath6k"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)"
COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$)"

View File

@ -0,0 +1,68 @@
# Copyright (C) 2016 Digi International.
SUMMARY = "Qualcomm firmware files for Digi's platforms."
SECTION = "base"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://${DIGI_EULA_FILE};md5=4c0991cfde5c8a92338cbfe0f4f9a5c6"
FW_QCA6564-BT = " \
file://qca/nvm_tlv_3.0.bin \
file://qca/nvm_tlv_3.2.bin \
file://qca/rampatch_tlv_3.0.tlv \
file://qca/rampatch_tlv_3.2.tlv \
"
FW_QCA6564-WIFI = " \
file://bdwlan30_US.bin \
file://bdwlan30_World.bin \
file://LICENCE.atheros_firmware \
file://otp30.bin \
file://qwlan30.bin \
file://utf30.bin \
file://utfbd30.bin \
file://wlan/cfg.dat \
file://wlan/qcom_cfg.ini \
"
SRC_URI = " \
${FW_QCA6564-BT} \
${FW_QCA6564-WIFI} \
"
S = "${WORKDIR}"
do_install() {
# BT firmware
install -d ${D}${base_libdir}/firmware/qca
install -m 0644 \
qca/nvm_tlv_3.0.bin \
qca/nvm_tlv_3.2.bin \
qca/rampatch_tlv_3.0.tlv \
qca/rampatch_tlv_3.2.tlv \
${D}${base_libdir}/firmware/qca
# Wifi firmware
install -d ${D}${base_libdir}/firmware/wlan
install -m 0644 \
bdwlan30_US.bin \
bdwlan30_World.bin \
LICENCE.atheros_firmware \
otp30.bin \
qwlan30.bin \
utf30.bin \
utfbd30.bin \
${D}${base_libdir}/firmware
install -m 0644 \
wlan/cfg.dat \
wlan/qcom_cfg.ini \
${D}${base_libdir}/firmware/wlan
}
# Do not create empty debug and development packages (PN-dbg PN-dev PN-staticdev)
PACKAGES = "${PN}-qca6564-bt ${PN}-qca6564-wifi"
FILES_${PN}-qca6564-bt = "/lib/firmware/qca"
FILES_${PN}-qca6564-wifi = "/lib/firmware"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccimx6ul)"

View File

@ -0,0 +1,38 @@
Copyright (c) 2008-2010, Atheros Communications, Inc.
All rights reserved.
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:
* Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of Atheros Communications, Inc. nor the names of
its suppliers may be used to endorse or promote products derived
from this software without specific prior written permission.
* No reverse engineering, decompilation, or disassembly of this
software is permitted.
Limited patent license. Atheros Communications, Inc. grants a
world-wide, royalty-free, non-exclusive license under patents it
now or hereafter owns or controls to make, have made, use, import,
offer to sell and sell ("Utilize") this software, but solely to
the extent that any such patent is necessary to Utilize the software
in conjunction with an Atheros Chipset. The patent license shall not
apply to any other combinations which include this software. No
hardware per se is licensed hereunder.
DISCLAIMER. 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.

View File

@ -0,0 +1,357 @@
# This file allows user to override the factory
# defaults for the WLAN Driver
# Enable/Disable Idle Scan
gEnableRxThread=1
gEnableIdleScan=0
# Increase sleep duration (seconds) during IMPS
# 0 implies no periodic wake up from IMPS. Periodic wakeup is
# unnecessary if Idle Scan is disabled.
gImpsModSleepTime=0
# Enable suspend or not
# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter
gEnableSuspend=3
# Phy Mode (auto, b, g, n, etc)
# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac
# 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only
# 7 = 11b only 8 = 11ac only.
gDot11Mode=0
# CSR Roaming Enable(1) Disable(0)
gRoamingTime=0
# Assigned MAC Addresses - This will be used until NV items are in place
# Each byte of MAC address is represented in Hex format as XX
Intf0MacAddress=000AF58989FF
Intf1MacAddress=000AF58989FE
Intf2MacAddress=000AF58989FD
Intf3MacAddress=000AF58989FC
# UAPSD service interval for VO,VI, BE, BK traffic
InfraUapsdVoSrvIntv=0
InfraUapsdViSrvIntv=0
InfraUapsdBeSrvIntv=0
InfraUapsdBkSrvIntv=0
# Flag to allow STA send AddTspec even when ACM is Off
gAddTSWhenACMIsOff=1
# Make 1x1 the default antenna configuration
gNumRxAnt=1
# Beacon filtering frequency (unit in beacon intervals)
gNthBeaconFilter=50
# Flags to filter Mcast abd Bcast RX packets.
# Value 0: No filtering, 1: Filter all Multicast.
# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast
McastBcastFilter=3
#Flag to enable HostARPOffload feature or not
hostArpOffload=1
#Flag to enable HostNSOffload feature or not
hostNSOffload=1
#Enable OBSS protection
gEnableApOBSSProt=1
# RTS threshold
RTSThreshold=1048576
# DFS Master Capability
gEnableDFSMasterCap=1
# fast transition
ImplicitQosIsEnabled=0
gNeighborLookupThreshold=76
gNeighborReassocThreshold=81
#Check if the AP to which we are roaming is better than current AP in terms of RSSI.
#Checking is disabled if set to Zero.Otherwise it will use this value as to how better
#the RSSI of the new/roamable AP should be for roaming
RoamRssiDiff=3
# If the RSSI of any available candidate is better than currently associated
# AP by at least gImmediateRoamRssiDiff, then being to roam immediately (without
# registering for reassoc threshold).
# NOTE: Value of 0 means that we would register for reassoc threshold.
gImmediateRoamRssiDiff=10
# SAP auto channel selection configuration
# 0 = disable auto channel selection
# 1 = enable auto channel selection, channel provided by supplicant will be ignored
gApAutoChannelSelection=0
# Listen Energy Detect Mode Configuration
# Valid values 0-128
# 128 means disable Energy Detect feature
# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled.
# 10-128 are reserved.
# The EDET threshold mapping is as follows in 3dB step:
# 0 = -60 dBm
# 1 = -63 dBm
# 2 = -66 dBm
# ...
# 7 = -81 dBm
# 8 = -84 dBm
# 9 = -87 dBm
# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as:
#
# Range Loss (dB) = EDET threshold level (dBm) + 97 dBm.
#
gEnablePhyAgcListenMode=128
#SOFTAP Channel Range selection
gAPChannelSelectStartChannel=1
gAPChannelSelectEndChannel=11
#SOFTAP Channel Range selection Operating band
# 0:2.4GHZ 1: LOW-5GHZ 2:MID-5GHZ 3:HIGH-5GHZ 4: 4.9HZ BAND
gAPChannelSelectOperatingBand=0
#Channel Bonding
gChannelBondingMode5GHz=1
#Enable Keep alive with non-zero period value
gStaKeepAlivePeriod = 30
#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds).
#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.)
#For both active and power save clients.
#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit.
#If doesn't honor for 5 seconds then DUT remove client.
#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on
#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames.
#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod)..
#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period
#where we send NULL frame.
#gApLinkMonitorPeriod = 10
#gGoLinkMonitorPeriod = 10
#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not.
#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod.
gGoKeepAlivePeriod = 20
gApKeepAlivePeriod = 20
gEnableLogp=1
# 0 for OLPC 1 for CLPC and SCPC
gEnableCloseLoop=1
#Data Inactivity Timeout when in powersave (in ms)
gDataInactivityTimeout=200
# VHT Tx/Rx MCS values
# Valid values are 0,1,2. If commented out, the default value is 0.
# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
gVhtRxMCS=2
gVhtTxMCS=2
# VHT Tx/Rx MCS values for 2x2
# Valid values are 0,1,2. If commented out, the default value is 0.
# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9
gEnable2x2=0
gVhtRxMCS2x2=2
gVhtTxMCS2x2=2
# Set txchainmask and rxchainmask
# These parameters are used only if gEnable2x2 is 0
# Valid values are 1,2
# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0.
# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1.
gSetTxChainmask1x1=1
gSetRxChainmask1x1=1
# 1=enable STBC; 0=disable STBC
gEnableRXSTBC=1
# 1=enable tx STBC; 0=disable
gEnableTXSTBC=1
# 1=enable rx LDPC; 0=disable
gEnableRXLDPC=1
#Enable Scan Results Aging based on timer
#Timer value is in seconds
#If Set to 0 it will not enable the feature
gScanAgingTime=0
#Enable Scan Results Aging based on number of scans
gScanResultAgeCount=1
#Enable thermal mitigation
gThermalMitigationEnable=0
#Thermal Mitigation Levels
gThermalTempMinLevel0=0
gThermalTempMaxLevel0=107
gThermalTempMinLevel1=105
gThermalTempMaxLevel1=117
gThermalTempMinLevel2=110
gThermalTempMaxLevel2=127
gThermalTempMinLevel3=115
gThermalTempMaxLevel3=0
#Maxium Channel time in msec
gMaxMediumTime = 6000
# 802.11K support
gRrmEnable=1
gRrmOperChanMax=8
gRrmNonOperChanMax=8
#Scan offload
gEnableDirectedScanOffload=1
#Enable Power Save offload
gEnablePowerSaveOffload=1
#Enable firmware log
gEnablefwlog=1
#P2P Listen offload
gEnableP2pListenOffload=1
# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k)
gVhtAmpduLenExponent=7
# Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets)
gVhtMpduLen=2
# Maximum number of wow filters required
#gMaxWoWFilters=22
# WOW Enable/Disable.
# 0 - Disable both magic pattern match and pattern byte match.
# 1 - Enable magic pattern match on all interfaces.
# 2 - Enable pattern byte match on all interfaces.
# 3 - Enable both magic patter and pattern byte match on all interfaces.
# Default value of gEnableWoW is 3.
# gEnableWoW=0
#Enable or Disable p2p device address administered
isP2pDeviceAddrAdministrated=0
# Set Thermal Power limit
TxPower2g=10
TxPower5g=10
#Enable VHT on 2.4Ghz
gEnableVhtFor24GHzBand=1
#Enable or Disable 5G early beacon termination
gEnable5gEBT=1
ssdp = 0
#Enable Hysteretic mode
gEnableHystereticMode=1
# Bus bandwidth compute timeout value in ms
gBusBandwidthComputeInterval=2000
# Regulatory Setting; 0=STRICT; 1=CUSTOM
gRegulatoryChangeCountry=1
# Enable/Disable RX full reorder offload
gReorderOffloadSupported=1
#Set SAP max peer to 16 which allows 10 WEP connection
gSoftApMaxPeers=16
# Whether userspace country code setting shld have priority
gCountryCodePriority=1
# Enable(1)/Disable(0) SIFS burst
gEnableSifsBurst=1
# Enable or Disable Multi-user MIMO
# 1=Enable (default), 0=Disable
gEnableMuBformee=1
# Inactivity time (in ms) to end TX Service Period while in IBSS power save mode
gIbssTxSpEndInactivityTime=10
END
# Note: Configuration parser would not read anything past the END marker

View File

@ -0,0 +1,29 @@
From: "Diaz de Grenu, Jose" <Jose.DiazdeGrenu@digi.com>
Date: Thu, 30 Jun 2016 16:42:42 +0200
Subject: [PATCH] gen_auth_encrypted_data: reuse existing DEK file
In order to be able to encrypt several artifacts with the same DEK, it is
needed to allow the CST to reuse an existing DEK file.
Previous to this patch, the DEK is generated on the fly and placed on the
specified path. After this patch, the DEK is taken from the specified path.
https://jira.digi.com/browse/DUB-608
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
---
code/back_end/src/adapt_layer_openssl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/code/back_end/src/adapt_layer_openssl.c b/code/back_end/src/adapt_layer_openssl.c
index 8513046269ea..ce6e370f2c6a 100644
--- a/code/back_end/src/adapt_layer_openssl.c
+++ b/code/back_end/src/adapt_layer_openssl.c
@@ -945,6 +945,7 @@ int32_t gen_auth_encrypted_data(const char* in_file,
}
printf("\n");
#endif
+ reuse_dek = 1;
if (reuse_dek) {
fh = fopen(key_file, "rb");
if (fh == NULL) {

View File

@ -0,0 +1,521 @@
From: "Diaz de Grenu, Jose" <Jose.DiazdeGrenu@digi.com>
Date: Mon, 18 Jul 2016 13:21:11 +0200
Subject: [PATCH] hab4_pki_tree.sh: automate script
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
---
keys/hab4_pki_tree.sh | 347 ++++++++++++++++----------------------------------
1 file changed, 107 insertions(+), 240 deletions(-)
diff --git a/keys/hab4_pki_tree.sh b/keys/hab4_pki_tree.sh
index 7dd67f68c8df..b2c6b71b604e 100755
--- a/keys/hab4_pki_tree.sh
+++ b/keys/hab4_pki_tree.sh
@@ -42,84 +42,40 @@
#
#-----------------------------------------------------------------------------
-printf "\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-printf " This script is a part of the Code signing tools for Freescale's\n"
-printf " High Assurance Boot. It generates a basic PKI tree. The PKI\n"
-printf " tree consists of one or more Super Root Keys (SRK), with each\n"
-printf " SRK having two subordinate keys: \n"
-printf " + a Command Sequence File (CSF) key \n"
-printf " + Image key. \n"
-printf " Additional keys can be added to the PKI tree but a separate \n"
-printf " script is available for this. This this script assumes openssl\n"
-printf " is installed on your system and is included in your search \n"
-printf " path. Finally, the private keys generated are password \n"
-printf " protectedwith the password provided by the file key_pass.txt.\n"
-printf " The format of the file is the password repeated twice:\n"
-printf " my_password\n"
-printf " my_password\n"
-printf " All private keys in the PKI tree are in PKCS #8 format will be\n"
-printf " protected by the same password.\n\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-
-stty erase 
-
-printf "Do you want to use an existing CA key (y/n)?: \b"
-read existing_ca
-if [ $existing_ca = "y" ]
-then
- printf "Enter CA key name: \b"
- read ca_key
- printf "Enter CA certificate name: \b"
- read ca_cert
+SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)"
+CSF_PATH="${1}"
+if [ ! -d "${CSF_PATH}" ]; then
+ echo "Invalid CSF_PATH: ${CSF_PATH}"
+ exit 1
fi
-printf "Do you want to use Elliptic Curve Cryptography (y/n)?: \b"
-read use_ecc
-if [ $use_ecc = "y" ]
-then
- printf "Enter length for elliptic curve to be used for PKI tree:\n"
- printf "Possible values p192, p256, p521: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- p192)
- cn="secp112r1" ;;
- p256)
- cn="prime256v1" ;;
- p521)
- cn="secp521r1" ;;
- *)
- echo Invalid key length. Supported key lengths: 192, 256, 521
- exit 1 ;;
- esac
-else
- printf "Enter key length in bits for PKI tree: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- 1024) ;;
- 2048) ;;
- 3072) ;;
- 4096) ;;
- *)
- echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096
- exit 1 ;;
- esac
-fi
+cd "${CSF_PATH}"
+
+[ -d crts ] || mkdir crts
+[ -d keys ] || mkdir keys
+cd keys
+existing_ca="n"
+kl="4096"
-printf "Enter PKI tree duration (years): \b"
-read duration
+# Confirm that a valid key length has been entered
+case $kl in
+ 1024) ;;
+ 2048) ;;
+ 3072) ;;
+ 4096) ;;
+ *)
+ echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096
+ exit 1 ;;
+esac
+
+duration="10"
# Compute validity period
val_period=$((duration*365))
-printf "How many Super Root Keys should be generated? \b"
-read num_srk
+num_srk="4"
# Check that 0 < num_srk <= 4 (Max. number of SRKs)
if [ $num_srk -lt 1 ] || [ $num_srk -gt 4 ]
@@ -128,10 +84,7 @@ then
exit 1
fi
-# Check if SRKs should be generated as CA certs or user certs
-printf "Do you want the SRK certificates to have the CA flag set? (y/n)?: \b"
-read srk_ca
-
+srk_ca="y"
# Check that the file "serial" is present, if not create it:
if [ ! -f serial ]
then
@@ -154,6 +107,9 @@ echo "unique_subject = no" > index.txt.attr
if [ $existing_ca = "n" ]
then
+ ca_key=./CA1_sha256_${kl}_65537_v3_ca_key
+ ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt
+
# Generate CA key and certificate
# -------------------------------
echo
@@ -161,31 +117,12 @@ then
echo + Generating CA key and certificate +
echo +++++++++++++++++++++++++++++++++++++
echo
-
- if [ $use_ecc = 'n' ]
- then
- ca_key=./CA1_sha256_${kl}_65537_v3_ca_key
- ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt
- ca_subj_req=/CN=CA1_sha256_${kl}_65537_v3_ca/
- ca_key_type=rsa:${kl}
- else
-
- # Generate Elliptic Curve parameters:
- eck='ec-'$cn'.pem'
- openssl ecparam -out $eck -name $cn
-
- ca_key=./CA1_sha256_${cn}_v3_ca_key
- ca_cert=../crts/CA1_sha256_${cn}_v3_ca_crt
- ca_subj_req=/CN=CA1_sha256_${cn}_v3_ca/
- ca_key_type=ec:${eck}
- fi
-
- openssl req -newkey ${ca_key_type} -passout file:./key_pass.txt \
- -subj ${ca_subj_req} \
- -x509 -extensions v3_ca \
- -keyout temp_ca.pem \
- -out ${ca_cert}.pem \
- -days ${val_period} -config ../ca/openssl.cnf
+ openssl req -newkey rsa:${kl} -passout file:./key_pass.txt \
+ -subj /CN=CA1_sha256_${kl}_65537_v3_ca/ \
+ -x509 -extensions v3_ca \
+ -keyout temp_ca.pem \
+ -out ${ca_cert}.pem \
+ -days ${val_period} -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Generate CA key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
@@ -202,7 +139,7 @@ then
openssl x509 -inform PEM -outform DER -in ${ca_cert}.pem -out ${ca_cert}.der
# Cleanup
- \rm temp_ca.pem
+ rm temp_ca.pem
fi
@@ -219,64 +156,48 @@ then
echo + Generating SRK key and certificate $i +
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate SRK key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_srk.pem ${kl}
-
- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_usr/
- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt
- srk_key=./SRK${i}_sha256_${kl}_65537_v3_usr_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey
- # Generate SRK key
- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_srk.pem
-
- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_usr/
- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_usr_crt
- srk_key=./SRK${i}_sha256_${cn}_v3_usr_key
- fi
+
+ # Generate SRK key
+ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
+ -out ./temp_srk.pem ${kl}
# Generate SRK certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${srk_subj_req} \
+ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_usr/ \
-key ./temp_srk.pem \
-out ./temp_srk_req.pem
# Generate SRK certificate (this is a CA cert)
- openssl ca -batch -passin file:./key_pass.txt \
- -md sha256 -outdir ./ \
- -in ./temp_srk_req.pem \
- -cert ${ca_cert}.pem \
+ openssl ca -batch -passin file:./key_pass.txt \
+ -md sha256 -outdir ./ \
+ -in ./temp_srk_req.pem \
+ -cert ${ca_cert}.pem \
-keyfile ${ca_key}.pem \
- -extfile ../ca/v3_usr.cnf \
- -out ${srk_crt}.pem \
- -days ${val_period} \
- -config ../ca/openssl.cnf
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \
+ -days ${val_period} \
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SRK Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${srk_crt}.pem \
- -out ${srk_crt}.der
+ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.der
# Generate SRK key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt \
-passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.der
+ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt \
-passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.pem
+ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.pem
# Cleanup
- \rm ./temp_srk.pem ./temp_srk_req.pem
+ rm ./temp_srk.pem ./temp_srk_req.pem
i=$((i+1))
done
else
@@ -293,98 +214,60 @@ do
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate SRK key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_srk.pem ${kl}
-
- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_ca/
- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt
- srk_key=./SRK${i}_sha256_${kl}_65537_v3_ca_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey
- # Generate SRK key
- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_srk.pem
-
- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_ca/
- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_ca_crt
- srk_key=./SRK${i}_sha256_${cn}_v3_ca_key
- fi
+ # Generate SRK key
+ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
+ -out ./temp_srk.pem ${kl}
+
# Generate SRK certificate signing request
- openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${srk_subj_req} \
- -key ./temp_srk.pem \
- -out ./temp_srk_req.pem
+ openssl req -new -batch -passin file:./key_pass.txt \
+ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_ca/ \
+ -key ./temp_srk.pem \
+ -out ./temp_srk_req.pem
# Generate SRK certificate (this is a CA cert)
- openssl ca -batch -passin file:./key_pass.txt \
- -md sha256 -outdir ./ \
- -in ./temp_srk_req.pem \
- -cert ${ca_cert}.pem \
- -keyfile ${ca_key}.pem \
- -extfile ../ca/v3_ca.cnf \
- -out ${srk_crt}.pem \
- -days ${val_period} \
- -config ../ca/openssl.cnf
+ openssl ca -batch -passin file:./key_pass.txt \
+ -md sha256 -outdir ./ \
+ -in ./temp_srk_req.pem \
+ -cert ${ca_cert}.pem \
+ -keyfile ${ca_key}.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_ca.cnf" \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -days ${val_period} \
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SRK Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${srk_crt}.pem \
- -out ${srk_crt}.der
+ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.der
# Generate SRK key in PKCS #8 format - both PEM and DER
- openssl pkcs8 -passin file:./key_pass.txt \
- -passout file:./key_pass.txt \
+ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.der
+ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.der
- openssl pkcs8 -passin file:./key_pass.txt \
- -passout file:./key_pass.txt \
+ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.pem
+ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem
# Cleanup
\rm ./temp_srk.pem ./temp_srk_req.pem
+
echo
echo ++++++++++++++++++++++++++++++++++++++++
echo + Generating CSF key and certificate $i +
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- srk_crt_i=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem
- srk_key_i=./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem
- # Generate key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_csf.pem ${kl}
-
- csf_subj_req=/CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/
- csf_crt=../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt
- csf_key=./CSF${i}_1_sha256_${kl}_65537_v3_usr_key
- else
- srk_crt_i=../crts/SRK${i}_sha256_${cn}_v3_ca_crt.pem
- srk_key_i=./SRK${i}_sha256_${cn}_v3_ca_key.pem
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_csf.pem -name ${cn} -genkey
- # Generate key
- openssl ec -in ./temp_csf.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_csf.pem
-
- csf_subj_req=/CN=CSF${i}_1_sha256_${cn}_v3_usr/
- csf_crt=../crts/CSF${i}_1_sha256_${cn}_v3_usr_crt
- csf_key=./CSF${i}_1_sha256_${cn}_v3_usr_key
- fi
+ # Generate key
+ openssl genrsa -des3 -passout file:./key_pass.txt \
+ -f4 -out ./temp_csf.pem ${kl}
# Generate CSF certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${csf_subj_req} \
+ -subj /CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/ \
-key ./temp_csf.pem \
-out ./temp_csf_req.pem
@@ -392,31 +275,31 @@ do
openssl ca -batch -md sha256 -outdir ./ \
-passin file:./key_pass.txt \
-in ./temp_csf_req.pem \
- -cert ${srk_crt_i} \
- -keyfile ${srk_key_i} \
- -extfile ../ca/v3_usr.cnf \
- -out ${csf_crt}.pem \
+ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert CSF Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${csf_crt}.pem \
- -out ${csf_crt}.der
+ -in ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.der
# Generate CSF key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_csf.pem \
- -out ${csf_key}.der
+ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_csf.pem \
- -out ${csf_key}.pem
+ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.pem
# Cleanup
- \rm ./temp_csf.pem ./temp_csf_req.pem
+ rm ./temp_csf.pem ./temp_csf_req.pem
echo
echo ++++++++++++++++++++++++++++++++++++++++
@@ -424,61 +307,45 @@ do
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_img.pem ${kl}
-
- img_subj_req=/CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/
- img_crt=../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt
- img_key=./IMG${i}_1_sha256_${kl}_65537_v3_usr_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_img.pem -name ${cn} -genkey
- # Generate key
- openssl ec -in ./temp_img.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_img.pem
-
- img_subj_req=/CN=IMG${i}_1_sha256_${cn}_v3_usr/
- img_crt=../crts/IMG${i}_1_sha256_${cn}_v3_usr_crt
- img_key=./IMG${i}_1_sha256_${cn}_v3_usr_key
- fi
+ # Generate key
+ openssl genrsa -des3 -passout file:./key_pass.txt \
+ -f4 -out ./temp_img.pem ${kl}
# Generate IMG certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${img_subj_req} \
+ -subj /CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/ \
-key ./temp_img.pem \
-out ./temp_img_req.pem
openssl ca -batch -md sha256 -outdir ./ \
-passin file:./key_pass.txt \
-in ./temp_img_req.pem \
- -cert ${srk_crt_i} \
- -keyfile ${srk_key_i} \
- -extfile ../ca/v3_usr.cnf \
- -out ${img_crt}.pem \
+ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert IMG Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${img_crt}.pem \
- -out ${img_crt}.der
+ -in ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.der
# Generate IMG key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_img.pem \
- -out ${img_key}.der
+ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_img.pem \
- -out ${img_key}.pem
+ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.pem
# Cleanup
- \rm ./temp_img.pem ./temp_img_req.pem
+ rm ./temp_img.pem ./temp_img_req.pem
+
i=$((i+1))
done

View File

@ -0,0 +1,22 @@
From: "Diaz de Grenu, Jose" <Jose.DiazdeGrenu@digi.com>
Date: Tue, 12 Jul 2016 17:47:24 +0200
Subject: [PATCH] openssl_helper: use /dev/urandom as seed source
This is needed in order to avoid indefinitely blocking.
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
---
code/back_end/src/openssl_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/back_end/src/openssl_helper.c b/code/back_end/src/openssl_helper.c
index 3c9c779092c5..f0cd4e06f0dd 100644
--- a/code/back_end/src/openssl_helper.c
+++ b/code/back_end/src/openssl_helper.c
@@ -486,7 +486,7 @@ void print_version(void)
---------------------------*/
uint32_t seed_prng(uint32_t bytes)
{
- return RAND_load_file("/dev/random", bytes);
+ return RAND_load_file("/dev/urandom", bytes);
}

View File

@ -0,0 +1,24 @@
TARGET = linux64/cst
LIBS = -lfrontend -lcrypto
CC = gcc
CFLAGS = -g -Wall
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = code/back_end/src/*.c
HEADERS = code/back_end/hdr
LIBS_PATH = linux64/lib
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) -L $(LIBS_PATH) $(LIBS) -I $(HEADERS) -o $@
clean:
-rm -f *.o $(TARGET)

View File

@ -0,0 +1,36 @@
SUMMARY = "NXP Code signing Tool for the High Assurance Boot library"
DESCRIPTION = "Provides software code signing support designed for use with i.MX processors that integrate the HAB library in the internal boot ROM."
HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL"
LICENSE = "CLOSED"
DEPENDS = "openssl"
S= "${WORKDIR}/cst-${PV}"
SRC_URI = " \
${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \
file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \
file://0002-hab4_pki_tree.sh-automate-script.patch \
file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \
file://Makefile \
"
do_configure() {
cp -f ${WORKDIR}/Makefile .
}
do_compile () {
oe_runmake clean && oe_runmake
}
do_install () {
install -d ${D}${bindir}
install -m 0755 linux64/cst ${D}${bindir}/cst
install -m 0755 linux64/srktool ${D}${bindir}/srktool
install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh
install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf
install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf
install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf
}
BBCLASSEXTEND = "native"

View File

@ -60,14 +60,15 @@ else
exit;
fi;
setenv INSTALL_MMCDEV 1
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4
# Check for presence of firmware files on the SD card
for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do
if test ! -e mmc 1:1 ${install_f}; then
if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1
install_abort=1;
fi;
done
if test -n "${install_abort}"; then
@ -88,10 +89,10 @@ setenv mmcdev 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader (target will reset)";
echo ">> Installing U-Boot boot loader (target will reset)"
echo ""
echo ""
update uboot mmc 1 fat ${INSTALL_UBOOT_FILENAME}
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -106,58 +107,55 @@ fi
# - Update the 'linux' partition
# - Update the 'rootfs' partition
# - Reset the system and let it boot
setenv bootcmd '
setenv bootcmd "
env default -a;
saveenv;
setenv mmcdev 0;
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4
echo "";
echo "";
echo ">> Creating Linux partition table on the eMMC";
echo "";
echo "";
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test $? -eq 1; then
echo "[ERROR] Failed to create Linux partition table!";
echo "";
echo "Aborted.";
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "";
echo ">> Installing Linux kernel and device tree files";
echo "";
echo "";
update linux mmc 1 fat ${INSTALL_LINUX_FILENAME};
if test $? -eq 1; then
echo "[ERROR] Failed to update linux partition!";
echo "";
echo "Aborted.";
echo \"\";
echo \"\";
echo \">> Installing Linux kernel and device tree files\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "";
echo ">> Installing Linux root file system";
echo "";
echo "";
update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME};
if test $? -eq 1; then
echo "[ERROR] Failed to update rootfs partition!";
echo "";
echo "Aborted.";
echo \"\";
echo \"\";
echo \">> Installing Linux root file system\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "#######################";
echo "# Install complete! #";
echo "#######################";
echo "";
echo \"\";
echo \"#######################\";
echo \"# Install complete! #\";
echo \"#######################\";
echo \"\";
sleep 1;
echo ">> Restarting the system";
echo \">> Restarting the system\";
sleep 1;
reset;
'
"
saveenv
reset

View File

@ -0,0 +1,23 @@
#
# U-Boot bootscript for NAND images created by Yocto.
#
#
# Set device tree filename depending on the board ID (if defined)
#
if test -n "${board_id}"; then
setenv fdt_file zImage-imx6ul-ccimx6ulstarter-id${board_id}.dtb
else
#
# Set device tree filename depending on the hardware variant
#
if test "${module_variant}" = "0x02"; then
setenv fdt_file zImage-imx6ul-ccimx6ulstarter-wb.dtb
elif test "${module_variant}" = "0x03"; then
setenv fdt_file zImage-imx6ul-ccimx6ulstarter.dtb
else
echo "------ Using default fdt_file: $fdt_file"
fi
fi
dboot linux nand

View File

@ -0,0 +1,105 @@
#
# U-Boot script for installing Linux images created by Yocto from the micro SD
# card into the NAND
#
echo "############################################################"
echo "# Linux firmware install from micro SD #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install a new"
echo " U-Boot and Linux firmware images on the NAND."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
if test $? -eq 1; then
echo "Aborted by user.";
exit;
fi
setenv INSTALL_MMCDEV 0
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter.imx
setenv INSTALL_LINUX_FILENAME core-image-base-ccimx6ulstarter.boot.ubifs
setenv INSTALL_ROOTFS_FILENAME core-image-base-ccimx6ulstarter.ubifs
# Check for presence of firmware files on the SD card
for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do
if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then
echo "ERROR: Could not find file ${install_f}";
install_abort=1;
fi;
done
if test -n "${install_abort}"; then
echo "Aborted.";
exit;
fi
# Skip user confirmation for U-Boot update
setenv forced_update 1
# Set bootdelay to zero so that firmware update is run immediately after
# the first reset.
setenv bootdelay 0
# Update U-Boot
echo ""
echo ""
echo ">> Installing U-Boot boot loader (target will reset)"
echo ""
echo ""
update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
echo "Aborted.";
exit;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Save the environment
# - Update the 'linux' partition
# - Update the 'rootfs' partition
# - Reset the system and let it boot
setenv bootcmd "
env default -a;
saveenv;
echo \"\";
echo \"\";
echo \">> Installing Linux kernel and device tree files\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing Linux root file system\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"#######################\";
echo \"# Install complete! #\";
echo \"#######################\";
echo \"\";
sleep 1;
echo \">> Restarting the system\";
sleep 1;
reset;
"
saveenv
reset

View File

@ -1,16 +1,18 @@
# Copyright (C) 2012-2015 Digi International
require recipes-bsp/u-boot/u-boot.inc
require u-boot.inc
DESCRIPTION = "Bootloader for Digi platforms"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=c7383a594871c03da76b3707929d2919"
DEPENDS += "dtc-native u-boot-mkimage-native"
DEPENDS += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence-cst-native', '', d)}"
PROVIDES += "u-boot"
SRCBRANCH = "v2015.04/maint"
SRCBRANCH = "v2015.04/master"
SRCBRANCH_ccimx6ul = "v2015.04/master"
SRCREV = "${AUTOREV}"
# Select internal or Github U-Boot repo
@ -18,6 +20,9 @@ UBOOT_GIT_URI = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-bo
SRC_URI = " \
${UBOOT_GIT_URI};branch=${SRCBRANCH} \
"
SRC_URI_append = " \
file://boot.txt \
file://install_linux_fw_sd.txt \
"
@ -27,6 +32,81 @@ inherit fsl-u-boot-localversion
EXTRA_OEMAKE_append = " KCFLAGS=-fgnu89-inline"
UBOOT_EXTRA_CONF ?= ""
python __anonymous() {
if (d.getVar("TRUSTFENCE_DEK_PATH", True) not in ["0", None]) and (d.getVar("TRUSTFENCE_SIGN", True) != "1"):
bb.fatal("Only signed U-Boot images can be encrypted. Generate signed images (TRUSTFENCE_SIGN=1) or remove encryption (TRUSTFENCE_DEK_PATH = 0)")
if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True) not in [None, "0"]):
if (d.getVar("TRUSTFENCE_DEK_PATH", True) in [None, "0"]):
bb.warn("It is strongly recommended to encrypt the U-Boot image when using environment encryption. Consider removing TRUSTFENCE_DEK_PATH = 0")
if (len(d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True)) != 32):
bb.fatal("Invalid TRUSTFENCE_UBOOT_ENV_DEK length. Define a string formed by 32 hexadecimal characters")
}
do_compile () {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
fi
unset LDFLAGS
unset CFLAGS
unset CPPFLAGS
if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
then
echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
fi
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
oe_runmake O=build_${config} ${config}
for var in ${UBOOT_EXTRA_CONF}; do
echo "${var}" >> build_${config}/.config
done
oe_runmake O=build_${config} oldconfig
oe_runmake O=build_${config} ${UBOOT_MAKE_TARGET}
cp ${S}/build_${config}/${UBOOT_BINARY} ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX}
# Secure boot artifacts
if [ "${TRUSTFENCE_SIGN}" = "1" ]
then
cp ${S}/build_${config}/u-boot-signed.imx ${S}/build_${config}/u-boot-signed-${type}.${UBOOT_SUFFIX}
if [ "${TRUSTFENCE_DEK_PATH}" != "0" ]
then
cp ${S}/build_${config}/u-boot-encrypted.imx ${S}/build_${config}/u-boot-encrypted-${type}.${UBOOT_SUFFIX}
fi
fi
fi
done
unset j
done
unset i
else
oe_runmake ${UBOOT_MACHINE}
for var in ${UBOOT_EXTRA_CONF}; do
echo "${var}" >> .config
done
oe_runmake oldconfig
oe_runmake ${UBOOT_MAKE_TARGET}
fi
}
TF_BOOTSCRIPT_SEDFILTER = ""
TF_BOOTSCRIPT_SEDFILTER_ccimx6 = "${@tf_bootscript_sedfilter(d)}"
def tf_bootscript_sedfilter(d):
tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or ""
return "/^dboot linux/i\setenv boot_initrd true\\nsetenv initrd_file %s-${MACHINE}.cpio.gz.u-boot" % tf_initramfs if tf_initramfs else ""
do_deploy_append() {
# Remove canonical U-Boot symlinks for ${UBOOT_CONFIG} currently in the form:
# u-boot-<platform>.imx-<type>
@ -42,6 +122,20 @@ do_deploy_append() {
cd ${DEPLOYDIR}
rm -r ${UBOOT_BINARY}-${type} ${UBOOT_SYMLINK}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-${type}.${UBOOT_SUFFIX}
if [ "${TRUSTFENCE_SIGN}" = "1" ]
then
install ${S}/build_${config}/SRK_efuses.bin SRK_efuses-${PV}-${PR}.bin
ln -sf SRK_efuses-${PV}-${PR}.bin SRK_efuses.bin
install ${S}/build_${config}/u-boot-signed-${type}.${UBOOT_SUFFIX} u-boot-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
ln -sf u-boot-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-signed-${type}.${UBOOT_SUFFIX}
if [ "${TRUSTFENCE_DEK_PATH}" != "0" ]
then
install ${S}/build_${config}/u-boot-encrypted-${type}.${UBOOT_SUFFIX} u-boot-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
ln -sf u-boot-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-encrypted-${type}.${UBOOT_SUFFIX}
fi
fi
fi
done
unset j
@ -53,8 +147,11 @@ do_deploy_append() {
sed -i -e 's,##GRAPHICAL_BACKEND##,${GRAPHICAL_BACKEND},g' ${WORKDIR}/install_linux_fw_sd.txt
mkimage -T script -n "DEY firmware install script" -C none -d ${WORKDIR}/install_linux_fw_sd.txt ${DEPLOYDIR}/install_linux_fw_sd.scr
# Boot script for DEY images
mkimage -T script -n bootscript -C none -d ${WORKDIR}/boot.txt ${DEPLOYDIR}/boot.scr
# Boot script for DEY images (reconfigure on-the-fly if TRUSTFENCE is enabled)
TMP_BOOTSCR="$(mktemp ${WORKDIR}/bootscr.XXXXXX)"
sed -e "${TF_BOOTSCRIPT_SEDFILTER}" ${WORKDIR}/boot.txt > ${TMP_BOOTSCR}
mkimage -T script -n bootscript -C none -d ${TMP_BOOTSCR} ${DEPLOYDIR}/boot.scr
rm -f ${TMP_BOOTSCR}
}
COMPATIBLE_MACHINE = "(ccimx6)"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)"

View File

@ -0,0 +1,7 @@
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Device name Offset Size
/dev/mtd1 0x0 0x20000
/dev/mtd1 0x20000 0x20000

View File

@ -2,12 +2,10 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " \
file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch \
file://fw_env.config \
"
SRC_URI += "file://fw_env.config"
SRC_URI_append_ccimx6 = " file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch"
# We do not have a CC6 defconfig in this version of u-boot, so just use the generic
# We do not have a platform defconfig in this version of u-boot, so just use the generic
# sandbox defconfig, which is enough to build the Linux user-space tool (fw_printenv)
UBOOT_CONFIG = "sandbox"
UBOOT_CONFIG[sandbox] = "sandbox_defconfig"
@ -16,7 +14,7 @@ do_install_append() {
install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/
}
pkg_postinst_${PN}() {
pkg_postinst_${PN}_ccimx6() {
# run the postinst script on first boot
if [ x"$D" != "x" ]; then
exit 1
@ -27,4 +25,4 @@ pkg_postinst_${PN}() {
fi
}
COMPATIBLE_MACHINE = "(ccimx6)"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)"

View File

@ -0,0 +1,290 @@
SUMMARY = "Universal Boot Loader for embedded devices"
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
SECTION = "bootloaders"
PROVIDES = "virtual/bootloader"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=0507cd7da8e7ad6d6701926ec9b84c95"
SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
S = "${WORKDIR}/git"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit uboot-config deploy
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1'
EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
PACKAGECONFIG ??= "openssl"
# u-boot will compile its own tools during the build, with specific
# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as
# a host build dependency.
PACKAGECONFIG[openssl] = ",,openssl-native"
# Allow setting an additional version string that will be picked up by the
# u-boot build system and appended to the u-boot version. If the .scmversion
# file already exists it will not be overwritten.
UBOOT_LOCALVERSION ?= ""
# Some versions of u-boot use .bin and others use .img. By default use .bin
# but enable individual recipes to change this value.
UBOOT_SUFFIX ??= "bin"
UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
UBOOT_MAKE_TARGET ?= "all"
# Output the ELF generated. Some platforms can use the ELF file and directly
# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
# purposes.
UBOOT_ELF ?= ""
UBOOT_ELF_SUFFIX ?= "elf"
UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
# Some versions of u-boot build an SPL (Second Program Loader) image that
# should be packaged along with the u-boot binary as well as placed in the
# deploy directory. For those versions they can set the following variables
# to allow packaging the SPL.
SPL_BINARY ?= ""
SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
# Additional environment variables or a script can be installed alongside
# u-boot to be used automatically on boot. This file, typically 'uEnv.txt'
# or 'boot.scr', should be packaged along with u-boot as well as placed in the
# deploy directory. Machine configurations needing one of these files should
# include it in the SRC_URI and set the UBOOT_ENV parameter.
UBOOT_ENV_SUFFIX ?= "txt"
UBOOT_ENV ?= ""
UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
do_compile () {
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
fi
unset LDFLAGS
unset CFLAGS
unset CPPFLAGS
if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
then
echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
fi
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
oe_runmake O=build_${config} ${config}
oe_runmake O=build_${config} ${UBOOT_MAKE_TARGET}
cp ${S}/build_${config}/${UBOOT_BINARY} ${S}/buidl_${config}/u-boot-${type}.${UBOOT_SUFFIX}
fi
done
unset j
done
unset i
else
oe_runmake ${UBOOT_MACHINE}
oe_runmake ${UBOOT_MAKE_TARGET}
fi
}
do_install () {
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install -d ${D}/boot
install ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
fi
done
unset j
done
unset i
else
install -d ${D}/boot
install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
fi
if [ "x${UBOOT_ELF}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install ${S}/build_${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
fi
done
unset j
done
unset i
else
install ${S}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
fi
fi
if [ -e ${WORKDIR}/fw_env.config ] ; then
install -d ${D}${sysconfdir}
install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
fi
if [ "x${SPL_BINARY}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install ${S}/build_${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARY}-${type}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARY}
fi
done
unset j
done
unset i
else
install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARY}
fi
fi
if [ "x${UBOOT_ENV}" != "x" ]
then
install ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
fi
}
FILES_${PN} = "/boot ${sysconfdir}"
# Ensure the split debug part of any elf files are put into dbg
FILES_${PN}-dbg += "/boot/.debug"
do_deploy () {
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install -d ${DEPLOYDIR}
install ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
cd ${DEPLOYDIR}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
fi
done
unset j
done
unset i
else
install -d ${DEPLOYDIR}
install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
cd ${DEPLOYDIR}
rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
fi
if [ "x${UBOOT_ELF}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install ${S}/build_${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
fi
done
unset j
done
unset i
else
install ${S}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
fi
fi
if [ "x${SPL_BINARY}" != "x" ]
then
if [ "x${UBOOT_CONFIG}" != "x" ]
then
for config in ${UBOOT_MACHINE}; do
i=`expr $i + 1`;
for type in ${UBOOT_CONFIG}; do
j=`expr $j + 1`;
if [ $j -eq $i ]
then
install ${S}/build_${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR}
rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARY}-${type}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARY}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}
fi
done
unset j
done
unset i
else
install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK}
ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY}
ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
fi
fi
if [ "x${UBOOT_ENV}" != "x" ]
then
install ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
fi
}
addtask deploy before do_build after do_compile

View File

@ -0,0 +1,3 @@
# Copyright (C) 2016 Digi International.
KERNEL_MODULE_AUTOLOAD = "cryptodev"

View File

@ -0,0 +1,63 @@
# Copyright (C) 2016 Digi International.
SUMMARY = "Qualcomm's wireless driver for qca6564"
DESCRIPTION = "qcacld-2.0 module.bbclass mechanism."
LICENSE = "ISC"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d"
DEPENDS = "virtual/kernel"
inherit module
CAF_MIRROR = "git://codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/qcacld-2.0"
PV = "v4.2.74.63"
SRCBRANCH = "caf-wlan/QCA6564_LE_1.0.3_LA.4.2.2.3"
SRCREV = "38f01638d75bdf3eb83ac428a4b6ec528b26f541"
SRC_URI = " \
${CAF_MIRROR};destsuffix=${PV};branch=${SRCBRANCH} \
file://qualcomm-pre-up \
file://modprobe-qualcomm.conf \
file://0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch \
file://0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch \
file://0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch \
file://0004-qcacld-2.0-remove-unused-code.patch \
file://0005-Including-header-file-for-regulatory_hint_user.patch \
file://0006-Updating-calls-to-alloc_netdev_mq.patch \
file://0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch \
file://0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch \
file://0009-linux_ac-Fix-for-f_dentry.patch \
file://0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch \
file://0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch \
file://0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch \
file://0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch \
file://0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch \
file://0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch \
"
S = "${WORKDIR}/${PV}"
EXTRA_OEMAKE += "CONFIG_CLD_HL_SDIO_CORE=y CONFIG_LINUX_QCMBR=y WLAN_OPEN_SOURCE=1"
# Explicity state it is not a QC platform, if not the driver will try to remap
# memory that is not allowed in ARMv6 (kernel commit
# 309caa9cc6ff39d261264ec4ff10e29489afc8f8)
EXTRA_OEMAKE += "CONFIG_NON_QC_PLATFORM=y"
# Flag to compile the debug version (1 - enabled, rest of values - disabled)
EXTRA_OEMAKE += "BUILD_DEBUG_VERSION=0"
do_compile_prepend() {
export BUILD_VER=${PV}
}
do_install_append() {
install -d ${D}${sysconfdir}/network/if-pre-up.d
install -m 0755 ${WORKDIR}/qualcomm-pre-up ${D}${sysconfdir}/network/if-pre-up.d/qualcomm
install -d ${D}${sysconfdir}/modprobe.d
install -m 0644 ${WORKDIR}/modprobe-qualcomm.conf ${D}${sysconfdir}/modprobe.d/qualcomm.conf
}
FILES_${PN} += " \
${sysconfdir}/network/if-pre-up.d/qualcomm \
${sysconfdir}/modprobe.d/qualcomm.conf \
"
COMPATIBLE_MACHINE = "(ccimx6ul)"

View File

@ -0,0 +1,64 @@
From: Yi Chen <yichen@qti.qualcomm.com>
Date: Fri, 28 Aug 2015 19:24:45 +0800
Subject: [PATCH] qcacld: Fix compiling errors when BUILD_DEBUG_VERSION := 0.
This is a compiling issue when BUILD_DEBUG_VERSION := 0 is set in Kbuild.
Change-Id: Iaee98eb91d66990dfa4989a7c07cb5592f8a6079
CRs-Fixed: 898366
(cherry picked from commit d0258ff1dcf19236e4cfa69e45f75b72a1334609)
---
CORE/UTILS/FWLOG/dbglog_host.c | 4 ++--
Kbuild | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/CORE/UTILS/FWLOG/dbglog_host.c b/CORE/UTILS/FWLOG/dbglog_host.c
index 2dfa45983a87..63fc742259fc 100644
--- a/CORE/UTILS/FWLOG/dbglog_host.c
+++ b/CORE/UTILS/FWLOG/dbglog_host.c
@@ -55,8 +55,6 @@
#include <a_debug.h>
#define FWLOG_DEBUG ATH_DEBUG_MAKE_MODULE_MASK(0)
-#if defined(DEBUG)
-
static bool appstarted = FALSE;
static bool senddriverstatus = FALSE;
static bool kd_nl_init = FALSE;
@@ -64,6 +62,8 @@ static int cnss_diag_pid = INVALID_PID;
static int get_version = 0;
static int gprint_limiter = 0;
+#if defined(DEBUG)
+
static ATH_DEBUG_MASK_DESCRIPTION g_fwlogDebugDescription[] = {
{FWLOG_DEBUG,"fwlog"},
};
diff --git a/Kbuild b/Kbuild
index 04461cfb7945..b248eee28bf0 100644
--- a/Kbuild
+++ b/Kbuild
@@ -882,7 +882,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \
-DWLAN_PERF \
-DPTT_SOCK_SVC_ENABLE \
-Wall\
- -Werror\
-D__linux__ \
-DHAL_SELF_STA_PER_BSS=1 \
-DWLAN_FEATURE_VOWIFI_11R \
@@ -966,11 +965,12 @@ CDEFINES += -DWCN_PRONTO
CDEFINES += -DWCN_PRONTO_V1
endif
+CDEFINES += -DTRACE_RECORD \
+ -DLIM_TRACE_RECORD \
+ -DSME_TRACE_RECORD
+
ifeq ($(BUILD_DEBUG_VERSION),1)
CDEFINES += -DWLAN_DEBUG \
- -DTRACE_RECORD \
- -DLIM_TRACE_RECORD \
- -DSME_TRACE_RECORD \
-DPE_DEBUG_LOGW \
-DPE_DEBUG_LOGE \
-DDEBUG

View File

@ -0,0 +1,57 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Mon, 18 Apr 2016 08:48:14 +0200
Subject: [PATCH] Update cfg80211_vendor_event_alloc call for newer kernel
versions
Current compilation fails with next error.
> wlan_hdd_cfg80211.h:995:9: error: too few arguments to function 'cfg80211_vendor_event_alloc'
This function has been updated starting with kernel 3.15
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/HDD/inc/wlan_hdd_cfg80211.h | 2 +-
CORE/HDD/src/wlan_hdd_assoc.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index 7602f1d3874b..a40c55144bc5 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -992,7 +992,7 @@ backported_cfg80211_vendor_event_alloc(struct wiphy *wiphy,
int approxlen,
int event_idx, gfp_t gfp)
{
- return cfg80211_vendor_event_alloc(wiphy, approxlen, event_idx, gfp);
+ return cfg80211_vendor_event_alloc(wiphy, wdev, approxlen, event_idx, gfp);
}
#define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc
#endif
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index bc3e15009d97..5dc882fa8f83 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -2027,6 +2027,8 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter,
eRoamCmdStatus roamStatus,
eCsrRoamResult roamResult )
{
+ struct ieee80211_channel *chann;
+
hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d",
__func__, pAdapter->dev->name, roamId, roamStatus, roamResult);
@@ -2082,7 +2084,13 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter,
return;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
+ chann = ieee80211_get_channel(pAdapter->wdev.wiphy,
+ (int)pRoamInfo->pBssDesc->channelId);
+ cfg80211_ibss_joined(pAdapter->dev, bss->bssid, chann, GFP_KERNEL);
+#else
cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL);
+#endif
cfg80211_put_bss(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) || defined(WITH_BACKPORTS)
pHddCtx->wiphy,

View File

@ -0,0 +1,30 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 10:30:51 +0200
Subject: [PATCH] wlan_hdd_main: Update cfg80211_ap_stopped to
nl80211_send_ap_stopped
Use nl80211_send_ap_stopped instead of cfg80211_ap_stopped for newer
kernel versions
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/HDD/src/wlan_hdd_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 5e4e95aaaee4..0ff3f31b9863 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -9929,8 +9929,12 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx )
#if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS)
hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant",
__func__);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL);
#else
+ nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr);
+#endif
+#else
hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant",
__func__);
/* event supplicant to restart */

View File

@ -0,0 +1,215 @@
From: Karthick S <skarthic@qti.qualcomm.com>
Date: Fri, 14 Aug 2015 14:52:23 +0530
Subject: [PATCH] qcacld-2.0: remove unused code
Removed unused code from ReinitSDIO. Also removed mmcbusmode and it's
related references in the code.
Change-Id: Idaa40f31cc830c0e2fa5d6fbda8c78c9f434bdaf
CRs-Fixed: 890630
(cherry picked from commit acca7f817db52580a985de2804f30973b2ed9cb7)
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
(cherry picked from commit d63533a6cc46671141ac31290e4f020c236298ee)
---
CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 165 +--------------------
1 file changed, 2 insertions(+), 163 deletions(-)
diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
index 31641c94351c..b3afed2a8d7c 100644
--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
+++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
@@ -57,11 +57,6 @@
#define MAX_HIF_DEVICES 2
-unsigned int mmcbusmode = 0;
-module_param(mmcbusmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-MODULE_PARM_DESC(mmcbusmode, "Set MMC driver Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104");
-EXPORT_SYMBOL(mmcbusmode);
-
unsigned int mmcbuswidth = 0;
module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(mmcbuswidth, "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit");
@@ -689,98 +684,6 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
sdio_claim_host(func);
do {
- /* 2.6.32 kernel does part of the SDIO initalization upon resume */
- A_BOOL lt_2_6_32 = (LINUX_VERSION_CODE<KERNEL_VERSION(2,6,32));
- if (lt_2_6_32) {
- A_UINT32 resp;
- A_UINT16 rca;
- A_UINT32 i;
- int bit = fls(host->ocr_avail) - 1;
- /* emulate the mmc_power_up(...) */
- host->ios.vdd = bit;
- host->ios.chip_select = MMC_CS_DONTCARE;
- host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
- host->ios.power_mode = MMC_POWER_UP;
- host->ios.bus_width = MMC_BUS_WIDTH_1;
- host->ios.timing = MMC_TIMING_LEGACY;
- host->ops->set_ios(host, &host->ios);
- /*
- * This delay should be sufficient to allow the power supply
- * to reach the minimum voltage.
- */
- msleep(2);
-
- host->ios.clock = host->f_min;
- host->ios.power_mode = MMC_POWER_ON;
- host->ops->set_ios(host, &host->ios);
-
- /*
- * This delay must be at least 74 clock sizes, or 1 ms, or the
- * time required to reach a stable voltage.
- */
- msleep(2);
-
- /* Issue CMD0. Goto idle state */
- host->ios.chip_select = MMC_CS_HIGH;
- host->ops->set_ios(host, &host->ios);
- msleep(1);
- err = IssueSDCommand(device, MMC_GO_IDLE_STATE, 0, (MMC_RSP_NONE | MMC_CMD_BC), NULL);
- host->ios.chip_select = MMC_CS_DONTCARE;
- host->ops->set_ios(host, &host->ios);
- msleep(1);
- host->use_spi_crc = 0;
-
- if (err) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD0 failed : %d \n",err));
- break;
- }
-
- if (!host->ocr) {
- /* Issue CMD5, arg = 0 */
- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp);
- if (err) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err));
- break;
- }
- host->ocr = resp;
- }
-
- /* Issue CMD5, arg = ocr. Wait till card is ready */
- for (i=0;i<100;i++) {
- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, host->ocr, (MMC_RSP_R4 | MMC_CMD_BCR), &resp);
- if (err) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err));
- break;
- }
- if (resp & MMC_CARD_BUSY) {
- break;
- }
- msleep(10);
- }
-
- if ((i == 100) || (err)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: card in not ready : %d %d \n",i,err));
- break;
- }
-
- /* Issue CMD3, get RCA */
- err = IssueSDCommand(device, SD_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6 | MMC_CMD_BCR, &resp);
- if (err) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD3 failed : %d \n",err));
- break;
- }
- rca = resp >> 16;
- host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
- host->ops->set_ios(host, &host->ios);
-
- /* Issue CMD7, select card */
- err = IssueSDCommand(device, MMC_SELECT_CARD, (rca << 16), MMC_RSP_R1 | MMC_CMD_AC, NULL);
- if (err) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD7 failed : %d \n",err));
- break;
- }
- }
-
/* Enable high speed */
if (card->host->caps & MMC_CAP_SD_HIGHSPEED) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("ReinitSDIO: Set high speed mode\n"));
@@ -1212,10 +1115,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe
*/
{
A_UINT32 clock, clock_set = 12500000;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
- unsigned int bus_speed = 0, timing = 0;
- unsigned char speed = 0;
-#endif
+
sdio_claim_host(func);
if (writecccr1) {
A_UINT32 err = Func0_CMD52WriteByte(func->card,
@@ -1352,69 +1252,8 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe
if (debugcccr) {
HIFDumpCCCR(device);
}
- // Set MMC Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104
- if (mmcbusmode > 0) {
- printk("host caps:0x%08X, card_sd3_bus_mode:0x%08X\n", (unsigned int)func->card->host->caps, (unsigned int)func->card->sw_caps.sd3_bus_mode);
- if (mmcbusmode == 5 && (func->card->host->caps & MMC_CAP_UHS_SDR104) &&
- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104) || forcecard)) {
- bus_speed = SDIO_SPEED_SDR104;
- timing = MMC_TIMING_UHS_SDR104;
- func->card->sw_caps.uhs_max_dtr = UHS_SDR104_MAX_DTR;
- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR104. \n", __func__));
- } else if (mmcbusmode == 4 && (func->card->host->caps & MMC_CAP_UHS_DDR50) &&
- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_DDR50) || forcecard)) {
- bus_speed = SDIO_SPEED_DDR50;
- timing = MMC_TIMING_UHS_DDR50;
- func->card->sw_caps.uhs_max_dtr = UHS_DDR50_MAX_DTR;
- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to DDR50. \n", __func__));
- } else if (mmcbusmode == 3 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50)) &&
- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) || forcecard)) {
- bus_speed = SDIO_SPEED_SDR50;
- timing = MMC_TIMING_UHS_SDR50;
- func->card->sw_caps.uhs_max_dtr = UHS_SDR50_MAX_DTR;
- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR50. \n", __func__));
- } else if (mmcbusmode == 2 && (func->card->host->caps &
- (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25)) &&
- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR25) || forcecard)) {
- bus_speed = SDIO_SPEED_SDR25;
- timing = MMC_TIMING_UHS_SDR25;
- func->card->sw_caps.uhs_max_dtr = UHS_SDR25_MAX_DTR;
- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR25. \n", __func__));
- } else if (mmcbusmode == 1 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 |
- MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)) &&
- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR12) || forcecard)) {
- bus_speed = SDIO_SPEED_SDR12;
- timing = MMC_TIMING_UHS_SDR12;
- func->card->sw_caps.uhs_max_dtr = UHS_SDR12_MAX_DTR;
- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR12. \n", __func__));
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: MMC bus mode %d not supported. \n", __func__, mmcbusmode));
- return ret = -1;
- }
-
- ret = Func0_CMD52ReadByte(func->card, SDIO_CCCR_SPEED, &speed);
- if (ret){
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to get CCCR SPEED failed: %d, cap_uhs: %lu, sd3_bus_mode: %x \n", __func__, ret, (long unsigned int)(func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)), func->card->sw_caps.sd3_bus_mode));
- return ret;
- }
-
- speed &= ~SDIO_SPEED_BSS_MASK;
- speed |= bus_speed;
- ret = Func0_CMD52WriteByte(func->card, SDIO_CCCR_SPEED, speed);
- if (ret){
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to set CCCR SPPED failed: %d \n", __func__, ret));
- return ret;
- }
-
- if (bus_speed) {
- device->host->ios.timing = timing;
- device->host->ops->set_ios(device->host, &device->host->ios);
- // mmc_set_clock(func->card->host, func->card->sw_caps.uhs_max_dtr);
- }
- }
-
-#endif //#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) */
sdio_release_host(func);
}

View File

@ -0,0 +1,28 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 13:19:10 +0200
Subject: [PATCH] Including header file for "regulatory_hint_user"
The function "regulatory_hint_user" has been moved from
include/net/cfg80211.h to net/wireless/reg.h.
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
(cherry picked from commit db944bc907127c191b1bbdcc58d3aecedcf44a8c)
---
CORE/VOSS/src/vos_nvitem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c
index d79ae2871e4b..47290c9d1744 100644
--- a/CORE/VOSS/src/vos_nvitem.c
+++ b/CORE/VOSS/src/vos_nvitem.c
@@ -53,6 +53,10 @@
#include "regdomain.h"
#include "regdomain_common.h"
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
+#include <../net/wireless/reg.h>
+#endif
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) && !defined(WITH_BACKPORTS)
#define IEEE80211_CHAN_NO_80MHZ 1<<7
#endif

View File

@ -0,0 +1,75 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 13:52:18 +0200
Subject: [PATCH] Updating calls to "alloc_netdev_mq"
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/EPPING/src/epping_txrx.c | 6 ++++++
CORE/HDD/src/wlan_hdd_hostapd.c | 4 ++++
CORE/HDD/src/wlan_hdd_main.c | 10 +++++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/CORE/EPPING/src/epping_txrx.c b/CORE/EPPING/src/epping_txrx.c
index 678d58e0cfae..0985e362f94a 100644
--- a/CORE/EPPING/src/epping_txrx.c
+++ b/CORE/EPPING/src/epping_txrx.c
@@ -355,7 +355,13 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx,
struct net_device *dev;
epping_adapter_t *pAdapter;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", NET_NAME_UNKNOWN, ether_setup);
+#else
dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", ether_setup);
+#endif
+
+
if (dev == NULL) {
EPPING_LOG(VOS_TRACE_LEVEL_FATAL,
"%s: Cannot allocate epping_adapter_t\n", __func__);
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 6251224c11df..8a80d26f355a 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -5447,7 +5447,11 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd
hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: iface_name = %s", __func__, iface_name);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES);
+#else
pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES);
+#endif
if (pWlanHostapdDev != NULL)
{
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 0ff3f31b9863..a10da2a9b164 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -8226,7 +8226,11 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac
/*
* cfg80211 initialization and registration....
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+ pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES);
+#else
pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, ether_setup, NUM_TX_QUEUES);
+#endif
if(pWlanDev != NULL)
{
@@ -9929,10 +9933,10 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx )
#if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS)
hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant",
__func__);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
- cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL);
-#else
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr);
+#else
+ cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL);
#endif
#else
hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant",

View File

@ -0,0 +1,28 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 13:56:15 +0200
Subject: [PATCH] wlan_hdd_cfg80211: update "cfg80211_inform_bss" params for
kernel version
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/HDD/src/wlan_hdd_cfg80211.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index c09ac0304852..c6c79552a9d0 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -8460,8 +8460,11 @@ static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss(
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
if (bss == NULL) {
rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100;
-
- return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId,
+ return (cfg80211_inform_bss(wiphy, chan,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+ CFG80211_BSS_FTYPE_BEACON,
+#endif
+ pBssDesc->bssId,
le64_to_cpu(*(__le64 *)pBssDesc->timeStamp),
pBssDesc->capabilityInfo,
pBssDesc->beaconInterval, ie, ie_length,

View File

@ -0,0 +1,45 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 13:57:03 +0200
Subject: [PATCH] wlan_hdd_p2p: Update call to "cfg80211_rx_mgmt" for different
kernel versions
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/HDD/src/wlan_hdd_p2p.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 0c6645f077f1..476b456e165c 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -826,7 +826,16 @@ void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter )
// Check for cached action frame
if(pRemainChanCtx->action_pkt_buff.frame_length != 0)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS)
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr,
+ pRemainChanCtx->action_pkt_buff.freq, 0,
+ pRemainChanCtx->action_pkt_buff.frame_ptr,
+ pRemainChanCtx->action_pkt_buff.frame_length,
+ NL80211_RXMGMT_FLAG_ANSWERED);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS)
cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr,
pRemainChanCtx->action_pkt_buff.freq, 0,
pRemainChanCtx->action_pkt_buff.frame_ptr,
@@ -2340,7 +2349,11 @@ void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter,
//Indicate Frame Over Normal Interface
hddLog( LOG1, FL("Indicate Frame over NL80211 Interface"));
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS)
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames,
+ nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS)
cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames,
nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED, GFP_ATOMIC);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))

View File

@ -0,0 +1,43 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 13:58:29 +0200
Subject: [PATCH] =?UTF-8?q?linux=5Fac:=20Fix=20for=20=E2=80=98f=5Fdentry?=
=?UTF-8?q?=E2=80=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://communities.vmware.com/thread/499483?start=0&tstart=0
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/UTILS/PKTLOG/linux_ac.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/CORE/UTILS/PKTLOG/linux_ac.c b/CORE/UTILS/PKTLOG/linux_ac.c
index b1969ad5d2ba..8d45d7365b2b 100644
--- a/CORE/UTILS/PKTLOG/linux_ac.c
+++ b/CORE/UTILS/PKTLOG/linux_ac.c
@@ -576,7 +576,10 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
int rem_len;
int start_offset, end_offset;
int fold_offset, ppos_data, cur_rd_offset;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *)
+ PDE_DATA(file_inode(file));
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *)
PDE_DATA(file->f_dentry->d_inode);
#else
@@ -817,7 +820,10 @@ static struct vm_operations_struct pktlog_vmops = {
static int pktlog_mmap(struct file *file, struct vm_area_struct *vma)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *)
+ PDE_DATA(file_inode(file));
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *)
PDE_DATA(file->f_dentry->d_inode);
#else

View File

@ -0,0 +1,70 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 14:00:59 +0200
Subject: [PATCH] native_sdio/src/hif: Do not call to HIGH SPEED functions for
newer kernels
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
index b3afed2a8d7c..1a1e51eff8c7 100644
--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
+++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c
@@ -690,7 +690,9 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
err = Func0_CMD52ReadByte(card, SDIO_CCCR_SPEED, &cmd52_resp);
if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 read to CCCR speed register failed : %d \n",err));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
card->state &= ~MMC_STATE_HIGHSPEED;
+#endif
/* no need to break */
} else {
err = Func0_CMD52WriteByte(card, SDIO_CCCR_SPEED, (cmd52_resp | SDIO_SPEED_EHS));
@@ -698,14 +700,20 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 write to CCCR speed register failed : %d \n",err));
break;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
mmc_card_set_highspeed(card);
+#endif
host->ios.timing = MMC_TIMING_SD_HS;
host->ops->set_ios(host, &host->ios);
}
}
/* Set clock */
- if (mmc_card_highspeed(card)) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
+ if (mmc_card_highspeed(card)) {
+#else
+ if (mmc_card_hs(card)) {
+#endif
clock = 50000000;
} else {
clock = card->cis.max_dtr;
@@ -1181,7 +1189,11 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe
if (mmcclock > 0){
clock_set = mmcclock;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
if (mmc_card_highspeed(func->card)){
+#else
+ if (mmc_card_hs(func->card)){
+#endif
clock = 50000000;
} else {
clock = func->card->cis.max_dtr;
@@ -2000,7 +2012,11 @@ addHifDevice(struct sdio_func *func)
hifdevice->func = func;
hifdevice->powerConfig = HIF_DEVICE_POWER_UP;
hifdevice->DeviceState = HIF_DEVICE_STATE_ON;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
ret = sdio_set_drvdata(func, hifdevice);
+#else
+ sdio_set_drvdata(func, hifdevice);
+#endif
EXIT("status %d", ret);
return hifdevice;

View File

@ -0,0 +1,24 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 21 Apr 2016 14:32:57 +0200
Subject: [PATCH] osdep_adf.h: fix for undefined ath_sysctl_pktlog_size
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
CORE/SERVICES/COMMON/osdep_adf.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CORE/SERVICES/COMMON/osdep_adf.h b/CORE/SERVICES/COMMON/osdep_adf.h
index 708b6f89fa03..48ca78618840 100644
--- a/CORE/SERVICES/COMMON/osdep_adf.h
+++ b/CORE/SERVICES/COMMON/osdep_adf.h
@@ -168,6 +168,10 @@ typedef unsigned long TQUEUE_ARG;
#define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
proc_dostring(ctl, write, filp, buffer, lenp, ppos)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+typedef struct ctl_table ctl_table;
+#endif
+
/*
* Byte Order stuff
*/

View File

@ -0,0 +1,37 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Thu, 19 May 2016 12:28:39 +0200
Subject: [PATCH] Kbuild: Add compilation flag based on kernel support
The option WLAN_NL80211_TESTMODE was inconditionally added to the compilation
but it does required the specific kernel support.
https://jira.digi.com/browse/DEL-2567
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
Kbuild | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Kbuild b/Kbuild
index b248eee28bf0..339262874c94 100644
--- a/Kbuild
+++ b/Kbuild
@@ -908,7 +908,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \
-DWLAN_WAKEUP_EVENTS \
-DFEATURE_WLAN_RA_FILTERING\
-DWLAN_KD_READY_NOTIFIER \
- -DWLAN_NL80211_TESTMODE \
-DFEATURE_WLAN_BATCH_SCAN \
-DFEATURE_WLAN_LPHB \
-DFEATURE_WLAN_PAL_TIMER_DISABLE \
@@ -948,6 +947,10 @@ CDEFINES += -DDFS_MASTER_OFFLOAD_IND_SUPPORT
endif
endif
+ifeq ($(CONFIG_NL80211_TESTMODE), y)
+CDEFINES += -DWLAN_NL80211_TESTMODE
+endif
+
ifeq ($(CONFIG_ARCH_MSM), y)
CDEFINES += -DMSM_PLATFORM
endif

View File

@ -0,0 +1,22 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Mon, 27 Jun 2016 13:07:23 +0200
Subject: [PATCH] Kbuild: do not create an auxiliar p2p on init
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
Kbuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Kbuild b/Kbuild
index 339262874c94..b14417a558cd 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1254,7 +1254,7 @@ CDEFINES += -DQCA_HT_2040_COEX
else
#Open P2P device interface only for non-Mobile router use cases
-CDEFINES += -DWLAN_OPEN_P2P_INTERFACE
+# CDEFINES += -DWLAN_OPEN_P2P_INTERFACE
#Enable 2.4 GHz social channels in 5 GHz only mode for p2p usage
CDEFINES += -DWLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY

View File

@ -0,0 +1,25 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Tue, 5 Jul 2016 17:57:07 +0200
Subject: [PATCH] Kbuild: do not compile the DEBUG version inconditionally
Do not compile the DEBUG version inconditionally by adding the posibility to
define the DEBUG version as a flag parameter.
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
Kbuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Kbuild b/Kbuild
index b14417a558cd..a0e203ce5493 100644
--- a/Kbuild
+++ b/Kbuild
@@ -121,7 +121,7 @@ endif
# Feature flags which are not (currently) configurable via Kconfig
#Whether to build debug version
-BUILD_DEBUG_VERSION := 1
+BUILD_DEBUG_VERSION ?= 1
#Enable this flag to build driver in diag version
BUILD_DIAG_VERSION := 1

View File

@ -0,0 +1,48 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Tue, 5 Jul 2016 17:52:44 +0200
Subject: [PATCH] Kbuild: Group most of the relevant DEBUG options
The value of BUILD_DEBUG_VERSION will be used to compile the driver with most
of the relevant DEBUG flags. Use that variable to compile the debug version.
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
Kbuild | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Kbuild b/Kbuild
index a0e203ce5493..e5f2e8ebd4ad 100644
--- a/Kbuild
+++ b/Kbuild
@@ -896,9 +896,7 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \
-DWLAN_FEATURE_PACKET_FILTERING \
-DWLAN_FEATURE_VOWIFI \
-DWLAN_FEATURE_11AC \
- -DWLAN_FEATURE_P2P_DEBUG \
-DWLAN_ENABLE_AGEIE_ON_SCAN_RESULTS \
- -DWLANTL_DEBUG\
-DWLAN_NS_OFFLOAD \
-DWLAN_ACTIVEMODE_OFFLOAD_FEATURE \
-DWLAN_FEATURE_HOLD_RX_WAKELOCK \
@@ -936,8 +934,7 @@ CDEFINES += -DCONFIG_HL_SUPPORT \
-DSDIO_3_0 \
-DHIF_SDIO \
-DCONFIG_ATH_PROCFS_DIAG_SUPPORT \
- -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL \
- -DDEBUG_HL_LOGGING
+ -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL
endif
ifeq ($(CONFIG_QCA_WIFI_SDIO), 1)
@@ -974,8 +971,11 @@ CDEFINES += -DTRACE_RECORD \
ifeq ($(BUILD_DEBUG_VERSION),1)
CDEFINES += -DWLAN_DEBUG \
+ -DWLAN_FEATURE_P2P_DEBUG \
+ -DWLANTL_DEBUG\
-DPE_DEBUG_LOGW \
-DPE_DEBUG_LOGE \
+ -DDEBUG_HL_LOGGING \
-DDEBUG
endif

View File

@ -0,0 +1,5 @@
install wlan true
# Load the wlan module with values for SDIO3.0.
options wlan asyncintdelay=0x2 writecccr1=0xf2 writecccr1value=0xf \
writecccr2=0xf1 writecccr2value=0xa8 writecccr3=0xf0 \
writecccr3value=0xa1 writecccr4=0x15 writecccr4value=0x30

View File

@ -0,0 +1,102 @@
#!/bin/sh
#===============================================================================
#
# qualcomm-pre-up
#
# Copyright (C) 2016 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: Load Qualcomm' wireless driver
#
#===============================================================================
[ "${IFACE}" != "wlan0" ] && exit 0
FIRMWARE_DIR="/lib/firmware"
MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin"
TMP_MACFILE="$(mktemp -t wlan_mac.XXXXXX)"
# Read the MACs from DeviceTree. We can have up to four wireless interfaces
# The only required one is wlan0 that is mapped with device tree mac address
# without suffix.
for index in $(seq 0 3); do
DT_WLANx_MAC="/proc/device-tree/wireless/mac-address"
if [ "${index}" = "0" ]; then
# Set a default MAC for wlan0
MAC_ADDR="00:04:F3:FF:FF:FB"
else
# Add the interface suffix for the device tree node
DT_WLANx_MAC=${DT_WLANx_MAC}${index}
MAC_ADDR=""
fi
if [ -f "${DT_WLANx_MAC}" ]; then
MAC_ADDR="$(hexdump -ve '1/1 "%02X" ":"' ${DT_WLANx_MAC} | sed 's/:$//g')"
fi
# Dump the MAC address in a file with the expected firmware format.
# example: Intf0MacAddress=0004f3fffffb
echo "Intf${index}MacAddress=${MAC_ADDR}" | sed s/://g >> ${TMP_MACFILE}
done
# Override the MAC firmware file only if the MAC file has changed.
if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then
cp ${TMP_MACFILE} ${MACFILE}
fi
rm -f ${TMP_MACFILE}
OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)"
US_CODE="0x0"
WW_CODE="0x1"
JP_CODE="0x2"
# Check if the DTB_REGION_CODE is in the list of valid codes,
# if not use the OTP programmed value.
case "${DTB_REGION_CODE}" in
${US_CODE}|${WW_CODE}|${JP_CODE})
REGULATORY_DOMAIN=${DTB_REGION_CODE};;
*)
logger -t qca6564 "[ERROR] Invalid region code in device tree, using OTP value"
REGULATORY_DOMAIN=${OTP_REGION_CODE};;
esac
BDATA_LINK="${FIRMWARE_DIR}/bdwlan30.bin"
# Create a symbolic link to the FW file for the specific country region.
BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_US.bin"
case "${REGULATORY_DOMAIN}" in
${US_CODE})
logger -t qca6564 "Setting US wireless region";;
${WW_CODE}|${JP_CODE})
logger -t qca6564 "Setting WW (world wide) wireless region"
BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_World.bin";;
"")
logger -t qca6564 "[WARN] region code not found, using US";;
*)
logger -t qca6564 "[WARN] Invalid region code, using US";;
esac
# We don't want to rewrite NAND every time we boot so only
# change the link if it is wrong.
if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${BDATA_SOURCE}"; then
ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}"
fi
# Check the version of modprobe installed to compound the arguments.
if readlink -f $(which modprobe) | grep -qs kmod; then
MODPROBE_ARGS="-i"
fi
# Load the wireless module with the params defined in modprobe.d/qualcomm.conf
modprobe ${MODPROBE_ARGS} wlan
# Validate that firmware was loaded by checking if the interface is present.
if [ -d "/sys/class/net/${IFACE}" ]; then
echo "Loading qca6564 module: [OK]"
else
echo "Loading qca6564 module: [FAILED]"
exit 1
fi

View File

@ -56,10 +56,10 @@ index 4a29f0e776e2..69a2d483b2cd 100644
if (!ret)
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
index a12579d44723..c2a54b7d072d 100644
index a5473bb926a2..d08479fa43b7 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
@@ -103,7 +103,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb);
@@ -108,7 +108,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb);
#define UNREG_THERMAL_NOTIFIER(a) unregister_thermal_notifier(a);
#endif

View File

@ -1,4 +1,3 @@
From 07ca37302306e764adaeaa8f2a8e4ef1b40cd395 Mon Sep 17 00:00:00 2001
From: Hector Palacios <hector.palacios@digi.com>
Date: Tue, 1 Dec 2015 11:36:24 +0100
Subject: [PATCH] Use busfreq-imx6.h up to 3.15 kernel
@ -13,7 +12,7 @@ Signed-off-by: Hector Palacios <hector.palacios@digi.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
index a12579d44723..8f7bb281aa74 100644
index d08479fa43b7..4a9b72ce2297 100644
--- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
+++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
@@ -74,7 +74,7 @@

View File

@ -22,6 +22,9 @@ CONFIG_SOC_IMX53=y
CONFIG_SOC_IMX6Q=y
CONFIG_SOC_IMX6SL=y
CONFIG_SOC_IMX6SX=y
CONFIG_SOC_IMX6UL=y
CONFIG_SOC_IMX7D=y
CONFIG_SOC_VF610=y
CONFIG_PCI=y
CONFIG_PCI_MSI=y
CONFIG_PCI_IMX6=y
@ -40,6 +43,7 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_ARM_IMX6Q_CPUFREQ=y
CONFIG_ARM_IMX7D_CPUFREQ=y
CONFIG_CPU_IDLE=y
CONFIG_VFP=y
CONFIG_NEON=y
@ -73,6 +77,7 @@ CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_ATH3K=y
CONFIG_CFG80211=y
CONFIG_CFG80211_CERTIFICATION_ONUS=y
CONFIG_CFG80211_WEXT=y
CONFIG_RFKILL=y
CONFIG_RFKILL_INPUT=y
@ -81,7 +86,8 @@ CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_STANDALONE is not set
# CONFIG_FW_LOADER_USER_HELPER is not set
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=320
CONFIG_CMA_SIZE_PERCENTAGE=40
CONFIG_CMA_SIZE_SEL_PERCENTAGE=y
CONFIG_IMX_WEIM=y
CONFIG_CONNECTOR=y
CONFIG_PROC_DEVICETREE=y
@ -101,6 +107,9 @@ CONFIG_ATA=y
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_IMX=y
CONFIG_PATA_IMX=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_CRYPT=y
CONFIG_NETDEVICES=y
# CONFIG_NET_CADENCE is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
@ -129,6 +138,8 @@ CONFIG_USB_SIERRA_NET=y
CONFIG_ATH_CARDS=y
CONFIG_ATH6KL=m
CONFIG_ATH6KL_SDIO=m
CONFIG_ATH6KL_DEBUG=y
CONFIG_ATH6KL_REGDOMAIN=y
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_IMX=y
@ -147,7 +158,6 @@ CONFIG_SERIAL_IMX_CONSOLE=y
CONFIG_SERIAL_FSL_LPUART=y
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
CONFIG_FSL_OTP=y
CONFIG_HW_RANDOM=y
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
@ -298,8 +308,13 @@ CONFIG_DEBUG_FS=y
# CONFIG_FTRACE is not set
# CONFIG_ARM_UNWIND is not set
CONFIG_SECURITYFS=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_DEV_FSL_CAAM=y
CONFIG_FONTS=y

View File

@ -0,0 +1,392 @@
CONFIG_KERNEL_LZO=y
CONFIG_SYSVIPC=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=18
CONFIG_CGROUPS=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PERF_EVENTS=y
# CONFIG_SLUB_DEBUG is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_ARCH_MXC=y
CONFIG_SOC_IMX6Q=y
CONFIG_SOC_IMX6UL=y
# CONFIG_SWP_EMULATE is not set
CONFIG_SMP=y
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_VMSPLIT_2G=y
CONFIG_PREEMPT=y
CONFIG_AEABI=y
CONFIG_HIGHMEM=y
CONFIG_CMA=y
CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_ARM_IMX6Q_CPUFREQ=y
CONFIG_ARM_IMX7D_CPUFREQ=y
CONFIG_CPU_IDLE=y
CONFIG_VFP=y
CONFIG_NEON=y
CONFIG_BINFMT_MISC=m
CONFIG_PM_DEBUG=y
CONFIG_PM_TEST_SUSPEND=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set
CONFIG_IPV6=y
CONFIG_VLAN_8021Q=y
CONFIG_LLC2=y
CONFIG_CAN=y
CONFIG_CAN_FLEXCAN=y
CONFIG_CAN_M_CAN=y
CONFIG_BT=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_IBS=y
CONFIG_CFG80211=y
CONFIG_CFG80211_CERTIFICATION_ONUS=y
CONFIG_CFG80211_DEBUGFS=y
CONFIG_CFG80211_WEXT=y
CONFIG_MAC80211=y
CONFIG_MAC80211_DEBUGFS=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_STANDALONE is not set
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_IMX_WEIM=y
CONFIG_CONNECTOR=y
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_STAA=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_DATAFLASH=y
CONFIG_MTD_M25P80=y
CONFIG_MTD_SST25L=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_GPMI_NAND=y
CONFIG_MTD_NAND_MXC=y
CONFIG_MTD_SPI_NOR=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_MTD_UBI=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=65536
CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_AT25=y
CONFIG_SCSI=y
# CONFIG_SCSI_PROC_FS is not set
CONFIG_BLK_DEV_SD=y
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_NETDEVICES=y
# CONFIG_NET_VENDOR_ARC is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
CONFIG_CS89x0=y
CONFIG_CS89x0_PLATFORM=y
# CONFIG_NET_VENDOR_FARADAY is not set
# CONFIG_NET_VENDOR_HISILICON is not set
# CONFIG_NET_VENDOR_INTEL is not set
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_SEEQ is not set
CONFIG_SMC91X=y
CONFIG_SMC911X=y
CONFIG_SMSC911X=y
# CONFIG_NET_VENDOR_STMICRO is not set
CONFIG_SMSC_PHY=y
CONFIG_USB_PEGASUS=m
CONFIG_USB_RTL8150=m
CONFIG_USB_RTL8152=m
CONFIG_USB_USBNET=m
CONFIG_USB_NET_CDC_EEM=m
CONFIG_ATH_CARDS=m
CONFIG_ATH_DEBUG=y
CONFIG_HOSTAP=y
CONFIG_HOSTAP_FIRMWARE=y
CONFIG_HOSTAP_FIRMWARE_NVRAM=y
# CONFIG_RTL_CARDS is not set
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=m
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_IMX=y
CONFIG_MOUSE_PS2=m
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ADS7846=y
CONFIG_TOUCHSCREEN_IMX6UL_TSC=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_MMA8450=y
CONFIG_INPUT_MPL3115=y
CONFIG_SENSOR_FXLS8471=y
CONFIG_INPUT_ISL29023=y
CONFIG_INPUT_MCA_CC6UL_PWRKEY=y
CONFIG_SERIO_SERPORT=m
# CONFIG_LEGACY_PTYS is not set
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_IMX=y
CONFIG_SERIAL_IMX_CONSOLE=y
CONFIG_SERIAL_FSL_LPUART=y
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
CONFIG_FSL_OTP=y
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_I2C_ALGOPCF=m
CONFIG_I2C_ALGOPCA=m
CONFIG_I2C_IMX=y
CONFIG_SPI=y
CONFIG_SPI_GPIO=y
CONFIG_SPI_IMX=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_MCA_CC6UL=y
CONFIG_GPIO_MAX732X=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_74X164=y
CONFIG_POWER_SUPPLY=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_SYSCON_POWEROFF=y
# CONFIG_MXC_MMA8451 is not set
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_IMX_THERMAL=y
CONFIG_DEVICE_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_MCA_CC6UL_WATCHDOG=y
CONFIG_IMX2_WDT=y
CONFIG_MFD_DA9052_I2C=y
CONFIG_MFD_MC13XXX_SPI=y
CONFIG_MFD_MC13XXX_I2C=y
CONFIG_MFD_MAX17135=y
CONFIG_MFD_SI476X_CORE=y
CONFIG_MFD_STMPE=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_ANATOP=y
CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_PFUZE100=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VIDEO_MXC_OUTPUT=y
CONFIG_VIDEO_MXC_CAPTURE=y
CONFIG_MXC_CAMERA_OV5640=y
CONFIG_MXC_CAMERA_OV5642=y
CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y
CONFIG_VIDEO_MXC_PXP_V4L2=y
CONFIG_VIDEO_MXC_CSI_CAMERA=y
CONFIG_SOC_CAMERA=y
CONFIG_V4L_MEM2MEM_DRIVERS=y
CONFIG_VIDEO_CODA=y
CONFIG_SOC_CAMERA_OV2640=y
CONFIG_DRM=y
CONFIG_DRM_VIVANTE=y
CONFIG_FB=y
CONFIG_FB_MXS=y
CONFIG_FB_MXC_SYNC_PANEL=y
CONFIG_FB_MXC_MIPI_DSI_SAMSUNG=y
CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL=y
CONFIG_FB_MXC_LDB=y
CONFIG_FB_MXS_SII902X=y
CONFIG_FB_MXC_DCIC=m
CONFIG_HANNSTAR_CABC=y
CONFIG_FB_MXC_EINK_PANEL=y
CONFIG_FB_MXC_EINK_V2_PANEL=y
CONFIG_LCD_CLASS_DEVICE=y
CONFIG_LCD_L4F00242T03=y
CONFIG_LCD_PLATFORM=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_LOGO=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_USB_AUDIO=m
CONFIG_SND_SOC=y
CONFIG_SND_SOC_FSL_ASRC=y
CONFIG_SND_SOC_FSL_SAI=y
CONFIG_SND_SOC_FSL_SSI=y
CONFIG_SND_SOC_FSL_ESAI=y
CONFIG_SND_SOC_IMX_AUDMUX=y
CONFIG_SND_IMX_SOC=y
CONFIG_SND_SOC_IMX_SPDIF=y
CONFIG_USB=y
CONFIG_USB_OTG_WHITELIST=y
CONFIG_USB_OTG_FSM=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_MXC=y
CONFIG_USB_HCD_TEST_MODE=y
CONFIG_USB_ACM=m
CONFIG_USB_STORAGE=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_MXS_PHY=y
CONFIG_USB_GADGET=y
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_G_NCM=m
CONFIG_USB_GADGETFS=m
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_ESDHC_IMX=y
CONFIG_MXC_IPU=y
CONFIG_MXC_SIM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_ONESHOT=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
CONFIG_RTC_DRV_MCA_CC6UL=y
CONFIG_RTC_DRV_MXC=y
CONFIG_RTC_DRV_SNVS=y
CONFIG_DMADEVICES=y
CONFIG_MXC_PXP_V2=y
CONFIG_MXC_PXP_V3=y
CONFIG_IMX_SDMA=y
CONFIG_MXS_DMA=y
CONFIG_DMATEST=m
CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_IIO=y
CONFIG_MCA_CC6UL_ADC=y
CONFIG_PWM=y
CONFIG_PWM_IMX=y
# CONFIG_RESET_GPIO is not set
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_PRINT_QUOTA_WARNING is not set
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_ISO9660_FS=m
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_JFFS2_FS=y
CONFIG_UBIFS_FS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_ROOT_NFS=y
CONFIG_NLS_DEFAULT="cp437"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_UTF8=y
CONFIG_DEBUG_FS=y
CONFIG_MAGIC_SYSRQ=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_FTRACE is not set
CONFIG_SECURITYFS=y
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_MD4=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_RMD128=y
CONFIG_CRYPTO_RMD160=y
CONFIG_CRYPTO_RMD256=y
CONFIG_CRYPTO_RMD320=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_TGR192=y
CONFIG_CRYPTO_WP512=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_TWOFISH=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_DEV_FSL_CAAM=y
CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y
CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y
CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y
CONFIG_CRC_CCITT=m
CONFIG_CRC_T10DIF=y
CONFIG_CRC7=m
CONFIG_LIBCRC32C=m
CONFIG_FONTS=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_VIRTUALIZATION=y

View File

@ -5,6 +5,7 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
DEPENDS += "lzop-native bc-native"
DEPENDS += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence-cst-native', '', d)}"
inherit kernel fsl-kernel-localversion
@ -24,7 +25,22 @@ S = "${WORKDIR}/git"
# machine, with different entry points
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
# In order to sign and encrypt the uImage, we need to know the address
# in which U-Boot loads the uImage. This is CONFIG_LOADADDR in U-Boot
# configuration file.
UBOOT_CONFIG_LOADADDR = ""
UBOOT_CONFIG_LOADADDR_ccimx6 = "0x12000000"
UBOOT_CONFIG_LOADADDR_ccimx6ul = "0x80800000"
do_deploy_append() {
if [ "${TRUSTFENCE_SIGN}" = "1" ]; then
export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}"
export CONFIG_UIMAGE_LOADADDR="${UBOOT_CONFIG_LOADADDR}"
[ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}"
[ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}"
"${THISDIR}/../../scripts/trustfence-sign-uimage.sh" "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin" "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}-signed.bin"
mv "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}-signed.bin" "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin"
fi
(cd ${DEPLOYDIR} && ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME})
}

View File

@ -5,7 +5,7 @@ require recipes-kernel/linux/linux-dtb.inc
inherit fsl-vivante-kernel-driver-handler
SRCBRANCH = "v3.14/dey-2.0/maint"
SRCBRANCH = "v3.14/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx6)"
COMPATIBLE_MACHINE = "(ccimx6$)"

View File

@ -0,0 +1,9 @@
# Copyright (C) 2016 Digi International
require recipes-kernel/linux/linux-dey.inc
require recipes-kernel/linux/linux-dtb.inc
SRCBRANCH = "v4.1.15/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx6ul)"

View File

@ -0,0 +1,48 @@
# The syntax for this file is documented in the HAB Code-Signing Tool
# User's Guide which is included in the CST package distributed by NXP
[Header]
Version = 4.1
Hash Algorithm = sha256
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
Engine = CAAM
[Install SRK]
File = "%srk_table%"
Source index = %key_index%
[Install CSFK]
File = "%cert_csf%"
[Authenticate CSF]
[Install Key]
Verification index = 0
Target index = 2
File = "%cert_img%"
[Authenticate Data]
Verification index = 2
Blocks = %ivt_ram_start% %ivt_uimage_start% %ivt_size% "%uimage_path%"
[Authenticate Data]
Verification index = 2
Blocks = %entrypoint_ram_start% %entrypoint_uimage_offset% %entrypoint_size% "%uimage_path%"
[Authenticate Data]
Verification index = 2
Blocks = %header_ram_start% %header_uimage_offset% %header_size% "%uimage_path%"
[Install Secret Key]
Verification index = 0
Target index = 0
Key = "%dek_path%"
Key Length = %dek_len%
Blob address = %dek_offset%
[Decrypt Data]
Verification index = 0
Mac Bytes = 16
Blocks = %r1_ram_start% %r1_uimage_offset% %r1_size% "%uimage_path%", \
%r2_ram_start% %r2_uimage_offset% %r2_size% "%uimage_path%"

View File

@ -0,0 +1,31 @@
# The syntax for this file is documented in the HAB Code Signing Tool
# User's Guid which is included in the CST package distributed by NXP
[Header]
Version = 4.0
Hash Algorithm = sha256
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
[Install SRK]
File = "%srk_table%"
Source index = %key_index%
[Install CSFK]
File = "%cert_csf%"
[Authenticate CSF]
[Unlock]
Engine = CAAM
Features = RNG
[Install Key]
Verification index = 0
Target index = 2
File = "%cert_img%"
[Authenticate Data]
Verification index = 2
Blocks = %ram_start% %image_offset% %auth_len% "%uimage_path%"

View File

@ -0,0 +1,195 @@
#!/bin/bash
#===============================================================================
#
# trustfence_sign_uimage.sh
#
# Copyright (C) 2016 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# Description:
# Script for building signed and encrypted kernel uImages using NXP CST.
#
# The following environment variables define the script behaviour:
# CONFIG_SIGN_KEYS_PATH: (mandatory) path to the CST folder by NXP with keys generated.
# CONFIG_UIMAGE_LOADADDR: (mandatory) memory address in which U-Boot loads the uImage
# CONFIG_KEY_INDEX: (optional) key index to use for signing. Default is 0.
# CONFIG_DEK_PATH: (optional) Path to keyfile. Define it to generate
# encrypted images
#
#===============================================================================
# Negative offset with respect to CONFIG_UIMAGE_LOADADDR in which U-Boot
# copies the DEK blob.
DEK_BLOB_OFFSET="0x100"
CONFIG_CSF_SIZE="0x4000"
UIMAGE_PATH="$(readlink -e ${1})"
TARGET="$(readlink -m ${2})"
SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)"
# Check arguments
if [ -z "${CONFIG_SIGN_KEYS_PATH}" ]; then
echo "Undefined CONFIG_SIGN_KEYS_PATH";
exit 1
fi
[ -d "${CONFIG_SIGN_KEYS_PATH}" ] || mkdir "${CONFIG_SIGN_KEYS_PATH}"
if [ -n "${CONFIG_DEK_PATH}" ]; then
if [ ! -f "${CONFIG_DEK_PATH}" ]; then
echo "DEK not found. Generating random 256 bit DEK."
[ -d $(dirname ${CONFIG_DEK_PATH}) ] || mkdir -p $(dirname ${CONFIG_DEK_PATH})
dd if=/dev/urandom of="${CONFIG_DEK_PATH}" bs=32 count=1
fi
dek_size="$((8 * $(stat -L -c %s ${CONFIG_DEK_PATH})))"
if [ "${dek_size}" != "128" ] && [ "${dek_size}" != "192" ] && [ "${dek_size}" != "256" ]; then
echo "Invalid DEK size: ${dek_size} bits. Valid sizes are 128, 192 and 256 bits"
exit 1
fi
ENCRYPT="true"
fi
if [ -z "${CONFIG_UIMAGE_LOADADDR}" ]; then
echo "Undefined CONFIG_UIMAGE_LOADADDR"
exit 1
fi
# Default values
[ -z "${CONFIG_KEY_INDEX}" ] && CONFIG_KEY_INDEX="0"
CONFIG_KEY_INDEX_1="$((CONFIG_KEY_INDEX + 1))"
[ -z "${CONFIG_DEK_SIZE}" ] && CONFIG_DEK_SIZE="128"
SRK_KEYS="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/SRK*crt.pem | sed s/\ /\,/g)"
CERT_CSF="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/CSF${CONFIG_KEY_INDEX_1}*crt.pem)"
CERT_IMG="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/IMG${CONFIG_KEY_INDEX_1}*crt.pem)"
n_commas="$(echo ${SRK_KEYS} | grep -o "," | wc -l)"
if [ "${n_commas}" -eq 3 ] && [ -f "${CERT_CSF}" ] && [ -f "${CERT_IMG}" ]; then
# PKI tree already exists.
echo "Using existing PKI tree"
elif [ "${n_commas}" -eq 0 ] || [ ! -f "${CERT_CSF}" ] || [ ! -f "${CERT_IMG}" ]; then
# Generate PKI
trustfence-gen-pki.sh "${CONFIG_SIGN_KEYS_PATH}"
SRK_KEYS="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/SRK*crt.pem | sed s/\ /\,/g)"
CERT_CSF="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/CSF${CONFIG_KEY_INDEX_1}*crt.pem)"
CERT_IMG="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/IMG${CONFIG_KEY_INDEX_1}*crt.pem)"
else
echo "Inconsistent CST folder."
exit 1
fi
SRK_TABLE="$(pwd)/SRK_table.bin"
# Other constants
GAP_FILLER="0x00"
# Compute dek blob size in bytes:
# header (8) + 256-bit AES key (32) + MAC (16) + custom key size in bytes
dek_blob_size="$((8 + 32 + 16 + CONFIG_DEK_SIZE/8))"
dek_blob_offset="$((CONFIG_UIMAGE_LOADADDR - DEK_BLOB_OFFSET))"
# Compute the layout: sizes and offsets.
uimage_size="$(stat -L -c %s ${UIMAGE_PATH})"
uimage_offset="0x0"
pad_len="$((uimage_size - uimage_size % 0x1000 + 0x1000))"
auth_len="$((pad_len + 0x20))"
sig_len="$((auth_len + CONFIG_CSF_SIZE))"
ivt_uimage_start="$((auth_len - 0x20))"
ivt_ram_start="$((CONFIG_UIMAGE_LOADADDR + ivt_uimage_start))"
ivt_size="0x20"
csf_ram_start="$((ivt_ram_start + ivt_size))"
entrypoint_uimage_offset="0x1000"
entrypoint_ram_start="$((CONFIG_UIMAGE_LOADADDR + entrypoint_uimage_offset))"
entrypoint_size="0x20"
header_uimage_offset="0x0"
header_ram_start="${CONFIG_UIMAGE_LOADADDR}"
header_size="0x40"
r1_uimage_offset="${header_size}"
r1_ram_start="$((CONFIG_UIMAGE_LOADADDR + r1_uimage_offset))"
r1_size="$((entrypoint_uimage_offset - header_size ))"
r2_uimage_offset="$((entrypoint_uimage_offset + entrypoint_size))"
r2_ram_start="$((CONFIG_UIMAGE_LOADADDR + r2_uimage_offset))"
r2_size="$((ivt_uimage_start - (entrypoint_uimage_offset + entrypoint_size)))"
# Generate actual CSF descriptor file from template
if [ "${ENCRYPT}" = "true" ]; then
sed -e "s,%ram_start%,${CONFIG_UIMAGE_LOADADDR},g" \
-e "s,%srk_table%,${SRK_TABLE},g " \
-e "s,%cert_csf%,${CERT_CSF},g" \
-e "s,%cert_img%,${CERT_IMG},g" \
-e "s,%uimage_path%,${TARGET},g" \
-e "s,%key_index%,${CONFIG_KEY_INDEX},g" \
-e "s,%dek_len%,${dek_size},g" \
-e "s,%dek_path%,${CONFIG_DEK_PATH},g" \
-e "s,%dek_offset%,${dek_blob_offset},g" \
-e "s,%ivt_uimage_start%,${ivt_uimage_start},g" \
-e "s,%ivt_ram_start%,${ivt_ram_start},g" \
-e "s,%ivt_size%,${ivt_size},g" \
-e "s,%entrypoint_uimage_offset%,${entrypoint_uimage_offset},g" \
-e "s,%entrypoint_ram_start%,${entrypoint_ram_start},g" \
-e "s,%entrypoint_size%,${entrypoint_size},g" \
-e "s,%header_uimage_offset%,${header_uimage_offset},g" \
-e "s,%header_ram_start%,${header_ram_start},g" \
-e "s,%header_size%,${header_size},g" \
-e "s,%r1_uimage_offset%,${r1_uimage_offset},g" \
-e "s,%r1_ram_start%,${r1_ram_start},g" \
-e "s,%r1_size%,${r1_size},g" \
-e "s,%r2_uimage_offset%,${r2_uimage_offset},g" \
-e "s,%r2_ram_start%,${r2_ram_start},g" \
-e "s,%r2_size%,${r2_size},g" \
"${SCRIPT_BASEDIR}/templates/encrypt_uimage" > csf_descriptor
else
sed -e "s,%ram_start%,${CONFIG_UIMAGE_LOADADDR},g" \
-e "s,%srk_table%,${SRK_TABLE},g" \
-e "s,%image_offset%,${uimage_offset},g" \
-e "s,%auth_len%,${auth_len},g" \
-e "s,%cert_csf%,${CERT_CSF},g" \
-e "s,%cert_img%,${CERT_IMG},g" \
-e "s,%uimage_path%,${TARGET},g" \
-e "s,%key_index%,${CONFIG_KEY_INDEX},g" \
"${SCRIPT_BASEDIR}/templates/sign_uimage" > csf_descriptor
fi
# Generate SRK tables
srktool --hab_ver 4 --certs "${SRK_KEYS}" --table "${SRK_TABLE}" --efuses /dev/null --digest sha256
if [ $? -ne 0 ]; then
echo "[ERROR] Could not generate SRK tables"
exit 1
fi
# Pad to IVT
objcopy -I binary -O binary --pad-to "${pad_len}" --gap-fill="${GAP_FILLER}" "${UIMAGE_PATH}" "${TARGET}"
# Generate and attach IVT
# Fields: header, jump location, reserved (0), DCD pointer (null)
# boot data (null), self pointer, CSF pointer, reserved (0)
IVT_HEADER="0x402000D1"
printf "0: %.8x" ${IVT_HEADER} | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 > ivt
printf "0: %.8x" "${entrypoint_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" "${ivt_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" "${csf_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt
cat ivt >> "${TARGET}"
CURRENT_PATH="$(pwd)"
cst -o "${CURRENT_PATH}/csf.bin" -i "${CURRENT_PATH}/csf_descriptor"
if [ $? -ne 0 ]; then
echo "[ERROR] Could not generate CSF"
exit 1
fi
cat csf.bin >> "${TARGET}"
objcopy -I binary -O binary --pad-to "${sig_len}" --gap-fill="${GAP_FILLER}" "${TARGET}"
echo "Signed uImage at ${TARGET}"
rm -f "${SRK_TABLE}" csf_descriptor csf.bin ivt 2> /dev/null

View File

@ -0,0 +1,68 @@
# Adds TrustFence configuration
#
# To use it add the following line to conf/local.conf:
#
# INHERIT += "trustfence"
#
# Inheriting this class enables the following default TrustFence configuration:
#
# * Disabled console
#
# Default secure console configuration
TRUSTFENCE_CONSOLE_DISABLE ?= "1"
# Uncomment to enable the console with the specified passphrase
#TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE = "my_secure_passphrase"
# Alternatively, uncommment to enable the console with the specified GPIO
#TRUSTFENCE_CONSOLE_GPIO_ENABLE = "4"
# Default secure boot configuration
TRUSTFENCE_SIGN ?= "1"
TRUSTFENCE_SIGN_KEYS_PATH ?= "default"
TRUSTFENCE_DEK_PATH ?= "default"
TRUSTFENCE_UBOOT_ENV_DEK ?= "gen_random"
# Trustfence initramfs image recipe
TRUSTFENCE_INITRAMFS_IMAGE ?= "dey-image-trustfence-initramfs"
IMAGE_FEATURES += "dey-trustfence"
UBOOT_EXTRA_CONF = ""
python () {
import binascii
import hashlib
import os
# Secure console configuration
if (d.getVar("TRUSTFENCE_CONSOLE_DISABLE", True) == "1"):
d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_CONSOLE_DISABLE=y ")
if d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE", True):
passphrase_hash = hashlib.sha256(d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE")).hexdigest()
d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_CONSOLE_ENABLE_PASSPHRASE=y CONFIG_CONSOLE_ENABLE_PASSPHRASE_KEY=\\"%s\\" ' % passphrase_hash)
elif d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE", True):
d.appendVar("UBOOT_EXTRA_CONF", " CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NR=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE"))
# Secure boot configuration
if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK") == "gen_random"):
d.setVar("TRUSTFENCE_UBOOT_ENV_DEK", str(binascii.hexlify(os.urandom(16)).decode()))
if (d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") == "default"):
d.setVar("TRUSTFENCE_SIGN_KEYS_PATH", d.getVar("TOPDIR") + "/trustfence");
if (d.getVar("TRUSTFENCE_DEK_PATH") == "default"):
d.setVar("TRUSTFENCE_DEK_PATH", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/dek.bin");
if (d.getVar("TRUSTFENCE_SIGN", True) == "1"):
d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_SIGN_IMAGE=y ")
if d.getVar("TRUSTFENCE_SIGN_KEYS_PATH", True):
d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_SIGN_KEYS_PATH=\\"%s\\" ' % d.getVar("TRUSTFENCE_SIGN_KEYS_PATH"))
if d.getVar("TRUSTFENCE_KEY_INDEX", True):
d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_KEY_INDEX=%s " % d.getVar("TRUSTFENCE_KEY_INDEX"))
if (d.getVar("TRUSTFENCE_DEK_PATH", True) not in [None, "0"]):
d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_DEK_PATH=\\"%s\\" ' % d.getVar("TRUSTFENCE_DEK_PATH"))
if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True) not in [None, "0"]):
d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_ENV_AES=y CONFIG_ENV_AES_KEY=\\"%s\\"' % d.getVar("TRUSTFENCE_UBOOT_ENV_DEK"))
}

View File

@ -23,7 +23,7 @@ DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${DISTRO_FEATURES_LIBC} ${POKY_DE
# 'ptest' -> fails to build QT5 toolchain
POKY_DEFAULT_DISTRO_FEATURES_remove = "ptest wayland"
GRAPHICAL_BACKEND = "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}"
GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}"
# DEY image features (alphabetical order)
FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio"
@ -33,6 +33,7 @@ FEATURE_PACKAGES_dey-examples = "packagegroup-dey-examples"
FEATURE_PACKAGES_dey-gstreamer = "packagegroup-dey-gstreamer"
FEATURE_PACKAGES_dey-network = "packagegroup-dey-network"
FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt"
FEATURE_PACKAGES_dey-trustfence = "packagegroup-dey-trustfence"
FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless"
# Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE
@ -91,9 +92,7 @@ https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
# the variable to be empty.
# Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master
CONNECTIVITY_CHECK_URIS ?= " \
https://eula-downloads.yoctoproject.org/index.php \
http://bugzilla.yoctoproject.org/report.cgi"
CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/"
SANITY_TESTED_DISTROS ?= " \
poky-1.7 \n \

View File

@ -0,0 +1,22 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Fri, 8 Jul 2016 12:19:33 +0200
Subject: [PATCH] hcitool: do not show unsupported refresh option
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
tools/hcitool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 02c4ebe1b71b..229c22c49909 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -568,7 +568,7 @@ static struct option scan_options[] = {
static const char *scan_help =
"Usage:\n"
- "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui] [--refresh]\n";
+ "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui]\n";
static void cmd_scan(int dev_id, int argc, char **argv)
{

View File

@ -0,0 +1,57 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Fri, 8 Jul 2016 10:42:57 +0200
Subject: [PATCH] hcitool: increase the shown connection limit to 20
Created a variable to set the number of connections to shown and increase that
value so we can list more current LE connections.
https://jira.digi.com/browse/DEL-2735
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
tools/hcitool.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 229c22c49909..ae70c9c0d3b4 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -69,6 +69,8 @@
#define EIR_TX_POWER 0x0A /* transmit power level */
#define EIR_DEVICE_ID 0x10 /* device ID */
+#define MAX_CONNECTIONS_SHOWN 20 /* Max number of "hcitool conn" items to shown */
+
#define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, NULL)) != -1)
static volatile int signal_received = 0;
@@ -156,12 +158,12 @@ static int conn_list(int s, int dev_id, long arg)
if (id != -1 && dev_id != id)
return 0;
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
perror("Can't allocate memory");
exit(1);
}
cl->dev_id = dev_id;
- cl->conn_num = 10;
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
ci = cl->conn_info;
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {
@@ -190,12 +192,12 @@ static int find_conn(int s, int dev_id, long arg)
struct hci_conn_info *ci;
int i;
- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) {
+ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) {
perror("Can't allocate memory");
exit(1);
}
cl->dev_id = dev_id;
- cl->conn_num = 10;
+ cl->conn_num = MAX_CONNECTIONS_SHOWN;
ci = cl->conn_info;
if (ioctl(s, HCIGETCONNLIST, (void *) cl)) {

View File

@ -0,0 +1,174 @@
#!/bin/sh
#===============================================================================
#
# bluez
#
# Copyright (C) 2012-2014 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: Configure Bluetooth
#
#===============================================================================
set -e
if [ "${1}" != "start" ]; then
exit 0
fi
SCRIPTNAME="$(basename "${0}")"
LOGFILE="/var/log/bluetoothd.log"
bt_init_qca6564() {
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))"
# Reset the BT_EN line
BT_EN_QCA_GPIO_NR="137"
BT_EN_L="/sys/class/gpio/gpio${BT_EN_QCA_GPIO_NR}"
[ -d "${BT_EN_L}" ] || printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_EN_L}/direction && sleep .1
printf 0 > ${BT_EN_L}/value && sleep .1
printf 1 > ${BT_EN_L}/value && sleep .1
[ -d "${BT_EN_L}" ] && printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/unexport
# Module version older than revision 4 has swapped TX and RX lines
if [ "${MOD_VERSION}" -lt "4" ]; then
# Workaround to ignore the CTS flow control line
BT_CTS_QCA_GPIO_NR="18"
BT_CTS_L="/sys/class/gpio/gpio${BT_CTS_QCA_GPIO_NR}"
[ -d "${BT_CTS_L}" ] || printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_CTS_L}/direction && sleep .1
printf 0 > ${BT_CTS_L}/value && sleep .1
[ -d "${BT_CTS_L}" ] && printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/unexport
# Reduce the rate to avoid the need for HW flow control
BT_RATE="115200"
BT_FLOW="noflow"
fi
if hciattach -t120 ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} 2>${LOGFILE}; then
: # No-op
else
echo "${SCRIPTNAME}: FAILED (hciattach)"
exit
fi
# Convert the BT address to the hcitool command format.
# Example: "00:04:F3:11:22:33" coverted to "33 22 11 F3 04 00"
HCI_BTADDR="$(echo ${BTADDR} | tr ':' '\n' | tac | tr '\n' ' ' | sed -e 's/ $//g')"
# Up the interface to be able to send hci commands
if ! hciconfig hci0 up; then
echo "${SCRIPTNAME}: FAILED (hci0 up)"
exit
fi
# Set the MAC address
if ! hcitool -i hci0 cmd 3F 000B 01 02 06 ${HCI_BTADDR} > /dev/null; then
echo "${SCRIPTNAME}: FAILED (hci set MAC)"
exit
fi
# HCI Reset
if ! hcitool -i hci0 cmd 03 0003 00 > /dev/null; then
echo "${SCRIPTNAME}: FAILED (hci reset)"
exit
fi
# Down and up the interface to load the new MAC address
if ! hciconfig hci0 down; then
echo "${SCRIPTNAME}: FAILED (hci0 down)"
exit
fi
hciconfig hci0 up && echo "${SCRIPTNAME}: OK" || echo "${SCRIPTNAME}: FAILED"
}
bt_init_ar3k() {
if grep -qs '\<digi,ccardimx28\>' /proc/device-tree/compatible; then
BT_PWR_GPIO_NR="21"
elif grep -qs '\<digi,ccimx6\>' /proc/device-tree/compatible; then
BT_PWR_GPIO_NR="244"
fi
# Use a sub-shell here to change to firmware directory
(
cd /lib/firmware/ar3k/1020200
# Update the MAC address file only if it has changed.
FW_MAC="ar3kbdaddr.pst"
[ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BTADDR}" ] || echo ${BTADDR} > ${FW_MAC}
JPN_REGCODE="0x2"
REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
BT_CLASS_LINK="PS_ASIC.pst"
BT_CLASS_FILE="PS_ASIC_class_1.pst"
if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then
BT_CLASS_FILE="PS_ASIC_class_2.pst"
fi
# Replace the configuration file if different
if ! cmp -s ${BT_CLASS_FILE} ${BT_CLASS_LINK}; then
ln -sf ${BT_CLASS_FILE} ${BT_CLASS_LINK}
fi
# Remove not used configuration and readme files
# -- Do not quote the subcommand to avoid leading/trailing whitespace
# -- being part of the file name.
rm -f $(echo PS_ASIC_class_?.pst | sed -e "s,${BT_CLASS_FILE},,g") readme.txt
)
# Start the Bluetooth driver and daemon (D-BUS must already be running)
RETRIES="5"
while [ "${RETRIES}" -gt "0" ]; do
hciattach ttyBt ath3k 4000000 1>${LOGFILE} && break
if [ -n "${BT_PWR_GPIO_NR}" ]; then
#
# If hciattach fails try to recover it by toggling the BT power GPIO
#
BT_PWR_L="/sys/class/gpio/gpio${BT_PWR_GPIO_NR}"
[ -d "${BT_PWR_L}" ] || printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_PWR_L}/direction && sleep .2
printf 0 > ${BT_PWR_L}/value && sleep .2
printf 1 > ${BT_PWR_L}/value && sleep .2
[ -d "${BT_PWR_L}" ] && printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/unexport
else
sleep .5
fi
RETRIES="$((RETRIES - 1))"
done
if [ "${RETRIES}" -eq "0" ]; then
echo "${SCRIPTNAME}: FAILED (hciattach)"
exit
fi
if hciconfig hci0 up; then
: # No-op
else
echo "${SCRIPTNAME}: FAILED"
exit
fi
}
# Check if this hardware does support Bluetooth
if [ -d "/proc/device-tree/bluetooth" ]; then
# Get MAC address from device tree. Use a default value if it has not been set.
if [ -f "/proc/device-tree/bluetooth/mac-address" ]; then
BTADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address | sed 's/:$//g')"
fi
if [ -z "${BTADDR}" ] || [ "${BTADDR}" = "00:00:00:00:00:00" ]; then
BTADDR="00:04:F3:FF:FF:BB"
fi
# Initialize for the specific bluetooth chip
if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then
bt_init_qca6564
else
bt_init_ar3k
fi
fi
echo "Starting bluetooth services."
start-stop-daemon -S --background --exec /usr/lib/bluez5/bluetooth/bluetoothd

View File

@ -0,0 +1,28 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Thu, 11 Sep 2014 19:20:02 +0530
Subject: [PATCH] bluetooth: Enable bluetooth low power mode functionality
During periods of inactivity the bluetooth controller and the
application processor will indicate each other to enter into
low power mode and signal each other when they have data to be
exchanged, thereby saving considerable amount of power.
Change-Id: I9e0d579ac8a9d61a2ebde78b031f4101cb6bc443
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index d3917a0d503e..3041e28ff82a 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -1156,7 +1156,7 @@ struct uart_t uart[] = {
FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm },
/* QCA ROME */
- { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
+ { "qca", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200,
FLOW_CTL, DISABLE_PM, NULL, qca, NULL },
/* QUALCOMM BTS */

View File

@ -0,0 +1,51 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Thu, 11 Sep 2014 18:57:45 +0530
Subject: [PATCH] bluetooth: Fix bug in firmware parsing mechanism
Reorganize the RAMPATCH members to be present as part of the
RAMPATCH header structre instead of the main firmware structure
Change-Id: If523e1bb20edcd52b7c6f623c07af492e6305bd0
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 4 ++--
tools/hciattach_rome.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index f31be43c09e4..122a0f4b89bc 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -851,8 +851,8 @@ int rome_get_tlv_file(char *file_path)
fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) |
(ptlv_header->tlv_length2 << 8) |
(ptlv_header->tlv_length3 << 16));
- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len);
- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len);
+ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len);
+ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index aa59965643ec..07127f30a70a 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -236,6 +236,8 @@ typedef struct {
} __attribute__ ((packed)) patch_info;
typedef struct {
+ unsigned int tlv_data_len;
+ unsigned int tlv_patch_data_len;
unsigned char sign_ver;
unsigned char sign_algorithm;
unsigned short reserved1;
@@ -258,8 +260,6 @@ typedef struct {
unsigned char tlv_length1;
unsigned char tlv_length2;
unsigned char tlv_length3;
- unsigned int tlv_data_len;
- unsigned int tlv_patch_data_len;
union{
tlv_patch_hdr patch;

View File

@ -0,0 +1,114 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Mon, 8 Sep 2014 15:11:02 +0530
Subject: [PATCH] bluetooth: Configure BD Address
Read the BD Address programmed by user from persist location.
If there is no user programmed BD address then use the default
BD address present in the firmware file.
Change-Id: Id702d1476bae765dfd23f88542bfd5a8a1f26056
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++---
tools/hciattach_rome.h | 7 +++++++
2 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 122a0f4b89bc..947e1abb96c4 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -809,6 +809,7 @@ int rome_get_tlv_file(char *file_path)
tlv_nvm_hdr *nvm_ptr;
unsigned char data_buf[PRINT_BUF_SIZE]={0,};
unsigned char *nvm_byte_ptr;
+ unsigned char bdaddr[6];
fprintf(stderr, "File Open (%s)\n", file_path);
pFile = fopen ( file_path , "r" );
@@ -886,9 +887,10 @@ int rome_get_tlv_file(char *file_path)
nvm_byte_ptr+=sizeof(tlv_nvm_hdr);
/* Write BD Address */
- if(nvm_ptr->tag_id == TAG_NUM_2){
- memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6);
- fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n",
+ if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) {
+ memcpy(nvm_byte_ptr, bdaddr, 6);
+ fprintf(stderr, "Overriding default BD ADDR with user"
+ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
*nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2),
*(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5));
}
@@ -1451,6 +1453,54 @@ error:
}
+int read_bd_address(unsigned char *bdaddr)
+{
+ int fd = -1;
+ int readPtr = 0;
+ unsigned char data[BD_ADDR_LEN];
+
+ /* Open the persist file for reading device address*/
+ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY);
+ if(fd < 0)
+ {
+ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__);
+ return -1;
+ }
+
+ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */
+ readPtr = read(fd, data, PERSIST_HEADER_LEN);
+ if (readPtr > 0)
+ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__,
+ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]);
+ else {
+ fprintf(stderr, "%s: Read from persist memory failed : Programming default"
+ " BD ADDR\n");
+ close(fd);
+ return -1;
+ }
+
+ /* Check for BD ADDR length before programming */
+ if(data[NVITEM_SIZE] != BD_ADDR_LEN) {
+ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n");
+ close(fd);
+ return -1;
+ }
+
+ /* Read the BD ADDR info */
+ readPtr = read(fd, data, BD_ADDR_LEN);
+ if (readPtr > 0)
+ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0],
+ data[1], data[2], data[3], data[4], data[5]);
+ else {
+ fprintf(stderr, "%s: Read from persist memory failed : Programming default"
+ " BD ADDR\n");
+ close(fd);
+ return -1;
+ }
+ memcpy(bdaddr, data, BD_ADDR_LEN);
+ close(fd);
+ return 0;
+}
int qca_soc_init(int fd, char *bdaddr)
{
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 07127f30a70a..a4abe9f73080 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -34,6 +34,13 @@
#define HCI_EVENT_PKT 0x04
#define HCI_VENDOR_PKT 0xff
#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10))
+
+#define NVITEM 0
+#define RDWR_PROT 1
+#define NVITEM_SIZE 2
+#define PERSIST_HEADER_LEN 3
+#define BD_ADDR_LEN 6
+
unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
typedef enum {
USERIAL_OP_FLOW_ON,

View File

@ -0,0 +1,73 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Mon, 8 Sep 2014 14:33:24 +0530
Subject: [PATCH] bluetooth: Remove unused functions in the firmware download
process
rome_disable_sleep() function is not used anywhere in the code and
hence remove it.
Change-Id: Iec1f9b1478850af3023ff297493693283a5338d7
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 48 ------------------------------------------------
1 file changed, 48 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 947e1abb96c4..4fcbdf2ab82a 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1317,54 +1317,6 @@ error:
}
-int rome_disable_sleep(int fd)
-{
- int size, err = 0;
- unsigned char cmd[HCI_MAX_CMD_SIZE];
- unsigned char rsp[HCI_MAX_EVENT_SIZE];
- hci_command_hdr *cmd_hdr;
- int flags;
-
- memset(cmd, 0x0, HCI_MAX_CMD_SIZE);
-
- cmd_hdr = (void *) (cmd + 1);
- cmd[0] = HCI_COMMAND_PKT;
- cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE);
- cmd_hdr->plen = VSC_DISABLE_IBS_LEN;
- cmd[4] = 0x01;
- cmd[5] = 0x1B;
- cmd[6] = 0x01;
- cmd[7] = 0x00;
-
- /* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN);
- /* Send the HCI command packet to UART for transmission */
- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ;
- err = write(fd, cmd, size);
- if (err != size) {
- fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
- goto error;
- }
-
- /* Check for response from the Controller */
- if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) {
- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
- goto error;
- }
-
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
-
- /* Wait for command complete event */
- err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
- if ( err < 0) {
- fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__);
- goto error;
- }
- fprintf(stderr, "%s\n", __FUNCTION__);
-error:
- return err;
-
-}
int rome_set_baudrate_req(int fd)
{

View File

@ -0,0 +1,150 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Mon, 8 Sep 2014 14:31:18 +0530
Subject: [PATCH] bluetooth: Enable 3Mbps baud rate support
Allow APPS PROC and BT Controller to operate at 3Mbps baud rate
for faster exchange of commands, events and data between the two
Change-Id: I55651633027ea60a762b11abea84fe1abd6574a9
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 63 ++++++++++++++++++++++++++++++++++++++------------
1 file changed, 48 insertions(+), 15 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 4fcbdf2ab82a..d0e2935b9997 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -166,6 +166,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
}
cfmakeraw(&ti);
ti.c_cflag |= CLOCAL;
+ ti.c_cflag |= CREAD;
switch(op)
{
@@ -332,6 +333,8 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
{
int remain, r;
int count = 0;
+ fd_set infids;
+ struct timeval timeout;
if (size <= 0) {
fprintf(stderr, "Invalid size arguement!\n");
@@ -340,6 +343,16 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__);
+ FD_ZERO (&infids);
+ FD_SET (fd, &infids);
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */
+
+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1)
+ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__);
+ else
+ fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__);
+
/* The first byte identifies the packet type. For HCI event packets, it
* should be 0x04, so we read until we get to the 0x04. */
/* It will keep reading until find 0x04 byte */
@@ -1332,10 +1345,16 @@ int rome_set_baudrate_req(int fd)
cmd[0] = HCI_COMMAND_PKT;
cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF);
cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN;
- cmd[4] = BAUDRATE_115200;
+ cmd[4] = BAUDRATE_3000000;
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN);
+ /* Flow off during baudrate change */
+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0)
+ {
+ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err);
+ goto error;
+ }
/* Send the HCI command packet to UART for transmission */
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
err = write(fd, cmd, size);
@@ -1343,7 +1362,15 @@ int rome_set_baudrate_req(int fd)
fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
goto error;
}
+ /* Change Local UART baudrate to high speed UART */
+ userial_vendor_set_baud(USERIAL_BAUD_3M);
+ /* Flow on after changing local uart baudrate */
+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0)
+ {
+ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err);
+ return err;
+ }
/* Check for response from the Controller */
if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) {
fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
@@ -1385,6 +1412,12 @@ int rome_hci_reset_req(int fd)
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE);
+ /* Flow off during baudrate change */
+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0)
+ {
+ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err);
+ goto error;
+ }
/* Send the HCI command packet to UART for transmission */
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
err = write(fd, cmd, size);
@@ -1393,6 +1426,15 @@ int rome_hci_reset_req(int fd)
goto error;
}
+ /* Change Local UART baudrate to high speed UART */
+ userial_vendor_set_baud(USERIAL_BAUD_3M);
+
+ /* Flow on after changing local uart baudrate */
+ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0)
+ {
+ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err);
+ return err;
+ }
/* Wait for command complete event */
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
if ( err < 0) {
@@ -1534,16 +1576,7 @@ int qca_soc_init(int fd, char *bdaddr)
nvm_file_path = ROME_NVM_TLV_3_0_0_PATH;
download:
- /* Donwload TLV files (rampatch, NVM) */
- err = rome_download_tlv_file(fd);
- if (err < 0) {
- fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
- goto error;
- }
- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
-
- /* Change baud rate back to user requested */
- fprintf(stderr, "Changing baud rate back from 3M --> 115K\n");
+ /* Change baud rate 115.2 kbps to 3Mbps*/
err = rome_set_baudrate_req(fd);
if (err < 0) {
fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
@@ -1551,13 +1584,13 @@ download:
}
fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__);
- fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__);
- err = rome_disable_sleep(fd);
+ /* Donwload TLV files (rampatch, NVM) */
+ err = rome_download_tlv_file(fd);
if (err < 0) {
- fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__);
+ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__);
+ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
/* Perform HCI reset here*/
err = rome_hci_reset_req(fd);

View File

@ -0,0 +1,189 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Tue, 30 Sep 2014 12:13:00 +0530
Subject: [PATCH] bluetooth: Check TTY buffer for data availability before
reading
When operating at higher baud rates check the TTY buffer for
availability of data before proceeding to read. Call select() with
a 3 sec timeout value to check for the availablitiy of data.
select() will return once data is available in the TTY buffers
and will allow read() to fetch the data. If data is not available
in the TTY buffer until the timeout valueexpires, do not proceed
to read the data from the TTY buffers as there is none.
Occasionally corrupt data is received on UART lines while we wait
for vendor specific event from Controller. Expected vendor specific
events are received after the corrupt data. But we do not retry
and exit and this causes firmware download failures. So, retry once
if we did not get HCI event.
Change-Id: I3b672a7762403690f8b934ca216492f16285e8da
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach.c | 20 ++++++++++++-
tools/hciattach_rome.c | 77 +++++++++++++++++++++++++++++++++++++++-----------
tools/hciattach_rome.h | 3 ++
3 files changed, 83 insertions(+), 17 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 3041e28ff82a..13f073325c43 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -163,16 +163,34 @@ int read_hci_event(int fd, unsigned char* buf, int size)
{
int remain, r;
int count = 0;
+ fd_set infids;
+ struct timeval timeout;
if (size <= 0)
return -1;
+ FD_ZERO (&infids);
+ FD_SET (fd, &infids);
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+
+ /* Check whether data is available in TTY buffer before calling read() */
+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) {
+ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__);
+ return -1;
+ }
+ else
+ fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__);
+
/* The first byte identifies the packet type. For HCI event packets, it
* should be 0x04, so we read until we get to the 0x04. */
while (1) {
r = read(fd, buf, 1);
- if (r <= 0)
+ if (r <= 0) {
+ fprintf(stderr, "%s: read() failed with return value: %d\n",
+ __FUNCTION__, r);
return -1;
+ }
if (buf[0] == 0x04)
break;
}
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index d0e2935b9997..d2687b1ef01a 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -326,42 +326,87 @@ failed:
}
+int wait_for_data(int fd, int maxTimeOut)
+{
+ fd_set infids;
+ struct timeval timeout;
+
+ if (maxTimeOut <= 0) {
+ fprintf(stderr, "%s: Invalid timeout value specified", __func__);
+ return -EINVAL;
+ }
+
+ FD_ZERO (&infids);
+ FD_SET (fd, &infids);
+ timeout.tv_sec = maxTimeOut;
+ timeout.tv_usec = 0;
+
+ /* Check whether data is available in TTY buffer before calling read() */
+ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) {
+ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut);
+ return -1;
+ }
+ else
+ fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n",
+ __FUNCTION__);
+
+ return 1;
+}
+
/*
* Read an VS HCI event from the given file descriptor.
*/
int read_vs_hci_event(int fd, unsigned char* buf, int size)
{
- int remain, r;
+ int remain, r, retry = 0;
int count = 0;
- fd_set infids;
- struct timeval timeout;
if (size <= 0) {
fprintf(stderr, "Invalid size arguement!\n");
return -1;
}
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__);
-
- FD_ZERO (&infids);
- FD_SET (fd, &infids);
- timeout.tv_sec = 3;
- timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */
+ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n",
+ __FUNCTION__);
- if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1)
- fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__);
- else
- fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__);
+ /* Check whether data is available in TTY buffer before calling read() */
+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1)
+ return -1;
/* The first byte identifies the packet type. For HCI event packets, it
* should be 0x04, so we read until we get to the 0x04. */
/* It will keep reading until find 0x04 byte */
while (1) {
+ /* Read UART Buffer for HCI-DATA */
r = read(fd, buf, 1);
- if (r <= 0)
- return -1;
- if (buf[0] == 0x04)
+ if (r <= 0) {
+ fprintf(stderr, "%s: read() failed. error: %d\n",
+ __FUNCTION__, r);
+ return -1;
+ }
+
+ /* Check if received data is HCI-DATA or not.
+ * If not HCI-DATA, then retry reading the UART Buffer once.
+ * Sometimes there could be corruption on the UART lines and to
+ * avoid that retry once reading the UART Buffer for HCI-DATA.
+ */
+ if (buf[0] == 0x04) { /* Recvd. HCI DATA */
+ retry = 0;
break;
+ }
+ else if (retry < MAX_RETRY_CNT){ /* Retry mechanism */
+ retry++;
+ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d",
+ __FUNCTION__, buf[0]);
+ if (wait_for_data(fd, SELECT_TIMEOUT) < 1)
+ return -1;
+ else /* Data available in UART Buffer: Continue to read */
+ continue;
+ }
+ else { /* RETRY failed : Exiting with failure */
+ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__);
+ return -1;
+ }
}
count++;
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index a4abe9f73080..3efb71995c45 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -179,6 +179,9 @@ typedef struct
#define TAG_NUM_2 2
#define TAG_BDADDR_OFFSET 7
+#define MAX_RETRY_CNT 1
+#define SELECT_TIMEOUT 3
+
/* NVM Tags specifically used for ROME 1.0 */
#define ROME_1_0_100022_1 0x101000221
#define ROME_1_0_100019 0x101000190

View File

@ -0,0 +1,44 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Wed, 20 Aug 2014 12:13:19 +0530
Subject: [PATCH] bluetooth : Add support for TUFEELO firmware download
Add TUFELLO chip version to allow firmware download.
Change-Id: Ie3760fa64e8345bf9a84b2f047fde0ac1003b393
---
tools/hciattach_rome.c | 5 ++++-
tools/hciattach_rome.h | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index d2687b1ef01a..84dfc97b5140 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1616,9 +1616,12 @@ int qca_soc_init(int fd, char *bdaddr)
nvm_file_path = ROME_NVM_TLV_2_0_1_PATH;
goto download;
case ROME_VER_3_0:
- case TUFELLO_VER_1_0:
rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH;
nvm_file_path = ROME_NVM_TLV_3_0_0_PATH;
+ goto download;
+ case TUFELLO_VER_1_0:
+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH;
+ nvm_file_path = TF_NVM_TLV_1_0_0_PATH;
download:
/* Change baud rate 115.2 kbps to 3Mbps*/
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 3efb71995c45..9d18c576fcae 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -204,7 +204,8 @@ typedef struct
#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin"
#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv"
#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin"
-
+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv"
+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin"
/******************************************************************************
** Local type definitions

View File

@ -0,0 +1,236 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Mon, 8 Dec 2014 14:52:16 +0530
Subject: [PATCH] bluetooth: Add support for ROME 3.2 SOC.
Add firmware download support for ROME 3.2 version. As part
of this, the Bluetooth on time is optimized based on event
handling while downloading rampatch files.From ROME 3.2 onwards,
the VS and command complete events will be sent depending the flag
indication present in the header. HOST can wait for VS and command
complete events only if specified in the header info. This greatly
reduces the time spent by HOST in waiting for 2 events from the
Controller before downloading each segment of the RAMPATCH file
Change-Id: I9c4227a7a529455f4d120b2c9d065f3ec6b439e9
---
tools/hciattach_rome.c | 104 ++++++++++++++++++++++++++++++++++++++++++-------
tools/hciattach_rome.h | 16 +++++++-
2 files changed, 103 insertions(+), 17 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 84dfc97b5140..c6d528f118e1 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -62,9 +62,11 @@ unsigned char *pdata_buffer = NULL;
patch_info rampatch_patch_info;
int rome_ver = ROME_VER_UNKNOWN;
unsigned char gTlv_type;
+unsigned char gtlv_dwndcfg;
char *rampatch_file_path;
char *nvm_file_path;
vnd_userial_cb_t vnd_userial;
+unsigned char wait_vsc_evt = TRUE;
/******************************************************************************
** Extern variables
******************************************************************************/
@@ -455,14 +457,16 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size)
goto failed;
}
- /* Check for response from the Controller */
- if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) {
- ret = -ETIMEDOUT;
- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
- goto failed;
+ if (wait_vsc_evt) {
+ /* Check for response from the Controller */
+ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) {
+ ret = -ETIMEDOUT;
+ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
+ goto failed;
+ }
+ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
}
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
failed:
return ret;
}
@@ -903,6 +907,7 @@ int rome_get_tlv_file(char *file_path)
/* To handle different event between rampatch and NVM */
gTlv_type = ptlv_header->tlv_type;
+ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg;
if(ptlv_header->tlv_type == TLV_TYPE_PATCH){
fprintf(stderr, "====================================================\n");
@@ -914,6 +919,7 @@ int rome_get_tlv_file(char *file_path)
fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
+ fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
@@ -1023,19 +1029,83 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n",
__FUNCTION__,tlv_size, total_segment, remain_size);
- for(i=0;i<total_segment ;i++){
- /* In case of ROME 1.1, last rampatch segment command will not wait for
- command complete event */
- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH )
- && !remain_size && ((i+1) == total_segment))? FALSE: TRUE;
+ if (gTlv_type == TLV_TYPE_PATCH) {
+ /* Prior to Rome version 3.2(including inital few rampatch release of
+ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After
+ * few release of rampatch for Rome 3.2, the mechamism is changed to
+ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now
+ */
+ switch(gtlv_dwndcfg)
+ {
+ case ROME_SKIP_EVT_NONE:
+ wait_vsc_evt = TRUE;
+ wait_cc_evt = TRUE;
+ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__);
+ break;
+ case ROME_SKIP_EVT_VSE_CC:
+ wait_vsc_evt = FALSE;
+ wait_cc_evt = FALSE;
+ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__);
+ break;
+ /* Not handled for now */
+ case ROME_SKIP_EVT_VSE:
+ case ROME_SKIP_EVT_CC:
+ default:
+ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg);
+ break;
+ }
+ } else {
+ wait_vsc_evt = TRUE;
+ wait_cc_evt = TRUE;
+ }
+
+ for(i = 0; i < total_segment; i++) {
+ if((i+1) == total_segment) {
+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) &&
+ (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is from 1.1 to 3.1
+ * 1. No CCE for the last command segment but all other segment
+ * 2. All the command segments get VSE including the last one
+ */
+ wait_cc_evt = !remain_size ? FALSE: TRUE;
+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is 3.2
+ * 1. None of the command segments receive CCE
+ * 2. No command segments receive VSE except the last one
+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is
+ * same as Rome 2.1, 2.2, 3.0
+ */
+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) {
+ wait_cc_evt = !remain_size ? FALSE: TRUE;
+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) {
+ wait_vsc_evt = !remain_size ? TRUE: FALSE;
+ }
+ }
+ }
+
if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0)
goto error;
}
- /* In case remain data still remain, last rampatch segment command will not wait
- for command complete event here */
- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH )
- && remain_size )? FALSE:TRUE;
+ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is from 1.1 to 3.1
+ * 1. No CCE for the last command segment but all other segment
+ * 2. All the command segments get VSE including the last one
+ */
+ wait_cc_evt = remain_size ? FALSE: TRUE;
+ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ /* If the Rome version is 3.2
+ * 1. None of the command segments receive CCE
+ * 2. No command segments receive VSE except the last one
+ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is
+ * same as Rome 2.1, 2.2, 3.0
+ */
+ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) {
+ wait_cc_evt = remain_size ? FALSE: TRUE;
+ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) {
+ wait_vsc_evt = remain_size ? TRUE: FALSE;
+ }
+ }
if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt);
@@ -1619,6 +1689,10 @@ int qca_soc_init(int fd, char *bdaddr)
rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH;
nvm_file_path = ROME_NVM_TLV_3_0_0_PATH;
goto download;
+ case ROME_VER_3_2:
+ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH;
+ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH;
+ goto download;
case TUFELLO_VER_1_0:
rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH;
nvm_file_path = TF_NVM_TLV_1_0_0_PATH;
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 9d18c576fcae..77e85e7e7b19 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -204,9 +204,17 @@ typedef struct
#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin"
#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv"
#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin"
+#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv"
+#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin"
#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv"
#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin"
+/* This header value in rampatch file decides event handling mechanism in the HOST */
+#define ROME_SKIP_EVT_NONE 0x00
+#define ROME_SKIP_EVT_VSE 0x01
+#define ROME_SKIP_EVT_CC 0x02
+#define ROME_SKIP_EVT_VSE_CC 0x03
+
/******************************************************************************
** Local type definitions
******************************************************************************/
@@ -251,7 +259,8 @@ typedef struct {
unsigned int tlv_patch_data_len;
unsigned char sign_ver;
unsigned char sign_algorithm;
- unsigned short reserved1;
+ unsigned char dwnd_cfg;
+ unsigned char reserved1;
unsigned short prod_id;
unsigned short build_ver;
unsigned short patch_ver;
@@ -306,7 +315,8 @@ enum{
ROME_PATCH_VER_0100 = 0x0100,
ROME_PATCH_VER_0101 = 0x0101,
ROME_PATCH_VER_0200 = 0x0200,
- ROME_PATCH_VER_0300 = 0x0300
+ ROME_PATCH_VER_0300 = 0x0300,
+ ROME_PATCH_VER_0302 = 0x0302
};
enum{
@@ -314,6 +324,7 @@ enum{
ROME_SOC_ID_11 = 0x00000011,
ROME_SOC_ID_13 = 0x00000013,
ROME_SOC_ID_22 = 0x00000022,
+ ROME_SOC_ID_44 = 0x00000044
};
enum{
@@ -323,6 +334,7 @@ enum{
ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ),
ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ),
ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ),
+ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ),
TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 )
};
#endif /* HW_ROME_H */

View File

@ -0,0 +1,189 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Thu, 4 Dec 2014 17:23:58 +0530
Subject: [PATCH] bluetooth: Use correct TTY ioctl calls for flow control
operations
BT firmware download application is using incorrect APIs for
performing flow off and flow on operations. As a result, the local
UART Controller is detecting breaks errors on the UART HW lines.
Appliaction should use TIOCMGET and TIOCMSET ioctl()'s for flow
control operations instead of the tcsetattr() call. Also, the
application should set the value of "number of bits per character"
value to 8 and not as 5.
Due to incorrect APIs used for flow control operation and wrong
value configured for CSIZE parameter, the local UART Controller
detected break errors on the UART HW lines. This caused the
firmware download operation to fail and resulted in BT ON failure.
Change-Id: Id0ac1276609eceb528163860cc87267aaa50fede
---
tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++-----------------
tools/hciattach_rome.h | 6 +++--
2 files changed, 49 insertions(+), 24 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index c6d528f118e1..1e689273b851 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2012 The Android Open Source Project
@@ -31,6 +31,7 @@
#define LOG_TAG "bt_vendor"
#include <stdio.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -139,6 +140,16 @@ void userial_vendor_set_baud(unsigned char userial_baud)
unsigned int tcio_baud;
fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud);
+ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) {
+ perror("Can't get port settings");
+ return;
+ }
+ cfmakeraw(&vnd_userial.termios);
+ vnd_userial.termios.c_cflag |= CLOCAL;
+ vnd_userial.termios.c_cflag |= CREAD;
+ vnd_userial.termios.c_cflag |= CS8;
+ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios);
+
userial_to_tcio_baud(userial_baud, &tcio_baud);
cfsetospeed(&vnd_userial.termios, tcio_baud);
@@ -169,6 +180,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
cfmakeraw(&ti);
ti.c_cflag |= CLOCAL;
ti.c_cflag |= CREAD;
+ ti.c_cflag |= CS8;
switch(op)
{
@@ -1445,6 +1457,29 @@ error:
}
+static void flow_control(int fd, int opt)
+{
+ struct termios c_opt;
+
+ ioctl(fd, TIOCMGET, &c_opt);
+ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */
+ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */
+ c_opt.c_cflag &= ~CSIZE;
+ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD);
+ if (MSM_ENABLE_FLOW_CTRL)
+ c_opt.c_cflag |= CRTSCTS;
+ else if (MSM_DISABLE_FLOW_CTRL)
+ c_opt.c_cflag |= ~CRTSCTS;
+ else {
+ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__);
+ return;
+ }
+ c_opt.c_iflag = IGNPAR;
+ c_opt.c_oflag = 0;
+ c_opt.c_lflag = 0;
+ ioctl(fd, TIOCMSET, &c_opt);
+}
+
int rome_set_baudrate_req(int fd)
{
@@ -1464,12 +1499,10 @@ int rome_set_baudrate_req(int fd)
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN);
+
/* Flow off during baudrate change */
- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0)
- {
- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err);
- goto error;
- }
+ flow_control(fd, MSM_DISABLE_FLOW_CTRL);
+
/* Send the HCI command packet to UART for transmission */
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
err = write(fd, cmd, size);
@@ -1481,11 +1514,8 @@ int rome_set_baudrate_req(int fd)
userial_vendor_set_baud(USERIAL_BAUD_3M);
/* Flow on after changing local uart baudrate */
- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0)
- {
- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err);
- return err;
- }
+ flow_control(fd, MSM_ENABLE_FLOW_CTRL);
+
/* Check for response from the Controller */
if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) {
fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
@@ -1528,11 +1558,8 @@ int rome_hci_reset_req(int fd)
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE);
/* Flow off during baudrate change */
- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0)
- {
- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err);
- goto error;
- }
+ flow_control(fd, MSM_DISABLE_FLOW_CTRL);
+
/* Send the HCI command packet to UART for transmission */
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
err = write(fd, cmd, size);
@@ -1545,11 +1572,8 @@ int rome_hci_reset_req(int fd)
userial_vendor_set_baud(USERIAL_BAUD_3M);
/* Flow on after changing local uart baudrate */
- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0)
- {
- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err);
- return err;
- }
+ flow_control(fd, MSM_ENABLE_FLOW_CTRL);
+
/* Wait for command complete event */
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
if ( err < 0) {
@@ -1616,7 +1640,6 @@ int qca_soc_init(int fd, char *bdaddr)
int err = -1;
int size;
- fprintf(stderr, " %s \n", __FUNCTION__);
vnd_userial.fd = fd;
/* Get Rome version information */
if((err = rome_patch_ver_req(fd)) <0){
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 77e85e7e7b19..ef3647e6a69b 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -1,7 +1,7 @@
/*
- * Copyright 2012 The Android Open Source Project
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
* Not a Contribution.
+ * Copyright 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,6 +40,8 @@
#define NVITEM_SIZE 2
#define PERSIST_HEADER_LEN 3
#define BD_ADDR_LEN 6
+#define MSM_ENABLE_FLOW_CTRL 16
+#define MSM_DISABLE_FLOW_CTRL 17
unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
typedef enum {

View File

@ -0,0 +1,256 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Tue, 20 Jan 2015 12:43:20 +0530
Subject: [PATCH] bluetooth: Add support for multi baud rate
Currently BT operates only at 3M baud rate. Provide option
to configure the pre-defined baud rate values as supported by the
target platform.
Change-Id: I4bbaf7db01ffb983c38dca7c4a4a56f579c678a8
---
tools/hciattach.c | 2 +-
tools/hciattach.h | 2 +-
tools/hciattach_rome.c | 109 ++++++++++++++++++++++++++++++++++++++++++-------
tools/hciattach_rome.h | 23 +++++++++++
4 files changed, 119 insertions(+), 17 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 13f073325c43..6de4129dfd8f 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -340,7 +340,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
static int qca(int fd, struct uart_t *u, struct termios *ti)
{
fprintf(stderr,"qca\n");
- return qca_soc_init(fd, u->bdaddr);
+ return qca_soc_init(fd, u->speed, u->bdaddr);
}
static int qualcomm(int fd, struct uart_t *u, struct termios *ti)
diff --git a/tools/hciattach.h b/tools/hciattach.h
index 2021c33a9824..c5aa495ac3ee 100644
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -63,7 +63,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr,
struct termios *ti);
int ath3k_post(int fd, int pm);
int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr);
-int qca_soc_init(int fd, char *bdaddr);
+int qca_soc_init(int fd, int speed, char *bdaddr);
int intel_init(int fd, int init_speed, int *speed, struct termios *ti);
int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
const char *bdaddr);
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 1e689273b851..37974290ae0a 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1481,7 +1481,7 @@ static void flow_control(int fd, int opt)
}
-int rome_set_baudrate_req(int fd)
+int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate)
{
int size, err = 0;
unsigned char cmd[HCI_MAX_CMD_SIZE];
@@ -1495,7 +1495,7 @@ int rome_set_baudrate_req(int fd)
cmd[0] = HCI_COMMAND_PKT;
cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF);
cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN;
- cmd[4] = BAUDRATE_3000000;
+ cmd[4] = controller_baud_rate;
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN);
@@ -1511,7 +1511,7 @@ int rome_set_baudrate_req(int fd)
goto error;
}
/* Change Local UART baudrate to high speed UART */
- userial_vendor_set_baud(USERIAL_BAUD_3M);
+ userial_vendor_set_baud(local_baud_rate);
/* Flow on after changing local uart baudrate */
flow_control(fd, MSM_ENABLE_FLOW_CTRL);
@@ -1537,7 +1537,7 @@ error:
}
-int rome_hci_reset_req(int fd)
+int rome_hci_reset_req(int fd, char baud)
{
int size, err = 0;
unsigned char cmd[HCI_MAX_CMD_SIZE];
@@ -1569,7 +1569,7 @@ int rome_hci_reset_req(int fd)
}
/* Change Local UART baudrate to high speed UART */
- userial_vendor_set_baud(USERIAL_BAUD_3M);
+ userial_vendor_set_baud(baud);
/* Flow on after changing local uart baudrate */
flow_control(fd, MSM_ENABLE_FLOW_CTRL);
@@ -1635,10 +1635,69 @@ int read_bd_address(unsigned char *bdaddr)
return 0;
}
-int qca_soc_init(int fd, char *bdaddr)
+int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate)
+{
+ switch(speed) {
+ case 9600:
+ *local_baud_rate = USERIAL_BAUD_9600;
+ *controller_baud_rate = BAUDRATE_9600;
+ break;
+ case 19200:
+ *local_baud_rate = USERIAL_BAUD_19200;
+ *controller_baud_rate = BAUDRATE_19200;
+ break;
+ case 57600:
+ *local_baud_rate = USERIAL_BAUD_57600;
+ *controller_baud_rate = BAUDRATE_57600;
+ break;
+ case 115200:
+ *local_baud_rate = USERIAL_BAUD_115200;
+ *controller_baud_rate = BAUDRATE_115200;
+ break;
+ case 230400:
+ *local_baud_rate = USERIAL_BAUD_230400;
+ *controller_baud_rate = BAUDRATE_230400;
+ break;
+ case 460800:
+ *local_baud_rate = USERIAL_BAUD_460800;
+ *controller_baud_rate = BAUDRATE_460800;
+ break;
+ case 921600:
+ *local_baud_rate = USERIAL_BAUD_921600;
+ *controller_baud_rate = BAUDRATE_921600;
+ break;
+ case 1000000:
+ *local_baud_rate = USERIAL_BAUD_1M;
+ *controller_baud_rate = BAUDRATE_1000000;
+ break;
+ case 2000000:
+ *local_baud_rate = USERIAL_BAUD_2M;
+ *controller_baud_rate = BAUDRATE_2000000;
+ break;
+ case 3000000:
+ *local_baud_rate = USERIAL_BAUD_3M;
+ *controller_baud_rate = BAUDRATE_3000000;
+ break;
+ case 4000000:
+ *local_baud_rate = USERIAL_BAUD_4M;
+ *controller_baud_rate = BAUDRATE_4000000;
+ break;
+ case 300:
+ case 600:
+ case 1200:
+ case 2400:
+ default:
+ fprintf(stderr, "Invalid baud rate passed!\n");
+ *local_baud_rate = *controller_baud_rate = -1;
+ break;
+ }
+ return -1;
+}
+
+int qca_soc_init(int fd, int speed, char *bdaddr)
{
int err = -1;
- int size;
+ int size, local_baud_rate = 0, controller_baud_rate = 0;
vnd_userial.fd = fd;
/* Get Rome version information */
@@ -1687,7 +1746,7 @@ int qca_soc_init(int fd, char *bdaddr)
}
/* Change baud rate 115.2 kbps to 3Mbps*/
- err = rome_hci_reset_req(fd);
+ err = rome_hci_reset_req(fd, local_baud_rate);
if ( err <0 ) {
fprintf(stderr, "HCI Reset Failed !!\n");
goto error;
@@ -1721,13 +1780,23 @@ int qca_soc_init(int fd, char *bdaddr)
nvm_file_path = TF_NVM_TLV_1_0_0_PATH;
download:
- /* Change baud rate 115.2 kbps to 3Mbps*/
- err = rome_set_baudrate_req(fd);
- if (err < 0) {
- fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
- goto error;
+ /* Check if user requested for 115200 kbps */
+ if (speed == 115200) {
+ local_baud_rate = USERIAL_BAUD_115200;
+ controller_baud_rate = BAUDRATE_115200;
}
- fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__);
+ else {
+ /* Change only if baud rate requested is valid or not */
+ isSpeedValid(speed, &local_baud_rate, &controller_baud_rate);
+ if (local_baud_rate < 0 || controller_baud_rate < 0)
+ goto error;
+
+ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
+ if (err < 0) {
+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
+ goto error;
+ }
+ }
/* Donwload TLV files (rampatch, NVM) */
err = rome_download_tlv_file(fd);
@@ -1737,8 +1806,18 @@ download:
}
fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
+ /*
+ * Overriding the baud rate value in NVM file with the user
+ * requested baud rate, since default baud rate in NVM file is 3M.
+ */
+ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
+ if (err < 0) {
+ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
+ goto error;
+ }
+
/* Perform HCI reset here*/
- err = rome_hci_reset_req(fd);
+ err = rome_hci_reset_req(fd, local_baud_rate);
if ( err <0 ) {
fprintf(stderr, "HCI Reset Failed !!!\n");
goto error;
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index ef3647e6a69b..1500ddd3a79f 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -78,6 +78,29 @@ typedef struct
#define USERIAL_BAUD_4M 15
#define USERIAL_BAUD_AUTO 16
+/* Vendor specific baud rate values */
+#define UART_Baud_Rate_Baud_9600 4
+#define UART_Baud_Rate_Baud_19200 3
+#define UART_Baud_Rate_Baud_57600 1
+#define UART_Baud_Rate_Baud_115200 0
+#define UART_Baud_Rate_Baud_230400 5
+#define UART_Baud_Rate_Baud_460800 7
+#define UART_Baud_Rate_Baud_921600 10
+#define UART_Baud_Rate_Baud_1000000 11
+#define UART_Baud_Rate_Baud_2000000 13
+#define UART_Baud_Rate_Baud_3000000 14
+#define UART_Baud_Rate_Baud_4000000 15
+
+#define UART_Baud_Rate_Baud_250000 6
+#define UART_Baud_Rate_Baud_500000 8
+#define UART_Baud_Rate_Baud_720000 9
+#define UART_Baud_Rate_Baud_125000 12
+#define UART_Baud_Rate_Baud_1600000 16
+#define UART_Baud_Rate_Baud_3200000 17
+#define UART_Baud_Rate_Baud_3500000 18
+
+
+
#ifndef FALSE
#define FALSE 0
#endif

View File

@ -0,0 +1,144 @@
From: Kamal Negi <kamaln@codeaurora.org>
Date: Tue, 30 Dec 2014 19:15:08 +0530
Subject: [PATCH] Override PCM Settings by reading configuration file
Configure the PCM role as master or slave depending upon
the platform's support. This configuration is provided
in the config file which is read during the firmware
download process and the default PCM configuration is
overwritten with this value.
Change-Id: If0eae58b4cd32d75b3bcb669bc73dca67652473c
Signed-off-by: Kamal Negi <kamaln@codeaurora.org>
---
tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++---
tools/hciattach_rome.h | 8 ++++++
2 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 37974290ae0a..99866e23e99e 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2012 The Android Open Source Project
@@ -873,6 +873,44 @@ error:
return err;
}
+int get_value_from_config(char *file_path,char *param)
+{
+ FILE *pfile = NULL;
+ char *line = NULL;
+ char *pch = NULL;
+ char param_str[20];
+ int bytes_read = 0, position;
+ int ret = -1;
+
+ if (!file_path || !param) {
+ fprintf(stderr,"Invalid arguments\n");
+ return -EINVAL;
+ }
+
+ pfile = fopen(file_path, "r" );
+ if (!pfile) {
+ fprintf(stderr, "Failed to open %s\n", file_path);
+ return ret;
+ }
+
+ while (getline(&line, &bytes_read, pfile) > 0 ) {
+ if (line[0] != '#' && line[0] != '\n') {
+ pch = memchr(line, '=', strlen(line));
+ if (pch != NULL) {
+ position = pch - line;
+ strncpy(param_str, line, position);
+ if (strncmp(param_str, param, position) == 0) {
+ ret = atoi(pch + 1);
+ break;
+ }
+ }
+ }
+ }
+ free(line);
+ fclose(pfile);
+ return ret;
+}
+
int rome_get_tlv_file(char *file_path)
{
FILE * pFile;
@@ -884,7 +922,7 @@ int rome_get_tlv_file(char *file_path)
unsigned char data_buf[PRINT_BUF_SIZE]={0,};
unsigned char *nvm_byte_ptr;
unsigned char bdaddr[6];
-
+ unsigned short pcm_value;
fprintf(stderr, "File Open (%s)\n", file_path);
pFile = fopen ( file_path , "r" );
if (pFile==NULL) {;
@@ -970,9 +1008,30 @@ int rome_get_tlv_file(char *file_path)
*nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2),
*(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5));
}
+ /* Read from file and check what PCM Configuration is required:
+ * Master = 0 /Slave = 1 */
+ /* Override PCM configuration */
+ if (nvm_ptr->tag_id == TAG_NUM_44) {
+ if ((pcm_value =
+ get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) {
+
+ if (pcm_value == PCM_SLAVE) {
+ nvm_byte_ptr[PCM_MS_OFFSET_1] |=
+ (1 << PCM_ROLE_BIT_OFFSET);
+ nvm_byte_ptr[PCM_MS_OFFSET_2] |=
+ (1 << PCM_ROLE_BIT_OFFSET);
+ } else if (pcm_value == PCM_MASTER) {
+ nvm_byte_ptr[PCM_MS_OFFSET_1] &=
+ (~(1 << PCM_ROLE_BIT_OFFSET));
+ nvm_byte_ptr[PCM_MS_OFFSET_2] &=
+ (~(1 << PCM_ROLE_BIT_OFFSET));
+ }
+ }
+ }
- for(i =0;(i<nvm_ptr->tag_len && (i*3 + 2) <PRINT_BUF_SIZE);i++)
- snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", (char *)data_buf, *(nvm_byte_ptr + i));
+ for(i =0;(i<nvm_ptr->tag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++)
+ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ",
+ (char *)data_buf, *(nvm_byte_ptr + i));
fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf);
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 1500ddd3a79f..f591c10e4f2b 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -202,8 +202,15 @@ typedef struct
#define NVM_ACCESS_SET 0x01
#define TAG_NUM_OFFSET 5
#define TAG_NUM_2 2
+#define TAG_NUM_44 44
#define TAG_BDADDR_OFFSET 7
+#define PCM_MS_OFFSET_1 9
+#define PCM_MS_OFFSET_2 33
+
+#define PCM_SLAVE 1
+#define PCM_MASTER 0
+#define PCM_ROLE_BIT_OFFSET 4
#define MAX_RETRY_CNT 1
#define SELECT_TIMEOUT 3
@@ -240,6 +247,7 @@ typedef struct
#define ROME_SKIP_EVT_CC 0x02
#define ROME_SKIP_EVT_VSE_CC 0x03
+#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf"
/******************************************************************************
** Local type definitions
******************************************************************************/

View File

@ -0,0 +1,169 @@
From: Rupesh Tatiya <rtatiya@codeaurora.org>
Date: Thu, 29 Jan 2015 15:36:27 +0530
Subject: [PATCH] Add support for Tufello 1.1 SOC
Enable mechanism to download firmware for Tufello 1.1 SOC.
Also, use correct firmware file path for Tufello 1.0.
Change-Id: I915e48023e45de9e2550336a3de9a07f2b788189
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 29 ++++++++++++++++++-----------
tools/hciattach_rome.h | 10 +++++++---
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 99866e23e99e..fee36f904e04 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -621,7 +621,7 @@ int rome_edl_set_patch_request(int fd)
-1, PATCH_HDR_LEN + 1);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -670,7 +670,7 @@ int rome_edl_patch_download_request(int fd)
index, MAX_DATA_PER_SEGMENT);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Initialize the RSP packet everytime to 0 */
memset(rsp, 0x0, HCI_MAX_EVENT_SIZE);
@@ -707,7 +707,7 @@ int rome_edl_patch_download_request(int fd)
memset(rsp, 0x0, HCI_MAX_EVENT_SIZE);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -824,7 +824,7 @@ int rome_attach_rampatch(int fd)
-1, EDL_PATCH_CMD_LEN);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -854,7 +854,7 @@ int rome_rampatch_reset(int fd)
-1, EDL_PATCH_CMD_LEN);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
/* Send HCI Command packet to Controller */
err = write(fd, cmd, size);
@@ -1058,7 +1058,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
unsigned char cmd[HCI_MAX_CMD_SIZE];
unsigned char rsp[HCI_MAX_EVENT_SIZE];
- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size);
+ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
/* Frame the HCI CMD PKT to be sent to Controller*/
frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size);
@@ -1092,6 +1092,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
{
int total_segment, remain_size, i, err = -1;
unsigned char wait_cc_evt;
+ unsigned int rom = rome_ver >> 16;
total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT;
remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\
@@ -1132,14 +1133,15 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
for(i = 0; i < total_segment; i++) {
if((i+1) == total_segment) {
- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) &&
+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) &&
(gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is from 1.1 to 3.1
* 1. No CCE for the last command segment but all other segment
* 2. All the command segments get VSE including the last one
*/
wait_cc_evt = !remain_size ? FALSE: TRUE;
- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ } else if ((rom == ROME_PATCH_VER_0302) &&
+ (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is 3.2
* 1. None of the command segments receive CCE
* 2. No command segments receive VSE except the last one
@@ -1158,13 +1160,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
goto error;
}
- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) &&
+ (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is from 1.1 to 3.1
* 1. No CCE for the last command segment but all other segment
* 2. All the command segments get VSE including the last one
*/
wait_cc_evt = remain_size ? FALSE: TRUE;
- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is 3.2
* 1. None of the command segments receive CCE
* 2. No command segments receive VSE except the last one
@@ -1837,6 +1840,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
case TUFELLO_VER_1_0:
rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH;
nvm_file_path = TF_NVM_TLV_1_0_0_PATH;
+ goto download;
+ case TUFELLO_VER_1_1:
+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH;
+ nvm_file_path = TF_NVM_TLV_1_0_1_PATH;
download:
/* Check if user requested for 115200 kbps */
@@ -1881,7 +1888,7 @@ download:
fprintf(stderr, "HCI Reset Failed !!!\n");
goto error;
}
- fprintf(stderr, "HCI Reset is done\n");
+ fprintf(stderr, "HCI Reset is done\n");
break;
case ROME_VER_UNKNOWN:
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index f591c10e4f2b..95d5f1e8a5c2 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -238,8 +238,10 @@ typedef struct
#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin"
#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv"
#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin"
-#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv"
-#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin"
+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv"
+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin"
+#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.1.tlv"
+#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/nvm_tlv_tf_1.1.bin"
/* This header value in rampatch file decides event handling mechanism in the HOST */
#define ROME_SKIP_EVT_NONE 0x00
@@ -357,6 +359,7 @@ enum{
ROME_SOC_ID_11 = 0x00000011,
ROME_SOC_ID_13 = 0x00000013,
ROME_SOC_ID_22 = 0x00000022,
+ ROME_SOC_ID_23 = 0x00000023,
ROME_SOC_ID_44 = 0x00000044
};
@@ -368,6 +371,7 @@ enum{
ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ),
ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ),
ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ),
- TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 )
+ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ),
+ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 )
};
#endif /* HW_ROME_H */

View File

@ -0,0 +1,74 @@
From: Anantha Krishnan <ananthk@codeaurora.org>
Date: Wed, 4 Feb 2015 12:29:07 +0530
Subject: [PATCH] bluetooth: Vote UART CLK ON prior to firmware download
process
Before starting the firmware download process, vote UART CLK ON
to avoid triggering the dynamic suspend of UART driver. Post
firmware download and in error scenarios vote UART CLK OFF.
As per design, the UART driver enters into dynamic suspend if
there are no activity on the UART lines for 100ms. Depending upon
the rampatch size, the BT Controller takes time to apply the
downloaded rampatch segments and in sending the vendor specific
event. If the BT Controller takes > 100ms time in sending the
vendor specific event, the UART driver enters into suspend state.
As a result, UART driver fails to process the last vendor specific
event sent by the BT Controller. The VSE sent by BT Controller
wakes up the UART driver, but the data is not processed causing
firmware download failures.
Hence, vote UART CLK ON prior to firmware download process and
vote UART CLK OFF post firmware download proess and in error
scenarios.
Change-Id: I447ded33ad1cfaa020b491effce368fbfe41f894
---
tools/hciattach_rome.c | 13 +++++++++++++
tools/hciattach_rome.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index fee36f904e04..574ceac6c750 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1762,6 +1762,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
int size, local_baud_rate = 0, controller_baud_rate = 0;
vnd_userial.fd = fd;
+
+ /* Vote for UART CLK prior to FW download */
+ err = ioctl(fd, USERIAL_OP_CLK_ON);
+ if (err < 0) {
+ fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__);
+ return -1;
+ }
+
/* Get Rome version information */
if((err = rome_patch_ver_req(fd)) <0){
fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err);
@@ -1899,5 +1907,10 @@ download:
}
error:
+ /* Vote UART CLK OFF post to FW download */
+ err = ioctl(fd, USERIAL_OP_CLK_OFF);
+ if (err < 0)
+ fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__);
+
return err;
}
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 95d5f1e8a5c2..20264f9978d9 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -42,6 +42,8 @@
#define BD_ADDR_LEN 6
#define MSM_ENABLE_FLOW_CTRL 16
#define MSM_DISABLE_FLOW_CTRL 17
+#define USERIAL_OP_CLK_ON 0x5441
+#define USERIAL_OP_CLK_OFF 0x5442
unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
typedef enum {

View File

@ -0,0 +1,127 @@
From: Kamal Negi <kamaln@codeaurora.org>
Date: Thu, 30 Apr 2015 15:53:06 +0530
Subject: [PATCH] Override IBS settings by reading configuration file
Configure the IBS value in Firmware by reading the
configuration file.This configuration value is
provided in the config file which is read during
the firmware download process and the default
configuration value is overwritten with this value.
Change-Id: I47992a573b3137ac9bfb80538727981f56b328c4
Signed-off-by: Kamal Negi <kamaln@codeaurora.org>
---
tools/hciattach_rome.c | 42 +++++++++++++++++++++++++++++-------------
tools/hciattach_rome.h | 24 ++++++++++++++++--------
2 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 574ceac6c750..6a3f33867c12 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -922,7 +922,8 @@ int rome_get_tlv_file(char *file_path)
unsigned char data_buf[PRINT_BUF_SIZE]={0,};
unsigned char *nvm_byte_ptr;
unsigned char bdaddr[6];
- unsigned short pcm_value;
+ unsigned short pcm_value, ibs_value;
+
fprintf(stderr, "File Open (%s)\n", file_path);
pFile = fopen ( file_path , "r" );
if (pFile==NULL) {;
@@ -1008,23 +1009,38 @@ int rome_get_tlv_file(char *file_path)
*nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2),
*(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5));
}
+
+ if (nvm_ptr->tag_id == TAG_NUM_17) {
+ if ((ibs_value =
+ get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) {
+ if (ibs_value == FWCONF_IBS_DISABLE) {
+ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &=
+ (~(FWCONF_IBS_ENABLE <<
+ FWCONF_IBS_VAL_BIT));
+ } else if (ibs_value == FWCONF_IBS_ENABLE) {
+ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |=
+ (FWCONF_IBS_ENABLE <<
+ FWCONF_IBS_VAL_BIT);
+ }
+ }
+ }
/* Read from file and check what PCM Configuration is required:
* Master = 0 /Slave = 1 */
/* Override PCM configuration */
if (nvm_ptr->tag_id == TAG_NUM_44) {
if ((pcm_value =
- get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) {
-
- if (pcm_value == PCM_SLAVE) {
- nvm_byte_ptr[PCM_MS_OFFSET_1] |=
- (1 << PCM_ROLE_BIT_OFFSET);
- nvm_byte_ptr[PCM_MS_OFFSET_2] |=
- (1 << PCM_ROLE_BIT_OFFSET);
- } else if (pcm_value == PCM_MASTER) {
- nvm_byte_ptr[PCM_MS_OFFSET_1] &=
- (~(1 << PCM_ROLE_BIT_OFFSET));
- nvm_byte_ptr[PCM_MS_OFFSET_2] &=
- (~(1 << PCM_ROLE_BIT_OFFSET));
+ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) {
+
+ if (pcm_value == FWCONF_PCM_SLAVE) {
+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |=
+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET);
+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |=
+ (1 << FWCONF_PCM_ROLE_BIT_OFFSET);
+ } else if (pcm_value == FWCONF_PCM_MASTER) {
+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &=
+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET));
+ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &=
+ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET));
}
}
}
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 20264f9978d9..8eaeeed8bc96 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -203,16 +203,24 @@ typedef struct
#define TAG_END 0xFF
#define NVM_ACCESS_SET 0x01
#define TAG_NUM_OFFSET 5
-#define TAG_NUM_2 2
-#define TAG_NUM_44 44
+#define TAG_NUM_2 2
+#define TAG_NUM_17 (17)
+#define TAG_NUM_44 44
#define TAG_BDADDR_OFFSET 7
-#define PCM_MS_OFFSET_1 9
-#define PCM_MS_OFFSET_2 33
+/* FW PCM Configuration */
+#define FWCONF_PCM_MS_OFFSET_1 9
+#define FWCONF_PCM_MS_OFFSET_2 33
+#define FWCONF_PCM_SLAVE 1
+#define FWCONF_PCM_MASTER 0
+#define FWCONF_PCM_ROLE_BIT_OFFSET 4
+
+/* FW IBS Configuration */
+#define FWCONF_IBS_DISABLE (0)
+#define FWCONF_IBS_ENABLE (1)
+#define FWCONF_IBS_VAL_BIT (7)
+#define FWCONF_IBS_VAL_OFFSET (0)
-#define PCM_SLAVE 1
-#define PCM_MASTER 0
-#define PCM_ROLE_BIT_OFFSET 4
#define MAX_RETRY_CNT 1
#define SELECT_TIMEOUT 3
@@ -251,7 +259,7 @@ typedef struct
#define ROME_SKIP_EVT_CC 0x02
#define ROME_SKIP_EVT_VSE_CC 0x03
-#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf"
+#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf"
/******************************************************************************
** Local type definitions
******************************************************************************/

View File

@ -0,0 +1,79 @@
From: Kamal Negi <kamaln@codeaurora.org>
Date: Fri, 8 May 2015 15:01:02 +0530
Subject: [PATCH] Handle NULL Pointer derefrencing in AVRCP Target role
Check NULL pointer to AVRCP controller role initialized or not.
If remote device don't support the AVRCP target role, then HOST dont
initialize AVRCP controller role and directly dereference the controller
role and segfault happens.
Change-Id: Ibbb9452f17a576c3a79a53ea72e0211982752144
Signed-off-by: Kamal Negi <kamaln@codeaurora.org>
---
profiles/audio/avrcp.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index d66f67032624..9fa939d9548b 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1808,13 +1808,19 @@ static gboolean avrcp_get_play_status_rsp(struct avctp *conn,
void *user_data)
{
struct avrcp *session = user_data;
- struct avrcp_player *player = session->controller->player;
- struct media_player *mp = player->user_data;
+ struct avrcp_player *player;
+ struct media_player *mp;
struct avrcp_header *pdu = (void *) operands;
uint32_t duration;
uint32_t position;
uint8_t status;
+ if (!session || !session->controller)
+ return FALSE;
+
+ player = session->controller->player;
+ mp = player->user_data;
+
if (pdu == NULL || code == AVC_CTYPE_REJECTED ||
ntohs(pdu->params_len) != 9)
return FALSE;
@@ -1872,12 +1878,18 @@ static gboolean avrcp_player_value_rsp(struct avctp *conn,
void *user_data)
{
struct avrcp *session = user_data;
- struct avrcp_player *player = session->controller->player;
- struct media_player *mp = player->user_data;
+ struct avrcp_player *player;
+ struct media_player *mp;
struct avrcp_header *pdu = (void *) operands;
uint8_t count;
int i;
+ if (!session || !session->controller)
+ return FALSE;
+
+ player = session->controller->player;
+ mp = player->user_data;
+
if (pdu == NULL) {
media_player_set_setting(mp, "Error", "Timeout");
return FALSE;
@@ -2028,10 +2040,15 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn,
void *user_data)
{
struct avrcp *session = user_data;
- struct avrcp_player *player = session->controller->player;
+ struct avrcp_player *player;
struct avrcp_header *pdu = (void *) operands;
uint8_t count;
+ if (!session || !session->controller)
+ return FALSE;
+
+ player = session->controller->player;
+
if (code == AVC_CTYPE_REJECTED)
return FALSE;

View File

@ -0,0 +1,52 @@
From: Dibyendu Roy <dibyen@codeaurora.org>
Date: Fri, 22 May 2015 18:57:05 +0530
Subject: [PATCH] bluetooth: Fix flow control operation
Flow off operation was not actually happening at the UART line level,
since the argument passed was not being used correctly. As a result,
sometimes command complete and VS event were sent by BT SOC even
before the local UART Controller could change its baud rate to the
newer one(3 Mbps). This led to VS event being processed
incorrectly which in turn causes baud rate change to fail.
CRs-Fixed: 844730
Change-Id: I06d8c4ed7807aa47dd5498642c7a23c9189a1cff
Signed-off-by: Dibyendu Roy <dibyen@codeaurora.org>
---
tools/hciattach_rome.c | 6 +++---
tools/hciattach_rome.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 6a3f33867c12..0d7014f1d2f6 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1544,10 +1544,10 @@ static void flow_control(int fd, int opt)
c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */
c_opt.c_cflag &= ~CSIZE;
c_opt.c_cflag |= (CS8 | CLOCAL | CREAD);
- if (MSM_ENABLE_FLOW_CTRL)
+ if (opt == MSM_ENABLE_FLOW_CTRL)
c_opt.c_cflag |= CRTSCTS;
- else if (MSM_DISABLE_FLOW_CTRL)
- c_opt.c_cflag |= ~CRTSCTS;
+ else if (opt == MSM_DISABLE_FLOW_CTRL)
+ c_opt.c_cflag &= ~CRTSCTS;
else {
fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__);
return;
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 8eaeeed8bc96..3fdaf208e522 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -40,8 +40,8 @@
#define NVITEM_SIZE 2
#define PERSIST_HEADER_LEN 3
#define BD_ADDR_LEN 6
-#define MSM_ENABLE_FLOW_CTRL 16
-#define MSM_DISABLE_FLOW_CTRL 17
+#define MSM_DISABLE_FLOW_CTRL 0
+#define MSM_ENABLE_FLOW_CTRL 1
#define USERIAL_OP_CLK_ON 0x5441
#define USERIAL_OP_CLK_OFF 0x5442

View File

@ -0,0 +1,65 @@
From: Dibyendu Roy <dibyen@codeaurora.org>
Date: Thu, 11 Jun 2015 12:07:43 +0530
Subject: [PATCH] Adding MDM specific code under _PLATFORM_MDM_
This patch is added to comment out the commit
84cc0e12983b5761c67789ef93fd6fb164c7314d in x86 as
dynamic suspend feature is not available in x86. However,
this code shall be active for MDM platform due to
dynamic suspend feature.
Change-Id: I998f0521b4a5f9744412db40f2c2d3bff2ac3d11
---
tools/hciattach_rome.c | 5 ++++-
tools/hciattach_rome.h | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 0d7014f1d2f6..1891de24e21a 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1779,13 +1779,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
vnd_userial.fd = fd;
+#ifdef _PLATFORM_MDM_
/* Vote for UART CLK prior to FW download */
err = ioctl(fd, USERIAL_OP_CLK_ON);
if (err < 0) {
fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__);
return -1;
}
-
+#endif
/* Get Rome version information */
if((err = rome_patch_ver_req(fd)) <0){
fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err);
@@ -1923,10 +1924,12 @@ download:
}
error:
+#ifdef _PLATFORM_MDM_
/* Vote UART CLK OFF post to FW download */
err = ioctl(fd, USERIAL_OP_CLK_OFF);
if (err < 0)
fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__);
+#endif
return err;
}
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 3fdaf208e522..89f7db3bef86 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -42,8 +42,11 @@
#define BD_ADDR_LEN 6
#define MSM_DISABLE_FLOW_CTRL 0
#define MSM_ENABLE_FLOW_CTRL 1
+
+#ifdef _PLATFORM_MDM_
#define USERIAL_OP_CLK_ON 0x5441
#define USERIAL_OP_CLK_OFF 0x5442
+#endif
unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
typedef enum {

View File

@ -0,0 +1,58 @@
From: Dibyendu Roy <dibyen@codeaurora.org>
Date: Mon, 6 Jul 2015 13:30:53 +0530
Subject: [PATCH] Bluetooth: Fix static analysis issues
Change-Id: Ida91f012544c39a8aaa6e7db23f1d5b68d3bec08
---
tools/hciattach.c | 9 ++++++++-
tools/hciattach_rome.c | 10 ++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 6de4129dfd8f..c9a5feffca2b 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -1395,7 +1395,14 @@ int main(int argc, char *argv[])
dev[0] = 0;
if (!strchr(opt, '/'))
strcpy(dev, "/dev/");
- strcat(dev, opt);
+
+ if (strlen(opt) + 1 > sizeof(dev) - strlen(dev)) {
+ fprintf(stderr, "error: string truncated\n");
+ exit(1);
+ }
+
+ strncat(dev, opt, sizeof(dev) - strlen(dev) - 1);
+
break;
case 1:
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 1891de24e21a..59bdc16e4e8f 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -933,7 +933,13 @@ int rome_get_tlv_file(char *file_path)
/* Get File Size */
fseek (pFile , 0 , SEEK_END);
- fileSize = ftell (pFile);
+
+ if((fileSize = ftell(pFile)) < 0) {
+ fprintf(stderr, "%s: fail to get current file position\n", file_path);
+ fclose (pFile);
+ return -1;
+ }
+
rewind (pFile);
pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize);
@@ -1107,7 +1113,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
int rome_tlv_dnld_req(int fd, int tlv_size)
{
int total_segment, remain_size, i, err = -1;
- unsigned char wait_cc_evt;
+ unsigned char wait_cc_evt = FALSE;
unsigned int rom = rome_ver >> 16;
total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT;

View File

@ -1,104 +0,0 @@
#!/bin/sh
#===============================================================================
#
# bluez
#
# Copyright (C) 2012-2014 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: Configure Bluetooth
#
#===============================================================================
set -e
if [ "${1}" != "start" ]; then
exit 0
fi
SCRIPTNAME="$(basename "${0}")"
bt_init() {
if grep -qs '\<digi,ccardimx28\>' /proc/device-tree/compatible; then
BT_PWR_GPIO_NR="21"
elif grep -qs '\<digi,ccimx6\>' /proc/device-tree/compatible; then
BT_PWR_GPIO_NR="244"
fi
# Use a sub-shell here to change to firmware directory
(
cd /lib/firmware/ar3k/1020200
# Get MAC address from device tree or NVRAM. Use a default value it it has not been set.
if [ -f "/proc/device-tree/bluetooth/mac-address" ]; then
BTADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address | sed 's/:$//g')"
else
BTADDR="$(sed -ne 's,^.*btaddr1=\([^[:blank:]]\+\)[:blank:]*.*,\1,g;T;p' /proc/cmdline)"
fi
if [ -z "${BTADDR}" ] || [ "${BTADDR}" = "00:00:00:00:00:00" ]; then
BTADDR="00:04:F3:FF:FF:BB"
fi
# Update the MAC address file only if it has changed.
FW_MAC="ar3kbdaddr.pst"
[ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BTADDR}" ] || echo ${BTADDR} > ${FW_MAC}
JPN_REGCODE="0x2"
REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
BT_CLASS_LINK="PS_ASIC.pst"
BT_CLASS_FILE="PS_ASIC_class_1.pst"
if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then
BT_CLASS_FILE="PS_ASIC_class_2.pst"
fi
# Replace the configuration file if different
if ! cmp -s ${BT_CLASS_FILE} ${BT_CLASS_LINK}; then
ln -sf ${BT_CLASS_FILE} ${BT_CLASS_LINK}
fi
# Remove not used configuration and readme files
# -- Do not quote the subcommand to avoid leading/trailing whitespace
# -- being part of the file name.
rm -f $(echo PS_ASIC_class_?.pst | sed -e "s,${BT_CLASS_FILE},,g") readme.txt
)
# Start the Bluetooth driver and daemon (D-BUS must already be running)
RETRIES="5"
while [ "${RETRIES}" -gt "0" ]; do
hciattach ttyBt ath3k 4000000 1>/dev/null && break
if [ -n "${BT_PWR_GPIO_NR}" ]; then
#
# If hciattach fails try to recover it by toggling the BT power GPIO
#
BT_PWR_L="/sys/class/gpio/gpio${BT_PWR_GPIO_NR}"
[ -d "${BT_PWR_L}" ] || printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_PWR_L}/direction && sleep .2
printf 0 > ${BT_PWR_L}/value && sleep .2
printf 1 > ${BT_PWR_L}/value && sleep .2
[ -d "${BT_PWR_L}" ] && printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/unexport
else
sleep .5
fi
RETRIES="$((RETRIES - 1))"
done
if [ "${RETRIES}" -eq "0" ]; then
echo "${SCRIPTNAME}: FAILED (hciattach)"
exit
fi
if hciconfig hci0 up; then
: # No-op
else
echo "${SCRIPTNAME}: FAILED"
exit
fi
}
# Check if this hardware does support Bluetooth
[ -d "/proc/device-tree/bluetooth" ] && bt_init
echo "Starting bluetooth services."
start-stop-daemon -S --background --exec /usr/lib/bluez5/bluetooth/bluetoothd

View File

@ -1,16 +0,0 @@
# Copyright (C) 2015 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += "file://bluez-init"
inherit update-rc.d
PACKAGECONFIG_append = " experimental"
do_install_append() {
install -d ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/bluez-init ${D}${sysconfdir}/init.d/bluez
}
INITSCRIPT_NAME = "bluez"
INITSCRIPT_PARAMS = "start 10 5 ."

View File

@ -0,0 +1,45 @@
# Copyright (C) 2015 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
SRC_URI += " \
file://bluez-init \
file://0021-hcitool-do-not-show-unsupported-refresh-option.patch \
file://0022-hcitool-increase-the-shown-connection-limit-to-20.patch \
"
SRC_URI_append_ccimx6ul = " \
file://0001-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch \
file://0002-bluetooth-Enable-bluetooth-low-power-mode-functional.patch \
file://0003-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch \
file://0004-bluetooth-Configure-BD-Address.patch \
file://0005-bluetooth-Remove-unused-functions-in-the-firmware-do.patch \
file://0006-bluetooth-Enable-3Mbps-baud-rate-support.patch \
file://0007-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch \
file://0008-bluetooth-Add-support-for-TUFEELO-firmware-download.patch \
file://0009-bluetooth-Add-support-for-ROME-3.2-SOC.patch \
file://0010-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch \
file://0011-bluetooth-Add-support-for-multi-baud-rate.patch \
file://0012-Override-PCM-Settings-by-reading-configuration-file.patch \
file://0013-Add-support-for-Tufello-1.1-SOC.patch \
file://0014-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch \
file://0015-Override-IBS-settings-by-reading-configuration-file.patch \
file://0016-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch \
file://0017-bluetooth-Fix-flow-control-operation.patch \
file://0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \
file://0019-Bluetooth-Fix-static-analysis-issues.patch \
"
inherit update-rc.d
PACKAGECONFIG_append = " experimental"
do_install_append() {
install -d ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/bluez-init ${D}${sysconfdir}/init.d/bluez
}
INITSCRIPT_NAME = "bluez"
INITSCRIPT_PARAMS = "start 10 5 ."
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -0,0 +1,38 @@
From 24fd20438f00a6f1bdeb6f23358ef60c2696b488 Mon Sep 17 00:00:00 2001
From: "Chen, Yi" <yichen@qti.qualcomm.com>
Date: Wed, 2 Sep 2015 21:25:01 +0530
Subject: WPS: Fix num_probereq_cb clearing on DISABLE to avoid segfault
Reset hapd->num_probereq_cb to 0 on an interface deinit to avoid
unexpected behavior if the same interface is enabled again without fully
freeing the data structures. hostapd_register_probereq_cb() increments
hapd->num_probereq_cb by one and leaves all old values unchanged. In
this deinit+init case, that would result in the first entry in the list
having an uninitialized pointer and the next Probe Request frame
processing would likely cause the process to terminate on segmentation
fault.
This issue could be hit when hostapd was used with WPS enabled (non-zero
wps_state configuration parameter) and control interface command DISABLE
and ENABLE were used.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
---
src/ap/hostapd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index e4d7bfc..c09c17a 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -261,6 +261,7 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd)
{
os_free(hapd->probereq_cb);
hapd->probereq_cb = NULL;
+ hapd->num_probereq_cb = 0;
#ifdef CONFIG_P2P
wpabuf_free(hapd->p2p_beacon_ie);
--
cgit v0.12

View File

@ -0,0 +1,9 @@
# Copyright (C) 2016 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
# The recipe uses a different "$S" directory so point the patch to the hostapd
# tarball directory.
SRC_URI_append_ccimx6ul = " file://fix_num_probereq_cb_clearing.patch;patchdir=.."
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -0,0 +1,449 @@
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date: Wed, 11 May 2016 12:07:15 +0200
Subject: [PATCH] cryptodev: Fix issue with signature generation
That patch also enables support for SHA2 hashes, and removes support
for hashes that were never supported by cryptodev.
Forward port of patch from:
https://rt.openssl.org/Ticket/Display.html?id=2770&user=guest&pass=guest
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
crypto/engine/eng_cryptodev.c | 197 +++++++++++++++++++++++++++++++-----------
1 file changed, 147 insertions(+), 50 deletions(-)
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index 926d95c0d7fc..d3554b4eaecd 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -2,6 +2,7 @@
* Copyright (c) 2002 Bob Beck <beck@openbsd.org>
* Copyright (c) 2002 Theo de Raadt
* Copyright (c) 2002 Markus Friedl
+ * Copyright (c) 2012 Nikos Mavrogiannopoulos
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -72,7 +73,6 @@ struct dev_crypto_state {
struct session_op d_sess;
int d_fd;
# ifdef USE_CRYPTODEV_DIGESTS
- char dummy_mac_key[HASH_MAX_LEN];
unsigned char digest_res[HASH_MAX_LEN];
char *mac_data;
int mac_len;
@@ -189,8 +189,10 @@ static struct {
static struct {
int id;
int nid;
- int keylen;
+ int digestlen;
} digests[] = {
+#if 0
+ /* HMAC is not supported */
{
CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16
},
@@ -198,15 +200,15 @@ static struct {
CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20
},
{
- CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16
- /* ? */
+ CRYPTO_SHA2_256_HMAC, NID_hmacWithSHA256, 32
},
{
- CRYPTO_MD5_KPDK, NID_undef, 0
+ CRYPTO_SHA2_384_HMAC, NID_hmacWithSHA384, 48
},
{
- CRYPTO_SHA1_KPDK, NID_undef, 0
+ CRYPTO_SHA2_512_HMAC, NID_hmacWithSHA512, 64
},
+#endif
{
CRYPTO_MD5, NID_md5, 16
},
@@ -214,6 +216,15 @@ static struct {
CRYPTO_SHA1, NID_sha1, 20
},
{
+ CRYPTO_SHA2_256, NID_sha256, 32
+ },
+ {
+ CRYPTO_SHA2_384, NID_sha384, 48
+ },
+ {
+ CRYPTO_SHA2_512, NID_sha512, 64
+ },
+ {
0, NID_undef, 0
},
};
@@ -288,13 +299,14 @@ static int get_cryptodev_ciphers(const int **cnids)
static int nids[CRYPTO_ALGORITHM_MAX];
struct session_op sess;
int fd, i, count = 0;
+ unsigned char fake_key[CRYPTO_CIPHER_MAX_KEY_LEN];
if ((fd = get_dev_crypto()) < 0) {
*cnids = NULL;
return (0);
}
memset(&sess, 0, sizeof(sess));
- sess.key = (caddr_t) "123456789abcdefghijklmno";
+ sess.key = (void*)fake_key;
for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
if (ciphers[i].nid == NID_undef)
@@ -325,6 +337,7 @@ static int get_cryptodev_ciphers(const int **cnids)
static int get_cryptodev_digests(const int **cnids)
{
static int nids[CRYPTO_ALGORITHM_MAX];
+ unsigned char fake_key[CRYPTO_CIPHER_MAX_KEY_LEN];
struct session_op sess;
int fd, i, count = 0;
@@ -333,12 +346,12 @@ static int get_cryptodev_digests(const int **cnids)
return (0);
}
memset(&sess, 0, sizeof(sess));
- sess.mackey = (caddr_t) "123456789abcdefghijklmno";
+ sess.mackey = fake_key;
for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
if (digests[i].nid == NID_undef)
continue;
sess.mac = digests[i].id;
- sess.mackeylen = digests[i].keylen;
+ sess.mackeylen = 8;
sess.cipher = 0;
if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
@@ -424,14 +437,14 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
cryp.ses = sess->ses;
cryp.flags = 0;
cryp.len = inl;
- cryp.src = (caddr_t) in;
- cryp.dst = (caddr_t) out;
+ cryp.src = (void*) in;
+ cryp.dst = (void*) out;
cryp.mac = 0;
cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
if (ctx->cipher->iv_len) {
- cryp.iv = (caddr_t) ctx->iv;
+ cryp.iv = (void*) ctx->iv;
if (!ctx->encrypt) {
iiv = in + inl - ctx->cipher->iv_len;
memcpy(save_iv, iiv, ctx->cipher->iv_len);
@@ -483,7 +496,7 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
if ((state->d_fd = get_dev_crypto()) < 0)
return (0);
- sess->key = (caddr_t) key;
+ sess->key = (void*)key;
sess->keylen = ctx->key_len;
sess->cipher = cipher;
@@ -749,16 +762,6 @@ static int digest_nid_to_cryptodev(int nid)
return (0);
}
-static int digest_key_length(int nid)
-{
- int i;
-
- for (i = 0; digests[i].id; i++)
- if (digests[i].nid == nid)
- return digests[i].keylen;
- return (0);
-}
-
static int cryptodev_digest_init(EVP_MD_CTX *ctx)
{
struct dev_crypto_state *state = ctx->md_data;
@@ -769,7 +772,6 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
printf("cryptodev_digest_init: Can't get digest \n");
return (0);
}
-
memset(state, 0, sizeof(struct dev_crypto_state));
if ((state->d_fd = get_dev_crypto()) < 0) {
@@ -777,8 +779,8 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
return (0);
}
- sess->mackey = state->dummy_mac_key;
- sess->mackeylen = digest_key_length(ctx->digest->type);
+ sess->mackey = NULL;
+ sess->mackeylen = 0;
sess->mac = digest;
if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
@@ -794,8 +796,8 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
size_t count)
{
- struct crypt_op cryp;
struct dev_crypto_state *state = ctx->md_data;
+ struct crypt_op cryp;
struct session_op *sess = &state->d_sess;
if (!data || state->d_fd < 0) {
@@ -804,7 +806,7 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
}
if (!count) {
- return (0);
+ return (1);
}
if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
@@ -828,9 +830,9 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
cryp.ses = sess->ses;
cryp.flags = 0;
cryp.len = count;
- cryp.src = (caddr_t) data;
+ cryp.src = (void*) data;
cryp.dst = NULL;
- cryp.mac = (caddr_t) state->digest_res;
+ cryp.mac = (void*) state->digest_res;
if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
printf("cryptodev_digest_update: digest failed\n");
return (0);
@@ -844,8 +846,6 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
struct dev_crypto_state *state = ctx->md_data;
struct session_op *sess = &state->d_sess;
- int ret = 1;
-
if (!md || state->d_fd < 0) {
printf("cryptodev_digest_final: illegal input\n");
return (0);
@@ -859,7 +859,7 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
cryp.len = state->mac_len;
cryp.src = state->mac_data;
cryp.dst = NULL;
- cryp.mac = (caddr_t) md;
+ cryp.mac = (void*)md;
if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
printf("cryptodev_digest_final: digest failed\n");
return (0);
@@ -870,7 +870,7 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
memcpy(md, state->digest_res, ctx->digest->md_size);
- return (ret);
+ return 1;
}
static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx)
@@ -921,8 +921,8 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
digest = digest_nid_to_cryptodev(to->digest->type);
- sess->mackey = dstate->dummy_mac_key;
- sess->mackeylen = digest_key_length(to->digest->type);
+ sess->mackey = NULL;
+ sess->mackeylen = 0;
sess->mac = digest;
dstate->d_fd = get_dev_crypto();
@@ -945,34 +945,118 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
return 1;
}
-const EVP_MD cryptodev_sha1 = {
+static const EVP_MD cryptodev_sha1 = {
NID_sha1,
- NID_undef,
+ NID_sha1WithRSAEncryption,
SHA_DIGEST_LENGTH,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
EVP_MD_FLAG_ONESHOT,
cryptodev_digest_init,
cryptodev_digest_update,
cryptodev_digest_final,
cryptodev_digest_copy,
cryptodev_digest_cleanup,
- EVP_PKEY_NULL_method,
+ EVP_PKEY_RSA_method,
SHA_CBLOCK,
- sizeof(struct dev_crypto_state),
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
};
-const EVP_MD cryptodev_md5 = {
+static const EVP_MD cryptodev_sha256 = {
+ NID_sha256,
+ NID_sha256WithRSAEncryption,
+ SHA256_DIGEST_LENGTH,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_RSA_method,
+ SHA256_CBLOCK,
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
+};
+
+static const EVP_MD cryptodev_sha224 = {
+ NID_sha224,
+ NID_sha224WithRSAEncryption,
+ SHA224_DIGEST_LENGTH,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_RSA_method,
+ SHA256_CBLOCK,
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
+};
+
+static const EVP_MD cryptodev_sha384 = {
+ NID_sha384,
+ NID_sha384WithRSAEncryption,
+ SHA384_DIGEST_LENGTH,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_RSA_method,
+ SHA512_CBLOCK,
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
+};
+
+static const EVP_MD cryptodev_sha512 = {
+ NID_sha512,
+ NID_sha512WithRSAEncryption,
+ SHA512_DIGEST_LENGTH,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
+ EVP_MD_FLAG_ONESHOT,
+ cryptodev_digest_init,
+ cryptodev_digest_update,
+ cryptodev_digest_final,
+ cryptodev_digest_copy,
+ cryptodev_digest_cleanup,
+ EVP_PKEY_RSA_method,
+ SHA512_CBLOCK,
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
+};
+
+static const EVP_MD cryptodev_md5 = {
NID_md5,
- NID_undef,
+ NID_md5WithRSAEncryption,
16 /* MD5_DIGEST_LENGTH */ ,
+#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT)
+ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|
+ EVP_MD_FLAG_DIGALGID_ABSENT|
+#endif
EVP_MD_FLAG_ONESHOT,
cryptodev_digest_init,
cryptodev_digest_update,
cryptodev_digest_final,
cryptodev_digest_copy,
cryptodev_digest_cleanup,
- EVP_PKEY_NULL_method,
+ EVP_PKEY_RSA_method,
64 /* MD5_CBLOCK */ ,
- sizeof(struct dev_crypto_state),
+ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state),
};
# endif /* USE_CRYPTODEV_DIGESTS */
@@ -992,6 +1076,18 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
case NID_sha1:
*digest = &cryptodev_sha1;
break;
+ case NID_sha224:
+ *digest = &cryptodev_sha224;
+ break;
+ case NID_sha256:
+ *digest = &cryptodev_sha256;
+ break;
+ case NID_sha384:
+ *digest = &cryptodev_sha384;
+ break;
+ case NID_sha512:
+ *digest = &cryptodev_sha512;
+ break;
default:
# endif /* USE_CRYPTODEV_DIGESTS */
*digest = NULL;
@@ -1022,7 +1118,7 @@ static int bn2crparam(const BIGNUM *a, struct crparam *crp)
return (1);
memset(b, 0, bytes);
- crp->crp_p = (caddr_t) b;
+ crp->crp_p = (void*) b;
crp->crp_nbits = bits;
for (i = 0, j = 0; i < a->top; i++) {
@@ -1277,7 +1373,7 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen,
kop.crk_op = CRK_DSA_SIGN;
/* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
- kop.crk_param[0].crp_p = (caddr_t) dgst;
+ kop.crk_param[0].crp_p = (void*)dgst;
kop.crk_param[0].crp_nbits = dlen * 8;
if (bn2crparam(dsa->p, &kop.crk_param[1]))
goto err;
@@ -1317,7 +1413,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
kop.crk_op = CRK_DSA_VERIFY;
/* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
- kop.crk_param[0].crp_p = (caddr_t) dgst;
+ kop.crk_param[0].crp_p = (void*)dgst;
kop.crk_param[0].crp_nbits = dlen * 8;
if (bn2crparam(dsa->p, &kop.crk_param[1]))
goto err;
@@ -1398,9 +1494,10 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
goto err;
kop.crk_iparams = 3;
- kop.crk_param[3].crp_p = (caddr_t) key;
- kop.crk_param[3].crp_nbits = keylen * 8;
+ kop.crk_param[3].crp_p = (void*) key;
+ kop.crk_param[3].crp_nbits = keylen;
kop.crk_oparams = 1;
+ dhret = keylen/8;
if (ioctl(fd, CIOCKEY, &kop) == -1) {
const DH_METHOD *meth = DH_OpenSSL();
@@ -1470,7 +1567,7 @@ void ENGINE_load_cryptodev(void)
put_dev_crypto(fd);
if (!ENGINE_set_id(engine, "cryptodev") ||
- !ENGINE_set_name(engine, "BSD cryptodev engine") ||
+ !ENGINE_set_name(engine, "cryptodev engine") ||
!ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) ||
!ENGINE_set_digests(engine, cryptodev_engine_digests) ||
!ENGINE_set_ctrl_function(engine, cryptodev_ctrl) ||

View File

@ -0,0 +1,203 @@
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date: Wed, 11 May 2016 12:33:20 +0200
Subject: [PATCH] cryptodev: allow copying EVP contexts
Forward port of patch from:
https://rt.openssl.org/Ticket/Display.html?id=2770&user=guest&pass=guest
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
crypto/engine/eng_cryptodev.c | 57 ++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index d3554b4eaecd..47e292f5e3c0 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -547,151 +547,164 @@ static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
* gets called when libcrypto requests a cipher NID.
*/
+static int cryptodev_cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void *p2)
+{
+ struct dev_crypto_state *state = ctx->cipher_data;
+ struct session_op *sess = &state->d_sess;
+
+ if (type == EVP_CTRL_COPY) {
+ EVP_CIPHER_CTX *out = p2;
+ return cryptodev_init_key(out, sess->key, ctx->iv, 0);
+ }
+
+ return 0;
+}
+
/* RC4 */
const EVP_CIPHER cryptodev_rc4 = {
NID_rc4,
1, 16, 0,
- EVP_CIPH_VARIABLE_LENGTH,
+ EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
NULL,
NULL,
- NULL
+ cryptodev_cipher_ctrl
};
/* DES CBC EVP */
const EVP_CIPHER cryptodev_des_cbc = {
NID_des_cbc,
8, 8, 8,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
/* 3DES CBC EVP */
const EVP_CIPHER cryptodev_3des_cbc = {
NID_des_ede3_cbc,
8, 24, 8,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_bf_cbc = {
NID_bf_cbc,
8, 16, 8,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_cast_cbc = {
NID_cast5_cbc,
8, 16, 8,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_aes_cbc = {
NID_aes_128_cbc,
16, 16, 16,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_aes_192_cbc = {
NID_aes_192_cbc,
16, 24, 16,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_aes_256_cbc = {
NID_aes_256_cbc,
16, 32, 16,
- EVP_CIPH_CBC_MODE,
+ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
# ifdef CRYPTO_AES_CTR
const EVP_CIPHER cryptodev_aes_ctr = {
NID_aes_128_ctr,
16, 16, 14,
- EVP_CIPH_CTR_MODE,
+ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_aes_ctr_192 = {
NID_aes_192_ctr,
16, 24, 14,
- EVP_CIPH_CTR_MODE,
+ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
const EVP_CIPHER cryptodev_aes_ctr_256 = {
NID_aes_256_ctr,
16, 32, 14,
- EVP_CIPH_CTR_MODE,
+ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY,
cryptodev_init_key,
cryptodev_cipher,
cryptodev_cleanup,
sizeof(struct dev_crypto_state),
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
- NULL
+ cryptodev_cipher_ctrl
};
# endif
/*

Some files were not shown because too many files have changed in this diff Show More