Import G96XFXXUCFTJ2 OSRC

This commit is contained in:
rifek4 2020-11-05 15:57:53 +01:00 committed by xxmustafacooTR
parent 46afb1983a
commit bdead5b636
No known key found for this signature in database
GPG key ID: 520B6FE385CBF5C9
134 changed files with 11616 additions and 8423 deletions

View file

@ -5044,6 +5044,7 @@ CONFIG_GATOR_WITH_MALI_SUPPORT=y
CONFIG_GATOR_MALI_MIDGARD=y
CONFIG_GATOR_MALI_MIDGARD_PATH="drivers/gpu/arm/tHEx/r9p0"
CONFIG_FIVE_TEE_DRIVER=y
# CONFIG_FIVE_USE_EMULATOR is not set
CONFIG_FIVE_USE_TRUSTONIC=y
# CONFIG_TEE_DRIVER_DEBUG is not set
CONFIG_FIVE_TRUSTLET_PATH="five/ffffffff000000000000000000000072.tlbin"
@ -5058,6 +5059,7 @@ CONFIG_ICD=y
CONFIG_ICD_USE_TRUSTONIC=y
CONFIG_TZIC=y
CONFIG_TZIC_USE_TRUSTONIC=y
# CONFIG_TZIC_DEFAULT is not set
#
# Firmware Drivers

View file

@ -5043,6 +5043,7 @@ CONFIG_GATOR_WITH_MALI_SUPPORT=y
CONFIG_GATOR_MALI_MIDGARD=y
CONFIG_GATOR_MALI_MIDGARD_PATH="drivers/gpu/arm/tHEx/r9p0"
CONFIG_FIVE_TEE_DRIVER=y
# CONFIG_FIVE_USE_EMULATOR is not set
CONFIG_FIVE_USE_TRUSTONIC=y
# CONFIG_TEE_DRIVER_DEBUG is not set
CONFIG_FIVE_TRUSTLET_PATH="five/ffffffff000000000000000000000072.tlbin"
@ -5057,6 +5058,7 @@ CONFIG_ICD=y
CONFIG_ICD_USE_TRUSTONIC=y
CONFIG_TZIC=y
CONFIG_TZIC_USE_TRUSTONIC=y
# CONFIG_TZIC_DEFAULT is not set
#
# Firmware Drivers

View file

@ -49,7 +49,7 @@
/* respond timeout for MCP notification, in secs */
#define MCP_TIMEOUT 10
#define MCP_RETRIES 2
#define MCP_RETRIES 3
#define MCP_NF_QUEUE_SZ 8
static struct {

View file

@ -1849,6 +1849,27 @@ struct camera2_dng_udm {
uint32_t gammaYpnt[32];
};
enum camera_client_index {
CAMERA_APP_CATEGORY_NOT_READ = -1,
CAMERA_APP_CATEGORY_NONE = 0,
CAMERA_APP_CATEGORY_FACEBOOK = 1,
CAMERA_APP_CATEGORY_WECHAT = 2,
CAMERA_APP_CATEGORY_SNAPCHAT = 3,
CAMERA_APP_CATEGORY_TWITTER = 4,
CAMERA_APP_CATEGORY_INSTAGRAM = 5,
CAMERA_APP_CATEGORY_3P_VT = 6,
CAMERA_APP_CATEGORY_VAULT = 7,
CAMERA_APP_CATEGORY_FACEBOOK_MASSENGER = 8,
CAMERA_APP_CATEGORY_WHATSAPP = 9,
CAMERA_APP_CATEGORY_ULIKE = 10,
CAMERA_APP_CATEGORY_WEIBO = 11,
CAMERA_APP_CATEGORY_MEITU = 12,
CAMERA_APP_CATEGORY_KAKAOBANK = 13,
CAMERA_APP_CATEGORY_CAMCARD = 14,
CAMERA_APP_CATEGORY_CAMCARD_FREE = 15,
CAMERA_APP_CATEGORY_MAX
};
/** \brief
User-defined control area.
\remarks

View file

@ -3253,6 +3253,7 @@ static ssize_t rb_info_store(struct device *dev,
return ret;
}
#if defined(CONFIG_CP_ZEROCOPY)
static ssize_t zmc_count_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@ -3284,6 +3285,9 @@ static ssize_t zmc_count_store(struct device *dev,
static ssize_t mif_buff_mng_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
if (!g_mif_buff_mng)
return 0;
return sprintf(buf, "used(%d)/free(%d)/total(%d)\n",
g_mif_buff_mng->used_cell_count, g_mif_buff_mng->free_cell_count,
g_mif_buff_mng->cell_count);
@ -3314,19 +3318,24 @@ static ssize_t force_use_memcpy_store(struct device *dev,
modem->mld->force_use_memcpy = 1;
return count;
}
#endif
static DEVICE_ATTR_RW(tx_period_ms);
static DEVICE_ATTR_RW(rb_info);
#if defined(CONFIG_CP_ZEROCOPY)
static DEVICE_ATTR_RO(mif_buff_mng);
static DEVICE_ATTR_RW(zmc_count);
static DEVICE_ATTR_RW(force_use_memcpy);
#endif
static struct attribute *shmem_attrs[] = {
&dev_attr_tx_period_ms.attr,
&dev_attr_rb_info.attr,
#if defined(CONFIG_CP_ZEROCOPY)
&dev_attr_mif_buff_mng.attr,
&dev_attr_zmc_count.attr,
&dev_attr_force_use_memcpy.attr,
#endif
NULL,
};

View file

@ -84,7 +84,7 @@ static const char *hex = "0123456789abcdef";
static struct raw_notifier_head cp_crash_notifier;
struct mif_buff_mng *g_mif_buff_mng;
struct mif_buff_mng *g_mif_buff_mng = NULL;
static inline void ts2utc(struct timespec *ts, struct utc_time *utc)
{

View file

@ -1254,6 +1254,9 @@ static void read_bulk_callback(struct urb *urb)
netif_device_detach(tp->netdev);
return;
case -ENOENT:
case -EPROTO:
netif_info(tp, intr, tp->netdev,
"Stop submitting intr, status %d\n", status);
return; /* the urb is in unlink state */
case -ETIME:
if (net_ratelimit())

View file

@ -75,6 +75,12 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#endif /* USE_SMMU_ARCH_MSM */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#include <linux/exynos-pci-ctrl.h>
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#define PCI_CFG_RETRY 10
#define OS_HANDLE_MAGIC 0x1234abcd /* Magic # to recognize osh */
@ -705,6 +711,12 @@ static int dhdpcie_suspend_dev(struct pci_dev *dev)
}
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
DHD_TRACE_HW4(("%s: Enter\n", __FUNCTION__));
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
exynos_pcie_l1ss_ctrl(0, PCIE_L1SS_CTRL_WIFI);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
dhd_dpc_tasklet_kill(bus->dhd);
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
@ -773,7 +785,12 @@ static int dhdpcie_resume_dev(struct pci_dev *dev)
printf("%s:pci_set_power_state error %d \n", __FUNCTION__, err);
goto out;
}
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
exynos_pcie_l1ss_ctrl(1, PCIE_L1SS_CTRL_WIFI);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
out:
return err;
}

View file

@ -351,10 +351,39 @@ extern uint64 osl_localtime_ns(void);
#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
#define bzero(b, len) memset((b), '\0', (len))
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
extern int exynos_pcie_l1_exit(int ch_num);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
/* register access macros */
#ifdef CONFIG_64BIT
/* readq is defined only for 64 bit platform */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
__typeof(*(r)) __osl_v = 0; \
exynos_pcie_l1_exit(0); \
BCM_REFERENCE(osh); \
switch (sizeof(*(r))) { \
case sizeof(uint8): __osl_v = \
readb((volatile uint8*)(r)); break; \
case sizeof(uint16): __osl_v = \
readw((volatile uint16*)(r)); break; \
case sizeof(uint32): __osl_v = \
readl((volatile uint32*)(r)); break; \
case sizeof(uint64): __osl_v = \
readq((volatile uint64*)(r)); break; \
} \
__osl_v; \
}), \
OSL_READ_REG(osh, r)) \
)
#else /* !CONFIG_64BIT */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
@ -374,6 +403,9 @@ extern uint64 osl_localtime_ns(void);
}), \
OSL_READ_REG(osh, r)) \
)
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#else /* !CONFIG_64BIT */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
@ -395,6 +427,26 @@ extern uint64 osl_localtime_ns(void);
#ifdef CONFIG_64BIT
/* writeq is defined only for 64 bit platform */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
({ \
exynos_pcie_l1_exit(0); \
switch (sizeof(*(r))) { \
case sizeof(uint8): writeb((uint8)(v), \
(volatile uint8*)(r)); break; \
case sizeof(uint16): writew((uint16)(v), \
(volatile uint16*)(r)); break; \
case sizeof(uint32): writel((uint32)(v), \
(volatile uint32*)(r)); break; \
case sizeof(uint64): writeq((uint64)(v), \
(volatile uint64*)(r)); break; \
} \
}), \
(OSL_WRITE_REG(osh, r, v))); \
} while (0)
#else
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
switch (sizeof(*(r))) { \
@ -405,7 +457,9 @@ extern uint64 osl_localtime_ns(void);
}, \
(OSL_WRITE_REG(osh, r, v))); \
} while (0)
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#else /* !CONFIG_64BIT */
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \

View file

@ -19,6 +19,13 @@ config BCM4343
This module adds support for wireless adapters based on
Broadcom 4343 chipset.
config BCM43436
tristate "Broadcom 43436 wireless cards support"
depends on BROADCOM_WIFI
---help---
This module adds support for wireless adapters based on
Broadcom 43436 chipset.
config BCM4334
tristate "Broadcom 4334 wireless cards support"
depends on BROADCOM_WIFI
@ -96,6 +103,13 @@ config BCM43455
This module adds support for wireless adapters based on
Broadcom 43455 chipset.
config BCM43456
tristate "Broadcom 43456 wireless cards support"
depends on BROADCOM_WIFI
---help---
This module adds support for wireless adapters based on
Broadcom 43456 chipset.
config BCM4334W
tristate "Broadcom 4334W wireless cards support"
depends on BROADCOM_WIFI
@ -133,7 +147,7 @@ config BROADCOM_WIFI_RESERVED_MEM
config WIFI_BROADCOM_COB
bool "BROADCOM WIFI COB"
depends on (BCM43455 || BCM4343 || BCM43454 || BCM43012)
depends on (BCM43456 || BCM43455 || BCM4343 || BCM43436 || BCM43454 || BCM43012)
---help---
This is a configuration for Broadcom WIFI COB Type.
@ -213,6 +227,13 @@ config SPLIT_ARGOS_SET
---help---
To support SPLIT_ARGOS_SET
config WLAN_VHTDISABLE
bool "WLAN Disable 11ac"
depends on BCM43456
default n
---help---
This is a configuration to disable 11ac.
config WLAN_TSQ_MULTIPLIER
bool "Enable TCP TSQ_MULTIPLIER"
depends on BROADCOM_WIFI

View file

@ -312,6 +312,16 @@ DHDCFLAGS += -DSUPPORT_RANDOM_MAC_SCAN
# WLC_E_SET_SSID fail
DHDCFLAGS += -DSET_SSID_FAIL_CUSTOM_RC=100
# Enable to block Band A(5G), Only support Band B(2G)
ifeq ($(CONFIG_WLAN_5GDISABLE),y)
DHDCFLAGS += -DDHD_2G_ONLY_SUPPORT
endif
# Disable VHT(5G HT80) mode
ifeq ($(CONFIG_WLAN_VHTDISABLE),y)
DHDCFLAGS += -DDHD_DISABLE_VHTMODE
endif
# Use legacy random mac
# Disable the legacy randmac and enable scanmac
#DHDCFLAGS += -DLEGACY_RANDOM_MAC
@ -881,12 +891,19 @@ ifeq ($(CONFIG_ARCH_MSM8998),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
endif
ifeq ($(CONFIG_ARCH_QCOM),y)
DHDCFLAGS += -DCONFIG_ARCH_MSM
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_ARCH_MSM),y)
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -922,18 +939,60 @@ ifneq ($(CONFIG_WLAN_GRACE),)
DHDCFLAGS += -DWBTEXT
# DHDCFLAGS += -DDHD_DEBUG_UART
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890)),y)
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890) $(CONFIG_ARCH_SDM845)),y)
# Runtime PM
DHDCFLAGS += -DDHD_PCIE_RUNTIMEPM -DMAX_IDLE_COUNT=11 -DCUSTOM_DHD_RUNTIME_MS=100
# Disable SOFTAP_SEND_HANGEVT
DHDCFLAGS := $(filter-out -DSOFTAP_SEND_HANGEVT,$(DHDCFLAGS))
# CLM
DHDCFLAGS += -DDHD_SUPPORT_GB_999
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8998) $(CONFIG_ARCH_SDM845)),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
DHDCFLAGS += -DSET_DMA_MASK_64BIT
endif
# LOGTRACE_EVENT
DHDCFLAGS += -DSHOW_LOGTRACE
DHDCFLAGS += -DLOGTRACE_FROM_FILE
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# For Samsung factory mode only
ifeq ($(CONFIG_SEC_FACTORY),y)
# Detect NON DMA M2M corruption
DHDCFLAGS += -DDHD_NON_DMA_M2M_CORRUPTION
# Detect FW Memory Corruption
DHDCFLAGS += -DDHD_FW_MEM_CORRUPTION
endif # CONFIG_SEC_FACTORY
ifeq ($(CONFIG_BCM4359),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM4358),)
@ -1119,8 +1178,22 @@ endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
endif
ifneq ($(CONFIG_BCM43456),)
DHDCFLAGS += -DBCM43456_CHIP
DHDCFLAGS += -DWLADPS_PRIVATE_CMD
endif
ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DBCM43455_CHIP -DHW_OOB
DHDCFLAGS += -DBCM43455_CHIP
endif
ifneq ($(CONFIG_BCM43454),)
DHDCFLAGS += -DBCM43454_CHIP
endif
# BCM43454/43455/43456 common difine.
ifneq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)))
DHDCFLAGS += -DHW_OOB
DHDCFLAGS += -DSUPPORT_MULTIPLE_REVISION
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR
@ -1137,10 +1210,10 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DPROP_TXSTATUS_VSDB
DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
# New Features
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
DHDCFLAGS += -DOKC_SUPPORT
@ -1152,17 +1225,70 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DSUPPORT_2G_VHT
DHDCFLAGS += -DSUPPORT_WL_TXPOWER
DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM43455),y)
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
# FCC power limit control on ch12/13.
# # DHDCFLAGS += -DFCC_PWR_LIMIT_2G
#
# # Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455)), y)
#Support Qatar 5G band 36-64, 100-144, 149-165 channels
DHDCFLAGS += -DDHD_SUPPORT_QA_6
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
ifneq ($(filter y,$(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43455) $(CONFIG_BCM43456)))
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(CONFIG_BCM43456),)
# STA/SoftAP Concurrent Mode Support for legacy chip
DHDCFLAGS += -DWL_VIRTUAL_APSTA
DHDCFLAGS += -DWL_RESTRICTED_APSTA_SCC
DHDCFLAGS += -DSOFTAP_UAPSD_OFF
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
# Use restricted channels on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_RESTRICTED_CHANNEL
# Block ARP during DHCP on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_BLOCK_ARP_DURING_DHCP
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# Iface force dev close
DHDCFLAGS += -DIFACE_HANG_FORCE_DEV_CLOSE
endif
endif
endif
ifneq ($(CONFIG_BCM43454),)
@ -1264,15 +1390,34 @@ endif
ifneq ($(CONFIG_BCM4343),)
DHDCFLAGS += -DBCM43430_CHIP -DSUPPORT_MULTIPLE_REVISION -DHW_OOB
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
DHDCFLAGS += -DCUSTOM_ASSOC_RETRY_MAX=7
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
# tput enhancement
DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
DHDCFLAGS += -DRXFRAME_THREAD -DRXTHREAD_ONLYSTA
DHDCFLAGS += -DMAX_HDR_READ=128
DHDCFLAGS += -DDHD_FIRSTREAD=128
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
ifeq ($(CONFIG_BCM43436),y)
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DCUSTOM_FRAMEBURST_SET=1
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
else
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -1284,11 +1429,26 @@ ifeq ($(CONFIG_BCM4343),y)
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
# FCC power limit control on ch12/13.
DHDCFLAGS += -DFCC_PWR_LIMIT_2G
# Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
# Remove common feature for BCM4343
DHDCFLAGS :=$(filter-out -DROAM_AP_ENV_DETECTION,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DSUPPORT_P2P_GO_PS,$(DHDCFLAGS))
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM43012),)

View file

@ -312,6 +312,16 @@ DHDCFLAGS += -DSUPPORT_RANDOM_MAC_SCAN
# WLC_E_SET_SSID fail
DHDCFLAGS += -DSET_SSID_FAIL_CUSTOM_RC=100
# Enable to block Band A(5G), Only support Band B(2G)
ifeq ($(CONFIG_WLAN_5GDISABLE),y)
DHDCFLAGS += -DDHD_2G_ONLY_SUPPORT
endif
# Disable VHT(5G HT80) mode
ifeq ($(CONFIG_WLAN_VHTDISABLE),y)
DHDCFLAGS += -DDHD_DISABLE_VHTMODE
endif
# Use legacy random mac
# Disable the legacy randmac and enable scanmac
#DHDCFLAGS += -DLEGACY_RANDOM_MAC
@ -846,12 +856,19 @@ ifeq ($(CONFIG_ARCH_MSM8998),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
endif
ifeq ($(CONFIG_ARCH_QCOM),y)
DHDCFLAGS += -DCONFIG_ARCH_MSM
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_ARCH_MSM),y)
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -887,18 +904,60 @@ ifneq ($(CONFIG_WLAN_GRACE),)
DHDCFLAGS += -DWBTEXT
# DHDCFLAGS += -DDHD_DEBUG_UART
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890)),y)
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890) $(CONFIG_ARCH_SDM845)),y)
# Runtime PM
DHDCFLAGS += -DDHD_PCIE_RUNTIMEPM -DMAX_IDLE_COUNT=11 -DCUSTOM_DHD_RUNTIME_MS=100
# Disable SOFTAP_SEND_HANGEVT
DHDCFLAGS := $(filter-out -DSOFTAP_SEND_HANGEVT,$(DHDCFLAGS))
# CLM
DHDCFLAGS += -DDHD_SUPPORT_GB_999
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8998) $(CONFIG_ARCH_SDM845)),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
DHDCFLAGS += -DSET_DMA_MASK_64BIT
endif
# LOGTRACE_EVENT
DHDCFLAGS += -DSHOW_LOGTRACE
DHDCFLAGS += -DLOGTRACE_FROM_FILE
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# For Samsung factory mode only
ifeq ($(CONFIG_SEC_FACTORY),y)
# Detect NON DMA M2M corruption
DHDCFLAGS += -DDHD_NON_DMA_M2M_CORRUPTION
# Detect FW Memory Corruption
DHDCFLAGS += -DDHD_FW_MEM_CORRUPTION
endif # CONFIG_SEC_FACTORY
ifeq ($(CONFIG_BCM4359),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM4358),)
@ -1084,8 +1143,22 @@ endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
endif
ifneq ($(CONFIG_BCM43456),)
DHDCFLAGS += -DBCM43456_CHIP
DHDCFLAGS += -DWLADPS_PRIVATE_CMD
endif
ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DBCM43455_CHIP -DHW_OOB
DHDCFLAGS += -DBCM43455_CHIP
endif
ifneq ($(CONFIG_BCM43454),)
DHDCFLAGS += -DBCM43454_CHIP
endif
# BCM43454/43455/43456 common difine.
ifneq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)))
DHDCFLAGS += -DHW_OOB
DHDCFLAGS += -DSUPPORT_MULTIPLE_REVISION
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR
@ -1102,10 +1175,10 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DPROP_TXSTATUS_VSDB
DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
# New Features
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
DHDCFLAGS += -DOKC_SUPPORT
@ -1117,17 +1190,70 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DSUPPORT_2G_VHT
DHDCFLAGS += -DSUPPORT_WL_TXPOWER
DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM43455),y)
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
# FCC power limit control on ch12/13.
# # DHDCFLAGS += -DFCC_PWR_LIMIT_2G
#
# # Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455)), y)
#Support Qatar 5G band 36-64, 100-144, 149-165 channels
DHDCFLAGS += -DDHD_SUPPORT_QA_6
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
ifneq ($(filter y,$(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43455) $(CONFIG_BCM43456)))
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(CONFIG_BCM43456),)
# STA/SoftAP Concurrent Mode Support for legacy chip
DHDCFLAGS += -DWL_VIRTUAL_APSTA
DHDCFLAGS += -DWL_RESTRICTED_APSTA_SCC
DHDCFLAGS += -DSOFTAP_UAPSD_OFF
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
# Use restricted channels on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_RESTRICTED_CHANNEL
# Block ARP during DHCP on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_BLOCK_ARP_DURING_DHCP
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# Iface force dev close
DHDCFLAGS += -DIFACE_HANG_FORCE_DEV_CLOSE
endif
endif
endif
ifneq ($(CONFIG_BCM43454),)
@ -1229,15 +1355,34 @@ endif
ifneq ($(CONFIG_BCM4343),)
DHDCFLAGS += -DBCM43430_CHIP -DSUPPORT_MULTIPLE_REVISION -DHW_OOB
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
DHDCFLAGS += -DCUSTOM_ASSOC_RETRY_MAX=7
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
# tput enhancement
DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
DHDCFLAGS += -DRXFRAME_THREAD -DRXTHREAD_ONLYSTA
DHDCFLAGS += -DMAX_HDR_READ=128
DHDCFLAGS += -DDHD_FIRSTREAD=128
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
ifeq ($(CONFIG_BCM43436),y)
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DCUSTOM_FRAMEBURST_SET=1
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
else
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -1249,11 +1394,26 @@ ifeq ($(CONFIG_BCM4343),y)
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
# FCC power limit control on ch12/13.
DHDCFLAGS += -DFCC_PWR_LIMIT_2G
# Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
# Remove common feature for BCM4343
DHDCFLAGS :=$(filter-out -DROAM_AP_ENV_DETECTION,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DSUPPORT_P2P_GO_PS,$(DHDCFLAGS))
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM43012),)

View file

@ -312,6 +312,16 @@ DHDCFLAGS += -DSUPPORT_RANDOM_MAC_SCAN
# WLC_E_SET_SSID fail
DHDCFLAGS += -DSET_SSID_FAIL_CUSTOM_RC=100
# Enable to block Band A(5G), Only support Band B(2G)
ifeq ($(CONFIG_WLAN_5GDISABLE),y)
DHDCFLAGS += -DDHD_2G_ONLY_SUPPORT
endif
# Disable VHT(5G HT80) mode
ifeq ($(CONFIG_WLAN_VHTDISABLE),y)
DHDCFLAGS += -DDHD_DISABLE_VHTMODE
endif
# Use legacy random mac
# Disable the legacy randmac and enable scanmac
#DHDCFLAGS += -DLEGACY_RANDOM_MAC
@ -869,12 +879,19 @@ ifeq ($(CONFIG_ARCH_MSM8998),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
endif
ifeq ($(CONFIG_ARCH_QCOM),y)
DHDCFLAGS += -DCONFIG_ARCH_MSM
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_ARCH_MSM),y)
DHDCFLAGS := $(filter-out -DDHDTCPACK_SUPPRESS,$(DHDCFLAGS))
endif
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -910,18 +927,60 @@ ifneq ($(CONFIG_WLAN_GRACE),)
DHDCFLAGS += -DWBTEXT
# DHDCFLAGS += -DDHD_DEBUG_UART
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890)),y)
ifeq ($(filter y,$(CONFIG_ARCH_MSM8996) $(CONFIG_SOC_EXYNOS8890) $(CONFIG_ARCH_SDM845)),y)
# Runtime PM
DHDCFLAGS += -DDHD_PCIE_RUNTIMEPM -DMAX_IDLE_COUNT=11 -DCUSTOM_DHD_RUNTIME_MS=100
# Disable SOFTAP_SEND_HANGEVT
DHDCFLAGS := $(filter-out -DSOFTAP_SEND_HANGEVT,$(DHDCFLAGS))
# CLM
DHDCFLAGS += -DDHD_SUPPORT_GB_999
endif
ifeq ($(filter y,$(CONFIG_ARCH_MSM8998) $(CONFIG_ARCH_SDM845)),y)
# Use SMMU for IOMEM
DHDCFLAGS += -DUSE_SMMU_ARCH_MSM
DHDCFLAGS += -DSET_DMA_MASK_64BIT
endif
# LOGTRACE_EVENT
DHDCFLAGS += -DSHOW_LOGTRACE
DHDCFLAGS += -DLOGTRACE_FROM_FILE
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# For Samsung factory mode only
ifeq ($(CONFIG_SEC_FACTORY),y)
# Detect NON DMA M2M corruption
DHDCFLAGS += -DDHD_NON_DMA_M2M_CORRUPTION
# Detect FW Memory Corruption
DHDCFLAGS += -DDHD_FW_MEM_CORRUPTION
endif # CONFIG_SEC_FACTORY
ifeq ($(CONFIG_BCM4359),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM4358),)
@ -1107,8 +1166,22 @@ endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
endif
ifneq ($(CONFIG_BCM43456),)
DHDCFLAGS += -DBCM43456_CHIP
DHDCFLAGS += -DWLADPS_PRIVATE_CMD
endif
ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DBCM43455_CHIP -DHW_OOB
DHDCFLAGS += -DBCM43455_CHIP
endif
ifneq ($(CONFIG_BCM43454),)
DHDCFLAGS += -DBCM43454_CHIP
endif
# BCM43454/43455/43456 common difine.
ifneq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)))
DHDCFLAGS += -DHW_OOB
DHDCFLAGS += -DSUPPORT_MULTIPLE_REVISION
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR
@ -1125,10 +1198,10 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DPROP_TXSTATUS_VSDB
DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
# New Features
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U -DMFP
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
DHDCFLAGS += -DOKC_SUPPORT
@ -1140,17 +1213,70 @@ ifneq ($(CONFIG_BCM43455),)
DHDCFLAGS += -DSUPPORT_2G_VHT
DHDCFLAGS += -DSUPPORT_WL_TXPOWER
DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM43455),y)
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455) $(CONFIG_BCM43456)),y)
DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
# FCC power limit control on ch12/13.
# # DHDCFLAGS += -DFCC_PWR_LIMIT_2G
#
# # Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
ifeq ($(filter y,$(CONFIG_BCM43454) $(CONFIG_BCM43455)), y)
#Support Qatar 5G band 36-64, 100-144, 149-165 channels
DHDCFLAGS += -DDHD_SUPPORT_QA_6
endif
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
ifneq ($(filter y,$(CONFIG_BCM43455) $(CONFIG_BCM43456)),$(filter m,$(CONFIG_BCM43455) $(CONFIG_BCM43456)))
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
# Enable concate blob path
DHDCFLAGS += -DCONCATE_BLOB
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(CONFIG_BCM43456),)
# STA/SoftAP Concurrent Mode Support for legacy chip
DHDCFLAGS += -DWL_VIRTUAL_APSTA
DHDCFLAGS += -DWL_RESTRICTED_APSTA_SCC
DHDCFLAGS += -DSOFTAP_UAPSD_OFF
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
# Use restricted channels on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_RESTRICTED_CHANNEL
# Block ARP during DHCP on STA/SoftAP concurrent mode
DHDCFLAGS += -DAPSTA_BLOCK_ARP_DURING_DHCP
DHDCFLAGS += -DWL_STATIC_IF
DHDCFLAGS += -DWL_STATIC_IFNAME_PREFIX="\"swlan0\""
# Iface force dev close
DHDCFLAGS += -DIFACE_HANG_FORCE_DEV_CLOSE
endif
endif
endif
ifneq ($(CONFIG_BCM43454),)
@ -1252,15 +1378,34 @@ endif
ifneq ($(CONFIG_BCM4343),)
DHDCFLAGS += -DBCM43430_CHIP -DSUPPORT_MULTIPLE_REVISION -DHW_OOB
DHDCFLAGS += -DUSE_CID_CHECK
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
DHDCFLAGS += -DCUSTOM_ASSOC_RETRY_MAX=7
DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
# tput enhancement
DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
DHDCFLAGS += -DRXFRAME_THREAD -DRXTHREAD_ONLYSTA
DHDCFLAGS += -DMAX_HDR_READ=128
DHDCFLAGS += -DDHD_FIRSTREAD=128
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
ifeq ($(CONFIG_BCM43436),y)
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8
DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
DHDCFLAGS += -DCUSTOM_FRAMEBURST_SET=1
# Enable Firmware Coredump
DHDCFLAGS += -DDHD_FW_COREDUMP
DHDCFLAGS += -DDHD_LOG_DUMP
ifneq ($(CONFIG_WLAN_VENDOR_DUMP_ENABLE),y)
DHDCFLAGS += -DDHD_COMMON_DUMP_PATH="\"/data/vendor/log/wifi/\""
DHDCFLAGS += -DDHD_FILE_DUMP_EVENT
DHDCFLAGS := $(filter-out -DDHD_DUMP_FILE_WRITE_FROM_KERNEL ,$(DHDCFLAGS))
endif
ifeq ($(CONFIG_BCMDHD_PREALLOC_MEMDUMP),y)
DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP
endif
else
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
endif
# New Features
DHDCFLAGS += -DDHD_RANDOM_MAC_SCAN
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DBCMCCX
DHDCFLAGS += -DWES_SUPPORT
@ -1272,11 +1417,26 @@ ifeq ($(CONFIG_BCM4343),y)
DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
DRIVER_TYPE = y
endif
# FCC power limit control on ch12/13.
DHDCFLAGS += -DFCC_PWR_LIMIT_2G
# Enable Roam time thresh
DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
# Remove common feature for BCM4343
DHDCFLAGS :=$(filter-out -DROAM_AP_ENV_DETECTION,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DSUPPORT_P2P_GO_PS,$(DHDCFLAGS))
# Generate .softap.info
DHDCFLAGS += -DGEN_SOFTAP_INFO_FILE
ifneq ($(PLATFORM_VERSION),)
# Android O OS use below features
ifeq ($(shell expr $(MAJOR_VERSION) \>= 8),1)
# Use single nvram file
DHDCFLAGS += -DDHD_USE_SINGLE_NVRAM_FILE
endif
endif
endif
ifneq ($(CONFIG_BCM43012),)

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Proprietary,Open:>>
*
* $Id: bcmsdh_sdmmc_linux.c 796911 2018-12-27 10:27:04Z $
* $Id: bcmsdh_sdmmc_linux.c 864822 2020-02-17 08:48:57Z $
*/
#include <typedefs.h>
@ -51,6 +51,14 @@
#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000
#if !defined(SDIO_DEVICE_ID_BROADCOM_43430)
#define SDIO_DEVICE_ID_BROADCOM_43430 43430
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_43430) */
#if !defined(SDIO_DEVICE_ID_BROADCOM_4345)
#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4345) */
extern void wl_cfg80211_set_parent_dev(void *dev);
extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
@ -188,6 +196,8 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = {
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43014_D11N_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43014_D11N2G_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, BCM43014_D11N5G_ID) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43430) },
{ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4345) },
/* { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_ANY_ID) }, */
/* end: all zeroes */
{ 0, 0, 0, 0},

View file

@ -27,7 +27,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd.h 860004 2020-01-20 02:39:12Z $
* $Id: dhd.h 871395 2020-04-01 06:47:36Z $
*/
/****************
@ -2653,6 +2653,7 @@ static INLINE int dhd_check_module_mac(dhd_pub_t *dhdp) { return 0; }
int dhd_read_cis(dhd_pub_t *dhdp);
void dhd_clear_cis(dhd_pub_t *dhdp);
#if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK)
bool dhd_check_module(char *module_name);
extern int dhd_check_module_b85a(void);
extern int dhd_check_module_b90(void);
#define BCM4359_MODULE_TYPE_B90B 1
@ -3233,7 +3234,9 @@ int dhd_print_rtt_data(void *dev, dhd_pub_t *dhdp, const void *user_buf,
void *fp, uint32 len, void *pos);
int dhd_get_debug_dump_file_name(void *dev, dhd_pub_t *dhdp,
char *dump_path, int size);
#if defined(BCMPCIE)
uint32 dhd_get_ext_trap_len(void *ndev, dhd_pub_t *dhdp);
#endif /* BCMPCIE */
uint32 dhd_get_time_str_len(void);
uint32 dhd_get_health_chk_len(void *ndev, dhd_pub_t *dhdp);
uint32 dhd_get_dhd_dump_len(void *ndev, dhd_pub_t *dhdp);

View file

@ -894,11 +894,28 @@ const char *softap_info_values[] = {
#endif /* DHD_SOFTAP_DUAL_IF_INFO */
"yes", "10", "yes", "yes", "yes", NULL
};
#elif defined(BCM43455_CHIP)
#elif defined(BCM4359_CHIP)
const char *softap_info_values[] = {
"yes",
#ifdef DHD_SOFTAP_DUAL_IF_INFO
#if defined(CONFIG_WLAN_GRACE) || defined(CONFIG_SEC_KELLYLTE_PROJECT) || \
defined(CONFIG_SEC_LYKANLTE_PROJECT)
"yes",
#else
"no",
#endif /* CONFIG_WLAN_GRACE || CONFIG_SEC_KELLYLTE_PROJECT || CONFIG_SEC_LYKANLTE_PROJECT */
#endif /* DHD_SOFTAP_DUAL_IF_INFO */
"yes", "10", "yes", "yes", "yes", NULL
};
#elif defined(BCM43455_CHIP) || defined(BCM43456_CHIP)
const char *softap_info_values[] = {
"no",
#ifdef DHD_SOFTAP_DUAL_IF_INFO
#ifdef WL_RESTRICTED_APSTA_SCC
"yes",
#else
"no",
#endif /* WL_RESTRICTED_APSTA_SCC */
#endif /* DHD_SOFTAP_DUAL_IF_INFO */
"yes", "10", "no", "yes", "yes", NULL
};
@ -1008,7 +1025,8 @@ dhd_force_disable_singlcore_scan(dhd_pub_t *dhd)
}
}
#endif /* FORCE_DISABLE_SINGLECORE_SCAN */
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
void
set_irq_cpucore(unsigned int irq, cpumask_var_t default_cpu_mask,
cpumask_var_t affinity_cpu_mask)
@ -1021,4 +1039,4 @@ set_irq_cpucore(unsigned int irq, cpumask_var_t default_cpu_mask,
ARGOS_P2P_TABLE_LABEL,
affinity_cpu_mask, default_cpu_mask);
}
#endif /* SET_PCIE_IRQ_CPU_CORE && !DHD_LB_IRQSET */
#endif /* SET_PCIE_IRQ_CPU_CORE && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */

View file

@ -23,7 +23,7 @@
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: dhd_debug.h 852609 2019-11-26 05:28:02Z $
* $Id: dhd_debug.h 865142 2020-02-19 02:27:53Z $
*/
#ifndef _dhd_debug_h_
@ -442,6 +442,9 @@ typedef enum {
/* Dropped by driver for any other reason. */
RX_PKT_FATE_DRV_DROP_OTHER,
/* Indicate RX Host Wake up packet. */
RX_PKT_FATE_WAKE_PKT,
} wifi_rx_packet_fate;
typedef enum {

View file

@ -25,7 +25,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_linux.c 864043 2020-02-12 07:34:04Z $
* $Id: dhd_linux.c 873599 2020-04-16 03:06:56Z $
*/
#include <typedefs.h>
@ -869,8 +869,11 @@ static int dhd_pm_callback(struct notifier_block *nfb, unsigned long action, voi
}
#endif /* defined(SUPPORT_P2P_GO_PS) && defined(PROP_TXSTATUS) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \
KERNEL_VERSION(2, 6, 39))
dhd_mmc_suspend = suspend;
smp_mb();
#endif // endif
return ret;
}
@ -1623,6 +1626,7 @@ static int dhd_wait_for_file_dump(dhd_pub_t *dhdp)
if (wl_cfg80211_is_hal_started(cfg)) {
int timeleft = 0;
BCM_REFERENCE(timeleft);
DHD_ERROR(("[DUMP] %s: HAL started. send urgent event\n", __FUNCTION__));
dhd_dbg_send_urgent_evt(dhdp, NULL, 0);
@ -4340,12 +4344,13 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
unsigned long flags;
#endif // endif
#ifdef DHD_WAKE_STATUS
int pkt_wake = 0;
wake_counts_t *wcp = NULL;
#endif /* DHD_WAKE_STATUS */
int pkt_wake = 0;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
BCM_REFERENCE(dump_data);
BCM_REFERENCE(pkt_wake);
for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) {
struct ether_header *eh;
@ -4620,6 +4625,7 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
#if defined(DHD_WAKE_STATUS) && defined(DHD_WAKEPKT_DUMP)
if (pkt_wake) {
prhex("[wakepkt_dump]", (char*)dump_data, MIN(len, 32));
dhd_prhex("[wakepkt_dump]", (char*)dump_data, MIN(len, 64), DHD_ERROR_VAL);
DHD_ERROR(("config check in_suspend: %d ", dhdp->in_suspend));
#ifdef ARP_OFFLOAD_SUPPORT
DHD_ERROR(("arp hmac_update:%d \n", dhdp->hmac_updated));
@ -4639,7 +4645,11 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
DHD_DBG_PKT_MON_RX(dhdp, skb);
#ifdef DHD_PKT_LOGGING
if (pkt_wake) {
DHD_PKTLOG_WAKERX(dhdp, skb);
} else {
DHD_PKTLOG_RX(dhdp, skb);
}
#endif /* DHD_PKT_LOGGING */
/* Strip header, count, deliver upward */
skb_pull(skb, ETH_HLEN);
@ -5185,10 +5195,11 @@ exit:
static int
dhd_dpc_thread(void *data)
{
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
int ret = 0;
unsigned long flags;
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */
tsk_ctl_t *tsk = (tsk_ctl_t *)data;
dhd_info_t *dhd = (dhd_info_t *)tsk->parent;
@ -5202,7 +5213,8 @@ dhd_dpc_thread(void *data)
setScheduler(current, SCHED_FIFO, &param);
}
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
if (!zalloc_cpumask_var(&dhd->pub.default_cpu_mask, GFP_KERNEL)) {
DHD_ERROR(("dpc_thread, zalloc_cpumask_var error\n"));
dhd->pub.affinity_isdpc = FALSE;
@ -5252,7 +5264,7 @@ dhd_dpc_thread(void *data)
#ifdef CUSTOM_SET_CPUCORE
dhd->pub.current_dpc = current;
#endif /* CUSTOM_SET_CPUCORE */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */
/* Run until signal received */
while (1) {
if (!binary_sema_down(tsk)) {
@ -5310,10 +5322,11 @@ dhd_rxf_thread(void *data)
{
tsk_ctl_t *tsk = (tsk_ctl_t *)data;
dhd_info_t *dhd = (dhd_info_t *)tsk->parent;
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
int ret = 0;
unsigned long flags;
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */
#if defined(WAIT_DEQUEUE)
#define RXF_WATCHDOG_TIME 250 /* BARK_TIME(1000) / */
ulong watchdogTime = OSL_SYSUPTIME(); /* msec */
@ -5330,7 +5343,8 @@ dhd_rxf_thread(void *data)
setScheduler(current, SCHED_FIFO, &param);
}
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
if (!zalloc_cpumask_var(&dhd->pub.rxf_affinity_cpu_mask, GFP_KERNEL)) {
DHD_ERROR(("rxthread zalloc_cpumask_var error\n"));
dhd->pub.affinity_isrxf = FALSE;
@ -5354,7 +5368,7 @@ dhd_rxf_thread(void *data)
#ifdef CUSTOM_SET_CPUCORE
dhd->pub.current_rxf = current;
#endif /* CUSTOM_SET_CPUCORE */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */
/* Run until signal received */
while (1) {
if (down_interruptible(&tsk->sema) == 0) {
@ -9261,7 +9275,7 @@ bool dhd_validate_chipid(dhd_pub_t *dhdp)
config_chipid = BCM43430_CHIP_ID;
#elif defined(BCM43018_CHIP)
config_chipid = BCM43018_CHIP_ID;
#elif defined(BCM43455_CHIP)
#elif defined(BCM43455_CHIP) || defined(BCM43456_CHIP)
config_chipid = BCM4345_CHIP_ID;
#elif defined(BCM43454_CHIP)
config_chipid = BCM43454_CHIP_ID;
@ -9277,6 +9291,11 @@ bool dhd_validate_chipid(dhd_pub_t *dhdp)
return FALSE;
#endif /* BCM4354_CHIP */
#ifdef SUPPORT_MULTIPLE_CHIP_4345X
if (config_chipid == BCM43454_CHIP_ID || config_chipid == BCM4345_CHIP_ID) {
return TRUE;
}
#endif /* SUPPORT_MULTIPLE_CHIP_4345X */
#if defined(BCM4354_CHIP) && defined(SUPPORT_MULTIPLE_REVISION)
if (chipid == BCM4350_CHIP_ID && config_chipid == BCM4354_CHIP_ID) {
return TRUE;
@ -10123,6 +10142,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#ifdef DISABLE_PRUNED_SCAN
uint32 scan_features = 0;
#endif /* DISABLE_PRUNED_SCAN */
#ifdef DHD_2G_ONLY_SUPPORT
uint band = WLC_BAND_2G;
#endif /* DHD_2G_ONLY_SUPPORT */
#ifdef BCMPCIE_OOB_HOST_WAKE
uint32 hostwake_oob = 0;
#endif /* BCMPCIE_OOB_HOST_WAKE */
@ -10138,7 +10160,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
uint32 rrm_bcn_req_thrtl_win = RRM_BCNREQ_MAX_CHAN_TIME * 2;
uint32 rrm_bcn_req_max_off_chan_time = RRM_BCNREQ_MAX_CHAN_TIME;
#endif /* WBTEXT && RRM_BCNREQ_MAX_CHAN_TIME */
#if !defined(CONFIG_BCM4359)
wl_wlc_version_t wlc_ver;
#endif /* CONFIG_BCM4359 */
#ifdef PKT_FILTER_SUPPORT
dhd_pkt_filter_enable = TRUE;
@ -10474,6 +10498,15 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
else
dhd->info->rxthread_enabled = TRUE;
#endif // endif
#ifdef DHD_2G_ONLY_SUPPORT
DHD_ERROR(("Enabled DHD 2G only support!!\n"));
ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_BAND, (char *)&band, sizeof(band), TRUE, 0);
if (ret < 0) {
DHD_ERROR(("%s Set Band B failed %d\n", __FUNCTION__, ret));
}
#endif /* DHD_2G_ONLY_SUPPORT */
/* Set Country code */
if (dhd->dhd_cspec.ccode[0] != 0) {
ret = dhd_iovar(dhd, 0, "country", (char *)&dhd->dhd_cspec, sizeof(wl_country_t),
@ -10843,6 +10876,10 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd_control_he_enab(dhd, control_he_enab);
#endif /* DISABLE_HE_ENAB || CUSTOM_CONTROL_HE_ENAB */
#ifdef DHD_DISABLE_VHTMODE
dhd_disable_vhtmode(dhd);
#endif /* DHD_DISABLE_VHTMODE */
#ifdef CUSTOM_PSPRETEND_THR
/* Turn off MPC in AP mode */
ret = dhd_iovar(dhd, 0, "pspretend_threshold", (char *)&pspretend_thr,
@ -11245,6 +11282,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
sec_save_wlinfo(fw_version, EPI_VERSION_STR, dhd->info->nv_path, clm_version);
#endif /* WRITE_WLANINFO */
#if !defined(CONFIG_BCM4359)
/* query for 'wlc_ver' to get version info from firmware */
memset(&wlc_ver, 0, sizeof(wl_wlc_version_t));
ret = dhd_iovar(dhd, 0, "wlc_ver", NULL, 0, (char *)&wlc_ver,
@ -11255,6 +11293,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd->wlc_ver_major = wlc_ver.wlc_ver_major;
dhd->wlc_ver_minor = wlc_ver.wlc_ver_minor;
}
#endif /* !CONFIG_BCM4359 */
#ifdef GEN_SOFTAP_INFO_FILE
sec_save_softap_info();
#endif /* GEN_SOFTAP_INFO_FILE */
@ -14505,6 +14544,7 @@ dhd_dev_set_whitelist_ssid(struct net_device *dev, wl_ssid_whitelist_t *ssid_whi
if (flush) {
ssid_whitelist = &whitelist_ssid_flush;
ssid_whitelist->ssid_count = 0;
len = sizeof(whitelist_ssid_flush);
} else {
DHD_ERROR(("%s : Nothing to do here\n", __FUNCTION__));
return BCME_BADARG;
@ -15512,12 +15552,66 @@ void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec, bool notif
if (dhd && dhd->pub.up) {
memcpy(&dhd->pub.dhd_cspec, cspec, sizeof(wl_country_t));
#ifdef DHD_DISABLE_VHTMODE
dhd_disable_vhtmode(&dhd->pub);
#endif /* DHD_DISABLE_VHTMODE */
#ifdef WL_CFG80211
wl_update_wiphybands(cfg, notify);
#endif // endif
}
}
#ifdef DHD_DISABLE_VHTMODE
void
dhd_disable_vhtmode(dhd_pub_t *dhd)
{
int ret = 0;
uint32 vhtmode = FALSE;
char buf[32];
/* Get vhtmode */
ret = dhd_iovar(dhd, 0, "vhtmode", NULL, 0, (char *)&buf, sizeof(buf), FALSE);
if (ret < 0) {
DHD_ERROR(("%s Get vhtmode Fail ret %d\n", __FUNCTION__, ret));
return;
}
memcpy(&vhtmode, buf, sizeof(uint32));
if (vhtmode == 0) {
DHD_ERROR(("%s Get vhtmode is 0\n", __FUNCTION__));
return;
}
vhtmode = FALSE;
/* Set vhtmode */
ret = dhd_iovar(dhd, 0, "vhtmode", (char *)&vhtmode, sizeof(vhtmode), NULL, 0, TRUE);
if (ret == 0) {
DHD_ERROR(("%s Set vhtmode Success %d\n", __FUNCTION__, vhtmode));
} else {
if (ret == BCME_NOTDOWN) {
uint wl_down = 1;
ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN,
(char *)&wl_down, sizeof(wl_down), TRUE, 0);
if (ret) {
DHD_ERROR(("%s WL_DOWN Fail ret %d\n", __FUNCTION__, ret));
return;
}
ret = dhd_iovar(dhd, 0, "vhtmode", (char *)&vhtmode,
sizeof(vhtmode), NULL, 0, TRUE);
DHD_ERROR(("%s Set vhtmode %d, ret %d\n", __FUNCTION__, vhtmode, ret));
ret = dhd_wl_ioctl_cmd(dhd, WLC_UP,
(char *)&wl_down, sizeof(wl_down), TRUE, 0);
if (ret) {
DHD_ERROR(("%s WL_UP Fail ret %d\n", __FUNCTION__, ret));
}
} else {
DHD_ERROR(("%s Set vhtmode 0 failed %d\n", __FUNCTION__, ret));
}
}
}
#endif /* DHD_DISABLE_VHTMODE */
void dhd_bus_band_set(struct net_device *dev, uint band)
{
dhd_info_t *dhd = DHD_DEV_INFO(dev);
@ -17175,9 +17269,9 @@ void dhd_schedule_memdump(dhd_pub_t *dhdp, uint8 *buf, uint32 size)
unsigned long flags = 0;
dhd_dump_t *dump = NULL;
dhd_info_t *dhd_info = NULL;
#if !defined(DHD_DUMP_FILE_WRITE_FROM_KERNEL)
#if !defined(DHD_DUMP_FILE_WRITE_FROM_KERNEL) && defined(DHD_LOG_DUMP)
log_dump_type_t type = DLD_BUF_TYPE_ALL;
#endif /* !DHD_DUMP_FILE_WRITE_FROM_KERNEL */
#endif /* !DHD_DUMP_FILE_WRITE_FROM_KERNEL && DHD_LOG_DUMP */
dhd_info = (dhd_info_t *)dhdp->info;
dump = (dhd_dump_t *)MALLOC(dhdp->osh, sizeof(dhd_dump_t));
@ -17945,6 +18039,7 @@ dhd_get_time_str_len()
return strlen(time_str);
}
#if defined(BCMPCIE)
uint32
dhd_get_ext_trap_len(void *ndev, dhd_pub_t *dhdp)
{
@ -17966,6 +18061,7 @@ dhd_get_ext_trap_len(void *ndev, dhd_pub_t *dhdp)
}
return length;
}
#endif /* BCMPCIE */
#if defined(DHD_FW_COREDUMP) && defined(DNGL_EVENT_SUPPORT)
uint32
@ -18192,6 +18288,7 @@ dhd_log_flush(dhd_pub_t *dhdp, log_dump_type_t *type)
int i = 0;
#endif /* EWP_EDL */
dhd_info_t *dhd_info = NULL;
BCM_REFERENCE(dhd_info);
/* if dhdp is null, its extremely unlikely that log dump will be scheduled
* so not freeing 'type' here is ok, even if we want to free 'type'
@ -18240,7 +18337,9 @@ dhd_log_flush(dhd_pub_t *dhdp, log_dump_type_t *type)
dhd_flush_logtrace_process(dhd_info);
}
#else
#if defined(SHOW_LOGTRACE)
dhd_flush_logtrace_process(dhd_info);
#endif /* SHOW_LOGTRACE */
#endif /* EWP_EDL */
#ifdef CUSTOMER_HW4_DEBUG
@ -18395,6 +18494,7 @@ exit:
}
#endif /* DHD_FW_COREDUMP && DNGL_EVENT_SUPPORT */
#if defined(BCMPCIE)
int
dhd_print_ext_trap_data(void *dev, dhd_pub_t *dhdp, const void *user_buf,
void *fp, uint32 len, void *pos)
@ -18439,6 +18539,7 @@ dhd_print_ext_trap_data(void *dev, dhd_pub_t *dhdp, const void *user_buf,
exit:
return ret;
}
#endif /* BCMPCIE */
int
dhd_print_dump_data(void *dev, dhd_pub_t *dhdp, const void *user_buf,
@ -18854,7 +18955,7 @@ do_dhd_log_dump(dhd_pub_t *dhdp, log_dump_type_t *type)
#if defined(DHD_FW_COREDUMP) && defined(DNGL_EVENT_SUPPORT)
len = dhd_get_health_chk_len(NULL, dhdp);
if (len) {
if (dhd_print_ext_trap_data(NULL, dhdp, 0, fp, len, &pos) < 0)
if (dhd_print_health_chk_data(NULL, dhdp, 0, fp, len, &pos) < 0)
goto exit2;
}
#endif /* DHD_FW_COREDUMP && DNGL_EVENT_SUPPORT */
@ -20369,15 +20470,16 @@ dhd_set_irq_cpucore(dhd_pub_t *dhdp, int affinity_cmd)
switch (affinity_cmd) {
case PCIE_IRQ_AFFINITY_OFF:
break;
case PCIE_IRQ_AFFINITY_BIG_CORE_ANY:
#if defined(CONFIG_ARCH_SM8150)
case PCIE_IRQ_AFFINITY_BIG_CORE_ANY:
case PCIE_IRQ_AFFINITY_BIG_CORE_EXYNOS:
irq_set_affinity_hint(pcie_irq, dhdp->info->cpumask_primary);
irq_set_affinity(pcie_irq, dhdp->info->cpumask_primary);
#else /* Exynos and Others */
irq_set_affinity(pcie_irq, dhdp->info->cpumask_primary);
#endif /* CONFIG_ARCH_SM8150 */
break;
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820)
#elif defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820)
case PCIE_IRQ_AFFINITY_BIG_CORE_ANY:
irq_set_affinity(pcie_irq, dhdp->info->cpumask_primary);
break;
case PCIE_IRQ_AFFINITY_BIG_CORE_EXYNOS:
DHD_ERROR(("%s, PCIe IRQ:%u set Core %d\n",
__FUNCTION__, pcie_irq, PCIE_IRQ_CPU_CORE));

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_linux.h 828731 2019-07-04 05:25:31Z $
* $Id: dhd_linux.h 864822 2020-02-17 08:48:57Z $
*/
/* wifi platform functions for power, interrupt and pre-alloc, either
@ -328,14 +328,15 @@ extern uint32 sec_save_softap_info(void);
extern uint32 report_hang_privcmd_err;
#endif /* DHD_SEND_HANG_PRIVCMD_ERRORS */
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET)
#if defined(ARGOS_CPU_SCHEDULER) && !defined(DHD_LB_IRQSET) && \
!defined(CONFIG_SOC_EXYNOS7870)
extern int argos_task_affinity_setup_label(struct task_struct *p, const char *label,
struct cpumask * affinity_cpu_mask, struct cpumask * default_cpu_mask);
extern struct cpumask hmp_slow_cpu_mask;
extern struct cpumask hmp_fast_cpu_mask;
extern void set_irq_cpucore(unsigned int irq, cpumask_var_t default_cpu_mask,
cpumask_var_t affinity_cpu_mask);
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET */
#endif /* ARGOS_CPU_SCHEDULER && !DHD_LB_IRQSET && !CONFIG_SOC_EXYNOS7870 */
#if (defined(ARGOS_CPU_SCHEDULER) && defined(ARGOS_RPS_CPU_CTL)) || \
defined(ARGOS_NOTIFY_CB)
@ -452,4 +453,7 @@ extern void dhd_reset_tcpsync_info_by_dev(struct net_device *dev);
int compat_kernel_read(struct file *file, loff_t offset, char *addr, unsigned long count);
#ifdef DHD_DISABLE_VHTMODE
void dhd_disable_vhtmode(dhd_pub_t *dhd);
#endif /* DHD_DISABLE_VHTMODE */
#endif /* __DHD_LINUX_H__ */

View file

@ -25,7 +25,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_linux_exportfs.c 851174 2019-11-18 12:13:55Z $
* $Id: dhd_linux_exportfs.c 864784 2020-02-17 05:51:17Z $
*/
#include <linux/kobject.h>
#include <linux/proc_fs.h>
@ -1151,8 +1151,8 @@ set_proptx(struct dhd_info *dev, const char *buf, size_t count)
}
proptx = onoff;
DHD_ERROR(("[WIFI_SEC] %s: FRAMEBURST On/Off from sysfs = %u\n",
__FUNCTION__, txbf));
DHD_ERROR(("[WIFI_SEC] %s: proptx On/Off from sysfs = %u\n",
__FUNCTION__, proptx));
return count;
}
@ -1383,9 +1383,9 @@ static struct attribute *control_file_attrs[] = {
#endif /* PROP_TXSTATUS */
#endif /* USE_WFA_CERT_CONF */
#endif /* DHD_EXPORT_CNTL_FILE */
#ifdef DHD_ADPS_BAM_EXPORT
#if defined(DHD_ADPS_BAM_EXPORT) && defined(WL_BAM)
&dhd_attr_adps_bam.attr,
#endif /* DHD_ADPS_BAM_EXPORT */
#endif /* DHD_ADPS_BAM_EXPORT && WL_BAM */
#ifdef DHD_SEND_HANG_PRIVCMD_ERRORS
&dhd_attr_hang_privcmd_err.attr,
#endif /* DHD_SEND_HANG_PRIVCMD_ERRORS */

View file

@ -195,7 +195,7 @@ dhd_mschdbg_timeslot_profiler_event_data(int sp, int ver, char *title, char *dat
MSCH_EVENT(("0x%08x\n", ntoh32(p->p_timeslot)));
s = (int)(ntoh32(p->state));
if (s > 5) s = 0;
if (s < 0 || s > 5) s = 0;
MSCH_EVENT_HEAD(sn);
MSCH_EVENT(("id: %d, state[%d]: %s, chan_ctxt: [0x%08x]\n",

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_pcie.c 851108 2019-11-18 07:01:36Z $
* $Id: dhd_pcie.c 871395 2020-04-01 06:47:36Z $
*/
/* include files */
@ -1939,13 +1939,12 @@ dhdpcie_bus_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation, bo
bus->dhd, bus->dhd->dongle_reset));
if ((bus->dhd && bus->dhd->dongle_reset) && reset_flag) {
DHD_TRACE(("%s Exit\n", __FUNCTION__));
return;
goto fail;
}
if (bus->is_linkdown) {
DHD_ERROR(("%s : Skip release dongle due to linkdown \n", __FUNCTION__));
return;
goto fail;
}
if (bus->sih) {
@ -1974,12 +1973,14 @@ dhdpcie_bus_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation, bo
/* Disable CLKREQ# */
dhdpcie_clkreq(bus->osh, 1, 0);
}
if (bus->sih != NULL) {
}
fail:
/* Resources should be freed */
if (bus->sih) {
si_detach(bus->sih);
bus->sih = NULL;
}
if (bus->vars && bus->varsz)
if (bus->vars && bus->varsz) {
MFREE(osh, bus->vars, bus->varsz);
bus->vars = NULL;
}
@ -2145,6 +2146,13 @@ bool dhd_bus_watchdog(dhd_pub_t *dhd)
} /* dhd_bus_watchdog */
#if defined(SUPPORT_MULTIPLE_REVISION)
#if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) && \
defined(SUPPORT_BCM4359_MIXED_MODULES)
#define VENDOR_MURATA "murata"
#define VENDOR_WISOL "wisol"
#define VNAME_DELIM "_"
#endif /* SUPPORT_MULTIPLE_MODULE_CIS && USE_CID_CHECK && SUPPORT_BCM4359_MIXED_MODULES */
static int concate_revision_bcm4358(dhd_bus_t *bus, char *fw_path, char *nv_path)
{
uint32 chiprev;
@ -2205,6 +2213,7 @@ static int concate_revision_bcm4359(dhd_bus_t *bus, char *fw_path, char *nv_path
#if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) && \
defined(SUPPORT_BCM4359_MIXED_MODULES)
int module_type = -1;
char chipver_tag_nv[20] = {0, };
#endif /* SUPPORT_MULTIPLE_MODULE_CIS && USE_CID_CHECK && SUPPORT_BCM4359_MIXED_MODULES */
chip_ver = bus->sih->chiprev;
@ -2216,7 +2225,31 @@ static int concate_revision_bcm4359(dhd_bus_t *bus, char *fw_path, char *nv_path
strncat(chipver_tag, "_b1", strlen("_b1"));
} else if (chip_ver == 9) {
DHD_ERROR(("----- CHIP 4359 C0 -----\n"));
#if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) && \
defined(SUPPORT_BCM4359_MIXED_MODULES)
if (dhd_check_module(VENDOR_MURATA)) {
strncat(chipver_tag_nv, VNAME_DELIM, strlen(VNAME_DELIM));
strncat(chipver_tag_nv, VENDOR_MURATA, strlen(VENDOR_MURATA));
} else if (dhd_check_module(VENDOR_WISOL)) {
strncat(chipver_tag_nv, VNAME_DELIM, strlen(VNAME_DELIM));
strncat(chipver_tag_nv, VENDOR_WISOL, strlen(VENDOR_WISOL));
}
/* In case of SEMCO module, extra vendor string doen not need to add */
strncat(chipver_tag_nv, "_c0", strlen("_c0"));
DHD_ERROR(("%s chipver_tag_nv = %s\n", __FUNCTION__, chipver_tag_nv));
#endif /* SUPPORT_MULTIPLE_MODULE_CIS && USE_CID_CHECK && SUPPORT_BCM4359_MIXED_MODULES */
strncat(chipver_tag, "_c0", strlen("_c0"));
#if defined(CONFIG_WLAN_GRACE) || defined(CONFIG_SEC_GRACEQLTE_PROJECT) || \
defined(CONFIG_SEC_LYKANLTE_PROJECT) || defined(CONFIG_SEC_KELLYLTE_PROJECT)
DHD_ERROR(("----- Adding _plus string -----\n"));
strncat(chipver_tag, "_plus", strlen("_plus"));
#if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) && \
defined(SUPPORT_BCM4359_MIXED_MODULES)
strncat(chipver_tag_nv, "_plus", strlen("_plus"));
#endif /* SUPPORT_MULTIPLE_MODULE_CIS && USE_CID_CHECK && SUPPORT_BCM4359_MIXED_MODULES */
#endif /* CONFIG_WLAN_GRACE || CONFIG_SEC_GRACEQLTE_PROJECT || CONFIG_SEC_LYKANLTE_PROJECT ||
* CONFIG_SEC_KELLYLTE_PROJECT
*/
} else {
DHD_ERROR(("----- Unknown chip version, ver=%x -----\n", chip_ver));
return -1;
@ -2240,7 +2273,11 @@ static int concate_revision_bcm4359(dhd_bus_t *bus, char *fw_path, char *nv_path
strncat(fw_path, "_b90s", strlen("_b90s"));
}
strcat(fw_path, chipver_tag);
if (!(strstr(nv_path, VENDOR_MURATA) || strstr(nv_path, VENDOR_WISOL))) {
strcat(nv_path, chipver_tag_nv);
} else {
strcat(nv_path, chipver_tag);
}
break;
}
#else /* SUPPORT_MULTIPLE_MODULE_CIS && USE_CID_CHECK && SUPPORT_BCM4359_MIXED_MODULES */
@ -2270,7 +2307,10 @@ static int concate_revision_bcm4359(dhd_bus_t *bus, char *fw_path, char *nv_path
#define DEFAULT_CIDINFO_FOR_B0 "r01i_e32_b0"
#define MAX_VID_LEN 8
#define CIS_TUPLE_HDR_LEN 2
#if defined(BCM4361_CHIP)
#if defined(BCM4359_CHIP)
#define CIS_TUPLE_START_ADDRESS 0x18011110
#define CIS_TUPLE_END_ADDRESS 0x18011167
#elif defined(BCM4361_CHIP)
#define CIS_TUPLE_START_ADDRESS 0x18011110
#define CIS_TUPLE_END_ADDRESS 0x18011167
#elif defined(BCM4375_CHIP)
@ -2362,6 +2402,7 @@ naming_info_t bcm4375_naming_table[] = {
{ {"1rh_es44"}, {"_1rh_es44_b1"}, {"_b1"} }
};
#if !defined(BCM4359_CHIP)
static naming_info_t *
dhd_find_naming_info(naming_info_t table[], int table_size, char *module_type)
{
@ -2549,6 +2590,7 @@ dhd_find_naming_info_by_chip_rev(naming_info_t table[], int table_size,
return info;
}
#endif /* !BCM4359_CHIP */
#endif /* USE_CID_CHECK */
static int

View file

@ -79,6 +79,12 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#endif /* USE_SMMU_ARCH_MSM */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#include <linux/exynos-pci-ctrl.h>
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#define PCI_CFG_RETRY 10
#define OS_HANDLE_MAGIC 0x1234abcd /* Magic # to recognize osh */
@ -980,6 +986,12 @@ static int dhdpcie_suspend_dev(struct pci_dev *dev)
}
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
DHD_ERROR(("%s: Enter\n", __FUNCTION__));
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
exynos_pcie_l1ss_ctrl(0, PCIE_L1SS_CTRL_WIFI);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
dhdpcie_suspend_dump_cfgregs(bus, "BEFORE_EP_SUSPEND");
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
dhd_dpc_tasklet_kill(bus->dhd);
@ -1055,6 +1067,12 @@ static int dhdpcie_resume_dev(struct pci_dev *dev)
}
BCM_REFERENCE(pch);
dhdpcie_suspend_dump_cfgregs(pch->bus, "AFTER_EP_RESUME");
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
exynos_pcie_l1ss_ctrl(1, PCIE_L1SS_CTRL_WIFI);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
out:
return err;
}

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_pktlog.c 813582 2019-04-05 10:41:35Z $
* $Id: dhd_pktlog.c 865142 2020-02-19 02:27:53Z $
*/
#include <typedefs.h>
@ -320,11 +320,11 @@ dhd_pktlog_ring_deinit(dhd_pub_t *dhdp, dhd_pktlog_ring_t *ring)
/*
* dhd_pktlog_ring_add_pkts : add filtered packets into pktlog ring
* direction : 1 - TX / 0 - RX
* pktid : incase of rx, pktid is not used (pass DHD_INVALID_PKID)
* direction : 1 - TX / 0 - RX / 2 - RX Wakeup Packet
*/
int
dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, bool direction)
dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, uint32 direction)
{
dhd_pktlog_ring_info_t *pkts;
uint8 *pktdata = NULL;
@ -346,11 +346,12 @@ dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, bool directio
pktdata = (uint8 *)PKTDATA(dhdp->osh, pkt);
if (direction == PKT_TX) {
pktlog_case = PKTLOG_TXPKT_CASE;
} else {
} else if ((direction == PKT_RX) || (direction == PKT_WAKERX)) {
pktlog_case = PKTLOG_RXPKT_CASE;
}
if (dhd_pktlog_filter_matched(pktlog_filter, pktdata, pktlog_case)
if ((direction != PKT_WAKERX) &&
dhd_pktlog_filter_matched(pktlog_filter, pktdata, pktlog_case)
== FALSE) {
return BCME_OK;
}
@ -389,9 +390,12 @@ dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, bool directio
if (direction == PKT_TX) {
pkts->info.pkt_hash = __dhd_dbg_pkt_hash((uintptr_t)pkt, pktid);
pkts->tx_fate = TX_PKT_FATE_DRV_QUEUED;
} else {
} else if (direction == PKT_RX) {
pkts->info.pkt_hash = 0U;
pkts->rx_fate = RX_PKT_FATE_SUCCESS;
} else if (direction == PKT_WAKERX) {
pkts->info.pkt_hash = 0U;
pkts->rx_fate = RX_PKT_FATE_WAKE_PKT;
}
DHD_PKT_LOG(("%s(): pkt hash %d\n", __FUNCTION__, pkts->info.pkt_hash));

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_pktlog.h 813582 2019-04-05 10:41:35Z $
* $Id: dhd_pktlog.h 865142 2020-02-19 02:27:53Z $
*/
#ifndef __DHD_PKTLOG_H_
@ -141,15 +141,16 @@ extern int dhd_pktlog_ring_get_nextbuf(dhd_pktlog_ring_t *ringbuf, void **data);
extern int dhd_pktlog_ring_set_prevpos(dhd_pktlog_ring_t *ringbuf);
extern int dhd_pktlog_ring_get_prevbuf(dhd_pktlog_ring_t *ringbuf, void **data);
extern int dhd_pktlog_ring_get_writebuf(dhd_pktlog_ring_t *ringbuf, void **data);
extern int dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, bool direction);
extern int dhd_pktlog_ring_add_pkts(dhd_pub_t *dhdp, void *pkt, uint32 pktid, uint32 direction);
extern int dhd_pktlog_ring_tx_status(dhd_pub_t *dhdp, void *pkt, uint32 pktid,
uint16 status);
extern dhd_pktlog_ring_t* dhd_pktlog_ring_change_size(dhd_pktlog_ring_t *ringbuf, int size);
extern void dhd_pktlog_filter_pull_forward(dhd_pktlog_filter_t *filter,
uint32 del_filter_id, uint32 list_cnt);
#define PKT_TX 1
#define PKT_RX 0
#define PKT_TX 1
#define PKT_WAKERX 2
#define DHD_INVALID_PKTID (0U)
#define PKTLOG_TRANS_TX 0x01
#define PKTLOG_TRANS_RX 0x02
@ -245,6 +246,24 @@ extern void dhd_pktlog_filter_pull_forward(dhd_pktlog_filter_t *filter,
} while (0); \
}
#define DHD_PKTLOG_WAKERX(dhdp, pkt) \
{ \
do { \
if ((dhdp) && (dhdp)->pktlog && (pkt)) { \
PKTLOG_SET_IN_RX(dhdp); \
if (ntoh16((pkt)->protocol) != ETHER_TYPE_BRCM) { \
if ((dhdp)->pktlog->pktlog_ring && \
OSL_ATOMIC_READ((dhdp)->osh, \
(&(dhdp)->pktlog->pktlog_ring->start))) { \
dhd_pktlog_ring_add_pkts(dhdp, pkt, \
DHD_INVALID_PKTID, PKT_WAKERX); \
} \
} \
PKTLOG_CLEAR_IN_RX(dhdp); \
} \
} while (0); \
}
extern dhd_pktlog_filter_t* dhd_pktlog_filter_init(int size);
extern int dhd_pktlog_filter_deinit(dhd_pktlog_filter_t *filter);
extern int dhd_pktlog_filter_add(dhd_pktlog_filter_t *filter, char *arg);

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: dhd_sdio.c 815919 2019-04-22 09:06:50Z $
* $Id: dhd_sdio.c 864822 2020-02-17 08:48:57Z $
*/
#include <typedefs.h>
@ -9353,6 +9353,29 @@ static int concate_revision_bcm4354(dhd_bus_t *bus, char *fw_path, char *nv_path
return 0;
}
#ifdef SUPPORT_MULTIPLE_CHIP_4345X
static int
concate_revision_bcm4345x(dhd_bus_t *bus,
char *fw_path, char *nv_path)
{
uint32 chip_id;
char chipver_tag[10] = "_43454";
chip_id = bus->sih->chip;
if (chip_id == BCM43454_CHIP_ID) {
DHD_ERROR(("----- CHIP 43454 -----\n"));
strcat(fw_path, chipver_tag);
strcat(nv_path, chipver_tag);
} else if (chip_id == BCM4345_CHIP_ID) {
DHD_ERROR(("----- CHIP 43455 -----\n"));
} else {
DHD_ERROR(("----- Unknown chip , id r=%x -----\n", chip_id));
}
return 0;
}
#else /* SUPPORT_MULTIPLE_CHIP_4345X */
static int
concate_revision_bcm43454(dhd_bus_t *bus, char *fw_path, char *nv_path)
{
@ -9385,6 +9408,72 @@ concate_revision_bcm43454(dhd_bus_t *bus, char *fw_path, char *nv_path)
return 0;
}
static int
concate_revision_bcm43455(dhd_bus_t *bus, char *fw_path, char *nv_path)
{
char chipver_tag[10] = {0, };
uint32 chip_rev = 0;
#ifdef SUPPORT_MULTIPLE_BOARD_REV_FROM_DT
int base_system_rev_for_nv = 0;
#endif /* SUPPORT_MULTIPLE_BOARD_REV_FROM_DT */
DHD_TRACE(("%s: BCM43455 Multiple Revision Check\n", __FUNCTION__));
if (bus->sih->chip != BCM4345_CHIP_ID) {
DHD_ERROR(("%s:Chip is not BCM43455!\n", __FUNCTION__));
return -1;
}
chip_rev = bus->sih->chiprev;
if (chip_rev == 0x9) {
DHD_ERROR(("----- CHIP 43456 -----\n"));
strcat(fw_path, "_c5");
strcat(nv_path, "_c5");
} else {
DHD_ERROR(("----- CHIP 43455 -----\n"));
}
#ifdef SUPPORT_MULTIPLE_BOARD_REV_FROM_DT
base_system_rev_for_nv = dhd_get_system_rev();
if (base_system_rev_for_nv > 0) {
DHD_ERROR(("----- Board Rev [%d]-----\n", base_system_rev_for_nv));
sprintf(chipver_tag, "_r%02d", base_system_rev_for_nv);
}
#endif /* SUPPORT_MULTIPLE_BOARD_REV_FROM_DT */
strcat(nv_path, chipver_tag);
return 0;
}
#endif /* SUPPORT_MULTIPLE_CHIP_4345X */
static int
concate_revision_bcm43430(dhd_bus_t *bus, char *fw_path, char *nv_path)
{
uint chipver;
char chipver_tag[4] = {0, };
DHD_TRACE(("%s: BCM43430 Multiple Revision Check\n", __FUNCTION__));
if (bus->sih->chip != BCM43430_CHIP_ID) {
DHD_ERROR(("%s:Chip is not BCM43430\n", __FUNCTION__));
return BCME_ERROR;
}
chipver = bus->sih->chiprev;
DHD_ERROR(("CHIP VER = [0x%x]\n", chipver));
if (chipver == 0x0) {
DHD_ERROR(("----- CHIP bcm4343S -----\n"));
strcat(chipver_tag, "_3s");
} else if (chipver == 0x1) {
DHD_ERROR(("----- CHIP bcm43438 -----\n"));
} else if (chipver == 0x2) {
DHD_ERROR(("----- CHIP bcm43436L -----\n"));
strcat(chipver_tag, "_36");
} else {
DHD_ERROR(("----- CHIP bcm43430 unknown revision %d -----\n",
chipver));
}
strcat(fw_path, chipver_tag);
strcat(nv_path, chipver_tag);
return 0;
}
int
concate_revision(dhd_bus_t *bus, char *fw_path, char *nv_path)
{
@ -9409,10 +9498,22 @@ concate_revision(dhd_bus_t *bus, char *fw_path, char *nv_path)
case BCM4354_CHIP_ID:
res = concate_revision_bcm4354(bus, fw_path, nv_path);
break;
#ifdef SUPPORT_MULTIPLE_CHIP_4345X
case BCM43454_CHIP_ID:
case BCM4345_CHIP_ID:
res = concate_revision_bcm4345x(bus, fw_path, nv_path);
break;
#else /* SUPPORT_MULTIPLE_CHIP_4345X */
case BCM43454_CHIP_ID:
res = concate_revision_bcm43454(bus, fw_path, nv_path);
break;
case BCM4345_CHIP_ID:
res = concate_revision_bcm43455(bus, fw_path, nv_path);
break;
#endif /* SUPPORT_MULTIPLE_CHIP_4345X */
case BCM43430_CHIP_ID:
res = concate_revision_bcm43430(bus, fw_path, nv_path);
break;
default:
DHD_ERROR(("REVISION SPECIFIC feature is not required\n"));
return res;

View file

@ -66,11 +66,11 @@
#if defined(ANDROID_PLATFORM_VERSION)
#if (ANDROID_PLATFORM_VERSION >= 10)
//#define STA_RANDMAC_ENFORCED
#define WL_USE_RANDOMIZED_SCAN
#define WL_STA_ASSOC_RAND
#define RANDOM_MAC_CONTROL
#endif // endif
#ifndef DHD_RANDOM_MAC_SCAN
#define WL_USE_RANDOMIZED_SCAN
#endif /* DHD_RANDOM_MAC_SCAN */
#endif /* ANDROID_PLATFORM_VERSION >= 10 */
#endif /* ANDROID_PLATFORM_VERSION */
/* For COB type feature */
@ -80,15 +80,17 @@
#endif /* CONFIG_WIFI_BROADCOM_COB */
#if defined(CONFIG_MACH_UNIVERSAL7420) || defined(CONFIG_ARCH_MSM8994) || \
defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_SOC_EXYNOS8890)
defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_SOC_EXYNOS8890) || \
defined(CONFIG_SEC_LYKANLTE_PROJECT)
#define SUPPORT_MULTIPLE_MODULE_CIS
#endif /* CONFIG_MACH_UNIVERSAL7420 || CONFIG_ARCH_MSM8994 ||
* CONFIG_ARCH_MSM8996 || CONFIG_SOC_EXYNOS8890
* CONFIG_ARCH_MSM8996 || CONFIG_SOC_EXYNOS8890 || CONFIG_SEC_LYKANLTE_PROJECT
*/
#if defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_SOC_EXYNOS8890)
#if defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_SOC_EXYNOS8890) || \
defined(CONFIG_SEC_LYKANLTE_PROJECT)
#define SUPPORT_BCM4359_MIXED_MODULES
#endif /* CONFIG_ARCH_MSM8996 || CONFIG_SOC_EXYNOS8890 */
#endif /* CONFIG_ARCH_MSM8996 || CONFIG_SOC_EXYNOS8890 || CONFIG_SEC_LYKANLTE_PROJECT */
#ifdef BCMPCIE
/* For EXYNOS PCIe RC Control */
@ -135,6 +137,15 @@
#endif /* CONFIG_MACH_UNIVERSAL7420 */
#endif /* CONFIG_MACH_UNIVERSAL7420 || CONFIG_SOC_EXYNOS8890 || CONFIG_SOC_EXYNOS8895 */
#if defined(CONFIG_SOC_EXYNOS7870) && defined(CONFIG_BCM43456)
#define CUSTOM_SET_CPUCORE
#define PRIMARY_CPUCORE 0
#define MAX_RETRY_SET_CPUCORE 5
#define DPC_CPUCORE 1
#define RXF_CPUCORE 2
#define ARGOS_CPU_SCHEDULER
#endif /* CONFIG_SOC_EXYNOS7870 && CONFIG_BCM43456 */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820)
#define PCIE_IRQ_CPU_CORE 5
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 */
@ -169,7 +180,9 @@
#define DHD_LB_SECONDARY_CPUS (0x0E)
#endif /* CONFIG_SOC_EXYNOS8890 */
#else /* !DHD_LB */
#ifdef BCMPCIE
#define ARGOS_DPC_TASKLET_CTL
#endif /* BCMPCIE */
#endif /* !DHD_LB */
#if defined(CONFIG_ARCH_MSM) || defined(CONFIG_SOC_EXYNOS8895) || \
@ -196,6 +209,10 @@
#endif /* CONFIG_WLAN_REGION_CODE == 150 */
#endif /* CONFIG_WLAN_REGION_CODE >= 100 && CONFIG_WLAN_REGION_CODE < 200 */
#if defined(CONFIG_WIFI_MULTIPLE_CHIP)
#define SUPPORT_MULTIPLE_CHIP_4345X
#endif /* CONFIG_WIFI_MULTIPLE_CHIP */
#if (CONFIG_WLAN_REGION_CODE >= 200) && (CONFIG_WLAN_REGION_CODE < 300) /* KOR */
#undef USE_INITIAL_2G_SCAN
#ifndef ROAM_ENABLE

View file

@ -33,19 +33,19 @@
#define EPI_MINOR_VERSION 15
#define EPI_RC_NUMBER 36
#define EPI_RC_NUMBER 44
#define EPI_INCREMENTAL_NUMBER 0
#define EPI_BUILD_NUMBER 0
#define EPI_VERSION 100, 15, 36, 0
#define EPI_VERSION 100, 15, 44, 0
#define EPI_VERSION_NUM 0x640f2400
#define EPI_VERSION_NUM 0x640f2c00
#define EPI_VERSION_DEV 100.15.36
#define EPI_VERSION_DEV 100.15.44
/* Driver Version String, ASCII, 32 chars max */
#define EPI_VERSION_STR "100.15.36 (r864043)"
#define EPI_VERSION_STR "100.15.44 (r873599)"
#endif /* _epivers_h_ */

View file

@ -351,10 +351,39 @@ extern uint64 osl_systztime_us(void);
#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
#define bzero(b, len) memset((b), '\0', (len))
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
extern int exynos_pcie_l1_exit(int ch_num);
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
/* register access macros */
#ifdef CONFIG_64BIT
/* readq is defined only for 64 bit platform */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
__typeof(*(r)) __osl_v = 0; \
exynos_pcie_l1_exit(0); \
BCM_REFERENCE(osh); \
switch (sizeof(*(r))) { \
case sizeof(uint8): __osl_v = \
readb((volatile uint8*)(r)); break; \
case sizeof(uint16): __osl_v = \
readw((volatile uint16*)(r)); break; \
case sizeof(uint32): __osl_v = \
readl((volatile uint32*)(r)); break; \
case sizeof(uint64): __osl_v = \
readq((volatile uint64*)(r)); break; \
} \
__osl_v; \
}), \
OSL_READ_REG(osh, r)) \
)
#else /* !CONFIG_64BIT */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
({ \
@ -374,6 +403,9 @@ extern uint64 osl_systztime_us(void);
}), \
OSL_READ_REG(osh, r)) \
)
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#else /* !CONFIG_64BIT */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
@ -395,6 +427,26 @@ extern uint64 osl_systztime_us(void);
#ifdef CONFIG_64BIT
/* writeq is defined only for 64 bit platform */
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830)
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
({ \
exynos_pcie_l1_exit(0); \
switch (sizeof(*(r))) { \
case sizeof(uint8): writeb((uint8)(v), \
(volatile uint8*)(r)); break; \
case sizeof(uint16): writew((uint16)(v), \
(volatile uint16*)(r)); break; \
case sizeof(uint32): writel((uint32)(v), \
(volatile uint32*)(r)); break; \
case sizeof(uint64): writeq((uint64)(v), \
(volatile uint64*)(r)); break; \
} \
}), \
(OSL_WRITE_REG(osh, r, v))); \
} while (0)
#else
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
switch (sizeof(*(r))) { \
@ -405,7 +457,9 @@ extern uint64 osl_systztime_us(void);
}, \
(OSL_WRITE_REG(osh, r, v))); \
} while (0)
#endif /* CONFIG_SOC_EXYNOS9810 || CONFIG_SOC_EXYNOS9820 ||
* CONFIG_SOC_EXYNOS9830
*/
#else /* !CONFIG_64BIT */
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \

File diff suppressed because it is too large Load diff

View file

@ -147,6 +147,9 @@
#define WL_STA_DWDS_CAP 0x01000000 /* DWDS CAP */
#define WL_STA_DWDS 0x02000000 /* DWDS active */
#define WL_WDS_LINKUP WL_STA_WDS_LINKUP /* deprecated */
#define WL_STA_IS_2G 0x04000000 /* 2G channels supported */
#define WL_STA_IS_5G 0x08000000 /* 5G channels supported */
#define WL_STA_IS_6G 0x10000000 /* 6G channels supported */
/* STA HT cap fields */
#define WL_STA_CAP_LDPC_CODING 0x0001 /* Support for rx of LDPC coded pkts */
@ -220,6 +223,7 @@
/* Mask bit for LOW power scan, High accuracy scan, LOW span scan bit defines */
#define WL_SCANFLAGS_SCAN_MODE_MASK 0x7000u
#define WL_SCANFLAGS_SCAN_MODE_SHIFT 12u
/* Bitmask for scan_type */
/* Reserved flag precludes the use of 0xff for scan_type which is
@ -258,6 +262,9 @@
* enable LISTEN along with PASSIVE flag
*/
/* BIT MASK for SSID TYPE */
#define WL_SCAN_SSIDFLAGS_SHORT_SSID 0x01U /* Use as Regular SSID */
/* Value to decide scan type based on scqs */
#define WL_SC_RETRY_SCAN_MODE_NO_SCAN 0x0u /* Do not reschedule scan */
#define WL_SC_RETRY_SCAN_MODE_HIGH_ACC 0x1u /* Reschedule scan as HighAccuracy */
@ -770,7 +777,6 @@
#define WLC_GET_LAZYWDS 138
#define WLC_SET_LAZYWDS 139
#define WLC_GET_BANDLIST 140
#define WLC_GET_BAND 141
#define WLC_SET_BAND 142
#define WLC_SCB_DEAUTHENTICATE 143
@ -1074,6 +1080,8 @@
#define WLC_BAND_6G 4 /* 6 Ghz */
#define WLC_BAND_INVALID -1 /* Invalid band */
#define WL_BAND_MAX_CNT 3 /* max number of bands supported */
/* band range returned by band_range iovar */
#define WL_CHAN_FREQ_RANGE_2G 0
#define WL_CHAN_FREQ_RANGE_5GL 1
@ -1523,77 +1531,20 @@
/* maximum channels returned by the get valid channels iovar */
#define WL_NUMCHANNELS 64
/* Channels break down for 2G BAND
* 2G 20MHz = 14
*
* 2G 40MHz
* 9 * 2 = 18
*
* 2G tot = 14 + 18 = 32
*
* Channels Break down for 5G BAND
* 5G 20MHz
* 36-48 4
* 52-64 4
* 100-144 12
* 149-161 4
* 165 1
* 5G 20 subtot = 25
*
* 5G 40 12 * 2 = 24
* 5G 80 6 * 4 = 24
* 5G 160 2 * 8 = 16
*
* 5G total = 25 + 24+ 24+ 16 = 89
*
* TOTAL 2G and 5G
* 2G + 5G = (32 + 89) = 121
*
* Channels Break down for 6G BAND
* 20MHz = 59
* 40MHz 29 * 2 = 58
* 80MHz 14 * 4 = 56
* 160MHz 7 * 8 = 56
* 6G total = 59 + 58 + 56 + 56 = 229
*
* Toal WL_NUMCHANSPECS 2G/5G/6G
* total = 32 + 89 + 229 = 350
*
* IF 5g 80+80 is defined
* 80MHz cf pairs are:
* 42 106
* 42 122
* 42 138
* 42 155
* 58 106
* 58 122
* 58 138
* 58 155
* 106 138
* 106 155
* 122 155
* 138 155
*
*
* 12 pairs * 8 primary channels = 96
* TOTAL 2G + 5G + 5G (80 + 80)
* 32 + 89 + 96 = 217
*
*TOTAL 2G + 5G + 5G (80 + 80) +6G (excluding 80 + 80)
* 32 + 89 + 96 + 229 = 446
*
*/
/* This constant is obsolete, not part of ioctl/iovar interface and should never be used
* It is preserved only for compatibility with older branches that use it
*/
#ifdef WL_BAND6G
/* max number of chanspecs (used by the iovar to calc. buf space) */
#ifdef WL11AC_80P80
#define WL_NUMCHANSPECS 446
#else
#define WL_NUMCHANSPECS 350
#endif // endif
#else
/* max number of chanspecs (used by the iovar to calc. buf space) */
#ifdef WL11AC_80P80
#if defined(WL11AC_80P80)
#define WL_NUMCHANSPECS 206
#elif defined(WL_BW160MHZ)
#define WL_NUMCHANSPECS 140
#else
#define WL_NUMCHANSPECS 110
#endif // endif
@ -2197,14 +2148,6 @@
#define MAX_BSSID_BLACKLIST_NUM 32
#endif /* CUSTOM_BSSID_BLACKLIST_NUM */
#ifndef BESTN_MAX
#define BESTN_MAX 10
#endif // endif
#ifndef MSCAN_MAX
#define MSCAN_MAX 32
#endif // endif
/* TCP Checksum Offload error injection for testing */
#define TOE_ERRTEST_TX_CSUM 0x00000001
#define TOE_ERRTEST_RX_CSUM 0x00000002

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_android.c 855877 2019-12-18 03:16:29Z $
* $Id: wl_android.c 874925 2020-04-24 08:58:32Z $
*/
#include <linux/module.h>
@ -1542,17 +1542,19 @@ wl_android_set_band(struct net_device *dev, char *command)
#ifdef CUSTOMER_HW4_PRIVATE_CMD
#ifdef ROAM_API
#ifdef WBTEXT
static bool wl_android_check_wbtext_support(struct net_device *dev)
{
dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(dev);
return dhdp->wbtext_support;
}
#endif /* WBTEXT */
static bool
wl_android_check_wbtext_policy(struct net_device *dev)
{
dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(dev);
#ifdef WBTEXT
dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(dev);
if (dhdp->wbtext_policy == WL_BSSTRANS_POLICY_PRODUCT_WBTEXT) {
return TRUE;
}
@ -3424,6 +3426,12 @@ wl_cfg80211_get_sta_info(struct net_device *dev, char* command, int total_len)
iovar_buf, WLC_IOCTL_MAXLEN, NULL);
if (ret < 0) {
WL_ERR(("Get sta_info ERR %d\n", ret));
#ifdef CONFIG_BCM43436
if (ret == BCME_BADADDR) {
bytes_written = BCME_UNSUPPORTED;
WL_ERR(("ret code is changed as %d\n", bytes_written));
}
#endif /* CONFIG_BCM43436 */
#ifdef BIGDATA_SOFTAP
goto get_bigdata;
#else
@ -9858,23 +9866,35 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len)
* Usage examples:
* DRIVER COUNTRY US
* DRIVER COUNTRY US/7
* Wrong revinfo should be filtered:
* DRIVER COUNTRY US/-1
*/
char *country_code = command + strlen(CMD_COUNTRY) + 1;
char *rev_info_delim = country_code + 2; /* 2 bytes of country code */
int revinfo = -1;
#if defined(DHD_BLOB_EXISTENCE_CHECK)
dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(net);
if (dhdp->is_blob) {
revinfo = 0;
} else
#endif /* DHD_BLOB_EXISTENCE_CHECK */
if ((rev_info_delim) &&
(strnicmp(rev_info_delim, CMD_COUNTRY_DELIMITER,
strlen(CMD_COUNTRY_DELIMITER)) == 0) &&
(rev_info_delim + 1)) {
revinfo = bcm_atoi(rev_info_delim + 1);
} else {
revinfo = 0;
}
if (revinfo < 0) {
DHD_ERROR(("%s:failed due to wrong revinfo %d\n", __FUNCTION__, revinfo));
return BCME_BADARG;
}
#if defined(DHD_BLOB_EXISTENCE_CHECK)
if (dhdp->is_blob) {
revinfo = 0;
}
#endif /* DHD_BLOB_EXISTENCE_CHECK */
bytes_written = wl_cfg80211_set_country_code(net, country_code,
true, true, revinfo);
#ifdef CUSTOMER_HW4_PRIVATE_CMD

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_cfg80211.c 862085 2020-01-31 01:26:59Z $
* $Id: wl_cfg80211.c 874925 2020-04-24 08:58:32Z $
*/
/* */
#include <typedefs.h>
@ -359,6 +359,25 @@ static const char *wl_if_state_strs[WL_IF_STATE_MAX + 1] = {
#define PM_BLOCK 1
#define PM_ENABLE 0
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#define IS_REGDOM_SELF_MANAGED(wiphy) \
(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
#else
#define IS_REGDOM_SELF_MANAGED(wiphy) (false)
#endif /* KERNEL >= 4.0 */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) && defined(WL_SELF_MANAGED_REGDOM)
#define WL_UPDATE_CUSTOM_REGULATORY(wiphy) \
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
#define WL_UPDATE_CUSTOM_REGULATORY(wiphy) \
wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
#else /* kernel > 4.0 && WL_SELF_MANAGED_REGDOM */
/* Kernels < 3.14 */
#define WL_UPDATE_CUSTOM_REGULATORY(wiphy) \
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) */
/* GCMP crypto supported above kernel v4.0 */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 0, 0))
#define WL_GCMP
@ -3915,6 +3934,50 @@ wl_cfg80211_to_fw_iftype(wl_iftype_t iftype)
return ret;
}
#ifdef CUSTOMER_HW4
static bool
wl_legacy_chip_check(struct bcm_cfg80211 *cfg)
{
int ret = FALSE;
#if defined(BCMSDIO) || defined(BCMPCIE)
u32 chipid, chiprevid;
dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub);
chipid = dhd_bus_chip_id(dhdp);
chiprevid = dhd_bus_chiprev_id(dhdp);
WL_DBG(("chipid=0x%x, chiprevid=%x\n", chipid, chiprevid));
if (chipid == BCM4350_CHIP_ID || chipid == BCM4345_CHIP_ID) {
ret = TRUE;
} else {
ret = FALSE;
}
#endif /* BCMSDIO || BCMPCIE */
return ret;
}
static bool
wl_check_interface_create_v0(struct bcm_cfg80211 *cfg)
{
int ret = FALSE;
#if defined(BCMSDIO) || defined(BCMPCIE)
u32 chipid, chiprevid;
dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub);
chipid = dhd_bus_chip_id(dhdp);
chiprevid = dhd_bus_chiprev_id(dhdp);
WL_DBG(("chipid=0x%x, chiprevid=%x\n", chipid, chiprevid));
if (chipid == BCM4359_CHIP_ID &&
(chiprevid == 5 || chiprevid == 9)) {
ret = TRUE;
}
#endif /* BCMSDIO || BCMPCIE */
return ret;
}
#endif /* CUSTOMER_HW4 */
s32
wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
struct net_device *ndev, s32 bsscfg_idx,
@ -3929,6 +3992,10 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
bool use_iface_info_v2 = false;
u8 ioctl_buf[WLC_IOCTL_SMLEN];
s32 iftype;
#ifdef CUSTOMER_HW4
wl_interface_info_v0_t *info_v0;
bool use_iface_info_v0 = false;
#endif /* CUSTOMER_HW4 */
if (del) {
ret = wldev_iovar_setbuf(ndev, "interface_remove",
@ -3954,6 +4021,25 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
ifflags |= WL_INTERFACE_MAC_USE;
}
#ifdef CUSTOMER_HW4
/* BCM4359B0/C0 chips are using the iovar version 0 */
if (wl_check_interface_create_v0(cfg)) {
wl_interface_create_v0_t iface_v0;
WL_DBG(("interface_create version 0\n"));
bzero(&iface_v0, sizeof(iface_v0));
use_iface_info_v0 = true;
iface_v0.ver = WL_INTERFACE_CREATE_VER_0;
iface_v0.flags = ifflags;
if (addr) {
memcpy(&iface_v0.mac_addr.octet, addr, ETH_ALEN);
}
ret = wldev_iovar_getbuf(ndev, "interface_create",
&iface_v0, sizeof(wl_interface_create_v0_t),
ioctl_buf, sizeof(ioctl_buf), NULL);
} else
#endif /* CUSTOMER_HW4 */
{
/* Pass ver = 0 for fetching the interface_create iovar version */
ret = wldev_iovar_getbuf(ndev, "interface_create",
&iface, sizeof(struct wl_interface_create_v2),
@ -3976,7 +4062,8 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
ioctl_buf, sizeof(ioctl_buf), NULL);
} else {
/* On any other error, attempt with iovar version 2 */
WL_DBG(("interface_create version 2. get_ver:%d ifflags:0x%x\n", ret, ifflags));
WL_DBG(("interface_create version 2. get_ver:%d ifflags:0x%x\n",
ret, ifflags));
iface.ver = WL_INTERFACE_CREATE_VER_2;
iface.iftype = iftype;
iface.flags = ifflags;
@ -3987,6 +4074,7 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
&iface, sizeof(struct wl_interface_create_v2),
ioctl_buf, sizeof(ioctl_buf), NULL);
}
}
if (unlikely(ret)) {
WL_ERR(("Interface create failed!! ret %d\n", ret));
@ -3997,7 +4085,15 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
if (use_iface_info_v2 == true) {
info_v2 = (wl_interface_info_v2_t *)ioctl_buf;
ret = info_v2->bsscfgidx;
} else {
}
#ifdef CUSTOMER_HW4
else if (use_iface_info_v0 == true) {
/* Use v0 struct */
info_v0 = (wl_interface_info_v0_t *)ioctl_buf;
ret = info_v0->bsscfgidx;
}
#endif /* CUSTOMER_HW4 */
else {
/* Use v1 struct */
info = (struct wl_interface_info_v1 *)ioctl_buf;
ret = info->bsscfgidx;
@ -4007,6 +4103,28 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg,
return ret;
}
#if defined(CUSTOMER_HW4)
void
wl_bss_iovar_war(struct bcm_cfg80211 *cfg,
struct net_device *ndev, s32 *val)
{
if (wl_legacy_chip_check(cfg) || wl_check_interface_create_v0(cfg))
{
/* Few firmware branches have issues in bss iovar handling and
* that can't be changed since they are in production.
*/
if (*val == WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE) {
*val = WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE;
} else if (*val == WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE) {
*val = WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE;
} else {
/* Ignore for other bss enums */
return;
}
WL_ERR(("wl bss %d\n", *val));
}
}
#endif // endif
s32
wl_cfg80211_add_del_bss(struct bcm_cfg80211 *cfg,
struct net_device *ndev, s32 bsscfg_idx,
@ -4041,6 +4159,12 @@ wl_cfg80211_add_del_bss(struct bcm_cfg80211 *cfg,
return -EINVAL;
}
#if defined(CUSTOMER_HW4)
if (!del) {
wl_bss_iovar_war(cfg, ndev, &val);
}
#endif // endif
bss_setbuf.cfg = htod32(bsscfg_idx);
bss_setbuf.val = htod32(val);
@ -4240,6 +4364,11 @@ wl_cfg80211_post_ifcreate(struct net_device *ndev,
u8 mac_addr[ETH_ALEN];
u16 wl_iftype;
#ifdef WL_STATIC_IF
int need_legacy_war = 0;
dhd_pub_t *dhd = NULL;
#endif /* WL_STATIC_IF */
if (!ndev || !event) {
WL_ERR(("Wrong arg\n"));
return NULL;
@ -4251,6 +4380,21 @@ wl_cfg80211_post_ifcreate(struct net_device *ndev,
return NULL;
}
#ifdef WL_STATIC_IF
{
dhd = (dhd_pub_t *)(cfg->pub);
if (!DHD_OPMODE_SUPPORTED(dhd, DHD_FLAG_MFG_MODE) && name) {
need_legacy_war = ((wl_legacy_chip_check(cfg) ||
wl_check_interface_create_v0(cfg)) &&
!strnicmp(name, SOFT_AP_IF_NAME, strlen(SOFT_AP_IF_NAME)));
if (need_legacy_war) {
event->role = WLC_E_IF_ROLE_AP;
}
}
WL_DBG(("name: %s\n", name));
}
#endif /* WL_STATIC_IF */
WL_DBG(("Enter. role:%d ifidx:%d bssidx:%d\n",
event->role, event->ifidx, event->bssidx));
if (!event->ifidx || !event->bssidx) {
@ -4293,6 +4437,37 @@ wl_cfg80211_post_ifcreate(struct net_device *ndev,
return NULL;
}
wdev = new_ndev->ieee80211_ptr;
if (need_legacy_war) {
/* Check whether mac addr is in sync with fw. If not,
* apply it using cur_etheraddr.
*/
if (memcmp(addr, event->mac, ETH_ALEN) != 0) {
ret = wldev_iovar_setbuf_bsscfg(new_ndev, "cur_etheraddr",
addr, ETH_ALEN, cfg->ioctl_buf, WLC_IOCTL_MAXLEN,
event->bssidx, &cfg->ioctl_buf_sync);
if (unlikely(ret)) {
WL_ERR(("set cur_etheraddr Error (%d)\n", ret));
goto fail;
}
memcpy(new_ndev->dev_addr, addr, ETH_ALEN);
WL_ERR(("Applying updated mac address to firmware\n"));
}
if (!wl_get_drv_status(cfg, AP_CREATED, new_ndev)) {
s32 err;
WL_INFORM_MEM(("[%s] Bringup SoftAP on bssidx:%d \n",
new_ndev->name, event->bssidx));
if ((err = wl_cfg80211_add_del_bss(cfg, new_ndev,
event->bssidx, WL_IF_TYPE_AP, 0, NULL)) < 0) {
WL_ERR(("wl bss ap returned error:%d\n", err));
return NULL;
}
/* On success, mark AP creation in progress. */
wl_set_drv_status(cfg, AP_CREATING, new_ndev);
} else {
WL_INFORM_MEM(("AP_CREATED bit set. Skip role change\n"));
}
}
} else
#endif /* WL_STATIC_IF */
{
@ -4616,6 +4791,18 @@ wl_cfg80211_create_iface(struct wiphy *wiphy,
/*
* Intialize the firmware I/F.
*/
#if defined(CONFIG_BCM43456) || defined(CONFIG_BCM4343)
/* De-initialize the p2p discovery interface, if operational */
wl_cfg80211_deinit_p2p_discovery(cfg);
#endif /* CONFIG_BCM43456 || CONFIG_BCM4343 */
#if defined(CUSTOMER_HW4)
if (wl_legacy_chip_check(cfg))
{
/* Use bss iovar instead of interface_create iovar */
ret = BCME_UNSUPPORTED;
} else
#endif // endif
{
ret = wl_cfg80211_interface_ops(cfg, primary_ndev, bsscfg_idx,
wl_iftype, 0, addr);
@ -5502,6 +5689,19 @@ wl_cfg80211_set_mfp(struct bcm_cfg80211 *cfg,
*/
if (err != BCME_UNSUPPORTED && err < 0) {
WL_ERR(("bip set error (%d)\n", err));
#if defined(CUSTOMER_HW4)
if (wl_legacy_chip_check(cfg))
{
/* Ignore bip error: Some older firmwares doesn't
* support bip iovar/ return BCME_NOTUP while trying
* to set bip from connect context. These firmares
* include bip in RSNIE by default. So its okay to
* ignore the error.
*/
err = BCME_OK;
goto exit;
} else
#endif // endif
{
goto exit;
}
@ -6095,12 +6295,9 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
dhd_reset_tcpsync_info_by_dev(dev);
#endif /* DHDTCPSYNC_FLOOD_BLK */
#if defined(SUPPORT_RANDOM_MAC_SCAN) && !defined(WL_USE_RANDOMIZED_SCAN)
/* Disable scanmac if enabled */
if (cfg->scanmac_enabled) {
wl_cfg80211_scan_mac_disable(dev);
}
#endif /* SUPPORT_RANDOM_MAC_SCAN && !WL_USE_RANDOMIZED_SCAN */
#if defined(SUPPORT_RANDOM_MAC_SCAN)
wl_cfg80211_random_mac_disable(dev);
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
#ifdef WL_SKIP_CONNECT_HINTS
@ -9271,6 +9468,11 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev,
WL_ERR(("bad length:%zu\n", len));
return BCME_BADLEN;
}
if (channel == NULL) {
WL_ERR(("channel is NULL\n"));
return -EINVAL;
}
#ifdef DHD_IFDEBUG
PRINT_WDEV_INFO(cfgdev);
#endif /* DHD_IFDEBUG */
@ -10632,11 +10834,13 @@ wl_cfg80211_set_ap_role(
WL_INFORM_MEM(("[%s] Bringup SoftAP on bssidx:%d \n", dev->name, bssidx));
#if !defined(CONFIG_BCM43456) && !defined(CONFIG_BCM4343)
if ((err = wl_cfg80211_add_del_bss(cfg, dev, bssidx,
WL_IF_TYPE_AP, 0, NULL)) < 0) {
WL_ERR(("wl add_del_bss returned error:%d\n", err));
return err;
}
#endif /* !CONFIG_BCM43456 && !CONFIG_BCM4343 */
/*
* For older chips, "bss" iovar does not support
@ -10659,8 +10863,11 @@ wl_cfg80211_set_ap_role(
return err;
}
if (apsta == 0) {
s32 apsta_off = 0;
/* If apsta is not set, set it */
#if !defined(CONFIG_BCM43456) && !defined(CONFIG_BCM4343)
apsta_off = 1;
#endif /* !CONFIG_BCM43456 && !CONFIG_BCM4343 */
/* Check for any connected interfaces before wl down */
if (wl_get_drv_status_all(cfg, CONNECTED) > 0) {
WL_ERR(("Concurrent i/f operational. can't do wl down"));
@ -10671,7 +10878,7 @@ wl_cfg80211_set_ap_role(
WL_ERR(("WLC_DOWN error %d\n", err));
return err;
}
err = wldev_iovar_setint(dev, "apsta", 1);
err = wldev_iovar_setint(dev, "apsta", apsta_off);
if (err < 0) {
WL_ERR(("wl apsta 0 error %d\n", err));
return err;
@ -10828,6 +11035,18 @@ wl_cfg80211_bcn_bringup_ap(
WLC_IOCTL_SMLEN, bssidx, &cfg->ioctl_buf_sync);
if (err < 0) {
WL_ERR(("bip set error %d\n", err));
#if defined(CUSTOMER_HW4)
if (wl_legacy_chip_check(cfg))
{
/* Ignore bip error: Some older firmwares doesn't
* support bip iovar/ return BCME_NOTUP while trying
* to set bip from AP bring up context. These firmares
* include bip in RSNIE by default. So its okay to ignore
* the error.
*/
err = BCME_OK;
} else
#endif // endif
{
goto exit;
}
@ -11537,6 +11756,10 @@ wl_cfg80211_start_ap(
WL_DBG(("Enter \n"));
#if defined(DHD_RANDOM_MAC_SCAN)
wl_cfg80211_dhd_driven_random_mac_disable(dev);
#endif /* DHD_RANDOM_MAC_SCAN */
if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) {
WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr));
return BCME_ERROR;
@ -12458,30 +12681,116 @@ s32 wl_mode_to_nl80211_iftype(s32 mode)
return err;
}
s32
wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
bool notify, bool user_enforced, int revinfo)
static bool
wl_is_ccode_change_required(struct net_device *net,
char *country_code, int revinfo)
{
s32 ret = BCME_OK;
wl_country_t cspec = {{0}, 0, {0}};
wl_country_t cur_cspec = {{0}, 0, {0}};
ret = wldev_iovar_getbuf(net, "country", NULL, 0, &cur_cspec,
sizeof(cur_cspec), NULL);
if (ret < 0) {
WL_ERR(("get country code failed = %d\n", ret));
return true;
}
/* If translation table is available, update cspec */
cspec.rev = revinfo;
strlcpy(cspec.country_abbrev, country_code, WL_CCODE_LEN + 1);
strlcpy(cspec.ccode, country_code, WL_CCODE_LEN + 1);
dhd_get_customized_country_code(net, cspec.country_abbrev, &cspec);
if ((cur_cspec.rev == cspec.rev) &&
(strncmp(cur_cspec.ccode, cspec.ccode, WL_CCODE_LEN) == 0) &&
(strncmp(cur_cspec.country_abbrev, cspec.country_abbrev, WL_CCODE_LEN) == 0)) {
WL_INFORM_MEM(("country code = %s/%d is already configured\n",
country_code, revinfo));
return false;
}
return true;
}
void
wl_cfg80211_cleanup_connection(struct net_device *net, bool user_enforced)
{
s32 ret = BCME_OK;
#ifdef WL_NAN
struct wireless_dev *wdev = ndev_to_wdev(net);
struct wiphy *wiphy = wdev->wiphy;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
struct net_info *iter, *next;
scb_val_t scbval;
GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST();
for_each_ndev(cfg, iter, next) {
GCC_DIAGNOSTIC_POP();
if (iter->ndev) {
if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
memset(scbval.ea.octet, 0xff, ETHER_ADDR_LEN);
scbval.val = DOT11_RC_DEAUTH_LEAVING;
if ((ret = wldev_ioctl_set(iter->ndev,
WLC_SCB_DEAUTHENTICATE_FOR_REASON,
&scbval, sizeof(scb_val_t))) != 0) {
WL_ERR(("Failed to disconnect STAs %d\n", ret));
}
} else if (wl_get_drv_status(cfg, CONNECTED, iter->ndev)) {
if ((iter->ndev == net) && !user_enforced)
continue;
wl_cfg80211_disassoc(iter->ndev, WLAN_REASON_DEAUTH_LEAVING);
} else {
WL_INFORM(("Disconnected state. Interface clean "
"up skipped for ifname:%s", iter->ndev->name));
}
}
}
wl_cfg80211_scan_abort(cfg);
/* Clean up NAN connection */
#ifdef WL_NAN
if (cfg->nan_enable) {
mutex_lock(&cfg->if_sync);
ret = wl_cfgnan_check_nan_disable_pending(cfg, true, true);
mutex_unlock(&cfg->if_sync);
if (ret != BCME_OK) {
WL_ERR(("failed to disable nan, error[%d]\n", ret));
return ret;
}
}
#endif /* WL_NAN */
}
s32
wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
bool notify, bool user_enforced, int revinfo)
{
s32 ret = BCME_OK;
struct wireless_dev *wdev = ndev_to_wdev(net);
struct wiphy *wiphy = wdev->wiphy;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
BCM_REFERENCE(cfg);
if (revinfo < 0) {
WL_ERR(("country revinfo wrong : %d\n", revinfo));
ret = BCME_BADARG;
goto exit;
}
if ((wl_is_ccode_change_required(net, country_code, revinfo) == false) &&
!dhd_force_country_change(net)) {
goto exit;
}
wl_cfg80211_cleanup_connection(net, user_enforced);
ret = wldev_set_country(net, country_code,
notify, user_enforced, revinfo);
notify, revinfo);
if (ret < 0) {
WL_ERR(("set country Failed :%d\n", ret));
goto exit;
}
exit:
return ret;
}
@ -12511,6 +12820,33 @@ int wl_features_set(u8 *array, uint8 len, u32 ftidx)
return BCME_OK;
}
static
void wl_config_custom_regulatory(struct wiphy *wiphy)
{
#if defined(WL_SELF_MANAGED_REGDOM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
/* Use self managed regulatory domain */
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED |
REGULATORY_IGNORE_STALE_KICKOFF;
wiphy->regd = &brcm_regdom;
WL_DBG(("Self managed regdom\n"));
return;
#else /* WL_SELF_MANAGED_REGDOM && KERNEL >= 4.0 */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
wiphy->regulatory_flags |=
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
REGULATORY_IGNORE_STALE_KICKOFF |
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
REGULATORY_CUSTOM_REG;
#else /* KERNEL VER >= 3.14 */
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) */
wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
WL_DBG(("apply custom regulatory\n"));
#endif /* WL_SELF_MANAGED_REGDOM && KERNEL >= 4.0 */
}
static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev, void *context)
{
s32 err = 0;
@ -12680,16 +13016,7 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
#endif /* CONFIG_PM && WL_CFG80211_P2P_DEV_IF */
WL_DBG(("Registering custom regulatory)\n"));
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
wdev->wiphy->regulatory_flags |=
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
REGULATORY_IGNORE_STALE_KICKOFF |
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
REGULATORY_CUSTOM_REG;
#else
wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) */
wiphy_apply_custom_regulatory(wdev->wiphy, &brcm_regdom);
wl_config_custom_regulatory(wdev->wiphy);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)) || defined(WL_VENDOR_EXT_SUPPORT)
WL_INFORM_MEM(("Registering Vendor80211\n"));
@ -14418,6 +14745,13 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
/* Initial Association */
wl_update_prof(cfg, ndev, e, &act, WL_PROF_ACT);
wl_bss_connect_done(cfg, ndev, e, data, true);
#ifdef WL_NAN
if (cfg->nan_enable &&
(event == WLC_E_SET_SSID) &&
(ntoh32(e->status) == WLC_E_STATUS_SUCCESS)) {
wl_cfgnan_get_stats(cfg);
}
#endif /* WL_NAN */
if (ndev == bcmcfg_to_prmry_ndev(cfg)) {
vndr_oui_num = wl_vndr_ies_get_vendor_oui(cfg,
ndev, vndr_oui, ARRAY_SIZE(vndr_oui));
@ -14712,7 +15046,11 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
"from " MACDBG "\n",
ndev->name, event, ntoh32(e->reason), reason, ie_len,
MAC2STRDBG((const u8*)(&e->addr))));
#ifdef WL_NAN
if (cfg->nan_enable) {
wl_cfgnan_get_stats(cfg);
}
#endif /* WL_NAN */
/* Wait for status to be cleared to prevent race condition
* issues with connect context
*/
@ -15516,7 +15854,7 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
#endif /* LINUX_VERSION > 2.6.39 || WL_COMPAT_WIRELESS */
#if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || defined(WL_FILS_ROAM_OFFLD) || \
defined(CFG80211_ROAM_API_GE_4_12)
defined(CFG80211_ROAM_API_GE_4_12) || defined(CONFIG_SEC_LYKANLTE_PROJECT)
struct cfg80211_roam_info roam_info;
#endif /* (CONFIG_ARCH_MSM && CFG80211_ROAMED_API_UNIFIED) || LINUX_VERSION >= 4.12.0 */
#if defined(WL_FILS_ROAM_OFFLD)
@ -15619,7 +15957,7 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
#if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || defined(WL_FILS_ROAM_OFFLD) || \
defined(CFG80211_ROAM_API_GE_4_12)
defined(CFG80211_ROAM_API_GE_4_12) || defined(CONFIG_SEC_LYKANLTE_PROJECT)
memset(&roam_info, 0, sizeof(struct cfg80211_roam_info));
roam_info.channel = notify_channel;
roam_info.bssid = curbssid;
@ -17262,14 +17600,15 @@ static void wl_cfg80211_determine_vsdb_mode(struct bcm_cfg80211 *cfg)
}
int
wl_cfg80211_determine_p2p_rsdb_mode(struct bcm_cfg80211 *cfg)
wl_cfg80211_determine_p2p_rsdb_scc_mode(struct bcm_cfg80211 *cfg)
{
struct net_info *iter, *next;
u32 chanspec = 0;
u32 pre_chanspec = 0;
u32 band = 0;
u32 pre_band = 0;
u32 pre_band = INVCHANSPEC;
bool is_rsdb_supported = FALSE;
bool rsdb_mode = FALSE;
bool rsdb_or_scc_mode = FALSE;
is_rsdb_supported = DHD_OPMODE_SUPPORTED(cfg->pub, DHD_FLAG_RSDB_MODE);
@ -17291,17 +17630,24 @@ wl_cfg80211_determine_p2p_rsdb_mode(struct bcm_cfg80211 *cfg)
band = CHSPEC_BAND(chanspec);
}
if (!pre_band && band) {
if (pre_band == INVCHANSPEC && chanspec) {
pre_band = band;
} else if (pre_band && (pre_band != band)) {
rsdb_mode = TRUE;
pre_chanspec = chanspec;
} else {
if ((pre_band == band) && (pre_chanspec != chanspec)) {
/* VSDB case */
rsdb_or_scc_mode = FALSE;
} else {
/* RSDB/SCC case */
rsdb_or_scc_mode = TRUE;
}
}
}
}
WL_DBG(("RSDB mode is %s\n", rsdb_mode ? "enabled" : "disabled"));
}
WL_DBG(("RSDB or SCC mode is %s\n", rsdb_or_scc_mode ? "enabled" : "disabled"));
return rsdb_mode;
return rsdb_or_scc_mode;
}
static s32 wl_notifier_change_state(struct bcm_cfg80211 *cfg, struct net_info *_net_info,
@ -17316,6 +17662,9 @@ static s32 wl_notifier_change_state(struct bcm_cfg80211 *cfg, struct net_info *_
#ifdef RTT_SUPPORT
rtt_status_info_t *rtt_status;
#endif /* RTT_SUPPORT */
#ifdef DISABLE_FRAMEBURST_VSDB
bool rsdb_scc_flag = FALSE;
#endif /* DISABLE_FRAMEBURST_VSDB */
if (dhd->busstate == DHD_BUS_DOWN) {
WL_ERR(("busstate is DHD_BUS_DOWN!\n"));
return 0;
@ -17354,9 +17703,9 @@ static s32 wl_notifier_change_state(struct bcm_cfg80211 *cfg, struct net_info *_
#ifdef DISABLE_FRAMEBURST_VSDB
if (!DHD_OPMODE_SUPPORTED(cfg->pub, DHD_FLAG_HOSTAP_MODE) &&
wl_cfg80211_is_concurrent_mode(primary_dev) &&
!wl_cfg80211_determine_p2p_rsdb_mode(cfg)) {
wl_cfg80211_set_frameburst(cfg, FALSE);
wl_cfg80211_is_concurrent_mode(primary_dev)) {
rsdb_scc_flag = wl_cfg80211_determine_p2p_rsdb_scc_mode(cfg);
wl_cfg80211_set_frameburst(cfg, rsdb_scc_flag);
}
#endif /* DISABLE_FRAMEBURST_VSDB */
#ifdef DISABLE_WL_FRAMEBURST_SOFTAP
@ -17729,9 +18078,9 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *context)
if (!cfg->btcoex_info)
goto cfg80211_attach_out;
#endif // endif
#if defined(SUPPORT_RANDOM_MAC_SCAN)
cfg->random_mac_enabled = FALSE;
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#if defined(DHD_RANDOM_MAC_SCAN)
cfg->random_mac_running = FALSE;
#endif /* DHD_RANDOM_MAC_SCAN */
#if defined(WL_ENABLE_P2P_IF) || defined(WL_NEWCFG_PRIVCMD_SUPPORT)
err = wl_cfg80211_attach_p2p(cfg);
@ -18645,8 +18994,12 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify)
wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
}
if (notify)
if (notify) {
if (!IS_REGDOM_SELF_MANAGED(wiphy)) {
WL_UPDATE_CUSTOM_REGULATORY(wiphy);
wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
}
}
return 0;
}
@ -18861,12 +19214,6 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
#endif /* PROP_TXSTATUS_VSDB */
}
#ifdef WL_NAN
mutex_lock(&cfg->if_sync);
wl_cfgnan_check_nan_disable_pending(cfg, true, false);
mutex_unlock(&cfg->if_sync);
#endif /* WL_NAN */
if (!dhd_download_fw_on_driverload) {
/* For built-in drivers/other drivers that do reset on
* "ifconfig <primary_iface> down", cleanup any left
@ -19169,6 +19516,12 @@ s32 wl_cfg80211_down(struct net_device *dev)
WL_DBG(("In\n"));
if (cfg) {
#ifdef WL_NAN
mutex_lock(&cfg->if_sync);
wl_cfgnan_check_nan_disable_pending(cfg, true, false);
mutex_unlock(&cfg->if_sync);
#endif /* WL_NAN */
mutex_lock(&cfg->usr_sync);
err = __wl_cfg80211_down(cfg);
mutex_unlock(&cfg->usr_sync);

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_cfg80211.h 854461 2019-12-09 02:16:27Z $
* $Id: wl_cfg80211.h 874925 2020-04-24 08:58:32Z $
*/
/**
@ -91,6 +91,11 @@ struct wl_ibss;
#define WL_FILS_ROAM_OFFLD
#endif // endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
/* Use driver managed regd */
#define WL_SELF_MANAGED_REGDOM
#endif /* KERNEL >= 4.0 */
#ifdef WL_SAE
#define IS_AKM_SAE(akm) (akm == WLAN_AKM_SUITE_SAE)
#else
@ -1030,6 +1035,8 @@ typedef struct wl_btm_event_type_data wl_btm_event_type_data_t;
typedef struct wl_bssid_prune_evt_info wl_bssid_pruned_evt_info_t;
#endif /* WL_MBO || WL_OCE */
#define WL_CCODE_LEN 2
#ifdef WL_NAN
#define NAN_MAX_NDI 1u
typedef struct wl_ndi_data
@ -1147,6 +1154,16 @@ typedef struct buf_data {
const void *data_buf[1]; /* array of user space buffer pointers. */
} buf_data_t;
#ifdef CONFIG_COMPAT
typedef struct compat_buf_data {
u32 ver; /* version of struct */
u32 len; /* Total len */
/* size of each buffer in case of split buffers (0 - single buffer). */
u32 buf_threshold;
u32 data_buf; /* array of user space buffer pointers. */
} compat_buf_data_t;
#endif /* CONFIG_COMPAT */
/* private data of cfg80211 interface */
struct bcm_cfg80211 {
struct wireless_dev *wdev; /* representing cfg cfg80211 device */
@ -1327,9 +1344,9 @@ struct bcm_cfg80211 {
u32 roam_count;
#endif /* DHD_ENABLE_BIGDATA_LOGGING */
u16 ap_oper_channel;
#if defined(SUPPORT_RANDOM_MAC_SCAN)
bool random_mac_enabled;
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#if defined(DHD_RANDOM_MAC_SCAN)
bool random_mac_running;
#endif /* DHD_RANDOM_MAC_SCAN */
#ifdef DHD_LOSSLESS_ROAMING
timer_list_compat_t roam_timeout; /* Timer for catch roam timeout */
#endif // endif
@ -2447,7 +2464,7 @@ extern int wl_cfg80211_ifstats_counters(struct net_device *dev, wl_if_stats_t *i
extern s32 wl_cfg80211_set_dbg_verbose(struct net_device *ndev, u32 level);
extern int wl_cfg80211_deinit_p2p_discovery(struct bcm_cfg80211 * cfg);
extern int wl_cfg80211_set_frameburst(struct bcm_cfg80211 *cfg, bool enable);
extern int wl_cfg80211_determine_p2p_rsdb_mode(struct bcm_cfg80211 *cfg);
extern int wl_cfg80211_determine_p2p_rsdb_scc_mode(struct bcm_cfg80211 *cfg);
extern uint8 wl_cfg80211_get_bus_state(struct bcm_cfg80211 *cfg);
#ifdef WL_WPS_SYNC
void wl_handle_wps_states(struct net_device *ndev, u8 *dump_data, u16 len, bool direction);
@ -2501,5 +2518,6 @@ do { \
} \
} while (0)
extern s32 wl_cfg80211_handle_macaddr_change(struct net_device *dev, u8 *macaddr);
extern bool dhd_force_country_change(struct net_device *dev);
extern void wl_cfg80211_concurrent_roam(struct bcm_cfg80211 *cfg, int enable);
#endif /* _wl_cfg80211_h_ */

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_cfgnan.c 863148 2020-02-06 10:48:09Z $
* $Id: wl_cfgnan.c 873848 2020-04-17 09:33:49Z $
*/
#ifdef WL_NAN
@ -2630,8 +2630,7 @@ wl_cfgnan_start_handler(struct net_device *ndev, struct bcm_cfg80211 *cfg,
goto fail;
}
}
/* Setting warm up time */
cmd_data->warmup_time = 1;
if (cmd_data->warmup_time) {
ret = wl_cfgnan_warmup_time_handler(cmd_data, nan_iov_data);
if (unlikely(ret)) {
@ -7083,6 +7082,7 @@ wl_nan_dp_cmn_event_data(struct bcm_cfg80211 *cfg, void *event_data,
wl_cfgnan_data_set_peer_dp_state(cfg, &ev_dp->peer_nmi,
NAN_PEER_DP_CONNECTED);
wl_cfgnan_update_dp_info(cfg, true, nan_event_data->ndp_id);
wl_cfgnan_get_stats(cfg);
} else if (ev_dp->status == NAN_NDP_STATUS_REJECT) {
nan_event_data->status = NAN_DP_REQUEST_REJECT;
/* Remove peer from data ndp peer list */
@ -8635,4 +8635,138 @@ fail:
NAN_DBG_EXIT();
return ret;
}
s32
wl_nan_print_avail_stats(const uint8 *data)
{
int idx;
s32 ret = BCME_OK;
int s_chan = 0;
char pbuf[NAN_IOCTL_BUF_SIZE_MED];
const wl_nan_stats_sched_t *sched = (const wl_nan_stats_sched_t *)data;
#define SLOT_PRINT_SIZE 4
char *buf = pbuf;
bzero(pbuf, sizeof(pbuf));
if ((sched->num_slot * SLOT_PRINT_SIZE) > (sizeof(pbuf)-1)) {
WL_ERR(("overflowed slot number %d detected\n",
sched->num_slot));
ret = BCME_BUFTOOSHORT;
goto exit;
}
buf += sprintf(buf, "Map ID:%u, %u/%u, Slot#:%u ",
sched->map_id, sched->period,
sched->slot_dur, sched->num_slot);
for (idx = 0; idx < sched->num_slot; idx++) {
const wl_nan_stats_sched_slot_t *slot;
slot = &sched->slot[idx];
s_chan = 0;
if (!wf_chspec_malformed(slot->chanspec)) {
s_chan = wf_chspec_ctlchan(slot->chanspec);
}
buf += sprintf(buf, "%03d|", s_chan);
}
WL_INFORM_MEM(("%s\n", pbuf));
exit:
return ret;
}
static int
wl_nan_print_stats_tlvs(void *ctx, const uint8 *data, uint16 type, uint16 len)
{
int err = BCME_OK;
switch (type) {
/* Avail stats xtlvs */
case WL_NAN_XTLV_GEN_AVAIL_STATS_SCHED:
err = wl_nan_print_avail_stats(data);
break;
default:
err = BCME_BADARG;
WL_ERR(("Unknown xtlv type received: %x\n", type));
break;
}
return err;
}
int
wl_cfgnan_get_stats(struct bcm_cfg80211 *cfg)
{
bcm_iov_batch_buf_t *nan_buf = NULL;
uint16 subcmd_len;
bcm_iov_batch_subcmd_t *sub_cmd = NULL;
bcm_iov_batch_subcmd_t *sub_cmd_resp = NULL;
uint8 resp_buf[NAN_IOCTL_BUF_SIZE_LARGE];
wl_nan_cmn_get_stat_t *get_stat = NULL;
wl_nan_cmn_stat_t *stats = NULL;
uint32 status;
s32 ret = BCME_OK;
uint16 nan_buf_size = NAN_IOCTL_BUF_SIZE;
NAN_DBG_ENTER();
nan_buf = MALLOCZ(cfg->osh, NAN_IOCTL_BUF_SIZE);
if (!nan_buf) {
WL_ERR(("%s: memory allocation failed\n", __func__));
ret = BCME_NOMEM;
goto fail;
}
nan_buf->version = htol16(WL_NAN_IOV_BATCH_VERSION);
nan_buf->count = 0;
nan_buf_size -= OFFSETOF(bcm_iov_batch_buf_t, cmds[0]);
sub_cmd = (bcm_iov_batch_subcmd_t*)(uint8 *)(&nan_buf->cmds[0]);
ret = wl_cfg_nan_check_cmd_len(nan_buf_size,
sizeof(*get_stat), &subcmd_len);
if (unlikely(ret)) {
WL_ERR(("nan_sub_cmd check failed\n"));
goto fail;
}
get_stat = (wl_nan_cmn_get_stat_t *)sub_cmd->data;
/* get only local availabiity stats */
get_stat->modules_btmap = (1 << NAN_AVAIL);
get_stat->operation = WLA_NAN_STATS_GET;
sub_cmd->id = htod16(WL_NAN_CMD_GEN_STATS);
sub_cmd->len = sizeof(sub_cmd->u.options) + sizeof(*get_stat);
sub_cmd->u.options = htol32(BCM_XTLV_OPTION_ALIGN32);
nan_buf_size -= subcmd_len;
nan_buf->count = 1;
nan_buf->is_set = false;
bzero(resp_buf, sizeof(resp_buf));
ret = wl_cfgnan_execute_ioctl(bcmcfg_to_prmry_ndev(cfg),
cfg, nan_buf, nan_buf_size, &status,
(void*)resp_buf, NAN_IOCTL_BUF_SIZE_LARGE);
if (unlikely(ret) || unlikely(status)) {
WL_ERR(("get nan stats failed ret %d status %d \n",
ret, status));
goto fail;
}
sub_cmd_resp = &((bcm_iov_batch_buf_t *)(resp_buf))->cmds[0];
stats = (wl_nan_cmn_stat_t *)&sub_cmd_resp->data[0];
if (stats->n_stats) {
WL_ERR((" == Aware Local Avail Schedule ==\n"));
ret = bcm_unpack_xtlv_buf((void *)&stats->n_stats,
(const uint8 *)&stats->stats_tlvs,
stats->totlen - 8, BCM_IOV_CMD_OPT_ALIGN32,
wl_nan_print_stats_tlvs);
}
fail:
if (nan_buf) {
MFREE(cfg->osh, nan_buf, NAN_IOCTL_BUF_SIZE);
}
NAN_DBG_EXIT();
return ret;
}
#endif /* WL_NAN */

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_cfgnan.h 863133 2020-02-06 10:16:12Z $
* $Id: wl_cfgnan.h 873848 2020-04-17 09:33:49Z $
*/
#ifndef _wl_cfgnan_h_
@ -781,6 +781,7 @@ bool wl_cfgnan_ranging_allowed(struct bcm_cfg80211 *cfg);
uint8 wl_cfgnan_cancel_rng_responders(struct net_device *ndev,
struct bcm_cfg80211 *cfg);
extern int wl_cfgnan_get_status(struct net_device *ndev, wl_nan_conf_status_t *nan_status);
extern int wl_cfgnan_get_stats(struct bcm_cfg80211 *cfg);
extern void wl_cfgnan_update_dp_info(struct bcm_cfg80211 *cfg, bool add,
nan_data_path_id ndp_id);
nan_status_type_t wl_cfgvendor_brcm_to_nanhal_status(int32 vendor_status);

View file

@ -771,8 +771,7 @@ exit:
return err;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && \
defined(SUPPORT_RANDOM_MAC_SCAN)
#if defined(SUPPORT_RANDOM_MAC_SCAN)
static const u8 *
wl_retrieve_wps_attribute(const u8 *buf, u16 element_id)
{
@ -823,7 +822,7 @@ wl_is_wps_enrollee_active(struct net_device *ndev, const u8 *ie_ptr, u16 len)
return false;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && defined(SUPPORT_RANDOM_MAC_SCAN) */
#endif /* SUPPORT_RANDOM_MAC_SCAN */
/* Find listen channel */
static s32 wl_find_listen_channel(struct bcm_cfg80211 *cfg,
@ -1186,15 +1185,22 @@ wl_run_escan(struct bcm_cfg80211 *cfg, struct net_device *ndev,
} else {
params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_escan_params_t, params));
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && \
defined(SUPPORT_RANDOM_MAC_SCAN)
#if defined(SUPPORT_RANDOM_MAC_SCAN)
if (request) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
bool randmac_enable = (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR);
#else /* old kernel version */
bool randmac_enable = TRUE;
#endif // endif
if (wl_is_wps_enrollee_active(ndev, request->ie, request->ie_len)) {
randmac_enable = false;
}
err = wl_rand_mac_ctrl(ndev, cfg, randmac_enable);
if (randmac_enable) {
err = wl_cfg80211_random_mac_enable(ndev, cfg, randmac_enable);
} else {
err = wl_cfg80211_random_mac_disable(ndev);
}
if (err < 0) {
if (err == BCME_UNSUPPORTED) {
@ -1209,7 +1215,7 @@ wl_run_escan(struct bcm_cfg80211 *cfg, struct net_device *ndev,
}
}
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && defined(SUPPORT_RANDOM_MAC_SCAN) */
#endif /* SUPPORT_RANDOM_MAC_SCAN */
if (!cfg->p2p_supported || !p2p_scan(cfg)) {
/* LEGACY SCAN TRIGGER */
@ -1844,6 +1850,9 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
if (cfg->p2p_supported) {
if (request && p2p_on(cfg) && p2p_scan(cfg)) {
#if defined(DHD_RANDOM_MAC_SCAN)
wl_cfg80211_dhd_driven_random_mac_disable(ndev);
#endif /* DHD_RANDOM_MAC_SCAN */
/* find my listen channel */
cfg->afx_hdl->my_listen_chan =
@ -2078,13 +2087,9 @@ s32 wl_notify_escan_complete(struct bcm_cfg80211 *cfg,
err = BCME_ERROR;
goto out;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && \
defined(SUPPORT_RANDOM_MAC_SCAN) && !defined(WL_USE_RANDOMIZED_SCAN)
/* Disable scanmac if enabled */
if (cfg->scanmac_enabled) {
wl_cfg80211_scan_mac_disable(ndev);
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && defined(SUPPORT_RANDOM_MAC_SCAN) */
#if defined(SUPPORT_RANDOM_MAC_SCAN)
wl_cfg80211_random_mac_disable(ndev);
#endif /* SUPPORT_RANDOM_MAC_SCAN */
if (cfg->scan_request) {
dev = bcmcfg_to_prmry_ndev(cfg);
@ -2482,201 +2487,85 @@ void wl_notify_scan_done(struct bcm_cfg80211 *cfg, bool aborted)
int
wl_cfg80211_set_random_mac(struct net_device *dev, bool enable)
{
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
int ret;
if (cfg->random_mac_enabled == enable) {
WL_ERR(("Random MAC already %s\n", enable ? "Enabled" : "Disabled"));
return BCME_OK;
}
if (enable) {
ret = wl_cfg80211_random_mac_enable(dev);
} else {
ret = wl_cfg80211_random_mac_disable(dev);
}
if (!ret) {
cfg->random_mac_enabled = enable;
}
return ret;
}
#if defined(DHD_RANDOM_MAC_SCAN)
#define RANDOM_MAC_ADDR_MUTICAST_BIT 0x01
#define RANDOM_MAC_ADDR_LOCALLY_ADMIN_BIT 0x02
int
wl_cfg80211_random_mac_enable(struct net_device *dev)
wl_cfg80211_dhd_driven_random_mac_enable(struct net_device *dev)
{
u8 random_mac[ETH_ALEN] = {0, };
u8 rand_bytes[3] = {0, };
u8 random_mac_addr[ETHER_ADDR_LEN] = {0, };
s32 err = BCME_ERROR;
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
#if !defined(LEGACY_RANDOM_MAC)
uint8 buffer[WLC_IOCTL_SMLEN] = {0, };
wl_scanmac_t *sm = NULL;
int len = 0;
wl_scanmac_enable_t *sm_enable = NULL;
wl_scanmac_config_t *sm_config = NULL;
#endif /* !LEGACY_RANDOM_MAC */
if (wl_get_drv_status_all(cfg, CONNECTED) || wl_get_drv_status_all(cfg, CONNECTING) ||
wl_get_drv_status_all(cfg, AP_CREATED) || wl_get_drv_status_all(cfg, AP_CREATING)) {
WL_ERR(("fail to Set random mac, current state is wrong\n"));
WL_ERR(("Skip to set random mac by current status\n"));
return err;
}
(void)memcpy_s(random_mac, ETH_ALEN, bcmcfg_to_prmry_ndev(cfg)->dev_addr, ETH_ALEN);
get_random_bytes(&rand_bytes, sizeof(rand_bytes));
/* Generate 6 bytes random address */
get_random_bytes(&random_mac_addr, sizeof(random_mac_addr));
if (rand_bytes[2] == 0x0 || rand_bytes[2] == 0xff) {
rand_bytes[2] = 0xf0;
/* Clear Multicast bit */
random_mac_addr[0] &= ~RANDOM_MAC_ADDR_MUTICAST_BIT;
/* Set locally administered address bit */
random_mac_addr[0] |= RANDOM_MAC_ADDR_LOCALLY_ADMIN_BIT;
/* Modify last mac address if 0x00 or 0xff */
if (random_mac_addr[5] == 0x0 || random_mac_addr[5] == 0xff) {
random_mac_addr[5] = 0xf0;
}
#if defined(LEGACY_RANDOM_MAC)
/* of the six bytes of random_mac the bytes 3, 4, 5 are copied with contents of rand_bytes
* So while copying 3 bytes of content no overflow would be seen. Hence returning void.
*/
(void)memcpy_s(&random_mac[3], (sizeof(u8) * 3), rand_bytes, sizeof(rand_bytes));
err = wldev_iovar_setbuf_bsscfg(bcmcfg_to_prmry_ndev(cfg), "cur_etheraddr",
random_mac, ETH_ALEN, cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
random_mac_addr, ETHER_ADDR_LEN, cfg->ioctl_buf, WLC_IOCTL_SMLEN,
0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed to set random generate MAC address\n"));
} else {
WL_ERR(("set mac " MACDBG " to " MACDBG "\n",
WL_ERR(("Failed to set random generate MAC address " MACDBG " to " MACDBG "\n",
MAC2STRDBG((const u8 *)bcmcfg_to_prmry_ndev(cfg)->dev_addr),
MAC2STRDBG((const u8 *)&random_mac)));
WL_ERR(("random MAC enable done"));
}
#else
/* Enable scan mac */
sm = (wl_scanmac_t *)buffer;
sm_enable = (wl_scanmac_enable_t *)sm->data;
sm->len = sizeof(*sm_enable);
sm_enable->enable = 1;
len = OFFSETOF(wl_scanmac_t, data) + sm->len;
sm->subcmd_id = WL_SCANMAC_SUBCMD_ENABLE;
err = wldev_iovar_setbuf_bsscfg(dev, "scanmac",
sm, len, cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
/* For older chip which which does not have scanmac support can still use
* cur_etheraddr to set the randmac. rand_mask and rand_mac comes from upper
* cfg80211 layer. If rand_mask and rand_mac is not passed then fallback
* to default cur_etheraddr and default mask.
*/
if (err == BCME_UNSUPPORTED) {
/* In case of host based legacy randomization, random address is
* generated by mixing 3 bytes of cur_etheraddr and 3 bytes of
* random bytes generated.In that case rand_mask is nothing but
* random bytes.
*/
(void)memcpy_s(&random_mac[3], (sizeof(u8) * 3), rand_bytes, sizeof(rand_bytes));
err = wldev_iovar_setbuf_bsscfg(bcmcfg_to_prmry_ndev(cfg), "cur_etheraddr",
random_mac, ETH_ALEN, cfg->ioctl_buf,
WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed to set random generate MAC address\n"));
MAC2STRDBG((const u8 *)&random_mac_addr)));
} else {
WL_ERR(("set mac " MACDBG " to " MACDBG "\n",
cfg->random_mac_running = TRUE;
WL_INFORM(("Set random mac " MACDBG " to " MACDBG "\n",
MAC2STRDBG((const u8 *)bcmcfg_to_prmry_ndev(cfg)->dev_addr),
MAC2STRDBG((const u8 *)&random_mac)));
WL_ERR(("random MAC enable done using legacy randmac"));
MAC2STRDBG((const u8 *)&random_mac_addr)));
}
} else if (err == BCME_OK) {
/* Configure scanmac */
(void)memset_s(buffer, sizeof(buffer), 0x0, sizeof(buffer));
sm_config = (wl_scanmac_config_t *)sm->data;
sm->len = sizeof(*sm_config);
sm->subcmd_id = WL_SCANMAC_SUBCMD_CONFIG;
sm_config->scan_bitmap = WL_SCANMAC_SCAN_UNASSOC;
/* Set randomize mac address recv from upper layer */
(void)memcpy_s(&sm_config->mac.octet, ETH_ALEN, random_mac, ETH_ALEN);
/* Set randomize mask recv from upper layer */
/* Currently in samsung case, upper layer does not provide
* variable randmask and its using fixed 3 byte randomization
*/
(void)memset_s(&sm_config->random_mask.octet, ETH_ALEN, 0x0, ETH_ALEN);
/* Memsetting the remaining octets 3, 4, 5. So remaining dest length is 3 */
(void)memset_s(&sm_config->random_mask.octet[3], 3, 0xFF, 3);
WL_DBG(("recv random mac addr " MACDBG " recv rand mask" MACDBG "\n",
MAC2STRDBG((const u8 *)&sm_config->mac.octet),
MAC2STRDBG((const u8 *)&sm_config->random_mask)));
len = OFFSETOF(wl_scanmac_t, data) + sm->len;
err = wldev_iovar_setbuf_bsscfg(dev, "scanmac",
sm, len, cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed scanmac configuration\n"));
/* Disable scan mac for clean-up */
wl_cfg80211_random_mac_disable(dev);
return err;
}
WL_DBG(("random MAC enable done using scanmac"));
} else {
WL_ERR(("failed to enable scanmac, err=%d\n", err));
}
#endif /* LEGACY_RANDOM_MAC */
return err;
}
int
wl_cfg80211_random_mac_disable(struct net_device *dev)
wl_cfg80211_dhd_driven_random_mac_disable(struct net_device *dev)
{
s32 err = BCME_ERROR;
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
#if !defined(LEGACY_RANDOM_MAC)
uint8 buffer[WLC_IOCTL_SMLEN] = {0, };
wl_scanmac_t *sm = NULL;
int len = 0;
wl_scanmac_enable_t *sm_enable = NULL;
#endif /* !LEGACY_RANDOM_MAC */
#if defined(LEGACY_RANDOM_MAC)
WL_ERR(("set original mac " MACDBG "\n",
if (cfg->random_mac_running) {
WL_INFORM(("Restore to original MAC address " MACDBG "\n",
MAC2STRDBG((const u8 *)bcmcfg_to_prmry_ndev(cfg)->dev_addr)));
err = wldev_iovar_setbuf_bsscfg(bcmcfg_to_prmry_ndev(cfg), "cur_etheraddr",
bcmcfg_to_prmry_ndev(cfg)->dev_addr, ETH_ALEN,
bcmcfg_to_prmry_ndev(cfg)->dev_addr, ETHER_ADDR_LEN,
cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed to set original MAC address\n"));
WL_ERR(("Failed to restore original MAC address\n"));
} else {
WL_ERR(("legacy random MAC disable done \n"));
cfg->random_mac_running = FALSE;
WL_ERR(("Random MAC disable done\n"));
}
#else
sm = (wl_scanmac_t *)buffer;
sm_enable = (wl_scanmac_enable_t *)sm->data;
sm->len = sizeof(*sm_enable);
/* Disable scanmac */
sm_enable->enable = 0;
len = OFFSETOF(wl_scanmac_t, data) + sm->len;
sm->subcmd_id = WL_SCANMAC_SUBCMD_ENABLE;
err = wldev_iovar_setbuf_bsscfg(dev, "scanmac",
sm, len, cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed to disable scanmac, err=%d\n", err));
return err;
} else {
/* Already randmac mac address disabled */
err = BCME_OK;
}
/* Clear scanmac enabled status */
cfg->scanmac_enabled = 0;
WL_DBG(("random MAC disable done\n"));
#endif /* LEGACY_RANDOM_MAC */
return err;
}
#endif /* DHD_RANDOM_MAC_SCAN */
/*
* This is new interface for mac randomization. It takes randmac and randmask
* as arg and it uses scanmac iovar to offload the mac randomization to firmware.
@ -2772,7 +2661,7 @@ int wl_cfg80211_scan_mac_enable(struct net_device *dev, uint8 *rand_mac, uint8 *
WL_ERR(("failed scanmac configuration\n"));
/* Disable scan mac for clean-up */
wl_cfg80211_random_mac_disable(dev);
wl_cfg80211_scan_mac_disable(dev);
return err;
}
/* Mark scanmac enabled */
@ -2789,16 +2678,48 @@ int
wl_cfg80211_scan_mac_disable(struct net_device *dev)
{
s32 err = BCME_ERROR;
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
err = wl_cfg80211_random_mac_disable(dev);
uint8 buffer[WLC_IOCTL_SMLEN] = {0, };
wl_scanmac_t *sm = NULL;
int len = 0;
wl_scanmac_enable_t *sm_enable = NULL;
sm = (wl_scanmac_t *)buffer;
sm_enable = (wl_scanmac_enable_t *)sm->data;
sm->len = sizeof(*sm_enable);
/* Disable scanmac */
sm_enable->enable = 0;
len = OFFSETOF(wl_scanmac_t, data) + sm->len;
sm->subcmd_id = WL_SCANMAC_SUBCMD_ENABLE;
err = wldev_iovar_setbuf_bsscfg(dev, "scanmac",
sm, len, cfg->ioctl_buf, WLC_IOCTL_SMLEN, 0, &cfg->ioctl_buf_sync);
if (err != BCME_OK) {
WL_ERR(("failed to disable scanmac, err=%d\n", err));
return err;
}
/* Clear scanmac enabled status */
cfg->scanmac_enabled = 0;
WL_DBG(("random MAC disable done\n"));
return err;
}
int
wl_rand_mac_ctrl(struct net_device *dev, struct bcm_cfg80211 *cfg, bool randmac_enable)
wl_cfg80211_random_mac_enable(struct net_device *dev, struct bcm_cfg80211 *cfg, bool randmac_enable)
{
s32 err = BCME_OK;
#if defined(DHD_RANDOM_MAC_SCAN)
if (randmac_enable && !cfg->random_mac_running)
wl_cfg80211_dhd_driven_random_mac_enable(dev);
else if (!randmac_enable) {
wl_cfg80211_dhd_driven_random_mac_disable(dev);
}
#else /* DHD_RANDOM_MAC_SCAN */
uint8 randomize_all_bits_mask[ETHER_ADDR_LEN] = {0};
/* Use default mask for 46 bit randomization */
uint8 random_addr[ETHER_ADDR_LEN] = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
@ -2808,10 +2729,27 @@ wl_rand_mac_ctrl(struct net_device *dev, struct bcm_cfg80211 *cfg, bool randmac_
} else if (!randmac_enable) {
err = wl_cfg80211_scan_mac_disable(dev);
}
#endif /* DHD_RANDOM_MAC_SCAN */
return err;
}
int
wl_cfg80211_random_mac_disable(struct net_device *dev)
{
s32 err = BCME_OK;
#if defined(DHD_RANDOM_MAC_SCAN)
err = wl_cfg80211_dhd_driven_random_mac_disable(dev);
#else
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
/* Disable scanmac if enabled */
if (cfg->scanmac_enabled) {
err = wl_cfg80211_scan_mac_disable(dev);
}
#endif // endif
return err;
}
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#ifdef WL_SCHED_SCAN
@ -3193,11 +3131,21 @@ static void wl_scan_timeout(unsigned long data)
WL_ERR(("timer expired\n"));
dhdp->scan_timeout_occurred = TRUE;
#ifdef BCMPCIE
(void)dhd_pcie_dump_int_regs(dhdp);
if (!dhd_pcie_dump_int_regs(dhdp)) {
WL_ERR(("%s : PCIe link might be down\n", __FUNCTION__));
dhd_bus_set_linkdown(dhdp, TRUE);
dhdp->hang_reason = HANG_REASON_PCIE_LINK_DOWN_EP_DETECT;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
dhd_os_send_hang_message(dhdp);
#else
WL_ERR(("%s: HANG event is unsupported\n", __FUNCTION__));
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) && OEM_ANDROID */
}
dhd_pcie_dump_rc_conf_space_cap(dhdp);
#endif /* BCMPCIE */
#ifdef DHD_FW_COREDUMP
if (dhdp->memdump_enabled) {
if (!dhd_bus_get_linkdown(dhdp) && dhdp->memdump_enabled) {
dhdp->memdump_type = DUMP_TYPE_SCAN_TIMEOUT;
dhd_bus_mem_dump(dhdp);
}

View file

@ -99,11 +99,17 @@ extern s32 wl_cfg80211_custom_scan_time(struct net_device *dev,
#if defined(SUPPORT_RANDOM_MAC_SCAN)
int wl_cfg80211_set_random_mac(struct net_device *dev, bool enable);
int wl_cfg80211_random_mac_enable(struct net_device *dev);
int wl_cfg80211_random_mac_enable(struct net_device *dev, struct bcm_cfg80211 *cfg,
bool randmac_enable);
int wl_cfg80211_random_mac_disable(struct net_device *dev);
int wl_cfg80211_scan_mac_enable(struct net_device *dev, uint8 *rand_mac, uint8 *rand_mask);
int wl_cfg80211_scan_mac_disable(struct net_device *dev);
int wl_rand_mac_ctrl(struct net_device *dev, struct bcm_cfg80211 *cfg, bool randmac_enable);
#ifdef DHD_RANDOM_MAC_SCAN
int wl_cfg80211_dhd_driven_random_mac_disable(struct net_device *dev);
int wl_cfg80211_dhd_driven_random_mac_enable(struct net_device *dev);
#endif /* DHD_RANDOM_MAC_SCAN */
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#ifdef WL_SCHED_SCAN

View file

@ -24,7 +24,7 @@
*
* <<Broadcom-WL-IPTag/Open:>>
*
* $Id: wl_cfgvendor.c 863133 2020-02-06 10:16:12Z $
* $Id: wl_cfgvendor.c 874894 2020-04-24 06:26:39Z $
*/
/*
@ -410,7 +410,7 @@ wl_cfgvendor_set_country(struct wiphy *wiphy,
}
}
/* country code is unique for dongle..hence using primary interface. */
err = wl_cfg80211_set_country_code(primary_ndev, country_code, true, true, -1);
err = wl_cfg80211_set_country_code(primary_ndev, country_code, true, true, 0);
if (err < 0) {
WL_ERR(("Set country failed ret:%d\n", err));
}
@ -3998,6 +3998,13 @@ wl_cfgvendor_nan_parse_discover_args(struct wiphy *wiphy,
goto exit;
}
cmd_data->mac_list.num_mac_addr = nla_get_u16(iter);
if (cmd_data->mac_list.num_mac_addr >= NAN_SRF_MAX_MAC) {
WL_ERR(("trying to overflow num :%d\n",
cmd_data->mac_list.num_mac_addr));
cmd_data->mac_list.num_mac_addr = 0;
ret = -EINVAL;
goto exit;
}
break;
case NAN_ATTRIBUTE_MAC_ADDR_LIST:
if ((!cmd_data->mac_list.num_mac_addr) ||
@ -6537,19 +6544,48 @@ exit:
#ifdef DHD_LOG_DUMP
static int
wl_cfgvendor_get_buf_data(const struct nlattr *iter, struct buf_data **buf)
wl_cfgvendor_get_buf_data(const struct nlattr *iter, struct buf_data *buf)
{
int ret = BCME_OK;
#ifdef CONFIG_COMPAT
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
if (in_compat_syscall()) {
#else
if (is_compat_task()) {
#endif /* LINUX_VER >= 4.6 */
struct compat_buf_data *compat_buf = (struct compat_buf_data *)nla_data(iter);
if (nla_len(iter) != sizeof(struct compat_buf_data)) {
WL_ERR(("Invalid len : %d\n", nla_len(iter)));
ret = BCME_BADLEN;
}
buf->ver = compat_buf->ver;
buf->len = compat_buf->len;
buf->buf_threshold = compat_buf->buf_threshold;
buf->data_buf[0] = (const void *)compat_ptr(compat_buf->data_buf);
}
else
#endif /* CONFIG_COMPAT */
{
if (nla_len(iter) != sizeof(struct buf_data)) {
WL_ERR(("Invalid len : %d\n", nla_len(iter)));
ret = BCME_BADLEN;
}
(*buf) = (struct buf_data *)nla_data(iter);
if (!(*buf) || (((*buf)->len) <= 0) || !((*buf)->data_buf[0])) {
ret = memcpy_s(buf, sizeof(struct buf_data), (void *)nla_data(iter), nla_len(iter));
if (ret) {
WL_ERR(("Can't get buf data\n"));
goto exit;
}
}
if ((buf->len <= 0) || !buf->data_buf[0]) {
WL_ERR(("Invalid buffer\n"));
ret = BCME_ERROR;
}
exit:
return ret;
}
@ -6563,6 +6599,7 @@ wl_cfgvendor_dbg_file_dump(struct wiphy *wiphy,
struct sk_buff *skb = NULL;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
struct buf_data *buf;
struct buf_data data_from_hal = {0};
int pos = 0;
/* Alloc the SKB for vendor_event */
@ -6573,9 +6610,10 @@ wl_cfgvendor_dbg_file_dump(struct wiphy *wiphy,
goto exit;
}
WL_ERR(("%s\n", __FUNCTION__));
buf = &data_from_hal;
nla_for_each_attr(iter, data, len, rem) {
type = nla_type(iter);
ret = wl_cfgvendor_get_buf_data(iter, &buf);
ret = wl_cfgvendor_get_buf_data(iter, buf);
if (ret)
goto exit;
switch (type) {
@ -7944,13 +7982,15 @@ static int wl_cfgvendor_set_pmk(struct wiphy *wiphy,
type = nla_type(iter);
switch (type) {
case BRCM_ATTR_DRIVER_KEY_PMK:
if (nla_len(iter) > sizeof(pmk.key)) {
pmk.flags = 0;
pmk.key_len = htod16(nla_len(iter));
ret = memcpy_s(pmk.key, sizeof(pmk.key),
(uint8 *)nla_data(iter), nla_len(iter));
if (ret) {
WL_ERR(("Failed to copy pmk: %d\n", ret));
ret = -EINVAL;
goto exit;
}
pmk.flags = 0;
pmk.key_len = htod16(nla_len(iter));
bcopy((uint8 *)nla_data(iter), pmk.key, len);
break;
default:
WL_ERR(("Unknown type: %d\n", type));

View file

@ -463,53 +463,18 @@ int wldev_get_mode(
return error;
}
int wldev_set_country(
struct net_device *dev, char *country_code, bool notify, bool user_enforced, int revinfo)
struct net_device *dev, char *country_code, bool notify, int revinfo)
{
int error = -1;
wl_country_t cspec = {{0}, 0, {0}};
scb_val_t scbval;
char smbuf[WLC_IOCTL_SMLEN];
#ifdef WL_CFG80211
struct wireless_dev *wdev = ndev_to_wdev(dev);
struct wiphy *wiphy = wdev->wiphy;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
#endif /* WL_CFG80211 */
if (!country_code)
return error;
bzero(&scbval, sizeof(scb_val_t));
error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL);
if (error < 0) {
WLDEV_ERROR(("wldev_set_country: get country failed = %d\n", error));
return error;
}
if ((error < 0) ||
dhd_force_country_change(dev) ||
(strncmp(country_code, cspec.ccode, WLC_CNTRY_BUF_SZ) != 0)) {
#ifdef WL_CFG80211
if ((user_enforced) && (wl_get_drv_status(cfg, CONNECTED, dev))) {
#else
if (user_enforced) {
#endif /* WL_CFG80211 */
bzero(&scbval, sizeof(scb_val_t));
error = wldev_ioctl_set(dev, WLC_DISASSOC,
&scbval, sizeof(scb_val_t));
if (error < 0) {
WLDEV_ERROR(("wldev_set_country: set country failed"
" due to Disassoc error %d\n",
error));
return error;
}
}
wl_cfg80211_scan_abort(cfg);
cspec.rev = revinfo;
strlcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
strlcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
strlcpy(cspec.country_abbrev, country_code, WL_CCODE_LEN + 1);
strlcpy(cspec.ccode, country_code, WL_CCODE_LEN + 1);
dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);
error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
smbuf, sizeof(smbuf), NULL);
@ -521,6 +486,5 @@ int wldev_set_country(
dhd_bus_country_set(dev, &cspec, notify);
WLDEV_INFO(("wldev_set_country: set country for %s as %s rev %d\n",
country_code, cspec.ccode, cspec.rev));
}
return 0;
}

View file

@ -98,10 +98,9 @@ extern int dhd_net_wifi_platform_set_power(struct net_device *dev, bool on,
extern void dhd_get_customized_country_code(struct net_device *dev, char *country_iso_code,
wl_country_t *cspec);
extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec, bool notify);
extern bool dhd_force_country_change(struct net_device *dev);
extern void dhd_bus_band_set(struct net_device *dev, uint band);
extern int wldev_set_country(struct net_device *dev, char *country_code, bool notify,
bool user_enforced, int revinfo);
int revinfo);
extern int net_os_wake_lock(struct net_device *dev);
extern int net_os_wake_unlock(struct net_device *dev);
extern int net_os_wake_lock_timeout(struct net_device *dev);

View file

@ -224,6 +224,61 @@ static int exynos_pcie_set_l1ss(int enable, struct pcie_port *pp, int id)
return 0;
}
int exynos_pcie_l1_exit(int ch_num)
{
struct exynos_pcie *exynos_pcie = &g_pcie[ch_num];
u32 count = 0, ret = 0, val = 0;
unsigned long flags;
spin_lock_irqsave(&exynos_pcie->pcie_l1_exit_lock, flags);
if (exynos_pcie->l1ss_ctrl_id_state == 0) {
/* Set s/w L1 exit mode */
exynos_elb_writel(exynos_pcie, 0x1, PCIE_APP_REQ_EXIT_L1);
val = exynos_elb_readl(exynos_pcie, PCIE_APP_REQ_EXIT_L1_MODE);
val &= ~APP_REQ_EXIT_L1_MODE;
exynos_elb_writel(exynos_pcie, val, PCIE_APP_REQ_EXIT_L1_MODE);
/* Max timeout = 3ms (300 * 10us) */
while (count < MAX_L1_EXIT_TIMEOUT) {
val = exynos_elb_readl(exynos_pcie,
PCIE_ELBI_RDLH_LINKUP) & 0x1f;
if (val == 0x11)
break;
count++;
udelay(10);
}
if (count >= MAX_L1_EXIT_TIMEOUT) {
pr_err("%s: cannot change to L0(LTSSM = 0x%x, cnt = %d)\n",
__func__, val, count);
ret = -EPIPE;
} else {
/* remove too much print */
/* pr_err("%s: L0 state(LTSSM = 0x%x, cnt = %d)\n",
* __func__, val, count); */
}
/* Set h/w L1 exit mode */
val = exynos_elb_readl(exynos_pcie, PCIE_APP_REQ_EXIT_L1_MODE);
val |= APP_REQ_EXIT_L1_MODE;
exynos_elb_writel(exynos_pcie, val, PCIE_APP_REQ_EXIT_L1_MODE);
exynos_elb_writel(exynos_pcie, 0x0, PCIE_APP_REQ_EXIT_L1);
} else {
/* remove too much print */
/* pr_err("%s: skip!!! l1.2 is already diabled(id = 0x%x)\n",
* __func__, exynos_pcie->l1ss_ctrl_id_state); */
}
spin_unlock_irqrestore(&exynos_pcie->pcie_l1_exit_lock, flags);
return ret;
}
EXPORT_SYMBOL(exynos_pcie_l1_exit);
int exynos_pcie_l1ss_ctrl(int enable, int id)
{
struct pcie_port *pp = NULL;
@ -1721,6 +1776,7 @@ static int __init add_pcie_port(struct pcie_port *pp,
pp->ops = &exynos_pcie_host_ops;
exynos_pcie_setup_rc(pp);
spin_lock_init(&exynos_pcie->pcie_l1_exit_lock);
spin_lock_init(&exynos_pcie->conf_lock);
spin_lock_init(&exynos_pcie->reg_lock);
ret = dw_pcie_host_init(pp);

View file

@ -17,6 +17,7 @@
#define ID_MASK 0xffff
#define TPUT_THRESHOLD 150
#define MAX_RC_NUM 2
#define MAX_L1_EXIT_TIMEOUT 300
#if defined(CONFIG_SOC_EXYNOS8890)
#define PCI_DEVICE_ID_EXYNOS 0xa544
@ -91,6 +92,7 @@ struct exynos_pcie {
bool use_ia;
spinlock_t conf_lock;
spinlock_t reg_lock;
spinlock_t pcie_l1_exit_lock;
struct workqueue_struct *pcie_wq;
struct exynos_pcie_clks clks;
struct pcie_port pp;

View file

@ -14,10 +14,16 @@ choice
depends on FIVE_TEE_DRIVER
default FIVE_USE_TZDEV if TZDEV
default FIVE_USE_QSEE if QSEECOM
default FIVE_USE_TRUSTONIC
default FIVE_USE_TRUSTONIC if TRUSTONIC_TEE || TRUSTONIC_TEE_SUPPORT
default FIVE_USE_EMULATOR
---help---
Select Secure OS for FIVE TEE Driver
config FIVE_USE_EMULATOR
bool "Integrity TEE Driver for TA emualtor"
---help---
Use Integrity TEE Driver which interacts with TA emulator over network
config FIVE_USE_TRUSTONIC
bool "Integrity TEE Driver based on Trustonic Secure OS"
depends on TRUSTONIC_TEE || TRUSTONIC_TEE_SUPPORT
@ -45,6 +51,13 @@ config TEE_DRIVER_DEBUG
---help---
Enable Debug mode in TEE Driver
config FIVE_EMULATOR_IP
string "IP address of FIVE TA Emulator"
depends on FIVE_TEE_DRIVER && FIVE_USE_EMULATOR
default "10.0.2.2" if FIVE_USE_EMULATOR
---help---
The driver will connect to FIVE TA at this address
config FIVE_TRUSTLET_PATH
string "FIVE trustlet"
depends on FIVE_TEE_DRIVER && FIVE_USE_TRUSTONIC && FIRMWARE_IN_KERNEL

View file

@ -1,68 +1,63 @@
#
# Integrity TEE Driver
#
FIVE_TEE_DRIVER_PATH := $(srctree)/drivers/security/samsung/five_tee_driver
TEEC_CLIENT_PATH := multibuild/source/gp-api/client
PROTOCOL_PATH := multibuild/source/gp-api/protocol
FIVE_TEE_DRIVER_PATH := drivers/security/samsung/five_tee_driver
obj-$(CONFIG_FIVE_TEE_DRIVER) += itee_driver.o
obj-$(CONFIG_FIVE_TEE_DRIVER) += five_tee_driver.o
itee_driver-objs += five_tee_driver.o
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Isecurity/samsung/five \
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -I$(srctree)/security/samsung/five \
-I$(FIVE_TEE_DRIVER_PATH)/$(PROTOCOL_PATH) \
-I$(FIVE_TEE_DRIVER_PATH)/$(TEEC_CLIENT_PATH)
ccflags-$(CONFIG_FIVE_USE_TRUSTONIC) += -DCONFIG_TRUSTONIC
ccflags-$(CONFIG_FIVE_USE_TZDEV) += -DCONFIG_TEEGRIS
ccflags-$(CONFIG_FIVE_USE_QSEE) += -DCONFIG_QSEE
# Emulator
obj-$(CONFIG_FIVE_USE_EMULATOR) += $(TEEC_CLIENT_PATH)/tee_client_api.o \
$(PROTOCOL_PATH)/teec_param_utils.o \
$(TEEC_CLIENT_PATH)/teec_common_emulator.o \
$(TEEC_CLIENT_PATH)/teec_operation.o \
$(PROTOCOL_PATH)/socket_utils.o
ccflags-$(CONFIG_FIVE_USE_EMULATOR) += -I$(FIVE_TEE_DRIVER_PATH)/multibuild/include/gp-api
# Trustonic
obj-$(CONFIG_FIVE_USE_TRUSTONIC) += $(TEEC_CLIENT_PATH)/tee_client_api.o \
$(PROTOCOL_PATH)/teec_param_utils.o \
$(TEEC_CLIENT_PATH)/teec_common_tbase.o \
$(TEEC_CLIENT_PATH)/teec_operation_tbase.o \
$(TEEC_CLIENT_PATH)/tee_client_api.o
$(TEEC_CLIENT_PATH)/teec_operation.o
ccflags-$(CONFIG_FIVE_USE_TRUSTONIC) += -I$(FIVE_TEE_DRIVER_PATH)/multibuild/include/gp-api
ifeq ($(CONFIG_FIVE_USE_TRUSTONIC), y)
ifeq ($(CONFIG_SOC_EXYNOS7570), y)
PLATFORM := exynos7570
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_SOC_EXYNOS7870), y)
PLATFORM := exynos7870
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_SOC_EXYNOS7885), y)
PLATFORM := exynos7885
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_SOC_EXYNOS9810), y)
PLATFORM := exynos9810
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_SOC_EXYNOS9820), y)
PLATFORM := exynos9820
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_SOC_EXYNOS9610), y)
PLATFORM := exynos9610
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
else ifeq ($(CONFIG_MACH_MT6768), y)
ifeq ($(CONFIG_MACH_MT6768), y)
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/misc/mediatek/gud/410/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/misc/mediatek/gud/410/MobiCoreDriver/public
else
ifeq ($(CONFIG_SOC_EXYNOS7570), y)
PLATFORM := exynos7570
else ifeq ($(CONFIG_SOC_EXYNOS7870), y)
PLATFORM := exynos7870
else ifeq ($(CONFIG_SOC_EXYNOS7885), y)
PLATFORM := exynos7885
else ifeq ($(CONFIG_SOC_EXYNOS9810), y)
PLATFORM := exynos9810
else ifeq ($(CONFIG_SOC_EXYNOS9820), y)
PLATFORM := exynos9820
else ifeq ($(CONFIG_SOC_EXYNOS9610), y)
PLATFORM := exynos9610
else ifeq ($(CONFIG_SOC_EXYNOS1000), y)
PLATFORM := exynos1000
else
$(error "Unknown SoC")
endif
endif
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver
ccflags-$(CONFIG_FIVE_TEE_DRIVER) += -Idrivers/gud/gud-$(PLATFORM)/MobiCoreDriver/public
endif # CONFIG_MACH_MT6768
endif # CONFIG_FIVE_USE_TRUSTONIC
# QSEE
obj-$(CONFIG_FIVE_USE_QSEE) += $(TEEC_CLIENT_PATH)/tee_client_api.o \
$(PROTOCOL_PATH)/teec_param_utils.o \
$(TEEC_CLIENT_PATH)/teec_common_qsee.o \
$(TEEC_CLIENT_PATH)/teec_operation_qsee.o
$(TEEC_CLIENT_PATH)/teec_operation.o
ccflags-$(CONFIG_FIVE_USE_QSEE) += -I$(FIVE_TEE_DRIVER_PATH)/multibuild/include/gp-api \
-Idrivers/misc
@ -78,10 +73,11 @@ ifeq ($(CONFIG_SOC_EXYNOS7870), y)
endif
ifeq ($(CONFIG_SOC_EXYNOS7885), y)
ifeq ($(CONFIG_TEEGRIS_VERSION), 2)
use_teegris_v2 := y
endif
ifeq ($(CONFIG_TEEGRIS_VERSION), 3)
ccflags-$(CONFIG_FIVE_USE_TZDEV) += -Idrivers/misc/tzdev/3.0/include/tzdev
else
use_teegris_v2 := y
endif
endif
@ -89,10 +85,12 @@ ifeq ($(use_teegris_v2), y)
obj-$(CONFIG_FIVE_USE_TZDEV) += $(TEEC_CLIENT_PATH)/teec_common_teegris_v2.o \
$(TEEC_CLIENT_PATH)/tee_client_api.o \
$(PROTOCOL_PATH)/teec_param_utils.o \
$(TEEC_CLIENT_PATH)/teec_operation_teegris_v2.o
$(TEEC_CLIENT_PATH)/teec_operation.o
ccflags-$(CONFIG_FIVE_USE_TZDEV) += -Idrivers/misc/tzdev/include \
-I$(FIVE_TEE_DRIVER_PATH)/multibuild/include/gp-api
else
obj-$(CONFIG_FIVE_USE_TZDEV) += $(TEEC_CLIENT_PATH)/teec_operation_teegris_v3.o
ccflags-$(CONFIG_FIVE_USE_TZDEV) += -Idrivers/misc/tzdev/include/tzdev
endif
subdir-ccflags-y := -Wformat

View file

@ -17,27 +17,43 @@
#ifndef __FIVE_TEE_UUID_H__
#define __FIVE_TEE_UUID_H__
#if defined(CONFIG_TEEGRIS)
#if defined(CONFIG_FIVE_USE_TZDEV)
static const TEEC_UUID five_ta_uuid = {
.timeLow = 0x00000000,
.timeMid = 0x0000,
.timeHiAndVersion = 0x0000,
.clockSeqAndNode = {0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x56, 0x45},
};
#elif defined(CONFIG_QSEECOM)
#elif defined(CONFIG_FIVE_USE_QSEE)
#ifdef CONFIG_ARCH_MSM8917
static const TEEC_UUID five_ta_uuid = {
.timeLow = 0x6d736d38,
.timeMid = 0x3931,
.timeHiAndVersion = 0x372f,
.clockSeqAndNode = {0x66, 0x69, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00},
};
#else
static const TEEC_UUID five_ta_uuid = {
.timeLow = 0x66697665,
.timeMid = 0x0000,
.timeHiAndVersion = 0x0000,
.clockSeqAndNode = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
};
#elif defined(CONFIG_TRUSTONIC)
#endif // CONFIG_ARCH_MSM8917
#elif defined(CONFIG_FIVE_USE_TRUSTONIC)
static const TEEC_UUID five_ta_uuid = {
.timeLow = 0xffffffff,
.timeMid = 0x0000,
.timeHiAndVersion = 0x0000,
.clockSeqAndNode = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72},
};
#elif defined(CONFIG_FIVE_USE_EMULATOR)
static const TEEC_UUID five_ta_uuid = {
.timeLow = 0x00000000,
.timeMid = 0x0000,
.timeHiAndVersion = 0x0000,
.clockSeqAndNode = {0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x56, 0xff},
};
#endif
#endif /* __FIVE_TEE_UUID_H__ */

View file

@ -195,7 +195,7 @@ static int send_cmd(unsigned int cmd,
pr_info("FIVE: Initialize trusted app, ret: %d\n", rc);
if (rc) {
mutex_unlock(&itee_driver_lock);
rc = -EIO;
rc = -ESRCH;
goto out;
}
}

View file

@ -0,0 +1,181 @@
/*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This code is originated from Samsung Electronics proprietary sources.
* Author: Oleksandr Fadieiev (o.fadieiev@samsung.com)
* Created: 14 Dec 2018
*
* Copyright (C) 2018 Samsung Electronics, Inc.
*/
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <net/sock.h>
#include "teec_common.h"
#include "protocol.h"
#include "teec_param_utils.h"
#include "socket_utils.h"
static const uint16_t FIVE_EMUL_PORT = 0x514e;
typedef struct EmulSessionStruct {
struct socket *socket;
ProtocolCmd *command;
} EmulSession;
static uint32_t create_address(const char *ip_addr)
{
uint8_t ip[4] = {0};
sscanf(ip_addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]);
return (ip[0] << 24) | (ip[1] << 16) | (ip[2] << 8) | ip[3];
}
static void CloseTASocket(EmulSession *session)
{
sock_release(session->socket);
}
static SocketStatus OpenTASocket(EmulSession *session)
{
struct sockaddr_in sa;
BUG_ON(!session);
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = htonl(create_address(CONFIG_FIVE_EMULATOR_IP));
sa.sin_port = htons(FIVE_EMUL_PORT);
return OpenSocket((struct sockaddr *)&sa, &session->socket);
}
TEEC_Result EmulSendCommand(void *ta_session,
uint32_t command_id,
TEEC_Operation *operation,
uint32_t *return_origin,
int32_t timeout)
{
int status = 0;
TEEC_Result ret = TEEC_ERROR_BAD_PARAMETERS;
EmulSession *emul_session = (EmulSession *)ta_session;
ProtocolCmd *command;
struct socket *socket;
const int cmd_sz = sizeof(ProtocolCmd);
BUG_ON(!emul_session);
command = emul_session->command;
BUG_ON(!command);
memset(command, 0x00, sizeof(ProtocolCmd));
/* Return origin: "API" is rewritten always at the exit condition. */
command->return_origin = TEEC_ORIGIN_API;
command->cmd_id = command_id;
command->cmd_ret = TEEC_ERROR_COMMUNICATION;
command->param_types = 0;
if (operation) {
command->param_types = operation->paramTypes;
ret = FillCommandArgs(command, operation, NULL);
if (TEEC_SUCCESS != ret)
goto exit;
}
/* Return origin: "COMMS" by default because of possible communication errors. */
command->return_origin = TEEC_ORIGIN_COMMS;
status = OpenTASocket(emul_session);
if (SocketStatusOk != status) {
pr_err("FIVE: error: connect to proxy failed: %d\n", status);
ret = TEEC_ERROR_COMMUNICATION;
goto exit;
}
socket = emul_session->socket;
status = WriteDataToSocket(socket, (uint8_t *)command, cmd_sz);
if (SocketStatusOk != status) {
ret = TEEC_ERROR_COMMUNICATION;
goto close;
}
status = ReadDataFromSocket(socket, (uint8_t *)command, cmd_sz);
if (SocketStatusOk != status) {
ret = TEEC_ERROR_COMMUNICATION;
goto close;
}
/* Return origin: "TEE" or "TRUSTED_APP" after communication with TEE. */
ret = command->cmd_ret;
if (TEEC_SUCCESS == ret && operation) {
ret = FillOperationArgs(operation, command);
if (TEEC_SUCCESS != ret)
command->return_origin = TEEC_ORIGIN_API;
}
close:
CloseTASocket(emul_session);
exit:
if (return_origin)
*return_origin = command->return_origin;
return ret;
}
TEEC_Result EmulUnloadTA(void *ta_session)
{
EmulSession *session = (EmulSession *)ta_session;
kfree(session->command);
return TEEC_SUCCESS;
}
TEEC_Result EmulLoadTA(void *ta_session, const TEEC_UUID *uuid)
{
EmulSession *session = (EmulSession *)ta_session;
session->command = NULL;
session->command = kmalloc(sizeof(ProtocolCmd), GFP_KERNEL);
if (!session->command)
return TEEC_ERROR_OUT_OF_MEMORY;
/* Do nothing. Open a connection on the first command invocation. */
return TEEC_SUCCESS;
}
PlatformClientImpl g_emul_platform_impl = {
EmulLoadTA,
EmulUnloadTA,
EmulSendCommand,
NULL,
NULL,
NULL,
NULL
};
PlatformClientImpl *GetPlatformClientImpl(void)
{
return &g_emul_platform_impl;
}
size_t GetPlatformClientImplSize(void)
{
return sizeof(EmulSession);
}

View file

@ -17,6 +17,7 @@
#include <linux/string.h>
#include <linux/bug.h>
#include <uapi/linux/qseecom.h>
#include "teec_common.h"
@ -25,7 +26,7 @@
#include "teec_param_utils.h"
#include "linux/errno.h"
#define MAX_QSEE_UUID_LEN 17
#define MAX_QSEE_UUID_LEN (MAX_APP_NAME_SIZE) // usually 64 bytes
#define QSEE_SUCCESS 0
/* 1. Actually we don't use the response buffer. But RBUF_LEN can't be zero.

View file

@ -0,0 +1,37 @@
/*
* Set option shared memory and operations for TEE access
*
* Copyright (C) 2019 Samsung Electronics, Inc.
*
* Egor Uleyskiy, <e.uleyskiy@samsung.com>
* Viacheslav Vovchenko <v.vovchenko@samsung.com>
* Yevgen Kopylov <y.kopylov@samsung.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "teec_operation.h"
void FillOperationSharedMem(TEEC_SharedMemory *sharedMem,
TEEC_Operation *operation, bool inout_direction)
{
if (inout_direction) {
operation->paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INOUT,
TEEC_NONE,
TEEC_NONE, TEEC_NONE);
} else {
operation->paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
TEEC_NONE,
TEEC_NONE, TEEC_NONE);
}
operation->params[0].tmpref.buffer = sharedMem->buffer;
operation->params[0].tmpref.size = sharedMem->size;
}

View file

@ -0,0 +1,135 @@
/*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This code is originated from Samsung Electronics proprietary sources.
* Author: Oleksandr Fadieiev (o.fadieiev@samsung.com)
* Author: Iaroslav Makarchuk (i.makarchuk@samsung.com)
* Created: 03 Oct, 2016
* Modified: Dec 27, 2018
*
* Copyright (C) 2015 Samsung Electronics, Inc.
*/
#include "socket_utils.h"
#include "protocol.h"
#include <linux/delay.h>
#include <linux/types.h>
#include <net/sock.h>
#define SOCKET_RETRY_CNT 5
#define SOCKET_RETRY_DELAY 1
SocketStatus ReadDataFromSocket(struct socket *socket, uint8_t *data,
uint32_t data_len)
{
SocketStatus status = SocketStatusError;
int read_res = 0;
uint32_t curr_len = 0;
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
msg.msg_flags = MSG_DONTWAIT;
do {
struct kvec vec;
vec.iov_base = data + curr_len;
vec.iov_len = data_len - curr_len;
read_res = kernel_recvmsg(socket, &msg, &vec, 1, vec.iov_len,
MSG_DONTWAIT);
if (read_res == -EAGAIN || read_res == -ERESTARTSYS)
continue;
if (read_res <= 0)
break;
curr_len += read_res;
} while (curr_len < data_len);
if (curr_len == data_len)
status = SocketStatusOk;
return status;
}
SocketStatus WriteDataToSocket(struct socket *socket, uint8_t *data,
uint32_t data_len)
{
SocketStatus status = SocketStatusError;
uint32_t curr_len = 0;
int write_res = 0;
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
msg.msg_flags = MSG_DONTWAIT;
while (curr_len < data_len) {
struct kvec vec;
vec.iov_base = data + curr_len;
vec.iov_len = data_len - curr_len;
write_res = kernel_sendmsg(socket, &msg, &vec, 1, vec.iov_len);
if (write_res == -EAGAIN || write_res == -ERESTARTSYS)
continue;
if (write_res <= 0) {
pr_err("FIVE: write error: %d\n", write_res);
break;
}
curr_len += write_res;
}
if (curr_len == data_len)
status = SocketStatusOk;
return status;
}
SocketStatus OpenSocket(struct sockaddr *sa, struct socket **socket)
{
int retry_cnt = SOCKET_RETRY_CNT;
SocketStatus status = SocketStatusError;
BUG_ON(!sa || !socket);
/*
* Connect to proxy between kernel and emulator.
* The FIVE trustlet emulator and FIVE proxy are supposed to be
* launched before the first user request to the kernel.
* User (sign/verify) -> FIVE driver (TEEC protocol request) -> TCP ->
* FIVE proxy (raw data) -> Socket ->
* FIVE emulator (TEEC protocol response)
*/
if (sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, socket) < 0) {
pr_err("FIVE: error: while creating TCP socket.\n");
return status;
}
while (retry_cnt--) {
if (kernel_connect(*socket, sa, sizeof(*sa), 0) == 0) {
status = SocketStatusOk;
break;
}
mdelay(500);
}
if (SocketStatusOk != status) {
sock_release(*socket);
status = SocketStatusError;
}
return status;
}

View file

@ -0,0 +1,41 @@
/*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This code is originated from Samsung Electronics proprietary sources.
* Author: Oleksandr Fadieiev (o.fadieiev@samsung.com)
* Author: Iaroslav Makarchuk (i.makarchuk@samsung.com)
* Created: 03 Oct, 2016
* Modified: Dec 27, 2018
*
* Copyright (C) 2015 Samsung Electronics, Inc.
*/
#ifndef SOCKET_UTILS_H_
#define SOCKET_UTILS_H_
#include "protocol.h"
#include <linux/types.h>
#include <net/sock.h>
typedef enum SocketStatusEnum {
SocketStatusOk = 0,
SocketStatusError,
} SocketStatus;
SocketStatus OpenSocket(struct sockaddr *sa, struct socket **socket);
SocketStatus ReadDataFromSocket(struct socket *socket, uint8_t *data,
uint32_t data_len);
SocketStatus WriteDataToSocket(struct socket *socket, uint8_t *data,
uint32_t data_len);
#endif /* SOCKET_UTILS_H_ */

View file

@ -11,7 +11,11 @@ EXTRA_CFLAGS += -I$(src)
obj-$(CONFIG_ICD_USE_QSEECOM) += qsee_oemflag.o
obj-$(CONFIG_ICD_USE_TZDEV) += tzdev_oemflag.o
ifneq ($(CONFIG_SOC_EXYNOS7885),)
ccflags-$(CONFIG_ICD_USE_TZDEV) += -Idrivers/misc/tzdev/3.0
ifeq ($(CONFIG_TEEGRIS_VERSION), 3)
ccflags-$(CONFIG_ICD_USE_TZDEV) += -Idrivers/misc/tzdev/3.0
else
ccflags-$(CONFIG_ICD_USE_TZDEV) += -Idrivers/misc/tzdev
endif
else
ccflags-$(CONFIG_ICD_USE_TZDEV) += -Idrivers/misc/tzdev
endif
@ -21,3 +25,5 @@ ifneq (,$(filter $(CONFIG_MTK_PLATFORM), "mt6768"))
else
obj-$(CONFIG_ICD_USE_TRUSTONIC) += kinibi_oemflag.o
endif
ccflags-y += -Wformat

View file

@ -33,10 +33,11 @@
#include <linux/string_helpers.h>
#endif
static void icd_hook_integrity_reset(struct task_struct *task);
static void icd_hook_integrity_reset(struct task_struct *task,
struct file *file, unsigned cause);
static struct five_hook_list five_ops[] = {
FIVE_HOOK_INIT(integrity_reset, icd_hook_integrity_reset),
FIVE_HOOK_INIT(integrity_reset2, icd_hook_integrity_reset),
};
static bool contains_str(const char * const array[], const char *str)
@ -156,7 +157,30 @@ static const char *get_exec_path(struct task_struct *task, char **pathbuf)
return pathname ?: (const char *)exe_path->dentry->d_name.name;
}
static void icd_hook_integrity_reset(struct task_struct *task)
static const char *icd_d_path(const struct path *path, char **pathbuf, char *namebuf)
{
char *pathname = NULL;
*pathbuf = __getname();
if (*pathbuf) {
pathname = d_absolute_path(path, *pathbuf, PATH_MAX);
if (IS_ERR(pathname)) {
__putname(*pathbuf);
*pathbuf = NULL;
pathname = NULL;
}
}
if (!pathname) {
strlcpy(namebuf, path->dentry->d_name.name, NAME_MAX);
pathname = namebuf;
}
return pathname;
}
static void icd_hook_integrity_reset(struct task_struct *task,
struct file *file, unsigned cause)
{
const char *execpath = NULL;
char *pathbuf = NULL;
@ -177,8 +201,18 @@ static void icd_hook_integrity_reset(struct task_struct *task)
if (oemid != OEMFLAG_NONE) {
int ret;
const char *pathname = NULL;
char *pathbuf = NULL;
char filename[NAME_MAX];
pr_info("ICD: %s: %u\n", execpath, oemid);
if (file) {
pathname = icd_d_path(&file->f_path, &pathbuf, filename);
pr_info("ICD: file=%s cause=%u\n", pathname, cause);
if (pathbuf)
__putname(pathbuf);
}
ret = oem_flags_set(oemid);
if (ret)
pr_err("oem_flags_set err: %d\n", ret);

View file

@ -13,7 +13,8 @@ choice
depends on TZIC
default TZIC_USE_QSEECOM if QSEECOM
default TZIC_USE_TZDEV if TZDEV
default TZIC_USE_TRUSTONIC
default TZIC_USE_TRUSTONIC if TRUSTONIC_TEE
default TZIC_DEFAULT
---help---
Select Secure OS for TZIC
@ -34,4 +35,8 @@ choice
depends on QSEECOM
---help---
Use Qualcomm as base Trusted Execution Environment
config TZIC_DEFAULT
bool "TZIC Disabled"
---help---
TZIC disabled
endchoice

View file

@ -10,7 +10,11 @@ EXTRA_CFLAGS += -I$(src)
obj-$(CONFIG_TZIC_USE_QSEECOM) += tzic_qsee.o
obj-$(CONFIG_TZIC_USE_TZDEV) += tzic_tzdev.o
ifneq ($(CONFIG_TZIC_EXYNOS7885),)
ccflags-$(CONFIG_TZIC_USE_TZDEV) += -Idrivers/misc/tzdev/3.0
ifeq ($(CONFIG_TEEGRIS_VERSION), 3)
ccflags-$(CONFIG_TZIC_USE_TZDEV) += -Idrivers/misc/tzdev/3.0
else
ccflags-$(CONFIG_TZIC_USE_TZDEV) += -Idrivers/misc/tzdev
endif
else
ccflags-$(CONFIG_TZIC_USE_TZDEV) += -Idrivers/misc/tzdev
endif
@ -18,4 +22,7 @@ ifeq ($(MTK_PLATFORM),mt6768)
obj-y += tzic_mtk_atf.o
else
obj-$(CONFIG_TZIC_USE_TRUSTONIC) += tzic_kinibi.o
obj-$(CONFIG_TZIC_DEFAULT) += tzic_default.o
endif
ccflags-y += -Wformat

View file

@ -34,7 +34,11 @@
#include <linux/ioctl.h>
#include <linux/moduleparam.h>
#include <linux/miscdevice.h>
#if defined(CONFIG_TEEGRIS_VERSION) && (CONFIG_TEEGRIS_VERSION >= 4)
#include "extensions/irs.h"
#else
#include "tzirs.h"
#endif
#endif /* CONFIG_TZDEV */
#define TZIC_DEV "tzic"

View file

@ -0,0 +1,27 @@
/*
* Set OEM flags
*
* Copyright (C) 2018 Samsung Electronics, Inc.
* Nguyen Hoang Thai Kiet, <kiet.nht@samsung.com>
* Jonghun Song, <justin.song@samsung.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "tzic.h"
int tzic_oem_flags_set(enum oemflag_id index)
{
return 0;
}
int tzic_oem_flags_get(enum oemflag_id index)
{
return 0;
}

View file

@ -16,8 +16,8 @@
* GNU General Public License for more details.
*/
#include <linux/printk.h>
#include <linux/types.h>
#include <linux/task_integrity.h>
#include <soc/qcom/scm.h>
#include "tzic.h"

View file

@ -19,7 +19,11 @@
#include <linux/debugfs.h>
#include <linux/types.h>
#include <linux/errno.h>
#if defined(CONFIG_TEEGRIS_VERSION) && (CONFIG_TEEGRIS_VERSION >= 4)
#include "extensions/irs.h"
#else
#include "tzirs.h"
#endif
#include "tzic.h"
static uint32_t run_cmd_teegris(uint32_t cmd, uint32_t arg1,
@ -48,9 +52,6 @@ static uint32_t run_cmd_teegris(uint32_t cmd, uint32_t arg1,
return -EFAULT;
}
arg2 = p1;
arg3 = p2;
cmd = p3;
if(arg1) {
return p2;
}

View file

@ -88,6 +88,18 @@ static struct boot_event boot_events[] = {
{"!@Boot_DEBUG: Launcher.LoaderTask.run() start",},
{"!@Boot_DEBUG: Launcher - FinishFirstBind",},
};
#define MAX_LENGTH_OF_BOOTING_LOG 90
#define DELAY_TIME_EBS 10000
#define MAX_EVENTS_EBS 100
struct enhanced_boot_time {
struct list_head next;
char buf[MAX_LENGTH_OF_BOOTING_LOG];
unsigned int time;
int freq[2];
int online;
};
#define MAX_LENGTH_OF_SYSTEMSERVER_LOG 90
struct systemserver_init_time_entry {
struct list_head next;
@ -95,8 +107,12 @@ struct systemserver_init_time_entry {
};
static bool bootcompleted = false;
static bool ebs_finished = false;
unsigned long long boot_complete_time = 0;
static int events_ebs = 0;
LIST_HEAD(systemserver_init_time_list);
LIST_HEAD(enhanced_boot_time_list);
void sec_bootstat_mct_start(u64 rate)
{
@ -118,12 +134,48 @@ void sec_bootstat_add_initcall(const char *s)
}
}
void sec_enhanced_boot_stat_record(const char *buf)
{
unsigned long long t = 0;
struct enhanced_boot_time *entry;
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return;
strncpy(entry->buf, buf, MAX_LENGTH_OF_BOOTING_LOG);
entry->buf[MAX_LENGTH_OF_BOOTING_LOG-1] = '\0';
t = local_clock();
do_div(t, 1000000);
entry->time = (unsigned int)t;
sec_bootstat_get_cpuinfo(entry->freq, &entry->online);
list_add(&entry->next, &enhanced_boot_time_list);
events_ebs++;
}
static int prev;
void sec_bootstat_add(const char *c)
{
size_t i = 0;
unsigned long long t = 0;
if (bootcompleted && !ebs_finished) {
t = local_clock();
do_div(t, 1000000);
if ((t - boot_complete_time) >= DELAY_TIME_EBS)
ebs_finished = true;
}
// Collect Boot_EBS from java side
if (!ebs_finished && events_ebs < MAX_EVENTS_EBS){
if (!strncmp(c, "!@Boot_EBS: ", 12)) {
sec_enhanced_boot_stat_record(c + 12);
return;
}
else if (!strncmp(c, "!@Boot_EBS_", 11)) {
sec_enhanced_boot_stat_record(c);
return;
}
}
if(!bootcompleted && !strncmp(c, "!@Boot_SystemServer: ", 21)){
struct systemserver_init_time_entry *entry;
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
@ -148,7 +200,11 @@ void sec_bootstat_add(const char *c)
sec_bootstat_get_thermal(boot_events[i].temp);
}
// careful check bootcomplete message index 9
if(i == 9) bootcompleted = true;
if(i == 9) {
bootcompleted = true;
boot_complete_time = local_clock();
do_div(boot_complete_time, 1000000);
}
break;
}
}
@ -218,11 +274,51 @@ static int sec_boot_stat_proc_show(struct seq_file *m, void *v)
return 0;
}
static int sec_enhanced_boot_stat_proc_show(struct seq_file *m, void *v)
{
size_t i = 0;
unsigned int last_time = 0;
struct enhanced_boot_time *entry;
seq_printf(m, "%-90s %6s %6s %6s %4s %4s\n", "Boot Events", "time", "ktime", "delta", "f_c0", "f_c1");
seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------\n");
seq_puts(m, "BOOTLOADER - KERNEL\n");
seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------\n");
seq_printf(m, "%-90s %6u %6u %6u\n", "MCT is initialized in bl2", 0, 0, 0);
seq_printf(m, "%-90s %6u %6u %6u\n", "start kernel timer", mct_start, 0, mct_start);
for (i = 0; i < ARRAY_SIZE(boot_initcall); i++) {
seq_printf(m, "%-90s %6u %6u %6u %4d %4d\n", boot_initcall[i].string, boot_initcall[i].time + mct_start, boot_initcall[i].time,
boot_initcall[i].time - last_time, boot_initcall[i].freq[0] / 1000, boot_initcall[i].freq[1] / 1000);
last_time = boot_initcall[i].time;
}
seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------\n");
seq_puts(m, "FRAMEWORK\n");
seq_puts(m, "-----------------------------------------------------------------------------------------------------------------------\n");
list_for_each_entry_reverse (entry, &enhanced_boot_time_list, next){
if (entry->buf[0] == '!') {
seq_printf(m, "%-90s %6u %6u %6u %4d %4d\n", entry->buf, entry->time + mct_start, entry->time, entry->time - last_time,
entry->freq[0] / 1000, entry->freq[1] / 1000);
last_time = entry->time;
}
else {
seq_printf(m, "%-90s %6u %6u %11d %4d\n", entry->buf, entry->time + mct_start, entry->time, entry->freq[0] / 1000, entry->freq[1] / 1000);
}
}
return 0;
}
static int sec_boot_stat_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, sec_boot_stat_proc_show, NULL);
}
static int sec_enhanced_boot_stat_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, sec_enhanced_boot_stat_proc_show, NULL);
}
static const struct file_operations sec_boot_stat_proc_fops = {
.open = sec_boot_stat_proc_open,
.read = seq_read,
@ -230,11 +326,30 @@ static const struct file_operations sec_boot_stat_proc_fops = {
.release = single_release,
};
static const struct file_operations sec_enhanced_boot_stat_proc_fops = {
.open = sec_enhanced_boot_stat_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static ssize_t store_boot_stat(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long long t = 0;
// Collect Boot_EBS from native side
if (!ebs_finished && events_ebs < MAX_EVENTS_EBS) {
if (!strncmp(buf, "!@Boot_EBS: ", 12)) {
sec_enhanced_boot_stat_record(buf + 12);
return count;
}
else if (!strncmp(buf, "!@Boot_EBS_", 11)) {
sec_enhanced_boot_stat_record(buf);
return count;
}
}
if (!strncmp(buf, "!@Boot: start init process", 26)) {
t = local_clock();
do_div(t, 1000000);
@ -251,6 +366,7 @@ static DEVICE_ATTR(boot_stat, 0220, NULL, store_boot_stat);
static int __init sec_bootstat_init(void)
{
struct proc_dir_entry *entry;
struct proc_dir_entry *enhanced_entry;
struct device *dev;
u32 arch_timer_rate;
@ -265,6 +381,9 @@ static int __init sec_bootstat_init(void)
entry = proc_create("boot_stat", S_IRUGO, NULL, &sec_boot_stat_proc_fops);
if (!entry)
return -ENOMEM;
enhanced_entry = proc_create("enhanced_boot_stat", S_IRUGO, NULL, &sec_enhanced_boot_stat_proc_fops);
if (!enhanced_entry)
return -ENOMEM;
// sysfs
dev = sec_device_create(NULL, "bsp");

View file

@ -1,14 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/s6e3ha6/self_clk_default_niddle.h
*
* Header file for S6E3HA6 Dimming Driver
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* 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.
*/
*/
#ifndef __LIVE_CLK_IMGE_DEFAULT_H__
#define __LIVE_CLK_IMGE_DEFAULT_H__

View file

@ -1,14 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/s6e3ha6/self_clk_default_niddle.h
*
* Header file for S6E3HA6 Dimming Driver
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* 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.
*/
*/
#ifndef __LIVE_CLK_IMG_WHITE_H__
#define __LIVE_CLK_IMG_WHITE_H__

View file

@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Samsung's Active Clock Driver
* Copyright (c) Samsung Electronics Co., Ltd.
* Author: Minwoo Kim <minwoo7945.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -29,7 +27,7 @@ static int check_need_update(struct panel_device *panel,
int ret = 0;
struct panel_state *state;
if (!panel || !act_info|| !ioctl_info) {
if (!panel || !act_info || !ioctl_info) {
panel_err("LIVE-CLK:ERR:%s:invalid argument\n", __func__);
return -1;
}
@ -46,9 +44,9 @@ static int check_need_update(struct panel_device *panel,
(act_info->time_min != ioctl_info->time_min) ||
(act_info->time_sec != ioctl_info->time_sec) ||
(act_info->time_ms != ioctl_info->time_ms)) {
if (state->cur_state == PANEL_STATE_ALPM) {
if (state->cur_state == PANEL_STATE_ALPM)
act_info->update_time = 1;
}
ret = 1;
}
if (act_info->interval != ioctl_info->interval)
@ -66,7 +64,7 @@ static int check_need_update(struct panel_device *panel,
panel_info("ACT-CLK:En : %d\n", act_info->en);
panel_info("ACT-CLK:Axis:x:%d,y:%d\n", act_info->pos_x,
act_info->pos_y);
panel_info("ACT-CLK:Time::%d:%d:%d:%d\n",act_info->time_hr,
panel_info("ACT-CLK:Time::%d:%d:%d:%d\n", act_info->time_hr,
act_info->time_min, act_info->time_sec, act_info->time_ms);
panel_info("ACT-CLK:Interval : %d\n", act_info->interval);
@ -75,7 +73,7 @@ static int check_need_update(struct panel_device *panel,
static int set_active_clock(struct act_clock_dev *act_dev, void __user *arg)
{
int ret= 0;
int ret = 0;
int need_update = 0;
struct panel_device *panel;
struct panel_state *state;
@ -90,7 +88,7 @@ static int set_active_clock(struct act_clock_dev *act_dev, void __user *arg)
goto set_exit;
}
if (copy_from_user(&ioctl_info,(struct ioctl_act_clk __user *)arg,
if (copy_from_user(&ioctl_info, (struct ioctl_act_clk __user *)arg,
sizeof(struct ioctl_act_clk))) {
panel_err("LIVE-CLK:ERR:%s:failed to copy from user's active param\n", __func__);
goto set_exit;
@ -114,26 +112,25 @@ static int set_active_clock(struct act_clock_dev *act_dev, void __user *arg)
if ((act_info->en == 1) &&
(act_info->update_img == IMG_UPDATE_NEED)) {
panel_info("PANEL:INFO:%s:Update Active Clock image \n", __func__);
panel_info("PANEL:INFO:%s:Update Active Clock image\n", __func__);
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_IMG_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("ACT-CLK:ERR:%s, failed to write init seqtbl\n", __func__);
}
act_info->update_img = IMG_UPDATE_DONE;
}
if (act_info->update_time) {
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_UPDATE_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("ACT-CLK:ERR:%s, failed to write init seqtbl\n", __func__);
}
act_info->update_time = 0;
} else {
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_CTRL_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("ACT-CLK:ERR:%s, failed to write init seqtbl\n", __func__);
}
}
set_exit:
return 0;
@ -170,7 +167,7 @@ static int set_self_drawer(struct act_clock_dev *act_dev, void __user *arg)
goto set_exit;
}
if (copy_from_user(&ioctl_info,(struct ioctl_self_drawer __user *)arg,
if (copy_from_user(&ioctl_info, (struct ioctl_self_drawer __user *)arg,
sizeof(struct ioctl_self_drawer))) {
panel_err("LIVE-CLK:ERR:%s:failed to copy from user's active param\n", __func__);
goto set_exit;
@ -215,12 +212,12 @@ static long active_clock_ioctl(struct file *file, unsigned int cmd, unsigned lon
mutex_lock(&panel->io_lock);
switch (cmd) {
case IOCTL_ACT_CLK :
case IOCTL_ACT_CLK:
panel_info("ACT-CLK:INFO:%s:IOCTL_ACT_CLK\n", __func__);
ret = set_active_clock(act_dev, (void __user *)arg);
break;
case IOCTL_BLINK_CLK :
case IOCTL_BLINK_CLK:
panel_info("ACT-CLK:INFO:%s:IOCTL_BLINK_CLK\n", __func__);
if (copy_from_user(&ioctl_blink, (struct ioctl_blink_clock __user *)arg,
sizeof(struct ioctl_blink_clock))) {
@ -240,7 +237,6 @@ static long active_clock_ioctl(struct file *file, unsigned int cmd, unsigned lon
panel_err("ACT-CLK:ERR:%s : invalid cmd : %d\n", __func__, cmd);
ret = -EINVAL;
goto exit_ioctl;
}
exit_ioctl:
@ -366,7 +362,7 @@ int probe_live_clock_drv(struct act_clock_dev *act_dev)
struct act_drawer_info *draw_info;
if (act_dev == NULL) {
panel_err("LIVE-CLK:ERR:%s: invalid live clk \n", __func__);
panel_err("LIVE-CLK:ERR:%s: invalid live clk\n", __func__);
return -EINVAL;
}
act_dev->dev.minor = MISC_DYNAMIC_MINOR;
@ -406,9 +402,9 @@ int probe_live_clock_drv(struct act_clock_dev *act_dev)
blink_info->interval = 5;
blink_info->radius = 10;
blink_info->color = 0x000000;
blink_info->line_width = 0;;
blink_info->line_width = 0;
blink_info->pos1_x = 0;
blink_info->pos1_y = 0 ;
blink_info->pos1_y = 0;
blink_info->pos2_x = 0;
blink_info->pos2_y = 0;

View file

@ -1,8 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Samsung's Live Clock Driver
* Copyright (c) Samsung Electronics Co., Ltd.
* Author: Minwoo Kim <minwoo7945.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/copr.c
*
* Samsung Common LCD COPR Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* 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
@ -818,16 +815,6 @@ static int copr_fb_notifier_callback(struct notifier_block *self,
if (unlikely(!copr->props.support))
return 0;
#if 0
if (fb_blank == FB_BLANK_UNBLANK) {
if (!early_blank)
copr_enable(copr);
} else if (fb_blank == FB_BLANK_POWERDOWN) {
if (early_blank)
copr_disable(copr);
}
#endif
return 0;
}

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/copr.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -177,16 +174,16 @@ static inline void SET_COPR_REG_RE(struct copr_info *copr, bool cnt_re)
}
#ifdef CONFIG_EXYNOS_DECON_LCD_COPR
bool copr_is_enabled(struct copr_info *);
int copr_enable(struct copr_info *);
int copr_disable(struct copr_info *);
int copr_update_start(struct copr_info *, int);
bool copr_is_enabled(struct copr_info *copr);
int copr_enable(struct copr_info *copr);
int copr_disable(struct copr_info *copr);
int copr_update_start(struct copr_info *copr, int count);
int copr_update_average(struct copr_info *copr);
int copr_get_value(struct copr_info *);
int copr_get_average(struct copr_info *, int *, int *);
int copr_get_value(struct copr_info *copr);
//int copr_get_average(struct copr_info *, int *, int *);
int copr_get_average_and_clear(struct copr_info *copr);
int copr_roi_get_value(struct copr_info *copr, struct copr_roi *roi, int size, u32 *out);
int copr_probe(struct panel_device *, struct panel_copr_data *);
int copr_probe(struct panel_device *panel, struct panel_copr_data *copr_data);
int copr_res_update(struct copr_info *copr, int index, int cur_value, struct timespec cur_ts);
#else
static inline bool copr_is_enabled(struct copr_info *copr) { return 0; }

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/dimming_gamma.h
*
* Header file for Samsung AID Dimming Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/dpui.c
*
* Samsung Common LCD DPUI(display use info) LOGGING Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* 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
@ -270,7 +267,7 @@ static int __get_dpui_u32_field(enum dpui_key key, u32 *value)
return -EINVAL;
}
rc = kstrtouint(dpui.field[key].buf, (unsigned int)0, &cur_val);
rc = kstrtouint(dpui.field[key].buf, 0, &cur_val);
if (rc < 0) {
pr_err("%s failed to get value\n", __func__);
return rc;

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/dpui.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/mdnie.c
*
* Samsung Common LCD mDNIe Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* 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
@ -394,7 +391,7 @@ static void mdnie_coordinate_tune_rgb(struct mdnie_info *mdnie, int x, int y, u8
((res[c][RGB_01] * (1024 - tune_x) + (res[c][RGB_11] * tune_x)) * tune_y)) + (1L << 19)) >> 20;
}
}
panel_info("coord (x:%4d y:%4d Q%d compV:%8lld compH:%8lld) "
panel_info("coord (x:%4d y:%4d Q%d compV:%8lld compH:%8lld)\t"
"tune_coord (%4d %4d) tune_rgb[ADT] (%3d %3d %3d) tune_rgb[D65] (%3d %3d %3d)\n",
x, y, area + 1, result[H_LINE], result[V_LINE], tune_x, tune_y,
tune_rgb[WCRD_TYPE_ADAPTIVE][0], tune_rgb[WCRD_TYPE_ADAPTIVE][1],

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/mdnie.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -523,7 +520,7 @@ static inline int mdnie_disable(struct mdnie_info *mdnie) { return 0; }
static inline int mdnie_update(struct mdnie_info *mdnie) { return 0; }
#endif
extern struct maptbl *mdnie_find_maptbl(struct mdnie_info *);
extern struct maptbl *mdnie_find_etc_maptbl(struct mdnie_info *, int);
extern int mdnie_get_maptbl_index(struct mdnie_info *);
extern ssize_t attr_store_for_each(struct class *, const char *, const char *, size_t);
extern struct maptbl *mdnie_find_etc_maptbl(struct mdnie_info *mdnie, int index);
extern int mdnie_get_maptbl_index(struct mdnie_info *mdnie);
extern ssize_t attr_store_for_each(struct class *cls, const char *name, const char *buf, size_t size);
#endif /* __MDNIE_H__ */

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/panel.c
*
* Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -424,6 +421,7 @@ int maptbl_getidx(struct maptbl *tbl)
u8 *maptbl_getptr(struct maptbl *tbl)
{
int index = maptbl_getidx(tbl);
if (unlikely(index < 0)) {
pr_err("%s, failed to get index\n", __func__);
return NULL;
@ -450,8 +448,8 @@ void maptbl_memcpy(struct maptbl *dst, struct maptbl *src)
if (!dst || !src || dst->nlayer != src->nlayer ||
dst->nrow != src->nrow || dst->ncol != src->ncol) {
pr_err("%s failed to copy from:%s to:%s size:%d\n",
__func__, (!src || !src->name ) ? "" : src->name,
(!dst || !dst->name ) ? "" : dst->name,
__func__, (!src || !src->name) ? "" : src->name,
(!dst || !dst->name) ? "" : dst->name,
(!dst) ? 0 : sizeof_maptbl(dst));
return;
}
@ -742,11 +740,10 @@ int panel_verify_tx_packet(struct panel_device *panel, u8 *table, u8 len)
return -EINVAL;
}
if (!IS_PANEL_ACTIVE(panel)) {
if (!IS_PANEL_ACTIVE(panel))
return 0;
}
buf = kzalloc(sizeof(u8) * len, GFP_KERNEL);
buf = kcalloc(len, sizeof(u8), GFP_KERNEL);
if (!buf) {
pr_err("%s, failed to alloc memory\n", __func__);
return -ENOMEM;
@ -1138,6 +1135,7 @@ struct resinfo *find_panel_resource(struct panel_info *panel_data, char *name)
bool panel_resource_initialized(struct panel_info *panel_data, char *name)
{
struct resinfo *res = find_panel_resource(panel_data, name);
if (unlikely(!res)) {
panel_err("%s, %s not found in resource\n",
__func__, name);
@ -1379,9 +1377,8 @@ int read_panel_id(struct panel_device *panel, u8 *buf)
return -EINVAL;
}
if (!IS_PANEL_ACTIVE(panel)) {
if (!IS_PANEL_ACTIVE(panel))
return -ENODEV;
}
mutex_lock(&panel->op_lock);
len = panel_rx_nbytes(panel, DSI_PKT_TYPE_RD, buf, PANEL_ID_REG, 0, 3);
@ -1416,9 +1413,8 @@ int panel_rdinfo_update(struct panel_device *panel, struct rdinfo *rdi)
return -EINVAL;
}
if (rdi->data)
kfree(rdi->data);
rdi->data = kzalloc(sizeof(u8) * rdi->len, GFP_KERNEL);
rdi->data = kcalloc(rdi->len, sizeof(u8), GFP_KERNEL);
#ifdef CONFIG_SUPPORT_DDI_FLASH
if (rdi->type == DSI_PKT_TYPE_RD_POC)

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/panel.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -80,14 +77,6 @@ enum {
struct maptbl;
struct mdnie_info;
struct common_panel_ops {
int (*tx_cmds)(struct panel_info *, const void *, int);
int (*rx_cmds)(struct panel_info *, u8 *, const void *, int);
#if CONFIG_OF
int (*parse_dt)(const struct device_node *);
#endif
};
/*
* [command types]
* 1. delay

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/panel_bl.c
*
* Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -35,9 +32,7 @@ static void print_tbl(int *tbl, int sz)
}
}
#else
static void print_tbl(int *tbl, int sz) {
return;
}
static void print_tbl(int *tbl, int sz) {}
#endif
static int max_brt_tbl(struct brightness_table *brt_tbl)
@ -542,7 +537,7 @@ int aor_interpolation(unsigned int *brt_tbl, unsigned int *lum_tbl,
u64 upper_lum, lower_lum;
u64 upper_brt, lower_brt;
u64 upper_aor, lower_aor, aor;
u64 upper_aor_ratio, lower_aor_ratio, aor_ratio;
u64 upper_aor_ratio, lower_aor_ratio, aor_ratio = 0;
u64 intrp_brt = 0, vbase_lum = 0;
enum DIMTYPE dimtype;
@ -678,7 +673,7 @@ int panel_bl_set_brightness(struct panel_bl_device *panel_bl, int id, int force)
int ret = 0, ilum = 0, luminance = 0, brightness, index = PANEL_SET_BL_SEQ, step;
struct panel_bl_sub_dev *subdev;
struct panel_device *panel;
int luminance_interp;
int luminance_interp = 0;
if (panel_bl == NULL) {
panel_err("PANEL:ERR:%s:panel is null\n", __func__);

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/panel_bl.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -106,11 +103,6 @@ struct brightness_table {
u32 vtotal;
};
struct panel_bl_ops {
int (*set_brightness)(void *, int level);
int (*get_brightness)(void *);
};
enum panel_bl_hw_type {
PANEL_BL_HW_TYPE_TFT,
PANEL_BL_HW_TYPE_OCTA,
@ -157,7 +149,6 @@ struct panel_bl_device {
struct backlight_device *bd;
void *bd_data;
struct mutex ops_lock;
const struct panel_bl_ops *ops;
struct mutex lock;
struct panel_bl_properties props;
struct panel_bl_sub_dev subdev[MAX_PANEL_BL_SUBDEV];
@ -169,19 +160,19 @@ struct panel_bl_device {
};
int panel_bl_probe(struct panel_device *panel);
int panel_bl_set_brightness(struct panel_bl_device *, int, int);
int get_max_brightness(struct panel_bl_device *);
int get_brightness_pac_step(struct panel_bl_device *, int);
int panel_bl_set_brightness(struct panel_bl_device *panel_bl, int id, int force);
int get_max_brightness(struct panel_bl_device *panel_bl);
int get_brightness_pac_step(struct panel_bl_device *panel_bl, int brightness);
int get_brightness_of_brt_to_step(struct panel_bl_device *panel_bl, int id, int brightness);
int get_actual_brightness(struct panel_bl_device *, int);
int get_subdev_actual_brightness(struct panel_bl_device *, int, int);
int get_actual_brightness_index(struct panel_bl_device *, int);
int get_actual_brightness(struct panel_bl_device *panel_bl, int brightness);
int get_subdev_actual_brightness(struct panel_bl_device *panel_bl, int id, int brightness);
int get_actual_brightness_index(struct panel_bl_device *panel_bl, int brightness);
int get_subdev_actual_brightness_index(struct panel_bl_device *panel_bl,
int id, int brightness);
int get_actual_brightness_interpolation(struct panel_bl_device *, int);
int get_subdev_actual_brightness_interpolation(struct panel_bl_device *, int, int);
int panel_bl_get_acl_pwrsave(struct panel_bl_device *);
int panel_bl_get_acl_opr(struct panel_bl_device *);
int get_actual_brightness_interpolation(struct panel_bl_device *panel_bl, int brightness);
int get_subdev_actual_brightness_interpolation(struct panel_bl_device *panel_bl, int id, int brightness);
int panel_bl_get_acl_pwrsave(struct panel_bl_device *panel_bl);
int panel_bl_get_acl_opr(struct panel_bl_device *panel_bl);
bool is_hbm_brightness(struct panel_bl_device *panel_bl, int brightness);
bool is_ext_hbm_brightness(struct panel_bl_device *panel_bl, int brightness);
int panel_bl_set_subdev(struct panel_bl_device *panel_bl, int id);
@ -190,12 +181,12 @@ int panel_bl_update_average(struct panel_bl_device *panel_bl, size_t index);
int panel_bl_clear_average(struct panel_bl_device *panel_bl, size_t index);
int panel_bl_get_average_and_clear(struct panel_bl_device *panel_bl, size_t index);
int aor_interpolation(unsigned int *brt_tbl, unsigned int *lum_tbl,
u8(*aor_tbl)[2], int size, int size_ui_lum, u32 vtotal, int brightness);
u8 (*aor_tbl)[2], int size, int size_ui_lum, u32 vtotal, int brightness);
int panel_bl_aor_interpolation(struct panel_bl_device *panel_bl,
int id, u8(*aor_tbl)[2]);
int irc_interpolation(unsigned int *brt_tbl, unsigned int *lum_tbl,
u8(*irc_tbl)[MAX_IRC_PARAM], int size, int size_ui_lum,
u8 (*irc_tbl)[MAX_IRC_PARAM], int size, int size_ui_lum,
u8 *dst, int brightness);
int panel_bl_irc_interpolation(struct panel_bl_device *panel_bl, int id,
u8(*irc_tbl)[MAX_IRC_PARAM], u8 *dst);
u8 (*irc_tbl)[MAX_IRC_PARAM], u8 *dst);
#endif /* __PANEL_BL_H__ */

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/panel_dimming.h
*
* Header file for Samsung AID Dimming Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Samsung's Panel Driver
* Copyright (c) Samsung Electronics Co., Ltd.
* Author: Minwoo Kim <minwoo7945.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -61,7 +59,7 @@ static char *panel_state_names[] = {
"LPM", /* LPM */
};
static int boot_panel_id = 0;
static int boot_panel_id;
int panel_log_level = 6;
#ifdef CONFIG_SUPPORT_PANEL_SWAP
static int connect_panel = PANEL_CONNECT;
@ -99,7 +97,6 @@ int get_lcd_info(char *arg)
else
return -EINVAL;
}
EXPORT_SYMBOL(get_lcd_info);
void clear_disp_det_pend(struct panel_device *panel)
@ -112,8 +109,6 @@ void clear_disp_det_pend(struct panel_device *panel)
pend_disp_det = pend_disp_det & ~(pad->pend_bit_disp_det);
writel(pend_disp_det, pad->pend_reg_disp_det);
}
return;
}
#define SSD_CURRENT_DOZE 8000
@ -153,9 +148,9 @@ int __set_panel_power(struct panel_device *panel, int power)
}
}
#ifndef CONFIG_OLD_DISP_TIMING
usleep_range(10000, 10000);
usleep_range(10000, 10000 + 10);
gpio_direction_output(pad->gpio_reset, 1);
usleep_range(5000, 5000);
usleep_range(5000, 5000 + 10);
#endif
} else {
gpio_direction_output(pad->gpio_reset, 0);
@ -188,9 +183,9 @@ int __panel_seq_display_on(struct panel_device *panel)
int ret = 0;
ret = panel_do_seqtbl_by_index(panel, PANEL_DISPLAY_ON_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
return ret;
}
@ -200,9 +195,9 @@ int __panel_seq_display_off(struct panel_device *panel)
int ret;
ret = panel_do_seqtbl_by_index(panel, PANEL_DISPLAY_OFF_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
return ret;
}
@ -267,7 +262,7 @@ static int __panel_seq_init(struct panel_device *panel)
check_disp_det:
if (gpio_get_value(disp_det) == PANEL_DISP_DET_LOW) {
usleep_range(100, 100);
usleep_range(100, 100 + 10);
if (retry--)
goto check_disp_det;
goto do_exit;
@ -399,7 +394,7 @@ static void __delay_normal_alpm(struct panel_device *panel)
goto exit_delay;
delaycmd = (struct delayinfo *)seqtbl->cmdtbl[0];
if(delaycmd == NULL) {
if (delaycmd == NULL) {
panel_info("PANEL:INFO:%s: no delay\n", __func__);
goto exit_delay;
}
@ -414,7 +409,7 @@ static void __delay_normal_alpm(struct panel_device *panel)
goto exit_delay;
delay = delaycmd->usec - gap;
usleep_range(delay, delay);
usleep_range(delay, delay + 10);
}
panel_info("PANEL:INFO:%stotal elapsed time : %d\n", __func__,
(int)ktime_to_us(ktime_sub(ktime_get(), panel->ktime_panel_on)));
@ -503,28 +498,26 @@ static int __panel_seq_active_clock(struct panel_device *panel, int send_img)
if (act_info->update_img == IMG_UPDATE_NEED) {
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_IMG_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
act_info->update_img = IMG_UPDATE_DONE;
}
}
usleep_range(5, 5);
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_CTRL_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
}
if (blink_info->en) {
panel_dbg("PANEL:DBG:%s:active blink was enabed\n", __func__);
ret = panel_do_seqtbl_by_index(panel, PANEL_ACTIVE_CLK_CTRL_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
}
return ret;
}
#endif
@ -534,9 +527,8 @@ static int __panel_seq_dump(struct panel_device *panel)
int ret;
ret = panel_do_seqtbl_by_index(panel, PANEL_DUMP_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write dump seqtbl\n", __func__);
}
return ret;
}
@ -996,9 +988,10 @@ int panel_probe(struct panel_device *panel)
}
#ifdef CONFIG_EXYNOS_DECON_LCD_SPI
/* TODO : move to parse dt function
1. get panel_spi device node.
2. get spi_device of node
/*
* TODO : move to parse dt function
* 1. get panel_spi device node.
* 2. get spi_device of node
*/
panel->spi = of_find_panel_spi_by_node(NULL);
if (!panel->spi)
@ -1311,7 +1304,7 @@ retry_sleep_out:
if (ret) {
if (--retry >= 0 && ret == -EAGAIN) {
panel_power_off(panel);
usleep_range(100000, 100000);
usleep_range(100000, 100000 + 10);
goto retry_sleep_out;
} else {
#ifdef CONFIG_SUPPORT_PANEL_SWAP
@ -1548,9 +1541,8 @@ int panel_set_dsu(struct panel_device *panel, struct dsu_info *dsu)
lcd_info->dsc_slice_h = dt_lcd_mres->res_info[actual_mode].dsc_height;
ret = panel_do_seqtbl_by_index(panel, PANEL_DSU_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s, failed to write init seqtbl\n", __func__);
}
return 0;
@ -1634,9 +1626,10 @@ static int panel_ioctl_set_power(struct panel_device *panel, void *arg)
static int panel_ioctl_set_reset(struct panel_device *panel)
{
struct panel_pad *pad = &panel->pad;
usleep_range(10000, 10000);
usleep_range(10000, 10000 + 10);
gpio_direction_output(pad->gpio_reset, 1);
usleep_range(5000, 5000);
usleep_range(5000, 5000 + 10);
pr_info("%s reset panel (%s)\n", __func__, gpio_get_value(pad->gpio_reset) ? "high" : "low");
return 0;
@ -1718,7 +1711,7 @@ static int panel_set_finger_layer(struct panel_device *panel, void *arg)
mutex_lock(&panel_bl->lock);
mutex_lock(&panel->op_lock);
if(*cmd == 0) {
if (*cmd == 0) {
panel_info("PANEL:INFO:%s:disable finger layer\n", __func__);
panel_bl->finger_layer = false;
panel_bl->subdev[PANEL_BL_SUBDEV_TYPE_DISP].brightness = panel_bl->saved_br;
@ -1730,9 +1723,8 @@ static int panel_set_finger_layer(struct panel_device *panel, void *arg)
}
ret = panel_bl_set_brightness(panel_bl, PANEL_BL_SUBDEV_TYPE_DISP, 1);
if (ret) {
if (ret)
pr_err("%s : fail to set brightness\n", __func__);
}
panel_info("- %s\n", __func__);
@ -1749,7 +1741,7 @@ static long panel_core_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg
mutex_lock(&panel->io_lock);
switch(cmd) {
switch (cmd) {
case PANEL_IOC_DSIM_PROBE:
ret = panel_ioctl_dsim_probe(sd, arg);
break;
@ -1790,7 +1782,7 @@ static long panel_core_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg
panel_info("PANEL:INFO:%s:PANEL_IOC_PANEL_RESET\n", __func__);
ret = panel_ioctl_set_reset(panel);
break;
case PANEL_IOC_PANEL_DUMP :
case PANEL_IOC_PANEL_DUMP:
panel_info("PANEL:INFO:%s:PANEL_IOC_PANEL_DUMP\n", __func__);
ret = panel_debug_dump(panel);
break;
@ -1842,7 +1834,6 @@ static long panel_core_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg
panel_err("PANEL:ERR:%s:undefined command\n", __func__);
ret = -EINVAL;
break;
}
if (ret) {
@ -1949,9 +1940,10 @@ static int panel_drv_set_gpios(struct panel_device *panel)
return 0;
}
static inline int panel_get_gpio(struct device *dev ,char *name)
static inline int panel_get_gpio(struct device *dev, char *name)
{
int ret = 0;
ret = of_gpio_named_count(dev->of_node, name);
if (ret != 1) {
panel_err("PANEL:ERR:%s:can't find gpio named : %s\n",
@ -1997,8 +1989,7 @@ static int panel_parse_gpio(struct panel_device *panel)
pend_disp_det = of_get_child_by_name(dev->of_node, "pend,disp-det");
if (!pend_disp_det) {
panel_warn("PANEL:WARN:%s:No DT node for te_eint\n", __func__);
}
else {
} else {
pad->pend_reg_disp_det = of_iomap(pend_disp_det, 0);
if (!pad->pend_reg_disp_det) {
panel_err("PANEL:ERR:%s:failed to get disp pend reg\n", __func__);
@ -2006,7 +1997,7 @@ static int panel_parse_gpio(struct panel_device *panel)
}
of_property_read_u32(pend_disp_det, "pend-bit",
&pad->pend_bit_disp_det);
panel_info("PANEL:INFO:%s:pend bit disp_det %x\n",\
panel_info("PANEL:INFO:%s:pend bit disp_det %x\n",
__func__, pad->pend_bit_disp_det);
panel_info("PANEL:INFO:%s:disp_det pend : %x\n",
__func__, readl(pad->pend_reg_disp_det));
@ -2116,9 +2107,8 @@ int panel_register_isr(struct panel_device *panel)
int ret = 0;
struct panel_pad *pad = &panel->pad;
if (panel->state.connect_panel == PANEL_DISCONNECT) {
if (panel->state.connect_panel == PANEL_DISCONNECT)
return 0;
}
clear_disp_det_pend(panel);
if (pad->gpio_disp_det) {
@ -2333,8 +2323,8 @@ static int panel_parse_panel_lookup(struct panel_device *panel)
sz_lut = of_property_count_u32_elems(np, "panel-lut");
if ((sz_lut % 3) || (sz_lut >= MAX_PANEL_LUT)) {
panel_warn("PANEL:WARN:%s:sz_lut(%d) should be multiple of 3"
" and less than MAX_PANEL_LUT\n", __func__, sz_lut);
panel_warn("PANEL:WARN:%s:sz_lut(%d) should be multiple of 3 and less than MAX_PANEL_LUT\n",
__func__, sz_lut);
return -EINVAL;
}
@ -2423,8 +2413,6 @@ void disp_det_handler(struct work_struct *data)
default:
break;
}
return;
}
static int panel_fb_notifier(struct notifier_block *self, unsigned long event, void *data)
@ -2442,7 +2430,6 @@ static int panel_fb_notifier(struct notifier_block *self, unsigned long event, v
return 0;
default:
return 0;
}
panel = container_of(self, struct panel_device, fb_notif);
@ -2614,11 +2601,7 @@ static int panel_drv_probe(struct platform_device *pdev)
#ifdef CONFIG_SUPPORT_HMD
panel->state.hmd_on = PANEL_HMD_OFF;
#endif
#if 0
#ifdef CONFIG_SUPPORT_DSU
panel->lcd_info.mres_mode = DSU_MODE_1;
#endif
#endif
#ifdef CONFIG_ACTIVE_CLOCK
panel->act_clk_dev.act_info.update_img = IMG_UPDATE_NEED;
#endif
@ -2708,7 +2691,7 @@ static int __init get_boot_panel_id(char *arg)
early_param("lcdtype", get_boot_panel_id);
static int __init panel_drv_init (void)
static int __init panel_drv_init(void)
{
return platform_driver_register(&panel_driver);
}

View file

@ -1,8 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Samsung's Panel Driver
* Copyright (c) Samsung Electronics Co., Ltd.
* Author: Minwoo Kim <minwoo7945.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -127,7 +125,7 @@ struct mipi_drv_ops {
int (*read)(u32 id, u8 addr, u8 ofs, u8 *buf, int size);
int (*write)(u32 id, u8 cmd_id, const u8 *cmd, u8 ofs, int size);
enum dsim_state(*get_state)(u32 id);
void (*parse_dt)(struct device_node *, struct decon_lcd *);
void (*parse_dt)(struct device_node *node, struct decon_lcd *lcd_info);
};
#define PANEL_INIT_KERNEL 0

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/panel_poc.c
*
* Samsung Common LCD Driver.
*
* Copyright (c) 2017 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
@ -302,12 +299,10 @@ int poc_write_data(struct panel_device *panel, u8 *data, u32 addr, u32 size)
}
poc_info->wdata = data[i];
if (i == 0 || i == (size - 1) || (poc_addr & 0xFF) == 0 || (poc_addr & 0xFF) == 0xFF) {
if (i == 0 || i == (size - 1) || (poc_addr & 0xFF) == 0 || (poc_addr & 0xFF) == 0xFF)
ret = panel_do_poc_seqtbl_by_index_nolock(poc_dev, POC_WRITE_DAT_STT_END_SEQ);
}
else {
else
ret = panel_do_poc_seqtbl_by_index_nolock(poc_dev, POC_WRITE_DAT_SEQ);
}
if (unlikely(ret < 0)) {
pr_err("%s, failed to write poc-wr-img seq\n", __func__);

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/panel_poc.h
*
* Samsung Common LCD Driver.
*
* Copyright (c) 2017 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -454,6 +454,9 @@ static DEFINE_STATIC_PACKET(s6e3ha8_aod_init_side_ram, DSI_PKT_TYPE_WR, S6E3HA8_
// --------------------- Image for analog clock ---------------------
static DEFINE_PANEL_MDELAY(s6e3ha8_aod_init_side_ram_delay, 34);
static char S6E3HA8_AOD_ANALOG_SD_PATH[] = {
0x75,
0x01,
@ -464,6 +467,7 @@ static DEFINE_STATIC_PACKET(s6e3ha8_aod_analog_img, DSI_PKT_TYPE_WR_SR, STAR_ANA
static void *s6e3ha8_aod_analog_img_cmdtbl[] = {
&KEYINFO(s6e3ha8_aod_level2_key_enable),
&PKTINFO(s6e3ha8_aod_init_side_ram),
&DLYINFO(s6e3ha8_aod_init_side_ram_delay),
&PKTINFO(s6e3ha8_aod_analog_sd_path),
&PKTINFO(s6e3ha8_aod_analog_img),
&KEYINFO(s6e3ha8_aod_level2_key_disable),
@ -838,7 +842,7 @@ static struct seqinfo s6e3ha8_aod_seqtbl[MAX_AOD_SEQ] = {
[ICON_GRID_OFF_SEQ] = SEQINFO_INIT("icon_grid_off", s6e3ha8_aod_icon_grid_off_cmdtbl),
[SET_TIME_SEQ] = SEQINFO_INIT("SET_TIME", s6e3ha8_aod_set_time_cmdtbl),
#ifdef SUPPORT_NORMAL_SELFMOVE
[ENABLE_SELFMOVE_SEQ] = SEQINFO_INIT( "enable_self_move", s6e3ha8_enable_selfmove),
[ENABLE_SELFMOVE_SEQ] = SEQINFO_INIT("enable_self_move", s6e3ha8_enable_selfmove),
[DISABLE_SELFMOVE_SEQ] = SEQINFO_INIT("disable_self", s6e3ha8_disable_selfmove),
#endif
};

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/spi.c
*
* Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* JiHoon Kim <jihoonn.kim@samsung.com>
* Gwanghui Lee <gwanghui.lee@samsung.com>
@ -12,13 +9,14 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#if defined (CONFIG_OF)
#if defined(CONFIG_OF)
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#endif /* CONFIG_OF */

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/spi.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
*
* JiHoon Kim <jihoonn.kim@samsung.com>
* Gwanghui Lee <gwanghui.lee@samsung.com>
@ -12,13 +9,14 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __PANEL_SPI_H__
#define __PANEL_SPI_H__
#include <linux/spi/spi.h>
#include <linux/of_device.h>
int panel_spi_read_data(struct spi_device *, u8 , u8 *, int);
int panel_spi_write_data(struct spi_device *, const u8 *, int);
int panel_spi_read_data(struct spi_device *spi, u8 addr, u8 *buf, int size);
int panel_spi_write_data(struct spi_device *spi, const u8 *cmd, int size);
#ifdef CONFIG_OF
struct spi_device *of_find_panel_spi_by_node(struct device_node *node);
#else

View file

@ -1,15 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/sysfs.c
*
* Samsung MIPI-DSI Panel SYSFS driver.
*
* Copyright (c) 2016 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* JiHoon Kim <jihoonn.kim@samsung.com>
*
* 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.
*/
*/
#include <linux/ctype.h>
#include <linux/lcd.h>
@ -55,7 +52,7 @@ static ssize_t fingerprint_store(struct device *dev,
{
int rc;
rc = kstrtouint(buf, (unsigned int)0, &fingerprint_value);
rc = kstrtouint(buf, 0, &fingerprint_value);
if (rc < 0)
return rc;
@ -148,7 +145,7 @@ static ssize_t cell_id_show(struct device *dev,
resource_copy_by_name(panel_data, coordinate, "coordinate");
snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
date[0] , date[1], date[2], date[3], date[4], date[5], date[6],
date[0], date[1], date[2], date[3], date[4], date[5], date[6],
coordinate[0], coordinate[1], coordinate[2], coordinate[3]);
return strlen(buf);
@ -269,6 +266,7 @@ static ssize_t brightness_table_show(struct device *dev,
char recv_buf[50] = {0, };
int recv_buf_len = ARRAY_SIZE(recv_buf);
int max_brightness = 0;
if (panel == NULL) {
panel_err("PANEL:ERR:%s:panel is null\n", __func__);
return -EINVAL;
@ -295,7 +293,7 @@ static ssize_t brightness_table_show(struct device *dev,
}
prev_actual_brightness = actual_brightness;
prev_br = br;
if (PAGE_SIZE <= len) {
if (len >= PAGE_SIZE) {
pr_info("%s print buffer overflow %d\n", __func__, len);
len = PAGE_SIZE - 1;
goto exit;
@ -350,7 +348,7 @@ static ssize_t adaptive_control_store(struct device *dev,
return -EINVAL;
}
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -412,7 +410,7 @@ static ssize_t siop_enable_store(struct device *dev,
return -EINVAL;
}
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -536,7 +534,7 @@ static ssize_t read_mtp_store(struct device *dev,
pr_info("READ_Reg addr: %02x, pos : %d len : %d\n",
readreg, readpos, readlen);
for (i = 0; i < readlen; i++)
pr_info("READ_Reg %dth : %02x \n", i + 1, readbuf[i]);
pr_info("READ_Reg %dth : %02x\n", i + 1, readbuf[i]);
mutex_unlock(&sysfs_lock);
return size;
@ -580,7 +578,7 @@ static ssize_t mcd_mode_store(struct device *dev,
}
panel_data = &panel->panel_data;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -739,7 +737,7 @@ static ssize_t mcd_resistance_store(struct device *dev,
return -EINVAL;
}
panel_data = &panel->panel_data;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -881,7 +879,7 @@ static ssize_t mst_store(struct device *dev,
}
panel_data = &panel->panel_data;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -911,10 +909,9 @@ u8 checksum[4] = { 0x12, 0x34, 0x56, 0x78 };
static bool gct_chksum_is_valid(struct panel_device *panel)
{
int i;
struct panel_info *panel_data;
panel_data = &panel->panel_data;
struct panel_info *panel_data = &panel->panel_data;
for(i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
if (checksum[i] != panel_data->props.gct_valid_chksum)
return false;
return true;
@ -986,7 +983,7 @@ static ssize_t gct_store(struct device *dev,
panel_data = &panel->panel_data;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -1147,7 +1144,7 @@ static ssize_t xtalk_mode_store(struct device *dev,
return -EINVAL;
}
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -1302,9 +1299,8 @@ static ssize_t poc_mca_show(struct device *dev,
len = get_resource_size_by_name(&panel->panel_data, "poc_mca_chksum");
buf[0] = '\0';
for (i = 0; i < len; i++) {
for (i = 0; i < len; i++)
snprintf(buf, PAGE_SIZE, "%s%02X ", buf, chksum_data[i]);
}
dev_info(dev, "%s poc_mca_checksum: %s\n", __func__, buf);
@ -1349,9 +1345,8 @@ static ssize_t gamma_flash_show(struct device *dev,
else
ret = panel->dim_flash_work.ret;
pr_info("%s result %d, dim chksum(calc:%04X read:%04X), "
"mtp chksum(reg:%04X, calc:%04X, read:%04X)\n", __func__,
ret, result->dim_chksum_by_calc, result->dim_chksum_by_read,
pr_info("%s result %d, dim chksum(calc:%04X read:%04X), mtp chksum(reg:%04X, calc:%04X, read:%04X)\n",
__func__, ret, result->dim_chksum_by_calc, result->dim_chksum_by_read,
calc_checksum_16bit(result->mtp_reg, sizeof(result->mtp_reg)),
result->mtp_chksum_by_calc, result->mtp_chksum_by_read);
@ -1372,7 +1367,7 @@ static ssize_t gamma_flash_store(struct device *dev,
if (!IS_PANEL_ACTIVE(panel))
return -ENODEV;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -1425,7 +1420,7 @@ static ssize_t grayspot_store(struct device *dev,
}
panel_data = &panel->panel_data;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -1489,7 +1484,7 @@ static ssize_t hmt_bright_store(struct device *dev,
}
panel_bl = &panel->panel_bl;
rc = kstrtouint(buf, (unsigned int)0, &value);
rc = kstrtouint(buf, 0, &value);
if (rc < 0)
return rc;
@ -1499,9 +1494,8 @@ static ssize_t hmt_bright_store(struct device *dev,
mutex_lock(&panel_bl->lock);
mutex_lock(&panel->op_lock);
if (panel_bl->subdev[PANEL_BL_SUBDEV_TYPE_HMD].brightness != BRT(value)) {
if (panel_bl->subdev[PANEL_BL_SUBDEV_TYPE_HMD].brightness != BRT(value))
panel_bl->subdev[PANEL_BL_SUBDEV_TYPE_HMD].brightness = BRT(value);
}
if (panel->state.hmd_on != PANEL_HMD_ON) {
panel_info("PANEL:WARN:%s: hmd off\n", __func__);
@ -2270,13 +2264,13 @@ void ccb_set_mode(struct panel_device *panel, u8 ccb, int stepping)
dsim_write_hl_data(dsim, ccb_cmd, ARRAY_SIZE(ccb_cmd));
break;
case LCD_TYPE_S6E3HA3_WQHD:
if((ccb & 0x0F) == 0x00) { // off
if(stepping) {
if ((ccb & 0x0F) == 0x00) { // off
if (stepping) {
ccb_cmd[1] = dsim->priv.current_ccb;
for(secondval = 0x2A; secondval <= 0x3F; secondval += 1) {
for (secondval = 0x2A; secondval <= 0x3F; secondval += 1) {
ccb_cmd[2] = secondval;
dsim_write_hl_data(dsim, ccb_cmd, ARRAY_SIZE(ccb_cmd));
msleep(17);
usleep_range(17000, 17000 + 10);
}
}
ccb_cmd[1] = 0x00;
@ -2284,22 +2278,22 @@ void ccb_set_mode(struct panel_device *panel, u8 ccb, int stepping)
dsim_write_hl_data(dsim, ccb_cmd, ARRAY_SIZE(ccb_cmd));
} else { // on
ccb_cmd[1] = ccb;
if(stepping) {
for(secondval = 0x3F; secondval >= 0x2A; secondval -= 1) {
if (stepping) {
for (secondval = 0x3F; secondval >= 0x2A; secondval -= 1) {
ccb_cmd[2] = secondval;
dsim_write_hl_data(dsim, ccb_cmd, ARRAY_SIZE(ccb_cmd));
if(secondval != 0x2A)
msleep(17);
if (secondval != 0x2A)
usleep_range(17000, 17000 + 10);
}
} else {
ccb_cmd[2] = 0x2A;
dsim_write_hl_data(dsim, ccb_cmd, ARRAY_SIZE(ccb_cmd));
}
}
msleep(17);
usleep_range(17000, 17000 + 10);
break;
default:
pr_info("%s unknown panel \n", __func__);
pr_info("%s unknown panel\n", __func__);
break;
}
@ -2360,7 +2354,7 @@ static ssize_t weakness_ccb_store(struct device *dev,
break;
case 2:
set_ccb += 5;
panel_dbg( "%s: enable green\n", __func__);
panel_dbg("%s: enable green\n", __func__);
break;
case 3:
if (serverity == 0) {
@ -2544,8 +2538,7 @@ static ssize_t read_copr_show(struct device *dev,
}
if (props->version == 2)
panel_info("read_copr : cur_cnt %d, cur_copr %d, avg_copr %d, "
"s_cur_cnt %d, s_avg_copr %d, copr_ready %d, comp_copr %d\n",
panel_info("read_copr : cur_cnt %d, cur_copr %d, avg_copr %d, s_cur_cnt %d, s_avg_copr %d, copr_ready %d, comp_copr %d\n",
props->cur_cnt, props->cur_copr, props->avg_copr,
props->s_cur_cnt, props->s_avg_copr,
props->copr_ready, props->comp_copr);
@ -2618,7 +2611,7 @@ static ssize_t copr_roi_show(struct device *dev,
for (c = 0; c < 3; c++) {
len += snprintf(buf + len, PAGE_SIZE - len,
"%d%s", out[i * 3 + c],
((i == copr->props.nr_roi -1) && c == 2) ? "\n" : " ");
((i == copr->props.nr_roi - 1) && c == 2) ? "\n" : " ");
}
}
@ -2966,10 +2959,9 @@ static ssize_t isc_defect_store(struct device *dev,
if (value) {
ret = panel_do_seqtbl_by_index_nolock(panel, PANEL_CHECK_ISC_DEFECT_SEQ);
if (unlikely(ret < 0)) {
if (unlikely(ret < 0))
panel_err("PANEL:ERR:%s:failed to write ics defect seq\n", __func__);
}
}
mutex_unlock(&panel->op_lock);
return size;
@ -3034,12 +3026,6 @@ struct device_attribute panel_attrs[] = {
__PANEL_ATTR_RW(alpm, 0664),
__PANEL_ATTR_RW(lpm_opr, 0664),
__PANEL_ATTR_RW(fingerprint, 0644),
#if 0
#ifdef CONFIG_ACTIVE_CLOCK
__PANEL_ATTR_RW(active_clock, 0644),
__PANEL_ATTR_RW(active_blink, 0644),
#endif
#endif
#ifdef CONFIG_SUPPORT_HMD
__PANEL_ATTR_RW(hmt_bright, 0664),
__PANEL_ATTR_RW(hmt_on, 0664),
@ -3094,16 +3080,16 @@ int panel_sysfs_probe(struct panel_device *panel)
else
pr_err("success to create /sys/devices/svc svc : 0x%pK\n", svc);
} else {
svc = (struct kobject*)svc_sd->priv;
svc = (struct kobject *)svc_sd->priv;
pr_info("success to find svc_sd : 0x%pK svc : 0x%pK\n", svc_sd, svc);
}
if (!IS_ERR_OR_NULL(svc)) {
ret = sysfs_create_link(svc, &lcd->dev.kobj, "OCTA");
if (ret)
pr_err("failed to create svc/OCTA/ \n");
pr_err("failed to create svc/OCTA/\n");
else
pr_info("success to create svc/OCTA/ \n");
pr_info("success to create svc/OCTA/\n");
} else {
pr_err("failed to find svc kobject\n");
}

View file

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/drivers/video/fbdev/exynos/panel/timenval.c
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2017 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -1,9 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/drivers/video/fbdev/exynos/panel/timenval.h
*
* Header file for Samsung Common LCD Driver.
*
* Copyright (c) 2017 Samsung Electronics
* Copyright (c) Samsung Electronics Co., Ltd.
* Gwanghui Lee <gwanghui.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or modify

View file

@ -565,7 +565,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
s64 nclusters, unsigned int flags)
{
s64 free_clusters, dirty_clusters, rsv, resv_clusters, sec_rsv;
s64 free_clusters, dirty_clusters, rsv, resv_clusters;
struct percpu_counter *fcc = &sbi->s_freeclusters_counter;
struct percpu_counter *dcc = &sbi->s_dirtyclusters_counter;
@ -579,10 +579,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
*/
rsv = (ext4_r_blocks_count(sbi->s_es) >> sbi->s_cluster_bits) +
resv_clusters;
sec_rsv = (ext4_sec_r_blocks_count(sbi->s_es) >> sbi->s_cluster_bits) +
rsv;
if (free_clusters - (nclusters + sec_rsv + dirty_clusters) <
if (free_clusters - (nclusters + rsv + dirty_clusters) <
EXT4_FREECLUSTERS_WATERMARK) {
free_clusters = percpu_counter_sum_positive(fcc);
dirty_clusters = percpu_counter_sum_positive(dcc);
@ -590,18 +588,13 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
/* Check whether we have space after accounting for current
* dirty clusters & root reserved clusters.
*/
if (free_clusters >= (sec_rsv + nclusters + dirty_clusters))
return 1;
if (ext4_android_claim_sec_r_blocks(flags)) {
if (free_clusters >= (rsv + nclusters + dirty_clusters))
return 1;
}
/* Hm, nope. Are (enough) root reserved clusters available? */
if (uid_eq(sbi->s_resuid, current_fsuid()) ||
(!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) ||
capable(CAP_SYS_RESOURCE) || ext4_android_claim_r_blocks(sbi) ||
capable(CAP_SYS_RESOURCE) ||
(flags & EXT4_MB_USE_ROOT_BLOCKS)) {
if (free_clusters >= (nclusters + dirty_clusters +

View file

@ -138,8 +138,6 @@ enum SHIFT_DIRECTION {
#define EXT4_MB_USE_ROOT_BLOCKS 0x1000
/* Use blocks from reserved pool */
#define EXT4_MB_USE_RESERVED 0x2000
/* Use extra reserved root blocks if needed */
#define EXT4_MB_USE_EXTRA_ROOT_BLOCKS 0x4000
struct ext4_allocation_request {
/* target inode for block we're allocating */
@ -401,11 +399,10 @@ struct flex_groups {
#endif
#define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data. */
#define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
#define EXT4_CORE_FILE_FL 0x40000000 /* allow use of reserved space */
#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
#define EXT4_FL_USER_VISIBLE 0x704BDFFF /* User visible flags */
#define EXT4_FL_USER_MODIFIABLE 0x604380FF /* User modifiable flags */
#define EXT4_FL_USER_VISIBLE 0x404BDFFF /* User visible flags */
#define EXT4_FL_USER_MODIFIABLE 0x204380FF /* User modifiable flags */
#define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \
EXT4_IMMUTABLE_FL | \
@ -468,7 +465,6 @@ enum {
EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */
EXT4_INODE_INLINE_DATA = 28, /* Data in inode. */
EXT4_INODE_PROJINHERIT = 29, /* Create with parents projid */
EXT4_INODE_CORE_FILE = 30, /* allow use of reserved space */
EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */
};
@ -514,7 +510,6 @@ static inline void ext4_check_flag_values(void)
CHECK_FLAG_VALUE(EOFBLOCKS);
CHECK_FLAG_VALUE(INLINE_DATA);
CHECK_FLAG_VALUE(PROJINHERIT);
CHECK_FLAG_VALUE(CORE_FILE);
CHECK_FLAG_VALUE(RESERVED);
}
@ -1300,8 +1295,6 @@ struct ext4_super_block {
__le64 s_kbytes_written; /* nr of lifetime kilobytes written */
__le32 s_snapshot_inum; /* Inode number of active snapshot */
__le32 s_snapshot_id; /* sequential ID of active snapshot */
#define s_sec_r_blocks_count s_snapshot_r_blocks_count
#define ext4_sec_r_blocks_count(es) (le64_to_cpu(es->s_sec_r_blocks_count))
__le64 s_snapshot_r_blocks_count; /* reserved blocks for active
snapshot's future use */
__le32 s_snapshot_list; /* inode number of the head of the
@ -1919,7 +1912,7 @@ static inline bool ext4_has_incompat_features(struct super_block *sb)
/*
* Default reserved inode count
*/
#define EXT4_DEF_RESERVE_INODE 4096
#define EXT4_DEF_RESERVE_INODE 8192
#define EXT4_SEC_DATA_MAGIC 0xBAB0CAFE /* data partition magic */
/*
@ -3293,25 +3286,6 @@ static inline bool ext4_aligned_io(struct inode *inode, loff_t off, loff_t len)
return IS_ALIGNED(off, blksize) && IS_ALIGNED(len, blksize);
}
static inline bool ext4_android_claim_sec_r_blocks(unsigned int flags) {
if (flags & EXT4_MB_USE_EXTRA_ROOT_BLOCKS)
return true;
#if ANDROID_VERSION < 90000
if (in_group_p(AID_USE_SEC_RESERVED))
return true;
#endif
return false;
}
static inline bool ext4_android_claim_r_blocks(struct ext4_sb_info *sbi) {
/* for O upgrade without factory reset */
if (in_group_p(AID_USE_ROOT_RESERVED))
return true;
return false;
}
#endif /* __KERNEL__ */
#define EFSBADCRC EBADMSG /* Bad CRC detected */

View file

@ -723,20 +723,13 @@ out:
static inline int ext4_has_free_inodes(struct ext4_sb_info *sbi)
{
if (likely(percpu_counter_read_positive(&sbi->s_freeinodes_counter) >
sbi->s_r_inodes_count * 2))
sbi->s_r_inodes_count))
return 1;
#if ANDROID_VERSION < 90000
if (percpu_counter_read_positive(&sbi->s_freeinodes_counter) >
sbi->s_r_inodes_count &&
in_group_p(AID_USE_SEC_RESERVED))
return 1;
#endif
/* Hm, nope. Are (enough) root reserved inodes available? */
if (uid_eq(sbi->s_resuid, current_fsuid()) ||
(!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) ||
capable(CAP_SYS_RESOURCE) || ext4_android_claim_r_blocks(sbi))
capable(CAP_SYS_RESOURCE))
return 1;
return 0;
}

View file

@ -1543,9 +1543,7 @@ static int ext4_da_reserve_space(struct inode *inode)
return ret;
spin_lock(&ei->i_block_reservation_lock);
if (ext4_claim_free_clusters(sbi, 1,
ext4_test_inode_flag(inode, EXT4_INODE_CORE_FILE) ?
EXT4_MB_USE_EXTRA_ROOT_BLOCKS : 0)) {
if (ext4_claim_free_clusters(sbi, 1, 0)) {
spin_unlock(&ei->i_block_reservation_lock);
dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
return -ENOSPC;

View file

@ -4587,9 +4587,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
if (IS_NOQUOTA(ar->inode))
ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
if (ext4_test_inode_flag(ar->inode, EXT4_INODE_CORE_FILE))
ar->flags |= EXT4_MB_USE_EXTRA_ROOT_BLOCKS;
if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
/* Without delayed allocation we need to verify
* there is enough free blocks to do block allocation

View file

@ -4272,16 +4272,11 @@ no_journal:
ext4_r_blocks_count(es) >> sbi->s_cluster_bits);
}
if (ext4_sec_r_blocks_count(es))
ext4_msg(sb, KERN_INFO, "SEC reserved blocks %llu",
ext4_sec_r_blocks_count(es) >>
sbi->s_cluster_bits);
if (le32_to_cpu(es->s_sec_magic) == EXT4_SEC_DATA_MAGIC ||
strncmp(es->s_volume_name, "data", 4) == 0) {
sbi->s_r_inodes_count = EXT4_DEF_RESERVE_INODE;
ext4_msg(sb, KERN_INFO, "Reserve inodes (%d/%u)",
EXT4_DEF_RESERVE_INODE * 2,
EXT4_DEF_RESERVE_INODE,
le32_to_cpu(es->s_inodes_count));
}
@ -5399,10 +5394,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
/* prevent underflow in case that few free space is available */
buf->f_bfree = EXT4_C2B(sbi, max_t(s64, bfree, 0));
buf->f_bavail = buf->f_bfree -
(ext4_r_blocks_count(es) + resv_blocks +
ext4_sec_r_blocks_count(es));
if (buf->f_bfree < (ext4_r_blocks_count(es) + resv_blocks +
ext4_sec_r_blocks_count(es)))
(ext4_r_blocks_count(es) + resv_blocks);
if (buf->f_bfree < (ext4_r_blocks_count(es) + resv_blocks))
buf->f_bavail = 0;
buf->f_files = le32_to_cpu(es->s_inodes_count);
buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);

File diff suppressed because it is too large Load diff

View file

@ -12,5 +12,6 @@
/* Defex init API */
int task_defex_enforce(struct task_struct *p, struct file *f, int syscall);
int task_defex_zero_creds(struct task_struct *tsk);
int task_defex_user_exec(const char *new_file);
void __init defex_load_rules(void);
#endif /* CONFIG_SECURITY_DEFEX_H */

View file

@ -43,6 +43,10 @@
#include <trace/events/module.h>
#ifdef CONFIG_SECURITY_DEFEX
#include <linux/defex.h>
#endif
extern int max_threads;
#define CAP_BSET (void *)1
@ -566,6 +570,13 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
retval = -EBUSY;
goto out;
}
#if defined(CONFIG_SECURITY_DEFEX) && ANDROID_VERSION >= 100000 /* Over Q in case of Exynos */
if (task_defex_user_exec(sub_info->path)) {
goto out;
}
#endif
/*
* Set the completion pointer only if there is a waiter.
* This makes it possible to use umh_complete to free

View file

@ -4,10 +4,10 @@
# Features to Enable
PED_ENABLE=true
PED_BASED_ON_TGID_ENABLE=true
SAFEPLACE_ENABLE=true
IMMUTABLE_ENABLE=true
LP_ENABLE=true
UMH_RESTRICTION_ENABLE=true
ifneq ($(wildcard $(srctree)/include/crypto/internal/rsa.h),)
$(warning [DEFEX] INTEGRITY_ENABLE)
@ -52,12 +52,19 @@ ifeq ($(CONFIG_DEFEX_KERNEL_ONLY), y)
endif
endif
ifeq ($(CONFIG_SEC_FACTORY), y)
DEFEX_DEFINES += -DDEFEX_FACTORY_ENABLE
endif
ifeq ($(CONFIG_KUNIT), y)
DEFEX_DEFINES += -DDEFEX_KUNIT_ENABLED
else
DEFEX_DEFINES += -D__visible_for_testing=static
endif
ifeq ($(PED_ENABLE), true)
obj-y += defex_priv.o
DEFEX_DEFINES += -DDEFEX_PED_ENABLE
ifeq ($(PED_BASED_ON_TGID_ENABLE), true)
DEFEX_DEFINES += -DDEFEX_PED_BASED_ON_TGID_ENABLE
endif
endif
ifeq ($(SAFEPLACE_ENABLE), true)
@ -78,6 +85,10 @@ ifeq ($(LP_ENABLE), true)
DEFEX_DEFINES += -DDEFEX_LP_ENABLE
endif
ifeq ($(UMH_RESTRICTION_ENABLE), true)
DEFEX_DEFINES += -DDEFEX_UMH_RESTRICTION_ENABLE
endif
ifeq ($(CACHES_ENABLE), true)
obj-y += defex_caches.o
DEFEX_DEFINES += -DDEFEX_CACHES_ENABLE
@ -109,15 +120,7 @@ else
endif
endif
ifeq ($(SEC_BUILD_OPTION_VTS), true)
$(warning [DEFEX] VTS true $(SEC_BUILD_OPTION_VTS))
DEFEX_DEFINES += -DDEFEX_PERMISSIVE_SP
DEFEX_DEFINES += -DDEFEX_PERMISSIVE_PED
DEFEX_DEFINES += -DDEFEX_PERMISSIVE_IM
DEFEX_DEFINES += -DDEFEX_PERMISSIVE_LP
else
$(warning [DEFEX] VTS false $(SEC_BUILD_OPTION_VTS))
endif
ccflags-y := -Wformat
EXTRA_CFLAGS += -I$(srctree)/$(src)/cert
EXTRA_AFLAGS += -Isecurity/samsung/defex_lsm/cert

View file

@ -7,6 +7,8 @@
*/
#include <linux/uaccess.h>
#include <linux/cred.h>
#include <linux/dcache.h>
#include <linux/err.h>
#include <linux/file.h>
@ -32,11 +34,60 @@
#include <linux/sched/task.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
inline ssize_t __vfs_read(struct file *file, char __user *buf,
size_t count, loff_t *pos)
{
ssize_t ret;
if (file->f_op->read)
ret = file->f_op->read(file, buf, count, pos);
else if (file->f_op->aio_read)
ret = do_sync_read(file, buf, count, pos);
else if (file->f_op->read_iter)
ret = new_sync_read(file, buf, count, pos);
else
ret = -EINVAL;
return ret;
}
#endif
struct file *local_fopen(const char *fname, int flags, umode_t mode)
{
struct file *f;
mm_segment_t old_fs;
old_fs = get_fs();
set_fs(get_ds());
f = filp_open(fname, flags, mode);
set_fs(old_fs);
return f;
}
int local_fread(struct file *f, loff_t offset, void *ptr, unsigned long bytes)
{
mm_segment_t old_fs;
char __user *buf = (char __user *)ptr;
ssize_t ret;
if (!(f->f_mode & FMODE_READ))
return -EBADF;
old_fs = get_fs();
set_fs(get_ds());
ret = __vfs_read(f, buf, bytes, &offset);
set_fs(old_fs);
return (int)ret;
}
const char unknown_file[] = "<unknown filename>";
void init_defex_context(struct defex_context *dc, int syscall, struct task_struct *p, struct file *f)
{
const struct cred *cred_ptr;
dc->syscall_no = syscall;
dc->task = p;
dc->process_file = NULL;
@ -47,6 +98,12 @@ void init_defex_context(struct defex_context *dc, int syscall, struct task_struc
dc->target_name = NULL;
dc->process_name_buff = NULL;
dc->target_name_buff = NULL;
if (p == current)
cred_ptr = get_current_cred();
else
cred_ptr = get_task_cred(p);
memcpy(&dc->cred, cred_ptr, sizeof(struct cred));
put_cred(cred_ptr);
}
void release_defex_context(struct defex_context *dc)
@ -93,7 +150,7 @@ char *get_dc_process_name(struct defex_context *dc)
if (!dc->process_name) {
dpath = get_dc_process_dpath(dc);
if (dpath) {
dc->process_name_buff = kzalloc(PATH_MAX, GFP_ATOMIC);
dc->process_name_buff = kmalloc(PATH_MAX, GFP_KERNEL);
if (dc->process_name_buff)
path = d_path(dpath, dc->process_name_buff, PATH_MAX);
}
@ -127,7 +184,7 @@ char *get_dc_target_name(struct defex_context *dc)
if (!dc->target_name) {
dpath = get_dc_target_dpath(dc);
if (dpath) {
dc->target_name_buff = kzalloc(PATH_MAX, GFP_ATOMIC);
dc->target_name_buff = kmalloc(PATH_MAX, GFP_KERNEL);
if (dc->target_name_buff)
path = d_path(dpath, dc->target_name_buff, PATH_MAX);
}
@ -198,7 +255,7 @@ char *defex_get_filename(struct task_struct *p)
dpath = &exe_file->f_path;
buff = kzalloc(PATH_MAX, GFP_ATOMIC);
buff = kmalloc(PATH_MAX, GFP_KERNEL);
if (buff)
path = d_path(dpath, buff, PATH_MAX);
@ -208,7 +265,7 @@ char *defex_get_filename(struct task_struct *p)
out_filename:
if (path && !IS_ERR(path))
filename = kstrdup(path, GFP_ATOMIC);
filename = kstrdup(path, GFP_KERNEL);
if (!filename)
filename = (char *)unknown_file;
@ -231,7 +288,7 @@ char* defex_resolve_filename(const char *name, char **out_buff)
if (*out_buff)
buff = *out_buff;
else
buff = kzalloc(PATH_MAX, GFP_ATOMIC);
buff = kmalloc(PATH_MAX, GFP_KERNEL);
if (buff) {
if (!kern_path(name, LOOKUP_FOLLOW, &path)) {
target_file = d_path(&path, buff, PATH_MAX);

View file

@ -19,7 +19,7 @@
static int last_cmd;
static int set_user(struct cred *new_cred)
__visible_for_testing int set_user(struct cred *new_cred)
{
struct user_struct *new_user;
@ -35,7 +35,7 @@ static int set_user(struct cred *new_cred)
/*
* target_id = (0 - set all uids, 1 - set fsuid, 2 - set all gids)
*/
static int set_cred(int target_id, int new_val)
__visible_for_testing int set_cred(int target_id, int new_val)
{
struct user_namespace *ns = current_user_ns();
const struct cred *old_cred;
@ -86,7 +86,7 @@ do_abort:
return -EPERM;
}
static ssize_t debug_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
__visible_for_testing ssize_t debug_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{
struct task_struct *p = current;
int i, l, new_val = -1;
@ -124,7 +124,7 @@ static ssize_t debug_store(struct kobject *kobj, struct kobj_attribute *attr, co
return (!ret)?count:ret;
}
static ssize_t debug_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
__visible_for_testing ssize_t debug_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
struct task_struct *p = current;
int res = 0;
@ -146,7 +146,7 @@ static ssize_t debug_show(struct kobject *kobj, struct kobj_attribute *attr, cha
return res;
}
static struct kobj_attribute debug_attribute = __ATTR(debug, 0660, debug_show, debug_store);
__visible_for_testing struct kobj_attribute debug_attribute = __ATTR(debug, 0660, debug_show, debug_store);
int defex_create_debug(struct kset *defex_kset)
{

View file

@ -8,48 +8,80 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/version.h>
#include "include/defex_catch_list.h"
#include "include/defex_internal.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/mm.h>
#include <linux/sched/task.h>
#endif
#define MAX_PID_32 32768
#define DEFEX_MEM_CACHE_SIZE 32
#define DEFEX_MEM_CACHE_COUNT 3
#define CACHE_CRED_DATA 0
#define CACHE_CRED_DATA_ID 1
#define CACHE_HTABLE_ITEM 2
#ifdef DEFEX_PED_ENABLE
DECLARE_HASHTABLE(creds_hash, 15);
#endif /* DEFEX_PED_ENABLE */
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
struct id_set {
unsigned int uid, fsuid, egid;
};
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
struct proc_cred_data {
unsigned int uid, fsuid, egid;
unsigned short cred_flags;
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
unsigned short tcnt;
struct id_set upd_ids[];
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
struct id_set default_ids;
struct id_set main_ids[];
};
struct proc_cred_struct {
struct hash_item_struct {
struct hlist_node node;
struct proc_cred_data cred_data;
struct proc_cred_data *cred_data;
int id;
};
struct mem_cache_list {
atomic_t count;
char name[8];
struct kmem_cache *allocator;
void *mem_cache_array[DEFEX_MEM_CACHE_SIZE];
};
#ifdef DEFEX_PED_ENABLE
DECLARE_HASHTABLE(creds_hash, 15);
static DEFINE_SPINLOCK(creds_hash_update_lock);
static struct proc_cred_data *creds_fast_hash[MAX_PID_32 + 1];
static int creds_fast_hash_ready;
static struct mem_cache_list mem_cache[DEFEX_MEM_CACHE_COUNT];
static int creds_fast_hash_ready __ro_after_init;
__visible_for_testing void mem_cache_alloc(void);
void creds_fast_hash_init(void)
void __init creds_fast_hash_init(void)
{
unsigned int i;
static const int sizes[DEFEX_MEM_CACHE_COUNT] __initdata = {
sizeof(struct proc_cred_data),
sizeof(struct proc_cred_data) + sizeof(struct id_set),
sizeof(struct hash_item_struct)
};
hash_init(creds_hash);
for (i = 0; i <= MAX_PID_32; i++)
creds_fast_hash[i] = NULL;
for(i = 0; i < ARRAY_SIZE(sizes); i++) {
snprintf(mem_cache[i].name, sizeof(mem_cache[i].name), "defex%d", i);
mem_cache[i].allocator = kmem_cache_create(mem_cache[i].name, sizes[i], 0, 0, NULL);
}
for(i = 0; i < (DEFEX_MEM_CACHE_SIZE / 2); i++)
mem_cache_alloc();
creds_fast_hash_ready = 1;
}
@ -58,339 +90,295 @@ int is_task_creds_ready(void)
return creds_fast_hash_ready;
}
#ifdef DEFEX_PED_ENABLE
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
void get_task_creds(struct task_struct *p, unsigned int *uid_ptr, unsigned int *fsuid_ptr, unsigned int *egid_ptr, unsigned short *cred_flags_ptr)
#else
void get_task_creds(int pid, unsigned int *uid_ptr, unsigned int *fsuid_ptr, unsigned int *egid_ptr, unsigned short *cred_flags_ptr)
#endif
__visible_for_testing inline void *mem_cache_get(int cache_number)
{
struct proc_cred_struct *obj;
struct proc_cred_data *cred_data;
int n;
n = atomic_read(&mem_cache[cache_number].count);
if (n) {
atomic_dec(&mem_cache[cache_number].count);
return mem_cache[cache_number].mem_cache_array[n - 1];
}
return NULL;
}
__visible_for_testing inline void *mem_cache_reclaim(int cache_number, void *ptr)
{
int n;
n = atomic_read(&mem_cache[cache_number].count);
if (n < DEFEX_MEM_CACHE_SIZE) {
atomic_inc(&mem_cache[cache_number].count);
mem_cache[cache_number].mem_cache_array[n] = ptr;
ptr = NULL;
}
return ptr;
}
__visible_for_testing void mem_cache_alloc(void)
{
int mem_allocated = 0;
int i, n;
unsigned long flags;
void *mem_block[DEFEX_MEM_CACHE_COUNT];
for(i = 0; i < DEFEX_MEM_CACHE_COUNT; i++) {
mem_block[i] = NULL;
n = atomic_read(&mem_cache[i].count);
if (n < (DEFEX_MEM_CACHE_SIZE / 2)) {
mem_block[i] = kmem_cache_alloc(mem_cache[i].allocator, in_atomic() ? GFP_ATOMIC:GFP_KERNEL);
mem_allocated++;
}
}
if (!mem_allocated)
return;
spin_lock_irqsave(&creds_hash_update_lock, flags);
for(i = 0; i < DEFEX_MEM_CACHE_COUNT; i++) {
n = atomic_read(&mem_cache[i].count);
if (mem_block[i] && n < DEFEX_MEM_CACHE_SIZE) {
mem_cache[i].mem_cache_array[n] = mem_block[i];
mem_block[i] = NULL;
atomic_inc(&mem_cache[i].count);
mem_allocated--;
}
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
if (!mem_allocated)
return;
for(i = 0; i < DEFEX_MEM_CACHE_COUNT; i++) {
if (mem_block[i]) {
kmem_cache_free(mem_cache[i].allocator, mem_block[i]);
}
}
}
__visible_for_testing struct proc_cred_data *get_cred_data(int id)
{
struct proc_cred_data *cred_data = NULL;
struct hash_item_struct *obj;
if (id < 0)
return NULL;
if (id <= MAX_PID_32) {
cred_data = creds_fast_hash[id];
} else {
hash_for_each_possible(creds_hash, obj, node, id) {
if (obj->id == id) {
cred_data = obj->cred_data;
break;
}
}
}
return cred_data;
}
__visible_for_testing struct proc_cred_data **get_cred_ptr(int id)
{
struct proc_cred_data **cred_ptr = NULL;
struct hash_item_struct *obj;
if (id < 0)
return NULL;
if (id <= MAX_PID_32) {
cred_ptr = &creds_fast_hash[id];
} else {
hash_for_each_possible(creds_hash, obj, node, id) {
if (obj->id == id) {
cred_ptr = &obj->cred_data;
break;
}
}
}
return cred_ptr;
}
__visible_for_testing void set_cred_data(int id, struct proc_cred_data **cred_ptr, struct proc_cred_data *cred_data)
{
struct hash_item_struct *obj;
if (id < 0)
return;
if (cred_ptr) {
*cred_ptr = cred_data;
} else {
if (id > MAX_PID_32) {
obj = mem_cache_get(CACHE_HTABLE_ITEM);
if (!obj)
return;
obj->id = id;
obj->cred_data = cred_data;
hash_add(creds_hash, &obj->node, id);
}
}
}
void get_task_creds(struct task_struct *p, unsigned int *uid_ptr, unsigned int *fsuid_ptr, unsigned int *egid_ptr, unsigned short *cred_flags_ptr)
{
struct proc_cred_data *cred_data, *thread_cred_data;
struct id_set *ids_ptr;
unsigned int uid = 0, fsuid = 0, egid = 0;
unsigned short cred_flags = CRED_FLAGS_PROOT;
unsigned long flags;
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
int tgid = p->tgid, pid = p->pid;
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
if (pid <= MAX_PID_32) {
spin_lock_irqsave(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
cred_data = creds_fast_hash[tgid];
cred_data = get_cred_data(tgid);
if (cred_data) {
if (tgid == pid) {
if (cred_data->cred_flags & CRED_FLAGS_MAIN_UPDATED) {
GET_CREDS(upd_ids->uid, upd_ids->fsuid, upd_ids->egid, cred_flags);
ids_ptr = (cred_data->cred_flags & CRED_FLAGS_MAIN_UPDATED) ? \
(&cred_data->main_ids[0]) : (&cred_data->default_ids);
} else {
GET_CREDS(uid, fsuid, egid, cred_flags);
if (cred_data->cred_flags & CRED_FLAGS_SUB_UPDATED) {
thread_cred_data = get_cred_data(pid);
if (thread_cred_data)
cred_data = thread_cred_data;
}
} else {
if ((cred_data->cred_flags & CRED_FLAGS_SUB_UPDATED) && creds_fast_hash[pid])
cred_data = creds_fast_hash[pid];
GET_CREDS(uid, fsuid, egid, cred_flags);
ids_ptr = &cred_data->default_ids;
}
GET_CREDS(ids_ptr, cred_data);
}
#else
cred_data = creds_fast_hash[pid];
if (cred_data) {
GET_CREDS(uid, fsuid, egid, cred_flags);
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
} else {
spin_lock_irqsave(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
if (tgid == pid) {
hash_for_each_possible(creds_hash, obj, node, tgid) {
if (obj->cred_data.cred_flags & CRED_FLAGS_MAIN_UPDATED) {
GET_CREDS_OBJ(upd_ids->uid, upd_ids->fsuid, upd_ids->egid, cred_flags);
} else {
GET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
}
break;
}
} else {
hash_for_each_possible(creds_hash, obj, node, tgid) {
GET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
break;
}
if (cred_flags & CRED_FLAGS_SUB_UPDATED) {
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
hash_for_each_possible(creds_hash, obj, node, pid) {
GET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
break;
}
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
}
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
}
*uid_ptr = uid;
*fsuid_ptr = fsuid;
*egid_ptr = egid;
*cred_flags_ptr = cred_flags;
}
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
int set_task_creds(struct task_struct *p, unsigned int uid, unsigned int fsuid, unsigned int egid, unsigned short cred_flags)
#else
int set_task_creds(int pid, unsigned int uid, unsigned int fsuid, unsigned int egid, unsigned short cred_flags)
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
{
struct proc_cred_struct *obj;
struct proc_cred_data *cred_data = NULL, *tmp_data = NULL;
struct proc_cred_data *cred_data = NULL, *tmp_data, **cred_ptr;
struct id_set *ids_ptr;
unsigned long flags;
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
struct proc_cred_struct *tmp_obj = NULL;
int tgid = p->tgid, pid = p->pid;
unsigned short tmp_cred_flags = 0x80;
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
int err = -1, tgid = p->tgid, pid = p->pid;
void *free_buff = NULL;
alloc_obj:;
if (pid <= MAX_PID_32) {
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
if (!creds_fast_hash[tgid]) {
#else
if (!creds_fast_hash[pid]) {
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
tmp_data = kmalloc(sizeof(struct proc_cred_data), GFP_ATOMIC);
if (!tmp_data)
return -1;
}
mem_cache_alloc();
spin_lock_irqsave(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
cred_data = creds_fast_hash[tgid];
#else
cred_data = creds_fast_hash[pid];
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
/* Search for main proces's data */
cred_ptr = get_cred_ptr(tgid);
cred_data = (cred_ptr) ? (*cred_ptr) : NULL;
if (!cred_data) {
if (!tmp_data) {
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
goto alloc_obj;
}
cred_data = tmp_data;
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
/* Not found? Allocate a new data */
cred_data = mem_cache_get(CACHE_CRED_DATA);
if (!cred_data)
goto set_finish;
cred_data->cred_flags = 0;
cred_data->tcnt = 1;
creds_fast_hash[tgid] = cred_data;
#else
creds_fast_hash[pid] = cred_data;
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
tmp_data = NULL;
set_cred_data(tgid, cred_ptr, cred_data);
}
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
if (cred_data && cred_data->tcnt >= 2) {
ids_ptr = &cred_data->default_ids;
if (cred_data->tcnt >= 2) {
if (tgid == pid) {
/* Allocate extended data for main process, copy and remove old data */
if (!(cred_data->cred_flags & CRED_FLAGS_MAIN_UPDATED)) {
cred_data->cred_flags |= CRED_FLAGS_MAIN_UPDATED;
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
tmp_data = kmalloc(sizeof(struct proc_cred_data) + sizeof(struct id_set), GFP_ATOMIC);
if (!tmp_data) {
return -1;
}
spin_lock_irqsave(&creds_hash_update_lock, flags);
tmp_data = mem_cache_get(CACHE_CRED_DATA_ID);
if (!tmp_data)
goto set_finish;
*tmp_data = *cred_data;
kfree(cred_data);
free_buff = mem_cache_reclaim(CACHE_CRED_DATA, cred_data);
cred_data = tmp_data;
creds_fast_hash[tgid] = cred_data;
tmp_data = NULL;
set_cred_data(tgid, cred_ptr, cred_data);
}
SET_CREDS(upd_ids->uid, upd_ids->fsuid, upd_ids->egid, cred_flags);
ids_ptr = &cred_data->main_ids[0];
} else {
cred_data->cred_flags |= CRED_FLAGS_SUB_UPDATED;
cred_data = creds_fast_hash[pid];
/* Search for thread's data. Allocate, if not found */
cred_ptr = get_cred_ptr(pid);
cred_data = (cred_ptr) ? (*cred_ptr) : NULL;
if (!cred_data) {
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
tmp_data = kmalloc(sizeof(struct proc_cred_data), GFP_ATOMIC);
if (!tmp_data) {
return -1;
}
spin_lock_irqsave(&creds_hash_update_lock, flags);
cred_data = tmp_data;
creds_fast_hash[pid] = cred_data;
tmp_data = NULL;
cred_data = mem_cache_get(CACHE_CRED_DATA);
if (!cred_data)
goto set_finish;
set_cred_data(pid, cred_ptr, cred_data);
}
cred_data->cred_flags = 0;
SET_CREDS(uid, fsuid, egid, cred_flags);
ids_ptr = &cred_data->default_ids;
}
} else {
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
SET_CREDS(uid, fsuid, egid, cred_flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
if (tmp_data)
kfree(tmp_data);
return 0;
}
SET_CREDS(ids_ptr, cred_data);
err = 0;
spin_lock_irqsave(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
hash_for_each_possible(creds_hash, obj, node, tgid) {
if (obj->cred_data.tcnt >= 2) {
tmp_cred_flags = obj->cred_data.cred_flags;
obj->cred_data.cred_flags |= ((tgid == pid) ? CRED_FLAGS_MAIN_UPDATED : CRED_FLAGS_SUB_UPDATED);
break;
}
#else
hash_for_each_possible(creds_hash, obj, node, pid) {
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
SET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
set_finish:
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
if (tmp_cred_flags == 0x80) {
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
obj = kmalloc(sizeof(struct proc_cred_struct), GFP_ATOMIC);
if (!obj)
return -1;
obj->cred_data.cred_flags = 0;
SET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
obj->cred_data.tcnt = 1;
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
spin_lock_irqsave(&creds_hash_update_lock, flags);
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
hash_add(creds_hash, &obj->node, tgid);
#else
hash_add(creds_hash, &obj->node, pid);
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
if (tgid == pid) {
if (!(tmp_cred_flags & CRED_FLAGS_MAIN_UPDATED)) {
obj = kmalloc(sizeof(struct proc_cred_struct) + sizeof(struct id_set), GFP_ATOMIC);
if (!obj)
return -1;
spin_lock_irqsave(&creds_hash_update_lock, flags);
hash_for_each_possible(creds_hash, tmp_obj, node, tgid) {
*obj = *tmp_obj;
hash_del(&tmp_obj->node);
kfree(tmp_obj);
break;
}
SET_CREDS_OBJ(upd_ids->uid, upd_ids->fsuid, upd_ids->egid, cred_flags);
hash_add(creds_hash, &obj->node, tgid);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
} else {
spin_lock_irqsave(&creds_hash_update_lock, flags);
hash_for_each_possible(creds_hash, obj, node, tgid) {
SET_CREDS_OBJ(upd_ids->uid, upd_ids->fsuid, upd_ids->egid, cred_flags);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return -1;
}
} else {
spin_lock_irqsave(&creds_hash_update_lock, flags);
hash_for_each_possible(creds_hash, obj, node, pid) {
SET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
obj = kmalloc(sizeof(struct proc_cred_struct), GFP_ATOMIC);
if (!obj)
return -1;
obj->cred_data.cred_flags = 0;
SET_CREDS_OBJ(uid, fsuid, egid, cred_flags);
spin_lock_irqsave(&creds_hash_update_lock, flags);
hash_add(creds_hash, &obj->node, pid);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return 0;
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
/* Free the pending pointer */
if (free_buff)
kmem_cache_free(mem_cache[CACHE_CRED_DATA].allocator, free_buff);
mem_cache_alloc();
return err;
}
#endif /* DEFEX_PED_ENABLE */
#ifdef DEFEX_PED_BASED_ON_TGID_ENABLE
void set_task_creds_tcnt(struct task_struct *p, int addition)
{
struct proc_cred_struct *tgid_obj, *pid_obj;
struct proc_cred_data *tgid_cred_data = NULL, *pid_cred_data = NULL;
unsigned long flags;
struct hash_item_struct *tgid_obj = NULL, *pid_obj = NULL;
struct proc_cred_data **cred_ptr, *tgid_cred_data = NULL, *pid_cred_data = NULL;
struct proc_cred_data *free_buff1 = NULL, *free_buff2 = NULL;
int tgid = p->tgid, pid = p->pid;
unsigned long flags;
if (pid <= MAX_PID_32) {
spin_lock_irqsave(&creds_hash_update_lock, flags);
/* Remove the thread's data, if found */
if (tgid != pid && addition == -1) {
pid_cred_data = creds_fast_hash[pid];
cred_ptr = get_cred_ptr(pid);
pid_cred_data = (cred_ptr) ? (*cred_ptr) : NULL;
if (pid_cred_data) {
creds_fast_hash[pid] = NULL;
kfree(pid_cred_data);
*cred_ptr = NULL;
/* Return to pre-allocated pool, if possible */
free_buff1 = mem_cache_reclaim(CACHE_CRED_DATA, pid_cred_data);
}
/* Remove the thread's hash container */
if (cred_ptr && pid > MAX_PID_32) {
pid_obj = container_of(cred_ptr, struct hash_item_struct, cred_data);
hash_del(&pid_obj->node);
/* Return to pre-allocated pool, if possible */
pid_obj = mem_cache_reclaim(CACHE_HTABLE_ITEM, pid_obj);
}
}
tgid_cred_data = creds_fast_hash[tgid];
/* Search for the main process's data */
cred_ptr = get_cred_ptr(tgid);
tgid_cred_data = (cred_ptr) ? (*cred_ptr) : NULL;
if (tgid_cred_data) {
tgid_cred_data->tcnt += addition;
/* No threads, remove process data */
if (!tgid_cred_data->tcnt) {
creds_fast_hash[tgid] = NULL;
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
kfree(tgid_cred_data);
return;
}
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
return;
}
spin_lock_irqsave(&creds_hash_update_lock, flags);
if (tgid != pid && addition == -1) {
hash_for_each_possible(creds_hash, pid_obj, node, pid) {
hash_del(&pid_obj->node);
kfree(pid_obj);
break;
}
}
hash_for_each_possible(creds_hash, tgid_obj, node, tgid) {
tgid_obj->cred_data.tcnt += addition;
if (!tgid_obj->cred_data.tcnt) {
*cred_ptr = NULL;
/* Return to pre-allocated pool, if possible */
free_buff2 = mem_cache_reclaim((tgid_cred_data->cred_flags & CRED_FLAGS_MAIN_UPDATED) ? \
CACHE_CRED_DATA_ID : CACHE_CRED_DATA, tgid_cred_data);
/* Remove the process's hash container */
if (tgid > MAX_PID_32) {
tgid_obj = container_of(cred_ptr, struct hash_item_struct, cred_data);
hash_del(&tgid_obj->node);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
kfree(tgid_obj);
return;
/* Return to pre-allocated pool, if possible */
tgid_obj = mem_cache_reclaim(CACHE_HTABLE_ITEM, tgid_obj);
}
}
break;
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
/* Free all pending pointers */
if (free_buff1)
kmem_cache_free(mem_cache[CACHE_CRED_DATA].allocator, free_buff1);
if (free_buff2)
kmem_cache_free(mem_cache[(free_buff2->cred_flags & CRED_FLAGS_MAIN_UPDATED) ? \
CACHE_CRED_DATA_ID : CACHE_CRED_DATA].allocator, free_buff2);
if (pid_obj)
kmem_cache_free(mem_cache[CACHE_HTABLE_ITEM].allocator, pid_obj);
if (tgid_obj)
kmem_cache_free(mem_cache[CACHE_HTABLE_ITEM].allocator, tgid_obj);
return;
}
#else
void delete_task_creds(int pid)
void set_task_creds_tcnt(struct task_struct *p, int addition)
{
struct proc_cred_struct *obj;
struct proc_cred_data *cred_data;
unsigned long flags;
if (pid <= MAX_PID_32) {
spin_lock_irqsave(&creds_hash_update_lock, flags);
cred_data = creds_fast_hash[pid];
creds_fast_hash[pid] = NULL;
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
kfree(cred_data);
return;
}
spin_lock_irqsave(&creds_hash_update_lock, flags);
hash_for_each_possible(creds_hash, obj, node, pid) {
hash_del(&obj->node);
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
kfree(obj);
return;
}
spin_unlock_irqrestore(&creds_hash_update_lock, flags);
(void)p;
(void)addition;
}
#endif /* DEFEX_PED_BASED_ON_TGID_ENABLE */
#endif /* DEFEX_PED_ENABLE */

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