First commit

This commit is contained in:
Joshua Riek
2024-07-14 14:43:45 -04:00
commit 3ae2c8227b
283 changed files with 431951 additions and 0 deletions

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# Introduction
This repo provides dkms source code for wireless adapters based on the Broadcom ap6xxx chipset.
Forked from BCMDHD 101.10.591.52.27 and adapted for the Rockchip platform.

7
debian/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
/.debhelper
/debhelper-build-stamp
/files
/bcmdhd-*
/*.debhelper.log
/*.debhelper
/*.substvars

17
debian/bcmdhd-pcie-dkms.dkms vendored Normal file
View File

@@ -0,0 +1,17 @@
PACKAGE_VARIANT="pcie"
PACKAGE_NAME="bcmdhd-pcie"
PACKAGE_VERSION="#MODULE_VERSION#"
CLEAN="make clean"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src CONFIG_BCMDHD_SDIO= CONFIG_BCMDHD_PCIE=y CONFIG_BCMDHD_USB="
BUILT_MODULE_NAME[0]="bcmdhd_$PACKAGE_VARIANT"
DEST_MODULE_NAME[0]="${BUILT_MODULE_NAME[0]}"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/updates/dkms"
BUILT_MODULE_NAME[1]="dhd_static_buf_$PACKAGE_VARIANT"
DEST_MODULE_NAME[1]="${BUILT_MODULE_NAME[1]}"
BUILT_MODULE_LOCATION[1]="src"
DEST_MODULE_LOCATION[1]="/updates/dkms"
AUTOINSTALL=yes

1
debian/bcmdhd-pcie-dkms.docs vendored Normal file
View File

@@ -0,0 +1 @@

3
debian/bcmdhd-pcie-dkms.install vendored Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/dh-exec
src usr/src/bcmdhd-pcie-${DEB_VERSION}/

17
debian/bcmdhd-sdio-dkms.dkms vendored Normal file
View File

@@ -0,0 +1,17 @@
PACKAGE_VARIANT="sdio"
PACKAGE_NAME="bcmdhd-sdio"
PACKAGE_VERSION="#MODULE_VERSION#"
CLEAN="make clean"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src CONFIG_BCMDHD_SDIO=y CONFIG_BCMDHD_PCIE= CONFIG_BCMDHD_USB="
BUILT_MODULE_NAME[0]="bcmdhd_$PACKAGE_VARIANT"
DEST_MODULE_NAME[0]="${BUILT_MODULE_NAME[0]}"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/updates/dkms"
BUILT_MODULE_NAME[1]="dhd_static_buf_$PACKAGE_VARIANT"
DEST_MODULE_NAME[1]="${BUILT_MODULE_NAME[1]}"
BUILT_MODULE_LOCATION[1]="src"
DEST_MODULE_LOCATION[1]="/updates/dkms"
AUTOINSTALL=yes

1
debian/bcmdhd-sdio-dkms.docs vendored Normal file
View File

@@ -0,0 +1 @@

3
debian/bcmdhd-sdio-dkms.install vendored Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/dh-exec
src usr/src/bcmdhd-sdio-${DEB_VERSION}/

17
debian/bcmdhd-usb-dkms.dkms vendored Normal file
View File

@@ -0,0 +1,17 @@
PACKAGE_VARIANT="usb"
PACKAGE_NAME="bcmdhd-usb"
PACKAGE_VERSION="#MODULE_VERSION#"
CLEAN="make clean"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src CONFIG_BCMDHD_SDIO= CONFIG_BCMDHD_PCIE= CONFIG_BCMDHD_USB=y"
BUILT_MODULE_NAME[0]="bcmdhd_$PACKAGE_VARIANT"
DEST_MODULE_NAME[0]="${BUILT_MODULE_NAME[0]}"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/updates/dkms"
BUILT_MODULE_NAME[1]="dhd_static_buf_$PACKAGE_VARIANT"
DEST_MODULE_NAME[1]="${BUILT_MODULE_NAME[1]}"
BUILT_MODULE_LOCATION[1]="src"
DEST_MODULE_LOCATION[1]="/updates/dkms"
AUTOINSTALL=yes

1
debian/bcmdhd-usb-dkms.docs vendored Normal file
View File

@@ -0,0 +1 @@

3
debian/bcmdhd-usb-dkms.install vendored Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/dh-exec
src usr/src/bcmdhd-usb-${DEB_VERSION}/

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
10

40
debian/control vendored Normal file
View File

@@ -0,0 +1,40 @@
Source: bcmdhd-dkms
Maintainer: Joshua Riek <jjriek@verizon.net>
Section: misc
Priority: optional
Standards-Version: 4.6.0
Build-Depends: debhelper (>=12~),
devscripts,
dh-exec,
dh-sequence-dkms,
lintian
Package: bcmdhd-sdio-dkms
Architecture: arm64
Section: misc
Priority: optional
Depends: ${misc:Depends}, rockchip-firmware
Conflicts: bcmdhd-pcie-dkms, bcmdhd-usb-dkms
Description: dkms sources for Broadcom ap6xxx SDIO
This package provides the dkms source code for Broadcom
ap6xxx SDIO.
Package: bcmdhd-pcie-dkms
Architecture: arm64
Section: misc
Priority: optional
Depends: ${misc:Depends}, rockchip-firmware
Conflicts: bcmdhd-sdio-dkms, bcmdhd-usb-dkms
Description: dkms sources for Broadcom ap6xxx PCIe
This package provides the dkms source code for Broadcom
ap6xxx PCIe.
Package: bcmdhd-usb-dkms
Architecture: arm64
Section: misc
Priority: optional
Depends: ${misc:Depends}, rockchip-firmware
Conflicts: bcmdhd-sdio-dkms, bcmdhd-pcie-dkms
Description: dkms sources for Broadcom ap6xxx USB
This package provides the dkms source code for Broadcom
ap6xxx USB.

22
debian/rules vendored Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk
export DEB_CFLAGS_MAINT_APPEND = -pthread
%:
dh $@
override_dh_install:
DEB_VERSION=$(DEB_VERSION) dh_install --exclude=*.ko --exclude=*.a --exclude=*.swp --exclude=*.o \
--exclude=.gitignore
override_dh_shlibdeps:
dh_shlibdeps -l/lib/aarch64-linux-gnu/
override_dh_dkms:
dh_dkms -V $(DEB_VERSION)
override_dh_builddeb:
dh_builddeb -- -Zxz

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
1.0

82
src/Kconfig Executable file
View File

@@ -0,0 +1,82 @@
#
# Copyright (C) 2023, Broadcom.
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to you
# under the terms of the GNU General Public License version 2 (the "GPL"),
# available at http://www.broadcom.com/licenses/GPLv2.php, with the
# following added to such license:
#
# As a special exception, the copyright holders of this software give you
# permission to link this software with independent modules, and to copy and
# distribute the resulting executable under terms of your choice, provided that
# you also meet, for each linked independent module, the terms and conditions of
# the license of that module. An independent module is a module which is not
# derived from this software. The special exception does not apply to any
# modifications of the software.
#
#
# <<Broadcom-WL-IPTag/Open:>>
#
config BCMDHD
tristate "Broadcom FullMAC wireless cards support"
default m
help
This module adds support for wireless adapters based on
Broadcom FullMAC chipset.
config BCMDHD_FW_PATH
depends on BCMDHD
string "Firmware path"
default "/system/etc/firmware/fw_bcmdhd.bin"
help
Path to the firmware file.
config BCMDHD_NVRAM_PATH
depends on BCMDHD
string "NVRAM path"
default "/system/etc/firmware/nvram.txt"
help
Path to the calibration file.
config BCMDHD_WEXT
bool "Enable WEXT support"
depends on BCMDHD && CFG80211 = n
select WIRELESS_EXT
select WEXT_PRIV
help
Enables WEXT support
choice
prompt "Enable Chip Interface"
depends on BCMDHD
help
Enable Chip Interface.
config BCMDHD_SDIO
bool "SDIO bus interface support"
depends on BCMDHD && MMC
config BCMDHD_PCIE
bool "PCIe bus interface support"
depends on BCMDHD && PCI
config BCMDHD_USB
bool "USB bus interface support"
depends on BCMDHD && USB
endchoice
choice
depends on BCMDHD && BCMDHD_SDIO
prompt "Interrupt type"
help
Interrupt type
config BCMDHD_OOB
depends on BCMDHD && BCMDHD_SDIO
bool "Out-of-Band Interrupt"
help
Interrupt from WL_HOST_WAKE.
config BCMDHD_SDIO_IRQ
depends on BCMDHD && BCMDHD_SDIO
bool "In-Band Interrupt"
help
Interrupt from SDIO DAT[1]
endchoice

525
src/Makefile Executable file

File diff suppressed because it is too large Load Diff

2622
src/aiutils.c Executable file

File diff suppressed because it is too large Load Diff

1252
src/bcm_app_utils.c Executable file

File diff suppressed because it is too large Load Diff

232
src/bcmbloom.c Executable file
View File

@@ -0,0 +1,232 @@
/*
* Bloom filter support
*
* Copyright (C) 2022, Broadcom.
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
*
* <<Broadcom-WL-IPTag/Dual:>>
*/
#include <typedefs.h>
#include <bcmdefs.h>
#ifdef BCMDRIVER
#include <osl.h>
#include <bcmutils.h>
#else /* !BCMDRIVER */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef ASSERT
#define ASSERT(exp)
#endif
#endif /* !BCMDRIVER */
#include <bcmutils.h>
#include <bcmbloom.h>
#define BLOOM_BIT_LEN(_x) ((_x) << 3)
struct bcm_bloom_filter {
void *cb_ctx;
uint max_hash;
bcm_bloom_hash_t *hash; /* array of hash functions */
uint filter_size; /* in bytes */
uint8 *filter; /* can be NULL for validate only */
};
/* public interface */
int
bcm_bloom_create(bcm_bloom_alloc_t alloc_cb,
bcm_bloom_free_t free_cb, void *cb_ctx, uint max_hash,
uint filter_size, bcm_bloom_filter_t **bloom)
{
int err = BCME_OK;
bcm_bloom_filter_t *bp = NULL;
if (!bloom || !alloc_cb || (max_hash == 0)) {
err = BCME_BADARG;
goto done;
}
bp = (*alloc_cb)(cb_ctx, sizeof(*bp));
if (!bp) {
err = BCME_NOMEM;
goto done;
}
bzero(bp, sizeof(*bp));
bp->cb_ctx = cb_ctx;
bp->max_hash = max_hash;
bp->hash = (*alloc_cb)(cb_ctx, sizeof(*bp->hash) * max_hash);
if (!bp->hash) {
err = BCME_NOMEM;
goto done;
}
bzero(bp->hash, sizeof(*bp->hash) * max_hash);
if (filter_size > 0) {
bp->filter = (*alloc_cb)(cb_ctx, filter_size);
if (!bp->filter) {
err = BCME_NOMEM;
goto done;
}
bp->filter_size = filter_size;
bzero(bp->filter, filter_size);
}
*bloom = bp;
done:
if (err != BCME_OK)
bcm_bloom_destroy(&bp, free_cb);
return err;
}
int
bcm_bloom_destroy(bcm_bloom_filter_t **bloom, bcm_bloom_free_t free_cb)
{
int err = BCME_OK;
bcm_bloom_filter_t *bp;
if (!bloom || !*bloom || !free_cb)
goto done;
bp = *bloom;
*bloom = NULL;
if (bp->filter)
(*free_cb)(bp->cb_ctx, bp->filter, bp->filter_size);
if (bp->hash)
(*free_cb)(bp->cb_ctx, bp->hash,
sizeof(*bp->hash) * bp->max_hash);
(*free_cb)(bp->cb_ctx, bp, sizeof(*bp));
done:
return err;
}
int
bcm_bloom_add_hash(bcm_bloom_filter_t *bp, bcm_bloom_hash_t hash, uint *idx)
{
uint i;
if (!bp || !hash || !idx)
return BCME_BADARG;
for (i = 0; i < bp->max_hash; ++i) {
if (bp->hash[i] == NULL)
break;
}
if (i >= bp->max_hash)
return BCME_NORESOURCE;
bp->hash[i] = hash;
*idx = i;
return BCME_OK;
}
int
bcm_bloom_remove_hash(bcm_bloom_filter_t *bp, uint idx)
{
if (!bp)
return BCME_BADARG;
if (idx >= bp->max_hash)
return BCME_NOTFOUND;
bp->hash[idx] = NULL;
return BCME_OK;
}
bool
bcm_bloom_is_member(bcm_bloom_filter_t *bp,
const uint8 *tag, uint tag_len, const uint8 *buf, uint buf_len)
{
uint i;
int err = BCME_OK;
if (!tag || (tag_len == 0)) /* empty tag is always a member */
goto done;
/* use internal buffer if none was specified */
if (!buf || (buf_len == 0)) {
if (!bp->filter) /* every one is a member of empty filter */
goto done;
buf = bp->filter;
buf_len = bp->filter_size;
}
for (i = 0; i < bp->max_hash; ++i) {
uint pos;
if (!bp->hash[i])
continue;
pos = (*bp->hash[i])(bp->cb_ctx, i, tag, tag_len);
/* all bits must be set for a match */
if (isclr(buf, pos % BLOOM_BIT_LEN(buf_len))) {
err = BCME_NOTFOUND;
break;
}
}
done:
return err;
}
int
bcm_bloom_add_member(bcm_bloom_filter_t *bp, const uint8 *tag, uint tag_len)
{
uint i;
if (!bp || !tag || (tag_len == 0))
return BCME_BADARG;
if (!bp->filter) /* validate only */
return BCME_UNSUPPORTED;
for (i = 0; i < bp->max_hash; ++i) {
uint pos;
if (!bp->hash[i])
continue;
pos = (*bp->hash[i])(bp->cb_ctx, i, tag, tag_len);
setbit(bp->filter, pos % BLOOM_BIT_LEN(bp->filter_size));
}
return BCME_OK;
}
int bcm_bloom_get_filter_data(bcm_bloom_filter_t *bp,
uint buf_size, uint8 *buf, uint *buf_len)
{
if (!bp)
return BCME_BADARG;
if (buf_len)
*buf_len = bp->filter_size;
if (buf_size < bp->filter_size)
return BCME_BUFTOOSHORT;
if (bp->filter && bp->filter_size)
memcpy(buf, bp->filter, bp->filter_size);
return BCME_OK;
}

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