mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 01:22:25 +00:00
Compare commits
135 Commits
v3.2.1-rc2
...
staging-te
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d140e1245 | ||
|
|
4b31e481ec | ||
|
|
ba10a88ab3 | ||
|
|
b85bc5db9c | ||
|
|
e998711444 | ||
|
|
2d6bea18df | ||
|
|
1bf9e40987 | ||
|
|
a20b96eb31 | ||
|
|
c83ac67492 | ||
|
|
2b0c600fb3 | ||
|
|
c5793bae3a | ||
|
|
6afbb92dec | ||
|
|
89cb9d63bd | ||
|
|
16963c997f | ||
|
|
f7a9ad770d | ||
|
|
dcdccc7ba0 | ||
|
|
b67f97f213 | ||
|
|
e9dcf3d953 | ||
|
|
cc5edd4446 | ||
|
|
79adece623 | ||
|
|
49b64ec93f | ||
|
|
b1e3686124 | ||
|
|
e5bcda17e7 | ||
|
|
7c04ed76bd | ||
|
|
04a5cc67e0 | ||
|
|
80b2c6d080 | ||
|
|
c683f19b7c | ||
|
|
1b10507cf1 | ||
|
|
50abd015b3 | ||
|
|
5dd212829f | ||
|
|
3abc947f8f | ||
|
|
5f42e9db58 | ||
|
|
b181add059 | ||
|
|
7eae0397f1 | ||
|
|
1033a63140 | ||
|
|
954108d742 | ||
|
|
caee55a61f | ||
|
|
502727ad6d | ||
|
|
1868e369d3 | ||
|
|
5a597c912d | ||
|
|
82ae3766fa | ||
|
|
d250f91bb3 | ||
|
|
76d112144f | ||
|
|
d218c15419 | ||
|
|
2bf2093305 | ||
|
|
c548edfe89 | ||
|
|
82a6e24e91 | ||
|
|
c0e6b523c4 | ||
|
|
195fc01d06 | ||
|
|
19959d016b | ||
|
|
03b34b062e | ||
|
|
076bc0712e | ||
|
|
486cc7983a | ||
|
|
80343e9dad | ||
|
|
dd14c1c6d1 | ||
|
|
71748f4cd4 | ||
|
|
49c51594a3 | ||
|
|
739b6b29b2 | ||
|
|
7e393c4831 | ||
|
|
1149cd41aa | ||
|
|
18bb47be4d | ||
|
|
7847e1778e | ||
|
|
57735bcd18 | ||
|
|
376072ad97 | ||
|
|
afa7e2bbb3 | ||
|
|
52f2e31892 | ||
|
|
b791a723ca | ||
|
|
a9e0e16a80 | ||
|
|
4d55d427d7 | ||
|
|
53ff49eb6f | ||
|
|
1a3c87cf35 | ||
|
|
75df7bb794 | ||
|
|
b61850ff18 | ||
|
|
3738f5b884 | ||
|
|
708895e7ae | ||
|
|
dbdc16804d | ||
|
|
98375061da | ||
|
|
e3edb1fdd5 | ||
|
|
68cf54d9f7 | ||
|
|
28161aff6e | ||
|
|
c2ea273bea | ||
|
|
9d611028fd | ||
|
|
24dbba4c5a | ||
|
|
4c84a3dbdd | ||
|
|
664fa78572 | ||
|
|
26e782627b | ||
|
|
9105d688b9 | ||
|
|
a9694847cd | ||
|
|
426943c1c0 | ||
|
|
6014103032 | ||
|
|
56eee37052 | ||
|
|
7374c39dea | ||
|
|
b77e80cf14 | ||
|
|
7544c1921b | ||
|
|
2d45944ba3 | ||
|
|
58d0932dee | ||
|
|
4f0f25ad05 | ||
|
|
b74f824b3a | ||
|
|
3e7fd62fc2 | ||
|
|
4050db8ed6 | ||
|
|
8b5a449f6d | ||
|
|
55e3e90513 | ||
|
|
0d1ea98328 | ||
|
|
aaaef76d7d | ||
|
|
4b09108f72 | ||
|
|
c02b5922d9 | ||
|
|
9d54cda767 | ||
|
|
1f10af2355 | ||
|
|
0df07d514e | ||
|
|
9587fb3fee | ||
|
|
4d4d356c1f | ||
|
|
64b1f96721 | ||
|
|
f3f070acb1 | ||
|
|
aa909d9ab8 | ||
|
|
1de1426a80 | ||
|
|
8279bae9db | ||
|
|
3554480103 | ||
|
|
e4b535f6cb | ||
|
|
ed7e047514 | ||
|
|
7ced0ea2cc | ||
|
|
a3a957f688 | ||
|
|
afcaa6dea2 | ||
|
|
605406e191 | ||
|
|
d639c02ec1 | ||
|
|
cf45b65214 | ||
|
|
258c26e7e6 | ||
|
|
ed4f03a1a9 | ||
|
|
7477963b1f | ||
|
|
1cf48ae6d9 | ||
|
|
77144209e9 | ||
|
|
71315b140a | ||
|
|
8332ba86e1 | ||
|
|
6a94323a59 | ||
|
|
3d43f4fc95 | ||
|
|
ee80309fc3 |
11
.github/workflows/build-dev.yml
vendored
11
.github/workflows/build-dev.yml
vendored
@@ -15,21 +15,20 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [ 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf196', 'cig_wf189', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'cybertan_rap63xc-211g','sonicfi_rap630c-311g', 'sonicfi_rap630w-311g', 'sonicfi_rap630w-211g', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap105', 'edgecore_eap111', 'edgecore_eap112', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4x_3', 'hfcl_ion4xi_w', 'hfcl_ion4x_w', 'indio_um-305ax', 'sercomm_ap72tip', 'udaya_a6-id2', 'udaya_a6-od2', 'wallys_dr5018', 'wallys_dr6018', 'wallys_dr6018-v4', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
|
||||
|
||||
target: [ 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf189', 'cig_wf196', 'cig_wf196', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'sonicfi_rap630w-312g', 'sonicfi_rap63xc-211g', 'sonicfi_rap630c-311g', 'sonicfi_rap630w-311g', 'sonicfi_rap630w-211g', 'sonicfi_rap7110c-341x', 'sonicfi_rap750w-311a', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap105', 'edgecore_eap111', 'edgecore_eap112', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'edgecore_oap103', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4x_3', 'hfcl_ion4xi_w', 'hfcl_ion4x_w', 'indio_um-305ax', 'senao_iap4300m', 'senao_iap2300m', 'senao_jeap6500', 'udaya_a6-id2', 'udaya_a6-od2', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
# Clean unnecessary files to save disk space
|
||||
- name: clean unncessary files to save space
|
||||
run: |
|
||||
docker rmi `docker images -q`
|
||||
docker rmi `docker images -q` || true
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
@@ -81,7 +80,7 @@ jobs:
|
||||
fi
|
||||
|
||||
trigger-testing:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
@@ -94,7 +93,7 @@ jobs:
|
||||
client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}'
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
|
||||
@@ -6,7 +6,8 @@ boot() {
|
||||
. /lib/functions/system.sh
|
||||
case $(board_name) in
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102)
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103)
|
||||
echo 54 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio54/direction
|
||||
echo 0 > /sys/class/gpio/gpio54/value
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
Index: hostapd-2023-09-08-e5ccbfc6/src/ap/wpa_auth_ft.c
|
||||
===================================================================
|
||||
--- hostapd-2023-09-08-e5ccbfc6.orig/src/ap/wpa_auth_ft.c
|
||||
+++ hostapd-2023-09-08-e5ccbfc6/src/ap/wpa_auth_ft.c
|
||||
@@ -3293,6 +3297,8 @@ static int wpa_ft_process_auth_req(struc
|
||||
size_t identity_len = 0, radius_cui_len = 0;
|
||||
size_t pmk_r1_len, kdk_len, len;
|
||||
int retval = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ struct os_reltime now;
|
||||
+ struct rsn_ftie *ftie;
|
||||
|
||||
*resp_ies = NULL;
|
||||
*resp_ies_len = 0;
|
||||
@@ -3324,6 +3330,9 @@ static int wpa_ft_process_auth_req(struc
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ ftie = (struct rsn_ftie *) parse.ftie;
|
||||
+ os_memcpy(sm->SNonce, ftie->snonce, WPA_NONCE_LEN);
|
||||
+
|
||||
if (parse.r0kh_id == NULL) {
|
||||
wpa_printf(MSG_DEBUG, "FT: Invalid FTIE - no R0KH-ID");
|
||||
retval = WLAN_STATUS_INVALID_FTIE;
|
||||
@@ -3424,10 +3433,18 @@ pmk_r1_derived:
|
||||
os_memcpy(sm->pmk_r1, pmk_r1, pmk_r1_len);
|
||||
sm->pmk_r1_len = pmk_r1_len;
|
||||
|
||||
- if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
|
||||
- wpa_printf(MSG_DEBUG, "FT: Failed to get random data for "
|
||||
- "ANonce");
|
||||
- goto out;
|
||||
+ if (os_get_reltime(&now) < 0 ||
|
||||
+ os_reltime_expired(&now, &sm->ANonce_time, 1)) {
|
||||
+ if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) {
|
||||
+ wpa_printf(MSG_DEBUG, "FT: Failed to get random data for "
|
||||
+ "ANonce");
|
||||
+ return WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
+ }
|
||||
+ sm->ANonce_time.sec = now.sec;
|
||||
+ sm->ANonce_time.usec = now.usec;
|
||||
+ wpa_printf(MSG_INFO, "FT: ANonce was randomized");
|
||||
+ } else {
|
||||
+ wpa_printf(MSG_INFO, "FT: ANonce has not expired");
|
||||
}
|
||||
|
||||
/* Now that we know the correct PMK-R1 length and as such, the length
|
||||
@@ -32,7 +32,6 @@ ALLWIFIBOARDS:= \
|
||||
cybertan-eww622-a1 \
|
||||
cybertan-eww631-a1 \
|
||||
cybertan-eww631-b1 \
|
||||
cybertan-rap630w-312g \
|
||||
edgecore-eap101 \
|
||||
gl-ax1800 \
|
||||
gl-axt1800 \
|
||||
@@ -40,6 +39,7 @@ ALLWIFIBOARDS:= \
|
||||
sercomm-wallaby \
|
||||
edgecore-eap102 \
|
||||
edgecore-oap102 \
|
||||
edgecore-oap103 \
|
||||
edgecore-eap104 \
|
||||
liteon-wpx8324 \
|
||||
indio-um-310ax-v1 \
|
||||
@@ -52,6 +52,7 @@ ALLWIFIBOARDS:= \
|
||||
wallys-dr6018-v4 \
|
||||
sonicfi-rap630c-311g \
|
||||
sonicfi-rap630w-311g \
|
||||
sonicfi-rap630w-312g \
|
||||
tplink-ex227 \
|
||||
tplink-ex447 \
|
||||
yuncore-ax840 \
|
||||
@@ -394,13 +395,13 @@ $(eval $(call generate-ath11k-wifi-package,cig-wf194c4,Cigtech WF194c4))
|
||||
$(eval $(call generate-ath11k-wifi-package,cybertan-eww622-a1,CyberTan EWW622 A1))
|
||||
$(eval $(call generate-ath11k-wifi-package,cybertan-eww631-a1,CyberTan EWW631 A1))
|
||||
$(eval $(call generate-ath11k-wifi-package,cybertan-eww631-b1,CyberTan EWW631 B1))
|
||||
$(eval $(call generate-ath11k-wifi-package,cybertan-rap630w-312g,CyberTan RAP630W 312G))
|
||||
$(eval $(call generate-ath11k-wifi-package,sercomm-wallaby,Sercomm Kiwi))
|
||||
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018,Wallys DR6018))
|
||||
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018-v4,Wallys DR6018 V4))
|
||||
$(eval $(call generate-ath11k-wifi-package,edgecore-eap101,EdgeCore EAP101))
|
||||
$(eval $(call generate-ath11k-wifi-package,edgecore-eap102,Edgecore EAP102))
|
||||
$(eval $(call generate-ath11k-wifi-package,edgecore-oap102,Edgecore OAP102))
|
||||
$(eval $(call generate-ath11k-wifi-package,edgecore-oap103,Edgecore OAP103))
|
||||
$(eval $(call generate-ath11k-wifi-package,edgecore-eap104,Edgecore EAP104))
|
||||
$(eval $(call generate-ath11k-wifi-package,liteon-wpx8324,Liteon WPX8324))
|
||||
$(eval $(call generate-ath11k-wifi-package,indio-um-310ax-v1,Indio UM-310AX V1))
|
||||
@@ -408,6 +409,7 @@ $(eval $(call generate-ath11k-wifi-package,indio-um-510axp-v1,Indio UM-510AXP V1
|
||||
$(eval $(call generate-ath11k-wifi-package,indio-um-510axm-v1,Indio UM-510AXM V1))
|
||||
$(eval $(call generate-ath11k-wifi-package,sonicfi-rap630c-311g,Sonicfi RAP630C 311G))
|
||||
$(eval $(call generate-ath11k-wifi-package,sonicfi-rap630w-311g,Sonicfi RAP630W 311G))
|
||||
$(eval $(call generate-ath11k-wifi-package,sonicfi-rap630w-312g,Sonicfi RAP630W 312G))
|
||||
$(eval $(call generate-ath11k-wifi-package,tplink-ex227,TP-Link EX227))
|
||||
$(eval $(call generate-ath11k-wifi-package,tplink-ex447,TP-Link EX447))
|
||||
$(eval $(call generate-ath11k-wifi-package,yuncore-ax840,YunCore AX840))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
feeds/ipq807x_v5.4/ath11k-wifi/board-edgecore-oap103.bin.IPQ8074
Normal file
BIN
feeds/ipq807x_v5.4/ath11k-wifi/board-edgecore-oap103.bin.IPQ8074
Normal file
Binary file not shown.
@@ -340,6 +340,7 @@ hostapd_common_add_bss_config() {
|
||||
wpa_group_rekey wpa_pair_rekey wpa_master_rekey
|
||||
config_add_boolean wpa_strict_rekey
|
||||
config_add_boolean wpa_disable_eapol_key_retries
|
||||
config_add_boolean multi_psk
|
||||
|
||||
config_add_boolean tdls_prohibit
|
||||
|
||||
@@ -724,7 +725,7 @@ hostapd_set_bss_options() {
|
||||
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
|
||||
multicast_to_unicast_all proxy_arp per_sta_vif \
|
||||
eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
|
||||
vendor_elements fils uci_section dynamic_probe_resp
|
||||
vendor_elements fils uci_section dynamic_probe_resp multi_psk
|
||||
|
||||
set_default fils 0
|
||||
set_default isolate 0
|
||||
@@ -737,6 +738,7 @@ hostapd_set_bss_options() {
|
||||
set_default wmm 1
|
||||
set_default uapsd 1
|
||||
set_default wpa_disable_eapol_key_retries 0
|
||||
set_default multi_psk $multi_psk
|
||||
set_default tdls_prohibit 0
|
||||
set_default eapol_version $((wpa & 1))
|
||||
set_default acct_port 1813
|
||||
|
||||
@@ -26,11 +26,12 @@ function event_cb_6g(req) {
|
||||
return 0;
|
||||
|
||||
let ssid = iface.ssid;
|
||||
if (!ssid || !length(ssids[ssid].keys))
|
||||
|
||||
if (!ssid || !ssids[ssid].mpsk)
|
||||
return 0;
|
||||
|
||||
let ssid_cache = cache[ssid];
|
||||
if (ssid_cache && ssid_cache[addr])
|
||||
if (ssid_cache && addr in ssid_cache)
|
||||
return 0;
|
||||
|
||||
if (req.type == 'probe') {
|
||||
@@ -53,15 +54,15 @@ function event_cb(req) {
|
||||
return 0;
|
||||
|
||||
let ssid = iface.ssid;
|
||||
if (!ssid || !length(ssids[ssid].keys))
|
||||
if (!ssid || !ssids[ssid].mpsk)
|
||||
return 0;
|
||||
|
||||
let ssid_cache = cache[ssid];
|
||||
if (ssid_cache && ssid_cache[addr])
|
||||
if (ssid_cache && addr in ssid_cache)
|
||||
return 0;
|
||||
|
||||
printf(`reply to ${req.type} on ${req.data.ifname} from ${addr} without 6G RNR\n`);
|
||||
return 2;
|
||||
return 2;
|
||||
}
|
||||
|
||||
function create_6g_subscriber() {
|
||||
@@ -143,6 +144,7 @@ function netifd_reload() {
|
||||
|
||||
push(ssid.interfaces, iface.ifname);
|
||||
ssid.bands[band] = iface.ifname;
|
||||
ssid.mpsk = config.multi_psk;
|
||||
for (let sta in iface.stations) {
|
||||
let stacfg = sta.config;
|
||||
|
||||
@@ -174,6 +176,20 @@ function iface_ssid(ifname) {
|
||||
return iface.ssid;
|
||||
}
|
||||
|
||||
function is_ssid_mpsk(ifname) {
|
||||
let ssid = iface_ssid(ifname);
|
||||
if (!ssid)
|
||||
return false;
|
||||
|
||||
if (!ssids[ssid])
|
||||
return false;
|
||||
|
||||
if (!ssids[ssid]?.mpsk)
|
||||
return false;
|
||||
|
||||
return ssids[ssid].mpsk;
|
||||
}
|
||||
|
||||
function sta_cache_entry_get(ssid, addr) {
|
||||
let ssid_cache = cache[ssid] ?? {};
|
||||
|
||||
@@ -292,6 +308,9 @@ function sta_auth_cache(ifname, addr, idx, phrase) {
|
||||
function auth_cb(msg) {
|
||||
let data = msg.data;
|
||||
|
||||
if (!is_ssid_mpsk(data.iface))
|
||||
return;
|
||||
|
||||
printf(`Event ${msg.type}: ${msg.data}\n`);
|
||||
switch (msg.type) {
|
||||
case 'sta_auth':
|
||||
|
||||
@@ -606,12 +606,13 @@
|
||||
for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) {
|
||||
if (!is_broadcast_ether_addr(pw->peer_addr) &&
|
||||
os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0)
|
||||
@@ -519,6 +525,31 @@ static const char * sae_get_password(str
|
||||
@@ -519,6 +525,33 @@ static const char * sae_get_password(str
|
||||
pt = hapd->conf->ssid.pt;
|
||||
}
|
||||
|
||||
+use_sta_psk:
|
||||
+ if (!password && sta) {
|
||||
+ sta->psk_idx = 0;
|
||||
+ for (psk = sta->psk; psk; psk = psk->next) {
|
||||
+ if (!psk->is_passphrase)
|
||||
+ continue;
|
||||
@@ -620,6 +621,7 @@
|
||||
+ if (!sta->use_sta_psk)
|
||||
+ break;
|
||||
+
|
||||
+ sta->psk_idx = 1;
|
||||
+ if (sta->sae_pt) {
|
||||
+ pt = sta->sae_pt;
|
||||
+ break;
|
||||
@@ -638,7 +640,7 @@
|
||||
if (pw_entry)
|
||||
*pw_entry = pw;
|
||||
if (s_pt)
|
||||
@@ -3698,6 +3729,12 @@ static void handle_auth(struct hostapd_d
|
||||
@@ -3698,6 +3731,12 @@ static void handle_auth(struct hostapd_d
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -686,15 +688,15 @@
|
||||
char *radius_cui; /* Chargeable-User-Identity from RADIUS */
|
||||
--- a/src/ap/wpa_auth_glue.c
|
||||
+++ b/src/ap/wpa_auth_glue.c
|
||||
@@ -337,6 +337,7 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
struct sta_info *sta = ap_get_sta(hapd, addr);
|
||||
const u8 *psk;
|
||||
@@ -355,6 +355,7 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
}
|
||||
#endif /* CONFIG_SAE */
|
||||
|
||||
+ sta->psk_idx = 0;
|
||||
if (vlan_id)
|
||||
*vlan_id = 0;
|
||||
if (psk_len)
|
||||
@@ -381,13 +382,18 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
#ifdef CONFIG_OWE
|
||||
if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) &&
|
||||
sta && sta->owe_pmk) {
|
||||
@@ -381,12 +382,17 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
* returned psk which should not be returned again.
|
||||
* logic list (all hostapd_get_psk; all sta->psk)
|
||||
*/
|
||||
@@ -702,28 +704,26 @@
|
||||
+ psk = NULL;
|
||||
if (sta && sta->psk && !psk) {
|
||||
struct hostapd_sta_wpa_psk_short *pos;
|
||||
+ int psk_idx;
|
||||
+ int psk_idx = 1;
|
||||
|
||||
if (vlan_id)
|
||||
*vlan_id = 0;
|
||||
psk = sta->psk->psk;
|
||||
+ sta->psk_idx = psk_idx = 1;
|
||||
+ if (vlan_id)
|
||||
+ sta->psk_idx = psk_idx;
|
||||
for (pos = sta->psk; pos; pos = pos->next) {
|
||||
+ psk_idx++;
|
||||
if (pos->is_passphrase) {
|
||||
pbkdf2_sha1(pos->passphrase,
|
||||
hapd->conf->ssid.ssid,
|
||||
@@ -396,10 +402,14 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
pos->is_passphrase = 0;
|
||||
@@ -397,9 +403,13 @@ static const u8 * hostapd_wpa_auth_get_p
|
||||
}
|
||||
if (pos->psk == prev_psk) {
|
||||
+ sta->psk_idx = psk_idx;
|
||||
psk = pos->next ? pos->next->psk : NULL;
|
||||
+ if (vlan_id)
|
||||
+ sta->psk_idx = psk_idx + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (!psk)
|
||||
+ if (vlan_id && !psk)
|
||||
+ sta->psk_idx = 0;
|
||||
}
|
||||
return psk;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -1527,19 +1527,15 @@ int hostapd_setup_bss(struct hostapd_dat
|
||||
if (x_snoop_init(hapd)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"Generic snooping infrastructure initialization failed");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (dhcp_snoop_init(hapd)) {
|
||||
+ conf->proxy_arp = 0;
|
||||
+ } else if (dhcp_snoop_init(hapd)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"DHCP snooping initialization failed");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (ndisc_snoop_init(hapd)) {
|
||||
+ conf->proxy_arp = 0;
|
||||
+ } else if (ndisc_snoop_init(hapd)) {
|
||||
wpa_printf(MSG_ERROR,
|
||||
"Neighbor Discovery snooping initialization failed");
|
||||
- return -1;
|
||||
+ conf->proxy_arp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,411 @@
|
||||
From: Jouni Malinen <quic_jouni@quicinc.com>
|
||||
Date: Tue, 14 Feb 2023 11:29:30 +0200
|
||||
Subject: [PATCH] FT: Store PMK-R0/PMK-R1 after EAPOL-Key msg 2/4 MIC
|
||||
validation
|
||||
|
||||
hostapd was previously storing the derived PMK-R0 and PMK-R1 as soon as
|
||||
these keys were derived. While that is fine for most purposes, it is
|
||||
unnecessary to do that so quickly and if anything were to fail before
|
||||
the supplicant is able to return a valid EAPOL-Key msg 2/4, there would
|
||||
not really be any real use for the derived keys.
|
||||
|
||||
For the special case of FT-PSK and VLAN determination based on the
|
||||
wpa_psk file, the VLAN information is set in the per-STA data structures
|
||||
only after the EAPOL-Key msg 2/4 MIC has been verified. This ended up
|
||||
storing the PMK-R0/PMK-R1 entries without correct VLAN assignment and as
|
||||
such, any use of the FT protocol would not be able to transfer the VLAN
|
||||
information through RRB.
|
||||
|
||||
Split local storing of the FT key hierarchy for the cases using the FT
|
||||
4-way handshake so that PMK-R0 and PMK-R1 are first derived and then
|
||||
stored as a separate step after having verified the MIC in the EAPOL-Key
|
||||
msg 2/4 (i.e., after having confirmed the per-STA passphrase/PSK was
|
||||
selected) and VLAN update. This fixes VLAN information for the
|
||||
wpa_psk_file cases with FT-PSK.
|
||||
|
||||
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
|
||||
---
|
||||
|
||||
--- a/src/ap/wpa_auth.c
|
||||
+++ b/src/ap/wpa_auth.c
|
||||
@@ -58,7 +58,9 @@ static int wpa_group_config_group_keys(s
|
||||
struct wpa_group *group);
|
||||
static int wpa_derive_ptk(struct wpa_state_machine *sm, const u8 *snonce,
|
||||
const u8 *pmk, unsigned int pmk_len,
|
||||
- struct wpa_ptk *ptk, int force_sha256);
|
||||
+ struct wpa_ptk *ptk, int force_sha256,
|
||||
+ u8 *pmk_r0, u8 *pmk_r1, u8 *pmk_r0_name,
|
||||
+ size_t *key_len);
|
||||
static void wpa_group_free(struct wpa_authenticator *wpa_auth,
|
||||
struct wpa_group *group);
|
||||
static void wpa_group_get(struct wpa_authenticator *wpa_auth,
|
||||
@@ -940,6 +942,10 @@ static int wpa_try_alt_snonce(struct wpa
|
||||
const u8 *pmk = NULL;
|
||||
size_t pmk_len;
|
||||
int vlan_id = 0;
|
||||
+ u8 pmk_r0[PMK_LEN_MAX], pmk_r0_name[WPA_PMK_NAME_LEN];
|
||||
+ u8 pmk_r1[PMK_LEN_MAX];
|
||||
+ size_t key_len;
|
||||
+ int ret = -1;
|
||||
|
||||
os_memset(&PTK, 0, sizeof(PTK));
|
||||
for (;;) {
|
||||
@@ -961,8 +967,8 @@ static int wpa_try_alt_snonce(struct wpa
|
||||
pmk_len = sm->pmk_len;
|
||||
}
|
||||
|
||||
- if (wpa_derive_ptk(sm, sm->alt_SNonce, pmk, pmk_len, &PTK, 0) <
|
||||
- 0)
|
||||
+ if (wpa_derive_ptk(sm, sm->alt_SNonce, pmk, pmk_len, &PTK, 0,
|
||||
+ pmk_r0, pmk_r1, pmk_r0_name, &key_len) < 0)
|
||||
break;
|
||||
|
||||
if (wpa_verify_key_mic(sm->wpa_key_mgmt, pmk_len, &PTK,
|
||||
@@ -983,7 +989,7 @@ static int wpa_try_alt_snonce(struct wpa
|
||||
if (!ok) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"WPA: Earlier SNonce did not result in matching MIC");
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
wpa_printf(MSG_DEBUG,
|
||||
@@ -992,14 +998,26 @@ static int wpa_try_alt_snonce(struct wpa
|
||||
|
||||
if (vlan_id && wpa_key_mgmt_wpa_psk(sm->wpa_key_mgmt) &&
|
||||
wpa_auth_update_vlan(sm->wpa_auth, sm->addr, vlan_id) < 0)
|
||||
- return -1;
|
||||
+ goto fail;
|
||||
+
|
||||
+#ifdef CONFIG_IEEE80211R_AP
|
||||
+ if (wpa_key_mgmt_ft(sm->wpa_key_mgmt) && !sm->ft_completed) {
|
||||
+ wpa_printf(MSG_DEBUG, "FT: Store PMK-R0/PMK-R1");
|
||||
+ wpa_auth_ft_store_keys(sm, pmk_r0, pmk_r1, pmk_r0_name,
|
||||
+ key_len);
|
||||
+ }
|
||||
+#endif /* CONFIG_IEEE80211R_AP */
|
||||
|
||||
os_memcpy(sm->SNonce, sm->alt_SNonce, WPA_NONCE_LEN);
|
||||
os_memcpy(&sm->PTK, &PTK, sizeof(PTK));
|
||||
forced_memzero(&PTK, sizeof(PTK));
|
||||
sm->PTK_valid = true;
|
||||
|
||||
- return 0;
|
||||
+ ret = 0;
|
||||
+fail:
|
||||
+ forced_memzero(pmk_r0, sizeof(pmk_r0));
|
||||
+ forced_memzero(pmk_r1, sizeof(pmk_r1));
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2283,7 +2301,9 @@ SM_STATE(WPA_PTK, PTKSTART)
|
||||
|
||||
static int wpa_derive_ptk(struct wpa_state_machine *sm, const u8 *snonce,
|
||||
const u8 *pmk, unsigned int pmk_len,
|
||||
- struct wpa_ptk *ptk, int force_sha256)
|
||||
+ struct wpa_ptk *ptk, int force_sha256,
|
||||
+ u8 *pmk_r0, u8 *pmk_r1, u8 *pmk_r0_name,
|
||||
+ size_t *key_len)
|
||||
{
|
||||
const u8 *z = NULL;
|
||||
size_t z_len = 0, kdk_len;
|
||||
@@ -2311,7 +2331,8 @@ static int wpa_derive_ptk(struct wpa_sta
|
||||
sm->pairwise,
|
||||
kdk_len);
|
||||
}
|
||||
- return wpa_auth_derive_ptk_ft(sm, ptk);
|
||||
+ return wpa_auth_derive_ptk_ft(sm, ptk, pmk_r0, pmk_r1,
|
||||
+ pmk_r0_name, key_len);
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211R_AP */
|
||||
|
||||
@@ -2934,6 +2955,9 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
struct wpa_eapol_ie_parse kde;
|
||||
int vlan_id = 0;
|
||||
int owe_ptk_workaround = !!wpa_auth->conf.owe_ptk_workaround;
|
||||
+ u8 pmk_r0[PMK_LEN_MAX], pmk_r0_name[WPA_PMK_NAME_LEN];
|
||||
+ u8 pmk_r1[PMK_LEN_MAX];
|
||||
+ size_t key_len;
|
||||
|
||||
SM_ENTRY_MA(WPA_PTK, PTKCALCNEGOTIATING, wpa_ptk);
|
||||
sm->EAPOLKeyReceived = false;
|
||||
@@ -2972,7 +2996,8 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
}
|
||||
|
||||
if (wpa_derive_ptk(sm, sm->SNonce, pmk, pmk_len, &PTK,
|
||||
- owe_ptk_workaround == 2) < 0)
|
||||
+ owe_ptk_workaround == 2, pmk_r0, pmk_r1,
|
||||
+ pmk_r0_name, &key_len) < 0)
|
||||
break;
|
||||
|
||||
if (mic_len &&
|
||||
@@ -3021,7 +3046,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
sm->last_rx_eapol_key,
|
||||
sm->last_rx_eapol_key_len);
|
||||
sm->waiting_radius_psk = 1;
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
@@ -3029,7 +3054,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
"invalid MIC in msg 2/4 of 4-Way Handshake");
|
||||
if (psk_found)
|
||||
wpa_auth_psk_failure_report(sm->wpa_auth, sm->addr);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3043,12 +3068,12 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
key_data_length = WPA_GET_BE16(mic + mic_len);
|
||||
if (key_data_length > sm->last_rx_eapol_key_len - sizeof(*hdr) -
|
||||
sizeof(*key) - mic_len - 2)
|
||||
- return;
|
||||
+ goto out;
|
||||
|
||||
if (wpa_parse_kde_ies(key_data, key_data_length, &kde) < 0) {
|
||||
wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_INFO,
|
||||
"received EAPOL-Key msg 2/4 with invalid Key Data contents");
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
if (kde.rsn_ie) {
|
||||
eapol_key_ie = kde.rsn_ie;
|
||||
@@ -3075,7 +3100,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
/* MLME-DEAUTHENTICATE.request */
|
||||
wpa_sta_disconnect(wpa_auth, sm->addr,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
if ((!sm->rsnxe && kde.rsnxe) ||
|
||||
(sm->rsnxe && !kde.rsnxe) ||
|
||||
@@ -3091,7 +3116,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
/* MLME-DEAUTHENTICATE.request */
|
||||
wpa_sta_disconnect(wpa_auth, sm->addr,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
#ifdef CONFIG_OCV
|
||||
if (wpa_auth_uses_ocv(sm)) {
|
||||
@@ -3103,14 +3128,14 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
if (wpa_channel_info(wpa_auth, &ci) != 0) {
|
||||
wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
|
||||
"Failed to get channel info to validate received OCI in EAPOL-Key 2/4");
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (get_sta_tx_parameters(sm,
|
||||
channel_width_to_int(ci.chanwidth),
|
||||
ci.seg1_idx, &tx_chanwidth,
|
||||
&tx_seg1_idx) < 0)
|
||||
- return;
|
||||
+ goto out;
|
||||
|
||||
res = ocv_verify_tx_params(kde.oci, kde.oci_len, &ci,
|
||||
tx_chanwidth, tx_seg1_idx);
|
||||
@@ -3127,7 +3152,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
OCV_FAILURE "addr=" MACSTR
|
||||
" frame=eapol-key-m2 error=%s",
|
||||
MAC2STR(sm->addr), ocv_errorstr);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_OCV */
|
||||
@@ -3135,7 +3160,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
if (ft && ft_check_msg_2_of_4(wpa_auth, sm, &kde) < 0) {
|
||||
wpa_sta_disconnect(wpa_auth, sm->addr,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211R_AP */
|
||||
#ifdef CONFIG_P2P
|
||||
@@ -3171,7 +3196,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
"DPP: Peer indicated it supports PFS and local configuration allows this, but PFS was not negotiated for the association");
|
||||
wpa_sta_disconnect(wpa_auth, sm->addr,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_DPP2 */
|
||||
@@ -3191,7 +3216,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
sm->sup_pmk_r1_name, WPA_PMK_NAME_LEN);
|
||||
wpa_hexdump(MSG_DEBUG, "FT: Derived PMKR1Name",
|
||||
sm->pmk_r1_name, WPA_PMK_NAME_LEN);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211R_AP */
|
||||
@@ -3200,7 +3225,7 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
wpa_auth_update_vlan(wpa_auth, sm->addr, vlan_id) < 0) {
|
||||
wpa_sta_disconnect(wpa_auth, sm->addr,
|
||||
WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
sm->pending_1_of_4_timeout = 0;
|
||||
@@ -3216,9 +3241,20 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
|
||||
|
||||
sm->MICVerified = true;
|
||||
|
||||
+#ifdef CONFIG_IEEE80211R_AP
|
||||
+ if (wpa_key_mgmt_ft(sm->wpa_key_mgmt) && !sm->ft_completed) {
|
||||
+ wpa_printf(MSG_DEBUG, "FT: Store PMK-R0/PMK-R1");
|
||||
+ wpa_auth_ft_store_keys(sm, pmk_r0, pmk_r1, pmk_r0_name,
|
||||
+ key_len);
|
||||
+ }
|
||||
+#endif /* CONFIG_IEEE80211R_AP */
|
||||
+
|
||||
os_memcpy(&sm->PTK, &PTK, sizeof(PTK));
|
||||
forced_memzero(&PTK, sizeof(PTK));
|
||||
sm->PTK_valid = true;
|
||||
+out:
|
||||
+ forced_memzero(pmk_r0, sizeof(pmk_r0));
|
||||
+ forced_memzero(pmk_r1, sizeof(pmk_r1));
|
||||
}
|
||||
|
||||
|
||||
--- a/src/ap/wpa_auth_ft.c
|
||||
+++ b/src/ap/wpa_auth_ft.c
|
||||
@@ -2175,13 +2175,13 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
|
||||
}
|
||||
|
||||
|
||||
-int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, struct wpa_ptk *ptk)
|
||||
+int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, struct wpa_ptk *ptk,
|
||||
+ u8 *pmk_r0, u8 *pmk_r1, u8 *pmk_r0_name,
|
||||
+ size_t *key_len)
|
||||
{
|
||||
- u8 pmk_r0[PMK_LEN_MAX], pmk_r0_name[WPA_PMK_NAME_LEN];
|
||||
size_t pmk_r0_len = wpa_key_mgmt_sha384(sm->wpa_key_mgmt) ?
|
||||
SHA384_MAC_LEN : PMK_LEN;
|
||||
size_t pmk_r1_len = pmk_r0_len;
|
||||
- u8 pmk_r1[PMK_LEN_MAX];
|
||||
u8 ptk_name[WPA_PMK_NAME_LEN];
|
||||
const u8 *mdid = sm->wpa_auth->conf.mobility_domain;
|
||||
const u8 *r0kh = sm->wpa_auth->conf.r0_key_holder;
|
||||
@@ -2189,13 +2189,6 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
|
||||
const u8 *r1kh = sm->wpa_auth->conf.r1_key_holder;
|
||||
const u8 *ssid = sm->wpa_auth->conf.ssid;
|
||||
size_t ssid_len = sm->wpa_auth->conf.ssid_len;
|
||||
- int psk_local = sm->wpa_auth->conf.ft_psk_generate_local;
|
||||
- int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
|
||||
- struct vlan_description vlan;
|
||||
- struct rate_description rate;
|
||||
- const u8 *identity, *radius_cui;
|
||||
- size_t identity_len, radius_cui_len;
|
||||
- int session_timeout;
|
||||
const u8 *mpmk;
|
||||
size_t mpmk_len;
|
||||
|
||||
@@ -2211,10 +2204,41 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ *key_len = pmk_r0_len;
|
||||
+ if (wpa_derive_pmk_r0(mpmk, mpmk_len, ssid, ssid_len, mdid,
|
||||
+ r0kh, r0kh_len, sm->addr,
|
||||
+ pmk_r0, pmk_r0_name,
|
||||
+ pmk_r0_len == SHA384_MAC_LEN) < 0 ||
|
||||
+ wpa_derive_pmk_r1(pmk_r0, pmk_r0_len, pmk_r0_name, r1kh, sm->addr,
|
||||
+ pmk_r1, sm->pmk_r1_name) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return wpa_pmk_r1_to_ptk(pmk_r1, pmk_r1_len, sm->SNonce, sm->ANonce,
|
||||
+ sm->addr, sm->wpa_auth->addr, sm->pmk_r1_name,
|
||||
+ ptk, ptk_name, sm->wpa_key_mgmt, sm->pairwise,
|
||||
+ 0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void wpa_auth_ft_store_keys(struct wpa_state_machine *sm, const u8 *pmk_r0,
|
||||
+ const u8 *pmk_r1, const u8 *pmk_r0_name,
|
||||
+ size_t key_len)
|
||||
+{
|
||||
+ int psk_local = sm->wpa_auth->conf.ft_psk_generate_local;
|
||||
+ int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
|
||||
+ struct vlan_description vlan;
|
||||
+ struct rate_description rate;
|
||||
+ const u8 *identity, *radius_cui;
|
||||
+ size_t identity_len, radius_cui_len;
|
||||
+ int session_timeout;
|
||||
+
|
||||
+ if (psk_local && wpa_key_mgmt_ft_psk(sm->wpa_key_mgmt))
|
||||
+ return;
|
||||
+
|
||||
if (wpa_ft_get_vlan(sm->wpa_auth, sm->addr, &vlan) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "FT: vlan not available for STA " MACSTR,
|
||||
MAC2STR(sm->addr));
|
||||
- return -1;
|
||||
+ return;
|
||||
}
|
||||
|
||||
wpa_ft_get_rate_limit(sm->wpa_auth, sm->addr, &rate);
|
||||
@@ -2224,32 +2248,16 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
|
||||
&radius_cui);
|
||||
session_timeout = wpa_ft_get_session_timeout(sm->wpa_auth, sm->addr);
|
||||
|
||||
- if (wpa_derive_pmk_r0(mpmk, mpmk_len, ssid, ssid_len, mdid,
|
||||
- r0kh, r0kh_len, sm->addr,
|
||||
- pmk_r0, pmk_r0_name,
|
||||
- wpa_key_mgmt_sha384(sm->wpa_key_mgmt)) < 0)
|
||||
- return -1;
|
||||
- if (!psk_local || !wpa_key_mgmt_ft_psk(sm->wpa_key_mgmt))
|
||||
- wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, pmk_r0_len,
|
||||
- pmk_r0_name,
|
||||
- sm->pairwise, &vlan, expires_in,
|
||||
- session_timeout, identity, identity_len,
|
||||
- radius_cui, radius_cui_len, &rate);
|
||||
-
|
||||
- if (wpa_derive_pmk_r1(pmk_r0, pmk_r0_len, pmk_r0_name, r1kh, sm->addr,
|
||||
- pmk_r1, sm->pmk_r1_name) < 0)
|
||||
- return -1;
|
||||
- if (!psk_local || !wpa_key_mgmt_ft_psk(sm->wpa_key_mgmt))
|
||||
- wpa_ft_store_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1, pmk_r1_len,
|
||||
- sm->pmk_r1_name, sm->pairwise, &vlan,
|
||||
- expires_in, session_timeout, identity,
|
||||
- identity_len, radius_cui, radius_cui_len,
|
||||
- &rate);
|
||||
-
|
||||
- return wpa_pmk_r1_to_ptk(pmk_r1, pmk_r1_len, sm->SNonce, sm->ANonce,
|
||||
- sm->addr, sm->wpa_auth->addr, sm->pmk_r1_name,
|
||||
- ptk, ptk_name, sm->wpa_key_mgmt, sm->pairwise,
|
||||
- 0);
|
||||
+ wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, key_len,
|
||||
+ pmk_r0_name,
|
||||
+ sm->pairwise, &vlan, expires_in,
|
||||
+ session_timeout, identity, identity_len,
|
||||
+ radius_cui, radius_cui_len, &rate);
|
||||
+
|
||||
+ wpa_ft_store_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1, key_len,
|
||||
+ sm->pmk_r1_name, sm->pairwise, &vlan,
|
||||
+ expires_in, session_timeout, identity,
|
||||
+ identity_len, radius_cui, radius_cui_len, &rate);
|
||||
}
|
||||
|
||||
|
||||
--- a/src/ap/wpa_auth_i.h
|
||||
+++ b/src/ap/wpa_auth_i.h
|
||||
@@ -302,7 +302,12 @@ int wpa_write_ftie(struct wpa_auth_confi
|
||||
const u8 *anonce, const u8 *snonce,
|
||||
u8 *buf, size_t len, const u8 *subelem,
|
||||
size_t subelem_len, int rsnxe_used);
|
||||
-int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, struct wpa_ptk *ptk);
|
||||
+int wpa_auth_derive_ptk_ft(struct wpa_state_machine *sm, struct wpa_ptk *ptk,
|
||||
+ u8 *pmk_r0, u8 *pmk_r1, u8 *pmk_r0_name,
|
||||
+ size_t *key_len);
|
||||
+void wpa_auth_ft_store_keys(struct wpa_state_machine *sm, const u8 *pmk_r0,
|
||||
+ const u8 *pmk_r1, const u8 *pmk_r0_name,
|
||||
+ size_t key_len);
|
||||
struct wpa_ft_pmk_cache * wpa_ft_pmk_cache_init(void);
|
||||
void wpa_ft_pmk_cache_deinit(struct wpa_ft_pmk_cache *cache);
|
||||
void wpa_ft_install_ptk(struct wpa_state_machine *sm, int retry);
|
||||
@@ -24,7 +24,7 @@ cybertan,eww631-a1|\
|
||||
cybertan,eww631-b1)
|
||||
ucidef_set_led_default "power" "POWER" "sys:blue" "on"
|
||||
;;
|
||||
cybertan,rap630w-312g)
|
||||
sonicfi,rap630w-312g)
|
||||
ucidef_set_led_default "power" "POWER" "red:power" "on"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt"
|
||||
|
||||
@@ -13,10 +13,10 @@ qcom_setup_interfaces()
|
||||
|
||||
case $board in
|
||||
cig,wf186w)
|
||||
ucidef_add_switch "switch0" "4:wan" "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0"
|
||||
ucidef_add_switch "switch0" "4:wan" "0:lan" "1:lan" "2:lan" "3:lan" "6u@eth0"
|
||||
;;
|
||||
cig,wf186h)
|
||||
ucidef_add_switch "switch0" "4:wan" "1:lan" "2:lan" "6@eth0"
|
||||
ucidef_add_switch "switch0" "4:wan" "1:lan" "2:lan" "6u@eth0"
|
||||
;;
|
||||
sonicfi,rap630c-311g|\
|
||||
cybertan,eww631-a1)
|
||||
@@ -25,11 +25,7 @@ qcom_setup_interfaces()
|
||||
;;
|
||||
sonicfi,rap630w-311g|\
|
||||
cybertan,eww631-b1)
|
||||
ucidef_add_switch "switch1" "5:wan" "2:lan" "3:lan" "4:lan" "6@eth0"
|
||||
;;
|
||||
cybertan,rap630w-312g)
|
||||
ucidef_add_switch "switch1" \
|
||||
"6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
ucidef_add_switch "switch1" "5:wan" "2:lan" "3:lan" "4:lan" "6u@eth0"
|
||||
;;
|
||||
udaya,a6-id2)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
@@ -50,7 +46,7 @@ qcom_setup_interfaces()
|
||||
edgecore,eap104)
|
||||
ucidef_set_interface_wan "eth0"
|
||||
ucidef_add_switch "switch1" \
|
||||
"6@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
"6u@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
;;
|
||||
hfcl,ion4x_w|\
|
||||
hfcl,ion4xi_w)
|
||||
@@ -63,12 +59,13 @@ qcom_setup_interfaces()
|
||||
ucidef_set_interface_wan "eth0"
|
||||
ucidef_set_interface_lan "eth1"
|
||||
;;
|
||||
sonicfi,rap630w-312g|\
|
||||
yuncore,fap655)
|
||||
ucidef_add_switch "switch1" \
|
||||
"6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
"6u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
;;
|
||||
glinet,b3000)
|
||||
ucidef_add_switch "switch1" "6@eth1" "1:wan" "2:lan" "3:lan"
|
||||
ucidef_add_switch "switch1" "6u@eth1" "1:wan" "2:lan" "3:lan"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -121,9 +121,9 @@ ath11k/IPQ5018/hw1.0/caldata.bin)
|
||||
cig,wf186h|\
|
||||
sonicfi,rap630c-311g|\
|
||||
sonicfi,rap630w-311g|\
|
||||
sonicfi,rap630w-312g|\
|
||||
cybertan,eww631-a1|\
|
||||
cybertan,eww631-b1|\
|
||||
cybertan,rap630w-312g|\
|
||||
edgecore,eap104|\
|
||||
edgecore,oap101|\
|
||||
edgecore,oap101-6e|\
|
||||
@@ -150,9 +150,9 @@ ath11k/qcn6122/hw1.0/caldata_1.bin)
|
||||
cig,wf186h|\
|
||||
sonicfi,rap630c-311g|\
|
||||
sonicfi,rap630w-311g|\
|
||||
sonicfi,rap630w-312g|\
|
||||
cybertan,eww631-a1|\
|
||||
cybertan,eww631-b1|\
|
||||
cybertan,rap630w-312g|\
|
||||
edgecore,oap101|\
|
||||
edgecore,oap101-6e|\
|
||||
edgecore,oap101e|\
|
||||
@@ -219,7 +219,7 @@ ath11k-macs)
|
||||
optimcloud,d60-5g|\
|
||||
optimcloud,d50|\
|
||||
optimcloud,d50-5g|\
|
||||
cybertan,rap630w-312g|\
|
||||
sonicfi,rap630w-312g|\
|
||||
yuncore,fap655)
|
||||
ath11k_generate_macs
|
||||
;;
|
||||
|
||||
@@ -6,26 +6,27 @@ board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"edgecore,eap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,eap102")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
"edgecore,eap102"|\
|
||||
"edgecore,oap103")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,oap101e-6e"|\
|
||||
"edgecore,oap101-6e")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy6g
|
||||
;;
|
||||
"edgecore,oap101e"|\
|
||||
"edgecore,oap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
"edgecore,eap104")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -72,9 +72,9 @@ platform_check_image() {
|
||||
cig,wf186h|\
|
||||
sonicfi,rap630c-311g|\
|
||||
sonicfi,rap630w-311g|\
|
||||
sonicfi,rap630w-312g|\
|
||||
cybertan,eww631-a1|\
|
||||
cybertan,eww631-b1|\
|
||||
cybertan,rap630w-312g|\
|
||||
edgecore,eap104|\
|
||||
wallys,dr5018|\
|
||||
hfcl,ion4x_w|\
|
||||
@@ -143,11 +143,11 @@ platform_do_upgrade() {
|
||||
}
|
||||
nand_upgrade_tar "$1"
|
||||
;;
|
||||
sonicfi,rap630c-311g|\
|
||||
sonicfi,rap630w-311g|\
|
||||
cybertan,eww631-a1|\
|
||||
cybertan,eww631-b1|\
|
||||
cybertan,rap630w-312g)
|
||||
sonicfi,rap630c-311g|\
|
||||
sonicfi,rap630w-311g|\
|
||||
sonicfi,rap630w-312g)
|
||||
boot_part=$(fw_printenv bootfrom | cut -d = -f2)
|
||||
echo "Current bootfrom is $boot_part"
|
||||
if [[ $boot_part == 1 ]]; then
|
||||
|
||||
3
feeds/ipq807x_v5.4/ipq50xx/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-eww631-a1.dts
Normal file → Executable file
3
feeds/ipq807x_v5.4/ipq50xx/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-eww631-a1.dts
Normal file → Executable file
@@ -817,10 +817,9 @@
|
||||
qcom,board_id = <0x24>;
|
||||
#ifdef __CNSS2__
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
|
||||
qcom,caldb-size = <0x200000>;
|
||||
mem-region = <&q6_ipq5018_data>;
|
||||
1235
|
||||
#else
|
||||
memory-region = <&q6_ipq5018_data>;
|
||||
#endif
|
||||
|
||||
78
feeds/ipq807x_v5.4/ipq50xx/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-eww631-b1.dts
Normal file → Executable file
78
feeds/ipq807x_v5.4/ipq50xx/files/arch/arm64/boot/dts/qcom/qcom-ipq5018-eww631-b1.dts
Normal file → Executable file
@@ -173,40 +173,40 @@
|
||||
* | data | | |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | data | 0x4C400000 | 14MB |
|
||||
* | data | 0x4C400000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | M3 Dump | 0x4D200000 | 1MB |
|
||||
* | M3 Dump | 0x4D100000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | QDSS | 0x4D300000 | 1MB |
|
||||
* | QDSS | 0x4D200000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | Caldb | 0x4D400000 | 2MB |
|
||||
* | Caldb | 0x4D300000 | 2MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | data | 0x4D600000 | 16MB |
|
||||
* | data | 0x4D500000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | M3 Dump | 0x4E600000 | 1MB |
|
||||
* | M3 Dump | 0x4E200000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | QDSS | 0x4E700000 | 1MB |
|
||||
* | QDSS | 0x4E300000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | Caldb | 0x4E800000 | 5MB |
|
||||
* | Caldb | 0x4E400000 | 5MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | data | 0x4ED00000 | 16MB |
|
||||
* | data | 0x4E900000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | M3 Dump | 0x4FD00000 | 1MB |
|
||||
* | M3 Dump | 0x4F600000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | QDSS | 0x4FE00000 | 1MB |
|
||||
* | QDSS | 0x4F700000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | Caldb | 0x4FF00000 | 5MB |
|
||||
* | Caldb | 0x4F800000 | 5MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | |
|
||||
* | Rest of the memory for Linux |
|
||||
@@ -215,7 +215,7 @@
|
||||
*/
|
||||
q6_mem_regions: q6_mem_regions@4B000000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4B000000 0x0 0x5400000>;
|
||||
reg = <0x0 0x4B000000 0x0 0x4D00000>;
|
||||
};
|
||||
|
||||
q6_code_data: q6_code_data@4B000000 {
|
||||
@@ -225,62 +225,62 @@
|
||||
|
||||
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4C400000 0x0 0xE00000>;
|
||||
reg = <0x0 0x4C400000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
m3_dump: m3_dump@4D200000 {
|
||||
m3_dump: m3_dump@4D100000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D100000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_etr_region: q6_etr_dump@4D200000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D200000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_etr_region: q6_etr_dump@4D300000 {
|
||||
q6_caldb_region: q6_caldb_region@4D300000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D300000 0x0 0x100000>;
|
||||
reg = <0x0 0x4D300000 0x0 0x200000>;
|
||||
};
|
||||
|
||||
q6_caldb_region: q6_caldb_region@4D400000 {
|
||||
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D400000 0x0 0x200000>;
|
||||
reg = <0x0 0x4D500000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_data1: q6_qcn6122_data1@4D600000 {
|
||||
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D600000 0x0 0x1000000>;
|
||||
reg = <0x0 0x4E200000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 {
|
||||
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E600000 0x0 0x100000>;
|
||||
reg = <0x0 0x4E300000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 {
|
||||
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E700000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E800000 0x0 0x500000>;
|
||||
reg = <0x0 0x4E400000 0x0 0x500000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4ED00000 0x0 0x1000000>;
|
||||
reg = <0x0 0x4E900000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 {
|
||||
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FD00000 0x0 0x100000>;
|
||||
reg = <0x0 0x4F600000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 {
|
||||
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FE00000 0x0 0x100000>;
|
||||
reg = <0x0 0x4F700000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 {
|
||||
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FF00000 0x0 0x500000>;
|
||||
reg = <0x0 0x4F800000 0x0 0x500000>;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -883,8 +883,8 @@
|
||||
#endif
|
||||
qcom,board_id = <0x24>;
|
||||
#ifdef __CNSS2__
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
|
||||
qcom,caldb-size = <0x200000>;
|
||||
mem-region = <&q6_ipq5018_data>;
|
||||
#else
|
||||
|
||||
@@ -816,10 +816,9 @@
|
||||
qcom,board_id = <0x24>;
|
||||
#ifdef __CNSS2__
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
|
||||
qcom,caldb-size = <0x200000>;
|
||||
mem-region = <&q6_ipq5018_data>;
|
||||
1235
|
||||
#else
|
||||
memory-region = <&q6_ipq5018_data>;
|
||||
#endif
|
||||
|
||||
@@ -175,40 +175,40 @@
|
||||
* | data | | |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | data | 0x4C400000 | 14MB |
|
||||
* | data | 0x4C400000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | M3 Dump | 0x4D200000 | 1MB |
|
||||
* | M3 Dump | 0x4D100000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | QDSS | 0x4D300000 | 1MB |
|
||||
* | QDSS | 0x4D200000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | IPQ5018 | | |
|
||||
* | Caldb | 0x4D400000 | 2MB |
|
||||
* | Caldb | 0x4D300000 | 2MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | data | 0x4D600000 | 16MB |
|
||||
* | data | 0x4D500000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | M3 Dump | 0x4E600000 | 1MB |
|
||||
* | M3 Dump | 0x4E200000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | QDSS | 0x4E700000 | 1MB |
|
||||
* | QDSS | 0x4E300000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_1| | |
|
||||
* | Caldb | 0x4E800000 | 5MB |
|
||||
* | Caldb | 0x4E400000 | 5MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | data | 0x4ED00000 | 16MB |
|
||||
* | data | 0x4E900000 | 13MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | M3 Dump | 0x4FD00000 | 1MB |
|
||||
* | M3 Dump | 0x4F600000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | QDSS | 0x4FE00000 | 1MB |
|
||||
* | QDSS | 0x4F700000 | 1MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | QCN6122_2| | |
|
||||
* | Caldb | 0x4FF00000 | 5MB |
|
||||
* | Caldb | 0x4F800000 | 5MB |
|
||||
* +----------+--------------+-------------------------+
|
||||
* | |
|
||||
* | Rest of the memory for Linux |
|
||||
@@ -217,7 +217,7 @@
|
||||
*/
|
||||
q6_mem_regions: q6_mem_regions@4B000000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4B000000 0x0 0x5400000>;
|
||||
reg = <0x0 0x4B000000 0x0 0x4D00000>;
|
||||
};
|
||||
|
||||
q6_code_data: q6_code_data@4B000000 {
|
||||
@@ -227,62 +227,62 @@
|
||||
|
||||
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4C400000 0x0 0xE00000>;
|
||||
reg = <0x0 0x4C400000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
m3_dump: m3_dump@4D200000 {
|
||||
m3_dump: m3_dump@4D100000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D100000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_etr_region: q6_etr_dump@4D200000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D200000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_etr_region: q6_etr_dump@4D300000 {
|
||||
q6_caldb_region: q6_caldb_region@4D300000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D300000 0x0 0x100000>;
|
||||
reg = <0x0 0x4D300000 0x0 0x200000>;
|
||||
};
|
||||
|
||||
q6_caldb_region: q6_caldb_region@4D400000 {
|
||||
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D400000 0x0 0x200000>;
|
||||
reg = <0x0 0x4D500000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_data1: q6_qcn6122_data1@4D600000 {
|
||||
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4D600000 0x0 0x1000000>;
|
||||
reg = <0x0 0x4E200000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 {
|
||||
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E600000 0x0 0x100000>;
|
||||
reg = <0x0 0x4E300000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 {
|
||||
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E700000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4E800000 0x0 0x500000>;
|
||||
reg = <0x0 0x4E400000 0x0 0x500000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4ED00000 0x0 0x1000000>;
|
||||
reg = <0x0 0x4E900000 0x0 0xD00000>;
|
||||
};
|
||||
|
||||
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 {
|
||||
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FD00000 0x0 0x100000>;
|
||||
reg = <0x0 0x4F600000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 {
|
||||
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FE00000 0x0 0x100000>;
|
||||
reg = <0x0 0x4F700000 0x0 0x100000>;
|
||||
};
|
||||
|
||||
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 {
|
||||
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
|
||||
no-map;
|
||||
reg = <0x0 0x4FF00000 0x0 0x500000>;
|
||||
reg = <0x0 0x4F800000 0x0 0x500000>;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -894,8 +894,8 @@
|
||||
#endif
|
||||
qcom,board_id = <0x24>;
|
||||
#ifdef __CNSS2__
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
|
||||
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
|
||||
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
|
||||
qcom,caldb-size = <0x200000>;
|
||||
mem-region = <&q6_ipq5018_data>;
|
||||
#else
|
||||
|
||||
@@ -22,16 +22,15 @@
|
||||
/ {
|
||||
#address-cells = <0x2>;
|
||||
#size-cells = <0x2>;
|
||||
model = "Cybertan RAP630W-312G";
|
||||
compatible = "cybertan,rap630w-312g", "qcom,ipq5018-mp03.3", "qcom,ipq5018";
|
||||
model = "Sonicfi RAP630W-312G";
|
||||
compatible = "sonicfi,rap630w-312g", "qcom,ipq5018-mp03.3", "qcom,ipq5018";
|
||||
interrupt-parent = <&intc>;
|
||||
|
||||
aliases {
|
||||
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
|
||||
serial0 = &blsp1_uart1;
|
||||
serial1 = &blsp1_uart2;
|
||||
ethernet0 = "/soc/dp1";
|
||||
ethernet1 = "/soc/dp2";
|
||||
ethernet1 = "/soc/dp1";
|
||||
|
||||
led-boot = &led_power;
|
||||
led-failsafe = &led_power;
|
||||
@@ -375,7 +374,7 @@
|
||||
port_id = <1>;
|
||||
phy_address = <7>;
|
||||
phy_dac = <0x10 0x10>;
|
||||
mdiobus = <&mdio0>;
|
||||
mdio-bus = <&mdio0>;
|
||||
};
|
||||
port@1 {
|
||||
mdio-bus = <&mdio0>;
|
||||
@@ -441,22 +440,6 @@
|
||||
};
|
||||
|
||||
dp1 {
|
||||
device_type = "network";
|
||||
compatible = "qcom,nss-dp";
|
||||
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
|
||||
clock-names = "nss-snoc-gmac-axi-clk";
|
||||
qcom,id = <1>;
|
||||
reg = <0x39C00000 0x10000>;
|
||||
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
|
||||
qcom,mactype = <2>;
|
||||
qcom,link-poll = <1>;
|
||||
qcom,phy-mdio-addr = <7>;
|
||||
mdio-bus = <&mdio0>;
|
||||
local-mac-address = [000000000000];
|
||||
phy-mode = "sgmii";
|
||||
};
|
||||
|
||||
dp2 {
|
||||
device_type = "network";
|
||||
compatible = "qcom,nss-dp";
|
||||
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
|
||||
|
||||
@@ -40,16 +40,16 @@ define Device/cybertan_eww631_b1
|
||||
endef
|
||||
TARGET_DEVICES += cybertan_eww631_b1
|
||||
|
||||
define Device/cybertan_rap630w_312g
|
||||
DEVICE_TITLE := CyberTan RAP630W-312G
|
||||
define Device/sonicfi_rap630w_312g
|
||||
DEVICE_TITLE := Sonicfi RAP630W-312G
|
||||
DEVICE_DTS := qcom-ipq5018-rap630w-312g
|
||||
SUPPORTED_DEVICES := cybertan,rap630w-312g
|
||||
DEVICE_PACKAGES := ath11k-wifi-cybertan-rap630w-312g ath11k-firmware-ipq50xx-map-spruce \
|
||||
SUPPORTED_DEVICES := sonicfi,rap630w-312g
|
||||
DEVICE_PACKAGES := ath11k-wifi-sonicfi-rap630w-312g ath11k-firmware-ipq50xx-map-spruce \
|
||||
-kmod-usb-dwc3-of-simple kmod-usb-dwc3-qcom kmod-usb3 \
|
||||
kmod-usb-uas kmod-fs-msdos kmod-fs-ntfs
|
||||
DEVICE_DTS_CONFIG := config@mp03.3
|
||||
endef
|
||||
TARGET_DEVICES += cybertan_rap630w_312g
|
||||
TARGET_DEVICES += sonicfi_rap630w_312g
|
||||
|
||||
define Device/sonicfi_rap630c_311g
|
||||
DEVICE_TITLE := Sonicfi RAP630C-311G
|
||||
|
||||
@@ -15,6 +15,9 @@ cig,wf188n)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
|
||||
ucidef_set_led_default "power" "POWER" "green:power" "on"
|
||||
;;
|
||||
cig,wf660a)
|
||||
ucidef_set_led_default "power" "POWER" "status:blue" "on"
|
||||
;;
|
||||
edgecore,eap101)
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
|
||||
|
||||
@@ -6,26 +6,27 @@ board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"edgecore,eap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,eap102")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
"edgecore,eap102"|\
|
||||
"edgecore,oap103")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,oap101e-6e"|\
|
||||
"edgecore,oap101-6e")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy6g
|
||||
;;
|
||||
"edgecore,oap101e"|\
|
||||
"edgecore,oap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
"edgecore,eap104")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -7,11 +7,12 @@ boot() {
|
||||
hfcl,ion4xe|\
|
||||
hfcl,ion4xi)
|
||||
fw_setenv boot_count 0
|
||||
;;
|
||||
;;
|
||||
edgecore,eap101|\
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102|\
|
||||
edgecore.eap104)
|
||||
edgecore,oap103|\
|
||||
edgecore,eap104)
|
||||
avail=$(fw_printenv -n upgrade_available)
|
||||
[ ${avail} -eq 0 ] && fw_setenv upgrade_available 1
|
||||
fw_setenv bootcount 0
|
||||
|
||||
@@ -145,7 +145,13 @@ platform_do_upgrade() {
|
||||
cig,wf660a)
|
||||
spi_nor_emmc_do_upgrade_bootconfig $1
|
||||
;;
|
||||
cig,wf188n|\
|
||||
cig,wf188n)
|
||||
[ -f /proc/boot_info/rootfs/upgradepartition ] && {
|
||||
CI_UBIPART="$(cat /proc/boot_info/rootfs/upgradepartition)"
|
||||
CI_BOOTCFG=1
|
||||
}
|
||||
nand_upgrade_tar "$1"
|
||||
;;
|
||||
glinet,ax1800|\
|
||||
glinet,axt1800|\
|
||||
wallys,dr6018|\
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "ipq6018-cpr-regulator.dtsi"
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/pwm/pwm.h>
|
||||
|
||||
/ {
|
||||
compatible = "cig,wf660a", "qcom,ipq6018-ap-cp01", "qcom,ipq6018";
|
||||
@@ -29,6 +28,11 @@
|
||||
ethernet2 = "/soc/dp3";
|
||||
ethernet3 = "/soc/dp4";
|
||||
ethernet4 = "/soc/dp5";
|
||||
|
||||
led-boot = &led_power;
|
||||
led-failsafe = &led_power;
|
||||
led-running = &led_power;
|
||||
led-upgrade = &led_power;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -155,6 +159,21 @@
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
button_pins: button_pins {
|
||||
wps_button {
|
||||
pins = "gpio9";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
reset_button {
|
||||
pins = "gpio19";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_pins: mdio_pinmux {
|
||||
mux_0 {
|
||||
@@ -181,20 +200,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
pwm_pins: pwm_pinmux {
|
||||
led_pins: led_pins {
|
||||
mux_1 {
|
||||
pins = "gpio22";
|
||||
function = "pwm02";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
};
|
||||
mux_2 {
|
||||
pins = "gpio23";
|
||||
function = "pwm12";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
};
|
||||
mux_3 {
|
||||
pins = "gpio24";
|
||||
function = "pwm22";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
};
|
||||
};
|
||||
@@ -208,27 +227,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
leds_pins: leds_pins {
|
||||
led_5g {
|
||||
pins = "gpio35";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
led_2g {
|
||||
pins = "gpio37";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
led_usb0 {
|
||||
pins = "gpio50";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
};
|
||||
|
||||
btcoex_pins: btcoex_pins {
|
||||
mux_0 {
|
||||
pins = "gpio51";
|
||||
@@ -390,36 +388,38 @@
|
||||
mdiobus = <&mdio>;
|
||||
};
|
||||
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm_pins>;
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
pinctrl-0 = <&button_pins>;
|
||||
pinctrl-names = "default";
|
||||
used-pwm-indices = <1>, <1>, <1>, <0>;
|
||||
dft-pwm-status = <0>, <1>, <0>, <0>;
|
||||
status = "ok";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&tlmm 19 GPIO_ACTIVE_LOW>;
|
||||
linux,input-type = <1>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
pinctrl-0 = <&leds_pins>;
|
||||
pinctrl-0 = <&led_pins>;
|
||||
pinctrl-names = "default";
|
||||
|
||||
led@35 {
|
||||
label = "led_5g";
|
||||
gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "led_5g";
|
||||
default-state = "off";
|
||||
led_power: led@22 {
|
||||
label = "status:blue";
|
||||
gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
led@37 {
|
||||
label = "led_2g";
|
||||
gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "led_2g";
|
||||
default-state = "off";
|
||||
|
||||
led@23 {
|
||||
label = "status:green";
|
||||
gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
led@50 {
|
||||
label = "led_usb0";
|
||||
gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "usb-host";
|
||||
default-state = "off";
|
||||
|
||||
led@24 {
|
||||
label = "status:red";
|
||||
gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/drivers/mmc/host/sdhci.c
|
||||
+++ b/drivers/mmc/host/sdhci.c
|
||||
@@ -367,7 +367,7 @@ static void __sdhci_led_deactivate(struc
|
||||
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
||||
}
|
||||
|
||||
-#if IS_REACHABLE(CONFIG_LEDS_CLASS)
|
||||
+#if 0
|
||||
static void sdhci_led_control(struct led_classdev *led,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
@@ -13,7 +13,8 @@ cig,wf194c4)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
|
||||
;;
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102)
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103)
|
||||
ucidef_set_led_netdev "poe" "poe" "green:wan" "eth0"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
|
||||
|
||||
@@ -23,6 +23,7 @@ qcom_setup_interfaces()
|
||||
;;
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103|\
|
||||
cig,wf196)
|
||||
ucidef_set_interface_lan "eth1"
|
||||
ucidef_set_interface_wan "eth0"
|
||||
|
||||
@@ -56,6 +56,7 @@ case "$FIRMWARE" in
|
||||
cig,wf196|\
|
||||
edgecore,eap102 |\
|
||||
edgecore,oap102 |\
|
||||
edgecore,oap103 |\
|
||||
edgecore,eap106 |\
|
||||
qcom,ipq807x-hk01|\
|
||||
qcom,ipq807x-hk14|\
|
||||
@@ -89,6 +90,7 @@ ath11k-macs)
|
||||
case "$board" in
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103|\
|
||||
edgecore,eap106)
|
||||
ath11k_generate_macs
|
||||
;;
|
||||
|
||||
@@ -6,26 +6,27 @@ board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"edgecore,eap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,eap102")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
"edgecore,eap102"|\
|
||||
"edgecore,oap103")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
;;
|
||||
"edgecore,oap101e-6e"|\
|
||||
"edgecore,oap101-6e")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy6g
|
||||
;;
|
||||
"edgecore,oap101e"|\
|
||||
"edgecore,oap101")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
"edgecore,eap104")
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
|
||||
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2g
|
||||
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy5g
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -11,7 +11,8 @@ boot() {
|
||||
edgecore,eap101|\
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102|\
|
||||
edgecore.eap104)
|
||||
edgecore,oap103|\
|
||||
edgecore,eap104)
|
||||
avail=$(fw_printenv -n upgrade_available)
|
||||
[ ${avail} -eq 0 ] && fw_setenv upgrade_available 1
|
||||
fw_setenv bootcount 0
|
||||
|
||||
@@ -27,6 +27,7 @@ platform_check_image() {
|
||||
cig,wf196|\
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103|\
|
||||
edgecore,eap106|\
|
||||
tplink,ex227|\
|
||||
tplink,ex447)
|
||||
@@ -46,8 +47,14 @@ platform_do_upgrade() {
|
||||
tplink,ex227)
|
||||
qca_do_upgrade "$1"
|
||||
;;
|
||||
cig,wf196)
|
||||
[ -f /proc/boot_info/rootfs/upgradepartition ] && {
|
||||
CI_UBIPART="$(cat /proc/boot_info/rootfs/upgradepartition)"
|
||||
CI_BOOTCFG=1
|
||||
}
|
||||
nand_upgrade_tar "$1"
|
||||
;;
|
||||
cig,wf194c4|\
|
||||
cig,wf196|\
|
||||
tplink,ex447)
|
||||
nand_upgrade_tar "$1"
|
||||
;;
|
||||
@@ -57,7 +64,8 @@ platform_do_upgrade() {
|
||||
nand_upgrade_tar "$1"
|
||||
;;
|
||||
edgecore,eap102|\
|
||||
edgecore,oap102)
|
||||
edgecore,oap102|\
|
||||
edgecore,oap103)
|
||||
if [ "$(find_mtd_chardev rootfs)" ]; then
|
||||
CI_UBIPART="rootfs"
|
||||
else
|
||||
|
||||
@@ -0,0 +1,736 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/dts-v1/;
|
||||
/* Copyright (c) 2020 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#include "ipq8074.dtsi"
|
||||
#include "ipq8074-ac-cpu.dtsi"
|
||||
|
||||
/ {
|
||||
#address-cells = <0x2>;
|
||||
#size-cells = <0x2>;
|
||||
model = "Edgecore OAP103";
|
||||
compatible = "edgecore,oap103", "qcom,ipq807x-ac02", "qcom,ipq807x";
|
||||
qcom,msm-id = <0x178 0x0>;
|
||||
interrupt-parent = <&intc>;
|
||||
|
||||
aliases {
|
||||
serial0 = &blsp1_uart5;
|
||||
/* Aliases as required by u-boot to patch MAC addresses */
|
||||
ethernet1 = "/soc/dp5";
|
||||
ethernet0 = "/soc/dp6";
|
||||
|
||||
led-boot = &led_power;
|
||||
led-failsafe = &led_power;
|
||||
led-running = &led_power;
|
||||
led-upgrade = &led_power;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0";
|
||||
};
|
||||
|
||||
gpio-export {
|
||||
compatible = "gpio-export";
|
||||
#size-cells = <0>;
|
||||
|
||||
mcu-enable {
|
||||
gpio-export,name = "mcu-enable";
|
||||
gpio-export,output = <0>;
|
||||
gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
usb-hub-enable {
|
||||
gpio-export,name = "usb-hub-enable";
|
||||
gpio-export,output = <1>;
|
||||
gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
usb-rear-power {
|
||||
gpio-export,name = "usb-rear-power";
|
||||
gpio-export,output = <1>;
|
||||
gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
usb-side-power {
|
||||
gpio-export,name = "usb-side-power";
|
||||
gpio-export,output = <1>;
|
||||
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
soc {
|
||||
pinctrl@1000000 {
|
||||
pinctrl-0 = <&mcu_rst &mcu_rsv &usb_rear_pwr &usb_side_pwr &usb_hub_rst>;
|
||||
pinctrl-names = "default";
|
||||
|
||||
mcu_rst: mcu_rst_pins {
|
||||
pins = "gpio54";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
output-low;
|
||||
};
|
||||
|
||||
mcu_rsv: mcu_rsv_pins {
|
||||
pins = "gpio56";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
};
|
||||
|
||||
usb_rear_pwr: usb_rear_pwr_pins {
|
||||
pins = "gpio29";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
output-high;
|
||||
};
|
||||
|
||||
usb_side_pwr: usb_side_pwr_pins {
|
||||
pins = "gpio30";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
output-high;
|
||||
};
|
||||
|
||||
usb_hub_rst: usb_hub_rst_pins {
|
||||
pins = "gpio55";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-disable;
|
||||
output-high;
|
||||
};
|
||||
|
||||
button_pins: button_pins {
|
||||
reset_button {
|
||||
pins = "gpio66";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_pins: mdio_pinmux {
|
||||
mux_0 {
|
||||
pins = "gpio68";
|
||||
function = "mdc";
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
mux_1 {
|
||||
pins = "gpio69";
|
||||
function = "mdio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-up;
|
||||
};
|
||||
mux_2 {
|
||||
pins = "gpio33";
|
||||
function = "gpio";
|
||||
bias-pull-up;
|
||||
};
|
||||
mux_3 {
|
||||
pins = "gpio44";
|
||||
function = "gpio";
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
led_pins: led_pins {
|
||||
led_2g {
|
||||
pins = "gpio42";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
led_5g {
|
||||
pins = "gpio43";
|
||||
function = "gpio";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
serial@78b3000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
spi@78b5000 {
|
||||
status = "ok";
|
||||
pinctrl-0 = <&spi_0_pins>;
|
||||
pinctrl-names = "default";
|
||||
cs-select = <0>;
|
||||
|
||||
m25p80@0 {
|
||||
compatible = "n25q128a11";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
reg = <0>;
|
||||
spi-max-frequency = <50000000>;
|
||||
};
|
||||
};
|
||||
|
||||
dma@7984000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
nand@79b0000 {
|
||||
status = "ok";
|
||||
|
||||
nand@0 {
|
||||
reg = <0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
nand-ecc-strength = <4>;
|
||||
nand-ecc-step-size = <512>;
|
||||
nand-bus-width = <8>;
|
||||
};
|
||||
};
|
||||
|
||||
qusb@79000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
ssphy@78000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
usb3@8A00000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
usb3@8C00000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
qusb@59000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
ssphy@58000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
usb3@8C00000 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
pinctrl-0 = <&button_pins>;
|
||||
pinctrl-names = "default";
|
||||
status = "ok";
|
||||
|
||||
button@1 {
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&tlmm 66 GPIO_ACTIVE_LOW>;
|
||||
linux,input-type = <1>;
|
||||
debounce-interval = <60>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@90000 {
|
||||
pinctrl-0 = <&mdio_pins>;
|
||||
pinctrl-names = "default";
|
||||
phy-reset-gpio = <&tlmm 37 0 &tlmm 25 1 &tlmm 44 1>;
|
||||
phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
};
|
||||
phy1: ethernet-phy@1 {
|
||||
reg = <1>;
|
||||
};
|
||||
phy2: ethernet-phy@2 {
|
||||
reg = <2>;
|
||||
};
|
||||
phy3: ethernet-phy@3 {
|
||||
reg = <3>;
|
||||
};
|
||||
phy4: ethernet-phy@4 {
|
||||
reg = <24>;
|
||||
};
|
||||
phy5: ethernet-phy@5 {
|
||||
reg = <28>;
|
||||
};
|
||||
};
|
||||
|
||||
ess-switch@3a000000 {
|
||||
switch_cpu_bmp = <0x1>; /* cpu port bitmap */
|
||||
switch_lan_bmp = <0x3e>; /* lan port bitmap */
|
||||
switch_wan_bmp = <0x40>; /* wan port bitmap */
|
||||
switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
|
||||
switch_mac_mode1 = <0xf>; /* mac mode for uniphy instance1*/
|
||||
switch_mac_mode2 = <0xf>; /* mac mode for uniphy instance2*/
|
||||
bm_tick_mode = <0>; /* bm tick mode */
|
||||
tm_tick_mode = <0>; /* tm tick mode */
|
||||
qcom,port_phyinfo {
|
||||
port@0 {
|
||||
port_id = <1>;
|
||||
phy_address = <0>;
|
||||
};
|
||||
port@1 {
|
||||
port_id = <2>;
|
||||
phy_address = <1>;
|
||||
};
|
||||
port@2 {
|
||||
port_id = <3>;
|
||||
phy_address = <2>;
|
||||
};
|
||||
port@3 {
|
||||
port_id = <4>;
|
||||
phy_address = <3>;
|
||||
};
|
||||
port@4 {
|
||||
port_id = <5>;
|
||||
phy_address = <24>;
|
||||
port_mac_sel = "QGMAC_PORT";
|
||||
};
|
||||
port@5 {
|
||||
port_id = <6>;
|
||||
phy_address = <28>;
|
||||
port_mac_sel = "QGMAC_PORT";
|
||||
};
|
||||
};
|
||||
port_scheduler_resource {
|
||||
port@0 {
|
||||
port_id = <0>;
|
||||
ucast_queue = <0 143>;
|
||||
mcast_queue = <256 271>;
|
||||
l0sp = <0 35>;
|
||||
l0cdrr = <0 47>;
|
||||
l0edrr = <0 47>;
|
||||
l1cdrr = <0 7>;
|
||||
l1edrr = <0 7>;
|
||||
};
|
||||
port@1 {
|
||||
port_id = <1>;
|
||||
ucast_queue = <144 159>;
|
||||
mcast_queue = <272 275>;
|
||||
l0sp = <36 39>;
|
||||
l0cdrr = <48 63>;
|
||||
l0edrr = <48 63>;
|
||||
l1cdrr = <8 11>;
|
||||
l1edrr = <8 11>;
|
||||
};
|
||||
port@2 {
|
||||
port_id = <2>;
|
||||
ucast_queue = <160 175>;
|
||||
mcast_queue = <276 279>;
|
||||
l0sp = <40 43>;
|
||||
l0cdrr = <64 79>;
|
||||
l0edrr = <64 79>;
|
||||
l1cdrr = <12 15>;
|
||||
l1edrr = <12 15>;
|
||||
};
|
||||
port@3 {
|
||||
port_id = <3>;
|
||||
ucast_queue = <176 191>;
|
||||
mcast_queue = <280 283>;
|
||||
l0sp = <44 47>;
|
||||
l0cdrr = <80 95>;
|
||||
l0edrr = <80 95>;
|
||||
l1cdrr = <16 19>;
|
||||
l1edrr = <16 19>;
|
||||
};
|
||||
port@4 {
|
||||
port_id = <4>;
|
||||
ucast_queue = <192 207>;
|
||||
mcast_queue = <284 287>;
|
||||
l0sp = <48 51>;
|
||||
l0cdrr = <96 111>;
|
||||
l0edrr = <96 111>;
|
||||
l1cdrr = <20 23>;
|
||||
l1edrr = <20 23>;
|
||||
};
|
||||
port@5 {
|
||||
port_id = <5>;
|
||||
ucast_queue = <208 223>;
|
||||
mcast_queue = <288 291>;
|
||||
l0sp = <52 55>;
|
||||
l0cdrr = <112 127>;
|
||||
l0edrr = <112 127>;
|
||||
l1cdrr = <24 27>;
|
||||
l1edrr = <24 27>;
|
||||
};
|
||||
port@6 {
|
||||
port_id = <6>;
|
||||
ucast_queue = <224 239>;
|
||||
mcast_queue = <292 295>;
|
||||
l0sp = <56 59>;
|
||||
l0cdrr = <128 143>;
|
||||
l0edrr = <128 143>;
|
||||
l1cdrr = <28 31>;
|
||||
l1edrr = <28 31>;
|
||||
};
|
||||
port@7 {
|
||||
port_id = <7>;
|
||||
ucast_queue = <240 255>;
|
||||
mcast_queue = <296 299>;
|
||||
l0sp = <60 63>;
|
||||
l0cdrr = <144 159>;
|
||||
l0edrr = <144 159>;
|
||||
l1cdrr = <32 35>;
|
||||
l1edrr = <32 35>;
|
||||
};
|
||||
};
|
||||
port_scheduler_config {
|
||||
port@0 {
|
||||
port_id = <0>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <0 1>; /*L0 SPs*/
|
||||
/*cpri cdrr epri edrr*/
|
||||
cfg = <0 0 0 0>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
/*unicast queues*/
|
||||
ucast_queue = <0 4 8>;
|
||||
/*multicast queues*/
|
||||
mcast_queue = <256 260>;
|
||||
/*sp cpri cdrr epri edrr*/
|
||||
cfg = <0 0 0 0 0>;
|
||||
};
|
||||
group@1 {
|
||||
ucast_queue = <1 5 9>;
|
||||
mcast_queue = <257 261>;
|
||||
cfg = <0 1 1 1 1>;
|
||||
};
|
||||
group@2 {
|
||||
ucast_queue = <2 6 10>;
|
||||
mcast_queue = <258 262>;
|
||||
cfg = <0 2 2 2 2>;
|
||||
};
|
||||
group@3 {
|
||||
ucast_queue = <3 7 11>;
|
||||
mcast_queue = <259 263>;
|
||||
cfg = <0 3 3 3 3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@1 {
|
||||
port_id = <1>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <36>;
|
||||
cfg = <0 8 0 8>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <37>;
|
||||
cfg = <1 9 1 9>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <144>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <272>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <36 0 48 0 48>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@2 {
|
||||
port_id = <2>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <40>;
|
||||
cfg = <0 12 0 12>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <41>;
|
||||
cfg = <1 13 1 13>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <160>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <276>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <40 0 64 0 64>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@3 {
|
||||
port_id = <3>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <44>;
|
||||
cfg = <0 16 0 16>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <45>;
|
||||
cfg = <1 17 1 17>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <176>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <280>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <44 0 80 0 80>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@4 {
|
||||
port_id = <4>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <48>;
|
||||
cfg = <0 20 0 20>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <49>;
|
||||
cfg = <1 21 1 21>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <192>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <284>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <48 0 96 0 96>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@5 {
|
||||
port_id = <5>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <52>;
|
||||
cfg = <0 24 0 24>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <53>;
|
||||
cfg = <1 25 1 25>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <208>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <288>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <52 0 112 0 112>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@6 {
|
||||
port_id = <6>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <56>;
|
||||
cfg = <0 28 0 28>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <57>;
|
||||
cfg = <1 29 1 29>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <224>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <292>;
|
||||
mcast_loop_pri = <4>;
|
||||
cfg = <56 0 128 0 128>;
|
||||
};
|
||||
};
|
||||
};
|
||||
port@7 {
|
||||
port_id = <7>;
|
||||
l1scheduler {
|
||||
group@0 {
|
||||
sp = <60>;
|
||||
cfg = <0 32 0 32>;
|
||||
};
|
||||
group@1 {
|
||||
sp = <61>;
|
||||
cfg = <1 33 1 33>;
|
||||
};
|
||||
};
|
||||
l0scheduler {
|
||||
group@0 {
|
||||
ucast_queue = <240>;
|
||||
ucast_loop_pri = <16>;
|
||||
mcast_queue = <296>;
|
||||
cfg = <60 0 144 0 144>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dp6 {
|
||||
device_type = "network";
|
||||
compatible = "qcom,nss-dp";
|
||||
qcom,id = <6>;
|
||||
reg = <0x3a001800 0x200>;
|
||||
qcom,mactype = <0>;
|
||||
local-mac-address = [000000000000];
|
||||
qcom,link-poll = <1>;
|
||||
qcom,phy-mdio-addr = <28>;
|
||||
phy-mode = "sgmii";
|
||||
};
|
||||
|
||||
dp5 {
|
||||
device_type = "network";
|
||||
compatible = "qcom,nss-dp";
|
||||
qcom,id = <5>;
|
||||
reg = <0x3a001a00 0x200>;
|
||||
qcom,mactype = <0>;
|
||||
local-mac-address = [000000000000];
|
||||
qcom,link-poll = <1>;
|
||||
qcom,phy-mdio-addr = <24>;
|
||||
phy-mode = "sgmii";
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
pinctrl-0 = <&led_pins>;
|
||||
pinctrl-names = "default";
|
||||
|
||||
led_pwr {
|
||||
label = "green:wan";
|
||||
gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
linux,default-trigger = "led_pwr";
|
||||
};
|
||||
|
||||
led_2g {
|
||||
label = "green:wifi2";
|
||||
gpio = <&tlmm 47 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
led_5g {
|
||||
label = "green:wifi5";
|
||||
gpio = <&tlmm 48 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
led_power: led_bt {
|
||||
gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
|
||||
label = "green:power";
|
||||
default-state = "on";
|
||||
linux,default-trigger = "led_bt";
|
||||
};
|
||||
};
|
||||
nss-macsec0 {
|
||||
compatible = "qcom,nss-macsec";
|
||||
phy_addr = <0x18>;
|
||||
mdiobus = <&mdio>;
|
||||
};
|
||||
nss-macsec1 {
|
||||
compatible = "qcom,nss-macsec";
|
||||
phy_addr = <0x1c>;
|
||||
mdiobus = <&mdio>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&apc_cpr {
|
||||
/* Same CPR configuration as OAK */
|
||||
compatible = "qcom,cpr4-ipq817x-apss-regulator";
|
||||
|
||||
thread@0 {
|
||||
apc_vreg: regulator {
|
||||
regulator-min-microvolt = <1>;
|
||||
regulator-max-microvolt = <2>;
|
||||
qcom,cpr-fuse-corners = <2>;
|
||||
qcom,cpr-corners = <3>;
|
||||
qcom,cpr-speed-bin-corners = <3>;
|
||||
qcom,cpr-corner-fmax-map = <1 3>;
|
||||
|
||||
qcom,cpr-voltage-ceiling =
|
||||
<840000 904000 944000>;
|
||||
qcom,cpr-voltage-floor =
|
||||
<592000 648000 712000>;
|
||||
qcom,corner-frequencies =
|
||||
<1017600000 1382400000 1382400000>;
|
||||
|
||||
qcom,cpr-open-loop-voltage-fuse-adjustment-0 =
|
||||
/* Speed bin 0; CPR rev 0..7 */
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>;
|
||||
|
||||
qcom,cpr-open-loop-voltage-fuse-adjustment-1 =
|
||||
/* Speed bin 0; CPR rev 0..7 */
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 20000 26000>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>;
|
||||
|
||||
qcom,cpr-open-loop-voltage-fuse-adjustment-v2-0 =
|
||||
/* Speed bin 0; CPR rev 0..7 */
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>;
|
||||
|
||||
qcom,cpr-open-loop-voltage-fuse-adjustment-v2-1 =
|
||||
/* Speed bin 0; CPR rev 0..7 */
|
||||
< 0 0>,
|
||||
< 0 7000>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>,
|
||||
< 0 0>;
|
||||
|
||||
qcom,cpr-floor-to-ceiling-max-range =
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>,
|
||||
< 40000 40000 40000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&npu_cpr {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&nss0 {
|
||||
qcom,low-frequency = <187200000>;
|
||||
qcom,mid-frequency = <748800000>;
|
||||
qcom,max-frequency = <1497600000>;
|
||||
};
|
||||
|
||||
&nss0 {
|
||||
npu-supply = <&dummy_reg>;
|
||||
mx-supply = <&dummy_reg>;
|
||||
};
|
||||
|
||||
&wifi0 {
|
||||
qcom,board_id = <0x92>;
|
||||
};
|
||||
|
||||
&wifi1 {
|
||||
qcom,board_id = <0x292>;
|
||||
};
|
||||
@@ -39,6 +39,15 @@ define Device/edgecore_oap102
|
||||
endef
|
||||
TARGET_DEVICES += edgecore_oap102
|
||||
|
||||
define Device/edgecore_oap103
|
||||
DEVICE_TITLE := Edgecore OAP103
|
||||
DEVICE_DTS := qcom-ipq807x-oap103
|
||||
DEVICE_DTS_CONFIG=config@ac02
|
||||
SUPPORTED_DEVICES := edgecore,oap103
|
||||
DEVICE_PACKAGES := ath11k-wifi-edgecore-oap103 kmod-usb2 kmod-usb3 uboot-envtools
|
||||
endef
|
||||
TARGET_DEVICES += edgecore_oap103
|
||||
|
||||
define Device/edgecore_eap106
|
||||
DEVICE_TITLE := Edgecore EAP106
|
||||
DEVICE_DTS := qcom-ipq807x-eap106
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
Index: backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/peer.c
|
||||
===================================================================
|
||||
--- backports-20210222_001-5.4.164-b157d2276.orig/drivers/net/wireless/ath/ath11k/peer.c
|
||||
+++ backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/peer.c
|
||||
@@ -789,8 +789,6 @@ int ath11k_peer_delete(struct ath11k *ar
|
||||
#endif
|
||||
lockdep_assert_held(&ar->conf_mutex);
|
||||
|
||||
- reinit_completion(&ar->peer_delete_done);
|
||||
-
|
||||
ath11k_nss_peer_delete(ar->ab, vdev_id, addr);
|
||||
#ifdef CCPTCFG_ATH11K_NSS_SUPPORTPTCFG_ATH11K_NSS_SUPPORT
|
||||
mutex_lock(&ar->ab->base_ast_lock);
|
||||
@@ -799,33 +797,60 @@ int ath11k_peer_delete(struct ath11k *ar
|
||||
spin_lock_bh(&ar->ab->base_lock);
|
||||
|
||||
peer = ath11k_peer_find_by_addr(ar->ab, addr);
|
||||
- if (peer) {
|
||||
+ /* Check if the found peer is what we want to remove.
|
||||
+ * While the sta is transitioning to another band we may
|
||||
+ * have 2 peer with the same addr assigned to different
|
||||
+ * vdev_id. Make sure we are deleting the correct peer.
|
||||
+ */
|
||||
+ if (peer && peer->vdev_id == vdev_id)
|
||||
+ ath11k_peer_rhash_delete(ar->ab, peer);
|
||||
+
|
||||
+ /* Fallback to peer list search if the correct peer can't be found.
|
||||
+ * Skip the deletion of the peer from the rhash since it has already
|
||||
+ * been deleted in peer add.
|
||||
+ */
|
||||
+ if (!peer)
|
||||
+ peer = ath11k_peer_find(ar->ab, vdev_id, addr);
|
||||
+
|
||||
+
|
||||
+ if (!peer) {
|
||||
+ spin_unlock_bh(&ar->ab->base_lock);
|
||||
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
|
||||
#ifdef CPTCFG_ATH11K_NSS_SUPPORT
|
||||
- peer->delete_in_progress = true;
|
||||
- if (peer->self_ast_entry) {
|
||||
- ath11k_peer_del_ast(ar, peer->self_ast_entry);
|
||||
- peer->self_ast_entry = NULL;
|
||||
- }
|
||||
+ mutex_unlock(&ar->ab->base_ast_lock);
|
||||
+#endif
|
||||
+ ath11k_warn(ar->ab,
|
||||
+ "failed to find peer vdev_id %d addr %pM in delete\n",
|
||||
+ vdev_id, addr);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+#ifdef CPTCFG_ATH11K_NSS_SUPPORT
|
||||
+ peer->delete_in_progress = true;
|
||||
+ if (peer->self_ast_entry) {
|
||||
+ ath11k_peer_del_ast(ar, peer->self_ast_entry);
|
||||
+ peer->self_ast_entry = NULL;
|
||||
+ }
|
||||
|
||||
- list_for_each_entry_safe(ast_entry, tmp_ast,
|
||||
- &peer->ast_entry_list, ase_list)
|
||||
- if ((ast_entry->type == ATH11K_AST_TYPE_WDS) ||
|
||||
- (ast_entry->type == ATH11K_AST_TYPE_MEC)) {
|
||||
- if (!list_empty(&ast_entry->wmi_list)) {
|
||||
- ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
|
||||
- "%s deleting unprocessed ast entry %pM of peer %pM from wmi list\n",
|
||||
- __func__, ast_entry->addr, addr);
|
||||
- list_del_init(&ast_entry->wmi_list);
|
||||
- }
|
||||
+ list_for_each_entry_safe(ast_entry, tmp_ast,
|
||||
+ &peer->ast_entry_list, ase_list)
|
||||
+ if ((ast_entry->type == ATH11K_AST_TYPE_WDS) ||
|
||||
+ (ast_entry->type == ATH11K_AST_TYPE_MEC)) {
|
||||
+ if (!list_empty(&ast_entry->wmi_list)) {
|
||||
+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
|
||||
+ "%s deleting unprocessed ast entry %pM of peer %pM from wmi list\n",
|
||||
+ __func__, ast_entry->addr, addr);
|
||||
+ list_del_init(&ast_entry->wmi_list);
|
||||
}
|
||||
+ }
|
||||
#endif
|
||||
- ath11k_peer_rhash_delete(ar->ab, peer);
|
||||
- }
|
||||
spin_unlock_bh(&ar->ab->base_lock);
|
||||
mutex_unlock(&ar->ab->tbl_mtx_lock);
|
||||
#ifdef CPTCFG_ATH11K_NSS_SUPPORT
|
||||
mutex_unlock(&ar->ab->base_ast_lock);
|
||||
#endif
|
||||
+ reinit_completion(&ar->peer_delete_done);
|
||||
+
|
||||
ret = ath11k_wmi_send_peer_delete_cmd(ar, addr, vdev_id);
|
||||
if (ret) {
|
||||
ath11k_warn(ar->ab,
|
||||
@@ -866,14 +891,20 @@ int ath11k_peer_create(struct ath11k *ar
|
||||
"failed to create peer due to insufficient peer entry resource in firmware\n");
|
||||
return -ENOBUFS;
|
||||
}
|
||||
-
|
||||
+ mutex_lock(&ar->ab->tbl_mtx_lock);
|
||||
spin_lock_bh(&ar->ab->base_lock);
|
||||
peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr);
|
||||
if (peer) {
|
||||
- spin_unlock_bh(&ar->ab->base_lock);
|
||||
- return -EINVAL;
|
||||
+ if (peer->vdev_id == param->vdev_id) {
|
||||
+ spin_unlock_bh(&ar->ab->base_lock);
|
||||
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ ath11k_peer_rhash_delete(ar->ab, peer);
|
||||
}
|
||||
+
|
||||
spin_unlock_bh(&ar->ab->base_lock);
|
||||
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
|
||||
|
||||
ret = ath11k_wmi_send_peer_create_cmd(ar, param);
|
||||
if (ret) {
|
||||
@@ -0,0 +1,36 @@
|
||||
From 93d02017c444d9bcb5e319ba6d9dac5794529cdd Mon Sep 17 00:00:00 2001
|
||||
From: Venkat Chimata <venkata@shasta.cloud>
|
||||
Date: Fri, 19 Jul 2024 18:43:19 +0530
|
||||
Subject: [PATCH] mac80211: workaround: Send multicast frames as multiple
|
||||
unicast frames in DVLAN mode
|
||||
|
||||
Broadcast / Multciast transmission is not working in DVLAN mode in the driver.
|
||||
If we send the frames as unicast frames, it works. This is a workaround for now.
|
||||
Need to rollback once we add a clean fix.
|
||||
|
||||
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
|
||||
---
|
||||
net/mac80211/tx.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
|
||||
index 9e978f9..6ebf9c2 100644
|
||||
--- a/net/mac80211/tx.c
|
||||
+++ b/net/mac80211/tx.c
|
||||
@@ -4197,11 +4197,8 @@ static bool ieee80211_multicast_to_unicast(struct sk_buff *skb,
|
||||
|
||||
switch (sdata->vif.type) {
|
||||
case NL80211_IFTYPE_AP_VLAN:
|
||||
- if (sdata->u.vlan.sta)
|
||||
- return false;
|
||||
- if (sdata->wdev.use_4addr)
|
||||
- return false;
|
||||
- fallthrough;
|
||||
+ // For now always enable multicast_to_unicast in DVLAN
|
||||
+ return true;
|
||||
case NL80211_IFTYPE_AP:
|
||||
/* check runtime toggle for this bss */
|
||||
if (!sdata->bss->multicast_to_unicast)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/include/net/cfg80211.h
|
||||
+++ b/include/net/cfg80211.h
|
||||
@@ -543,6 +543,9 @@ ieee80211_get_sband_iftype_data(const st
|
||||
if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
|
||||
return NULL;
|
||||
|
||||
+ if (iftype == NL80211_IFTYPE_AP_VLAN)
|
||||
+ iftype = NL80211_IFTYPE_AP;
|
||||
+
|
||||
for (i = 0; i < sband->n_iftype_data; i++) {
|
||||
const struct ieee80211_sband_iftype_data *data =
|
||||
&sband->iftype_data[i];
|
||||
@@ -1,37 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath11k-firmware
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_BRANCH:=main
|
||||
PKG_SOURCE_URL:=https://github.com/quic/upstream-wifi-fw.git
|
||||
PKG_MIRROR_HASH:=557505744764b0442c887be3f5bb0ce924323d785b6d207899f19fad992a6020
|
||||
PKG_SOURCE_VERSION:=3417bb86645c5ff4c58258db7cc33e43260b4222
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ath11k-firmware-default
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
URL:=$(PKG_SOURCE_URL)
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/ath11k-firmware-ipq95xx
|
||||
$(Package/ath11k-firmware-default)
|
||||
TITLE:=ath11k firmware for IPQ95xx devices
|
||||
DEPENDS:=@TARGET_ipq95xx
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
define Package/ath11k-firmware-ipq95xx/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/IPQ9574/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/ath11k-firmware/IPQ9574/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01890-QCAHKSWPL_SILICONZ-1/* \
|
||||
$(1)/lib/firmware/IPQ9574/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ath11k-firmware-ipq95xx))
|
||||
@@ -1,36 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/version.mk
|
||||
|
||||
PKG_NAME:=ath11k-wifi
|
||||
PKG_RELEASE:=1
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
define Package/ath11k-wifi-default
|
||||
SUBMENU:=ath11k Board-Specific Overrides
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
DEPENDS:=@TARGET_ipq95xx
|
||||
TITLE:=Custom Board
|
||||
endef
|
||||
|
||||
define Package/ath11k-wifi-qcom-ipq95xx
|
||||
$(call Package/ath11k-wifi-default)
|
||||
TITLE:=board-2.bin for QCOM IPQ9574 eval kits
|
||||
endef
|
||||
|
||||
define Package/ath11k-wifi-qcom-ipq95xx/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ9574/hw1.0/
|
||||
$(INSTALL_DATA) ./board-2.bin.IPQ9574 $(1)/lib/firmware/ath11k/IPQ9574/hw1.0/board-2.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ath11k-wifi-qcom-ipq95xx))
|
||||
Binary file not shown.
@@ -1,76 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath12k-firmware
|
||||
PKG_MIRROR_HASH:=a325f86b1d613f713d2e015abca4a9ff86c8448d4cd540fa022866da2c5aa042
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_BRANCH:=main
|
||||
PKG_SOURCE_URL:=https://github.com/quic/upstream-wifi-fw.git
|
||||
PKG_SOURCE_VERSION:=e90d32aaa149800ea79760639cb5ac9ddcfc8281
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ath12k-firmware-default
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
URL:=$(PKG_SOURCE_URL)
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-qcn92xx-split-phy
|
||||
$(Package/ath12k-firmware-default)
|
||||
TITLE:=ath12k firmware for qcn92xx split phy devices
|
||||
DEPENDS:=@(TARGET_ipq95xx||TARGET_ipq53xx)
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-qcn92xx
|
||||
$(Package/ath12k-firmware-default)
|
||||
TITLE:=ath12k firmware for qcn92xx devices
|
||||
DEPENDS:=@(TARGET_ipq95xx||TARGET_ipq53xx)
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-ipq53xx
|
||||
$(Package/ath12k-firmware-default)
|
||||
TITLE:=ath12k firmware for ipq53xx devices
|
||||
DEPENDS:=@TARGET_ipq53xx
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-ipq53xx-wk-wk
|
||||
$(Package/ath12k-firmware-default)
|
||||
TITLE:=ath12k firmware for ipq53xx + wk + wk devices
|
||||
DEPENDS:=@TARGET_ipq53xx
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-qcn92xx-split-phy/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN92XX/hw1.0
|
||||
$(CP) $(PKG_BUILD_DIR)/ath12k-firmware/QCN9274/hw2.0_split_phy/1.2.1/WLAN.WBE.1.2.1-00148-QCAHKSWPL_SILICONZ-1/* \
|
||||
$(1)/lib/firmware/ath12k/QCN92XX/hw1.0
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-qcn92xx/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN92XX/hw1.0
|
||||
$(CP) $(PKG_BUILD_DIR)/ath12k-firmware/QCN9274/hw2.0/1.2.1/WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1/* \
|
||||
$(1)/lib/firmware/ath12k/QCN92XX/hw1.0
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-ipq53xx/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/IPQ5332/
|
||||
$(CP) $(PKG_BUILD_DIR)/ath12k-firmware//IPQ5322/hw1.0/1.2.1/WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1/* \
|
||||
$(1)/lib/firmware/IPQ5332/
|
||||
endef
|
||||
|
||||
define Package/ath12k-firmware-ipq53xx-wk-wk/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/IPQ5332/
|
||||
$(CP) $(PKG_BUILD_DIR)/ath12k-firmware/IPQ5322_QCN6432_QCN6432/hw1.0/testing/1.3/WLAN.WBE.1.3-02907-QCAHKSWPL_SILICONZ-1/* \
|
||||
$(1)/lib/firmware/IPQ5332/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ath12k-firmware-qcn92xx))
|
||||
$(eval $(call BuildPackage,ath12k-firmware-qcn92xx-split-phy))
|
||||
$(eval $(call BuildPackage,ath12k-firmware-ipq53xx))
|
||||
$(eval $(call BuildPackage,ath12k-firmware-ipq53xx-wk-wk))
|
||||
@@ -1,78 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/version.mk
|
||||
|
||||
PKG_NAME:=ath12k-wifi
|
||||
PKG_RELEASE:=1
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-default
|
||||
SUBMENU:=ath12k Board-Specific Overrides
|
||||
SECTION:=firmware
|
||||
CATEGORY:=Firmware
|
||||
DEPENDS:=@(TARGET_qcn9274||TARGET_ipq53xx)
|
||||
TITLE:=Custom Board
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-qcom-qcn9274
|
||||
$(call Package/ath12k-wifi-default)
|
||||
TITLE:=board-2.bin for QCOM QCN9274 eval kits
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-qcom-qcn9274/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN9274/hw1.0/
|
||||
$(INSTALL_DATA) ./board-2.bin.QCN9274 $(1)/lib/firmware/ath12k/QCN9274/hw1.0/board-2.bin
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-cig-wf189
|
||||
$(call Package/ath12k-wifi-default)
|
||||
TITLE:=board.bin for CIG WF189
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-edgecore-eap105
|
||||
$(call Package/ath12k-wifi-default)
|
||||
TITLE:=board.bin for Edgecore EAP105
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-sercomm-ap72tip
|
||||
$(call Package/ath12k-wifi-default)
|
||||
TITLE:=board.bin for Sercomm WIFI-7
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-cig-wf189/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN92XX/hw1.0 $(1)/lib/firmware/ath12k/IPQ5332/hw1.0
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/
|
||||
$(INSTALL_DATA) ./board-cig-wf189.bin.qcn9224 $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/board.bin
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/
|
||||
$(INSTALL_DATA) ./board-cig-wf189.bin.ipq53xx $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/board.bin
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-edgecore-eap105/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN92XX/hw1.0 $(1)/lib/firmware/ath12k/IPQ5332/hw1.0
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/
|
||||
$(INSTALL_DATA) ./board-edgecore-eap105.bin.qcn9224 $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/board.bin
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/
|
||||
$(INSTALL_DATA) ./board-edgecore-eap105.bin.ipq53xx $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/board.bin
|
||||
endef
|
||||
|
||||
define Package/ath12k-wifi-sercomm-ap72tip/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/ath12k/QCN92XX/hw1.0 $(1)/lib/firmware/ath12k/IPQ5332/hw1.0
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/
|
||||
$(INSTALL_DATA) ./board-sercomm-ap72tip.bin.qcn9224 $(1)/lib/firmware/ath12k/QCN92XX/hw1.0/board.bin
|
||||
$(INSTALL_DATA) ./regdb.bin $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/
|
||||
$(INSTALL_DATA) ./board-sercomm-ap72tip.bin.ipq53xx $(1)/lib/firmware/ath12k/IPQ5332/hw1.0/board.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ath12k-wifi-qcom-qcn9274))
|
||||
$(eval $(call BuildPackage,ath12k-wifi-cig-wf189))
|
||||
$(eval $(call BuildPackage,ath12k-wifi-edgecore-eap105))
|
||||
$(eval $(call BuildPackage,ath12k-wifi-sercomm-ap72tip))
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,88 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors:
|
||||
#
|
||||
# Marek Lindner, Simon Wunderlich
|
||||
|
||||
#
|
||||
# B.A.T.M.A.N meshing protocol
|
||||
#
|
||||
|
||||
config BATMAN_ADV_BATMAN_V
|
||||
bool "B.A.T.M.A.N. V protocol"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the B.A.T.M.A.N. V protocol, the successor
|
||||
of the currently used B.A.T.M.A.N. IV protocol. The main
|
||||
changes include splitting of the OGM protocol into a neighbor
|
||||
discovery protocol (Echo Location Protocol, ELP) and a new OGM
|
||||
Protocol OGMv2 for flooding protocol information through the
|
||||
network, as well as a throughput based metric.
|
||||
B.A.T.M.A.N. V is currently considered experimental and not
|
||||
compatible to B.A.T.M.A.N. IV networks.
|
||||
|
||||
config BATMAN_ADV_BLA
|
||||
bool "Bridge Loop Avoidance"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select PACKAGE_kmod-lib-crc16
|
||||
default y
|
||||
help
|
||||
This option enables BLA (Bridge Loop Avoidance), a mechanism
|
||||
to avoid Ethernet frames looping when mesh nodes are connected
|
||||
to both the same LAN and the same mesh. If you will never use
|
||||
more than one mesh node in the same LAN, you can safely remove
|
||||
this feature and save some space.
|
||||
|
||||
config BATMAN_ADV_DAT
|
||||
bool "Distributed ARP Table"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables DAT (Distributed ARP Table), a DHT based
|
||||
mechanism that increases ARP reliability on sparse wireless
|
||||
mesh networks. If you think that your network does not need
|
||||
this option you can safely remove it and save some space.
|
||||
|
||||
config BATMAN_ADV_NC
|
||||
bool "Network Coding"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This option enables network coding, a mechanism that aims to
|
||||
increase the overall network throughput by fusing multiple
|
||||
packets in one transmission.
|
||||
Note that interfaces controlled by batman-adv must be manually
|
||||
configured to have promiscuous mode enabled in order to make
|
||||
network coding work.
|
||||
If you think that your network does not need this feature you
|
||||
can safely disable it and save some space.
|
||||
|
||||
config BATMAN_ADV_MCAST
|
||||
bool "Multicast optimisation"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
default y
|
||||
help
|
||||
This option enables the multicast optimisation which aims to
|
||||
reduce the air overhead while improving the reliability of
|
||||
multicast messages.
|
||||
|
||||
config BATMAN_ADV_DEBUG
|
||||
bool "B.A.T.M.A.N. debugging"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. This enables compilation of support for
|
||||
outputting debugging information to the debugfs log or tracing
|
||||
buffer. The output is controlled via the batadv netdev specific
|
||||
log_level setting.
|
||||
|
||||
config BATMAN_ADV_TRACING
|
||||
bool "B.A.T.M.A.N. tracing support"
|
||||
depends on PACKAGE_kmod-batman-adv
|
||||
select KERNEL_FTRACE
|
||||
select KERNEL_ENABLE_DEFAULT_TRACERS
|
||||
help
|
||||
This is an option for use by developers; most people should
|
||||
say N here. Select this option to gather traces like the debug
|
||||
messages using the generic tracing infrastructure of the kernel.
|
||||
BATMAN_ADV_DEBUG must also be selected to get trace events for
|
||||
batadv_dbg.
|
||||
@@ -1,101 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=batman-adv
|
||||
PKG_VERSION:=2022.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
|
||||
PKG_HASH:=49338705bc207709ac84d766688e702571009c827c0a320788ea51fb887714aa
|
||||
PKG_EXTMOD_SUBDIRS:=net/batman-adv
|
||||
|
||||
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
|
||||
PKG_LICENSE:=GPL-2.0-only MIT
|
||||
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_BATMAN_ADV_BATMAN_V \
|
||||
CONFIG_BATMAN_ADV_BLA \
|
||||
CONFIG_BATMAN_ADV_DAT \
|
||||
CONFIG_BATMAN_ADV_NC \
|
||||
CONFIG_BATMAN_ADV_MCAST \
|
||||
CONFIG_BATMAN_ADV_DEBUG \
|
||||
CONFIG_BATMAN_ADV_TRACING
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/batman-adv
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=B.A.T.M.A.N. Adv
|
||||
URL:=https://www.open-mesh.org/
|
||||
DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl
|
||||
FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoProbe,batman-adv)
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/description
|
||||
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
|
||||
a routing protocol for multi-hop ad-hoc mesh networks. The
|
||||
networks may be wired or wireless. See
|
||||
https://www.open-mesh.org/ for more information and user space
|
||||
tools. This package builds version $(PKG_VERSION) of the kernel
|
||||
module.
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/kmod-batman-adv/conffiles
|
||||
/etc/config/batman-adv
|
||||
endef
|
||||
|
||||
PKG_EXTRA_KCONFIG:= \
|
||||
CONFIG_BATMAN_ADV=m \
|
||||
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \
|
||||
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \
|
||||
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \
|
||||
CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \
|
||||
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \
|
||||
CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \
|
||||
CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \
|
||||
|
||||
PKG_EXTRA_CFLAGS:= \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
|
||||
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
$(KERNEL_NOSTDINC_FLAGS) \
|
||||
-I$(PKG_BUILD_DIR)/net/batman-adv \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(PKG_BUILD_DIR)/include/ \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h \
|
||||
-include $(PKG_BUILD_DIR)/compat-hacks.h \
|
||||
-DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\"
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/net/batman-adv" \
|
||||
$(PKG_EXTRA_KCONFIG) \
|
||||
EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/batman-adv/install
|
||||
$(CP) ./files/. $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,batman-adv))
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This UCI-Defaults script will split the batadv proto network interfaces
|
||||
# in batadv_hardif and batadv proto. The configuration options from
|
||||
# /etc/config/batman-adv will be moved to the latter.
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
proto_batadv_to_batadv_hardif() {
|
||||
local section="$1"
|
||||
local proto
|
||||
local mesh
|
||||
local routing_algo
|
||||
|
||||
config_get proto "${section}" proto
|
||||
config_get mesh "${section}" mesh
|
||||
config_get routing_algo "${section}" routing_algo
|
||||
|
||||
if [ -z "$mesh" -o "${proto}" != "batadv" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
uci set network."${section}".proto="batadv_hardif"
|
||||
uci rename network."${section}".mesh="master"
|
||||
uci delete network."${section}".routing_algo
|
||||
|
||||
# create new section or adjust existing one
|
||||
uci set network."${mesh}"=interface
|
||||
uci set network."${mesh}".proto=batadv
|
||||
[ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}"
|
||||
}
|
||||
|
||||
mv_batadv_config_section() {
|
||||
local section="$1"
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
|
||||
config_get aggregated_ogms "${section}" aggregated_ogms
|
||||
config_get ap_isolation "${section}" ap_isolation
|
||||
config_get bonding "${section}" bonding
|
||||
config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance
|
||||
config_get distributed_arp_table "${section}" distributed_arp_table
|
||||
config_get fragmentation "${section}" fragmentation
|
||||
config_get gw_bandwidth "${section}" gw_bandwidth
|
||||
config_get gw_mode "${section}" gw_mode
|
||||
config_get gw_sel_class "${section}" gw_sel_class
|
||||
config_get hop_penalty "${section}" hop_penalty
|
||||
config_get isolation_mark "${section}" isolation_mark
|
||||
config_get log_level "${section}" log_level
|
||||
config_get multicast_mode "${section}" multicast_mode
|
||||
config_get network_coding "${section}" network_coding
|
||||
config_get orig_interval "${section}" orig_interval
|
||||
|
||||
# update section in case it exists
|
||||
[ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}"
|
||||
[ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}"
|
||||
[ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}"
|
||||
[ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}"
|
||||
[ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}"
|
||||
[ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}"
|
||||
[ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}"
|
||||
[ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}"
|
||||
[ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}"
|
||||
[ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}"
|
||||
[ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}"
|
||||
[ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}"
|
||||
[ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}"
|
||||
[ -n "${network_coding}" ] && uci set network."${section}".network_coding="${network_coding}"
|
||||
[ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}"
|
||||
}
|
||||
|
||||
if [ -f /etc/config/batman-adv ]; then
|
||||
config_load network
|
||||
config_foreach proto_batadv_to_batadv_hardif 'interface'
|
||||
uci commit network
|
||||
|
||||
config_load batman-adv
|
||||
config_foreach mv_batadv_config_section 'mesh'
|
||||
uci commit network
|
||||
|
||||
rm -f /etc/config/batman-adv
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,123 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_batadv_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
|
||||
proto_config_add_boolean 'aggregated_ogms:bool'
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
proto_config_add_boolean 'bonding:bool'
|
||||
proto_config_add_boolean 'bridge_loop_avoidance:bool'
|
||||
proto_config_add_boolean 'distributed_arp_table:bool'
|
||||
proto_config_add_boolean 'fragmentation:bool'
|
||||
proto_config_add_string 'gw_bandwidth'
|
||||
proto_config_add_string 'gw_mode'
|
||||
proto_config_add_int 'gw_sel_class'
|
||||
proto_config_add_int 'hop_penalty'
|
||||
proto_config_add_string 'isolation_mark'
|
||||
proto_config_add_string 'log_level'
|
||||
proto_config_add_int 'multicast_fanout'
|
||||
proto_config_add_boolean 'multicast_mode:bool'
|
||||
proto_config_add_boolean 'network_coding:bool'
|
||||
proto_config_add_int 'orig_interval'
|
||||
proto_config_add_string 'routing_algo'
|
||||
}
|
||||
|
||||
proto_batadv_setup() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
|
||||
local aggregated_ogms
|
||||
local ap_isolation
|
||||
local bonding
|
||||
local bridge_loop_avoidance
|
||||
local distributed_arp_table
|
||||
local fragmentation
|
||||
local gw_bandwidth
|
||||
local gw_mode
|
||||
local gw_sel_class
|
||||
local hop_penalty
|
||||
local isolation_mark
|
||||
local log_level
|
||||
local multicast_fanout
|
||||
local multicast_mode
|
||||
local network_coding
|
||||
local orig_interval
|
||||
local routing_algo
|
||||
|
||||
json_get_vars aggregated_ogms
|
||||
json_get_vars ap_isolation
|
||||
json_get_vars bonding
|
||||
json_get_vars bridge_loop_avoidance
|
||||
json_get_vars distributed_arp_table
|
||||
json_get_vars fragmentation
|
||||
json_get_vars gw_bandwidth
|
||||
json_get_vars gw_mode
|
||||
json_get_vars gw_sel_class
|
||||
json_get_vars hop_penalty
|
||||
json_get_vars isolation_mark
|
||||
json_get_vars log_level
|
||||
json_get_vars multicast_fanout
|
||||
json_get_vars multicast_mode
|
||||
json_get_vars network_coding
|
||||
json_get_vars orig_interval
|
||||
json_get_vars routing_algo
|
||||
|
||||
set_default routing_algo 'BATMAN_IV'
|
||||
|
||||
batctl routing_algo "$routing_algo"
|
||||
batctl meshif "$iface" interface create
|
||||
|
||||
[ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms"
|
||||
[ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation"
|
||||
[ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding"
|
||||
[ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
|
||||
[ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
|
||||
[ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation"
|
||||
|
||||
case "$gw_mode" in
|
||||
server)
|
||||
if [ -n "$gw_bandwidth" ]; then
|
||||
batctl meshif "$iface" gw_mode "server" "$gw_bandwidth"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "server"
|
||||
fi
|
||||
;;
|
||||
client)
|
||||
if [ -n "$gw_sel_class" ]; then
|
||||
batctl meshif "$iface" gw_mode "client" "$gw_sel_class"
|
||||
else
|
||||
batctl meshif "$iface" gw_mode "client"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
batctl meshif "$iface" gw_mode "off"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty"
|
||||
[ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark"
|
||||
[ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout"
|
||||
[ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&-
|
||||
[ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&-
|
||||
[ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&-
|
||||
[ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval"
|
||||
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_teardown() {
|
||||
local config="$1"
|
||||
local iface="$config"
|
||||
|
||||
batctl meshif "$iface" interface destroy
|
||||
}
|
||||
|
||||
add_protocol batadv
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_init_config() {
|
||||
proto_config_add_int 'elp_interval'
|
||||
proto_config_add_int 'hop_penalty'
|
||||
proto_config_add_string "master"
|
||||
proto_config_add_string 'throughput_override'
|
||||
}
|
||||
|
||||
proto_batadv_hardif_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local elp_interval
|
||||
local hop_penalty
|
||||
local master
|
||||
local throughput_override
|
||||
|
||||
json_get_vars elp_interval
|
||||
json_get_vars hop_penalty
|
||||
json_get_vars master
|
||||
json_get_vars throughput_override
|
||||
|
||||
( proto_add_host_dependency "$config" '' "$master" )
|
||||
|
||||
batctl meshif "$master" interface -M add "$iface"
|
||||
|
||||
[ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval"
|
||||
[ -n "$hop_penalty" ] && batctl hardif "$iface" hop_penalty "$hop_penalty"
|
||||
[ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override"
|
||||
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
proto_batadv_hardif_teardown() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local master
|
||||
|
||||
json_get_vars master
|
||||
|
||||
batctl meshif "$master" interface -M del "$iface" || true
|
||||
}
|
||||
|
||||
add_protocol batadv_hardif
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_batadv_vlan_init_config() {
|
||||
proto_config_add_boolean 'ap_isolation:bool'
|
||||
}
|
||||
|
||||
proto_batadv_vlan_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
# batadv_vlan options
|
||||
local ap_isolation
|
||||
|
||||
json_get_vars ap_isolation
|
||||
|
||||
[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation"
|
||||
proto_init_update "$iface" 1
|
||||
proto_send_update "$config"
|
||||
}
|
||||
|
||||
add_protocol batadv_vlan
|
||||
@@ -1,128 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Sat, 24 Oct 2020 22:51:23 +0200
|
||||
Subject: Revert "batman-adv: genetlink: move to smaller ops wherever possible"
|
||||
|
||||
The netlink genl_ops interface was splitted into two parts for Linux 5.10.
|
||||
The batman-adv code changed to the new one because it doesn't use the more
|
||||
complex policy handling of genl_ops. But the backports-5.8-1 version in
|
||||
OpenWrt doesn't yet support the new genl_small_ops.
|
||||
|
||||
This patch must be dropped directly when OpenWrt switches to backports-5.10
|
||||
or newer - otherwise it will not work as expected.
|
||||
|
||||
This reverts commit 725b4ef5be840cfcd0ca33b9393c14dee40c10f7.
|
||||
|
||||
--- a/compat-include/net/genetlink.h
|
||||
+++ b/compat-include/net/genetlink.h
|
||||
@@ -31,17 +31,15 @@ void batadv_genl_dump_check_consistent(s
|
||||
#endif /* LINUX_VERSION_IS_LESS(4, 15, 0) */
|
||||
|
||||
|
||||
-#if LINUX_VERSION_IS_LESS(5, 10, 0)
|
||||
-
|
||||
#if LINUX_VERSION_IS_LESS(5, 2, 0)
|
||||
+
|
||||
enum genl_validate_flags {
|
||||
GENL_DONT_VALIDATE_STRICT = BIT(0),
|
||||
GENL_DONT_VALIDATE_DUMP = BIT(1),
|
||||
GENL_DONT_VALIDATE_DUMP_STRICT = BIT(2),
|
||||
};
|
||||
-#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */
|
||||
|
||||
-struct batadv_genl_small_ops {
|
||||
+struct batadv_genl_ops {
|
||||
int (*doit)(struct sk_buff *skb,
|
||||
struct genl_info *info);
|
||||
int (*dumpit)(struct sk_buff *skb,
|
||||
@@ -70,9 +68,9 @@ struct batadv_genl_family {
|
||||
struct genl_info *info);
|
||||
void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb,
|
||||
struct genl_info *info);
|
||||
- const struct batadv_genl_small_ops *small_ops;
|
||||
+ const struct batadv_genl_ops *ops;
|
||||
const struct genl_multicast_group *mcgrps;
|
||||
- unsigned int n_small_ops;
|
||||
+ unsigned int n_ops;
|
||||
unsigned int n_mcgrps;
|
||||
struct module *module;
|
||||
|
||||
@@ -96,32 +94,24 @@ static inline int batadv_genl_register_f
|
||||
family->family.pre_doit = family->pre_doit;
|
||||
family->family.post_doit = family->post_doit;
|
||||
family->family.mcgrps = family->mcgrps;
|
||||
- family->family.n_ops = family->n_small_ops;
|
||||
+ family->family.n_ops = family->n_ops;
|
||||
family->family.n_mcgrps = family->n_mcgrps;
|
||||
family->family.module = family->module;
|
||||
|
||||
- ops = kzalloc(sizeof(*ops) * family->n_small_ops, GFP_KERNEL);
|
||||
+ ops = kzalloc(sizeof(*ops) * family->n_ops, GFP_KERNEL);
|
||||
if (!ops)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < family->family.n_ops; i++) {
|
||||
- ops[i].doit = family->small_ops[i].doit;
|
||||
- ops[i].dumpit = family->small_ops[i].dumpit;
|
||||
- ops[i].done = family->small_ops[i].done;
|
||||
- ops[i].cmd = family->small_ops[i].cmd;
|
||||
- ops[i].internal_flags = family->small_ops[i].internal_flags;
|
||||
- ops[i].flags = family->small_ops[i].flags;
|
||||
-#if LINUX_VERSION_IS_GEQ(5, 2, 0)
|
||||
- ops[i].validate = family->small_ops[i].validate;
|
||||
-#else
|
||||
+ ops[i].doit = family->ops[i].doit;
|
||||
+ ops[i].dumpit = family->ops[i].dumpit;
|
||||
+ ops[i].done = family->ops[i].done;
|
||||
+ ops[i].cmd = family->ops[i].cmd;
|
||||
+ ops[i].internal_flags = family->ops[i].internal_flags;
|
||||
+ ops[i].flags = family->ops[i].flags;
|
||||
ops[i].policy = family->policy;
|
||||
-#endif
|
||||
}
|
||||
|
||||
-#if LINUX_VERSION_IS_GEQ(5, 2, 0)
|
||||
- family->family.policy = family->policy;
|
||||
-#endif
|
||||
-
|
||||
family->family.ops = ops;
|
||||
family->copy_ops = ops;
|
||||
|
||||
@@ -136,7 +126,7 @@ typedef struct genl_ops batadv_genl_ops_
|
||||
#define batadv_post_doit(__x, __y, __z) \
|
||||
batadv_post_doit(const batadv_genl_ops_old *ops, __y, __z)
|
||||
|
||||
-#define genl_small_ops batadv_genl_small_ops
|
||||
+#define genl_ops batadv_genl_ops
|
||||
#define genl_family batadv_genl_family
|
||||
|
||||
#define genl_register_family(family) \
|
||||
@@ -160,6 +150,6 @@ batadv_genl_unregister_family(struct bat
|
||||
genlmsg_multicast_netns(&(_family)->family, _net, _skb, _portid, \
|
||||
_group, _flags)
|
||||
|
||||
-#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
|
||||
+#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */
|
||||
|
||||
#endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */
|
||||
--- a/net/batman-adv/netlink.c
|
||||
+++ b/net/batman-adv/netlink.c
|
||||
@@ -1357,7 +1357,7 @@ static void batadv_post_doit(const struc
|
||||
}
|
||||
}
|
||||
|
||||
-static const struct genl_small_ops batadv_netlink_ops[] = {
|
||||
+static const struct genl_ops batadv_netlink_ops[] = {
|
||||
{
|
||||
.cmd = BATADV_CMD_GET_MESH,
|
||||
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
|
||||
@@ -1491,8 +1491,8 @@ struct genl_family batadv_netlink_family
|
||||
.pre_doit = batadv_pre_doit,
|
||||
.post_doit = batadv_post_doit,
|
||||
.module = THIS_MODULE,
|
||||
- .small_ops = batadv_netlink_ops,
|
||||
- .n_small_ops = ARRAY_SIZE(batadv_netlink_ops),
|
||||
+ .ops = batadv_netlink_ops,
|
||||
+ .n_ops = ARRAY_SIZE(batadv_netlink_ops),
|
||||
.mcgrps = batadv_netlink_mcgrps,
|
||||
.n_mcgrps = ARRAY_SIZE(batadv_netlink_mcgrps),
|
||||
};
|
||||
@@ -1,116 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Thu, 28 Jan 2021 21:06:51 +0100
|
||||
Subject: Revert "batman-adv: Add new include for min/max helpers"
|
||||
|
||||
The OpenWrt kernel sources and backports sources are currently missing this
|
||||
header.
|
||||
|
||||
This reverts commit 1810de05310d5c5e9140f870ac21052f38bc06b8.
|
||||
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
|
||||
--- a/compat-include/linux/minmax.h
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0 */
|
||||
-/* Copyright (C) B.A.T.M.A.N. contributors:
|
||||
- *
|
||||
- * Marek Lindner, Simon Wunderlich
|
||||
- *
|
||||
- * This file contains macros for maintaining compatibility with older versions
|
||||
- * of the Linux kernel.
|
||||
- */
|
||||
-
|
||||
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_
|
||||
-#define _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_
|
||||
-
|
||||
-#include <linux/version.h>
|
||||
-#if LINUX_VERSION_IS_GEQ(5, 10, 0)
|
||||
-#include_next <linux/minmax.h>
|
||||
-#else
|
||||
-#include <linux/kernel.h>
|
||||
-#endif
|
||||
-
|
||||
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_ */
|
||||
--- a/net/batman-adv/bat_v.c
|
||||
+++ b/net/batman-adv/bat_v.c
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rculist.h>
|
||||
--- a/net/batman-adv/bat_v_elp.c
|
||||
+++ b/net/batman-adv/bat_v_elp.c
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kref.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/nl80211.h>
|
||||
#include <linux/prandom.h>
|
||||
--- a/net/batman-adv/bat_v_ogm.c
|
||||
+++ b/net/batman-adv/bat_v_ogm.c
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/lockdep.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/prandom.h>
|
||||
--- a/net/batman-adv/fragmentation.c
|
||||
+++ b/net/batman-adv/fragmentation.c
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/lockdep.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/slab.h>
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <linux/kref.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/list.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/printk.h>
|
||||
--- a/net/batman-adv/main.c
|
||||
+++ b/net/batman-adv/main.c
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/list.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/printk.h>
|
||||
--- a/net/batman-adv/netlink.c
|
||||
+++ b/net/batman-adv/netlink.c
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/list.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/printk.h>
|
||||
--- a/net/batman-adv/tp_meter.c
|
||||
+++ b/net/batman-adv/tp_meter.c
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/list.h>
|
||||
-#include <linux/minmax.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/param.h>
|
||||
#include <linux/printk.h>
|
||||
@@ -1,34 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Fri, 14 May 2021 19:34:35 +0200
|
||||
Subject: batman-adv: Fix build of multicast code against Linux < 5.13
|
||||
|
||||
Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
|
||||
--- a/net/batman-adv/multicast.c
|
||||
+++ b/net/batman-adv/multicast.c
|
||||
@@ -422,9 +422,14 @@ batadv_mcast_mla_softif_get_ipv6(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_IS_LESS(5, 13, 0)
|
||||
+ read_lock_bh(&in6_dev->lock);
|
||||
+ for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
|
||||
+#else
|
||||
for (pmc6 = rcu_dereference(in6_dev->mc_list);
|
||||
pmc6;
|
||||
pmc6 = rcu_dereference(pmc6->next)) {
|
||||
+#endif
|
||||
if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
|
||||
IPV6_ADDR_SCOPE_LINKLOCAL)
|
||||
continue;
|
||||
@@ -453,6 +458,9 @@ batadv_mcast_mla_softif_get_ipv6(struct
|
||||
hlist_add_head(&new->list, mcast_list);
|
||||
ret++;
|
||||
}
|
||||
+#if LINUX_VERSION_IS_LESS(5, 13, 0)
|
||||
+ read_unlock_bh(&in6_dev->lock);
|
||||
+#endif
|
||||
rcu_read_unlock();
|
||||
|
||||
return ret;
|
||||
@@ -1,19 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Tue, 14 Sep 2021 21:02:10 +0200
|
||||
Subject: Revert "batman-adv: Switch to kstrtox.h for kstrtou64"
|
||||
|
||||
This header is only available after Linux 5.14
|
||||
|
||||
This reverts commit c9a69cb4048ebef3a4d91835669011a26d9b7dab.
|
||||
|
||||
--- a/net/batman-adv/gateway_common.c
|
||||
+++ b/net/batman-adv/gateway_common.c
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/byteorder/generic.h>
|
||||
#include <linux/errno.h>
|
||||
-#include <linux/kstrtox.h>
|
||||
+#include <linux/kernel.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/math64.h>
|
||||
#include <linux/netdevice.h>
|
||||
@@ -1,19 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Tue, 14 Sep 2021 21:07:34 +0200
|
||||
Subject: Revert "batman-adv: use Linux's stdarg.h"
|
||||
|
||||
This header is only available since Linux 5.15
|
||||
|
||||
This reverts commit 36d059797a14f0e373fdc3c79df7b467435925ad.
|
||||
|
||||
--- a/net/batman-adv/log.c
|
||||
+++ b/net/batman-adv/log.c
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "log.h"
|
||||
#include "main.h"
|
||||
|
||||
-#include <linux/stdarg.h>
|
||||
+#include <stdarg.h>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
From: Eric Dumazet <edumazet@google.com>
|
||||
Date: Wed, 2 Mar 2022 20:05:13 +0100
|
||||
Subject: batman-adv: make mc_forwarding atomic
|
||||
|
||||
This fixes minor data-races in ip6_mc_input() and
|
||||
batadv_mcast_mla_rtr_flags_softif_get_ipv6()
|
||||
|
||||
Signed-off-by: Eric Dumazet <edumazet@google.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
[sven@narfation.org: Add ugly hack to get it building with old kernels]
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/56db7c0540e733a1f063ccd6bab1b537a80857eb
|
||||
|
||||
--- a/net/batman-adv/multicast.c
|
||||
+++ b/net/batman-adv/multicast.c
|
||||
@@ -134,7 +134,11 @@ static u8 batadv_mcast_mla_rtr_flags_sof
|
||||
{
|
||||
struct inet6_dev *in6_dev = __in6_dev_get(dev);
|
||||
|
||||
+#if LINUX_VERSION_IS_GEQ(5, 18, 0) // UGLY_HACK_NEW
|
||||
+ if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding))
|
||||
+#else // UGLY_HACK_OLD
|
||||
if (in6_dev && in6_dev->cnf.mc_forwarding)
|
||||
+#endif // UGLY_HACK_STOP
|
||||
return BATADV_NO_FLAGS;
|
||||
else
|
||||
return BATADV_MCAST_WANT_NO_RTR6;
|
||||
@@ -1,23 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Fri, 15 Apr 2022 15:12:45 +0200
|
||||
Subject: batman-adv: compat: Add atomic mc_fowarding support for stable kernels
|
||||
|
||||
Fixes: 56db7c0540e7 ("batman-adv: make mc_forwarding atomic")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/350adcaec82fbaa358a2406343b6130ac8dad126
|
||||
|
||||
--- a/net/batman-adv/multicast.c
|
||||
+++ b/net/batman-adv/multicast.c
|
||||
@@ -134,7 +134,11 @@ static u8 batadv_mcast_mla_rtr_flags_sof
|
||||
{
|
||||
struct inet6_dev *in6_dev = __in6_dev_get(dev);
|
||||
|
||||
-#if LINUX_VERSION_IS_GEQ(5, 18, 0) // UGLY_HACK_NEW
|
||||
+#if (LINUX_VERSION_IS_GEQ(5, 4, 189) && LINUX_VERSION_IS_LESS(5, 5, 0)) || /* UGLY_HACK */ \
|
||||
+ (LINUX_VERSION_IS_GEQ(5, 10, 111) && LINUX_VERSION_IS_LESS(5, 11, 0)) || /* UGLY_HACK */ \
|
||||
+ (LINUX_VERSION_IS_GEQ(5, 15, 34) && LINUX_VERSION_IS_LESS(5, 16, 0)) || /* UGLY_HACK */ \
|
||||
+ (LINUX_VERSION_IS_GEQ(5, 16, 20) && LINUX_VERSION_IS_LESS(5, 17, 0)) || /* UGLY_HACK */ \
|
||||
+ LINUX_VERSION_IS_GEQ(5, 17, 3) // UGLY_HACK_NEW
|
||||
if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding))
|
||||
#else // UGLY_HACK_OLD
|
||||
if (in6_dev && in6_dev->cnf.mc_forwarding)
|
||||
@@ -1,44 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Wed, 2 Mar 2022 19:49:44 +0100
|
||||
Subject: batman-adv: Request iflink once in batadv-on-batadv check
|
||||
|
||||
There is no need to call dev_get_iflink multiple times for the same
|
||||
net_device in batadv_is_on_batman_iface. And since some of the
|
||||
.ndo_get_iflink callbacks are dynamic (for example via RCUs like in
|
||||
vxcan_get_iflink), it could easily happen that the returned values are not
|
||||
stable. The pre-checks before __dev_get_by_index are then of course bogus.
|
||||
|
||||
Fixes: 3d48811b27f5 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/f6c0c45356fe3ab9c5e01b81d060f8a436658037
|
||||
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -148,22 +148,23 @@ static bool batadv_is_on_batman_iface(co
|
||||
struct net *net = dev_net(net_dev);
|
||||
struct net_device *parent_dev;
|
||||
struct net *parent_net;
|
||||
+ int iflink;
|
||||
bool ret;
|
||||
|
||||
/* check if this is a batman-adv mesh interface */
|
||||
if (batadv_softif_is_valid(net_dev))
|
||||
return true;
|
||||
|
||||
+ iflink = dev_get_iflink(net_dev);
|
||||
+
|
||||
/* no more parents..stop recursion */
|
||||
- if (dev_get_iflink(net_dev) == 0 ||
|
||||
- dev_get_iflink(net_dev) == net_dev->ifindex)
|
||||
+ if (iflink == 0 || iflink == net_dev->ifindex)
|
||||
return false;
|
||||
|
||||
parent_net = batadv_getlink_net(net_dev, net);
|
||||
|
||||
/* recurse over the parent device */
|
||||
- parent_dev = __dev_get_by_index((struct net *)parent_net,
|
||||
- dev_get_iflink(net_dev));
|
||||
+ parent_dev = __dev_get_by_index((struct net *)parent_net, iflink);
|
||||
/* if we got a NULL parent_dev there is something broken.. */
|
||||
if (!parent_dev) {
|
||||
pr_err("Cannot find parent device\n");
|
||||
@@ -1,46 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Wed, 2 Mar 2022 19:49:45 +0100
|
||||
Subject: batman-adv: Request iflink once in batadv_get_real_netdevice
|
||||
|
||||
There is no need to call dev_get_iflink multiple times for the same
|
||||
net_device in batadv_get_real_netdevice. And since some of the
|
||||
ndo_get_iflink callbacks are dynamic (for example via RCUs like in
|
||||
vxcan_get_iflink), it could easily happen that the returned values are not
|
||||
stable. The pre-checks before __dev_get_by_index are then of course bogus.
|
||||
|
||||
Fixes: 2b45bb6c3aad ("batman-adv: additional checks for virtual interfaces on top of WiFi")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/445f477ec3e805425186f5fbe8ed0fe89cc226b6
|
||||
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -214,14 +214,16 @@ static struct net_device *batadv_get_rea
|
||||
struct net_device *real_netdev = NULL;
|
||||
struct net *real_net;
|
||||
struct net *net;
|
||||
- int ifindex;
|
||||
+ int iflink;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (!netdev)
|
||||
return NULL;
|
||||
|
||||
- if (netdev->ifindex == dev_get_iflink(netdev)) {
|
||||
+ iflink = dev_get_iflink(netdev);
|
||||
+
|
||||
+ if (netdev->ifindex == iflink) {
|
||||
dev_hold(netdev);
|
||||
return netdev;
|
||||
}
|
||||
@@ -231,9 +233,8 @@ static struct net_device *batadv_get_rea
|
||||
goto out;
|
||||
|
||||
net = dev_net(hard_iface->soft_iface);
|
||||
- ifindex = dev_get_iflink(netdev);
|
||||
real_net = batadv_getlink_net(netdev, net);
|
||||
- real_netdev = dev_get_by_index(real_net, ifindex);
|
||||
+ real_netdev = dev_get_by_index(real_net, iflink);
|
||||
|
||||
out:
|
||||
batadv_hardif_put(hard_iface);
|
||||
@@ -1,86 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Wed, 2 Mar 2022 19:49:46 +0100
|
||||
Subject: batman-adv: Don't expect inter-netns unique iflink indices
|
||||
|
||||
The ifindex doesn't have to be unique for multiple network namespaces on
|
||||
the same machine.
|
||||
|
||||
$ ip netns add test1
|
||||
$ ip -net test1 link add dummy1 type dummy
|
||||
$ ip netns add test2
|
||||
$ ip -net test2 link add dummy2 type dummy
|
||||
|
||||
$ ip -net test1 link show dev dummy1
|
||||
6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
|
||||
link/ether 96:81:55:1e:dd:85 brd ff:ff:ff:ff:ff:ff
|
||||
$ ip -net test2 link show dev dummy2
|
||||
6: dummy2: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
|
||||
link/ether 5a:3c:af:35:07:c3 brd ff:ff:ff:ff:ff:ff
|
||||
|
||||
But the batman-adv code to walk through the various layers of virtual
|
||||
interfaces uses this assumption because dev_get_iflink handles it
|
||||
internally and doesn't return the actual netns of the iflink. And
|
||||
dev_get_iflink only documents the situation where ifindex == iflink for
|
||||
physical devices.
|
||||
|
||||
But only checking for dev->netdev_ops->ndo_get_iflink is also not an option
|
||||
because ipoib_get_iflink implements it even when it sometimes returns an
|
||||
iflink != ifindex and sometimes iflink == ifindex. The caller must
|
||||
therefore make sure itself to check both netns and iflink + ifindex for
|
||||
equality. Only when they are equal, a "physical" interface was detected
|
||||
which should stop the traversal. On the other hand, vxcan_get_iflink can
|
||||
also return 0 in case there was currently no valid peer. In this case, it
|
||||
is still necessary to stop.
|
||||
|
||||
Fixes: 3d48811b27f5 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
|
||||
Fixes: 2b45bb6c3aad ("batman-adv: additional checks for virtual interfaces on top of WiFi")
|
||||
Reported-by: Sabrina Dubroca <sd@queasysnail.net>
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/0aac7a9fbbbeec25f2f54a9e6d53ea91217ba720
|
||||
|
||||
--- a/net/batman-adv/hard-interface.c
|
||||
+++ b/net/batman-adv/hard-interface.c
|
||||
@@ -156,13 +156,15 @@ static bool batadv_is_on_batman_iface(co
|
||||
return true;
|
||||
|
||||
iflink = dev_get_iflink(net_dev);
|
||||
-
|
||||
- /* no more parents..stop recursion */
|
||||
- if (iflink == 0 || iflink == net_dev->ifindex)
|
||||
+ if (iflink == 0)
|
||||
return false;
|
||||
|
||||
parent_net = batadv_getlink_net(net_dev, net);
|
||||
|
||||
+ /* iflink to itself, most likely physical device */
|
||||
+ if (net == parent_net && iflink == net_dev->ifindex)
|
||||
+ return false;
|
||||
+
|
||||
/* recurse over the parent device */
|
||||
parent_dev = __dev_get_by_index((struct net *)parent_net, iflink);
|
||||
/* if we got a NULL parent_dev there is something broken.. */
|
||||
@@ -222,8 +224,7 @@ static struct net_device *batadv_get_rea
|
||||
return NULL;
|
||||
|
||||
iflink = dev_get_iflink(netdev);
|
||||
-
|
||||
- if (netdev->ifindex == iflink) {
|
||||
+ if (iflink == 0) {
|
||||
dev_hold(netdev);
|
||||
return netdev;
|
||||
}
|
||||
@@ -234,6 +235,14 @@ static struct net_device *batadv_get_rea
|
||||
|
||||
net = dev_net(hard_iface->soft_iface);
|
||||
real_net = batadv_getlink_net(netdev, net);
|
||||
+
|
||||
+ /* iflink to itself, most likely physical device */
|
||||
+ if (net == real_net && netdev->ifindex == iflink) {
|
||||
+ real_netdev = netdev;
|
||||
+ dev_hold(real_netdev);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
real_netdev = dev_get_by_index(real_net, iflink);
|
||||
|
||||
out:
|
||||
@@ -1,46 +0,0 @@
|
||||
From: Sven Eckelmann <sven@narfation.org>
|
||||
Date: Sat, 16 Apr 2022 14:24:34 +0200
|
||||
Subject: batman-adv: Don't skb_split skbuffs with frag_list
|
||||
|
||||
The receiving interface might have used GRO to receive more fragments than
|
||||
MAX_SKB_FRAGS fragments. In this case, these will not be stored in
|
||||
skb_shinfo(skb)->frags but merged into the frag list.
|
||||
|
||||
batman-adv relies on the function skb_split to split packets up into
|
||||
multiple smaller packets which are not larger than the MTU on the outgoing
|
||||
interface. But this function cannot handle frag_list entries and is only
|
||||
operating on skb_shinfo(skb)->frags. If it is still trying to split such an
|
||||
skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST,
|
||||
then validate_xmit_skb() will try to linearize it. But this fails due to
|
||||
inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after
|
||||
skb_copy_bits() returns an error.
|
||||
|
||||
In case of entries in frag_list, just linearize the skb before operating on
|
||||
it with skb_split().
|
||||
|
||||
Reported-by: Felix Kaechele <felix@kaechele.ca>
|
||||
Tested-by: Felix Kaechele <felix@kaechele.ca>
|
||||
Fixes: 9de347143505 ("batman-adv: layer2 unicast packet fragmentation")
|
||||
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/d467720acaf1b22b0cee58144eeaf9ef6c5e285c
|
||||
|
||||
--- a/net/batman-adv/fragmentation.c
|
||||
+++ b/net/batman-adv/fragmentation.c
|
||||
@@ -475,6 +475,17 @@ int batadv_frag_send_packet(struct sk_bu
|
||||
goto free_skb;
|
||||
}
|
||||
|
||||
+ /* GRO might have added fragments to the fragment list instead of
|
||||
+ * frags[]. But this is not handled by skb_split and must be
|
||||
+ * linearized to avoid incorrect length information after all
|
||||
+ * batman-adv fragments were created and submitted to the
|
||||
+ * hard-interface
|
||||
+ */
|
||||
+ if (skb_has_frag_list(skb) && __skb_linearize(skb)) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto free_skb;
|
||||
+ }
|
||||
+
|
||||
/* Create one header to be copied to all fragments */
|
||||
frag_header.packet_type = BATADV_UNICAST_FRAG;
|
||||
frag_header.version = BATADV_COMPAT_VERSION;
|
||||
@@ -1,179 +0,0 @@
|
||||
/* Please avoid adding hacks here - instead add it to mac80211/backports.git */
|
||||
|
||||
#undef CONFIG_MODULE_STRIPPED
|
||||
|
||||
#include <linux/version.h> /* LINUX_VERSION_CODE */
|
||||
#include <linux/types.h>
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(5, 10, 0)
|
||||
|
||||
#include <linux/if_bridge.h>
|
||||
|
||||
struct batadv_br_ip {
|
||||
union {
|
||||
__be32 ip4;
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct in6_addr ip6;
|
||||
#endif
|
||||
} dst;
|
||||
__be16 proto;
|
||||
__u16 vid;
|
||||
};
|
||||
|
||||
struct batadv_br_ip_list {
|
||||
struct list_head list;
|
||||
struct batadv_br_ip addr;
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* "static" dropped to force compiler to evaluate it as part of multicast.c
|
||||
* might need to be added again and then called in some kind of dummy
|
||||
* compat.c in case this header is included in multiple files.
|
||||
*/
|
||||
inline void __batadv_br_ip_list_check(void)
|
||||
{
|
||||
BUILD_BUG_ON(sizeof(struct batadv_br_ip_list) != sizeof(struct br_ip_list));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, list) != offsetof(struct br_ip_list, list));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, addr) != offsetof(struct br_ip_list, addr));
|
||||
|
||||
BUILD_BUG_ON(sizeof(struct batadv_br_ip) != sizeof(struct br_ip));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip4) != offsetof(struct br_ip, u.ip4));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip6) != offsetof(struct br_ip, u.ip6));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip, proto) != offsetof(struct br_ip, proto));
|
||||
BUILD_BUG_ON(offsetof(struct batadv_br_ip, vid) != offsetof(struct br_ip, vid));
|
||||
}
|
||||
#endif
|
||||
|
||||
#define br_ip batadv_br_ip
|
||||
#define br_ip_list batadv_br_ip_list
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(5, 14, 0)
|
||||
|
||||
#include <linux/if_bridge.h>
|
||||
#include <net/addrconf.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
static inline bool
|
||||
br_multicast_has_router_adjacent(struct net_device *dev, int proto)
|
||||
{
|
||||
struct list_head bridge_mcast_list = LIST_HEAD_INIT(bridge_mcast_list);
|
||||
struct br_ip_list *br_ip_entry, *tmp;
|
||||
int ret;
|
||||
|
||||
if (proto != ETH_P_IPV6)
|
||||
return true;
|
||||
|
||||
ret = br_multicast_list_adjacent(dev, &bridge_mcast_list);
|
||||
if (ret < 0)
|
||||
return true;
|
||||
|
||||
ret = false;
|
||||
|
||||
list_for_each_entry_safe(br_ip_entry, tmp, &bridge_mcast_list, list) {
|
||||
if (br_ip_entry->addr.proto == htons(ETH_P_IPV6) &&
|
||||
ipv6_addr_is_ll_all_routers(&br_ip_entry->addr.dst.ip6))
|
||||
ret = true;
|
||||
|
||||
list_del(&br_ip_entry->list);
|
||||
kfree(br_ip_entry);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static inline bool
|
||||
br_multicast_has_router_adjacent(struct net_device *dev, int proto)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(5, 14, 0) */
|
||||
|
||||
#if LINUX_VERSION_IS_LESS(5, 15, 0)
|
||||
|
||||
static inline void batadv_eth_hw_addr_set(struct net_device *dev,
|
||||
const u8 *addr)
|
||||
{
|
||||
ether_addr_copy(dev->dev_addr, addr);
|
||||
}
|
||||
#define eth_hw_addr_set batadv_eth_hw_addr_set
|
||||
|
||||
#endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */
|
||||
|
||||
/* <DECLARE_EWMA> */
|
||||
|
||||
#include <linux/version.h>
|
||||
#include_next <linux/average.h>
|
||||
|
||||
#include <linux/bug.h>
|
||||
|
||||
#ifdef DECLARE_EWMA
|
||||
#undef DECLARE_EWMA
|
||||
#endif /* DECLARE_EWMA */
|
||||
|
||||
/*
|
||||
* Exponentially weighted moving average (EWMA)
|
||||
*
|
||||
* This implements a fixed-precision EWMA algorithm, with both the
|
||||
* precision and fall-off coefficient determined at compile-time
|
||||
* and built into the generated helper funtions.
|
||||
*
|
||||
* The first argument to the macro is the name that will be used
|
||||
* for the struct and helper functions.
|
||||
*
|
||||
* The second argument, the precision, expresses how many bits are
|
||||
* used for the fractional part of the fixed-precision values.
|
||||
*
|
||||
* The third argument, the weight reciprocal, determines how the
|
||||
* new values will be weighed vs. the old state, new values will
|
||||
* get weight 1/weight_rcp and old values 1-1/weight_rcp. Note
|
||||
* that this parameter must be a power of two for efficiency.
|
||||
*/
|
||||
|
||||
#define DECLARE_EWMA(name, _precision, _weight_rcp) \
|
||||
struct ewma_##name { \
|
||||
unsigned long internal; \
|
||||
}; \
|
||||
static inline void ewma_##name##_init(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
/* \
|
||||
* Even if you want to feed it just 0/1 you should have \
|
||||
* some bits for the non-fractional part... \
|
||||
*/ \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
e->internal = 0; \
|
||||
} \
|
||||
static inline unsigned long \
|
||||
ewma_##name##_read(struct ewma_##name *e) \
|
||||
{ \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
return e->internal >> (_precision); \
|
||||
} \
|
||||
static inline void ewma_##name##_add(struct ewma_##name *e, \
|
||||
unsigned long val) \
|
||||
{ \
|
||||
unsigned long internal = READ_ONCE(e->internal); \
|
||||
unsigned long weight_rcp = ilog2(_weight_rcp); \
|
||||
unsigned long precision = _precision; \
|
||||
\
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
|
||||
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
|
||||
BUILD_BUG_ON((_precision) > 30); \
|
||||
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
|
||||
\
|
||||
WRITE_ONCE(e->internal, internal ? \
|
||||
(((internal << weight_rcp) - internal) + \
|
||||
(val << precision)) >> weight_rcp : \
|
||||
(val << precision)); \
|
||||
}
|
||||
|
||||
/* </DECLARE_EWMA> */
|
||||
@@ -1,82 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG:=ftm
|
||||
PKG_NAME:=$(PKG)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_SRC:=$(TOPDIR)/qca/src/common-tools/ftm
|
||||
|
||||
PKG_VERSION:=12.3
|
||||
|
||||
#PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=QCA
|
||||
CATEGORY:=QTI software
|
||||
URL:=http://www.qca.qualcomm.com
|
||||
MAINTAINER:=Qualcomm Atheros
|
||||
TITLE:= QCA ftm utils
|
||||
DEPENDS:= @TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_64||TARGET_ipq_ipq60xx||TARGET_ipq_ipq60xx_64||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64||TARGET_ipq807x||TARGET_ipq50xx||TARGET_ipq60xx||TARGET_ipq95xx||TARGET_ipq53xx +libnl +libtcmd +qca-diag +librt +kmod-diag-char
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description/Default
|
||||
FTM Package Support for QCA WIFI 11 drivers
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DCONFIG_FTM_WLAN -DDEBUG -DFTM_DEBUG -DWIN_AP_HOST
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/qca-diag
|
||||
TARGET_CFLAGS += -MMD -O2 -Wall -g
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
TARGET_CFLAGS += -fpie
|
||||
TARGET_LDFLAGS += -ldiag -lnl-3 -lnl-genl-3 -lrt -ltcmd
|
||||
TARGET_CSRCS := ftm_main.c ftm_wlan.c ftm_write_to_flash.c
|
||||
TARGET_LDFLAGS += -pie
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_IPQ_PROVISION_SUPPORT),y)
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/qti-mfg-provision
|
||||
TARGET_CFLAGS += -DWIN_AP_AFC
|
||||
TARGET_LDFLAGS += -lprovision
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-mac80211),)
|
||||
TARGET_CFLAGS+=-DWIN_AP_HOST_OPEN=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_QCA_IOT),y)
|
||||
TARGET_CFLAGS += -DIPQ_AP_HOST_IOT -DIPQ_AP_HOST_IOT_QCA402X -ggdb3 -DCONFIG_DAEMON_MODE
|
||||
TARGET_CSRCS += ftm_iot.c
|
||||
TARGET_LDFLAGS += -lpthread
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/qca-iot
|
||||
TARGET_LDFLAGS += -ldiag_demo
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_IPQ_IOT_SUPPORT),y)
|
||||
TARGET_CFLAGS += -DIPQ_AP_HOST_IOT -DIPQ_AP_HOST_IOT_IPQ -ggdb3 -I$(STAGING_DIR)/usr/include/btdaemon
|
||||
TARGET_CSRCS += ftm_iot.c
|
||||
TARGET_LDFLAGS += -lpthread -lbtdaemon
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CC="$(TARGET_CC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
CSRCS="$(TARGET_CSRCS)"
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ftm $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/ftm.init $(1)/etc/init.d/ftm
|
||||
$(INSTALL_DIR) $(1)/lib/wifi
|
||||
$(INSTALL_BIN) ./files/compress_vart.sh $(1)/lib/compress_vart.sh
|
||||
ifneq (, $(findstring ipq95xx, $(CONFIG_TARGET_BOARD)))
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/ftm_qcc710_start.sh $(1)/sbin/ftm_qcc710_start
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ftm))
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2020 Qualcomm Technologies, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
# Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
#
|
||||
#
|
||||
|
||||
[ -e /lib/functions.sh ] && . /lib/functions.sh
|
||||
[ -e /lib/ipq806x.sh ] && . /lib/ipq806x.sh
|
||||
[ -e /lib/functions/boot.sh ] && . /lib/functions/boot.sh
|
||||
|
||||
low_mem_compress_art()
|
||||
{
|
||||
local mtdblock=$(find_mtd_part 0:ART)
|
||||
|
||||
if [ -z "$mtdblock" ]; then
|
||||
# read from mmc
|
||||
mtdblock=$(find_mmc_part 0:ART)
|
||||
fi
|
||||
|
||||
[ -n "$mtdblock" ] || return
|
||||
|
||||
local apmp="/tmp"
|
||||
|
||||
lzma -zvfk -4 ${apmp}/virtual_art.bin 2> /dev/null || {
|
||||
echo "Error Compressing Virtual ART" > /dev/console
|
||||
return
|
||||
}
|
||||
|
||||
dd if=${apmp}/virtual_art.bin.lzma of=${mtdblock}
|
||||
echo "Success compressing Virtual ART(${mtdblock})" > /dev/console
|
||||
return
|
||||
}
|
||||
|
||||
normal_art()
|
||||
{
|
||||
local mtdblock=$(find_mtd_part 0:ART)
|
||||
|
||||
if [ -z "$mtdblock" ]; then
|
||||
# read from mmc
|
||||
mtdblock=$(find_mmc_part 0:ART)
|
||||
fi
|
||||
|
||||
[ -n "$mtdblock" ] || return
|
||||
|
||||
local apmp="/tmp"
|
||||
|
||||
dd if=${apmp}/virtual_art.bin of=${mtdblock}
|
||||
echo "Success writing to ART(${mtdblock})" > /dev/console
|
||||
return
|
||||
}
|
||||
|
||||
write_caldata()
|
||||
{
|
||||
local board
|
||||
[ -f /tmp/sysinfo/board_name ] && {
|
||||
board=ap$(cat /tmp/sysinfo/board_name | awk -F 'ap' '{print$2}')
|
||||
}
|
||||
|
||||
if [ -e /sys/firmware/devicetree/base/compressed_art ]
|
||||
then
|
||||
echo "Compressed ART Supported Platform $board " > /dev/console
|
||||
low_mem_compress_art
|
||||
else
|
||||
echo "Non Compressed ART Platform $board " > /dev/console
|
||||
normal_art
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "write_caldata" ]
|
||||
then
|
||||
write_caldata
|
||||
fi
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (c) 2013, 2017, 2020 Qualcomm Technologies, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
# Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
#
|
||||
# 2013 Qualcomm Atheros, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
# Qualcomm Atheros Confidential and Proprietary
|
||||
#
|
||||
|
||||
[ -e /lib/functions.sh ] && . /lib/functions.sh
|
||||
[ -e /lib/ipq806x.sh ] && . /lib/ipq806x.sh
|
||||
[ -e /lib/functions/boot.sh ] && . /lib/functions/boot.sh
|
||||
|
||||
START=97
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
|
||||
MTD_ART_PART_NAME="art"
|
||||
|
||||
compressed_art_read() {
|
||||
local mtdblock=$(find_mtd_part 0:ART)
|
||||
|
||||
if [ -z "$mtdblock" ]; then
|
||||
#read from mmc
|
||||
mtdblock=$(find_mmc_part 0:ART)
|
||||
fi
|
||||
|
||||
[ -n "$mtdblock" ] || return
|
||||
|
||||
local apmp="/tmp"
|
||||
|
||||
dd if=${mtdblock} of=${apmp}/virtual_art.bin.lzma
|
||||
lzma -fdv --single-stream ${apmp}/virtual_art.bin.lzma || {
|
||||
# Create dummy virtual_art.bin file of size 512K
|
||||
dd if=/dev/zero of=${apmp}/virtual_art.bin bs=1024 count=512
|
||||
}
|
||||
echo "Uncompressed and Copied ART content from ${mtdblock} to /tmp/virtual_art.bin" > /dev/console
|
||||
}
|
||||
|
||||
raw_art_read() {
|
||||
local mtdblock=$(find_mtd_part 0:ART)
|
||||
|
||||
if [ -z "$mtdblock" ]; then
|
||||
#read from mmc
|
||||
mtdblock=$(find_mmc_part 0:ART)
|
||||
fi
|
||||
|
||||
[ -n "$mtdblock" ] || return
|
||||
|
||||
local apmp="/tmp"
|
||||
|
||||
dd if=${mtdblock} of=${apmp}/virtual_art.bin
|
||||
echo "Copy ART caldata from ${mtdblock} to /tmp/virtual_art.bin" > /dev/console
|
||||
}
|
||||
|
||||
retrieve_caldata() {
|
||||
local board
|
||||
[ -f /tmp/sysinfo/board_name ] && {
|
||||
board=ap$(cat /tmp/sysinfo/board_name | awk -F 'ap' '{print$2}')
|
||||
}
|
||||
echo "**** Platform Name: $board *****" > /dev/console
|
||||
|
||||
if [ -e /sys/firmware/devicetree/base/compressed_art ]
|
||||
then
|
||||
compressed_art_read
|
||||
else
|
||||
raw_art_read
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
local emmc_flash=""
|
||||
local nor_flash=""
|
||||
|
||||
emmc_flash=$(find_mmc_part 0:ART 2> /dev/null)
|
||||
mtd_name=$(grep -i -w ${MTD_ART_PART_NAME} /proc/mtd | cut -f1 -d:)
|
||||
nor_flash=`find /sys/bus/spi/devices/*/mtd -name ${mtd_name} 2> /dev/null`
|
||||
|
||||
if [ -n "$emmc_flash" ]; then
|
||||
[ -L /dev/caldata ] || \
|
||||
ln -s $emmc_flash /dev/caldata
|
||||
elif [ -n "$nor_flash" ]; then
|
||||
[ -L /dev/caldata ] || \
|
||||
ln -s /dev/${mtd_name//mtd/mtdblock} /dev/caldata
|
||||
elif [ -n "$mtd_name" ]; then
|
||||
[ -L /dev/caldata ] || \
|
||||
ln -s /dev/${mtd_name//mtd/mtdblock} /dev/caldata
|
||||
fi
|
||||
retrieve_caldata
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ -L /dev/caldata ] && rm /dev/caldata
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2021 Qualcomm Technologies, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
# Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
#
|
||||
#
|
||||
|
||||
# QCC710 v1.0 reset for BT bringup
|
||||
qcc710_reset() {
|
||||
reset_gpio_pin=$(cat /proc/device-tree/soc/pinctrl@1000000/QCC710_pins/QCC710_reset/pins | sed s/"gpio"//)
|
||||
[[ -z $reset_gpio_pin ]] && return
|
||||
gpio_base=$(cat /sys/class/gpio/gpiochip*/base | head -n1)
|
||||
gpio_reset=$(( gpio_base + reset_gpio_pin ))
|
||||
if [[ ! -e /sys/class/gpio/gpio$gpio_reset ]]; then
|
||||
[ -z ${SLEEP} ] && echo -e "Enter sleep value for reset. Options:\n10 \n1" && read -p "Enter : " SLEEP
|
||||
[ -z ${SLEEP} ] && SLEEP=10
|
||||
echo $gpio_reset > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio$gpio_reset/direction
|
||||
echo "Performing QCC710 reset ...." > /dev/console
|
||||
{ echo 1 > /sys/class/gpio/gpio$gpio_reset/value ; \
|
||||
sleep $SLEEP; \
|
||||
echo 0 > /sys/class/gpio/gpio$gpio_reset/value; \
|
||||
echo "QCC710 reset complete ...." > /dev/console; }
|
||||
fi
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-h|--help) HELP=1; break;;
|
||||
-a|--ipaddr) SERVERIP="$2";shift;;
|
||||
-s|--sleep) SLEEP="$2";shift;;
|
||||
-r|--baud-rate) BAUDRATE="$2";shift;;
|
||||
-*)
|
||||
echo "Invalid option: $1"
|
||||
ERROR=1;
|
||||
break
|
||||
;;
|
||||
*)break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
[ -n "$HELP" -o -n "$ERROR" ] && {
|
||||
cat <<EOF
|
||||
Usage: $0 [-h] [-a SERVERIP] [-r baud-rate] [-s sleep]
|
||||
ftm_qcc710_start options:
|
||||
-h print this help
|
||||
-a ipaddr of the server for diag connection
|
||||
-r baudrate
|
||||
-s sleep
|
||||
|
||||
Example:
|
||||
ftm_qcc710_start -a <serverip> -r <baud-rate> -s <sleep>
|
||||
|
||||
version 1 : ./sbin/ftm_qcc710_start -a 192.168.1.121 -r 2000000 -s 10
|
||||
version 2 : ./sbin/ftm_qcc710_start -a 192.168.1.121 -r 115200 -s 1
|
||||
EOF
|
||||
# If we requested the help flag, then exit normally.
|
||||
# Else, it's probably an error so report it as such.
|
||||
[ -n "$HELP" ] && exit 0
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z ${SERVERIP} ] && SERVERIP=$(grep -oh "serverip.*#" /proc/cmdline | awk -F '#' '{print $2}')
|
||||
[ -z ${SERVERIP} ] && read -p "No serverip in cmdline, please enter the serverip : " SERVERIP
|
||||
[ -z ${BAUDRATE} ] && echo -e "Enter baudrate for stack bringup. Options:\n2000000\n115200" && read -p "Enter : " BAUDRATE
|
||||
[ -z ${BAUDRATE} ] && BAUDRATE=2000000
|
||||
qcc710_reset
|
||||
DIAG_PID=$(ps | grep diag_socket_app | grep -v grep | awk '{print $1}')
|
||||
while [ -n "$DIAG_PID" ]
|
||||
do
|
||||
kill -s SIGTERM $DIAG_PID
|
||||
DIAG_PID=$(ps | grep diag_socket_app | grep -v grep | awk '{print $1}')
|
||||
done
|
||||
echo "Stopped previous instances of diag_socket_app process"
|
||||
[ -z "$DIAG_PID" ] && /usr/sbin/diag_socket_app -a $SERVERIP -p 2500 &
|
||||
|
||||
FTM_PID=$(ps | grep "ftm " | grep -v grep | awk '{print $1}')
|
||||
while [ -n "$FTM_PID" ]
|
||||
do
|
||||
kill -s SIGTERM $FTM_PID
|
||||
FTM_PID=$(ps | grep "ftm " | grep -v grep | awk '{print $1}')
|
||||
done
|
||||
echo "Stopped previous instances ftm process"
|
||||
[ -z "$FTM_PID" ] && /usr/sbin/ftm -n -dd -r $BAUDRATE
|
||||
@@ -1,133 +0,0 @@
|
||||
ifeq ($(call is-vendor-board-platform,QCOM),true)
|
||||
|
||||
# Build only if board has BT/FM/WLAN
|
||||
ifeq ($(findstring true, $(BOARD_HAVE_QCOM_FM) $(BOARD_HAVE_BLUETOOTH) $(BOARD_HAS_ATH_WLAN_AR6320)),true)
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
BDROID_DIR:= system/bt
|
||||
ifeq ($(TARGET_SUPPORTS_WEARABLES),true)
|
||||
QTI_DIR := hardware/qcom/bt/msm8909/libbt-vendor
|
||||
else
|
||||
QTI_DIR := hardware/qcom/bt/libbt-vendor
|
||||
endif
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/diag/include \
|
||||
LOCAL_C_INCLUDES += vendor/qcom/proprietary/diag/src \
|
||||
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc \
|
||||
LOCAL_C_INCLUDES += vendor/qcom/proprietary/bt/hci_qcomm_init \
|
||||
LOCAL_C_INCLUDES += vendor/qcom/opensource/fm/helium \
|
||||
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
|
||||
LOCAL_C_INCLUDES += $(BDROID_DIR)/hci/include \
|
||||
LOCAL_C_INCLUDES += $(QTI_DIR)/include
|
||||
ifeq ($(TARGET_SUPPORTS_WEARABLES),true)
|
||||
LOCAL_C_INCLUDES += device/qcom/msm8909w/opensource/bluetooth/tools/hidl_client/inc
|
||||
else
|
||||
LOCAL_C_INCLUDES += vendor/qcom/opensource/bluetooth/tools/hidl_client/inc
|
||||
endif
|
||||
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
|
||||
LOCAL_CFLAGS:= \
|
||||
-DANDROID \
|
||||
-DDEBUG
|
||||
|
||||
#LOCAL_CFLAGS += -include bionic/libc/include/sys/socket.h
|
||||
#LOCAL_CFLAGS += -include bionic/libc/include/netinet/in.h
|
||||
|
||||
ifneq ($(DISABLE_BT_FTM),true)
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_BT
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD_HAVE_QCOM_FM),true)
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_FM
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD_HAS_QCA_FM_SOC), "cherokee")
|
||||
LOCAL_CFLAGS += -DFM_SOC_TYPE_CHEROKEE
|
||||
endif
|
||||
|
||||
ifneq ($(BOARD_ANT_WIRELESS_DEVICE), )
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_ANT
|
||||
endif
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_NFC
|
||||
|
||||
ifeq ($(BOARD_HAVE_BLUETOOTH_BLUEZ), true)
|
||||
LOCAL_CFLAGS += -DHAS_BLUEZ_BUILDCFG
|
||||
endif # BOARD_HAVE_BLUETOOTH_BLUEZ
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
ftm_main.c \
|
||||
ftm_nfc.c \
|
||||
ftm_nfcnq.c \
|
||||
ftm_nfcqti.c \
|
||||
ftm_nfcnq_fwdl.c \
|
||||
ftm_nfcnq_test.c
|
||||
|
||||
ifneq ($(DISABLE_BT_FTM),true)
|
||||
LOCAL_SRC_FILES += \
|
||||
ftm_bt.c \
|
||||
ftm_bt_power_pfal_linux.c \
|
||||
ftm_bt_hci_pfal_linux.c \
|
||||
ftm_bt_persist.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(call is-platform-sdk-version-at-least,23),true)
|
||||
LOCAL_CFLAGS += -DANDROID_M
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD_HAVE_QCOM_FM),true)
|
||||
ifeq ($(BOARD_HAS_QCA_FM_SOC), "cherokee")
|
||||
LOCAL_SRC_FILES += ftm_fm.c ftm_fm_pfal_linux_3990.c
|
||||
else
|
||||
LOCAL_SRC_FILES += ftm_fm.c ftm_fm_pfal_linux.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(BOARD_ANT_WIRELESS_DEVICE), )
|
||||
LOCAL_SRC_FILES += ftm_ant.c
|
||||
endif
|
||||
|
||||
ifeq ($(findstring true, $(BOARD_HAS_ATH_WLAN) $(BOARD_HAS_ATH_WLAN_AR6320)),true)
|
||||
LOCAL_CFLAGS += -DBOARD_HAS_ATH_WLAN_AR6320
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_WLAN
|
||||
LOCAL_CFLAGS += -DCONFIG_FTM_WLAN_AUTOLOAD
|
||||
LOCAL_STATIC_LIBRARIES += libtcmd
|
||||
LOCAL_SHARED_LIBRARIES += libnl
|
||||
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libtcmd
|
||||
LOCAL_SRC_FILES += ftm_wlan.c
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libdl
|
||||
|
||||
ifneq ($(DISABLE_BT_FTM),true)
|
||||
LOCAL_SHARED_LIBRARIES += libbt-hidlclient
|
||||
endif
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
|
||||
LOCAL_MODULE:= ftmdaemon
|
||||
LOCAL_CLANG := true
|
||||
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
|
||||
LOCAL_PROPRIETARY_MODULE := true
|
||||
endif
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_SHARED_LIBRARIES += libdiag
|
||||
LOCAL_SHARED_LIBRARIES += libcutils liblog libhardware
|
||||
|
||||
ifneq ($(DISABLE_BT_FTM),true)
|
||||
LOCAL_SHARED_LIBRARIES += libbtnv
|
||||
endif
|
||||
|
||||
# By default NV persist gets used
|
||||
LOCAL_CFLAGS += -DBT_NV_SUPPORT
|
||||
|
||||
LDFLAGS += -ldl
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
|
||||
endif # filter
|
||||
endif # is-vendor-board-platform
|
||||
@@ -1,181 +0,0 @@
|
||||
This text file is provided to comply with the attribution requirements of
|
||||
the licenses herein, but see NOTICE for license terms of this software.
|
||||
The Apache 2.0 license can be found at
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -1,12 +0,0 @@
|
||||
#CC := $(ATH_CROSS_COMPILE_TYPE)gcc
|
||||
TARGET_TYPE ?= AR9888
|
||||
TARGET_VERS ?= v2
|
||||
|
||||
#Sources to compile
|
||||
CSRCS := ftm_main.c ftm_wlan.c ftm_write_to_flash.c
|
||||
|
||||
all:
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -g3 -Wall \
|
||||
$(CSRCS) -o ftm
|
||||
clean:
|
||||
rm -f ftm
|
||||
@@ -1,86 +0,0 @@
|
||||
AM_CFLAGS = -Wall \
|
||||
-g -O0 \
|
||||
$(DIAG_CFLAGS)
|
||||
|
||||
AM_CPPFLAGS = -Wall \
|
||||
-g -O0 \
|
||||
$(DIAG_CFLAGS)
|
||||
|
||||
AM_CFLAGS += -I${WORKSPACE}/system/bt/hci/include
|
||||
AM_CFLAGS += -I${WORKSPACE}/vendor/qcom/proprietary/bt/hci_qcomm_init/
|
||||
|
||||
AM_CPPFLAGS += -I${WORKSPACE}/system/bt/hci/include
|
||||
AM_CPPFLAGS += -I${WORKSPACE}/vendor/qcom/proprietary/bt/hci_qcomm_init/
|
||||
|
||||
if DEBUG
|
||||
AM_CFLAGS += -DDEBUG
|
||||
AM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
requiredlibs = -lrt $(DIAG_LIBS)
|
||||
|
||||
if USE_GLIB
|
||||
AM_CFLAGS += -DUSE_GLIB $(GLIB_CFLAGS)
|
||||
AM_CPPFLAGS += -DUSE_GLIB $(GLIB_CFLAGS)
|
||||
requiredlibs += $(GLIB_LIBS)
|
||||
endif
|
||||
|
||||
#By default build for MDM_LE
|
||||
AM_CFLAGS += -DMDM_LE
|
||||
AM_CPPFLAGS += -DMDM_LE
|
||||
|
||||
if MDM_ROME
|
||||
AM_CFLAGS += -DBT_SOC_TYPE_ROME
|
||||
AM_CPPFLAGS += -DBT_SOC_TYPE_ROME
|
||||
else
|
||||
if MDM_PRONTO
|
||||
AM_CFLAGS += -DHCI_USE_MCT
|
||||
AM_CPPFLAGS += -DHCI_USE_MCT
|
||||
endif
|
||||
endif
|
||||
|
||||
c_sources = ftm_main.c
|
||||
|
||||
if CONFIG_FTM_BT
|
||||
AM_CFLAGS += -DCONFIG_FTM_BT -DBT_NV_SUPPORT
|
||||
AM_CPPFLAGS += -DCONFIG_FTM_BT -DBT_NV_SUPPORT
|
||||
c_sources += ftm_bt.c
|
||||
c_sources += ftm_bt_power_pfal_linux.c
|
||||
c_sources += ftm_bt_hci_pfal_linux.c
|
||||
c_sources += ftm_bt_persist.cpp
|
||||
endif
|
||||
|
||||
if CONFIG_FTM_FM
|
||||
AM_CFLAGS += -DCONFIG_FTM_FM
|
||||
c_sources += ftm_fm.c
|
||||
c_sources += ftm_fm_pfal_linux.c
|
||||
endif
|
||||
|
||||
if CONFIG_FTM_ANT
|
||||
AM_CFLAGS += -DCONFIG_FTM_ANT
|
||||
c_sources += ftm_ant.c
|
||||
endif
|
||||
|
||||
if CONFIG_FTM_NFC
|
||||
AM_CFLAGS += -DCONFIG_FTM_NFC
|
||||
c_sources += ftm_nfc.c
|
||||
c_sources += ftm_nfcnq.c
|
||||
c_sources += ftm_nfcqti.c
|
||||
c_sources += ftm_nfcnq_fwdl.c
|
||||
c_sources += ftm_nfcnq_test.c
|
||||
endif
|
||||
|
||||
if CONFIG_FTM_WLAN
|
||||
|
||||
AM_CFLAGS += -DCONFIG_FTM_WLAN -DCONFIG_FTM_WLAN_AUTOLOAD
|
||||
AM_CFLAGS += $(LIBNL_CFLAGS) $(ATH6KL_UTILS_CFLAGS)
|
||||
AM_CPPFLAGS += $(LIBNL_CFLAGS) $(ATH6KL_UTILS_CFLAGS)
|
||||
|
||||
requiredlibs += $(ATH6KL_UTILS_LIBS) $(LIBNL_LIBS)
|
||||
|
||||
c_sources += ftm_wlan.c
|
||||
endif
|
||||
|
||||
ftmdaemon_SOURCES = $(c_sources)
|
||||
ftmdaemon_LDADD = -ldl $(requiredlibs) -lbtnv
|
||||
bin_PROGRAMS = ftmdaemon
|
||||
@@ -1,72 +0,0 @@
|
||||
This NOTICE file contains certain notices of software components included
|
||||
with the software that Qualcomm Technologies, Inc. ("Qualcomm Technologies")
|
||||
is required to provide you. Notwithstanding anything in the notices in this
|
||||
file, your use of these software components together with the
|
||||
Qualcomm Technologies software (Qualcomm Technologies software hereinafter
|
||||
referred to as "Software") is subject to the terms of your license from
|
||||
Qualcomm Technologies. Compliance with all copyright laws and software
|
||||
license agreements included in the notice section of this file are the
|
||||
responsibility of the user. Except as may be granted by separate express
|
||||
written agreement, this file provides no license to any patents,
|
||||
trademarks, copyrights, or other intellectual property.
|
||||
|
||||
Copyright (c) 2016 Qualcomm Technologies, Inc.
|
||||
All rights reserved.
|
||||
Qualcomm is a registered trademark and registered service mark of
|
||||
QUALCOMM Incorporated. All other trademarks and service marks are the
|
||||
property of their respective owners.
|
||||
________________________________________
|
||||
NOTICES
|
||||
________________________________________
|
||||
|
||||
Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
________________________________________
|
||||
|
||||
Copyright (C) 2015 NXP Semiconductors
|
||||
The original Work has been changed by NXP Semiconductors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
________________________________________
|
||||
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
________________________________________
|
||||
|
||||
Note: Any files for which the above Apache License notices are required
|
||||
to be provided are not contributions.
|
||||
|
||||
A copy of the Apache 2.0 license is included in the file LICENSE
|
||||
for attribution purposes only.
|
||||
@@ -1,149 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
|
||||
# configure.ac -- Autoconf script for ftm.
|
||||
#
|
||||
|
||||
# Process this file with autoconf to produce a configure script
|
||||
|
||||
# Requires autoconf tool later than 2.61
|
||||
AC_PREREQ(2.61)
|
||||
# Initialize the ftm package version 1.0.0
|
||||
AC_INIT([ftm],1.0.0)
|
||||
# Does not strictly follow GNU Coding standards
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
# Disables auto rebuilding of configure, Makefile.ins
|
||||
AM_MAINTAINER_MODE
|
||||
# defines some macros variable to be included by source
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
# Checks for libraries.
|
||||
PKG_CHECK_MODULES([DIAG], [diag])
|
||||
AC_SUBST([DIAG_CFLAGS])
|
||||
AC_SUBST([DIAG_LIBS])
|
||||
|
||||
has_libnl_ver=0
|
||||
# libnl-2 provides only libnl-2.0.pc file, so we check for separate libnl-genl-3.0.pc
|
||||
# pkg-config file just for libnl-3.0 case.
|
||||
#
|
||||
PKG_CHECK_MODULES([LIBNL], [libnl-3.0 >= 3.0 libnl-genl-3.0 >= 3.0], [has_libnl_ver=3], [
|
||||
PKG_CHECK_MODULES([LIBNL], [libnl-2.0 >= 2.0], [has_libnl_ver=2], [
|
||||
PKG_CHECK_MODULES([LIBNL], [libnl-1], [has_libnl_ver=1], [has_libnl_ver=0])])])
|
||||
|
||||
if (test "$has_libnl_ver" -eq 0); then
|
||||
AC_MSG_ERROR(libnl and libnl-genl are required but were not found)
|
||||
fi
|
||||
|
||||
if (test "$has_libnl_ver" -gt 1); then
|
||||
AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
|
||||
fi
|
||||
|
||||
AC_SUBST([LIBNL_CFLAGS])
|
||||
AC_SUBST([LIBNL_LIBS])
|
||||
|
||||
PKG_CHECK_MODULES([ATH6KL_UTILS], [ath6kl-utils])
|
||||
AC_SUBST([ATH6KL_UTILS_CFLAGS])
|
||||
AC_SUBST([ATH6KL_UTILS_LIBS])
|
||||
|
||||
AC_ARG_WITH([glib],
|
||||
AC_HELP_STRING([--with-glib],
|
||||
[enable glib, building FTM Daemon which use glib]))
|
||||
|
||||
if (test "x${with_glib}" = "xyes"); then
|
||||
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
|
||||
AC_MSG_ERROR(GThread >= 2.16 is required))
|
||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
|
||||
AC_MSG_ERROR(GLib >= 2.16 is required))
|
||||
GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
|
||||
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
|
||||
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
fi
|
||||
AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
|
||||
|
||||
AC_ARG_ENABLE([debug],
|
||||
[ --enable-debug Turn on debugging],
|
||||
[case "${enableval}" in
|
||||
yes) debug=true ;;
|
||||
no) debug=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
||||
esac],[debug=false])
|
||||
|
||||
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
|
||||
|
||||
AC_ARG_ENABLE([all],
|
||||
[ --enable-all Enable all FTM functionality],
|
||||
[case "${enableval}" in
|
||||
yes) all=true ;;
|
||||
no) all=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-all]) ;;
|
||||
esac],[all=false])
|
||||
|
||||
AM_CONDITIONAL([CONFIG_FTM_BT], [test x$all = xtrue])
|
||||
AM_CONDITIONAL([CONFIG_FTM_FM], [test x$all = xtrue])
|
||||
AM_CONDITIONAL([CONFIG_FTM_ANT], [test x$all = xtrue])
|
||||
AM_CONDITIONAL([CONFIG_FTM_NFC], [test x$all = xtrue])
|
||||
|
||||
AC_ARG_ENABLE([wlan],
|
||||
[ --enable-wlan Enable WLAN FTM functionality],
|
||||
[case "${enableval}" in
|
||||
yes) wlan=true ;;
|
||||
no) wlan=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-wlan]) ;;
|
||||
esac],[wlan=false])
|
||||
|
||||
AM_CONDITIONAL([CONFIG_FTM_WLAN], [test x$wlan = xtrue -o x$all = xtrue])
|
||||
|
||||
AC_ARG_ENABLE([bt],
|
||||
[ --enable-bt Enable BT FTM functionality],
|
||||
[case "${enableval}" in
|
||||
yes) bt=true ;;
|
||||
no) bt=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-bt]) ;;
|
||||
esac],[bt=false])
|
||||
|
||||
AM_CONDITIONAL([CONFIG_FTM_BT], [test x$bt = xtrue -o x$all = xtrue])
|
||||
|
||||
|
||||
AC_ARG_ENABLE(target,
|
||||
[AS_HELP_STRING([--enable-target=TARGET], [Specify the target product to build])],
|
||||
[TARGET=$enableval],
|
||||
[TARGET=none]
|
||||
)
|
||||
AM_CONDITIONAL([MDM_ROME], [test "x$TARGET" = "xmdm9607" -o "x$TARGET" = "xmdm9635" -o "x$TARGET" = "xmdm9640" -o "x$TARGET" = "xmdmcalifornium"])
|
||||
AM_CONDITIONAL([MDM_PRONTO], [test "x$TARGET" = "xapq8009" -o "x$TARGET" = "xapq8017" -o "x$TARGET" = "xapq8053"])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_HEADER_STDC
|
||||
AC_C_INLINE
|
||||
AC_TYPE_INT64_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT8_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_MALLOC
|
||||
|
||||
AC_CONFIG_FILES([ \
|
||||
Makefile \
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -1,585 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM ANT Source File
|
||||
|
||||
Description
|
||||
FTM platform independent processing of packet data
|
||||
|
||||
# Copyright (c) 2010-2012 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
05/16/12 ankurn Adding support for ANT commands
|
||||
11/28/12 c_ssugas implements efficent method for Ant cmd transfer
|
||||
and implements Rx thread for event handling.
|
||||
===========================================================================*/
|
||||
#include "event.h"
|
||||
#include "msg.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "diag_lsm.h"
|
||||
#include "diagpkt.h"
|
||||
#include "diagcmd.h"
|
||||
#include "diag.h"
|
||||
#include "termios.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <dlfcn.h>
|
||||
#include "bt_vendor_qcom.h"
|
||||
#include "ftm_ant_common.h"
|
||||
#include "ftm_bt.h"
|
||||
#include <string.h>
|
||||
#include "hidl_client.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <cutils/properties.h>
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
extern int soc_type;
|
||||
#endif
|
||||
|
||||
#define ANT_CTRL_PACKET_TYPE 0x0c
|
||||
#define ANT_DATA_PACKET_TYPE 0x0e
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
int init_transport_ant(int on);
|
||||
// The following functions are dummy implementations of the callbacks required by libbt-vendor.
|
||||
static void vendor_fwcfg_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_scocfg_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_lpm_vnd_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_audio_state_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void* vendor_alloc(int size) {
|
||||
UNUSED(size);
|
||||
return NULL;
|
||||
}
|
||||
static void vendor_dealloc(void *p_buf) {
|
||||
UNUSED(p_buf);
|
||||
}
|
||||
static uint8_t vendor_xmit_cb(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback) {
|
||||
UNUSED(opcode);
|
||||
UNUSED(p_buf);
|
||||
UNUSED(p_cback);
|
||||
return 0;
|
||||
}
|
||||
static void vendor_epilog_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_a2dp_offload_cb(bt_vendor_op_result_t result, bt_vendor_opcode_t op, unsigned char handle) {
|
||||
UNUSED(result);
|
||||
UNUSED(op);
|
||||
UNUSED(handle);
|
||||
}
|
||||
|
||||
// This struct is used to regsiter the dummy callbacks with libbt-vendor
|
||||
static bt_vendor_interface_t *vendor_interface=NULL;
|
||||
static const bt_vendor_callbacks_t vendor_callbacks = {
|
||||
sizeof(bt_vendor_callbacks_t),
|
||||
vendor_fwcfg_cb,
|
||||
vendor_scocfg_cb,
|
||||
vendor_lpm_vnd_cb,
|
||||
vendor_audio_state_cb,
|
||||
vendor_alloc,
|
||||
vendor_dealloc,
|
||||
vendor_xmit_cb,
|
||||
vendor_epilog_cb,
|
||||
vendor_a2dp_offload_cb
|
||||
};
|
||||
|
||||
/* Transport file descriptor */
|
||||
int fd_transport_ant_cmd;
|
||||
extern int first_ant_command;
|
||||
/* Reader thread handle */
|
||||
pthread_t ant_cmd_thread_hdl;
|
||||
/* Pipe file descriptors for cancelling read operation */
|
||||
int ant_pipefd[2];
|
||||
|
||||
/* Enable FTM_DEBUG to turn on Debug messages */
|
||||
//#define FTM_DEBUG
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_ant_readerthread
|
||||
|
||||
DESCRIPTION
|
||||
Thread Routine to perfom asynchrounous handling of events coming on Smd
|
||||
descriptor. It invokes a callback to the FTM ANT layer to intiate a request
|
||||
to read event bytes.
|
||||
|
||||
DEPENDENCIES
|
||||
The LifeTime of ReaderThraad is dependent on the status returned by the
|
||||
call to ftm_ant_qcomm_handle_event
|
||||
|
||||
RETURN VALUE
|
||||
RETURN NULL
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
void *ftm_ant_readerthread(void *ptr)
|
||||
{
|
||||
boolean status = FALSE;
|
||||
int retval;
|
||||
fd_set readfds;
|
||||
int buf;
|
||||
|
||||
UNUSED(ptr);
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_readerthread --> \n");
|
||||
#endif
|
||||
do
|
||||
{
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(fd_transport_ant_cmd, &readfds);
|
||||
FD_SET(ant_pipefd[0],&readfds);
|
||||
retval = select((fd_transport_ant_cmd>ant_pipefd[0]?fd_transport_ant_cmd
|
||||
:ant_pipefd[0]) + 1, &readfds, NULL, NULL, NULL);
|
||||
if(retval == -1)
|
||||
{
|
||||
printf("select failed\n");
|
||||
break;
|
||||
}
|
||||
if(FD_ISSET(ant_pipefd[0],&readfds))
|
||||
{
|
||||
#ifdef FTM_DEBUG
|
||||
printf("Pipe descriptor set\n");
|
||||
#endif
|
||||
read(ant_pipefd[0],&buf,1);
|
||||
if(buf == 1)
|
||||
break;
|
||||
}
|
||||
if(FD_ISSET(fd_transport_ant_cmd,&readfds))
|
||||
{
|
||||
#ifdef FTM_DEBUG
|
||||
printf("Read descriptor set\n");
|
||||
#endif
|
||||
status = ftm_ant_qcomm_handle_event();
|
||||
if(TRUE != status)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(1);
|
||||
#ifdef FTM_DEBUG
|
||||
printf("\nReader thread exited\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_ant_open_channel
|
||||
|
||||
DESCRIPTION
|
||||
Open the SMD transport associated with ANT
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
int value indicating success or failure
|
||||
|
||||
SIDE EFFECTS
|
||||
NONE
|
||||
|
||||
===========================================================================*/
|
||||
static bool ftm_ant_open_channel()
|
||||
{
|
||||
struct termios term_port;
|
||||
int opts;
|
||||
|
||||
printf("%s: \n",__func__ );
|
||||
switch (soc_type)
|
||||
{
|
||||
case BT_SOC_ROME:
|
||||
case BT_SOC_CHEROKEE:
|
||||
case BT_SOC_NAPIER:
|
||||
//Use hidl_client_initialize for chip initialization
|
||||
if (hidl_client_initialize(MODE_ANT,&fd_transport_ant_cmd) == false) {
|
||||
printf("%s: HIDL client initialization failed, opening port with init_transpor_ant\n", __func__);
|
||||
//Use libbt-vendor for chip initialization
|
||||
fd_transport_ant_cmd = init_transport_ant(TRUE);
|
||||
if (fd_transport_ant_cmd == -1) {
|
||||
printf("%s: ANT Device open Failed, fd:%d: \n", __func__, fd_transport_ant_cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BT_SOC_AR3K:
|
||||
case BT_SOC_SMD:
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_open_channel --> \n");
|
||||
#endif
|
||||
|
||||
fd_transport_ant_cmd = open(APPS_RIVA_ANT_CMD_CH, (O_RDWR));
|
||||
if (fd_transport_ant_cmd == -1) {
|
||||
printf("Ant Device open Failed= %d\n ", fd_transport_ant_cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Blocking Read
|
||||
opts = fcntl(fd_transport_ant_cmd, F_GETFL);
|
||||
if (opts < 0) {
|
||||
perror("fcntl(F_GETFL)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
opts = opts & (~O_NONBLOCK);
|
||||
if (fcntl(fd_transport_ant_cmd, F_SETFL, opts) < 0) {
|
||||
perror("fcntl(F_SETFL)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (tcgetattr(fd_transport_ant_cmd, &term_port) < 0)
|
||||
close(fd_transport_ant_cmd);
|
||||
cfmakeraw(&term_port);
|
||||
if (tcsetattr(fd_transport_ant_cmd, TCSANOW, &term_port) < 0) {
|
||||
printf("\n Error while setting attributes\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
tcflush(fd_transport_ant_cmd, TCIFLUSH);
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_open_channel success \n");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s:Unknown soc type.",__func__);
|
||||
return false;
|
||||
}
|
||||
if (pipe(ant_pipefd) == -1)
|
||||
{
|
||||
printf("pipe create error");
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
/* Creating read thread which listens for various masks & pkt requests */
|
||||
pthread_create( &ant_cmd_thread_hdl, NULL, ftm_ant_readerthread, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
int init_transport_ant(int on) {
|
||||
|
||||
void *so_handle;
|
||||
unsigned char bdaddr[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
|
||||
int fd[CH_MAX], powerstate, ret = -1;
|
||||
char ref_count[PROPERTY_VALUE_MAX];
|
||||
int value;
|
||||
|
||||
if (on) {
|
||||
so_handle = dlopen("libbt-vendor.so", RTLD_NOW);
|
||||
if (!so_handle)
|
||||
{
|
||||
ALOGE("Failed to load vendor component");
|
||||
return -1;
|
||||
}
|
||||
|
||||
vendor_interface = (bt_vendor_interface_t *) dlsym(so_handle, "BLUETOOTH_VENDOR_LIB_INTERFACE");
|
||||
if (!vendor_interface)
|
||||
{
|
||||
ALOGE("Failed to accesst bt vendor interface");
|
||||
return -1;
|
||||
}
|
||||
|
||||
vendor_interface->init(&vendor_callbacks, bdaddr);
|
||||
|
||||
ALOGI("Turn On BT power");
|
||||
powerstate = BT_VND_PWR_ON;
|
||||
ret = vendor_interface->op(BT_VND_OP_POWER_CTRL, &powerstate);
|
||||
if (ret < 0)
|
||||
{
|
||||
ALOGE("Failed to turn on power from bt vendor interface");
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < CH_MAX; i++)
|
||||
fd[i] = -1;
|
||||
|
||||
#ifdef ANDROID
|
||||
if (soc_type == BT_SOC_ROME || soc_type == BT_SOC_CHEROKEE || soc_type == BT_SOC_NAPIER) {
|
||||
/*call ANT_USERIAL_OPEN to get ANT handle*/
|
||||
ret = vendor_interface->op((bt_vendor_opcode_t)BT_VND_OP_ANT_USERIAL_OPEN, fd);
|
||||
}
|
||||
#else
|
||||
#ifdef BT_SOC_TYPE_ROME
|
||||
/*call ANT_USERIAL_OPEN to get ANT handle*/
|
||||
ret = vendor_interface->op((bt_vendor_opcode_t)BT_VND_OP_ANT_USERIAL_OPEN, fd);
|
||||
#endif
|
||||
#endif
|
||||
ALOGE("ret value: %d", ret);
|
||||
if (ret != 1)
|
||||
{
|
||||
ALOGE("Failed to get fd from bt vendor interface");
|
||||
return -1;
|
||||
} else {
|
||||
ALOGE("FD: %x", fd[0]);
|
||||
return fd[0];
|
||||
}
|
||||
} else {
|
||||
if (vendor_interface) {
|
||||
ALOGE("Close and cleanup the interfaces");
|
||||
|
||||
#ifdef ANDROID
|
||||
if (soc_type == BT_SOC_ROME || soc_type == BT_SOC_CHEROKEE || soc_type == BT_SOC_NAPIER) {
|
||||
int ret = vendor_interface->op((bt_vendor_opcode_t)BT_VND_OP_ANT_USERIAL_CLOSE, NULL);
|
||||
}
|
||||
#else
|
||||
#ifdef BT_SOC_TYPE_ROME
|
||||
int ret = vendor_interface->op((bt_vendor_opcode_t)BT_VND_OP_ANT_USERIAL_CLOSE, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ALOGE("ret value: %d", ret);
|
||||
ALOGI("Turn off BT power");
|
||||
powerstate = BT_VND_PWR_OFF;
|
||||
ret = vendor_interface->op(BT_VND_OP_POWER_CTRL, &powerstate);
|
||||
if (ret < 0)
|
||||
{
|
||||
ALOGE("Failed to turn off power from bt vendor interface");
|
||||
return -1;
|
||||
}
|
||||
vendor_interface->cleanup();
|
||||
vendor_interface = NULL;
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
ALOGE("Not able to find vendor interface handle");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_log_send_msg
|
||||
|
||||
DESCRIPTION
|
||||
Processes the buffer sent and sends it to the libdiag for sending the Cmd
|
||||
response
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
NIL
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
void ftm_ant_log_send_msg(const uint8 *pEventBuf,int event_bytes)
|
||||
{
|
||||
int result = log_status(LOG_FTM_VER_2_C);
|
||||
ftm_ant_log_pkt_type* ftm_ant_log_pkt_ptr = NULL;
|
||||
|
||||
if((pEventBuf == NULL) || (event_bytes == 0))
|
||||
return;
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_log_send_msg --> \n");
|
||||
#endif
|
||||
if(result == 1)
|
||||
{
|
||||
ftm_ant_log_pkt_ptr = (ftm_ant_log_pkt_type *)log_alloc(LOG_FTM_VER_2_C,
|
||||
FTM_ANT_LOG_HEADER_SIZE + (event_bytes-1));
|
||||
if(ftm_ant_log_pkt_ptr != NULL)
|
||||
{
|
||||
/* FTM ANT Log PacketID */
|
||||
ftm_ant_log_pkt_ptr->ftm_log_id = FTM_ANT_LOG_PKT_ID;
|
||||
memcpy((void *)ftm_ant_log_pkt_ptr->data,(void *)pEventBuf,event_bytes);
|
||||
log_commit( ftm_ant_log_pkt_ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_ant_dispatch
|
||||
|
||||
DESCRIPTION
|
||||
Dispatch routine for the various FM Rx/Tx commands. Copies the data into
|
||||
a global union data structure before calling the processing routine
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
A Packed structre pointer including the response to the FTM FM packet
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
void * ftm_ant_dispatch(ftm_ant_pkt_type *ant_ftm_pkt, uint16 pkt_len)
|
||||
{
|
||||
ftm_ant_generic_sudo_res *rsp;
|
||||
int err = 0, i;
|
||||
int data_len = ant_ftm_pkt->cmd_data_len;
|
||||
bool resp = false;
|
||||
unsigned char *pdata = NULL, *ptemp;
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_dispatch --> \n");
|
||||
#endif
|
||||
|
||||
UNUSED(pkt_len);
|
||||
|
||||
if (first_ant_command == 0) {
|
||||
first_ant_command = 1;
|
||||
ftm_ant_open_channel();
|
||||
}
|
||||
|
||||
rsp = (ftm_ant_generic_sudo_res*)diagpkt_subsys_alloc( DIAG_SUBSYS_FTM
|
||||
, FTM_ANT_CMD_CODE
|
||||
, sizeof(ftm_ant_generic_sudo_res)
|
||||
);
|
||||
if(rsp == NULL)
|
||||
{
|
||||
printf("%s Failed to allocate resource",__func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (soc_type) {
|
||||
//Rome shares the same UART transport for ANT and BT. Hence, to differenciate the
|
||||
//packets by controller, adding one extra byte for ANT data and control packets
|
||||
case BT_SOC_ROME:
|
||||
case BT_SOC_CHEROKEE:
|
||||
case BT_SOC_NAPIER:
|
||||
data_len = data_len + 1;
|
||||
pdata = (unsigned char *) malloc(data_len);
|
||||
if (pdata == NULL) {
|
||||
ALOGE("Failed to allocate the memory for ANT command packet");
|
||||
rsp->result = FTM_ANT_FAIL;
|
||||
return (void *) rsp;
|
||||
}
|
||||
//To be compatible with Legacy, SMD based PLs, send all the packets
|
||||
//with cmd opcode 0x0c
|
||||
pdata[0] = 0x0c;
|
||||
memcpy(pdata+1, ant_ftm_pkt->data, data_len-1);
|
||||
err = write(fd_transport_ant_cmd, pdata, data_len);
|
||||
ptemp = pdata;
|
||||
break;
|
||||
case BT_SOC_AR3K:
|
||||
case BT_SOC_SMD:
|
||||
/* Send the packet to controller and send a dummy response back to host*/
|
||||
err = write(fd_transport_ant_cmd, ant_ftm_pkt->data, data_len);
|
||||
ptemp = ant_ftm_pkt->data;
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s:Unknown soc type", __func__);
|
||||
break;
|
||||
}
|
||||
if (err == data_len) {
|
||||
rsp->result = FTM_ANT_SUCCESS;
|
||||
printf("ANT CMD: ");
|
||||
for (i = 1; i<data_len; i++) {
|
||||
printf("%02X ", ptemp[i]);
|
||||
}
|
||||
printf("\n");
|
||||
} else {
|
||||
rsp->result = FTM_ANT_FAIL;
|
||||
printf("FTM ANT write fail len: %d\n", err);
|
||||
}
|
||||
if (pdata)
|
||||
free(pdata);
|
||||
return (void *)rsp;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_qcomm_handle_event
|
||||
|
||||
DESCRIPTION
|
||||
Routine called by the HAL layer reader thread to process the HCI events
|
||||
The post conditions of each event is covered in a state machine pattern
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
boolean ftm_ant_qcomm_handle_event ()
|
||||
{
|
||||
boolean status = TRUE;
|
||||
int nbytes,i,len =0;
|
||||
int event_type;
|
||||
ftm_ant_generic_res *res = (ftm_ant_generic_res *)diagpkt_subsys_alloc(
|
||||
DIAG_SUBSYS_FTM
|
||||
, FTM_ANT_CMD_CODE
|
||||
, sizeof(ftm_ant_generic_res)
|
||||
);
|
||||
if(res == NULL)
|
||||
{
|
||||
printf("%s Failed to allocate res",__func__);
|
||||
tcflush(fd_transport_ant_cmd, TCIFLUSH);
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef FTM_DEBUG
|
||||
printf("ftm_ant_hci_qcomm_handle_event --> \n");
|
||||
#endif
|
||||
|
||||
/* Read length and event type of Ant Resp event*/
|
||||
nbytes = read(fd_transport_ant_cmd, (void *)res->evt, 2);
|
||||
if(nbytes <= 0) {
|
||||
status = FALSE;
|
||||
printf("ftm_ant_qcomm_handle_event read fail len=%d\n", nbytes);
|
||||
return status;
|
||||
}
|
||||
event_type = res->evt[0];
|
||||
len = res->evt[1];
|
||||
#ifdef FTM_DEBUG
|
||||
printf(" event type =%d\n",event_type);
|
||||
printf("length of event =%d\n",len);
|
||||
#endif
|
||||
/* Read out the Ant Resp event*/
|
||||
if (len <= (int)sizeof(res->evt))
|
||||
{
|
||||
nbytes = read(fd_transport_ant_cmd, (void *)res->evt, len);
|
||||
if (nbytes != len) {
|
||||
res->result = FTM_ANT_FAIL;
|
||||
status = FALSE;
|
||||
printf("ftm_ant_qcomm_handle_event read fail len=%d\n", nbytes);
|
||||
}
|
||||
else {
|
||||
res->result = FTM_ANT_SUCCESS;
|
||||
printf("ANT EVT: ");
|
||||
for (i=0; i<nbytes; i++) {
|
||||
printf("%02X ", res->evt[i]);
|
||||
}
|
||||
printf("\n");
|
||||
ftm_ant_log_send_msg(res->evt, nbytes);
|
||||
tcflush(fd_transport_ant_cmd, TCIOFLUSH);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res->result = FTM_ANT_FAIL;
|
||||
status = FALSE;
|
||||
printf("ftm_ant_qcomm_handle_event read fail len=%d is more than sizeof(res->evt)=%d\n", len, (int)sizeof(res->evt));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM FM Common Header File
|
||||
|
||||
Description
|
||||
Global Data declarations of the ftm ant component.
|
||||
|
||||
# Copyright (c) 2012,2014 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
05/16/2012 ankurn Adding support for ANT+
|
||||
11/28/12 c_ssugas Adds data structures and macro for ant log event support.
|
||||
===========================================================================*/
|
||||
|
||||
#ifdef CONFIG_FTM_ANT
|
||||
|
||||
#include "diagpkt.h"
|
||||
#include "log.h"
|
||||
#include "ftm_bt_common.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define APPS_RIVA_ANT_CMD_CH "/dev/smd5"
|
||||
#define APPS_RIVA_ANT_DATA_CH "/dev/smd6"
|
||||
|
||||
#define FTM_ANT_CMD_CODE 94
|
||||
#define OPCODE_OFFSET 5
|
||||
|
||||
#define FTM_ANT_LOG_HEADER_SIZE (sizeof(ftm_ant_log_pkt_type) - 1)
|
||||
#define FTM_ANT_LOG_PKT_ID 0x0D
|
||||
|
||||
/* FTM Log Packet - Used to send back the event of a ANT Command */
|
||||
typedef PACKED struct
|
||||
{
|
||||
log_hdr_type hdr;
|
||||
word ftm_log_id; /* FTM log id */
|
||||
byte data[1]; /* Variable length payload,
|
||||
look at FTM log id for contents */
|
||||
} ftm_ant_log_pkt_type;
|
||||
|
||||
/* Generic result, used for any command that only returns an error code */
|
||||
typedef enum {
|
||||
FTM_ANT_FAIL,
|
||||
FTM_ANT_SUCCESS,
|
||||
} ftm_ant_api_result_type;
|
||||
|
||||
typedef PACKED struct
|
||||
{
|
||||
diagpkt_subsys_header_type header ;
|
||||
char result ;
|
||||
} ftm_ant_generic_sudo_res;
|
||||
|
||||
|
||||
/* Generic Response */
|
||||
typedef PACKED struct
|
||||
{
|
||||
diagpkt_subsys_header_type header; /*Diag header*/
|
||||
uint8 evt[18]; /*allocates memory to hold longest valid event */
|
||||
char result; /* result */
|
||||
}__attribute__((packed)) ftm_ant_generic_res;
|
||||
|
||||
/* FTM ANT request type */
|
||||
typedef PACKED struct
|
||||
{
|
||||
diagpkt_cmd_code_type cmd_code;
|
||||
diagpkt_subsys_id_type subsys_id;
|
||||
diagpkt_subsys_cmd_code_type subsys_cmd_code;
|
||||
uint8 cmd_id; /* command id (required) */
|
||||
uint8 cmd_data_len;
|
||||
byte data[1];
|
||||
}__attribute__((packed))ftm_ant_pkt_type;
|
||||
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_ant_dispatch
|
||||
|
||||
DESCRIPTION
|
||||
Dispatch routine for the various ANT commands. Copies the data into
|
||||
a global union data structure before calling the processing routine
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
A Packed structre pointer including the response to the FTM ANT packet
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
void * ftm_ant_dispatch(ftm_ant_pkt_type *ftm_ant_pkt, uint16 length );
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_ant_qcomm_handle_event
|
||||
|
||||
DESCRIPTION
|
||||
Handler for the various ANT Events received. Sends data as log packets
|
||||
using diag to upper layers.
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
Status value TRUE if event received successfuly
|
||||
otherwise returns status value FALSE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
boolean ftm_ant_qcomm_handle_event ();
|
||||
|
||||
#endif /* CONFIG_FTM_ANT */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,289 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT Task Header File
|
||||
|
||||
Description
|
||||
Global Data declarations of the ftm bt component.
|
||||
|
||||
# Copyright (c) 2010-2011, 2013-2014 by Qualcomm Technologies, Inc.
|
||||
# All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
09/28/11 rrr Moved peristent NV item related APIs to CPP,
|
||||
for having BD address being programmed twice if previous
|
||||
BD address was random generated.
|
||||
09/03/11 agaja Added support for NV_READ and NV_WRITE Commands to write
|
||||
onto Persist File system
|
||||
02/08/11 braghave Changes to read the HCI commands from a binary file for
|
||||
non-Android case
|
||||
06/18/10 rakeshk Created a header file to hold the definitons for ftm bt
|
||||
task
|
||||
===========================================================================*/
|
||||
|
||||
#ifdef CONFIG_FTM_BT
|
||||
|
||||
#include "diagpkt.h"
|
||||
#include <sys/types.h>
|
||||
#ifdef USE_LIBSOCCFG
|
||||
#include "btqsocnvm.h"
|
||||
#include "btqsocnvmutils.h"
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
** Definitions and Declarations
|
||||
** ------------------------------------------------------------------------- */
|
||||
|
||||
#define FTM_BT_CMD_CODE 4 /* BT FTM Command code */
|
||||
#define FTM_FM_CMD_CODE 28 /* FM FTM Command code */
|
||||
#define HCI_EVT_HDR_SIZE 3
|
||||
#define HCI_ACL_HDR_SIZE 5
|
||||
#define PROTOCOL_BYTE_SIZE 1
|
||||
#define HC_VS_MAX_CMD_EVENT 260
|
||||
#define HC_VS_MAX_ACL 1200
|
||||
#define FTM_BT_HCI_USER_CMD 0
|
||||
#define BT_FTM_CMD_RSP_LEN 1100
|
||||
#define FTM_BT_DRV_START_TEST 0xA
|
||||
|
||||
/* MACROS for pin connectivty test*/
|
||||
#define BT_CMD_SLIM_TEST 0xBFAC
|
||||
#define LOOP_BACK_EVT_OGF 0x02
|
||||
#define LOOP_BACK_EVT_OCF 0x18
|
||||
#define LOOP_BACK_EVT_STATUS 0x00
|
||||
#define LOOP_BACK_EVT_OGF_BIT 0x04
|
||||
#define LOOP_BACK_EVT_OCF_BIT 0x05
|
||||
#define LOOP_BACK_EVT_STATUS_BIT 0x06
|
||||
|
||||
|
||||
#define FTM_BT_LOG_HEADER_SIZE (sizeof(ftm_bt_log_pkt_type) - 1)
|
||||
|
||||
|
||||
/* Vendor Specific command codes */
|
||||
#define BT_QSOC_EDL_CMD_OPCODE (0xFC00)
|
||||
#define BT_QSOC_NVM_ACCESS_OPCODE (0xFC0B)
|
||||
|
||||
#define BT_QSOC_EDL_CMD_CODE (0x00)
|
||||
#define BT_QSOC_NVM_ACCESS_CODE (0x0B)
|
||||
#define BT_QSOC_VS_EDL_APPVER_RESP (0x02)
|
||||
|
||||
#ifndef HC_VS_MAX_CMD_EVENT
|
||||
#define HC_VS_MAX_CMD_EVENT 260
|
||||
#endif /* HC_VS_MAX_CMD_EVENT */
|
||||
|
||||
#define BT_QSOC_MAX_NVM_CMD_SIZE 0x64 /* Maximum size config (NVM) cmd */
|
||||
#define BT_QSOC_MAX_BD_ADDRESS_SIZE 0x06 /**< Length of BT Address */
|
||||
|
||||
#ifndef HCI_CMD_HDR_SIZE
|
||||
#define HCI_CMD_HDR_SIZE 4
|
||||
#endif /* HCI_CMD_HDR_SIZE */
|
||||
|
||||
#ifndef HCI_EVT_HDR_SIZE
|
||||
#define HCI_EVT_HDR_SIZE 3
|
||||
#endif /* HCI_EVT_HDR_SIZE */
|
||||
|
||||
#define FTM_BT_LOG_PKT_ID 0x01
|
||||
|
||||
|
||||
#define BT_HCI_CMD_PKT 0x01
|
||||
#define BT_HCI_ACL_PKT 0x02
|
||||
#define BT_HCI_EVT_PKT 0x04
|
||||
|
||||
#define BT_HCI_CMD_CMPLT_EVT 0x0E
|
||||
#define FM_HCI_EVT_PKT 0x14
|
||||
#define FM_HCI_CMD_PKT 0x11
|
||||
|
||||
extern int boardtype;
|
||||
|
||||
/* VS command structure */
|
||||
typedef struct
|
||||
{
|
||||
uint8 vs_cmd_len;
|
||||
uint8 vs_cmd_data[BT_QSOC_MAX_NVM_CMD_SIZE];
|
||||
} bt_qsoc_cfg_tbl_struct_type;
|
||||
|
||||
/* First Commamd structure - Used to store the First command for later
|
||||
* processing
|
||||
*/
|
||||
struct first_cmd
|
||||
{
|
||||
uint8 *cmd_buf;
|
||||
int cmd_len;
|
||||
};
|
||||
|
||||
/* FTM Global State - Enum defines the various states of the FTM
|
||||
* module
|
||||
*/
|
||||
typedef enum ftm_state
|
||||
{
|
||||
FTM_SOC_NOT_INITIALISED,
|
||||
FTM_SOC_READ_APP_VER,
|
||||
FTM_SOC_READ_HW_VER,
|
||||
FTM_SOC_POKE8_TBL_INIT,
|
||||
FTM_SOC_DOWNLOAD_NVM,
|
||||
FTM_SOC_DOWNLOAD_NVM_EFS,
|
||||
FTM_SOC_SLEEP_DISABLE,
|
||||
FTM_SOC_RESET,
|
||||
FTM_SOC_INITIALISED
|
||||
}ftm_state;
|
||||
/* FTM CMD status */
|
||||
typedef enum ftm_log_packet_type
|
||||
{
|
||||
FTM_USER_CMD_PASS,
|
||||
FTM_USER_CMD_FAIL,
|
||||
FTM_HCI_EVENT
|
||||
}ftm_log_packet_type;
|
||||
|
||||
/* FTM Log Packet - Used to send back the event of a HCI Command */
|
||||
typedef PACKED struct
|
||||
{
|
||||
log_hdr_type hdr;
|
||||
byte data[1]; /* Variable length payload,
|
||||
look at FTM log id for contents */
|
||||
} ftm_bt_log_pkt_type;
|
||||
|
||||
|
||||
/* FTM (BT) PKT Header */
|
||||
typedef PACKED struct
|
||||
{
|
||||
word cmd_id; /* command id (required) */
|
||||
word cmd_data_len; /* request pkt data length, excluding the diag and ftm headers
|
||||
(optional, set to 0 if not used)*/
|
||||
word cmd_rsp_pkt_size; /* rsp pkt size, size of response pkt if different then req pkt
|
||||
(optional, set to 0 if not used)*/
|
||||
} ftm_bt_cmd_header_type;
|
||||
|
||||
/* Bluetooth FTM packet */
|
||||
typedef PACKED struct
|
||||
{
|
||||
diagpkt_subsys_header_type diag_hdr;
|
||||
ftm_bt_cmd_header_type ftm_hdr;
|
||||
byte data[1];
|
||||
} ftm_bt_pkt_type;
|
||||
|
||||
/* SoC Cfg open Struct*/
|
||||
#ifdef USE_LIBSOCCFG
|
||||
typedef struct
|
||||
{
|
||||
bt_qsoc_config_params_struct_type run_time_params;
|
||||
bt_qsoc_enum_nvm_mode nvm_mode;
|
||||
bt_qsoc_enum_type soc_type;
|
||||
}ftm_bt_soc_runtime_cfg_type;
|
||||
#endif
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_err_timedout
|
||||
|
||||
DESCRIPTION
|
||||
This routine triggers the shutdown of the HCI and Power resources in case
|
||||
a HCI command previously sent times out.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN NIL
|
||||
|
||||
SIDE EFFECTS
|
||||
NONE
|
||||
|
||||
===========================================================================*/
|
||||
void ftm_bt_err_timedout();
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_dispatch
|
||||
|
||||
DESCRIPTION
|
||||
Processes the BT FTM packet and dispatches the command to FTM HCI driver
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
NIL,The error in the Command Processing is sent to the DIAG App on PC via
|
||||
log packets
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
void ftm_bt_dispatch(void *ftm_bt_pkt ,int cmd_len );
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION bt_hci_send_ftm_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the HCI cmd and invokes the sub routines to intialise
|
||||
the SoC if needed based on the state of the FTM module
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
boolean ftm_bt_hci_send_cmd
|
||||
(
|
||||
uint8 * cmd_buf, /* pointer to Cmd */
|
||||
uint16 cmd_len /* Cmd length */
|
||||
);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION bt_hci_hal_vs_sendcmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the VS HCI cmd and constucts the HCI packet before
|
||||
calling bt_hci_send_ftm_cmd routine
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_hal_vs_sendcmd
|
||||
(
|
||||
uint16 opcode, /* Opcode */
|
||||
uint8 *pCmdBuffer, /* Pointer to Payload*/
|
||||
uint8 nSize /* Cmd Size */
|
||||
);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION isLatestTarget
|
||||
|
||||
DESCRIPTION
|
||||
For all the target/solution which has Bluedroid as stack and libbt-vendor as
|
||||
vendor initialization component considered as latest target
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean isLatestTarget();
|
||||
char *get_current_time(void);
|
||||
#endif /* CONFIG_FTM_BT */
|
||||
@@ -1,115 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT Commom Header File
|
||||
|
||||
Description
|
||||
The header file includes helper enums for request_status and bt_power_state.
|
||||
|
||||
# Copyright (c) 2010-2011, 2014 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
09/28/11 rrr Common utility API abstracted,
|
||||
06/18/10 rakeshk Created a header file to hold the helper enums for
|
||||
request_status and bt_power_state
|
||||
========================================================================*/
|
||||
|
||||
#ifdef CONFIG_FTM_BT
|
||||
|
||||
#include "event.h"
|
||||
#include "msg.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "diag_lsm.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __FTM_BT_COMMON_H__
|
||||
|
||||
#define __FTM_BT_COMMON_H__
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/* request_status - enum to encapuslate the status of a HAL request*/
|
||||
typedef enum request_status
|
||||
{
|
||||
STATUS_SUCCESS,
|
||||
STATUS_FAIL,
|
||||
STATUS_NO_RESOURCES,
|
||||
STATUS_SHORT_WRITE,
|
||||
STATUS_SHORT_READ
|
||||
}request_status;
|
||||
|
||||
/* request_status - enum to encapuslate the possible statea of BT power*/
|
||||
typedef enum bt_power_state
|
||||
{
|
||||
BT_OFF = 0x30, /* Its the value 0 to be input to rfkill driver */
|
||||
BT_ON = 0x31 /* ASCII value for '1'*/
|
||||
}bt_power_state;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FTM_BT_DRV_NO_ERR = 0,
|
||||
FTM_BT_DRV_CONN_TEST_FAILS,
|
||||
FTM_BT_DRV_QSOC_POWERUP_FAILS,
|
||||
FTM_BT_DRV_RX_PKT_TYPE_NOT_SUPPORTED,
|
||||
FTM_BT_DRV_SIO_OPEN_FAILS,
|
||||
FTM_BT_DRV_NO_SOC_RSP_TOUT,
|
||||
FTM_BT_DRV_BAD_NVM,
|
||||
#ifdef BT_NV_SUPPORT
|
||||
FTM_BT_NV_READ_FAIL,
|
||||
FTM_BT_NV_WRITE_FAIL,
|
||||
#endif
|
||||
FTM_BT_DRV_UNKNOWN_ERR
|
||||
} ftm_bt_drv_err_state_type;
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_qcomm_handle_event
|
||||
|
||||
DESCRIPTION
|
||||
Routine called by the HAL layer reader thread to process the HCI events
|
||||
The post conditions of each event is covered in a state machine pattern
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_qcomm_handle_event();
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_log_send_msg
|
||||
|
||||
DESCRIPTION
|
||||
Processes the buffer sent and sends it to the libdiag for sending the Cmd
|
||||
response
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
NIL
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
void ftm_log_send_msg(const uint8 *pEventBuf,int event_bytes);
|
||||
#endif //__FTM_BT_COMMON_H__
|
||||
#endif /* CONFIG_FTM_BT */
|
||||
@@ -1,161 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT HCI PFAL Header File
|
||||
|
||||
Description
|
||||
Warpper API definitions of the ftm bt hci hal component.
|
||||
|
||||
# Copyright (c) 2010 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created a header file to hold the wrapper HAL
|
||||
definitions for HCI UART control
|
||||
===========================================================================*/
|
||||
|
||||
#include "ftm_bt_common.h"
|
||||
#include "ftm_bt_hci_pfal.h"
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_set_transport
|
||||
|
||||
DESCRIPTION
|
||||
sets the type of transport based on the msm type
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
returns the type of transport
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_hal_set_transport()
|
||||
{
|
||||
return ftm_bt_hci_pfal_set_transport();
|
||||
}
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_deinit_transport
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which intiatea a De-intialise of UART/SMD
|
||||
resources with PFAL layer and returns the status of the PFAL operation
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_hal_deinit_transport()
|
||||
{
|
||||
return ftm_bt_hci_pfal_deinit_transport();
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_init_transport
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which intiatea a intialise of UART/SMD
|
||||
resources with PFAL layer and returns the status of the PFAL operation
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_hal_init_transport (int mode)
|
||||
{
|
||||
return ftm_bt_hci_pfal_init_transport(mode);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_nwrite
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which intiates a write operation
|
||||
with the PFAL layer and returns the status of the PFAL operation.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_hal_nwrite(uint8 *buf, int size)
|
||||
{
|
||||
return ftm_bt_hci_pfal_nwrite(buf,size);
|
||||
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_nread
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which intiates a read operation
|
||||
with the PFAL layer and returns the status of the PFAL operation.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_hal_nread(uint8 *buf, int size)
|
||||
{
|
||||
return ftm_bt_hci_pfal_nread(buf,size);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_hal_changebaudrate
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which intiatea a UART baud rate change
|
||||
with the PFAL layer and returns the status of the PFAL request.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
TRUE if SUCCESS, else FAIL
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_hal_changebaudrate (uint32 new_baud)
|
||||
{
|
||||
return ftm_bt_hci_pfal_changebaudrate(new_baud);
|
||||
}
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT HCI PFAL Header File
|
||||
|
||||
Description
|
||||
PFAL API declarations of the ftm bt hci pfal component.
|
||||
|
||||
# Copyright (c) 2010 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created a header file to hold the PFAL declarations for
|
||||
HCI UART programming
|
||||
===========================================================================*/
|
||||
#include "ftm_bt_common.h"
|
||||
|
||||
#ifndef __FTM_BT_HCI_PFAL_H__
|
||||
#define __FTM_BT_HCI_PFAL_H__
|
||||
|
||||
#define PIN_CON_CMD_OGF 0xFC
|
||||
#define PIN_CON_CMD_OCF 0x0C
|
||||
#define PIN_CON_CMD_SUB_OP 0x38
|
||||
#define PIN_CON_INTERFACE_ID 0x01
|
||||
#define PIN_CON_EVENT_LEN 0x06
|
||||
#define EXT_PIN_CON_LEN 0x02
|
||||
|
||||
#define PIN_CON_CMD_OCF_BIT 0x01
|
||||
#define PIN_CON_CMD_OGF_BIT 0x02
|
||||
#define PIN_CON_CMD_SUBOP_BIT 0x04
|
||||
#define PIN_CON_CMD_INTER_BIT 0x05
|
||||
|
||||
#define PIN_CON_EVT_OGF_BIT 0x05
|
||||
#define PIN_CON_EVT_OCF_BIT 0x04
|
||||
#define PIN_CON_EVT_SUB_OP_BIT 0x07
|
||||
#define PIN_CON_INTERFACE_ID_EVT_BIT 0x08
|
||||
#define PIN_CON_EVENT_LEN_BIT 0x02
|
||||
#define PIN_CON_EVT_STATUS_BIT 0x06
|
||||
|
||||
#define LOG_TAG "ftmdaemon"
|
||||
|
||||
#define PRI_INFO " I"
|
||||
#define PRI_WARN " W"
|
||||
#define PRI_ERROR " E"
|
||||
#define PRI_DEBUG " D"
|
||||
#define PRI_VERB " V"
|
||||
|
||||
#define ALOG(pri, tag, fmt, arg...) fprintf(stderr, tag pri ": " fmt"\n", ##arg)
|
||||
#define ALOGV(fmt, arg...) ALOG(PRI_VERB, LOG_TAG, fmt, ##arg)
|
||||
#define ALOGD(fmt, arg...) ALOG(PRI_DEBUG, LOG_TAG, fmt, ##arg)
|
||||
#define ALOGI(fmt, arg...) ALOG(PRI_INFO, LOG_TAG, fmt, ##arg)
|
||||
#define ALOGW(fmt, arg...) ALOG(PRI_WARN, LOG_TAG, fmt, ##arg)
|
||||
#define ALOGE(fmt, arg...) ALOG(PRI_ERROR, LOG_TAG, fmt, ##arg)
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_set_transport
|
||||
|
||||
DESCRIPTION
|
||||
sets the type of transport based on the msm type
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
returns the type of transport
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_pfal_set_transport(void);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_deinit_transport
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to de-intialise the UART/SMD resource.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_deinit_transport();
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_init_transport
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to intialise the UART/SMD resources.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_init_transport ();
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_nwrite
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to write the data in the argument to the UART/SMD
|
||||
port intialised.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_nwrite(uint8 *buf, int size);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_nread
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to read data from the UART/SMD port intialised into
|
||||
the buffer passed in argument.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_nread(uint8 *buf, int size);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_changebaudrate
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to intiate a change in baud rate
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
TRUE if SUCCESS, else FALSE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_pfal_changebaudrate (uint32 new_baud);
|
||||
|
||||
#endif //__FTM_BT_HCI_PFAL_H__
|
||||
@@ -1,674 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM Platform specfic HCI UART/SMD File
|
||||
|
||||
Description
|
||||
Platform specific routines to program the UART/SMD descriptors
|
||||
|
||||
# Copyright (c) 2010-2011, 2013 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/07/11 bneti Add support smd support for msm8960
|
||||
06/18/10 rakeshk Created a source file to implement platform specific
|
||||
routines for UART
|
||||
07/07/10 rakeshk Removed the conversion of 3.2 Mbps baud rate
|
||||
01/07/10 rakeshk Added support for verbose logging of Cmd and events
|
||||
===========================================================================*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/select.h>
|
||||
#include <termios.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
#include "bt_vendor_lib.h"
|
||||
#include "ftm_bt_hci_pfal.h"
|
||||
#include "ftm_common.h"
|
||||
#include <string.h>
|
||||
#include "log.h"
|
||||
#include <cutils/properties.h>
|
||||
#include "hidl_client.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#define VENDOR_LIB "libbt-vendor.so"
|
||||
#else
|
||||
#define VENDOR_LIB "libbt-vendor.so.0"
|
||||
#endif
|
||||
|
||||
uint8_t is_slim_bus_test = 0;
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
/*identify the transport type*/
|
||||
static char *transport_dev;
|
||||
|
||||
typedef enum {
|
||||
BT_SOC_DEFAULT = 0,
|
||||
BT_SOC_SMD = BT_SOC_DEFAULT,
|
||||
BT_SOC_AR3K,
|
||||
BT_SOC_ROME,
|
||||
BT_SOC_CHEROKEE,
|
||||
BT_SOC_NAPIER,
|
||||
/* Add chipset type here */
|
||||
BT_SOC_RESERVED
|
||||
} bt_soc_type;
|
||||
|
||||
static void vendor_fwcfg_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_scocfg_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_lpm_vnd_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_audio_state_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void* vendor_alloc(int size) {
|
||||
UNUSED(size);
|
||||
return NULL;
|
||||
}
|
||||
static void vendor_dealloc(void *p_buf) {
|
||||
UNUSED(p_buf);
|
||||
}
|
||||
static uint8_t vendor_xmit_cb(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback) {
|
||||
UNUSED(opcode);
|
||||
UNUSED(p_buf);
|
||||
UNUSED(p_cback);
|
||||
return 0;
|
||||
}
|
||||
static void vendor_epilog_cb(bt_vendor_op_result_t result) {
|
||||
UNUSED(result);
|
||||
}
|
||||
static void vendor_a2dp_offload_cb(bt_vendor_op_result_t result, bt_vendor_opcode_t op, unsigned char handle) {
|
||||
UNUSED(result);
|
||||
UNUSED(op);
|
||||
UNUSED(handle);
|
||||
}
|
||||
|
||||
|
||||
bt_vendor_interface_t *vendor_interface=NULL;
|
||||
static const bt_vendor_callbacks_t vendor_callbacks = {
|
||||
sizeof(bt_vendor_callbacks_t),
|
||||
vendor_fwcfg_cb,
|
||||
vendor_scocfg_cb,
|
||||
vendor_lpm_vnd_cb,
|
||||
vendor_audio_state_cb,
|
||||
vendor_alloc,
|
||||
vendor_dealloc,
|
||||
vendor_xmit_cb,
|
||||
vendor_epilog_cb,
|
||||
vendor_a2dp_offload_cb
|
||||
};
|
||||
|
||||
|
||||
/*BT HS UART TTY DEVICE */
|
||||
#define BT_HS_UART_DEVICE "/dev/ttyHS0"
|
||||
|
||||
/*BT RIVA-SMD CHANNELS */
|
||||
#define APPS_RIVA_BT_ACL_CH "/dev/smd2"
|
||||
#define APPS_RIVA_BT_CMD_CH "/dev/smd3"
|
||||
|
||||
/* Variables to identify the platform */
|
||||
char transport_type[PROPERTY_VALUE_MAX];
|
||||
static boolean is_transportSMD;
|
||||
|
||||
extern int soc_type;
|
||||
|
||||
/* Reader thread handle */
|
||||
pthread_t hci_cmd_thread_hdl;
|
||||
/* Pipe file descriptors for cancelling read operation */
|
||||
int pipefd[2];
|
||||
/* Transport file descriptor */
|
||||
int fd_transport;
|
||||
/* Starting baud rate to init the tty device */
|
||||
int starting_baud = 115200;
|
||||
/* Verbose output monitoring variable */
|
||||
int verbose = 1;
|
||||
/* Defintion to convert integer baud rate to the
|
||||
* Data type understood by tty device
|
||||
*/
|
||||
#define BAUDCLAUS(i) case (i): return ( B##i )
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION convert_baud
|
||||
|
||||
DESCRIPTION
|
||||
Routine to convert the integer baud rate to type speed_t
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
Converted Baud rate, else default 0
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
static speed_t convert_baud(uint32 baud_rate)
|
||||
{
|
||||
switch (baud_rate)
|
||||
{
|
||||
BAUDCLAUS(50);
|
||||
BAUDCLAUS(75);
|
||||
BAUDCLAUS(110);
|
||||
BAUDCLAUS(134);
|
||||
BAUDCLAUS(150);
|
||||
BAUDCLAUS(200);
|
||||
BAUDCLAUS(300);
|
||||
BAUDCLAUS(600);
|
||||
BAUDCLAUS(1200);
|
||||
BAUDCLAUS(1800);
|
||||
BAUDCLAUS(2400);
|
||||
BAUDCLAUS(4800);
|
||||
BAUDCLAUS(9600);
|
||||
BAUDCLAUS(19200);
|
||||
BAUDCLAUS(38400);
|
||||
BAUDCLAUS(57600);
|
||||
BAUDCLAUS(115200);
|
||||
BAUDCLAUS(230400);
|
||||
BAUDCLAUS(460800);
|
||||
BAUDCLAUS(500000);
|
||||
BAUDCLAUS(576000);
|
||||
BAUDCLAUS(921600);
|
||||
BAUDCLAUS(1000000);
|
||||
BAUDCLAUS(1152000);
|
||||
BAUDCLAUS(1500000);
|
||||
BAUDCLAUS(2000000);
|
||||
BAUDCLAUS(2500000);
|
||||
BAUDCLAUS(3000000);
|
||||
BAUDCLAUS(3500000);
|
||||
BAUDCLAUS(4000000);
|
||||
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_readerthread
|
||||
|
||||
DESCRIPTION
|
||||
Thread Routine to perfom asynchrounous handling of events coming on Uart/Smd
|
||||
descriptor. It invokes a callback to the FTM BT layer to intiate a request
|
||||
to read event bytes.
|
||||
|
||||
DEPENDENCIES
|
||||
The LifeTime of ReaderThraad is dependent on the status returned by the
|
||||
call to ftm_bt_hci_qcomm_handle_event
|
||||
|
||||
RETURN VALUE
|
||||
RETURN NIL
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
void *ftm_readerthread(void *ptr)
|
||||
{
|
||||
UNUSED(ptr);
|
||||
boolean status = FALSE;
|
||||
int retval;
|
||||
fd_set readfds;
|
||||
int buf;
|
||||
|
||||
do
|
||||
{
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(fd_transport, &readfds);
|
||||
FD_SET(pipefd[0],&readfds);
|
||||
retval = select((pipefd[0] > fd_transport? pipefd[0] : fd_transport) + 1,
|
||||
&readfds, NULL, NULL, NULL);
|
||||
if(retval == -1)
|
||||
{
|
||||
printf("select failed\n");
|
||||
break;
|
||||
}
|
||||
if(FD_ISSET(pipefd[0],&readfds))
|
||||
{
|
||||
#ifdef FTM_DEBUG
|
||||
printf("Pipe descriptor set\n");
|
||||
#endif
|
||||
read(pipefd[0],&buf,1);
|
||||
if(buf == 1)
|
||||
break;
|
||||
}
|
||||
if(FD_ISSET(fd_transport,&readfds))
|
||||
{
|
||||
#ifdef FTM_DEBUG
|
||||
printf("Read descriptor set\n");
|
||||
#endif
|
||||
status = ftm_bt_hci_qcomm_handle_event();
|
||||
if(TRUE != status)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(1);
|
||||
#ifdef FTM_DEBUG
|
||||
printf("\nReader thread exited\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_pfal_set_transport
|
||||
|
||||
DESCRIPTION
|
||||
sets the type of transport based on the msm type
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
returns the type of transport
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_pfal_set_transport(void)
|
||||
{
|
||||
if (soc_type == BT_SOC_ROME || soc_type == BT_SOC_CHEROKEE || soc_type == BT_SOC_NAPIER) {
|
||||
strlcpy(transport_type, "uart", sizeof(transport_type));
|
||||
printf("[%s]: Transport type is: %s\n", __FUNCTION__, transport_type);
|
||||
is_transportSMD = 0;
|
||||
transport_dev = BT_HS_UART_DEVICE;
|
||||
} else {
|
||||
strlcpy(transport_type, "smd", sizeof(transport_type));
|
||||
printf("[%s]: Transport type is: %s\n", __FUNCTION__, transport_type);
|
||||
is_transportSMD = 1;
|
||||
transport_dev = APPS_RIVA_BT_CMD_CH;
|
||||
}
|
||||
return is_transportSMD;
|
||||
}
|
||||
|
||||
|
||||
int init_transport_bdroid(boolean on) {
|
||||
|
||||
void *so_handle;
|
||||
unsigned char bdaddr[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
|
||||
request_status st;
|
||||
int fd[CH_MAX], powerstate, ret;
|
||||
|
||||
if (on) {
|
||||
so_handle = dlopen(VENDOR_LIB, RTLD_NOW);
|
||||
if (!so_handle)
|
||||
{
|
||||
ALOGE("Failed to load vendor component %s", dlerror());
|
||||
return -1;
|
||||
}
|
||||
|
||||
vendor_interface = (bt_vendor_interface_t *) dlsym(so_handle, "BLUETOOTH_VENDOR_LIB_INTERFACE");
|
||||
if (!vendor_interface)
|
||||
{
|
||||
ALOGE("Failed to accesst bt vendor interface");
|
||||
return -1;
|
||||
}
|
||||
|
||||
vendor_interface->init(&vendor_callbacks, bdaddr);
|
||||
|
||||
ALOGI("Turn On BT power");
|
||||
powerstate = BT_VND_PWR_ON;
|
||||
ret = vendor_interface->op(BT_VND_OP_POWER_CTRL, &powerstate);
|
||||
if (ret < 0)
|
||||
{
|
||||
ALOGE("Failed to turn on power from bt vendor interface");
|
||||
return -1;
|
||||
}
|
||||
ret = vendor_interface->op(BT_VND_OP_USERIAL_OPEN, fd);
|
||||
ALOGE("ret value: %d", ret);
|
||||
/* This is just a hack; needs to be removed */
|
||||
ret = 1;
|
||||
ALOGE("setting ret value to 1 manually");
|
||||
if (ret != 1)
|
||||
{
|
||||
ALOGE("Failed to get fd from bt vendor interface");
|
||||
return -1;
|
||||
} else {
|
||||
ALOGE("FD: %x", fd[0]);
|
||||
return fd[0];
|
||||
}
|
||||
} else {
|
||||
if (vendor_interface) {
|
||||
ALOGE("Close and cleanup the interfaces");
|
||||
int ret = vendor_interface->op(BT_VND_OP_USERIAL_CLOSE, NULL);
|
||||
|
||||
ALOGE("ret value: %d", ret);
|
||||
vendor_interface->cleanup();
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
ALOGE("Not able to find vendor interface handle");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_deinit_transport
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to de-intialise the UART/SMD resource.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Closes the TTY/SMD file descriptor and sets the descriptor value to -1
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
The Close of the descriptor will trigger a failure in the Reader Thread
|
||||
and hence cause a Deinit of the ReaderThread
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_deinit_transport()
|
||||
{
|
||||
int buf = 1;
|
||||
write(pipefd[1],&buf,1);
|
||||
if(!isLatestTarget())
|
||||
{
|
||||
close(fd_transport);
|
||||
fd_transport = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Use libbt-vendor for chip de-initialization
|
||||
init_transport_bdroid(FALSE);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_init_uart
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to intialise the UART/SMD resources.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Opens the TTY/SMD device file descriptor, congiures the TTY/SMD device for CTS/RTS
|
||||
flow control,sets 115200 for TTY as the default baudrate and starts the Reader
|
||||
Thread
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_init_transport(int mode)
|
||||
{
|
||||
struct termios term;
|
||||
if(isLatestTarget())
|
||||
{
|
||||
printf("%s: ",__func__ );
|
||||
//Use hidl_client_initialize for chip initialization
|
||||
if (hidl_client_initialize(mode, &fd_transport) == false) {
|
||||
printf("%s: HIDL client initialization failed \n", __func__);
|
||||
return STATUS_NO_RESOURCES;
|
||||
}
|
||||
printf("%s: , fd:%d: ", __func__, fd_transport);
|
||||
}
|
||||
else
|
||||
{
|
||||
fd_transport = open(transport_dev, (O_RDWR | O_NOCTTY));
|
||||
|
||||
if (-1 == fd_transport)
|
||||
{
|
||||
return STATUS_NO_RESOURCES;
|
||||
}
|
||||
|
||||
if (tcflush(fd_transport, TCIOFLUSH) < 0)
|
||||
{
|
||||
close(fd_transport);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
|
||||
if (tcgetattr(fd_transport, &term) < 0)
|
||||
{
|
||||
close(fd_transport);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
|
||||
cfmakeraw(&term);
|
||||
/* Set RTS/CTS HW Flow Control*/
|
||||
term.c_cflag |= (CRTSCTS | CLOCAL);
|
||||
|
||||
if (tcsetattr(fd_transport, TCSANOW, &term) < 0)
|
||||
{
|
||||
close(fd_transport);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
|
||||
/* Configure the /dev/ttyHS0 device to operate at 115200.
|
||||
no need for msm8960 as it is using smd as transport
|
||||
*/
|
||||
if (!is_transportSMD)
|
||||
if (ftm_bt_hci_pfal_changebaudrate(starting_baud) == FALSE)
|
||||
{
|
||||
close(fd_transport);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
if (pipe(pipefd) == -1)
|
||||
{
|
||||
printf("pipe create error");
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
if(mode != MODE_FM) {
|
||||
/* Creating read thread which listens for various masks & pkt requests */
|
||||
pthread_create( &hci_cmd_thread_hdl, NULL, ftm_readerthread, NULL);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_nwrite
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to write the data in the argument to the UART/SMD
|
||||
port intialised.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Write the buffer to the tty device and ensure it is completely written
|
||||
In case of short write report error to the BT FTM layer.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_nwrite(uint8 *buf, int size)
|
||||
{
|
||||
int tx_bytes = 0, nwrite;
|
||||
int i = 0, buf_size = size;
|
||||
uint8 loop_back_cmd[6] = {0x1, 0x02, 0x18, 0x01, 0x01};
|
||||
/*hci packet is not required to carry the Packet indicator (for UART interfaces) for msm8960
|
||||
as it is using share memory interface */
|
||||
int hci_uart_pkt_ind = 0;
|
||||
|
||||
if(fd_transport < 0)
|
||||
return STATUS_NO_RESOURCES;
|
||||
if ( buf[PIN_CON_CMD_OGF_BIT] == PIN_CON_CMD_OGF &&
|
||||
buf[PIN_CON_CMD_OCF_BIT] == PIN_CON_CMD_OCF &&
|
||||
(size > PIN_CON_CMD_SUBOP_BIT) &&
|
||||
buf[PIN_CON_CMD_SUBOP_BIT] == PIN_CON_CMD_SUB_OP &&
|
||||
(size > PIN_CON_CMD_INTER_BIT) &&
|
||||
buf[PIN_CON_CMD_INTER_BIT] == PIN_CON_INTERFACE_ID)
|
||||
{
|
||||
is_slim_bus_test = 1;
|
||||
printf("\nPinConnectivityTest: Sending loopback command to SOC before initiasing slimbus\n");
|
||||
strlcpy(buf, loop_back_cmd, size);
|
||||
}
|
||||
do
|
||||
{
|
||||
nwrite = write(fd_transport, (buf + hci_uart_pkt_ind + tx_bytes), (size - hci_uart_pkt_ind - tx_bytes));
|
||||
|
||||
if (nwrite < 0)
|
||||
{
|
||||
printf("Error while writing ->\n");
|
||||
return STATUS_SHORT_WRITE;
|
||||
}
|
||||
if (nwrite == 0)
|
||||
{
|
||||
printf("ftm_bt_hci_pfal_nwrite: zero-length write\n");
|
||||
return STATUS_SHORT_WRITE;
|
||||
}
|
||||
|
||||
tx_bytes += nwrite;
|
||||
size -= nwrite;
|
||||
} while (tx_bytes < size - hci_uart_pkt_ind);
|
||||
|
||||
if (verbose == 1)
|
||||
{
|
||||
printf("[%s] %s: CMD:", get_current_time(), __FUNCTION__);
|
||||
for (i = 0; i < buf_size; i++)
|
||||
{
|
||||
printf(" %02X", buf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_nread
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to read data from the UART/SMD port intialised into
|
||||
the buffer passed in argument.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Read from the tty device into the buffer and ensure the read request is
|
||||
completed, in case of short read report error to the BT FTM layer.
|
||||
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_hci_pfal_nread(uint8 *buf, int size)
|
||||
{
|
||||
int rx_bytes = 0, nread;
|
||||
|
||||
if(fd_transport < 0)
|
||||
return STATUS_NO_RESOURCES;
|
||||
|
||||
do
|
||||
{
|
||||
nread = read(fd_transport, (buf + rx_bytes), (size - rx_bytes));
|
||||
if (nread < 0)
|
||||
{
|
||||
printf("Error while reading ->\n");
|
||||
return STATUS_SHORT_READ;
|
||||
}
|
||||
|
||||
rx_bytes += nread;
|
||||
|
||||
} while (rx_bytes < size);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_hci_pfal_changebaudrate
|
||||
|
||||
DESCRIPTION
|
||||
Platform specific routine to intiate a change in baud rate
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Convert the Baud rate passed to the speed_t type and program the
|
||||
Baud rate change after ensuring all transmit is drained at the
|
||||
current baud rate
|
||||
|
||||
DEPENDENCIES
|
||||
It is expected that the Upper layer will intiate a Flow Off to the
|
||||
BT SoC, to signal the stop of receive if the baud rate change is
|
||||
initiated while SoC init is in progress
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
TRUE if SUCCESS, else FALSE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_hci_pfal_changebaudrate (uint32 new_baud)
|
||||
{
|
||||
struct termios term;
|
||||
boolean status = TRUE;
|
||||
speed_t baud_code;
|
||||
speed_t actual_baud_code;
|
||||
|
||||
if (tcgetattr(fd_transport, &term) < 0)
|
||||
{
|
||||
printf("Can't get port settings\n");
|
||||
status = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
baud_code = convert_baud(new_baud);
|
||||
(void) cfsetospeed(&term, baud_code);
|
||||
if (tcsetattr(fd_transport, TCSADRAIN, &term) < 0) /* don't change speed until last write done */
|
||||
{
|
||||
printf("bt_hci_qcomm_pfal_changebaudrate: tcsetattr:\n");
|
||||
status = FALSE;
|
||||
}
|
||||
/* make sure that we reportedly got the speed we tried to set */
|
||||
if (1 < verbose)
|
||||
{
|
||||
if (tcgetattr(fd_transport, &term) < 0)
|
||||
{
|
||||
printf("bt_hci_qcomm_pfal_changebaudrate: tcgetattr:\n");
|
||||
status = FALSE;
|
||||
}
|
||||
if (baud_code != (actual_baud_code = cfgetospeed(&term)))
|
||||
{
|
||||
printf("bt_hci_qcomm_pfal_changebaudrate: new baud %u FAILED, got 0x%x\n", new_baud, actual_baud_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("bt_hci_qcomm_pfal_changebaudrate: new baud %u SUCCESS, got 0x%x\n", new_baud, actual_baud_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
BT persist NV items access source file
|
||||
|
||||
Description
|
||||
Read/Write APIs for retreiving NV items from persist memory.
|
||||
|
||||
# Copyright (c) 2011-12 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
05/25/12 jav Added FTM log that will display bt address while testing.
|
||||
09/27/11 rrr Moved persist related API for c/c++ compatibility, needed
|
||||
for random BD address to be persistent across target
|
||||
reboots.
|
||||
==========================================================================*/
|
||||
|
||||
#include "ftm_bt_persist.h"
|
||||
#include <semaphore.h>
|
||||
|
||||
#ifdef BT_NV_SUPPORT
|
||||
#include "bt_nv.h"
|
||||
|
||||
/* Semaphore shared by the Event handler and main thread */
|
||||
extern sem_t semaphore_cmd_complete;
|
||||
/*Flag to manage the verbose output */
|
||||
extern int verbose;
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_send_nv_read_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the nv read command
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_send_nv_read_cmd
|
||||
(
|
||||
uint8 * cmd_buf, /* pointer to Cmd */
|
||||
uint16 cmd_len /* Cmd length */
|
||||
)
|
||||
{
|
||||
nv_persist_item_type my_nv_item;
|
||||
nv_persist_stat_enum_type cmd_result;
|
||||
boolean result = TRUE;
|
||||
|
||||
if(cmd_len >1)
|
||||
{
|
||||
switch(*(cmd_buf+1))
|
||||
{
|
||||
case NV_BD_ADDR_I:
|
||||
cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BD_ADDR_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
if (verbose > 0)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to get BD_ADDR from NV, code %d\n", cmd_result);
|
||||
}
|
||||
/* Send fail response */
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy bytes */
|
||||
event_buf_nv_read_response[0] = FTM_BT_CMD_NV_READ;
|
||||
event_buf_nv_read_response[1] = NV_BD_ADDR_I;
|
||||
event_buf_nv_read_response[7] = my_nv_item.bd_addr[5];
|
||||
event_buf_nv_read_response[6] = my_nv_item.bd_addr[4];
|
||||
event_buf_nv_read_response[5] = my_nv_item.bd_addr[3];
|
||||
event_buf_nv_read_response[4] = my_nv_item.bd_addr[2];
|
||||
event_buf_nv_read_response[3] = my_nv_item.bd_addr[1];
|
||||
event_buf_nv_read_response[2] = my_nv_item.bd_addr[0];
|
||||
/* send BD_ADDR in the response */
|
||||
fprintf (stderr, "nv_cmd_remote got NV_BD_ADDR_I from NV: %x:%x:%x:%x:%x:%x\n",
|
||||
(unsigned int) my_nv_item.bd_addr[5], (unsigned int) my_nv_item.bd_addr[4],
|
||||
(unsigned int) my_nv_item.bd_addr[3], (unsigned int) my_nv_item.bd_addr[2],
|
||||
(unsigned int) my_nv_item.bd_addr[1], (unsigned int) my_nv_item.bd_addr[0]);
|
||||
|
||||
ftm_log_send_msg((const uint8 *)event_buf_nv_read_response,nv_read_response_size);
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case NV_BT_SOC_REFCLOCK_TYPE_I:
|
||||
cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BT_SOC_REFCLOCK_TYPE_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
if (verbose > 0)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to get BD_ADDR from NV, code %d\n", cmd_result);
|
||||
}
|
||||
/* Send fail response */
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
event_buf_nv_read_response[0] = FTM_BT_CMD_NV_READ;
|
||||
event_buf_nv_read_response[1] = NV_BT_SOC_REFCLOCK_TYPE_I;
|
||||
event_buf_nv_read_response[2] = (uint8) my_nv_item.bt_soc_refclock_type ;
|
||||
event_buf_nv_read_response[7] = 0x0;
|
||||
event_buf_nv_read_response[6] = 0x0;
|
||||
event_buf_nv_read_response[5] = 0x0;
|
||||
event_buf_nv_read_response[4] = 0x0;
|
||||
event_buf_nv_read_response[3] = 0x0;
|
||||
fprintf (stderr, "nv_cmd_remote got NV_BT_SOC_REFCLOCK_TYPE_I from NV: 0x%x\n",
|
||||
(unsigned int) my_nv_item.bt_soc_refclock_type);
|
||||
ftm_log_send_msg((const uint8 *)event_buf_nv_read_response,nv_read_response_size);
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case NV_BT_SOC_CLK_SHARING_TYPE_I:
|
||||
cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_READ_F, NV_BT_SOC_CLK_SHARING_TYPE_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
if (verbose > 0)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to get CLK_SHARING from NV, code %d\n", cmd_result);
|
||||
}
|
||||
/* Send fail response */
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
event_buf_nv_read_response[0] = FTM_BT_CMD_NV_READ;
|
||||
event_buf_nv_read_response[1] = NV_BT_SOC_CLK_SHARING_TYPE_I;
|
||||
event_buf_nv_read_response[2] = (uint8) my_nv_item.bt_soc_clk_sharing_type ;
|
||||
event_buf_nv_read_response[7] = 0x0;
|
||||
event_buf_nv_read_response[6] = 0x0;
|
||||
event_buf_nv_read_response[5] = 0x0;
|
||||
event_buf_nv_read_response[4] = 0x0;
|
||||
event_buf_nv_read_response[3] = 0x0;
|
||||
fprintf (stderr, "nv_cmd_remote got NV_BT_SOC_CLK_SHARING_TYPE_I from NV: 0x%x\n",
|
||||
(unsigned int) my_nv_item.bt_soc_refclock_type);
|
||||
ftm_log_send_msg((const uint8 *)event_buf_nv_read_response,nv_read_response_size);
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(result == FALSE)
|
||||
ftm_log_send_msg(event_buf_nv_read_response_fail,nv_read_response_size_fail);
|
||||
|
||||
sem_post(&semaphore_cmd_complete);
|
||||
return result;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_send_nv_write_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the nv write command
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_send_nv_write_cmd
|
||||
(
|
||||
uint8 * cmd_buf, /* pointer to Cmd */
|
||||
uint16 cmd_len /* Cmd length */
|
||||
)
|
||||
{
|
||||
nv_persist_item_type my_nv_item;
|
||||
nv_persist_stat_enum_type cmd_result;
|
||||
boolean result = TRUE;
|
||||
if(cmd_len >1)
|
||||
{
|
||||
switch(*(cmd_buf+1))
|
||||
{
|
||||
case NV_BD_ADDR_I:
|
||||
memcpy(&my_nv_item.bd_addr, (cmd_buf+2), NV_BD_ADDR_SIZE);
|
||||
cmd_result = (nv_persist_stat_enum_type)bt_nv_cmd(NV_WRITE_F, NV_BD_ADDR_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
if (verbose > 0)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to get BD_ADDR from NV, code %d\n", cmd_result);
|
||||
}
|
||||
/* Send fail response */
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case NV_BT_SOC_REFCLOCK_TYPE_I:
|
||||
switch (*(cmd_buf+2))
|
||||
{
|
||||
case NV_PS_BT_SOC_REFCLOCK_32MHZ:
|
||||
case NV_PS_BT_SOC_REFCLOCK_19P2MHZ:
|
||||
my_nv_item.bt_soc_refclock_type = (nv_ps_bt_soc_refclock_enum_type)(*(cmd_buf+2)) ;
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Invalid Ref Clock option\n");
|
||||
result = FALSE;
|
||||
}
|
||||
if (result != FALSE)
|
||||
{
|
||||
cmd_result= (nv_persist_stat_enum_type)bt_nv_cmd(NV_WRITE_F, NV_BT_SOC_REFCLOCK_TYPE_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to write SOC_REFCLOCK_TYPE to NV, code %d\n", cmd_result);
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NV_BT_SOC_CLK_SHARING_TYPE_I:
|
||||
switch (*(cmd_buf+2))
|
||||
{
|
||||
case NV_PS_BT_SOC_CLOCK_SHARING_ENABLED:
|
||||
case NV_PS_BT_SOC_CLOCK_SHARING_DISABLED:
|
||||
my_nv_item.bt_soc_clk_sharing_type = (nv_ps_bt_soc_clock_sharing_enum_type)(*(cmd_buf+2)) ;
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "Invalid Clock Sharing option\n");
|
||||
result = FALSE;
|
||||
}
|
||||
if (result != FALSE)
|
||||
{
|
||||
cmd_result= (nv_persist_stat_enum_type)bt_nv_cmd(NV_WRITE_F, NV_BT_SOC_CLK_SHARING_TYPE_I, &my_nv_item);
|
||||
if (NV_SUCCESS != cmd_result)
|
||||
{
|
||||
fprintf (stderr, "nv_cmd_remote failed to write SOC_CLK_SHARING_TYPE to NV, code %d\n", cmd_result);
|
||||
result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(result == FALSE)
|
||||
{
|
||||
ftm_log_send_msg(event_buf_bt_nv_write_fail,nv_write_response_size);
|
||||
sem_post(&semaphore_cmd_complete);
|
||||
}
|
||||
else
|
||||
{
|
||||
ftm_log_send_msg((const uint8 *)event_buf_bt_nv_write_pass,nv_write_response_size);
|
||||
sem_post(&semaphore_cmd_complete);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* End of BT_NV_SUPPORT */
|
||||
@@ -1,113 +0,0 @@
|
||||
#ifndef _FTM_BT_PERSIST_H_
|
||||
#define _FTM_BT_PERSIST_H_
|
||||
|
||||
/*==========================================================================
|
||||
|
||||
BT persist NV items access source file
|
||||
|
||||
Description
|
||||
Read/Write APIs for retreiving NV items from persist memory.
|
||||
|
||||
# Copyright (c) 2011 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
09/27/11 rrr Moved persist related API for c/c++ compatibility, needed
|
||||
for random BD address to be persistent across target
|
||||
reboots.
|
||||
==========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "ftm_bt_common.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef BT_NV_SUPPORT
|
||||
|
||||
#define FTM_BT_CMD_NV_READ 0xB
|
||||
#define FTM_BT_CMD_NV_WRITE 0xC
|
||||
|
||||
const uint8 nv_read_response_size = 8;
|
||||
const uint8 nv_read_response_size_fail = 2;
|
||||
const uint8 nv_write_response_size = 2;
|
||||
|
||||
/* NV Write Responses */
|
||||
const uint8 event_buf_bt_nv_write_pass[2] = { FTM_BT_CMD_NV_WRITE, FTM_BT_DRV_NO_ERR};
|
||||
const uint8 event_buf_bt_nv_write_fail[2] = { FTM_BT_CMD_NV_WRITE, FTM_BT_NV_WRITE_FAIL};
|
||||
|
||||
/* NV Read Responses */
|
||||
const uint8 event_buf_nv_read_response_fail[8] =
|
||||
{
|
||||
FTM_BT_CMD_NV_READ, FTM_BT_NV_READ_FAIL, 0x0, 0x0,0x0,0x0,0x0,0x0
|
||||
};
|
||||
|
||||
uint8 event_buf_nv_read_response[8];
|
||||
#endif /* BT_NV_SUPPORT */
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_send_nv_read_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the nv read command
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_send_nv_read_cmd
|
||||
(
|
||||
uint8 * cmd_buf, /* pointer to Cmd */
|
||||
uint16 cmd_len /* Cmd length */
|
||||
);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_send_nv_write_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Helper Routine to process the nv write command
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
FALSE = failure, else TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean ftm_bt_send_nv_write_cmd
|
||||
(
|
||||
uint8 * cmd_buf, /* pointer to Cmd */
|
||||
uint16 cmd_len /* Cmd length */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FTM_BT_PERSIST_H_ */
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT POWER HAL Header File
|
||||
|
||||
Description
|
||||
Wrapper API definitions of the ftm bt power hal component.
|
||||
|
||||
# Copyright (c) 2010 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created a header file to include the wrapper API
|
||||
definitions for BT power control
|
||||
07/07/10 rakeshk Modified the function name of BT power set HAL routine
|
||||
===========================================================================*/
|
||||
#include "ftm_bt_common.h"
|
||||
#include "ftm_bt_power_pfal.h"
|
||||
|
||||
|
||||
#ifndef __FTM_BT_POWER_HAL_H__
|
||||
#define __FTM_BT_POWER_HAL_H__
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_power_hal_set
|
||||
|
||||
DESCRIPTION
|
||||
Platform independent wrapper API which sets a BT power from PFAL
|
||||
layer and returns the status of the PFAL operation.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_power_hal_set(bt_power_state state)
|
||||
{
|
||||
return ftm_bt_power_pfal_set(state);
|
||||
}
|
||||
/*===========================================================================
|
||||
FtUNCTION ftm_bt_power_hal_check
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Platform independent wrapper API which gets the BT power from PFAL
|
||||
layer and returns the current state of the BT HW.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
Current BT power state
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
bt_power_state ftm_bt_power_hal_check()
|
||||
{
|
||||
return ftm_bt_power_pfal_check();
|
||||
}
|
||||
|
||||
#endif //__FTM_BT_POWER_HAL_H__
|
||||
@@ -1,71 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT POWER PFAL Header File
|
||||
|
||||
Description
|
||||
PFAL API declarations of the ftm bt power pfal component.
|
||||
|
||||
# Copyright (c) 2010 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created a header file to hold the PFAL declarations for
|
||||
BT power programming
|
||||
07/07/10 rakeshk Modified the function name of BT power set PFAL routine
|
||||
===========================================================================*/
|
||||
#include "ftm_bt_common.h"
|
||||
|
||||
#ifndef __FTM_BT_POWER_PFAL_H__
|
||||
#define __FTM_BT_POWER_PFAL_H__
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_power_pfal_set
|
||||
|
||||
DESCRIPTION
|
||||
Platform dependent interface API which sets the BT power
|
||||
and returns the status of the toggle operation.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_power_pfal_set(bt_power_state state);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_power_pfal_check
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Platform dependent interface API which intiates a BT power read/check
|
||||
and returns the current state of the BT HW.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
Current BT power state
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
bt_power_state ftm_bt_power_pfal_check();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM Platform specfic BT power File
|
||||
|
||||
Description
|
||||
Platform specific routines to toggle/read the BT power state
|
||||
|
||||
# Copyright (c) 2010-2011 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created a source file to implement platform specific
|
||||
routines for BT power.
|
||||
07/07/10 rakeshk Added routine to find the sysfs entry for bluetooth in
|
||||
runtime
|
||||
07/07/10 rakeshk Added call to init the rfkill state path in case of first
|
||||
read
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "ftm_bt_power_pfal.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Bluetooth Rfkill Entry for Android */
|
||||
static char *rfkill_state_path = NULL;
|
||||
/*===========================================================================
|
||||
FUNCTION init_rfkill_path
|
||||
|
||||
DESCRIPTION
|
||||
Opens the sysfs entry for different types of rfkill and finds the one
|
||||
which matches Bluetooth by iterating through the rfkill entries
|
||||
and checking for bluetooth
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
TRUE if SUCCESS, else FALSE
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
boolean init_rfkill_path()
|
||||
{
|
||||
int fd;
|
||||
int readsize;
|
||||
int rfkillid;
|
||||
char rfkill_path[64];
|
||||
char buf[16];
|
||||
|
||||
for (rfkillid = 0; ; rfkillid++)
|
||||
{
|
||||
/* Open the different rfkill type entries and check if type macthes bluetooth */
|
||||
snprintf(rfkill_path, sizeof(rfkill_path), "/sys/class/rfkill/rfkill%d/type", rfkillid);
|
||||
fd = open(rfkill_path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
printf("open(%s) failed: \n", rfkill_path);
|
||||
return FALSE;
|
||||
}
|
||||
readsize = read(fd, &buf, sizeof(buf));
|
||||
close(fd);
|
||||
|
||||
if (memcmp(buf, "bluetooth", 9) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
asprintf(&rfkill_state_path, "/sys/class/rfkill/rfkill%d/state", rfkillid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_power_pfal_set
|
||||
|
||||
DESCRIPTION
|
||||
Platform dependent interface API which sets the BT power state
|
||||
and returns the status of the toggle operation.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Opens the rfkill entry for Bleutooth and initiates a write of the value
|
||||
passed as argument.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
STATUS_SUCCESS if SUCCESS, else other reasons
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
request_status ftm_bt_power_pfal_set(bt_power_state state)
|
||||
{
|
||||
int sz;
|
||||
int fd = -1;
|
||||
request_status ret = STATUS_FAIL;
|
||||
const char buffer = state;
|
||||
if(rfkill_state_path == NULL)
|
||||
{
|
||||
if(init_rfkill_path() != TRUE)
|
||||
goto out;
|
||||
}
|
||||
|
||||
fd = open(rfkill_state_path, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = STATUS_NO_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
sz = write(fd, &buffer, 1);
|
||||
if (sz < 0)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
ret = STATUS_SUCCESS;
|
||||
|
||||
out:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION ftm_bt_power_pfal_check
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Platform dependent interface API which intiates a BT power read/check
|
||||
and returns the current state of the BT HW.
|
||||
|
||||
PLATFORM SPECIFIC DESCRIPTION
|
||||
Opens the rfkill entry for Bleutooth and initiates a read on the rfkill
|
||||
descriptor.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN VALUE
|
||||
Current BT power state
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
bt_power_state ftm_bt_power_pfal_check()
|
||||
{
|
||||
int sz;
|
||||
bt_power_state state= BT_OFF;
|
||||
int fd = -1;
|
||||
char buffer = '0';
|
||||
|
||||
if(rfkill_state_path == NULL)
|
||||
{
|
||||
if(init_rfkill_path() != TRUE)
|
||||
goto out;
|
||||
}
|
||||
fd = open(rfkill_state_path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
sz = read(fd, &buffer, 1);
|
||||
if (sz < 0)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
state = (bt_power_state)buffer;
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM BT HCI PFAL Header File
|
||||
|
||||
Description
|
||||
Queue insert/delete routines and data structures
|
||||
|
||||
# Copyright (c) 2010-2011, 2014 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
Edit History
|
||||
|
||||
|
||||
when who what, where, why
|
||||
-------- --- ----------------------------------------------------------
|
||||
06/18/10 rakeshk Created
|
||||
11/09/10 rakeshk Added two APIs to perform read/write of BT Top level
|
||||
I2C registers
|
||||
===========================================================================*/
|
||||
|
||||
#if defined(CONFIG_FTM_BT) || defined(CONFIG_FTM_FM)
|
||||
#include <ftm_bt_common.h>
|
||||
#include "ftm_bt.h"
|
||||
#include <semaphore.h>
|
||||
#include <pthread.h>
|
||||
/* Semaphore shared by the Event handler and main thread */
|
||||
extern sem_t semaphore_cmd_complete;
|
||||
/* Structure used by the FTM BT/FM component to
|
||||
* queue the FTM packet contents
|
||||
*/
|
||||
|
||||
pthread_mutex_t fm_event_lock;
|
||||
pthread_cond_t fm_event_cond;
|
||||
extern int fm_passthrough;
|
||||
|
||||
typedef struct cmdQ
|
||||
{
|
||||
int command_id;/*Command id */
|
||||
void *data; /* Command data */
|
||||
boolean bt_command; /* whether BT or FM command */
|
||||
int cmd_len; /* Command length */
|
||||
struct cmdQ *next; /* pointer to next CmdQ item */
|
||||
}cmdQ;
|
||||
|
||||
/* Callback declaration for BT FTM packet processing */
|
||||
void *bt_ftm_diag_dispatch(void *req_pkt, uint16 pkt_len);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION qinsert_cmd
|
||||
|
||||
DESCRIPTION
|
||||
Command Queue insert routine. Add the FTM BT packet to the Queue
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURNS FALSE without adding queue entry in failure
|
||||
to allocate a new Queue item
|
||||
else returns TRUE
|
||||
|
||||
SIDE EFFECTS
|
||||
increments the number of commands queued
|
||||
|
||||
===========================================================================*/
|
||||
boolean qinsert_cmd(ftm_bt_pkt_type *ftm_bt_pkt);
|
||||
/*===========================================================================
|
||||
FUNCTION dequeue_send
|
||||
|
||||
DESCRIPTION
|
||||
Command Queue delete and calls HCI send routine. Dequeues the HCI data from
|
||||
the queue and sends it to HCI HAL layer.
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
RETURN NIL
|
||||
|
||||
SIDE EFFECTS
|
||||
decrements the number of command queued
|
||||
|
||||
===========================================================================*/
|
||||
void dequeue_send();
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION i2c_write
|
||||
|
||||
DESCRIPTION
|
||||
Helper function to construct the I@C request to be sent to the FM I2C
|
||||
driver
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
-1 in failure,positive or zero in success
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
int i2c_write
|
||||
(
|
||||
int fd,
|
||||
unsigned char offset,
|
||||
const unsigned char* buf,
|
||||
unsigned char len,
|
||||
unsigned int slave_addr
|
||||
);
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION i2c_read
|
||||
|
||||
DESCRIPTION
|
||||
Helper function to construct the I2C request to read data from the FM I2C
|
||||
driver
|
||||
|
||||
DEPENDENCIES
|
||||
NIL
|
||||
|
||||
RETURN VALUE
|
||||
-1 in failure,positive or zero in success
|
||||
|
||||
SIDE EFFECTS
|
||||
None
|
||||
|
||||
===========================================================================*/
|
||||
int i2c_read
|
||||
(
|
||||
int fd,
|
||||
unsigned char offset,
|
||||
const unsigned char* buf,
|
||||
unsigned char len,
|
||||
unsigned int slave_addr
|
||||
);
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
/*==========================================================================
|
||||
|
||||
FTM WLAN Source File
|
||||
|
||||
# Copyright (c) 2013-2014 by Qualcomm Technologies, Inc. All Rights Reserved.
|
||||
# Qualcomm Technologies Proprietary and Confidential.
|
||||
|
||||
===========================================================================*/
|
||||
#ifndef _FTM_DBG_H_
|
||||
#define _FTM_DBG_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#define FTM_DBG_ERROR 0x00000001
|
||||
#define FTM_DBG_INFO 0x00000002
|
||||
#define FTM_DBG_TRACE 0x00000004
|
||||
|
||||
#define FTM_DBG_DEFAULT (FTM_DBG_ERROR)
|
||||
|
||||
extern unsigned int g_dbg_level;
|
||||
|
||||
struct ftm_config
|
||||
{
|
||||
int total_num_slots;
|
||||
uint32_t slot_id[4];
|
||||
uint32_t slot_size[4];
|
||||
};
|
||||
extern struct ftm_config ftm_cfg;
|
||||
|
||||
#ifdef DEBUG
|
||||
void current_time();
|
||||
#define DPRINTF(_level, _x...)\
|
||||
do {\
|
||||
if (g_dbg_level & (_level))\
|
||||
{\
|
||||
fprintf(stderr, _x);\
|
||||
}\
|
||||
} while (0);
|
||||
|
||||
#else
|
||||
#define DPRINTF(_level, x...) do { } while (0);
|
||||
#endif
|
||||
|
||||
#endif /* _FTM_DBG_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user