Compare commits

...

834 Commits

Author SHA1 Message Date
jaspreetsachdev
bb5d3ecd2d Merge pull request #583 from Telecominfraproject/main
merge main to release branch
2023-09-26 10:30:48 -04:00
John Crispin
d9f237b450 hostapd: update to latest hot reload
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-25 11:52:41 +02:00
John Crispin
4f5a3b0c2b ucentral-schema: update to latest HEAD
Fixes: WIFI-12956
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-25 07:10:33 +02:00
jaspreetsachdev
dd41f15987 Merge pull request #581 from Telecominfraproject/main
Merge the latest changes from main
2023-09-20 08:58:21 -04:00
John Crispin
007cfe9c16 ipq807x: update ifname rename patches
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-19 06:44:06 +02:00
Ken
52884b2835 ipq807x: CIG wf660ag: support both EMMC and SPI NOR+EMCC H/W
Using one firmware to support the board which has EMMC only and SPI NOR+EMMC equipped

Fixes: WIFI-12941
Signed-off-by: Ken <xshi@actiontec.com>
2023-09-18 16:19:17 +02:00
John Crispin
6a6af16f48 hostapd: add CSA event
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-18 15:58:39 +02:00
John Crispin
2818722b19 usteer2: improve gateway command handling
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-18 15:58:39 +02:00
John Crispin
194eba2d21 ucentral-schema: update to latest HEAD
e99eaf9 add rrm cmd handler

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-18 15:58:39 +02:00
John Crispin
3d41a22fba ucentral-client: update to latest HEAD
3bbcd36 handle rrm command

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-18 09:56:50 +02:00
John Crispin
acd4b79dd4 ipq807x: backport latest wifi hot-reload to v5.4 kernel
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-17 06:50:23 +02:00
John Crispin
befac1e065 netifd: backport vlan rewrite
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-16 17:29:49 +02:00
John Crispin
7e4e221ccb netifd: add dynamic interface patch
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-16 17:29:49 +02:00
Felix Fietkau
1d9b69ee6f hostapd: add vlan reload support and ap+sta fix
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-16 17:29:49 +02:00
Felix Fietkau
018f20119d netifd: add wireless vlan/sta fix
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-16 17:29:49 +02:00
Felix Fietkau
9a6e41adb8 hostapd: fix ucode reload issues
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-16 17:29:49 +02:00
Felix Fietkau
970b22856f mac80211: fix reconfiguration on DFS channels in non-ETSI regdomains
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-16 17:29:49 +02:00
Felix Fietkau
95032994fe hostapd: move ubus.c changes from patches to src
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-16 17:29:49 +02:00
John Crispin
48cda63dc5 hostapd: backport latest reload patches
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-16 17:29:49 +02:00
Ken
8e9f79964a ipq807x: Apply CE TX power to wf-186w
Apply CE TX power for WF186w and WF186H include FCC as well.

Fixes: WIFI-12920
Signed-off-by: Ken <xshi@actiontec.com>
2023-09-16 17:20:11 +02:00
John Crispin
3c7df86373 certificates: fix mounting on cig,wf186w|cig,wf186h
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-16 17:20:11 +02:00
Ken
38e6aee074 ipq807x: BSP patch for WF-186H
Fixes: WIFI-12922
Signed-off-by: Ken <xshi@actiontec.com>
2023-09-16 17:19:55 +02:00
John Crispin
0a13684bb6 ipq807x: fix certificates mounting in dual-boot scenario on yuncore,fap655
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-16 17:17:15 +02:00
John Crispin
e7ca6e8455 hostapd: fix ft-anonce behavior for broken clients
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-13 16:37:12 +02:00
John Crispin
f17e635d34 ucentral-schema: update to latest HEAD
f113e61 fix uci for network devices that have a dot in the name

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-13 16:35:50 +02:00
John Crispin
90e78c6068 ucentral-schema: update to latest HEAD
58d7d72 fix beacon rates

Fixes: WIFI-12935
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-12 16:58:23 +02:00
John Crispin
550bb6fb7e hostapd: update the snooping patch
Fixes: WIFI-12929
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-12 16:18:01 +02:00
John Crispin
b3a0ebe534 ipq807x: disable SWITCHDEV support
It is not used by the firmware.

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-12 16:16:43 +02:00
John Crispin
6d16e50bbe ipq807x: do not include kmod-qca-nss-drv-bridge-mgr
This was causing issues with bridge-vlans that have mixed tagged and untagged ports.

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-12 16:16:04 +02:00
Paul White
513eec1c5f ipq807x: cig.wf186w: Add MPSK Dynamic VLAN support
When a MPSK VLAN netdev is created on the cig.wf186w board, this script
will configure switch0 via swconfig for the corresponding VLAN

Signed-off-by: Paul White <paul@shasta.cloud>
2023-09-12 04:15:24 +02:00
Paul White
6a797e8a64 ucentral-schema: cig.wf186w: wan_port set to eth0
Reset the ucentral UCI config 'event.config.wan_port' to eth0 for
the WF186W board

Signed-off-by: Paul White <paul@shasta.cloud>
2023-09-12 04:15:24 +02:00
John Crispin
082134bc43 ucentral-schema: update to latest HEAD
fd6a079 dhcp-relay: dhcp relay option 82 parameters

Signed-off-by: John Crispin <john@phrozen.org>
2023-09-11 07:31:55 +02:00
Arif Alam
03ec2de777 ucentral-event: dhcp relay option 82 parameters
Add the ability to configure circuit-id and remote-id sub-options.

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2023-09-11 07:29:17 +02:00
John Crispin
989d39d1f2 ucentral-schema: update to latest HEAD
a4c8a13 increase reassociation_deadline to 3s when using multi-psk

Fixes: WIFI-12598
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-06 16:15:11 +02:00
John Crispin
b6b298ad68 hostapd: fix association of clients on Open/VLAN SSIDs
Fixes: WIFI-12929
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-06 16:14:42 +02:00
Ken
be1cb862f1 ipq807x: CIG WF-186w - Adjust the LAN ID to match printed labels
Fixes: WIFI-12915
Signed-off-by: Ken <xshi@actiontec.com>
2023-09-06 11:55:01 +02:00
John Crispin
eb6e95f760 hostapd: add proxy-state to DAS frames
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
f04eb1d604 netifd: revert upstream wpa3 cypher fixes
Fixes: WIFI-12906
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
cc1512e42a CI: fix oap101_/-e profile name
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
88d6633c85 ipq807x: update the eap101 BDF
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
1773435a2c .github/workflows: drop ununsed targets
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
cf12abc92e ucentral-schema: update to latest HEAD
708b1de override dynamic_authorization settings when radius-gw-proxy is enabled

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
d8c4b1f0e2 ucentral-schema: update to latest HEAD
81a786d add radius support to the ieee8021x service
ee0a87c ethernet port UCI sections should be named to prevent duplicate sections

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
45cbd5d93a ipq95xx: fix sysupgrade on reference kit
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
2646db0826 ipq807x: update NSS patch
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
0289ea7293 ipq95xx: basic uci support for wifi-7
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
c02c293651 ipq95xx: enable wifi-7
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
e6786115cc ipq807x: add more v5.4 profiles
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:36 +02:00
John Crispin
89b9596e27 ipq807x: fix edgecore_oap101_6e profile name
Fixes: WIFI-12882
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
23cd3b3e99 ucentral-schema: update to latest HEAD
e5ff553 channel 40 was not set correctly during wifi-scan

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
5a8cf73137 mac80211: fix ath11k mimo/nss calculation
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
79dfb1e861 ieee8021x: update to latest HEAD
560fe30 allow the use of an external AAA server

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
4eb30ba080 mac80211: drop hostapd dependency
This fixes build dependency errors introduced by the latest wifi hot reload update.

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
1829c9c96f hostapd: update builtin version to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
fa2424750b netifd: update to latest HEAD
Fixes: WIFI-12878
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
441cb82d32 ucentral-schema: update to latest HEAD
0220fbc fix a null expression in capabilities code

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
c34d346b57 hostapd: update v5.4 version to latest hot-reload version
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
Ken
f7a766be20 ipq807x: CIG WF188n: wrong wan mac address
eth0 is configured as WAN but set with LAN mac.

Fixes: WIFI-12869
Signed-off-by: Ken <xshi@actiontec.com>
2023-08-31 16:08:35 +02:00
Ken
54e8411980 ipq807x: CIG-WF Apply FCC TX power to 660a (20230804)
Add new FCC tx power, MD5 79a4b5cd48bcd8de82d3f0d30cc57cca

Fixes: WIFI-12873
Signed-off-by: Ken <xshi@actiontec.com>
2023-08-31 16:08:35 +02:00
John Crispin
09ebd5f406 hostapd: more hot-reload backports
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
44aef94d82 ath11k: fix capability recalc when changing the mimo mask
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
aeac214236 hostapd: backport more hot-reload fixes
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
81f8a368d1 hostapd: mimo was not always applied correctly
Fixes: WIFI-12854
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
cde9d148b8 netifd: update to latest HEAD
Fixes: WIFI-12854
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
b1bf054d74 ucentral-schema: update to latest HEAD
2defc8e fix mimo 3x3 calculation

Fixes: WIFI-12854
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
wingate.chi
18100e0b4e ipq807x: update qca-thermald
Let qca thermald support IPQ50xx platform and has cooling function to limit the
duty cycle of tx queues

Signed-off-by: wingate5678 <wingate.chi@cybertan.com.tw>
2023-08-31 16:08:35 +02:00
John Crispin
42f0c520da ucentral-schema: update to latest HEAD
5df48b7 fix malformed beacon when enabling TIP OUI

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
fbee159481 hostapd: backport 2 hot-reload fixes
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
ca4a4365d6 ucentral-schema: update to latest HEAD
ea269d6 add strict validation support

Fixes: WIFI-12852
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
54ffbadc2d ipq807x: enable dual-boot on cig,wf186w
Fixes: WIFI-12761
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
Ken
a4cd9cb03b ipq807x: Apply FCC TX power to 186w and 660a
Fixes: WIFI-12864
Signed-off-by: Ken <xshi@actiontec.com>
2023-08-31 16:08:35 +02:00
John Crispin
f3406891b2 ucentral-client: update to latest HEAD
d898a7a prevent ip-collide script and apply task running in parallel

Fixes: WIFI-12849
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
6f7c5995ad ipq807x: fix eap102-ath12 image path
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
8046c336c3 ipq807x: add more ath12 profiles to CI
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
c39f92eea7 ucentral-schema: update to latest HEAD
5746d3d make the wifi scanning code aware of the TIP OUI

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
37d1da8b01 ucentral-event: always respawn the service
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
6f65229d66 ucentral-event: fix possible null pointer deref
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
7bf62b76bd hostapd: fix stray unused interfaces in the hot reload code
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
693e147cd9 ucentral-schema: update to latest HEAD
122135c add becaon-adverrtisment support using TIP IE

Fixes: WIFI-12535
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
eab2445d14 mac80211: hot-reload backport added an unknown option
acs_survey is not known by the QCA hapd, revert to the previous value

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
5c53054de9 mac80211: hot reload was not working reliably when going from single STA to any other mode
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
1866ffcccc ipq807x: make cig wf-188n work on v5.4 kernel
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
5c7fe1a0fa mac80211: hot reload was not working reliably when going from single STA to any other mode
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
672578af01 mac80211: update v5.4 patches
add recent patches made to the v4.4 kernel to the v5.4 kernel

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
9c27a4b878 unetd: improve kernel dependencies for v5.4 kernel
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
4cf4a5152e ipq807x: update v5.4 patches
add recent patches made to the v4.4 kernel to the v5.4 kernel

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
7daf37be9e ucentral-schema: update to latest HEAD
fa2cdb2 add tip-information-element support

Fixes: WIFI-12535
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
7975de1101 ipq807x: add eap102 v5.4 profile
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
Gg
2d1bbeedd9 ipq807x: Add the corresponding software content for the <wallys-dr5018> hardware device
Fixes: WIFI-12804
Signed-off-by: Gg <gxg@wallystech.com>
2023-08-31 16:08:35 +02:00
John Crispin
e0fc96b950 ucentral-schema: add qos-class example
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
835909f3cc hostapd: fix a use-after-free bug
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
Felix Fietkau
e02d9261df add missing patch for hostapd update
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-08-31 16:08:35 +02:00
John Crispin
2f7a1e5952 ucentral-event: fix dynamic vlan
since the latest netifd update, dynamic vlans need to be set to untagged explicitly

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
0ad0aa8255 netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
4db35c127b ucentral-schema: update to latest HEAD
6de905f add QoS classes and services

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
f6ae95da15 qosify: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
daec2bef52 hostapd: fix compile error introduced by recent update
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
4e5e483743 ucentral-schema: update to latest HEAD
249788e fix state messages when no devices are configured

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
ea1cb7a4a6 ucentral-schema: update to latest HEAD
36f815c fix static upstream interfaces

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
ce33b86c6f hostapd: update wifi-reload code
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
8e0e4d81d8 netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
74616bda9a qca-ssdk: fix max vlan support on qca8337
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
47afa20ff1 ipq807x_v5.4: fix maple/oap101-(6)e support
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
b4c68157c8 ath11k-wifi: add new wf188n BDF files
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:35 +02:00
John Crispin
5dd721b206 ucentral-schema: update to latest HEAD
19f4910 allow setting proto: none on ipv4 interfaces
3f98df2 Fix definitions, to match other schema yml definitions

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
9ef59ba079 ucentral-schema: update to latest HEAD
f56f754 allow multiple fixe country codes on an AP

Fixes: WIFI-12744
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
fafb5cbffd ucentral-schema: update to latest HEAD
77031d1 swconfig: fix interfaces with mixed switch and raw ports

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
Ken
dca6ea517f ipq807x: CIG WF-186w : Fixed the vlan issue when add two vlan interface into one bridge
Fixes: WIFI-12743
Signed-off-by: Ken <xshi@actiontec.com>
2023-08-31 16:08:34 +02:00
John Crispin
43436e4726 ucentral-schema: update to latest HEAD
2d702af add swconfig support

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
18c6087d56 wifi-ax: backport hostapd reload support - fixes
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-08-31 16:08:34 +02:00
John Crispin
a5eaccb29a ipq807x: enable 4k vlan by default on realtek switches
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
ee090f6230 ucentral-schema: update to latest HEAD
2c8fb4a enable wifi hot-reload on all phys

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
Felix Fietkau
5b397d54ce wifi-ax: backport hostapd reload support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-08-31 16:08:34 +02:00
Felix Fietkau
323dc65770 ucode: update to the latest version
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-08-31 16:08:34 +02:00
John Crispin
bccdb175b0 ucentral-schema: update to latest HEAD
5255152 use logical names instead of linux netdev ones inside state messages
f129469 remove outdated test cases
57e1ff5 149 is not a 160mhz channel

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
esha
92f59a3f22 Add Support for hfcl_ion4xi_w, hfcl_ion4x_w and hfcl_ion4xi_HMR
Fixes: WIFI-12710
Signed-off-by: Esha Aggarwal <esha.aggarwal@hfcl.com>
2023-08-31 16:08:34 +02:00
John Crispin
ccdca73cd6 mac80211: add the HTC+ / iPhone fix
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
Ken
3fde7d88fb ipq807x: add stty to configure the uart on CIG 660A
Fixes: WIFI-12712
Signed-off-by: Ken <xshi@actiontec.com>
2023-08-31 16:08:34 +02:00
John Crispin
79dcd8a900 ucentral-schema: update to latest HEAD
6085276 reject upstream interfaces with invalid config

Fixes: WIFI-12695
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
3d851f6343 libubox: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
ed3142aa10 bridger: update to latest HEAD
3159bbe improve isolation when selecting a fixed output port

Fixes: WIFI-12577
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
5d0a5e377e ath11k: disable HE160/80+80 on cypress/hawkeye
[  307.970726] qcom-q6v5-wcss-pil cd00000.qcom_q6v5_wcss: fatal error received:
[  307.970726] QC Image Version: QC_IMAGE_VERSION_STRING=WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
[  307.970726] Image Variant : IMAGE_VARIANT_STRING=6018.wlanfw.evalQ
[  307.970726]
[  307.970726] phyrf_reset.c:1131 Assertion (boardOpFlags == WHAL_WLAN_11AG_CAPABILITY) || ((boardOpFlags == WHALparam0 :zero, param1 :zero, param2 :zero.
[  307.970726] Thread ID      : 0x00000068  Thread name    : WLAN RT0  Process ID     : 0
[  307.970726] Register:
[  307.970726] SP : 0x4bb6e720
[  307.970726] FP : 0x4bb6e728
[  307.970726] PC : 0x4ac8d44c
[  307.970726] SSR : 0x00000008
[  307.970726] BADVA : 0x00020000
[  307.970726] LR : 0x4ac8cbe8
[  307.970726]
[  307.970726] Stack Dump
[  307.970726] from : 0x4bb6e720
[  307.970726] to   : 0x4bb6eec0
[  307.970726]
[  308.023043] remoteproc remoteproc0: crash detected in cd00000.qcom_q6v5_wcss: type fatal error
[  308.045307] remoteproc remoteproc0: handling crash #1 in cd00000.qcom_q6v5_wcss
[  308.053681] remoteproc remoteproc0: recovering cd00000.qcom_q6v5_wcss

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
439c386506 ucentral-schema: update to latest HEAD
0c0a741 fix 160 and 80+80 modes
dbc38ab start bridger early

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
1371a9d3d8 ucentral-event: add option82 handling
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
Felix Fietkau
52f6189c10 udhcpsnoop: allow processing other hooks after ingress mirror
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-08-31 16:08:34 +02:00
John Crispin
cf63cb94aa udhcprelay: add new package
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
94a442abcf ucentral-schema: update to latest HEAD
0986e5a improve vlan-awareness support

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
6cf990f142 netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
8422d572e7 ipq807x: add profiles/hfcl_ion4xi_w.yml
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
659e7c52ba ipq807x: fix xunison-d50 leds
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
2536cfdc9e ipq807x: fix xunison-d50 BDF files
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
e9b64b0dfd ipq807x: fix certificates on hfcl-ion4xi_w
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
b4ed6a8367 ipq807x: fix hfcl-ion4xi_w ethernet ports
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
5362455444 ipq807x: fix hfcl-ion4xi_w calibration data
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
eff55cc055 ipq807x: fix hfcl-ion4xi_w board files
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
295a81450b ipq807x: fix hfcl-ion4xi_w wifi macs
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
ad48758229 ipq807x: fix hfcl-ion4xi_w wifi firmware selection
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
0f5302044d ipq807x: add hfcl-ion4xi_w support
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
398e17a583 hostapd: add usteer2 patches
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
b303909c83 ipq807x: add xunison-d50 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
d7c88de1a7 ucentral-schema: update to latest HEAD
e156652 FWsignature->signature
d324707 fix typo
08ee70c add vlan-awareness support

Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
c144aeed12 usteer2: WIP
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
John Crispin
b3d791b34e base-files/ipq807x: allow setting the dual boot env in the sysupgrade sucess handler
Signed-off-by: John Crispin <john@phrozen.org>
2023-08-31 16:08:34 +02:00
Stephane Bourque
9b77f6ed22 Update x64_vm-build-test.yml
Reverting a bad commit
2023-07-16 21:15:42 -07:00
Stephane Bourque
7eb5d45bb8 Update x64_vm-build-test.yml
xx
2023-07-16 20:48:49 -07:00
Stephane Bourque
8b64db3c7a Update x64_vm-build-test.yml
x
2023-07-16 20:48:17 -07:00
John Crispin
cd461e555e ucentral-schema: update to latest HEAD
9797d7e allow using a shared service->captive for multiple instances
ad7eb8e rename strict-isolation -> strict-forwarding
43c44c1 force spotfilter off prior to config apply
11fffcf captive: fix credentials configuration

Signed-off-by: John Crispin <john@phrozen.org>
2023-06-26 16:24:08 +02:00
John Crispin
9195806206 ucentral-event: rename strict-isolation -> strict-forwarding
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-26 16:20:14 +02:00
John Crispin
9621c21535 spotfilter: add a delay after setting up a captive portal
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-26 16:20:14 +02:00
John Crispin
f74cee802b uspot: fix rate limiting in captive portal/UAM
Fixes: WIFI-12305
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
Ken
0c7aecde9f ipq807x: CIG WF-186w / update uart pin setting for commucation between ble and soc
Fixes: WIFI-12679
Signed-off-by: Ken <xshi@actiontec.com>
2023-06-15 16:22:27 +02:00
John Crispin
9ab2f5ede9 ucentral-schema: update to latest HEAD
9637b4a disable bridger by default

Fixes: WIFI-12670
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
a7fe885dc5 radius-gw-proxy: improve header length sanity check
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
105e55c01a ucentral-schema: update to latest HEAD
48ee8f0 fix cpu core utilisation

Fixes: WIFI-12440
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
200b759d6f ipq807x: update ion4x_wp dts config
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
5da87dc07d uspot: fix a typo int he CHAP/PAP handler code
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
25f42bdcaf ucentral-schema: update to latest HEAD
47f39e9 cmd_upgrade: signature requirement was not properly detected

Fixes: WIFI-12675
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
43361d0ee7 ucentral-schema: update to latest HEAD
4ddcb12 properly indicate apply errors via an exit() call

Fixes: WIFI-12673
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
93a8a764a8 ucentral-schema: update to latest HEAD
eea75b3 do not enable vlan accounting for untagged interfaces

Fixes: WIFI-12674
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
1e515ed1e1 ucentral-schema: update to latest HEAD
04ce23b fix udevstats counters

Fixes: WIFI-12674
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
78388a8ecf ucentral-event: fix radius rate limiting
Fixes: WIFI-12665
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
1e1c286f06 ipq40xx: disable the unused container feed
Fixes: WIFI-12672
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
81f7d7d7ce ramips: enable vlan offloading
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-15 16:22:27 +02:00
John Crispin
2403eb2a87 ipq807x: do not bounce arp frames back in proxy_arp mode
Fixes: WIFI-12653
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-08 11:13:23 +02:00
John Crispin
5a686344e8 ipq807x: update wf-186 5GHz BDF
Fixes: WIFI-12656
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-08 06:32:38 +02:00
Thibaut VARÈNE
ff1214b1dc uspot: portal: avoid null dereference, always define ctx.ssid
This commit fixes a bug where the SSID value would be set to "unknown"
in spotfilter data when the hostapd call returned without SSID data; but
this value  was not propagated internally, resulting in a null value
being used in other parts of the portal code. Furthermore, if the
hostapd call returned null data, the spotfilter assignment correctly
handled this case but not the subsequent internal assignment, resulting
in a potential null dereference and crash.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-06 17:51:37 +02:00
Thibaut VARÈNE
cf8769e4b5 uspot: def_captive may not exist
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 19:28:38 +02:00
Thibaut VARÈNE
f770253a52 uspot: don't use CONNMARK
This commit removes CONNMARK marking of all authenticated clients
packets. In client_kick() we now delete all conntrack entries for the
client.

This simplifies firewall.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
bb4b7cb95c uspot: handler-uam: fix CHAP challenge
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
d3f4afd4a7 uspot: handler.uc: remove unused payload attribute
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
35e1cbd15b uspot: use a single fwmark
Default firewall rules apply to unauthenticated clients, there is no
need to specifically fwmark their packets. This reduces the firewall
complexity and makes very clear what happens "by default".

Add a preliminary README with a sample firewall illustrating this setup.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
cf2f80fd3c uspot: handle_request: abort on spotfilter error
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
56549a44ea uspot: rename accounting.uc -> uspot.uc
This file is run by /etc/init.d/uspot, uses /etc/config/uspot and
basically handles uspot state (beyond mere accounting).

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
59b3387ece uspot: handle client removal in accounting.uc
mirror the client_add call

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
1ebc3f59ba uspot: regroup ratelimiting start/stop under accounting
Avoid again having the init and exit stages of a specific subsystem
spread across multiple modules.

We no longer need to lowercase the MAC address and can use the
spotfilter native (uppercase) format for ratelimit calls.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
5d93a1ddc0 uspot: accounting: cleanup ratelimit rules on removal
When a client is removed, call ratelimit client_delete to remove any
lingering related bandwidth limits.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
5d0f75f68e uspot: handler: use Call-Check for MAC auth
Reading [1] and [2], it appears that the hard-coded value "2" is
incorrect and "10" should be used instead. [1] provides that:

  Checks for the presence of a Service-Type == 'Call-Check' AVP as an
  explicit indication that the NAS wants to do Mac-Auth.

"Call-Check" is defined in [2] as value 10.

[1]: https://wiki.freeradius.org/guide/mac-auth#web-auth-safe-mac-auth
[2]: https://freeradius.org/rfc/rfc2865.html#Service-Type

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
eeec28eb4a uspot: remove references to radius accounting
Now that accounting is entirely handled in accounting.uc, the rest of
the system no longer needs to carry around that information.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
1c38559cf0 uspot: handle accounting start in accounting.uc
This commit introduces an "acct_start" ubus endpoint for accounting.uc
that is used to register a new client and start accounting.

This moves the entirety of accounting management under accounting.uc,
instead of having e.g. the RADIUS Start call separate in handler-uam.uc.

Furthermore, accounting.uc no longer needs to poll for new clients: they
are now registered from portal.allow_client().

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
c9b2877de1 uspot: accounting: use provided nas_port_type
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
21d79d1a9e uspot: portal: increase sessionid uniqueness
RFC[1] says that Acct-Session-Id should be an UTF-8-encoded string.
Increase uniqueness by using hex values instead of decimal ones.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
95a7b6d54d uspot: accounting: implement Accounting-On/Off
The RFC[1] says about Acct-Status-Type:

    It MAY be used by the client to mark the start of accounting (for
    example, upon booting) by specifying Accounting-On and to mark the
    end of accounting (for example, just before a scheduled reboot) by
    specifying Accounting-Off.

The RFC errata[2] further specifies that Accounting-On and
Accounting-Off messages apply to the whole NAS.

The RFC also mandates that[3]:

    Either NAS-IP-Address or NAS-Identifier MUST be present in a
    RADIUS Accounting-Request.  It SHOULD contain a NAS-Port or NAS-
    Port-Type attribute or both unless the service does not involve a
    port or the NAS does not distinguish among its ports.

And[4]:

    An Accounting-Request packet MUST have an Acct-Session-Id.
    The Acct-Session-Id SHOULD contain UTF-8 encoded 10646 characters.

Finally the freeRADIUS recommendations here[5] suggest that:

 1. Acct-Status-Type = Accounting-On should not be used to indicate
    sub-system reboot.
 2. IANA should allocate two new values for Acct-Status-Type:
    Subsystem-On, and Subsystem-Off. These values have meaning similar
    to Accounting-On and Accounting-Off, except that they apply to a
    subystem of the NAS.
 3. NASes should use these new values to indicate subsystem on/off.
 4. The Called-Station-Id attribute should contain values unique to each
    subsystem.
 5. The NAS should signal that the entire system has rebooted by using
    the existing Accounting-On and Accounting-Off values, with a value
    for Called-Station-Id that is global to the NAS, or to omit it
    entirely.

In order to reconcile all this, this commit implements Accounting-On and
Accounting-Off requests as follows:

- When accounting.uc is started, it loops through each uspot interface
  and keeps track of the acct_server seen for each interface. Then for
  each interface that do not use a previously seen server, it generates
  a unique session ID, and sends an Accounting-On request to the
  RADIUS server, using this session ID and the configured NAS-ID.
- When accounting.uc stops, it sends an Accounting-Off request for each
  uspot interface for which an Accounting-On message was previously sent,
  using the same global session ID.

If/when the Subsystem-On/Subsystem-Off values are implemented, this
commit can be revisited to simply lift the restriction on unique servers
and change the acct_type value accordingly.

Finally, it appears that while NAS-ID is provided in the request thus
making NAS-IP unnecessary, libradcli still includes this field in the
request. Likewise, it also insists on sending a NAS-Port attribute.

[1]: https://datatracker.ietf.org/doc/html/rfc2866#section-5.1
[2]: https://www.rfc-editor.org/errata_search.php?rfc=2866
[3]: https://datatracker.ietf.org/doc/html/rfc2866#section-4.1
[4]: https://datatracker.ietf.org/doc/html/rfc2866#section-5.5
[5]: https://freeradius.org/rfc/acct_status_type_subsystem.html

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
a647368f15 uspot: accounting: allow radius calls from non-clients
In order to send RADIUS accounting requests at the NAS level (for e.g.
Accounting-On/Off), radius_init() and radius_call() are made to accept a
null mac argument.

For radius_call() we fall back to the acct_session value (which is
required to be present per RFC) to construct the temporary file name.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
97f641a16b uspot: accounting: quote syslog() logger argument
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
1252ca6778 uspot: accounting: use NAS-ID from settings
NAS-ID is a mandatory setting in configuration. This will be useful to
support Accounting-Off frames.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
e561f4a82e uspot: don't publish radius secrets
Now that accounting.uc no longer needs the per-client radius server
information, there is no reason to publish these sensitive secrets in
cleartext in spotfiler data.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
395e98dc66 uspot: accounting: build radius payload from settings
Address RADIUS accounting server from the global settings, and call
client_interim() only if accounting is globally enabled for that
interface.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
b5e33cec05 uspot: accouting: save interface-wide settings
Before this commit, interface-wide settings (mainly radius) were stored
per client, resulting in duplicate data.

This commit runs a first pass that renames the "clients" global variable
to "interfaces" which is expected to have the following content:

interfaces {
	settings {},
	clients {},
}

Thus the settings are stored per interface now, and the list of clients
belonging to that interface is stored within the object.

This change enables us to also remove direct calls to uci configuration
in the code and thus we no longer need to store it locally.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
ec924ea3d7 uspot: accounting: send RADIUS acct Stop on disconnect
If a client "disappears" from wireless, spotfilter eventually wipes
their state data before the accounting removal occurs. Thus in
radius_acct(), the ubus call returns empty and no RADIUS accounting Stop
frame is sent in this condition, leaving a dangling accounting for the
client.

This commit solves this issue by maintaining a local copy of the most
recent accounting data and sending that when the live data is no longer
available.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
e30cfbf36b spotfilter: move accounting totals to "acct_data" table
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
39510a6728 uspot: accounting: relax loop timer
For accounting purposes, a 10s resolution seems adequate. Accounting
session start is handled asynchronously in handler-uam.uc anyway.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
0abc0c17ff uspot: accounting: refactor interim reporting
Instead of running one timer per client, handle interim reports in the
main loop through a simple comparison between current time and expected
time of next report.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
3375803a26 uspot: accounting: add_client(): fix integer types
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
16e06ad7aa uspot: accounting: remove on logoff, reset on idle
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
a12f43e912 uspot: accounting: s/client_flush/client_reset/g
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
a6a9ef6c1b uspot: add nftables firewall snippet
This enables CONNMARK'ing allowed traffic, and is used by accounting to
selectively delete conntrack entries on client removal.

To be used with the following fw4 config:

config include
	option type 'nftables'
	option path '/usr/share/uspot/firewall.nft'
	option position 'chain-post'
	option chain 'mangle_postrouting'

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
866583625b uspot: accounting: local config overrides Acct-Interim-Interval
Per RFC: https://www.rfc-editor.org/rfc/rfc2869.html#section-2.1

   It is also possible to statically configure an interim value on the
   NAS itself. Note that a locally configured value on the NAS MUST
   override the value found in an Access-Accept.

Don't start the interim reporting timer if no interval is configured.

Also add the config option to the documented config template

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
4c272fe5f5 uspot: accounting: setup interim only when needed
There is no point in setting up the interim timer if the relevant radius
data is not available. Furthermore, the return value check would only
fail if the client was unknown to spotfilter at the query time, which
isn't a failure to *send* data.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
45def78972 uspot: accounting: coalesce radius stop requests
Define constants for terminate causes, see:
https://www.iana.org/assignments/radius-types/radius-types.xhtml#radius-types-12

Use "Lost Carrier" for disconnected client (matching Chilli).

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
f1c4a39540 uspot: accounting: correctly handle ipv4/v6 conntrack
Only run conntrack deletion on defined client IP(s) and process both
IPv4 and IPv6.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
a9df4b8549 uspot: accounting: use variables instead of function calls
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
4d8bc3c5bd uspot: accounting: client timeouts are always defined
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
245b062db8 uspot: accounting: fix loop logic
When looping through known clients:
- removal of client in spotfilter list is checked first
- checks for known client existence are redundant by construction

Also format the max_total check similarly to the timeout one

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
c6d07ca178 uspot: accounting: use explicit variable names
And avoid enumerating unused values in k,v pairs

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
60c708dce9 uspot: accounting: s/radius_stop/client_kick/
radius_stop() had nothing to do with RADIUS.
Simplify the function prototype by handling spotfilter args internally.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
dfdf25834c uspot: accounting: remove redundant function
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
1e82a24192 uspot: accounting: radius_stop(): reduce args redundancy
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
ce20be0b3b uspot: accounting: config[interface] is always defined
By construction:
- interface is one of clients[] keys
- clients[] is built from config uspot 'interface'

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
3e483bd524 uspot: accounting: avoid redundant assignments
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
1cded2e983 uspot: radius: regroup redundant checks
Clarifies intent.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
3219fceb48 uspot: move RADIUS NAS_PORT_TYPE to portal.uc
Currently still hardcoded to "19" aka Wireless.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
78c7a3cbfa uspot: handler-uam: improve auth-client()
Simplify the query string parsing logic, allow empty password.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
0a390bea0b uspot: rename common.uc -> portal.uc
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
cad21f394e ucentral-tools: remove dictionary.CoovaChilli
This dictionary uses vendor 14122, which is the WISPr vendor code. The
first few attributes defined in this dictionary as integers masked their
WISPr string counterparts, resulting in truncated attributes in RADIUS
requests.

From a quick Google Search, there is no CoovaChilli RADIUS vendor ID, it
seems to use the ChilliSpot ones:
https://support.ignitenet.com/portal/en/kb/articles/what-are-the-supported-radius-attributes-in-coovachilli-captive-portal

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
3384986bef uspot: support ChilliSpot radius ratelimits
This commit introduces a helper function "ratelimit_client()", invoked
from allow_client(), which parses the radius reply for known
ratelimiting attributes:

- WISPr-Bandwidth-Max-{Up,Down}
- ChilliSpot-Bandwidth-Max-{Up,Down}

WISPr attributes are expressed in bits/s, ChilliSpot in kbits/s.

If none of the attributes are present, the function is a NOP.
If any of the -Up or -Down is missing, the corresponding limit is not
set. NB: ratelimit currently does not support setting only up OR down
ratelimiting if defaults are not set.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
Thibaut VARÈNE
23073a8ae5 uspot: captive: restart(): include uspot accounting
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-06-05 13:19:19 +02:00
John Crispin
3ab700de32 ipq807x: fix yuncore fap655 filename
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-04 18:04:41 +02:00
John Crispin
454856e5c2 ipq807x: always power on phys when an interface is started
Fixes: WIFI-12648
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-04 17:14:18 +02:00
John Crispin
7e4030c0bc ipq807x: add yuncore fap655 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-04 12:36:46 +02:00
John Crispin
1deab06c09 ucentral-schema: update to latest HEAD
1279e7c fix section names for swconfig devices

Signed-off-by: John Crispin <john@phrozen.org>
2023-06-04 12:34:24 +02:00
John Crispin
a4bc2913e1 ipq807x: add edgecore OAP101e support
Fixes: WIFI-12617
Signed-off-by: tanya.singh <tanya.singh@4ipnet.com>
2023-06-01 10:06:39 +02:00
Ken
87dbd3e289 ipq807x: various improvements for CIG-WF-186w
1. Using rtl8367c.c file for rtl8367S switch driver  to support vlan 
2. Configure eth0.1 as WAN and eth0.2 as LAN
3. Add mdio read/write in smi driver  followed 5.4 kernel driver
4. add mido clock setting followed 5.4 kernel driver for 186w board
5. Add eth and wifi mac address allocation based of BaseMacAddress
6. Update new bdf for 2G radio

Fixes: WIFI-12650
Signed-off-by: Ken <xshi@actiontec.com>
2023-06-01 08:58:14 +02:00
John Crispin
3f79bc76ac ucentral-schema: update to latest HEAD
137615d add vlan_id to uci sections

Signed-off-by: John Crispin <john@phrozen.org>
2023-06-01 08:58:14 +02:00
John Crispin
4820218fc2 netifd: backport 2 status fixes
Fixes: WIFI-12513
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-01 08:58:14 +02:00
John Crispin
b30bcf501a ramips: fix fap640 mac addresses
Signed-off-by: John Crispin <john@phrozen.org>
2023-06-01 08:58:14 +02:00
John Crispin
d9e62da73d ucentral-client: update to latest HEAD
feadd83 handle configuration load/parse error

Fixes: WIFI-12380
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
404a3a4813 ucentral-schema: add strict-isolation example
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
e9f5aec955 ucentral-schema: update to latest HEAD
c3d8380 add new dhcp-relay render code
a39410a remove old dhcp-relay code

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
9eada6166c ucentral-event: add dhcp-relay support
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
e8875a7375 ucode: backport uci.foreach fix
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
33c4c732c9 dnsmasq: drop old option 82 patch
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
2c8e736fa8 ucentral-schema: update to latest HEAD
84f53b2 add strict_isolation support

Fixes: WIFI-12577
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
e18d485bdc ucentral-schema: update to latest HEAD
11d7374 always set the developer mode flag when generating capabilities

Fixes: WIFI-12270
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
a1678619be ucentral-client: update to latest HEAD
ffd9d6f indicate crashlog inside the connect reason

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
eec945417d ucentral-schema: upodate to latest HEAD
3afde47 fix generation of bridger block list

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
cd3fb41eb0 ipq807x: update wf196ca 6G BDF file
Fixes: WIFI-12538
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
0445caf2b8 ipa807x: various fixes for wf186
Fixes: WIFI-12616
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
Venkat Chimata
3bb4304fe4 cybertan: Specify correct images in cybertan profiles
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2023-05-30 07:56:09 +02:00
Venkat Chimata
2edf5d750c cybertan: Fix build issues with Cybertan APs
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2023-05-30 07:56:09 +02:00
John Crispin
89d1213f39 ucentral-client: update to latest HEAD
cb5030f crashlog->rebootlog

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
3eb13481c9 ucentral-schema: update to latest HEAD
27b1d45 cmd_upgrade: create /ucentral.upgrade
7109e62 add captive portal devices to the bridger block list

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
e2ffc6650c bridger: re-enable inside default images
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
42be849af8 generic: use latest kernel headers when building eBPF tools
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
Felix Fietkau
d9adc8f7a1 hostapd: fix double free in coa-multi patch
Fixes: WIFI-12586
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-30 07:56:09 +02:00
John Crispin
399f862bb9 ipq807x: various cig,wf660a improvements
* fix wifi macs
* reset button had the wrong polarity

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
e73633402c ipq807x: whitespace cleanup
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
Felix Fietkau
acc3d67cff wifi-ax: fix mac80211 crash when dealing with AP vlans
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-30 07:56:09 +02:00
John Crispin
c3ab147246 ucentral-schema: update to latest HEAD
694fd64 convert vlan_ifaces to an array

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
8cbc9e4fb1 bridger: do not include in builds until it is used
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
John Crispin
3fc4414a84 uspot: fix compile error in radius.c for older GCC
/openwrt/build_dir/target-arm_cortex-a7_musl_eabi/uspot/radius.c:264:4: error: label at end of compound statement
    default:
    ^
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
5d7650a69c uspot: radius.c: use rc_apply_config()
This is required per documentation and may result in segfault if not
used.
Also remove the "servers" settings which is unnecessary in the context
of a single server.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
e4d81ee5b9 uspot: add support for radius location name
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
8ec07e0588 uspot: partial rewrite of radius-client
Streamline the code to make it easier to extend supported attributes,
and to clarify code flow. Improve error checking.

Add licensing information (with permission from John Crispin, original
author).

NB: a few things are still hardcoded toward the end of radius(), to be
revisited.

Cc: John Crispin <john@phrozen.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
8262342e1c uspot: initial documentation of config options
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
a7341b418e uspot: introduce mac_passwd and mac_suffix options
This carries over two Chilli options used during mac authentication:

- macpasswd, which sets a static password when performing mac-auth
- macsuffix, which allows suffixing the mac address provided as username

These options are implemented in config uspot section as:

- option mac_passwd 'password'
- option mac_suffix 'suffix'

If unset, this commit is a NOP.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
fc80a4aa84 uspot: radius_call: unlink tmp file after exec
If debug is disabled, this commit deletes the temporary json files
passed to radius-client.

Furthermore, to reduce the risk of collision, use a different prefix in
accounting.uc ('uacct') vs common.uc ('acct').

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
db37e3727d uspot: captive: honor 'debugoff'
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
d667c2e2b9 uspot: correctly honor "debug=0" configs
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
b7f8c7e788 uspot: accouting: spell out config load failure
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
243f42454f uspot/spotfilter: implement captive generate
For basic uspot setups, this commit implements a 'generate' verb to
uspot /usr/bin/captive that takes a config uspot section name, and
parses the following extra options to generate the relevant spotfilter
config:

  option generate_spotfilter (bool) # if unset/false, generate is a NOP
  option interface 'name' # config/network interface name to redirect to
  option client_autoremove (bool) # if set/true, sets client_autoremove
  list wl_hosts '*.example.com' # optional list of whitelist hostnames
  list wl_addrs '1.2.3.4' # optional list of whitelist IPs

"captive generate" is called in spotfilter.init to optionally (depending
on 'generate_spotfilter') create the required spotfilter-XXX.json before
starting spotfilter.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
74651831ef uspot: configure devices ifnames in section uspot
The current uspot config uses a single named section to assign ifnames
to uspot interfaces like so:

config devices 'devices'
	option wlanc0 'hotspot1'
	option wlanc1 'hotspot1'

Where 'wlanc0' and 'wlanc1' are physical ifnames.

Code in common.uc also hardcodes a check to match ifnames with 'wlanc*'.

This comit gets rid of the "config device" sections and accepts in the
"config uspot" sections e.g.:

	option ifname 'wlanc0'
or
	list ifname 'wlanc0'
	list ifname 'wlanc1'

The listed devices are then associated with the current uspot config
exactly as they were with the previous configuration system.

The hardcoded check in common.uc is also removed, allowing arbitrary
ifnames to be used.

Malformed sections are ignored with a warning. Subsequent duplicate
entries for a given ifname are be ignored with a warning.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
b44c7b09db uspot: track client sessionid and provide it to UAM
This commit moves session id creation outside of radius_init() and
stores the identifier in ctx and client data, making it available to
various handlers.

The id is added to the list of uam_url parameters to be sent to the
backend.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
ecc8829a01 uspot: handler: correctly honor mac_auth setting
Suggested-by: John Crispin <john@phrozen.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
8029c318d0 uspot: handler-uam: stop processing after error
The current code would still issue a radius request after showing the
error boilerplate.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
16cf91b3d2 uspot: fix malformed hex string and buffer overflow
Because _md[32] is defined as "char" instead of "unsigned char" in
uc_md5() and sprintf() is used instead of snprintf(), the resulting
string can be malformed (padded with FF for negative values) and
can overflow the target buffer, producing strings like:

21FFFF0D12FFFF6A48651050FFFF4CFFFFFFBA
FFFFFF16FF3EFF7C6560FFFF6BFFFFFFFFFFE7

The same issue affects the hex_to_str() helper function which uc_md5()
does not use.

This commit addresses these issues by:
- refactoring hex_to_str():
  - accept a const void * input buffer internally cast to uchar
  - use snprintf() and the correct format length modifier 'hh'
- use hex_to_str() in uc_md5()
- adjust uses in other callers to pass sizeof(inbuf)/2 instead of a
  hardcoded number

str_to_hex() is also refactored with the same guidelines to simplify the
code and minimally address sscanf() failures by ending conversion.

While there, document these two helpers.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
7bbad0ed50 uspot: handler-uam.uc: use ctx.config.uam_port/logoff
Remove hardcoded port and specify the actual logoff request endpoint.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:09 +02:00
Thibaut VARÈNE
c89b054324 uspot: accounting.uc: fix typo
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:08 +02:00
Thibaut VARÈNE
e2abfd7b72 spotfilter: adjust DEPENDS
Add missing kmod-ifb
Remove unused kmod-sched-cake

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:08 +02:00
Thibaut VARÈNE
e55abc109c uspot: fix missing DEPENDS
Add missing:
- ratelimit
- ucode-mod-math
- ucode-mod-nl8011
- ucode-mod-rtnl
- ucode-mod-uloop

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
2023-05-30 07:56:08 +02:00
John Crispin
7d68d6d5c3 ucentral-schema: update to latest HEAD
e30b05f propagate reboot_cause
11dff2a add dynamic vlans to state messages
505ac1a fix captive uci code for latest captive PR

Fixes: WIFI-12590
Fixes: WIFI-12582
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
d16b3d6919 ucentra-client: update to latest HEAD
cca938b send connect reason

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
e91f49bdbd udevstats: add support for dynamic vlans
Fixes: WIFI-12582
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
4688ba6996 bridger: add new package
Fixes: WIFI-12577
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
Venkata Chimata
4a6bc07d61 ipq50xx: Addp support for Cybertan EWW631-A1 and EWW631-B1 APs
EWW631-A1 (Ceiling mount)

Specifications are:

* CPU: Qualcomm IPQ5018
* RAM: 512 MB
* Storage:  256MB NAND-optional.
* Ethernet: 1x GbE
* UART header
* WLAN: 2.4GHz: IPQ5018, 5GHz:  QCN6102
* 3x LED-s à R/G/B PWM control

 Installation instructions:
Connect to UART, pins are like this

XA/XB PCBA UART :
PIN #5   |  #4 |  #3  |  #2  |  #1
GND | x | RX | TX | VCC

XC PCBA UART : (next version hardware board)
PIN  #4  |   #3  |  #2   |  #1
GND | RX | TX | VCC

Settings are 115200 8n1

1. Copy openwrt-ipq807x-cybertan_eww631_a1-squashfs-nand-factory.bin onto the board into /tmp/
2. At board's command prompt, issue sysupgrade -n /tmp/openwrt-ipq807x-cybertan_eww631_a1-squashfs-nand-factory.bin

-----------------------------------------------------------------------

EWW631-B1 (Wall mount)

Specifications are:

* CPU: Qualcomm IPQ5000
* RAM: 256 MB (IPQ5000 inside)
* Storage:  256MB NAND-optional.
* Ethernet: 4x GbE
* UART header
* WLAN: 2.4GHz: IPQ5000, 5GHz:  QCN6102
* 3x LED-s à R/G/B PWM control

Installation instructions:
Connect to UART, pins are like this

Fixes: WIFI-12579
Signed-off-by: Venkata Chimata <venkata@shasta.cloud>
2023-05-30 07:56:08 +02:00
John Crispin
6f5f7bf068 ipq807x: fix reset button on wf666a
Fixes: WIFI-12591
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
5b27dc31fc ipq807x: fix dualboot on emmc flash chips
Fixes: WIFI-12537
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
d9d0ae77e9 ipq807x: turn bootconfig into a module
Fixes: WIFI-12537
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
a195b9e316 ucentral-schema: update to latest HEAD
689b111 make crashlog handler generic for pstore items

Fixes: WIFI-12590
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
e211647656 ucentral-schema: update to latest HEAD
5d8e9b0 add boot time to the state message

Fixes: WIFI-12593
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
64b248fad1 ipq807x: various improvements to cig,wf660a
Fixes: WIFI-12592
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
d792176347 ucentral-schema: update to latest HEAD
4b86496 fix generation of upgrade.tgz

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
John Crispin
5bd7b4bc51 ucentral-schema: update to latest HEAD
c112a0c rtty: allow configuration of the mutual tls feature

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-30 07:56:08 +02:00
Felix Fietkau
929ca004c4 ipq807x: backport act_pedit changes
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-08 12:19:38 +02:00
John Crispin
848b09b6e1 ucentral-schema: update to latest HEAD
37d7a26 add per core cpu_load to the state message

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-08 10:56:18 +02:00
John Crispin
1061890189 ucentral-client: update to latest HEAD
5597621 improve the logic that detects stale gateway connections

Signed-off-by: John Crispin <john@phrozen.org>
2023-05-08 10:56:18 +02:00
Kishan Shukla
39b1211541 ipq807x: Add ION4XI_WP support
Fixes: WIFI-12581
Signed-off-by: Kishan Shukla <kishan.shukla@hfcl.com>
2023-05-08 10:56:18 +02:00
Piotr Dymacz
08e976af26 ipq807x: include support for dual-image in YunCore AX840
This adds support for dual-image ('rootfs' partitions rotation), for
the YunCore AX840 board. Implementation details are included in the
'base-files' patch this commit adds:

  0060-base-files-minimal-support-for-QCA-runtime-failsafe.patch

Fixes: WIFI-12537
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-05-08 10:56:18 +02:00
Piotr Dymacz
b89ba787fe ipq807x: enable BOOTCONFIG partition support in kernel
This is required for dual-image support ('rootfs' partitions rotation)
used for example on the YunCore AX840.

Fixes: WIFI-12537
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-05-08 09:16:32 +02:00
John Crispin
1548fac62a ipq807x: add dosilicon nand flash support
Fixes: WIFI-12580
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-06 09:21:12 +02:00
John Crispin
3dafdff716 ipq807x: make pstore/pmsg work
Fixes: WIFI-12578
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-04 12:57:52 +02:00
John Crispin
5cd786fb9a ucentral-event: do not flush rate-limit on captive interfaces
Fixes: WIFI-12305
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-04 09:09:21 +02:00
John Crispin
be67c7fa07 ucentral-client: update to latest HEAD
a94e2df added the support to remove old public IP file once it is connected successfully to controller

Fixes: WIFI-12474
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-03 08:57:09 +02:00
John Crispin
5f3f788955 ucentral-client: update to latest HEAD
c500514 reduce PING interval to 60s

Fixes: WIFI-12573
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-02 18:49:35 +02:00
John Crispin
8667eecdcf ucentral-schema: update to latest HEAD
0af4f34 Added support of retrieval of public IP if not existed and reporting in state msg

Fixes: WIFI-12474
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-02 17:46:43 +02:00
John Crispin
47b396873b ucentral-schema: update to latest HEAD
99cd625 captive: allow mutliple instances

Fixes: WIFI-12366
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-02 17:42:17 +02:00
John Crispin
74dd8fc89e uspot: add support for multiple captive portals
Fixes: WIFI-12366
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-02 17:42:17 +02:00
John Crispin
2a75855f23 ucentral-schema: update to latest HEAD
f2a7137 add roaming 'auto' button to data model

Fixes: WIFI-12570
Signed-off-by: John Crispin <john@phrozen.org>
2023-05-02 17:42:17 +02:00
John Crispin
7895a40487 ipq807x: disable GRO by default
Fixes: WIFI-12526
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-25 16:20:54 +02:00
John Crispin
1f9a41b386 mac80211/ath11k: fix num_iface_combinations
Fixes: WIFI-12019
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-24 17:51:34 +02:00
John Crispin
efb57bcc5a ucentral-schema: update to latest HEAD
d7dbe23 allow passing hex values as radius request attributes

Fixes: WIFI-12534
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-24 08:21:07 +02:00
John Crispin
70cdfe7103 ipq807x: update 6G CA BDF
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-12 06:57:02 +02:00
John Crispin
082e96d546 ip807x: fix ath11k-fwtest on cig wf196
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-12 06:57:02 +02:00
John Crispin
3aa1ff70bb certificates: add a mount_cert helper script
Fixes: WIFI-12461
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-12 06:57:02 +02:00
John Crispin
28623fb4b3 ucentral-schema: update to latest HEAD
b918e6a state: some devices will report temperature in milli celssius

Fixes: WIFI-12500
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-12 06:57:02 +02:00
John Crispin
e35aacca4b profiles: update profiles to allow v4.4 and v5.4 to co-exist in CI
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-12 06:57:02 +02:00
John Crispin
91e3140f5a .github/workflows: add additional CI jobs
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:49 +02:00
Ken
5c84541011 ipq807x: Add WF-186w support
Add WF-186w support

Signed-off-by: Ken <xshi@actiontec.com>
2023-04-10 14:25:48 +02:00
John Crispin
b9b03a6e38 ipq95xx: add Qualcomm wifi-7 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
3b6582117b ipq807x: add ath12 / v5.4 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
50cbd4688b ipq807x: make v4.4 and v5.4 co-exist
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
354089a7f2 base-files: fix target feeds
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
f669fdaddc cleanup: drop obselete code
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
267147f971 edgecore: add TPM support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
63e8acadfc bluetooth-cc2652: update feed to latest version
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00
John Crispin
690d7655a0 ucentral-event: fix dynamic vlan for devices where the WAN port is not eth0
Fixes: WIFI-12372
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:22 +02:00
jaspreetsachdev
52c39cd3bf Merge pull request #539 from Telecominfraproject/staging-fix-nns-feed
ipq807x: fix qca-nss-clients feed
2023-04-01 08:05:35 -04:00
Arif Alam
ebd7c79e65 ipq807x: fix qca-nss-clients feed
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2023-03-31 18:36:56 -04:00
Piotr Dymacz
560e9f326d mcu: fix host support for multi-slot UART based MCUs
In case of MCU with multiple firmware slots support, change of active
slot requires reset. This obviously results in MCU entering the serial
recovery mode in bootloader, with 5 sec timeout, which in case of UART
based MCUs isn't automatically detected and handled in the same way as
USB based devices (hotplug).

Starting host side support script when the MCU is waiting for MCUmgr
commands during recovery is wrong. This fixes the problem by requesting
UART based MCU to boot the firmware after active slot change followed by
reset. While at it, change also how single slot type MCUs are handled
during upgrade (always request reset after the upgrade).

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-23 08:06:42 +01:00
John Crispin
3da1530926 ratelimit: SSIDs with spaces failed to be configured
Fixes: WIFI-12421
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-23 07:39:11 +01:00
Arif Alam
abcf6dd1fd ipq807x: fix mac address assignment
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2023-03-21 07:57:13 +01:00
Chaitanya Kiran Godavarthi
2bcedafe0d ipa807x: generate an ath11k-macs file on eap104
Signed-off-by: Chaitanya Kiran Godavarthi <chaitanya.kiran@netexperience.com>
2023-03-21 06:23:39 +01:00
Piotr Dymacz
c0cf066900 mcu-firmware: include host support for 'hci_uart' firmware
This includes shell script for host side support of the 'hci_uart' MCU
firmware type. The script calls 'btattach' with matching tty interface
and baud rate as arguments, resulting in new Bluetooth HCI controller
registration in the system. Both UART and USB interfaces are supported.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
Piotr Dymacz
6462efd6bc mcu: execute host side support script for firmware type
This adds support for executing a host side support script per firmware
type (in our case, full MCU firmware name is a combination of two terms:
'version__type', e.g. 'zephyr-v3.3.x__hci_uart') which currently runs on
the MCU. Additionally, support for calling the init script with 'stop'
argument is included.

The host side support scripts will be placed in '/etc/mcu.d/' and should
have executable flag set and be named after the firmware type, with 'sh'
extension (e.g. 'hci_uart.sh'). This solution assumes also that PID of a
running, related service will be stored in '/var/run/mcu.SN.pid' where
'SN' is the associated MCU serial number.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
Piotr Dymacz
0bce7dc7a4 mcu-firmware: update 'zephyr-main' to 'cf50a3c570bb' (2023-03-10)
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
Piotr Dymacz
a3f0fb23b7 mcu-firmware: add support for host side support packages
In case of some of the MCU firmware types, additional setup on the host
side is required before the target application can be used. Example of
such a requirement is a BLE HCI controller on UART bus (firmware type:
'hci_uart') which, before can be registered in system, needs to be
attached to Bluetooth stack (with e.g. 'btattach').

This includes code for generating hidden packages under 'mcu-firmware'
with all the files required for host side support (stored in directory
with the same name as firmware type, under local 'files' directory),
for a selected MCU firmware. For example, below tree:

  ./feeds/mcu/mcu-firmware/files/hci_uart/etc/...

would result in creation of new package 'zephyr-hci_uart-host-support',
included in dependencies lists for all MCU firmware versions of the
'hci_uart' type, with everything from '.../files/hci_uart/'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
Piotr Dymacz
b9d20e083c mcu: simplify and fix 'mcu.sh' and 'mcu.hotplug' scripts
This reduces amount of helper functions and fixes also global variables
handle inside 'mcu.sh' and 'mcu.hotplug' shell scripts. While at it,
provide additional debug information when fetching images list and
system information.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
Piotr Dymacz
725899248a mcu: update MCU if firmware hash doesn't match
This includes simple upgrade (downgrade) capability in the MCU support
package. If hash of firmware installed on the MCU doesn't match the one
available on host's local file system, it will get upgraded.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-20 08:26:50 +01:00
John Crispin
c8685f2352 ucentral-schema: update to latest HEAD
caac3f1 add support for secondary radius server

Fixes: WIFI-11979
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-20 08:26:35 +01:00
John Crispin
7d10d77e35 udevmand: update to latest HEAD
979aca4 mac addresses were never flushed

Fixes: WIFI-11973
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-16 17:08:59 +01:00
John Crispin
96c391eaac ucentral-event: fix captive portal rate-limiting
Fixes: WIFI-12305
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-16 17:08:14 +01:00
John Crispin
c700795895 ipq807x: add cig_wf660a to the CI workflow
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-16 08:30:28 +01:00
John Crispin
8bcb4c2063 ucentral-schema: update to latest HEAD
59c8214 hostapd parses psk-files in reverse order

Fixes: WIFI-12383
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-15 18:23:28 +01:00
John Crispin
ea95356ebd rtty: improve patch indenting
Newer version of GCC complained about inconsistent indenting.

Signed-off-by: John Crispin <john@phrozen.org>
2023-03-15 09:56:09 +01:00
Piotr Dymacz
8111566f35 feeds: ucentral: include BlueZ 5.66
Copy 'bluez' package from OpenWrt's packages master branch to 'ucentral'
feed so that we can use latest version and add custom, local changes.

Keep this within 'ucentral' feeds directory to override version provided
by community based 'packages' feed from OpenWrt 21.02.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-14 15:53:43 +01:00
John Crispin
c952b34858 ucentral-schema: update to latest HEAD
54453a6 cmd_script: custom scripts with no uri failed to send the stdout to the server

Fixes: WIFI-12358
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-14 14:52:23 +01:00
John Crispin
792e3a8a2e rtty: throttle the amount of data being pushed to the server
The socket died when too much data was sent too fast

Fixes: WIFI-12334
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-14 14:41:08 +01:00
John Crispin
ae75067938 ucentral-schema: default to 32 STA max assoc if the driver does not report a valid value
Fixes: WIFI-12355
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-13 15:03:24 +01:00
John Crispin
81b66ad44b dnsmasq: fix handling of option 38
Fixes: WIFI-12260
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-13 11:55:28 +01:00
John Crispin
e193250291 ucentral-schema: update to latest HEAD
5e08879 add additional event types

Signed-off-by: John Crispin <john@phrozen.org>
2023-03-13 07:49:54 +01:00
Piotr Dymacz
dc0dae6284 mcu: select host dependencies based on MCU firmware type
In case of some types of MCU firmware, additional tools, daemons, kernel
drivers, etc. are required on the host side. For example, for Bluetooth
HCI controller, at least kernel module and BlueZ should be included.

This adds a simple recipe which generates dependencies list per firmware
type/name and for existing 'hci_usb' and 'hci_uart', selects 3 packages:
'bluez-daemon', 'kmod-bluetooth' and 'kmod-crypto-user'.

Kernel crypto interface in user space has to be also included because
the BlueZ isn't able to create static address for LE-only controller
without it, which results in no registration of new BT interface:

  bluetoothd[668]: src/adapter.c:get_static_addr() Failed to open crypto
  bluetoothd[668]: No Bluetooth address for index 0

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-10 12:11:06 +01:00
John Crispin
7c535de60d ucentral-schema: update to latest HEAD
204341f state: add port_id and port_desc to lldp state

Fixes: WIFI-11975
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-09 16:40:58 +01:00
John Crispin
26192989cd ipq807x: add CIG WF196 BDF
split the image into 2 SKUs for CA/US.

Fixes: WIFI-12357
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-09 15:14:36 +01:00
John Crispin
317aaadcbd ucentral-schema: update to latest HEAD
0f40765 turn telemetry and realtime filter into an enum

Signed-off-by: John Crispin <john@phrozen.org>
2023-03-08 17:35:43 +01:00
Satya-sc
c670733ea5 ucentral-event: added support to queue the events when there is no ucentral client is running and send those once it is available
Signed-off-by: Satya-sc <Satya@shasta.cloud>
2023-03-08 17:20:21 +01:00
John Crispin
f92617f24a ipq807x: add zephyr specific profiles
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-08 17:18:53 +01:00
Piotr Dymacz
337a68cf1d mcu: ipq807x: add support for CIG WF-196
This includes default configuration for the on-board Nordic nRF52833 MCU
in CIG WF-196. A Zephyr based sample 'hci_uart' firmware is selected.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
e09633fc2a ipq807x: add Zephyr HCI UART MCU firmware to CIG WF-196
Include Zephyr v3.3.x based Bluetooth LE HCI UART firmware package in
default packages list for the CIG WF-196. This brings initial support
for the on-board nRF52833 MCU.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
d838391850 profiles: cig_wf196: include 'mcu' feed
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
d59e58b794 mcu: ipq807x: add support for EdgeCore EAP102
This includes default configuration for the on-board Nordic nRF52840 MCU
in EdgeCore EAP102. A Zephyr based sample 'hci_usb' firmware is selected.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
ee7bf9671a ipq807x: add Zephyr HCI USB MCU firmware to EdgeCore EAP102
Include Zephyr v3.3.x based Bluetooth LE HCI USB firmware package in
default packages list for the EdgeCore EAP102. This brings initial
support for the on-board nRF52840 MCU.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
c4f0f367bc profiles: edgecore_eap102: include 'mcu' feed
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
5f649ea1f4 mcu-firmware: include firmware based on latest Zephyr
This adds Zephyr firmware builds from custom git branch based on the
latest's upstream branch name 'main': 'main__mcu-on-wifi-boards'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
397c6df34a feeds: mcu: introduce 'mcu-firmware' package
The new 'mcu-firmware' package will provide binary firmware dedicated
for MCU embedded on Wi-Fi boards (and also standalone, e.g. USB based),
supported by the OpenWrt/OpenWiFi projects. Currently, only Zephyr RTOS
based sample firmware ('BLE HCI controller' and 'hello world') files are
provided, for Wi-Fi boards and one standalone development module, listed
below:

- CIG WF-196 (Nordic nRF52833, UART bus)
- EdgeCore EAP102 (Nordic nRF52840, USB bus)
- Nordic nRF52840 Dongle (Nordic nRF52840, USB bus)

Different firmware types planned in future include Nordic's nRF Connect
SDK, OpenThread and others.

The Zephyr based firmware comes from a custom fork available in GitLab:
'https://gitlab.com/pepe2k/zephyr' (firmware in this package were built
from a v3.3.0 release based branch 'zephyr-v3.3.x__mcu-on-wifi-boards').

MCU firmware from this package is compatible only with OpenWrt/OpenWiFi
generic MCU support stack which, among others, assumes availability of
compatible bootloader (MCUboot is currently the only one supported) and
e.g. multiple firmware slots. MCUboot fork development takes part in git
repository hosted in GitLab: 'https://gitlab.com/pepe2k/mcuboot/'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
7a37e9bf0b mcu: support default configuration with uci-defaults
This adds support for creating initial MCU configuration with use of
'uci-defaults' in a same was as for example 'uboot-envtools' package.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
e4ed881dd7 mcu: support OpenWiFi with uCentral
On device running OpenWiFi with uCentral, additional copy of the initial
UCI configuration will be generated in '/etc/config-shadow/'. As part of
the MCU configuration is done during runtime, after the 'config-shadow'
is created, we should update it as well to keep everything in sync.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
9aff26b7fb mcu: provide example UCI configuration file
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
5603442a37 feeds: mcu: introduce 'mcu' package
This introduces new package 'mcu' which is a collection of shell based
scripts used as glue code for generic MCU configuration and management.

The scripts are responsible for communicating with embedded MCU running
compatible MCUboot bootloader version over MCUmgr/SMP protocol.
The communication is realized based on usage of the introduced earlier
dedicated CLI tool called 'umcumgr.

The most important function of this package is a simple MCU's firmware
management (checking firmware available in the MCU's internal flash,
uploading new and selecting active on multi-firmware slot capable MCU).

This solution requires MCU running modified version of MCUboot,
available in GitLab: https://gitlab.com/pepe2k/mcuboot

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Piotr Dymacz
8a86ae3b7d feeds: add mcu feed with 'umcumgr' package
The 'umcumgr' is a simple command line tool for MCU firmware management
over MCUmgr/SMP protocol. It will be used together with MCUboot running
on the on-board (or external, e.g. in form of a dongle) MCU.

While at it, add also dedicated 'mcu.yml' profile file.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-07 11:08:39 +01:00
Ken
9997af10a5 CIG WF-660A : Add WF-660a support [patch 3]
Fixed caldata.bin can NOT be generated with EMMC issue.
2023-03-06 10:41:39 +01:00
John Crispin
5fec90d4ca uspot: fix userurl and allow cleartext password
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-06 09:37:17 +01:00
Piotr Dymacz
f1a56edd09 ipq807x: backport some additional fixes for Bluetooth
This backports more fixes for the Bluetooth subsystem from 4.9.
They were found missing during some initial Bluetooth LE testing.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-02 16:43:05 +01:00
Piotr Dymacz
3f03cfa7c4 ipq807x: backport fix for Bluetooth LE-only HCI controllers
This backports an essential fix for Bluetooth LE-only HCI devices from
kernel 4.9: 39385cb5f327 ("Bluetooth: Fix using the correct source
address type").

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-02 16:43:05 +01:00
John Crispin
f34db0bb24 ucentral-schema: update to latest HEAD
5517c1c wifiscan: add additional options to the periodic scan feature

Fixes: WIFI-11993
Signed-off-by: John Crispin <john@phrozen.org>
2023-03-01 17:36:38 +01:00
John Crispin
94d154c628 qca-ssdk: reduce log noise
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-28 16:08:59 +01:00
John Crispin
071962440e ucentral-schema: update to latest HEAD
5287f72 fix wifiscan channel

Fixes: WIFI-11993
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-28 12:21:17 +01:00
John Crispin
5171b52570 hostapd: do not use ubus return codes as auth/assoc errors
Fixes: WIFI-12330
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-27 13:06:32 +01:00
John Crispin
fb282e2aff qca-ssdk: fix UE Roaming between vlans
Fixes: WIFI-11886
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-27 11:52:40 +01:00
John Crispin
5013b9c7fe ipq807x: update WF196 BDF files
Fixes: WIFI-12333
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-24 15:14:50 +01:00
John Crispin
0e2fcfcb95 ucentral-schema: update to latest HEAD
86dc187 the developer mode indication should be in the top level of the capa dictionary
f4aca9b indicate secure-rtty by default

Signed-off-by: John Crispin <john@phrozen.org>
2023-02-24 15:08:32 +01:00
John Crispin
a7ea6ef398 ucentral-event: fix ubus notification and band detect
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-24 15:06:56 +01:00
John Crispin
b4a2291dce ucentral-event: fix boot detection
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-23 11:35:49 +01:00
John Crispin
9348c426e5 ipq807x: fixup yuncore fap650 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-23 09:21:12 +01:00
John Crispin
678c4db8f0 ucentral-schema: update to latest HEAD
35cf7bf add more verbose error code to the script command

Signed-off-by: John Crispin <john@phrozen.org>
2023-02-22 15:21:29 +01:00
John Crispin
e979df64d1 ucentral-schema: update to latest HEAD
2ee157f fix health.uc: the events patch left a stray sprintf( breaking compile
ac9e8cf capabilities: add developer mode info to restrictions

Signed-off-by: John Crispin <john@phrozen.org>
2023-02-22 10:57:41 +01:00
Ken
43fa167f14 ipq807x: Add WF-660a support
Fixes: WIFI-12280
Signed-off-by: Ken <xshi@actiontec.com>
2023-02-22 10:03:05 +01:00
John Crispin
2a8858a3a2 uspot: fix an exception in the idle timeout handler
Fixes: WIFI-12282
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-22 09:41:48 +01:00
John Crispin
977d16557a ucentral-event: do not reset rate limit for captive clients
Fixes: WIFI-12305
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-21 15:56:19 +01:00
Satya-sc
3db254c306 ucentral-event: add unit boot-up event 2023-02-20 15:40:30 +01:00
John Crispin
9274c3a719 rtty: enable mTLS support
Fixes: WIFI-10516
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 15:40:30 +01:00
John Crispin
993ff2624e ucentral-event: add wired events
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 15:40:30 +01:00
John Crispin
60f6565d18 ucentral-event: make the ssh event payload a dictionary
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 10:41:14 +01:00
John Crispin
924d30af74 ucentral-event: add bssid to wifi events
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 10:40:08 +01:00
John Crispin
c55d19c3c5 ucentral-event: fix polled telemetry stream
Fixes: WIFI-12341
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 10:35:53 +01:00
John Crispin
9221c3e7e7 ucentral-schema: update to latest HEAD
bf8c384 properly stream state in telemetry mode

Fixes: WIFI-12314
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 10:33:03 +01:00
John Crispin
eb862cf2d2 ucentral-client: update to latest HEAD
2917158 ubus fix dump all telemetry

Fixes: WIFI-12314
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-20 10:32:19 +01:00
John Crispin
1e3cef1a26 mac80211: backport 230-get_txpower.patch
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-15 15:46:39 +01:00
Piotr Dymacz
50fd49fd3d ipq807x: eap102: keep MCU disabled by default
This would simplify MCU setup after bootup.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
8e8a763485 ipq807x: eap102: export more USB related pins
This exports USB related pins in sysfs using 'gpio-export' as:
- usb-rear-power
- usb-side-power
- usb-hub-enable (renamed from 'usb-enable')

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
ab47566e82 ipq807x: eap102: add more pin configs for USB and MCU
This adds few more pin configs for USB (rear and side ports power) and
MCU (reserved pin, apparently used by device vendor for DTM enable).

While at it, align labels and nodes names with staging branch.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
e9a834c205 ipq807x: wf196: keep MCU disabled by default
This would simplify MCU setup after bootup.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
6dc524e67b ipq807x: wf196: export MCU reset pin
This exports MCU reset pin as 'mcu-enable' in sysfs with 'gpio-export'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
b61b3aa06f ipq807x: wf196: add pin config for MCU reset
This adds config for nRF52833 MCU reset pin on the CIG WF-196.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
Piotr Dymacz
b9d43eb897 ipq807x: tidy up CIG WF-196 DTS file
This change focuses on the I/O related cleanups for the CIG WF-196 DTS
file. Most of the removed definitions come from QCA reference files and
should have been adjusted for a custom board. List of changes:

1. Drop 'btcoex' pinctrl mux define
   WF-196 includes nRF52833 MCU which doesn't have dedicated PTA coex
   hardware interface (see [1] for software based solution in Nordic's
   nRF Connect SDK). Based on the real hardware research, defined pins
   from 'btcoex' mux aren't routed to nRF52833 MCU.

2. Drop 'spi_3' pinctrl mux define
   Defined label isn't used as reference in any other node and defined
   GPIOs most likely aren't used as well.

3. Drop GPIO 46 and 47 from hsuart pinctrl mux define
   It turned out that only UART TX and RX lines are routed between the
   main SOC (IPQ8072A) and the MCU (nRF52833).

While at it, fix also some broken indentation and redundant new lines.

[1] https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/mpsl/doc/bluetooth_coex.html

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-02-15 15:21:45 +01:00
John Crispin
c069ba71cc ucentral-schema: update to latest HEAD
8c71638 fix listing mesh interfaces inside state
c3f6981 sysupgrade: GW sends FWsignature and not signature
94543ee state: cleanup and document the data model
6056d32 state: add [ avg, max ] cpu thermal sensor
900ce67 add phy temperature to state messages

Signed-off-by: John Crispin <john@phrozen.org>
2023-02-13 17:15:08 +01:00
John Crispin
df01a9acc0 ucentral-event: fix rtnl support
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-13 17:13:37 +01:00
Felix Fietkau
e0aa0eec98 ucode: add refcount fixes for rtnl/nl80211
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-13 15:24:52 +01:00
Tanya Singh
2a145ba46a WIFI-12182: Support Edgecore OAP100e
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2023-02-13 09:13:57 +01:00
John Crispin
9f34e57df8 ucentral-event: fix typo in events.json
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-08 09:04:30 +01:00
John Crispin
9c8affad09 ucode: backport rtnl notifications
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-08 08:43:31 +01:00
John Crispin
cd76797336 ucentral-schema: update to latest HEAD
17e7a3e fix lldp_description

Fixes: WIFI-12269
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-08 08:42:21 +01:00
John Crispin
feb26f21fd ucentral-event: add wifi-scan service
Fixes: WIFI-11993
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-06 11:52:46 +01:00
Tanya Singh
5ff23ce3cf busybox: Fix Zero touch provisioning with DHCP option 138
Fixes: WIFI-12260
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2023-02-06 07:47:17 +01:00
Ravi Vaishnav
cacb8a23dd hostapd: Code for secondary RADIUS
Signed-off-by: Ravi Vaishnav <ravi.vaishnav@netexperience.com>
2023-02-05 09:41:55 +01:00
John Crispin
f5604d42f6 upgs: add package to default package selection
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 15:55:21 +01:00
John Crispin
8f74933b37 ucentral-schema: update to latest HEAD
f4f2e69 add cig_sha256

Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 14:32:15 +01:00
Venkat Chimata
2d92eeab07 openssl is needed to verify the command signatures 1. Enable openssl in AP firmware 2. Copy /certificates/sign_pubkey.pem into /etc/ucentral at boot time
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2023-01-27 14:29:54 +01:00
John Crispin
c44ab8b4e6 ugps: update to latest HEAD
Fixes: WIFI-12238
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 14:25:41 +01:00
John Crispin
d3ad594940 ucentral-schema: update to latest HEAD
242a1a1 gps: add support to the data model

Fixes: WIFI-12238
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 13:41:58 +01:00
John Crispin
8f53da4f79 hostapd: make radius rate-limit work with new event listener framework
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
1cc9673e8c disable none active services
Fixes: WIFI-12237
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
Ravi Vaishnav
258e484d5f uboot-envtools: Fix syntax on number of sectors
ProblemStatement: On EAP104, "fw_setenv" fails with the error "MTD erase error on /dev/mtd10: Invalid argument"
RootCause: uboot-envtools expects hex format for the number of sectors while the config file (/etc/fw_env.config) contains a decimal number format for the number of sectors. This leads to out-of-boundary size calculation within the function "environment_end()".
Solution: Update the scripts to write a hex value instead of a decimal value in the config file.

Reference for the expected format from the config file: Please check the function "get_config" in the file "fw_env.c", where the function uses sscanf to read the parameters from the config file.

Fixes: WIFI-12189
Signed-off-by: Ravi Vaishnav <ravi.vaishnav@netexperience.com>
2023-01-27 12:18:37 +01:00
John Crispin
7edbe99599 ucentral-schema: update to latest HEAD
cd97d41 make sure that restricted country code errors get propagated

Fixes: WIFI-12001
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
fbcfddfbdc initial events support
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
0e75b82eb6 uspot: allow adding IPs to the walled-garden
Fixes: WIFI-12032
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
492db67f64 base-files: sysupgrade: always imply -n if -f is not provided
This ensures that no random config giles get carried over.

Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
6129f525d5 udevstats: add new package
This package uses eBPF to do traffic accounting ont he WAN port

Fixes: WIFI-12183
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
Oleksandr Mazur
2ec381534e ucentral-client: health: remove redundant check for zero value
config_get is issued with a default (120) parameter, which makes a check for 0
a redundant.
It can be safely removed, as the check for "[ "$interval" -eq 0 ]" is
always non-zero.

Fixes 396e2bd06c ("ucentral-client: cleanup health parameter")

Tested on virtual Wlan-AP img: no syntax error occured.

Signed-off-by: Oleksandr Mazur <cahbua@gmail.com>
2023-01-27 12:18:37 +01:00
John Crispin
29d6d9f1ea ucentral-schema: update to latest HEAD
47b470f make captive portal radius-gw-proxy aware

Fixes: WIFI-11705
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
a530af9354 uspot: fix endless STOP frames and add radius-gw-proxy
Fixes: WIFI-12044
Fixes: WIFI-11705
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
e42fd1e3a4 ucentral-client: update to latest HEAD
568a84a do not enforce CN validation when in self-signed mode

Fixes: WIFI-12099
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
30cfc34e1c opennds: drop package
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
0737a706ec ubpf: drop feed
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
b3589c92dc p4: drop feed
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
0f40cb8e77 ucentral-schema: update to latest HEAD
7f77f02 state: add [ avg, max ] cpu thermal sensor
e635ab8 add phy temperature to state messages

Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
a051edcd00 ucentral-client: remove sysupgrade preserved config
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
18b19c92be ucentral-wifi: deprecate package
Fixes: WIFI-11926
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
a2eabf35e3 ucentral-schema: update to latest HEAD
9dc66d7 fix listing mesh interfaces inside state
ad84690 only set port counter if they are available

Fixes: WIFI-11994
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
Johann Hoffmann
0dfe43f1e6 Add patches/x86 directory to config.yml
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2023-01-27 12:18:37 +01:00
John Crispin
20cda84f47 netifd: allow disabling unicast_to_multicast conversion on bridged wifi
Fixes: WIFI-11550
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
0228173d53 uspot: add mac-auth support
Fixes: WIFI-11895
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-27 12:18:37 +01:00
John Crispin
0db604ad1e Revert "ucentral-schema: update to latest HEAD"
This reverts commit e8bd819e39.
2023-01-16 16:46:48 +01:00
John Crispin
c53d342b6a uspot: fix exception during rediret
Fixes: WIFI-11995
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-16 14:56:17 +01:00
John Crispin
42e77e6f5a ipq807x: fix MAC assignment on WF188n
Fixes: WIFI-12090
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-16 12:57:15 +01:00
John Crispin
e8bd819e39 ucentral-schema: update to latest HEAD
ec657b5 improve stability of reading counters

Signed-off-by: John Crispin <john@phrozen.org>
2023-01-13 14:09:25 +01:00
John Crispin
0c03b63c0f ucentral-schema: update to latest HEAD
ad84690 only set port counter if they are available

Signed-off-by: John Crispin <john@phrozen.org>
2023-01-12 06:02:39 +01:00
jaspreetsachdev
5ed2f1d964 Merge pull request #509 from Telecominfraproject/v2.8.0-rc4
V2.8.0 rc4
2022-12-20 10:16:06 -05:00
Jaspreet Sachdev
515793450e Merge branch 'main' into v2.8.0 2022-12-20 10:14:56 -05:00
John Crispin
541e9b0b4f ucentral-schema: update to latest HEAD
4278dfb gre: add dont fragment flag

Signed-off-by: John Crispin <john@phrozen.org>
2022-12-20 11:00:42 +01:00
jaspreetsachdev
24611df4c6 Merge pull request #508 from Telecominfraproject/v2.8.0-rc3
V2.8.0 rc3
2022-12-19 17:47:11 -05:00
Jaspreet Sachdev
083010d43c Merge branch 'main' into v2.8.0 2022-12-19 13:38:29 -05:00
John Crispin
f9b46fd6b0 ucentral-schema: update to latest HEAD
39dad34 wireguard: fix reload after reboot

Fixes: WIFI-12002
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-19 13:02:46 +01:00
John Crispin
74eb6f96ab atfpolicy: reduce ubus_wait timeout to 2s
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-19 13:01:49 +01:00
John Crispin
4967fcd2be hostapd: improve multi CoA support
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-18 15:25:27 +01:00
John Crispin
e973110de7 ath11k: fix mac assignment on cig wf196
Fixes: WIFI-11976
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-17 10:43:04 +01:00
John Crispin
a62503328b .github/workflows: add cig,wf194c4
Fixes: WIFI-11983
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-16 16:15:47 +01:00
John Crispin
e42051d3a9 hostapd: add dynamic_own_ip support
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-15 12:03:31 +01:00
John Crispin
e5336b7351 ucentral-schema: update to latest HEAD
b539203 include APVLAN associations inside state messages

Fixes: WIFI-11861
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-14 17:09:46 +01:00
John Crispin
5469af35f1 ucentral-schema: update to latest HEAD
6049cd7 various state improvements

Fixes: WIFI-11967
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-14 11:53:51 +01:00
John Crispin
8c9cd8f9d2 ratelimit: fix syntax error during parsing of wlanX-Y
Fixes: WIFI-11965
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-13 16:50:58 +01:00
John Crispin
8b3ac5ea36 uspot: purge pending flows during flush
Fixes: WIFI-11908
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-12 11:46:09 +01:00
John Crispin
c230825486 uspot: do not send accounting off upon logoff
Fixes: WIFI-11907
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-12 11:45:57 +01:00
John Crispin
e8b0f5da60 ucentral-schema: update to latest HEAD
53e3bb4 radio.channel should not be an array

Signed-off-by: John Crispin <john@phrozen.org>
2022-12-12 10:43:34 +01:00
John Crispin
bc45e11824 ucentral-schema: update to latest HEAD
e336aa4 add username to captive state

Fixes: WIFI-11896
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-12 08:22:56 +01:00
John Crispin
d6b3e97c34 ucentral-schema: update to latest HEAD
195ed80 fix multicast to unicast conversion on wifi

Fixes: WIFI-11550
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-12 07:44:48 +01:00
jaspreetsachdev
d35a12b4f4 Merge pull request #506 from Telecominfraproject/v2.8.0-rc2
V2.8.0 rc2
2022-12-09 13:33:12 -05:00
John Crispin
a42f103500 .github/workflows/: add yuncore fap640 to CI builds
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 18:14:44 +01:00
John Crispin
dc2a48c515 ucentral-schema: update to latest HEAD
f3c9972 state: add ssid counters
0329b38 state: make the tid-stats opt-in

Fixes: WIFI-11234
Fixes: WIFI-11928
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 18:09:20 +01:00
John Crispin
db617e23f0 ipq807x: do no keep uboot-env config during sysupgrade
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 15:31:30 +01:00
John Crispin
71189b1b74 ramips: add yuncore fap640 support
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 15:31:13 +01:00
John Crispin
5567de89e6 ipq807x: add yuncore fap650
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 10:12:54 +01:00
John Crispin
5430d79f53 .github/workflows/: add yuncore devices to CI
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-08 07:45:19 +01:00
John Crispin
9d82d88a0c ucentral-schema: update to latest HEAD
084fa1a use ucode handler to get channel survey
870a719 improve DFS channel restrictions

Signed-off-by: John Crispin <john@phrozen.org>
2022-12-07 17:48:18 +01:00
John Crispin
0e264203de luci-mod-ucentral: add diagnostic download button
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-07 17:47:33 +01:00
John Crispin
469443da2a profiles: fix indio image paths
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-07 12:03:04 +01:00
John Crispin
692958d2fd uspot: fix idle-timeout handling
Fixes: WIFI-11208
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-07 11:55:20 +01:00
Kishan Shukla
e65fa74071 ucentral-schema: add gre6 example config
Signed-off by: Kishan Shukla <kishan.shukla@hfcl.com>
2022-12-05 18:49:29 +01:00
Sohail Ahmad
fb64d45c39 From: Sohail Ahmad <sohail@indionetworks.com> Date: Mon Dec 5 02:58:36 2022 +0000 Subject: [PATCH] dnsmasq: enabled EDNS configuration options- CPE ID and subnet
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
2022-12-05 11:45:06 +01:00
John Crispin
71e5c8f441 ucentral-schema: update to latest HEAD
c6ba7ce add diagnostic script support
5d70069 cmd_script: add an additional return json when upload was triggered

Signed-off-by: John Crispin <john@phrozen.org>
2022-12-05 11:13:46 +01:00
John Crispin
8e34f6653c .github/workflows/: add Indio's 11ax 2x2 models (indoor and outdoor) targets
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
2022-12-02 14:45:06 +01:00
Rick Sommerville
bee060b9bb udhcpsnoop: snoop clients in GRE tunnel
Fixes WIFI-11710

Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
2022-12-02 14:16:01 +01:00
Arif Alam
e3e94fe520 base-files: make EAP104 switch ports configurable
Fixes WIFI-11709

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2022-12-02 14:14:41 +01:00
John Crispin
237c090cb4 uspot: add max octet support
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-02 14:06:43 +01:00
John Crispin
74ea7a7a1e ucentral-schema: update to latest HEAD
efd60c9 add maximum_clients_ignore_probe support

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-29 14:30:54 +01:00
John Crispin
330dbd49e6 uspot: properly set the ssid inside a UEs state
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-29 14:30:54 +01:00
John Crispin
a84b047061 ucode: fix a memory corruption
the uloop binding was not closing the uloop epoll fd correcttl when forking.

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-29 14:30:54 +01:00
John Crispin
3795060bf2 uspot: properly terminate Acct when /logoff happens
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-29 14:30:54 +01:00
Johann Hoffmann
e61ab97815 .github/: Patch workflows with regard to deprecated Github actions commands (#502)
* Update checkout action version and replace set-output command
* Put whole echo statement in double quotes
* Replace set-output commands in action as well

Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-11-29 14:30:34 +01:00
Piotr Dymacz
0162828df8 ipq807x: eap102: export MCU and USB reset pins
This exports MCU and USB reset pins in sysfs using 'gpio-export' as
'mcu-enable' and 'usb-enable'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-11-23 14:55:03 +01:00
Piotr Dymacz
73cfef1203 ipq807x: eap102: add pin configs for USB and MCU reset
This adds configuration for reset pins connected with nRF52840 MCU and
the GL850G USB HUB on the EdgeCore EAP102.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-11-23 14:54:53 +01:00
Piotr Dymacz
3eb6360054 ipq807x: tidy up EdgeCore EAP102 DTS file
This change focuses on the I/O related cleanups for the EdgeCore EAP102
DTS file. Most of the removed definitions come from QCA reference files
and should have been adjusted for a custom board. List of changes:

1. Drop 'btcoex' pinctrl mux define
   EAP102 includes nRF52840 MCU which doesn't have dedicated PTA coex
   hardware interface (see [1] for software based solution in Nordic's
   nRF Connect SDK). Based on the real hardware research, defined pins
   from 'btcoex' mux aren't routed to nRF52840 MCU.

2. Drop 'hsuart' pinctrl mux define and 'serial_blsp2' node
   Only one UART interface is used on the EAP102.

3. Drop 'usb_mux_sel' pinctrl mux
   Defined label isn't use as reference in any other node and defined
   GPIO most likely isn't used as well.

4. Disable 'pcie0' and remove 'pcie0' pinctrl mux
   EAP102 doesn't use of any of the IPQ8071A PCIe buses.

[1] https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/mpsl/doc/bluetooth_coex.html

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-11-23 14:54:49 +01:00
Piotr Dymacz
47e4bc585a ipq807x: add named gpio exports
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-11-23 14:54:12 +01:00
John Crispin
3746722a4d uspot: redirect to UAM server upon /logoff
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 13:34:31 +01:00
John Crispin
5828971cfe uspot: add support for propagating the Class VAP (25)
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
dd911cbf21 uncentral-schema: update to latest HEAD
74fc62b captive: add /logout as a valid logoff path
18f7d08 captive: block remaining non-auth traffic in NAT mode
eb0c25c add signature verification wrapper
ef06d00 Add Support for EOGREv6

Fixes: WIFI-10887
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
f167553348 spotfilter: do not flush ip addresses upon logoff
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
d483c55c14 uspot: allow /logout in addition to /logoff
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
d9815c0f62 radius-gw-proxy: fix possible memory corruption
Fixes: WIFI-10964
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
daadf043d8 spotfilter: fix idle detection
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
1a56d5820d ratelimit: improve hotplug trigger
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
8e2f2fcce3 hostapd: add dynamic_probe_resp support
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00
John Crispin
fc5a841563 ucentral-schema: update to latest HEAD
c72603f wifi.station: code was incorrectly reporting MCS value inside NSS field

Fixes: WIFI-11599
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 16:05:36 +01:00
John Crispin
d511a338df uspot: add userurl to uam redirect parameters
Fixes: WIFI-11539
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 10:44:14 +01:00
John Crispin
a3d348b664 ipq807x: add initial support for MUXI AP3220L
Hardware:
* SoC: Qcom IPQ5018
* RAM: 512MB
* Flash: 4MB Nor + 128MB Nand
* Ethernet: 2x GbE
* WLAN: 2x2 2.4GHz 574Mbps(builtin) + 2x2 5GHz 2400Mbps(qcn6122)
* BT: BT5.1(builtin) / nrf52840(option)
* LEDS: 1x power, 1x 2G, 1x 5G
* Buttons: 1x reset
* USB: 1x 2.0(Type-A)
* Power: DC 12V/2A, PoE 48V/0.6A
* UART: 1x RJ45

Flash instruction under U-Boot:
tftpboot 0x44000000 openwrt-ipq807x-muxi_ap3220l-squashfs-nand-factory.bin
imxtract 0x44000000 ubi
flash rootfs
reset

Signed-off-by: angliu-muxi <ang.liu@muxi-connect.com>
2022-11-14 09:21:06 +01:00
Kishan
b48506b156 ip807x: HFCL WiFi6 ION4X and ION4X_2 target addition
Fixes: WIFI-11576
Signed-off by: Kishan Shukla <kishan.shukla@hfcl.com>
2022-11-14 08:19:36 +01:00
Isaev Ruslan
17bb88b67a ipq807x: wifi-ax/ath11-firmware/Makefile yuncore ax840 fix This define recipe for yuncore ax840 device to copy firmware to the correct location.
Signed-off-by: Isaev Ruslan <legale.legale@gmail.com>
2022-11-14 07:47:20 +01:00
John Crispin
578a616b00 ipq807x: ipq6018 based boards caldata size fix
This fixes size of the caldata for ipq60xx based boards and moves the
YunCore AX840 to correct case block (the board is IPQ60xx based, so
the driver looks for ath11k/IPQ6018/hw1.0/caldata.bin,
not ath11k/IPQ8074/hw2.0/caldata.bin). Without this fix, the driver
isn't able to fetch caldata:
[ 16.792551] ath11k c000000.wifi: qmi failed to load CAL data file:caldata.bin

Signed-off-by: Isaev Ruslan <legale.legale@gmail.com>
2022-11-14 07:47:20 +01:00
Piotr Dymacz
93f603e27c base-files: fix foreign sysupgrade detection
Backups are gzipped, include the missing 'z' parameter in 'tar' call.
While at it, make 'grep' call quiet (add 'q' parameter).

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-11-14 07:47:20 +01:00
John Crispin
09b513550c ucentral-schema: update to latest HEAD
b4b8e19 fix wifi unicast conversion
83761f9 fix dtim-period handling

Fixes: WIFI-11550
Fixes: WIFI-11546
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
5e451461cf central-client: update to latest HEAD
5f69da7 send restricted=1 on locked units

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
fd33396acb ucentral-schema: update to latest HEAD
129d75a add final-redirect-rul for cpative portal support

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
3bdfa68ff5 dnsmasq: ignore dhcp events on spotfilter-ifb
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
3dbc070f2c uspot: add final-redirect-url
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
b48e5eb057 ucentral-schema: add ASB bundle.uc
Fixes: WIFI-10967
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
3501bd9c11 ucentral-schema: update to latest HEAD
a509308 rssi thresholds are iface and not bss options

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
70635ac911 ucentral-schema: update to latest HEAD
85698d2 move health_check settings tp the metric deictionary

Fixes: WIFI-11262
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
f9a00b7ebd ucentral-schema: update to latest HEAD
9968cb6 cmd_trace: limit maximum file size to 25% of free mem

Fixes: WIFI-11224
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
5bec28b7e5 ucentral-client: update to latest HEAD
6e774f6 upload: delete files after the upload completed

Fixes: WIFI-11224
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
Venkat Chimata
e41818470f Updating the board files for Liteon WPX8324.
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2022-11-14 07:47:20 +01:00
John Crispin
a31422d3d7 ucentral-schema: update to latest HEAD
f941f47 healthcheck: set 60s as the minimum interval
85495ab wifi.iface was not converting 6G channels correctly

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
bea3d2c4f8 usteer2: add new package
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
4c4cb58027 ucentral-schema: update to latest HEAD
8d4384b add session-timeout to captive support
516829a add client kick threshold support
5a5085b add uci_section to wifi uci

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
4312a42b62 ucentral-client: update to latest HEAD
e39e9c2 add wildcard CN validation

Fixes: WIFI-10419
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
011e5b6e1a ucentral-schema: update to latest HEAD
0856cd5 add support for wifi mac acl

Signed-off-by: John Crispin <john@phrozen.org>
2022-11-14 07:47:20 +01:00
John Crispin
8233c10569 .github: add wallys_dr6018_v4 to the build pipeline
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-04 11:20:07 +01:00
John Crispin
fb73d889ed udevmand: update to latest HEAD
3d2b67b use u64 when reporting interface counters

Fixes: WIFI-11235
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-02 16:34:38 +01:00
John Crispin
80bfb8671d spotfilter: fix sta detection when multiple ifaces are tracked
Fixes: WIFI-11272
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-29 08:56:04 +02:00
John Crispin
521df1a142 mac80211-ax: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0
Rekeying PTK for STA 2e:54:0a:55:25:c6 but driver can't safely do that.
Rekeying PTK for STA 48:26:2c:3e:b0:f4 but driver can't safely do that.
ath11k c000000.wifi: failed to flush transmit queue 0

Fixes: WIFI-11004
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-28 16:32:53 +02:00
John Crispin
72a75b72ac ipq807x: properly assign macs on wf196
Fixes: WIFI-10939
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-28 16:32:42 +02:00
jaspreetsachdev
c22dce10d3 Merge pull request #486 from elludraon/readme
Update README.md
2022-10-20 15:24:47 -04:00
Jeffrey Han
8eb801a0cc Update README.md
Signed-off-by: Jeffrey Han <39203126+elludraon@users.noreply.github.com>
2022-10-19 17:04:14 -07:00
jaspreetsachdev
6eaef7adad Merge pull request #484 from Telecominfraproject/2.7.1-fixes-from-next
2.7.1 fixes from next
2022-10-17 15:41:09 -04:00
John Crispin
0272d4bcad hostapd: AAA WISPr rates are sent as mbit
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:20 -04:00
John Crispin
41c64e9978 spotfilter: fix a use-after-free
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:20 -04:00
John Crispin
9c2f0a098d uspot: dns_state was not getting reset correctly when flushing a client
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:20 -04:00
John Crispin
0bb8d0dcc0 uspot: Session-Timeout AVP was not correctly honoured
Fixes: WIFI-10663
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:19 -04:00
John Crispin
a542660072 uspot: idle-timeout failed for non radius backed clients
Fixes: WIIF-11208
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:19 -04:00
John Crispin
8ee15d0053 uspot: fix unreolved variable in mac-format handler
Fixes: WIFI-11204
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:19 -04:00
John Crispin
311515867c uspot: add ssid to called-station-id
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-17 15:35:19 -04:00
jaspreetsachdev
16bbcddd40 Merge branch 'main' of github.com:Telecominfraproject/wlan-ap 2022-10-17 14:24:06 -04:00
John Crispin
a4b663b824 ucentral-schema: update to latest HEAD
329dffa add captive portal info to state messages
f3ee560 start the uspot service if captive is enabled
7da0185 allow defining the format of MAC sent to AAA in captive mode
2dfbeff rename wlancaptive -> wlanc, netdev name got too long when creating the IFB device
1784f7e add 'none' mode to wifi-steering
abeb712 broadband: the DNS was not getting applied in static configuration
0fbe7d5 various captive portal improvements

Fixes: WIFI-10665
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-06 07:02:49 +02:00
John Crispin
736ab2b803 uhttpd: update to latest HEAD
Fixes: WIFI-10665
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-06 07:02:49 +02:00
John Crispin
cd2fbd11f2 captive: add missing UAM/ACCT/rate features
Fixes: WIFI-10665
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-05 16:26:01 +02:00
John Crispin
708fe70e75 ucentral-schema: update to latest HEAD
a473fe2 restart ratelimit daemon after config apply
ec58d3a do not auto-expire captive clients

Fixes: WIFI-10190
Fixes: WIFI-10194
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-05 16:25:50 +02:00
John Crispin
0c9499c085 ratelimit: replace script with daemon
Fixes: WIFI-10190
Fixes: WIFI-10194
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-05 16:25:48 +02:00
John Crispin
d52d4ff627 ucode: update to latest HEAD
Fixes: WIFI-10190
Fixes: WIFI-10194
Signed-off-by: John Crispin <john@phrozen.org>
2022-10-05 16:25:37 +02:00
Venkat Chimata
324df56861 ipq50xx: Addp support for Liteon WPX8324 AP
Specifications are:
* CPU: Qualcomm IPQ5018
* RAM: 512 MB
* Storage: 16MB ROR, 128MB NAND-optional.
* Ethernet: 2x GBe
* UART header
* WLAN: QCN6122 + QCN8080
* 3x LED-s

Installation instructions:
Connect to UART, pins are like this (from the edge on LEDS):
-> GND | RX | TX | GND | VCC

Settings are 115200 8n1

1. Copy openwrt-ipq807x-liteon_wpx8324-squashfs-nand-factory.bin (attached) onto the board into /tmp/
2. At board's command prompt, issue sysupgrade -n /tmp/openwrt-ipq807x-liteon_wpx8324-squashfs-nand-factory.bin

Fixes: WIFI-10929
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2022-10-05 16:25:14 +02:00
Felix Fietkau
a21a08e8bf ipq807x: backport sched matchall classifier support
Fixes: WIFI-10190
Fixes: WIFI-10194
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-10-05 16:24:34 +02:00
John Crispin
393db0ec2a mac80211: fix typo
The detection of multi_bssid was using bad syntx, this caused the wifi MAC
of some boards to change.

Signed-off-by: John Crispin <john@phrozen.org>
2022-10-04 07:21:27 +02:00
jaspreetsachdev
ca26d347eb Merge branch 'main' of github.com:Telecominfraproject/wlan-ap 2022-09-29 21:53:47 -04:00
Sohail Ahmad
c56b7adea8 ipq807x: Support for Indio WiFi6 AP -indoor and outdoor models based on IPQ6000
Fixes: WIFI-10802
Signed-off-by: Sohail Ahmad <sohail.ahmad@wifi-soft.com>
2022-09-26 22:06:53 +02:00
Felix Fietkau
84d31765db qosify: update to the latest version
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-26 22:06:53 +02:00
Arif Alam
fb617ea136 ipq807x: Fix EAP104 upgrade
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2022-09-26 22:06:53 +02:00
John Crispin
47468145c6 spotfilter: add a maissing v5.4 kernel backport
fixes an off-by-one bug in the validator

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-26 22:06:53 +02:00
John Crispin
854c8a44d4 ucentral-client: update to latest HEAD
update wifi-scan timeout to 120s

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-26 22:06:53 +02:00
John Crispin
86948e1052 ucentral-schema: update to latest HEAD
55b8272 add support for overriding country codes

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-26 22:06:53 +02:00
Felix Fietkau
39053d366d qosify: update to the latest version
fixes classification on linux 4.4

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-26 22:06:53 +02:00
Felix Fietkau
daaed910da wifi-ax: backport mac80211 WME classification fix
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-26 22:06:53 +02:00
John Crispin
bf6abd80dd mac80211: fix multiple bssid mac addresses
Fixes: WIFI-10596
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-26 22:06:53 +02:00
Jaspreet Sachdev
e74e22e184 .github/workflows: Removed deprecated targets
Signed-off-by: Jaspreet Sachdev <jaspreetsachdev@fb.com>
2022-09-26 22:06:53 +02:00
John Crispin
b8f5e17e38 uspot: fix a typo causing config to not load correctly
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-26 22:06:53 +02:00
Simon Kinane
956a31db8f uspot: Improve HTML for captive portal UI
Signed-off-by: Simon Kinane <skinane@fb.com>
2022-09-26 22:06:15 +02:00
Sohail Ahmad
9eeefa2fbf ipq807x: Support for Indio WiFi6 AP -indoor and outdoor models based on IPQ6000
Fixes: WIFI-10802
Signed-off-by: Sohail Ahmad <sohail.ahmad@wifi-soft.com>
2022-09-26 18:00:41 +02:00
Felix Fietkau
c33705ca60 qosify: update to the latest version
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-26 15:00:33 +02:00
Arif Alam
ba41e6773b ipq807x: Fix EAP104 upgrade
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2022-09-23 17:19:01 +02:00
John Crispin
8ebf884436 spotfilter: add a maissing v5.4 kernel backport
fixes an off-by-one bug in the validator

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-23 17:19:01 +02:00
John Crispin
7d4353caf0 ucentral-client: update to latest HEAD
update wifi-scan timeout to 120s

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-23 17:19:01 +02:00
John Crispin
fa6220a615 ucentral-schema: update to latest HEAD
55b8272 add support for overriding country codes

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-22 15:14:05 +02:00
Felix Fietkau
26517bb6ae qosify: update to the latest version
fixes classification on linux 4.4

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-22 07:47:21 +02:00
Felix Fietkau
ea4c4b3fe5 wifi-ax: backport mac80211 WME classification fix
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-22 07:47:01 +02:00
John Crispin
00f273000e mac80211: fix multiple bssid mac addresses
Fixes: WIFI-10596
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-21 09:45:05 +02:00
Jaspreet Sachdev
6014d3a04d .github/workflows: Removed deprecated targets
Signed-off-by: Jaspreet Sachdev <jaspreetsachdev@fb.com>
2022-09-20 08:56:55 +02:00
John Crispin
08f082acfe uspot: fix a typo causing config to not load correctly
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-19 09:19:01 +02:00
Simon Kinane
12e5efcda4 uspot: Improve HTML for captive portal UI 2022-09-19 09:19:01 +02:00
John Crispin
26be5ba20e udhcpsnoop: fix an endianness error
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-16 17:06:54 +02:00
John Crispin
dc2feb3cc7 ucentral-client: update to latest HEAD
90d276f force SIGKILL when terminating a runqueu task

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-09 13:40:03 +02:00
John Crispin
ed397f5ce4 ucentral-client: update to latest HEAD
f5e5a61 propagate "cancelled" when a runqueue job timed out

Fixes: WIFI-10768
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-09 13:40:03 +02:00
John Crispin
19f0260c0a ucentral-schema: update to latest HEAD
b27df64 add support for setting an interfaces MTU

Fixes: WIFI-10556
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-09 13:40:03 +02:00
John Crispin
49c55bdec5 ucentral-schema: update to latest HEAD
19df069 update fils-discovery-interval max value

Fixes: WIFI-10710
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-09 13:40:03 +02:00
John Crispin
2ab86ee29d ucentral-client: update to latest HEAD
b0e7432 proto: limit wifiscans to 30s
597aab3 task: add an additional runqueue for admin commands

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-09 13:40:02 +02:00
Krishna
888aa40057 ipq807x: Add support for Mesh++ S618 devices
Mesh++ S618 has below products based on Qualcomm IPQ6018:

  * cp03-c1
  * cp01-c1

These are Wi-Fi 6 (IEEE 80211.ax) dual band 2x2 mesh routers.

Fixes: WIFI-10561
Signed-off-by: Krishna <krishna@meshplusplus.com>
Signed-off-by: Edward Cheung <edward@meshplusplus.com>
Signed-off-by: Alex Ballmer <alexb@meshplusplus.com>
2022-09-08 12:49:58 +02:00
Sven Eckelmann
2291ccf198 ipq807x: Fix build of kmod-br-netfilter
QCA is still backporting the old OpenWrt hack for BR_HOOK to newer kernels.
This change was identified as a source for bugs and also caused performance
problems in certain scenarios.

And since OpenWrt is now building the bridge as part of the kernel and the
br-netfilter code as module, the build of the QCA kernel fork will also
fail because the kernel binary is depending on a module:

  net/built-in.o: in function `BR_HOOK':
  net/bridge/br_private.h:929: undefined reference to `br_netfilter_run_hooks'
  net/bridge/br_private.h:929: undefined reference to `br_netfilter_run_hooks'
  net/bridge/br_private.h:929: undefined reference to `br_netfilter_run_hooks'
  net/bridge/br_private.h:929: undefined reference to `br_netfilter_run_hooks'
  net/bridge/br_private.h:929: undefined reference to `br_netfilter_run_hooks'
  net/built-in.o:net/bridge/br_private.h:929: more undefined references to `br_netfilter_run_hooks' follow

Just getting rid of this patch (as OpenWrt did) is therefore the best
option.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-09-08 12:49:27 +02:00
John Crispin
1d031a0535 unetd: add bpf-headers dependency
This fixes a spurious build issue

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-08 12:49:27 +02:00
John Crispin
cb7ed7a37b hostapd: backport multicast_to_unicast patch
Fixes: WIFI-10766
Signed-off-by: John Crispin <john@phrozen.org>
2022-09-08 12:49:27 +02:00
John Crispin
e692aea19e uspot: refactor code
* add a common.uc class
* add ucode ubus calls

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-08 12:49:27 +02:00
John Crispin
a8bb06fb1c ath1kk-wifi: update the WF188n BDF file
This is the BDF that passed FCC certification.

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-08 12:49:27 +02:00
John Crispin
63b5803086 uspot: add MS CHAP support
* extend the radius-client to also support MS CHAP

Signed-off-by: John Crispin <john@phrozen.org>
2022-09-08 12:49:27 +02:00
John Crispin
68689674b7 uspot: various fixes
* add web-root override support
* various cleanups

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-30 15:35:54 +02:00
John Crispin
fccdccdba3 ipq807x: add firmware downgrade support for eap101/2
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-30 08:29:07 +02:00
Tanya Singh
21176badf7 firstcontact: Zero touch provisioning with DHCP option 138
Fixes: WIFI-7266
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2022-08-30 07:22:25 +02:00
John Crispin
87adc56e60 ipq807x: make wifi 6e work on wallytech dr6018-v4
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-25 10:01:28 +02:00
John Crispin
0f8be3bbde hostapd: do not enforce multiple_bssid on 6G band
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-24 10:28:39 +02:00
John Crispin
a3fc407f25 hostapd: manually generate roaming keys when SAE is used
Fixes: WIFI-10570
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 17:09:08 +02:00
John Crispin
30c2c68579 ucentral-schema: update to latest HEAD
bab27cb add support for advanced captive-portal

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 15:09:35 +02:00
John Crispin
736e3e58cf uhttp: update to latest HEAD and add 2 pending fixes
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 15:09:35 +02:00
John Crispin
b38cd9bb9f profiles: switch from OpenNDS to uSpot for captive portal
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 15:09:35 +02:00
John Crispin
d69a8f159d spotfilter: add advance captive packet filter
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 15:09:35 +02:00
John Crispin
baaa31f445 uspot: add advanced captive http components
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 15:09:35 +02:00
John Crispin
cf18242ee5 mac80211-qsdk: default multiple_ssid to 1 if not set
Fixes: WIFI-10597
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 09:14:06 +02:00
John Crispin
fdcfffd81d luci: update to version used in 22.03-rc6
Fixes: WIFI-10390
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 09:14:02 +02:00
John Crispin
c9a76b8d76 openssl: update to 22.03-rc6 version
Fixes: WIFI-10390
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 09:01:07 +02:00
John Crispin
9bd53e7d91 ucentral-schema: update to latest HEAD
b2ce495 ucentral-schema: set passpoint version

Fixes: WIFI-10575
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-23 07:23:07 +02:00
John Crispin
812fb18160 ath11k-wifi: update cig wf196 BDF files to latest FCC version
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-22 10:36:10 +02:00
Kishan
0571cc73da ath11k-wifi: add hfcl-ion4xi specific BDF
Signed-off-by: Kishan Shukla <kishan.shukla@hfcl.com>
2022-08-22 10:36:08 +02:00
John Crispin
6bdd93ce0f radius-gw-proxy: fix CoA port
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-19 08:17:00 +02:00
John Crispin
0603953d9f hostapd: add multi CoA support
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-19 08:17:00 +02:00
John Crispin
098c81376f udhcpsnoop: look at more options for the cache expiry
make the code look for leasetime, rebind and renew options to
determine the cache expiry time.

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-16 17:57:46 +02:00
John Crispin
7ef10fcfb4 ucentral-schema: update to latest HEAD
a074cc0 improve dhcp probe on GRE tunnels
2a66b4c enable the noscan flag on radios to make 40MHz work
4c36050 improve ipv4 wifi client reporting in bridge mode
aed8805 remove openflow support
4597721 add dhcp discovery on gre tunnel interface

Fixes: WIFI-7838
Fixes: WIFI-10549
Fixes: WIFI-10538
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-15 11:42:09 +02:00
Venkat Chimata
823ac590ff ipq807x: fix proxy_arp
sk_buff's cb should be cleared in the entry point for both incoming and outgoing packets at each layer.
At bridge, it is already handled in the outgoing path, but not in the incoming path. We have seen cases
where proxyarp_replied was 1 on sk_buffs coming from the WLAN driver and they were getting dropped in
forwarding path.

Fixes: WIFI-10552
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2022-08-15 11:41:43 +02:00
John Crispin
9b68205dc0 ucentral-schema: rename psk-radius.json to psk2-radius.json
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-15 11:41:43 +02:00
John Crispin
d8216dc583 ucentral-schema: update to latest HEAD
9b24058 fix gre for non vlan setups

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-15 11:41:43 +02:00
John Crispin
2e3c52160c ipq807x: backport an off-by-one error inside the BFP verifier
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-15 11:41:43 +02:00
John Crispin
8686846a09 hostapd: backport several CVE fixes
Fixes: WIFI-10412
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-15 11:41:41 +02:00
John Crispin
8de22ca44b ucentral-schema: update to latest HEAD
52e27a1 enable unicast conversion on wifi instead of bridge layer

Fixes: WIFI-10430
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-10 06:45:51 +02:00
Sven Eckelmann
3e692ed95a ipq807x: Add support for Plasma Cloud PAX1800 v1
Device specifications:
======================

* Qualcomm IPQ6000
* 256 MB of RAM
* 64 MB of SPI NOR flash
  - 2x 28 MB available; but one of the 28 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi (11ax)
* 2T2R 5 GHz Wi-Fi (11ax)
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board
* 2x ethernet
  - eth0
    + 1000 Mbps Ethernet
    + used as LAN interface
  - eth1
    + 1000 Mbps Ethernet
    + 802.3at POE
    + used as WAN interface
* 12 2A DC
* internal antennas

This device is not exported via a profile in TIP because there were
concerns about the 256MB limitations. But the actual OpenWrt support is
still added for interested parties.

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   setenv bootargs 'console=ttyMSM0,115200n8 rootfstype=squashfs,jffs2 board=PAX1800 root=31:10 mtdparts=spi32766.0:768k(0:SBL1),64k(0:MIBIB),1664k(0:QSEE),64k(0:DEVCFG),128k(0:RPM),64k(0:CDT),64k(0:APPSBLENV),640k(0:APPSBL),256k(0:ART),28672k(inactive),28672k(inactive2),64k(custom),64k(0:KEYS),2304k(0:WIFIFW)'
   tftpboot <filename-of-initramfs-kernel>.bin && bootm

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-08-10 06:45:51 +02:00
Marek Lindner
128bd3a17e ipq807x: Add post-flash check of written data
If it already looks to the system that the flashing of the image data
failed, it is not a good idea to inform the u-boot to switch the inactive
(newly flashed) partition to the active one

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-08-10 06:45:51 +02:00
Sven Eckelmann
cc54c8654f ipq807x: Add support for Plasma Cloud PAX1800 v2
Device specifications:
======================

* Qualcomm IPQ6000
* 512 MB of RAM
* 64 MB of SPI NOR flash
  - 2x 28 MB available; but one of the 28 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi (11ax)
* 2T2R 5 GHz Wi-Fi (11ax)
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board
* 2x ethernet
  - eth0
    + 1000 Mbps Ethernet
    + used as LAN interface
  - eth1
    + 1000 Mbps Ethernet
    + 802.3at POE
    + used as WAN interface
* 12 2A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   setenv bootargs 'console=ttyMSM0,115200n8 rootfstype=squashfs,jffs2 board=PAX1800v2 root=31:10 mtdparts=spi32766.0:768k(0:SBL1),64k(0:MIBIB),1664k(0:QSEE),64k(0:DEVCFG),128k(0:RPM),64k(0:CDT),64k(0:APPSBLENV),640k(0:APPSBL),256k(0:ART),28672k(inactive),28672k(inactive2),64k(custom),64k(0:KEYS),2304k(0:WIFIFW)'
   tftpboot <filename-of-initramfs-kernel>.bin && bootm

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-08-10 06:45:51 +02:00
Sven Eckelmann
200f627a9c ipq807x: Fix installation of FTBFS gcc 5.5 patch
The toolchain path will not automatically be copied to OpenWrt. So the
build will still fail on recent Debian unstable version. Instead, it must
be applied during the setup.py process via the normal patch procedure.

Reported-by: Marek Lindner <marek.lindner@plasma-cloud.com>
Fixes: 6f6b40a94f ("toolchain/gcc: fix building gcc 5.5 on newer systems")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-08-10 06:45:51 +02:00
John Crispin
0134c1cb64 ucentral-wifi: update to latest HEAD
d55f2d5 nl80211: increase IEEE80211_CHAN_MAX to 234

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-10 06:45:50 +02:00
John Crispin
5519ab913b ucentral-schema: update to latest HEAD
37707f1 allow OWE encryption on 6G band

Fixes: WIFI-10426
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-10 06:45:50 +02:00
John Crispin
530332fb51 fix packet captures when packet count is set
Fixes: WIFI-10290
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-07 14:55:32 +02:00
John Crispin
8bb8c16b34 drop openflow support
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-07 14:55:32 +02:00
John Crispin
a6a7d82607 drop fbwifi support
Signed-off-by: John Crispin <john@phrozen.org>
2022-08-07 14:55:32 +02:00
John Crispin
f78dc0cd77 ucentral-schema: update to latest HEAD
21c2709 add owe-transition support

Signed-off-by: John Crispin <john@phrozen.org>
2022-08-07 14:55:32 +02:00
John Crispin
aaf830ae27 ucentral-schema: update to latest HEAD
29cfbca owe: hide the encrypted BSS
ec4284b expose PMKSA caching via the data model

Fixes: WIFI-10235
Fixes: WIFI-10233
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-22 11:10:55 +02:00
John Crispin
555e1a2b1b .github/workflow: add wallys_dr6018 to CI builds
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-21 18:53:24 +02:00
John Crispin
0fbe2e9089 ratelimit: fix flowid generation on flow delete
The ID was not properly generated causing the code to delete all flow rules.

Signed-off-by: John Crispin <john@phrozen.org>
2022-07-18 10:35:05 +02:00
John Crispin
e87c1ca2dd ipq8074: fix yuncore ax840 port mapping and wifi macs
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-15 16:36:17 +02:00
John Crispin
c0b3e38215 ucentral-schema: update to latest HEAD
Fixes: WIFI-4237
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-12 10:44:57 +02:00
John Crispin
0bf5ea74b3 xtables-addon: import version 2.14
This is only used for the v4.4 QCA kernel.

Fixes: WIFI-10095
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-12 10:44:57 +02:00
John Crispin
1c4c82a9df bpftools: backport latest version from OpenWrt HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-12 10:44:57 +02:00
John Crispin
4d1022f29b ucentral-schema: update to latest HEAD
5d5bc06 enable igmp snooping and unicast conversion by default

Fixes: WIFI-7723
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 17:35:42 +02:00
John Crispin
a652e6c8d2 ucentral-schema: add OWE encryption example
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 14:02:04 +02:00
John Crispin
7b91863cba ucentral-schema: update to latest HEAD
257185a state: make sure that snooped IP addresses are also shown inside the clients table
7f157d8 qos: use fn_match instead of regex
6a68c03 wireguard-overlay: use correct default port for vxlan

Fixes: WIFI-7838
Fixes: WIFI-7208
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 14:01:30 +02:00
John Crispin
c7ad6eaf2c ieee8021x: update to latest HEAD
c526967 improve reconnect logic

Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 14:01:30 +02:00
John Crispin
c06923a022 dynamic-vlan: add support for multiple wan ports
the code did not handle devices that have more than one uplink
device.

Fixes: WIFI-9954
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 14:01:27 +02:00
Tanya Singh
d9a8e771ae firstcontact: Zero touch provisioning with DHCP option 138
Fixes: WIFI-7266
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2022-07-11 07:45:23 +02:00
Jianhui Zhao
7e2cec9d91 ath11k-wifi: update GL-AXT1800 BDF
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-07-11 07:42:23 +02:00
John Crispin
84add765fe ucentral-schema: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 07:41:47 +02:00
John Crispin
f050d53ed4 ucode: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 07:41:47 +02:00
John Crispin
26be8ab162 qosify: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 07:41:47 +02:00
John Crispin
3f93f7c972 unetd: update to latest HEAD
this makes vxlan work

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-07-11 07:41:47 +02:00
Felix Fietkau
7bab50dd3c ipq807x: backport vxlan path mtu changes
Fixes: WIFI-7571
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11 07:40:09 +02:00
jaspreetsachdev
cf657dbd94 Merge pull request #461 from Telecominfraproject/next
Next
2022-06-30 17:34:02 -04:00
jaspreetsachdev
33c9876760 Merge pull request #460 from Telecominfraproject/release/v2.6.0
Release/v2.6.0
2022-06-30 17:30:42 -04:00
John Crispin
4d6d7405d6 ucentral-schema: update to latest HEAD
9691cc6 improve custom config handling
b4a3a56 add support for OWE encryption

Fixes: WIFI-9811
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
e249701c34 profile: add bind-dig to default package selection
This makes openroaming NAPTR work

Fixes: WIFI-9962
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
0d50975152 hostapd: backport OWE patches
Fixes: WIFI-9811
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
John Crispin
6d87847d15 radius-gw-proxy: update to latest HEAD
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-30 12:19:41 +02:00
jaspreetsachdev
eebe021780 Merge pull request #459 from Telecominfraproject/main
ucentral-client: update to latest HEAD
2022-06-23 15:02:37 -04:00
John Crispin
c6e0384f21 ucentral-client: update to latest HEAD
68fe6c2 fix the ping command

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-23 14:06:26 +02:00
jaspreetsachdev
23ae850f72 Merge pull request #458 from Telecominfraproject/main
Fixes for WIFI-7687, WIFI-9620
2022-06-22 08:59:02 -04:00
John Crispin
708cf2dec6 ucentral-schema: update to latest HEAD
fc8fdcf point radsec proxy at the correct radius accounting server
886a650 Add missing paramters to uC state schema
c8b15b7 chain the radius vendor attributes inside a single AVP

Fixes: WIFI-7687
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:06:35 +02:00
John Crispin
a95745d95b ucentral-client: update to latest HEAD
62efd45 add radius-proxy RX path

Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:06:21 +02:00
John Crispin
83ccea0abf radius-gw-proxy: add RX path support
Fixes: WIFI-9620
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-22 11:02:16 +02:00
John Crispin
bfeaf89238 ucentral-schema: update to latest HEAD
548ce37 point radsec proxy at the correct radius accounting server
c49ce29 Add missing paramters to uC state schema
1c55872 chain the radius vendor attributes inside a single AVP

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-20 19:24:29 +02:00
jaspreetsachdev
7439217b3c Merge pull request #456 from Telecominfraproject/main
Merging Fixes for WIFI-9630 and others
2022-06-17 09:32:12 -04:00
John Crispin
ae2377f4d2 ucentral-schema: update to latest HEAD
4df0373 renderer: quote wireless encryption key

Fixes: WIFI-9630
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 16:37:37 +02:00
John Crispin
b81d0aaf0e ipq40xx: add dual boot support for ecw5211
Fixes: WIFI-7712
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 12:47:13 +02:00
John Crispin
1546bef93f ucentral-schema: update to latest HEAD
1d7e565 optimize the bridge/uci config for gre tunnels

Signed-off-by: John Crispin <john@phrozen.org>
2022-06-16 12:44:53 +02:00
Stijn Tintel
32b1aade42 ipq807x: force ext4 creation in emmc_do_upgrade
Running mkfs.ext4 on a partition that already contains an ext4
filesystem asks for input:

  mke2fs 1.45.6 (20-Mar-2020)
  /dev/mmcblk0p9 contains a ext4 file system
          created on Sat Jun 11 12:23:42 2022
  Proceed anyway? (y,N) y

This breaks the ability to run sysupgrade non-interactively. Add the -F
switch to force ext4 creation to fix this.

Fixes: WIFI-9419
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-06-15 12:42:34 +02:00
Stijn Tintel
2a92b75fe1 ipq807x: silence dd errors in do_flash_emmc
Running dd if=/dev/zero to a partition will always throw an ENOSPC error
when reaching the end of the partition. Silence those errors to avoid
confusion.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-06-15 12:42:34 +02:00
John Crispin
cb30d9e20a ipq807x: add motorola q14 support
Fixes: WIFI-8040
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-15 12:42:34 +02:00
John Crispin
588206b93b ucentral-schema: update to latest HEAD
417fcc4 fix selection of radius proxy ip

Fixes: WIFI-9461
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
6399649038 ipq807x: improve dual boot on eap101/2
inverse the logic that figures out if we want to set upgrade_available.

Fixes: WIFI-7712
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
aa3cb95233 wireguard-tools: do not select the kernel module
unetd will select the correct kernel module.

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:48 +02:00
John Crispin
3ea06dac40 dhcpsnoop: update code
* Update to latest version of dhcpsnoop
* always snoop all upstream interfaces
* add snooped leases to state

Fixes: WIFI-7838
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-13 14:57:21 +02:00
jaspreetsachdev
a70dda4a8e Merge pull request #453 from Telecominfraproject/main
Merge Main to release/v2.6.0
2022-06-09 15:43:49 -04:00
John Crispin
a01f1add81 ipq807x: disable Q14 image generation
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:06:39 +02:00
Felix Fietkau
57849591d7 ipq807x: backport act_mirred changes
Fixes: WIFI-7838
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-06-09 14:06:25 +02:00
John Crispin
b4a09e7167 ucentral-schema: update to latest HEAD
96324e2 fix a typo inside the state handler

Fixes: WIFI-7838
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:34 +02:00
John Crispin
96bb8b1372 ucentral-schema: update to latest HEAD
6974baa add data model support for wireguard overlay networks

Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:24 +02:00
John Crispin
99ea9da785 ipq807x: add kmod-wireguard backport package
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:05:00 +02:00
John Crispin
bfe7fadfc5 ucentral-schema: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:04:04 +02:00
John Crispin
ad1dcc4f45 radius-gw-proxy: fix compile error on gcc5
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:53 +02:00
John Crispin
f371c789d0 ipq807x: revert all 11.5 changes
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:42 +02:00
John Crispin
386eca1f65 wifi-ax: revert all ath11.5 changes
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:03:05 +02:00
John Crispin
8b9047952d ipq807x: make USB work on wallys-dr6018 and disable sdhci
Fixes: WIFI-9306
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 14:01:49 +02:00
John Crispin
5a105ef06e hostapd: make psk2-radius work on wifi-5 devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 13:59:43 +02:00
John Crispin
c60dc1e045 wifi-ax: disable encap offloading in WDS / STA mode
Fixes: WIFI-9305
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-09 13:58:06 +02:00
John Crispin
1e1bd19429 ucentral-schema: update to latest HEAD
bfa2647 make sure that vxlan tunnels endup inside a bridge

Fixes: WIFI-9121
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-30 08:26:51 +02:00
John Crispin
cfe07f6e15 ipq807x: backport the skb->cb fix from upstream
This was causing sporadic proxy_arp failures.

Fixes: WIFI-7154
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-30 06:03:02 +02:00
John Crispin
a64039db20 mac80211-qca: properly rebase a patch
The patch had a line skew due to a bad rebase.

Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 18:11:58 +02:00
John Crispin
7f81ddb8cc ucentral-schema: update to latest HEAD
27f451b add script command handler

Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 18:11:58 +02:00
John Crispin
3c0d495334 ucode: package the uloop library
Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 17:33:14 +02:00
John Crispin
38a7c54cce ucentral-client: update to latest HEAD
a4671bb fix an error reported by CI
a82c3f0 add handling for the "script" command

Fixes: WIFI-9120
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 17:31:00 +02:00
Jianhui Zhao
1aead07444 ath11k-wifi: update GL-AXT1800 BDF
Fixes: WIFI-8042
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-29 10:31:54 +02:00
John Crispin
d2f44cbb12 ucentral-schema: update to latest HEAD
d1c7ab8 add ip-collide handler

Fixes: WIFI-7830
Fixes: WIFI-7989
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-29 10:30:45 +02:00
John Crispin
43d7ca31d6 wifi-ax/mac80211: make the 11.4 ath11k work inside the v5.4 kernel
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-27 10:05:52 +02:00
John Crispin
0985c573b0 ipq807x: fix MAC assign on cig-wf19* units
The mtd offset changed in the v5.4 kernel causing MAC lookup to fail.

Fixes: WIFI-7997
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-27 07:34:07 +02:00
John Crispin
d9ed861c1d ipq807x: add support for wallytech dr6018(-v4)
Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 16:20:34 +02:00
John Crispin
8ef9989147 ipq807x: fix a null pointer crash in ip_tunnel
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:51:07 +02:00
John Crispin
7d5eab4bf3 libnl-tine: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:50:34 +02:00
John Crispin
5e03e04bbd unetd: add wireshark overlay service
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:30:11 +02:00
John Crispin
6fabaeca53 kernel-headers: make sure that the QSDK v5.4 kernel has access to the wireshark headers
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:59 +02:00
John Crispin
be4ca445f5 netifd: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:36 +02:00
John Crispin
e99c8b27e1 libubox: update to latest HEAD
Fixes: WIFI-7571
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:28:11 +02:00
John Crispin
e9055b4f08 ucentral-schema: update to latest HEAD
6d83248 add missing radsec features

Fixes: WIFI-7077
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-26 09:13:23 +02:00
John Crispin
cfcafb676b ipq807x: backport the wireguard patches from the generic folder
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 17:28:11 +02:00
GL.iNet-Xinfa.Deng
899b4d6bfd ipq807x: fix gl-ax1800 switch button high active level
The active status of the switch button in the DTS configuration
is the opposite of that marked on the product housing.

The switch button should be activated at high GPIO level.

Fixes: WIFI-8042
Signed-off-by: GL.iNet-Xinfa.Deng <xinfa.deng@gl-inet.com>
2022-05-24 15:07:19 +02:00
John Crispin
2003632ddb ucentral-schema: update to latest HEAD
db15ed7 third-party services were not getting shut down properly

Fixes: WIFI-6907
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:14 +02:00
John Crispin
d4a14106b7 radius_gw_proxy: add support for a radius/gateway proxy
This will allow the AP to send radius requests via the websocket
to the gateway for routing to the correct AAA.

Fixes: WIFI-7328
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:14 +02:00
John Crispin
85af9d7e0b ipq807x: add motorola q14 support
Fixes: WIFI-8040
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-24 14:05:06 +02:00
John Crispin
d4442efbfe ipq807x: disable bluetooth on eap102
this causes units to take several minutes if the nrf8 chip has not been flashed yet

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:37:10 +02:00
John Crispin
3a26ae2695 ipq807x: re-add patches that got lost during the v5.4 update
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:36:42 +02:00
John Crispin
09af596e85 ipq807x: fix the lan port on EAP102
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 15:36:20 +02:00
John Crispin
5985187316 .github: remove wallys cypress from CI until bootloop on v5.4 is resolved
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 12:12:22 +02:00
John Crispin
33ac83a309 wifi-ax: enable fils_discovery and multiple_ssid by default on 6g band
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 11:29:36 +02:00
John Crispin
921c1b553d ipq807x: enable ethernet LEDs on wf196
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-20 11:29:11 +02:00
Jianhui Zhao
d160507230 ipq807x: fix dts for gl-ax1800
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-19 13:16:26 +02:00
Jianhui Zhao
7368620fd2 ipq807x: bump glinet ax1800/axt1800 to ath11.5/v5.4
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-05-19 11:21:21 +02:00
John Crispin
a910e297a3 ucentral-schema: update to latest HEAD
7ead16a add device serial as an additional TLV inside radius requests

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-18 13:02:32 +02:00
John Crispin
f819bb8753 wifi-ax: update hostapd to latest 11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-18 10:59:06 +02:00
John Crispin
cc0d4bded2 ipq807x: bump wf194c4 to ath11.5/v5.4
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:33 +02:00
Felix Fietkau
e3b2b7f232 ipq807x: enable threaded napi on ethernet
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
Felix Fietkau
c8dde50eba ath11k: enable threaded napi support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
Felix Fietkau
3c355f96eb ipq807x: backport threaded NAPI support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-05-17 07:45:32 +02:00
John Crispin
93dd24ef6e qca-nss-fw: update maple firmware
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
107bc8ef65 ucentral-schema: update to latest HEAD
a18efc1 add psk2-radius support

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
9a8278afcc hostapd: add psk2-radius support
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
1c48765913 ipq807x: add the diagchar module
This is required for FTM to correctly work

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
c6a45184fd ipq807x: fix buildsystem for ath11.5-csu
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
18d5b8cba7 batman-adv: drop v4.4 backport
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
65c08ade18 ath11k-wifi: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
3f6fee91e9 ath11k-firmware: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
d29c4e49b3 mac80211-qsdk: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
f162000749 qca-thermald-10.4: drop legacy package
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
c804333bc0 kmod-sched-cake: drop legacy v4.4 backport
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00
John Crispin
449795db97 ipq807x: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:31 +02:00
John Crispin
af92a2c7aa qca-nss-clients: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:52 +02:00
John Crispin
b68affdf6a qca-nss-dp: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:33 +02:00
John Crispin
7a95f9ac2d qca-nss-drv: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:31:16 +02:00
John Crispin
8b5d9d84de qca-ssdk-shell: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:30:59 +02:00
John Crispin
93d93c7708 qsdk-ssdk: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 14:30:21 +02:00
John Crispin
b35232ab4a wifi-ax: enable fils_discovery and multiple_ssid by default on 6g band
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:51:06 +02:00
John Crispin
770a2bdd36 wifi-ax: add ftm package as default selection
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:46:21 +02:00
John Crispin
9650f8eaa8 iwinfo: fix 6e channel calculation
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:45:30 +02:00
John Crispin
63ab76bb30 ucentral-schema: add various 6e fixes
ba2bc69 fix wifi 6e channel calculation

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-12 11:39:58 +02:00
John Crispin
fcb21ca0b6 ucentral-schema: add a sample wifi 6e config file
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-06 12:44:35 +02:00
John Crispin
d6d5422152 ipq40xx: add indio UM510/550AC support
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-06 09:08:59 +02:00
John Crispin
5b970a3f12 .github: add Indio UM-305ax to the CI job
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-05 10:38:59 +02:00
Matthew Hagan
a4a7c1f9f3 usteer: uchannel.uc: check host_info exists
If another host has not set a status, for example when autochannel is
disabled, it will not show host_info when remote_hosts is called. This
fix adds a check for this condition.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2022-05-05 09:50:35 +02:00
John Crispin
5cbac23e3f ramips: disable switch/bridge offload
This is breaking win10 laptops when vlan_filtering is enabled

Signed-off-by: John Crispin <john@phrozen.org>
2022-05-04 17:09:53 +02:00
John Crispin
172c0d3690 bpf.mk: backport a fix that unbreaks bpf compile on armv7
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-03 07:44:34 +02:00
John Crispin
535f41d58b hostapd: fix phy level max-assoc settings
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-02 08:47:12 +02:00
John Crispin
2be18091a4 proxy_arp: backport skb->cb fix from upstream kernel
this caused proxy_arp to misbehave

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 12:24:51 +02:00
John Crispin
73f42e3c6f ipq807x: enable dual boot on HFCL ION4X*
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
cff778d8ca treewide: update ucode to work with latest interpreter
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
94d4498a2d ucode: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-26 07:59:41 +02:00
John Crispin
eb0ab17f58 ipq807x: enable dual boot on EdgeCore devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
John Crispin
1ab99d50b2 certificates: add support for finding certificates on dual boot devices
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
Johann Hoffmann
dfeddc0d89 x86: add CI workflows
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-04-21 11:18:58 +02:00
Johann Hoffmann
efde86be9d x86: add vm images
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-04-21 11:18:58 +02:00
John Crispin
739e8c12fb ramips: fix actiontect web7200 wifi macs
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
John Crispin
3fdbbff9f7 ucentral-schema: update to latest HEAD
4829132 properly honour mac addresses that are inside board.json
ba9a2ee various 6G improvements
0a05052 interface: fix wan side STA-only interfaces

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-21 11:18:58 +02:00
Sohail Ahmad
0a56755bef ramips: Support for Indio UM-305AX AP
Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
2022-04-21 11:18:58 +02:00
John Crispin
c35290772d ipq40xx: add certificate partition to cig-wf610
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-19 10:28:15 +02:00
John Crispin
cedcbcbc2b ratelimit: fix ratelimit for multiple bss
The function looking up the rate was leaking a local variable into the global space

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-19 07:40:58 +02:00
Stijn Tintel
9de96deca8 usteer: rename uptime to executed in uchannel.uc state
The uptime value in the uchannel state contains the uptime at the time
the script was last executed. This is a rather confusing name, and
possibly this is what lead to WIFI-7613. Rename it to executed to avoid
confusion in the future.

Keep the original name in the usteerd node status, as it is unclear what
impact this has, and could lead to breakage elsewhere.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:42 +02:00
Stijn Tintel
19dbb1d5e3 usteer: fix uchannel.uc script
Once the uchannel.uc script sets its status to waiting, it becomes
defunct. The next invocation of the script will compare uptime to
state.uptime, and if the difference is less than 12h, it will change
state.uptime to the current uptime and return. As the script runs every
5 minutes, the difference will always be less than 12h.

Fix this by comparing uptime against state.changed rather than
state.uptime.

Fixes: WIFI-7613
Fixes: 670bc9d2e2 ("ucentral: development update")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:42 +02:00
Stijn Tintel
83b6ccf562 usteer: fix init script
The uchannel instance of the usteer init script contains a typo, causing
the following error when autochannel is enabled:

/etc/rc.common: line 147: procd_close_instancea: not found

Fixes: WIFI-7577
Fixes: c467a62af3 ("usteer: update to latest HEAD")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-04-19 06:35:12 +02:00
Owen Anderson
ea86593835 profiles: Fixed typo in cig_wf610d profile name
Signed-off-by: Owen Anderson <owen.anderson@netexperience.com>
2022-04-19 06:33:24 +02:00
John Crispin
36b5478005 ipq807x: fix dwc3 module dependency
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-06 08:54:20 +02:00
John Crispin
1ad19297c1 ipq807x: factory images for wf196 were generated with a bad page size
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-06 08:53:20 +02:00
John Crispin
f5357f7854 ath11k: add ath11k-fwtest support
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-05 17:21:55 +02:00
Johann Hoffmann
8a3140b89b Add dummy workflow to test workflow modifications in PR branch
Signed-off-by: Johann Hoffmann <johann.hoffmann@mailbox.org>
2022-04-05 15:13:54 +02:00
John Crispin
16e0724ace ramips: fix actiontec web7200 dual boot
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-04 16:09:55 +02:00
wenij
17ff9eecf5 ipq807x: cybertan eww622 usb xchi driver not work
Signed-off-by: wenij <wenij.chang@cybertan.com.tw>
2022-04-04 10:54:46 +02:00
wenij
4b870f978c ipq807x: Cybertan EWW622-A1 get mac address from nand devinfo partition.
Signed-off-by: wenij <wenij.chang@cybertan.com.tw>
2022-04-04 10:53:10 +02:00
John Crispin
8b83365961 ucentral-schema: update to latest HEAD
7015feb improve wifi reload

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-04 06:54:06 +02:00
John Crispin
c6ebb5537a ucentral-schema: update to latest HEAD
e12bc03 revert hostapd restart hack as the root cause of the channel issue was found

Signed-off-by: John Crispin <john@phrozen.org>
2022-04-01 14:15:50 +02:00
John Crispin
6ebe189d71 ramips: fix uboot-env-tools mtd offset
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-31 13:41:16 +02:00
John Crispin
98b56551d5 mac80211: automatically restart wifi if bringup failed
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-31 10:58:50 +02:00
John Crispin
606e27e256 wifi: fix channel select when using ACS
there were several small issues that caused ACS to leave the radio in a bad state
during sanity runs.

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-31 10:58:45 +02:00
John Crispin
94fe14b9f9 ucentral-schema: update to latest HEAD
4cff999 add a 5s delay on config re-apply to give wifi time to restart

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-30 16:46:43 +02:00
John Crispin
58388f84b6 ipq40xx: add status led support on udaya board
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-29 13:44:54 +02:00
John Crispin
79ea04af49 ipq807x: re-add accidentially deleted config-default
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-29 13:22:38 +02:00
John Crispin
396e2bd06c ucentral-client: cleanup health parameter
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-29 07:29:12 +02:00
John Crispin
1a484c7f39 protobuf: drop legacy out of tree package
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-28 15:12:04 +02:00
John Crispin
e6b1030991 ucentral-schema: update to latest HEAD
9ac9f7e health: add a 75s delay when applying a new config

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-25 16:08:34 +01:00
John Crispin
6e32e68302 ucentral-client: update to latest HEAD
6cb4485 drop healthcheck from the client and move it to its own service

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-25 16:08:34 +01:00
John Crispin
0f13f7f5cd ipq40xx: add support for udaya a5 id2
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-25 16:08:34 +01:00
John Crispin
2ac4f9ef1d ucentral-schema: update to latest HEAD
fb6db0f force hapd restart upon cfg apply
ee0a8a4 broadband username was not getting applied correctly

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-24 15:59:34 +01:00
wenij
f1a75c25f9 ipq807x: Cybertan EWW622-A1 LED fixes
Signed-off-by: wenij <wenij.chang@cybertan.com.tw>
2022-03-24 15:59:34 +01:00
John Crispin
ff8d70753d ucentral-event: update to latest HEAD
24b7fb3 use async invoke when sending events

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-23 12:09:25 +01:00
John Crispin
caea6baecd certificates: create ubivolume with LEBs instead of MiB
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-23 11:51:32 +01:00
John Crispin
2e914c9b35 ipq807x: use CIG mac address hack on wf196
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-23 11:50:34 +01:00
Jianhui Zhao
da65d7e06f ipq807x: add initial support for GL.iNet AXT1800
Hardware:
* SoC: Qcom IPQ6000
* RAM: DDR3L 512MB
* Flash: 128MB Nand
* Ethernet: 3x GbE
* WLAN: 2x2 2.4GHz 600Mbps + 2x2 5GHz 1200Mbps (builtin + builtin)
* LEDS: 1x white, 1x blue
* Buttons: 1x switch, 1x reset
* USB: 1x 3.0(Type-A)
* SD: 1x microSD
* PWM Fan
* Power: 12VDC, 2A
* UART (4-pin, 2.54 mm pitch) pad on PCB
* JTAG (8-pin, 2.54 mm pitch) pad on PCB

Installation: upgrade "openwrt-ipq807x-glinet_ax1800-squashfs-sysupgrade.tar" directly.

Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-03-22 08:19:50 +01:00
Sohail Ahmad
d18eef480c ipq40xx: add Support for Indio's UM-325AC AP
Changes made in OpenWrt supported targets to Include Indio's UM-325AC AP which is an indoor WiFi5 AP based on ipq4019 chipset.

Signed-off-by: Sohail Ahmad <sohail@indionetworks.com>
2022-03-22 08:04:40 +01:00
John Crispin
f3532c66e5 ucentral-client: update to latest HEAD
63eddd2 send the original size when using compress_64

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-21 09:44:32 +01:00
Felix Fietkau
9678b1d6a5 ipq807x: backport clsact support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-21 09:00:35 +01:00
John Crispin
379a4e2382 ucentral-schema: update to latest HEAD
fb537b9 enhance healthcheck to provide verbose error messages
2b65900 sysinfo: add helper tool to monitor memory consumption per service/instance

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-21 08:44:43 +01:00
John Crispin
edb33cd560 ucentral-schema: update to latest HEAD
5865d5a fix detection of pci radios

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-17 16:11:55 +01:00
John Crispin
2ff425ddeb ucentral-schema: update to latest HEAD
6dbd602 fix gre bridges
611af3d fix vxlan bridges

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-17 10:22:28 +01:00
John Crispin
7d016ac27f ucentral-schema: update to latest HEAD
d97a35c do not allow roaming for none, psk and wpa

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-15 18:49:51 +01:00
John Crispin
9790377dec ath11k-wifi: update cig wf196 BDF files
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-15 17:25:25 +01:00
John Crispin
597c547101 ipq807x: fix vmalloc on wf196
the built in wifi failed to start

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-15 16:24:33 +01:00
John Crispin
73b2645027 ucentral-schema: update to latest HEAD
9dfff17 fix include paths of the new wifi module

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-15 10:37:02 +01:00
John Crispin
8d58387d15 ucentral-schema: update to latest HEAD
ef7649f fix channel 140
302c5bf drop dependency on ucentral-wifi

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-14 17:19:07 +01:00
John Crispin
54dac4d348 ucode: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-14 17:17:59 +01:00
John Crispin
a0880ed0f1 edgecore: disable dual boot on eap10x/ecw5211
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-11 16:28:41 +01:00
John Crispin
ed6d683980 ramips: add bmtv2 and nbnm support
this fixes the nand issue on the actiontec web7200

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-11 14:57:54 +01:00
John Crispin
4c72c6a35a ucentral-wifi: update to latest HEAD
aa9c3ee set the AP bssid inside the assoc list

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-11 07:59:34 +01:00
Sven Eckelmann
125d56866e batman-adv: Merge bugfixes from 2022.0
* allow netlink usage in unprivileged containers
* mcast: don't send link-local multicast to mcast routers

Origin: upstream, https://git.openwrt.org/?p=feed/routing.git;a=commit;h=9e2383e9b42087d5a3892366bed8b6bb4f868fe3
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-03-10 15:10:05 +01:00
Hendrik Borghorst
a70a767ec0 batman-adv: Prevent use from libc headers to not build with BIG_ENDIAN
Commit 97d35a552ec5b6ddf7923dd2f9a8eb973526acea of musl introduced the
macros __LITTLE_ENDIAN and __BIG_ENDIAN in alltypes.h. These are pulled
into the compilation of batman-adv. This has the side effect that the
function is_multicast_ether_addr of etherdevice.h in Linux kernel is
compiled as the big endian version and so fails to work properly on
little endian devices.

This commits prevents pulling in header files of musl libc similar to
OpenWRT commit 9ac47ee46918c45b91f4e4d1fa76b1e26b9d57fe

Origin: upstream, https://git.openwrt.org/?p=feed/routing.git;a=commit;h=47436b04fd32cf3b6e6b46c25cb9c1fff3a995fd
Signed-off-by: Hendrik Borghorst <hendrikborghorst@gmail.com>
(cherry picked from commit 523821c1959cb288b55b7fcc8761c83f6ff48c4d)
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-03-10 15:10:05 +01:00
Sven Eckelmann
b8a6764207 batman-adv: Merge bugfixes from 2021.4
* fix error handling during interface initialization

Origin: upstream, https://git.openwrt.org/?p=feed/routing.git;a=commit;h=6d10a01dfa68eb5e25b84b33e33aefd312f46f4d
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-03-10 15:10:05 +01:00
Sven Eckelmann
98c9fcfd5d batman-adv: Refresh patches with quilt
The test builds are now requiring quilt refreshed patches instead of git
patches. Otherwise the build check will not even try to build something.

Origin: upstream, https://git.openwrt.org/?p=feed/routing.git;a=commit;h=e294a224640e03791a101a9302dbf72b06efab80
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-03-10 15:10:05 +01:00
Sven Eckelmann
eac5504fec batman-adv: Merge bugfixes from 2021.2
* Avoid WARN_ON timing related checks

Origin: upstream, https://git.openwrt.org/?p=feed/routing.git;a=commit;h=519ef4ad29a8e53c1763df1553d386e3abf6206d
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-03-10 15:10:05 +01:00
Piotr Dymacz
c2c75b67eb ipq807x: add initial support for YunCore AX840
This adds initial support for the YunCore AX840, an IPQ6010 based
802.11ax ceiling AP.

Specifications:

- Qualcomm IPQ6010
- 1 GB of RAM (DDR3)
- 8 MB of serial flash (SPI NOR)
- 256 MB of parallel flash (NAND)
- 2x2 2.4 GHz WiFi (IPQ6010)
- 2x2 5 GHz WiFi (IPQ6010)
- 2x IPEX/U.FL antenna connectors
- 4x 3 dBi dual-band antennas
- 2x 1 Gbps Ethernet (QCA8075) with 802.3at PoE input support
- 1x RGB LED
- 1x push-button (reset)
- DC jack for main power input (12 V)
- UART (4-pin, 2.54 mm pitch) header on PCB

Flash instruction under stock QSDK image:

  sysupgrade -n openwrt-ipq807x-yuncore_ax840-squashfs-nand-factory.bin

Flash instruction under U-Boot:

  tftpb 0x44000000 openwrt-ipq807x-yuncore_ax840-squashfs-nand-factory.ubi
  flash rootfs
  reset

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-03-10 14:50:37 +01:00
John Crispin
ef3eacefa7 ath11k-wifi: update WF188n BDF
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-10 08:21:58 +01:00
John Crispin
ef7481596a qosify: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-10 08:18:47 +01:00
Paul Spooren
6f4e00aa46 README: fix linksys_ea8300 example
The profile is no longer called just `ea8300`.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2022-03-10 07:59:59 +01:00
Jianhui Zhao
be65578a7f profile: add gl-ax1800 support
Because we have an another similar device named gl-axt1800,
so we put the common functions in a dtsi file. And we'll
submit a PR for gl-axt1800 soon.

Hardware:
* SoC: Qcom IPQ6000
* RAM: DDR3L 512MB
* Flash: 128MB Nand
* Ethernet: 5x GbE
* WLAN: 2x2 2.4GHz 600Mbps + 2x2 5GHz 1200Mbps (builtin + builtin)
* LEDS: 1x white, 1x blue
* Buttons: 1x switch, 1x reset
* USB: 1x 3.0(Type-A)
* Power: 12VDC, 1.5A

Installation:
* from qsdk to openwifi:
upgrade "openwrt-ipq807x-glinet_ax1800-squashfs-nand-factory.bin" via web ui
without keep config.
* upgrade "openwrt-ipq807x-glinet_ax1800-squashfs-sysupgrade.tar" if you are already in openwifi.

Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-03-10 07:59:21 +01:00
John Crispin
20d4bd0c7d ucentral-schema: fix online-check
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-10 07:52:13 +01:00
John Crispin
531f4eb811 ucentral-schema: update to latest HEAD
4532c47 fix downstream bridges with no eth ports
04edaef ntp: open firewall port if ntpd is enabled
bf11105 fix led-active restart
c95667a a failed apply should return the error code 2
72e225e capabilities: add label_macaddr to capabilities

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-10 07:52:13 +01:00
John Crispin
3b0dae7189 ucentral-schema: update to latest HEAD
72e225e capabilities: add label_macaddr to capabilities
f09f2b2 state: improve link metric, add ssid location
5586b93 unit: improve password generation
959a40d system: add sysinfo / resource consumption reporting
cdfb209 state: fix link state reporting

Fixes: WIFI-7210
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-03 17:12:31 +01:00
John Crispin
79395593ba ipq807x: add support for label_macaddr
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-03 17:09:21 +01:00
John Crispin
61248b98e0 ucentral-schema: set executable bit for wifi_max_user.uc
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-02 16:02:18 +01:00
Felix Fietkau
72b5abb72a ath10k: enable threaded napi support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-02 15:45:08 +01:00
Felix Fietkau
673a029a02 ipq807x: enable threaded napi on ethernet
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-02 15:45:08 +01:00
Felix Fietkau
7efb85180f ipq807x: backport threaded napi support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-02 15:45:08 +01:00
Felix Fietkau
f95eadaa8f ipq807x: backport kbuild fix to avoid spurious rebuilds
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-02 15:45:08 +01:00
Felix Fietkau
6f6b40a94f toolchain/gcc: fix building gcc 5.5 on newer systems
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-02 15:45:08 +01:00
John Crispin
d84982f161 ath11k: fix WDS when encap offload is enabled
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-02 15:45:08 +01:00
John Crispin
4b07afe59f ucentral-schema: update to latest HEAD
19fcc8d update schemareader
bef2a8f state: add the upstream dhcp servers ip to the state message

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-02 15:12:50 +01:00
John Crispin
5d53d138b0 maverick: add the last 3 bytes of the serial to the Maverick ssid
Fixes: WIFI-7202
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-02 15:12:21 +01:00
John Crispin
e40631b8cd ucentral-schema: update to latest HEAD
ba41897 radio: enable 'allow-dfs' by default

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-01 17:36:54 +01:00
John Crispin
22135129bd treewide: fix pkg hashes
Signed-off-by: John Crispin <john@phrozen.org>
2022-03-01 17:36:52 +01:00
John Crispin
de4b3c4edc ucentral-wifi: update to latest HEAD
40d0eb9 use the real usec value for tx/rx duration

Signed-off-by: John Crispin <john@phrozen.org>
2022-03-01 17:36:48 +01:00
John Crispin
e3b1fe36e5 hostapd: enable CONFIG_ERP
This caused local EAP to not work on wifi-qsdk targets.

Fixes: WIFI-7203
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-28 11:16:02 +01:00
John Crispin
5af7e1e7d8 ucode: add tool to read out the max clients an AP can handle per phy
Fixes: WIFI-7197
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-28 10:52:40 +01:00
John Crispin
057ebb8660 ucentral-schema: update to latest HEAD
1c46544 5G was not allowing specific 20MHz channels and would fall back to ACS

Fixes: WIFI-7179
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-28 10:08:43 +01:00
John Crispin
17fe72c6e9 wifi: revert some tweaks that are causing stability issues
this will come back in 2.6 once stability is restored

Signed-off-by: John Crispin <john@phrozen.org>
2022-02-25 17:34:27 +01:00
John Crispin
834ff2fe4f certificates: improve the code loading sqsh certificates
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-23 07:54:22 +01:00
John Crispin
ce3849e131 ipq40xx: revert an upstream patch causing problem with ea8300 eth ports
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-23 07:54:00 +01:00
John Crispin
66640cdd1a ipq807x: add cig wf196 to the CI builds
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-22 16:33:52 +01:00
John Crispin
300924a4be hostapd: fix syntax error inside hostapd.sh
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-22 15:13:28 +01:00
John Crispin
8fb088bcc8 ucentral-schema: update to latest HEAD
b3ce69e wifiscan: allow bandwith override
6d59acc trace: improve tracing code

Fixes: WIFI-7167
Fixes: WIFI-7168
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-22 08:59:48 +01:00
John Crispin
b08455228f ipq807x: point edgecore eap104 profile at the correct image
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-18 15:09:18 +01:00
John Crispin
09563eadaf ipq807x: do not enable bridge-vlan in maverick mode
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-18 10:29:25 +01:00
John Crispin
2df46a2c77 ipq807x: fix LEDs on wf196
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-18 10:29:25 +01:00
John Crispin
e4fa57b4d0 proxy_arp: backport skb->cb fix from upstream kernel
this caused proxy_arp to misbehave

Signed-off-by: John Crispin <john@phrozen.org>
2022-02-17 08:28:21 +01:00
John Crispin
48677a6943 ipq807x: add edgecore eap104 support
Fixes: WIFI-7117
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-16 15:44:24 +01:00
John Crispin
e79970ce04 ath11k: disable napi threading
The code causes 15% softirq in idle causing issue, drop until resolved.

Signed-off-by: John Crispin <john@phrozen.org>
2022-02-15 20:46:06 +01:00
John Crispin
b4d1d58fc9 hostapd: improve acs_exclude_dfs support
Fixes: WIFI-6933
Signed-off-by: John Crispin <john@phrozen.org>
2022-02-15 17:06:22 +01:00
3508 changed files with 702597 additions and 121651 deletions

View File

@@ -0,0 +1,39 @@
name: Create AMI from firmware image in S3 bucket
inputs:
firmware_image_name:
description: Name of the firmware image
required: true
firmware_image_s3_bucket:
description: Name of the S3 bucket where the image resides
required: true
runs:
using: "composite"
steps:
- name: Import snapshot based on firmware image
id: import_snapshot
shell: bash
run: |
echo "import_task_id=$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')" >> $GITHUB_OUTPUT
- name: Wait for import task to complete and get snapshot ID
id: get_snapshot_id
shell: bash
run: |
IMPORT_TASK_STATUS=""
while [[ $IMPORT_TASK_STATUS != 'completed' ]]; do
IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion."
done
echo "id=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')" >> $GITHUB_OUTPUT
- name: Tag snapshot with image name
shell: bash
run: |
aws ec2 create-tags --resources ${{ steps.get_snapshot_id.outputs.id }} --tags 'Key=Name,Value=${{ inputs.firmware_image_name }}'
- name: Register AMI based on snapshot
shell: bash
run: |
aws ec2 register-image --name '${{ inputs.firmware_image_name }}' --root-device-name /dev/xvda --block-device-mappings 'DeviceName=/dev/xvda,Ebs={SnapshotId=${{ steps.get_snapshot_id.outputs.id }}}'

View File

@@ -1,5 +1,13 @@
name: Build OpenWrt/uCentral images
env:
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
on:
push:
branches: [ main, next, staging-* ]
@@ -8,13 +16,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest
outputs:
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
strategy:
fail-fast: false
matrix:
target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'indio_um-305ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4' ]
target: [ 'cig_wf186w', 'cig_wf188n-ca', 'cig_wf188n-ca-ath12', 'cig_wf188n-us', 'cig_wf196-us', 'cig_wf196-ca', 'cig_wf196-ca-ath12', 'cig_wf610d', 'cig_wf660a', 'cig_wf808', 'cybertan_eww622-a1', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'edgecore_eap101', 'edgecore_eap101-ath12', 'edgecore_eap102', 'edgecore_eap102-ath12', 'edgecore_eap104', 'edgecore_eap104-ath12', 'liteon_wpx8324', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_oap101-6e', 'edgecore_oap101e', 'hfcl_ion4','hfcl_ion4xi_wp', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4xi_w', 'hfcl_ion4xi_HMR', 'hfcl_ion4x_w', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'indio_um-310ax-v1', 'indio_um-510axp-v1', 'indio_um-510axm-v1', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4', 'x64_vm', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build image for ${{ matrix.target }}
id: build
@@ -24,17 +34,12 @@ jobs:
make -j TARGET=${{ matrix.target }}
- name: Package and upload image for ${{ matrix.target }}
id: package_and_upload_image
env:
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
ARTIFACTORY_USERNAME: cicd-indoor-main
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
run: |
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
HASH=$(git rev-parse --short HEAD)
@@ -66,6 +71,10 @@ jobs:
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
if [ ${{ matrix.target }} == 'x64_vm' ]; then
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
fi
trigger-testing:
runs-on: ubuntu-latest
needs: build
@@ -78,3 +87,16 @@ jobs:
repository: Telecominfraproject/wlan-testing
event-type: new-ap-release
client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}'
create-x64_vm-ami:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Use create-ami-from-image composite action
uses: ./.github/actions/create-ami-from-image
with:
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}

88
.github/workflows/x64_vm-build-test.yml vendored Normal file
View File

@@ -0,0 +1,88 @@
name: Test x64_vm build and AMI creation
env:
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-1
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
strategy:
fail-fast: false
matrix:
target: ['x64_vm']
steps:
- uses: actions/checkout@v3
- name: Build image for ${{ matrix.target }}
id: build
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
make -j TARGET=${{ matrix.target }} make -j TARGET=${{ matrix.target }}
- name: Package and upload image for ${{ matrix.target }}
id: package_and_upload_image
env:
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
ARTIFACTORY_USERNAME: cicd-indoor-main
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: |
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
HASH=$(git rev-parse --short HEAD)
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
then
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
IS_RELEASE="false"
else
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
IS_RELEASE="true"
fi
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
TAR_NAME="$BASENAME.tar.gz"
IMG_NAME="$BASENAME-upgrade.bin";
JSON_NAME="$BASENAME.json";
tar cfz "$TAR_NAME" -C openwrt/bin/targets/ .
curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME""
IMG_NAME="$BASENAME-upgrade.bin";
TIP_VERSION="$(grep DISTRIB_TIP= openwrt/tmp/openwrt_release | cut -d\' -f2)"
echo -e "{\n\t\"image\":\""${IMG_NAME}"\",\n\t\"revision\": \""${TIP_VERSION}"\",\n\t\"timestamp\":\""$(date +%s)"\",\n\t\"compatible\": \""${LOWERCASE_TARGET}"\"\n}" > latest-upgrade.json
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "openwrt/$(cat openwrt/tmp/image-file)" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$IMG_NAME""
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
if [[ ${{ matrix.target }} == 'x64_vm' ]]; then
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
fi
create-x64_vm-ami:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
ref: WIFI-7206-add-workflow-to-build-virtual-ap-image
- name: Use create-ami-from-image composite action
uses: ./.github/actions/create-ami-from-image
with:
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}

View File

@@ -1,20 +1,83 @@
# Setting up your build machine
# OpenWiFi AP NOS
Requires a recent linux installation. Older systems without python 3.7 will have trouble. See this link for details: https://openwrt.org/docs/guide-developer/quickstart-build-images
OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi.
Read more at [openwifi.tip.build](https://openwifi.tip.build/).
Install build packages: sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml.
## Building
# Doing a native build on Linux
First we need to clone and setup our tree. This will result in an openwrt/.
### Setting up your build machine
Building requires a recent Linux installation. Older systems without Python 3.7
will have trouble. See this guide for details:
https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide
Install build packages on Debian/Ubuntu (or see above guide for other systems):
```
./setup.py --setup
sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml
```
Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file.
### Doing a native build on Linux
Use `./build.sh <target>`, or follow the manual steps below:
1. Clone and set up the tree. This will create an `openwrt/` directory.
```shell
./setup.py --setup # for subsequent builds, use --rebase instead
```
2. Select the profile and base package selection. This setup will install the
feeds and packages and generate the `.config` file.
```shell
cd openwrt
./scripts/gen_config.py ea8300
./scripts/gen_config.py linksys_ea8300
```
Finally we can build the tree.
```
make -j X V=s
3. Build the tree (replace `-j 8` with the number of cores to use).
```shell
make -j 8 V=s
```
### Build output
The build results are located in the `openwrt/bin/` directory:
| Type | Path |
| ---------------- | ---------------------------------------------------- |
| Firmware images | `openwrt/bin/targets/<target>/<subtarget>/` |
| Kernel modules | `openwrt/bin/targets/<target>/<subtarget>/packages/` |
| Package binaries | `openwrt/bin/packages/<platform>/<feed>/` |
## Developer Notes
### Branching model
- `main` - Stable dev branch
- `next` - Integration branch
- `staging-*` - Feature/bug branches
- `release/v#.#.#` - Release branches (*major.minor.patch*)
### Repository structure
Build files:
- `Makefile` - Calls Docker environment per target
- `dock-run.sh` - Dockerized build environment
- `docker/Dockerfile` - Dockerfile for build image
- `build.sh` - Build script
- `setup.py` - Clone and set up the tree
- `config.yml` - Specifies OpenWrt version and patches to apply
Directories:
- `feeds/` - OpenWiFi feeds
- `patches/` - OpenWiFi patches applied during builds
- `profiles/` - Per-target kernel configs, packages, and feeds
- [wifi-ax](profiles/wifi-ax.yml): Wi-Fi AX packages
- [ucentral-ap](profiles/ucentral-ap.yml): uCentral packages
- [x64_vm](profiles/x64_vm.yml): x86-64 VM image
### uCentral packages
AP-NOS packages implementing the uCentral protocol include the following
repositories (refer to the [ucentral](feeds/ucentral/) feed for a full list):
- ucentral-client: https://github.com/Telecominfraproject/wlan-ucentral-client
- ucentral-schema: https://github.com/Telecominfraproject/wlan-ucentral-schema
- ucentral-wifi: https://github.com/blogic/ucentral-wifi

View File

@@ -12,5 +12,5 @@ patch_folders:
- patches/ipq40xx
- patches/ipq806x
- patches/ipq807x
- patches/rtkmipsel
- patches/rest
- patches/x86

View File

@@ -0,0 +1,29 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ble_scan
PKG_VERSION:=1.0
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/ble_scan
SECTION:=base
CATEGORY:=Utilities
TITLE:=ble_scan
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Package/ble_scan/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ble_scan $(1)/bin/
endef
define Package/ble_scan/extra_provides
echo "libc.so.6";
endef
$(eval $(call BuildPackage,ble_scan))

View File

@@ -0,0 +1,47 @@
#all: ble_scan
#ble_scan: ble_scan.o
# $(CC) $(LDFLAGS) ble_scan.o -o ble_scan
#blescan.o: ble_scan.c
# $(CC) $(CFLAGS) -c ble_scan.c
#clean:
# rm *.o ble_scan
#
#
# Author: Teunis van Beelen
#
# email: teuniz@protonmail.com
#
#
#CROSS-COMPILE:=../../../../../qsdk/staging_dir/toolchain-arm/bin/arm-openwrt-linux-
#CC:=$(CROSS-COMPILE)gcc
CC = gcc
CFLAGS = -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -O2
objects = rs232.o
all: ble_scan
ble_scan : $(objects) ble_scan.o
$(CC) $(CFLAGS) $(objects) ble_scan.o -o ble_scan
ble_scan.o : ble_scan.c rs232.h
$(CC) $(CFLAGS) -c ble_scan.c -o ble_scan.o
rs232.o : rs232.h rs232.c
$(CC) $(CFLAGS) -c rs232.c -o rs232.o
clean :
$(RM) ble_scan $(objects) ble_scan.o
#
#
#
#

View File

@@ -0,0 +1,387 @@
/**************************************************
file: ble_scan.c
purpose: Send HCI command to do BLE scan
compile with the command: gcc ble_scan.c rs232.c -Wall -Wextra -o2 -o ble_scan
**************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include "rs232.h"
#define TX 0
#define RX 1
#define BUF_SIZE 4095
#define FULL_BUF_SIZE BUF_SIZE*4
//#define DEBUG
#ifdef DEBUG
#else
#endif
int print_hex(int mode, unsigned char *buf, int size);
int rx_pkt_parser(unsigned char *buf, int size);
struct rx_packet_h{
unsigned char rxType;
unsigned char rxEventCode;
unsigned char rxDataLen;
unsigned char Event[2];
unsigned char Status;
};
struct event_cmd_st_h{
unsigned char OpCode[2];
unsigned char DataLength;
};
struct event_scn_evnt_rep_h{
unsigned char EventId[4];
unsigned char AdvRptEventType;
unsigned char AddressType;
unsigned char Address[6];
unsigned char PrimaryPHY;
unsigned char SecondaryPHY;
unsigned char AdvSid;
unsigned char TxPower;
unsigned char RSSI;
unsigned char DirectAddrType;
unsigned char DirectAddr[6];
unsigned char PeriodicAdvInt[2];
unsigned char DataLength[2];
//unsigned char *DataPtr;
};
int main()
{
int cport_nr,bdrate,n;
//cport_nr=0, /* /dev/ttyS0 (COM1 on windows) */
//bdrate=9600; /* 9600 baud */
cport_nr=39, /* (ttyMSM1 : 39) */
bdrate=115200; /* 115200 baud */
#ifdef DEBUG
clock_t t;
#endif
char mode[]={'8','N','1',0};
unsigned char buf[BUF_SIZE];
unsigned char full_buf[FULL_BUF_SIZE];
int full_buf_ptr = 0;
unsigned char HCIExt_ResetSystemCmd[] = {0x01, 0x1D, 0xFC, 0x01, 0x00 };
int HCIExt_ResetSystemCmd_length = 5;
unsigned char GAP_DeviceInitCmd[] = {0x01, 0x00, 0xFE, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
int GAP_DeviceInitCmd_length = 12;
unsigned char GapScan_enableCmd[] = {0x01, 0x51, 0xFE, 0x06, 0x00, 0x00, 0xF4, 0x01, 0x28, 0x00 };
int GapScan_enableCmd_length = 10;
if(RS232_OpenComport(cport_nr, bdrate, mode, 0))
{
printf("Can not open comport\n");
return(0);
}
RS232_flushRXTX(cport_nr);
// send reset command
#ifdef DEBUG
t=clock();
print_hex(TX, HCIExt_ResetSystemCmd, HCIExt_ResetSystemCmd_length);
t=clock()-t;
printf("t=%ld\n",t); //60
#else
/* sleep for 60ms */
usleep(60000);
#endif
RS232_SendBuf(cport_nr, HCIExt_ResetSystemCmd, HCIExt_ResetSystemCmd_length);
/* sleep for 1 Second */
#ifdef DEBUG
t=clock();
#endif
usleep(1000000);
#ifdef DEBUG
t=clock()-t;
printf("CLOCKS_PER_SEC=%ld\n",t);
#endif
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
#ifdef DEBUG
t=clock();
print_hex(RX, buf, n);
t=clock()-t;
printf("t=%ld\n",t);
#else
/* sleep for 300ms */
usleep(300000);
#endif
// send device initial command
#ifdef DEBUG
t=clock();
print_hex(TX, GAP_DeviceInitCmd, GAP_DeviceInitCmd_length);
t=clock()-t;
printf("t=%ld\n",t);
#else
/* sleep for 250 ms */
usleep(250000);
#endif
RS232_SendBuf(cport_nr, GAP_DeviceInitCmd, GAP_DeviceInitCmd_length);
/* sleep for 0.5 Second */
usleep(500000);
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
#ifdef DEBUG
t=clock();
print_hex(RX, buf, n);
t=clock()-t;
printf("t=%ld\n",t);
#else
/* sleep for 500 ms */
usleep(500000);
#endif
// send scan command
#ifdef DEBUG
t=clock();
print_hex(TX, GapScan_enableCmd, GapScan_enableCmd_length);
t=clock()-t;
printf("t=%ld\n",t);
#else
/* sleep for 30ms */
usleep(30000);
#endif
RS232_SendBuf(cport_nr, GapScan_enableCmd, GapScan_enableCmd_length);
//read scan respone
while (n > 0)
{
/* sleep for 400 mS */
usleep(400000);
n = RS232_PollComport(cport_nr, buf, BUF_SIZE);
#ifdef DEBUG
t=clock();
print_hex(RX, buf, n);
t=clock()-t;
printf("t=%ld\n",t);
#endif
if (full_buf_ptr+n>FULL_BUF_SIZE)
{
#ifdef DEBUG
printf("buffer full. break.\n");
#endif
break;
}
memcpy(full_buf+full_buf_ptr, buf, n);
full_buf_ptr+=n;
#ifdef DEBUG
printf("n:%d, full_buf_ptr:%d\n",n, full_buf_ptr);
#endif
}
#ifdef DEBUG
print_hex(RX, full_buf, full_buf_ptr);
#endif
rx_pkt_parser( full_buf, full_buf_ptr);
#ifdef DEBUG
printf("n:%d, full_buf_ptr:%d\n",n, full_buf_ptr);
#endif
RS232_flushRXTX(cport_nr);
RS232_CloseComport(cport_nr);
return(0);
}
/**************************************************
Print buffer in HEX
**************************************************/
int print_hex(int mode, unsigned char *buf, int size)
{
int ii,jj;
if (mode == TX)
printf("TX: ");
else
printf("RX: ");
for(ii=0,jj=0; ii < size; ii++,jj++)
{
printf("%02X ",buf[ii]);
if (jj==15)
{
printf("\n");
jj = 0;
}
}
printf("\n");
return(0);
}
int rx_pkt_parser(unsigned char *buf, int size)
{
int pkt_index=0;
int pkt_size=0;
int temp_event=0;
int temp_EventId=0;
int total_device_count=0;
char szAddress[18];
struct rx_packet_h *rx_packet;
struct event_scn_evnt_rep_h *event_scn_evnt_rep;
#ifdef DEBUG
int dump_i=0;
unsigned char *pkt_ptr;
#endif
if(size<=0){printf("size error\n");return -1;}
printf("BLE scan start:\n");
rx_packet = (struct rx_packet_h *)(buf);
while(pkt_index<size)
{
#ifdef DEBUG
printf("--------------------------------------------------------------------\n");
printf("-Type : 0x%02X (%s)\n",rx_packet->rxType,rx_packet->rxType==0x4?"Event":"Unknown");
if(rx_packet->rxType!=0x4)
{
printf(" Type unknown, rxType:0x%02X, pkt_index:%d\n",rx_packet->rxType,pkt_index);
}
printf("-EventCode : 0x%02X (%s)\n",rx_packet->rxEventCode,rx_packet->rxEventCode==0xff?"HCI_LE_ExtEvent":"Unknown");
if(rx_packet->rxEventCode!=0xff)
{
printf(" EventCode unknown, rxEventCode:0x%02X, pkt_index:%d\n",rx_packet->rxEventCode,pkt_index);
}
printf("-Data Length : 0x%02X (%d) bytes(s)\n",rx_packet->rxDataLen,rx_packet->rxDataLen);
#endif
temp_event = (rx_packet->Event[1]<<8)+rx_packet->Event[0] ;
#ifdef DEBUG
printf(" Event : 0x%02X%02X (%d) ",rx_packet->Event[1],rx_packet->Event[0],temp_event);
if(temp_event==0x067F)
{
printf("(GAP_HCI_ExtentionCommandStatus)\n");
}
else if(temp_event==0x0600)
{
printf("(GAP_DeviceInitDone)\n");
}
else if(temp_event==0x0613)
{
printf("(GAP_AdvertiserScannerEvent)\n");
}
else
{
printf(" Event unknown, Event:0x%04X, pkt_index:%d\n",temp_event,pkt_index);
}
printf(" Status : 0x%02X (%d) (%s)\n",rx_packet->Status,rx_packet->Status,rx_packet->Status==0?"SUCCESS":"FAIL");
#endif
if(temp_event==0x0613)
{
event_scn_evnt_rep = (struct event_scn_evnt_rep_h *)(&(rx_packet->Status) + 1);
temp_EventId = (event_scn_evnt_rep->EventId[3]<<24) + (event_scn_evnt_rep->EventId[2]<<16) +
(event_scn_evnt_rep->EventId[1]<<8) + (event_scn_evnt_rep->EventId[0]) ;
#ifdef DEBUG
printf(" EventId : 0x%02X%02X%02X%02X (%d) ", event_scn_evnt_rep->EventId[3],
event_scn_evnt_rep->EventId[2],
event_scn_evnt_rep->EventId[1],
event_scn_evnt_rep->EventId[0],temp_EventId);
if(temp_EventId==0x00010000)
{
printf("(GAP_EVT_SCAN_ENABLED)\n");
}
else if(temp_EventId==0x00020000)
{
printf("(GAP_EVT_SCAN_DISABLED)\n");
}
else if(temp_EventId==0x00400000)
{
printf("(GAP_EVT_ADV_REPORT)\n");
}
else
{
printf(" EventId unknown, EventId:0x%08X, pkt_index:%d\n",temp_EventId,pkt_index);
}
#endif
if(temp_EventId==0x00400000)
{
sprintf(szAddress,"%02X:%02X:%02X:%02X:%02X:%02X", event_scn_evnt_rep->Address[5],
event_scn_evnt_rep->Address[4],
event_scn_evnt_rep->Address[3],
event_scn_evnt_rep->Address[2],
event_scn_evnt_rep->Address[1],
event_scn_evnt_rep->Address[0]);
#ifdef DEBUG
printf("%04d", total_device_count);
printf(" Address : %s", szAddress);
printf(" RSSI : 0x%02X (%d)(%d)",event_scn_evnt_rep->RSSI,event_scn_evnt_rep->RSSI,event_scn_evnt_rep->RSSI-256);
#else
printf(" Address: %s RSSI: %d", szAddress, event_scn_evnt_rep->RSSI-256);
#endif
printf("\n");
total_device_count++;
}
}
pkt_size = 3+rx_packet->rxDataLen;
#ifdef DEBUG
pkt_ptr = (unsigned char *)rx_packet;
printf(" <Info > Dump(Rx):");
for(dump_i=0; dump_i < pkt_size; dump_i++)
{
if (dump_i%16==0)
{
printf("\n");
printf("%04x:",dump_i);
}
printf("%02X ",pkt_ptr[dump_i]);
}
printf("\n");
#endif
pkt_index+=pkt_size;
#ifdef DEBUG
printf(" pkt_size:%d, pkt_index:%d\n",pkt_size,pkt_index);
#endif
rx_packet = (struct rx_packet_h *)(&(rx_packet->rxDataLen) + rx_packet->rxDataLen + 1);
}
printf("Total: %d Device found.\n",total_device_count);
return 0;
}

View File

@@ -0,0 +1,879 @@
/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2005 - 2021 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
***************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***************************************************************************
*/
/* Last revision: February 9, 2021 */
/* For more info and how to use this library, visit: http://www.teuniz.net/RS-232/ */
#include "rs232.h"
#if defined(__linux__) || defined(__FreeBSD__) /* Linux & FreeBSD */
#define RS232_PORTNR 40
int Cport[RS232_PORTNR],
error;
struct termios new_port_settings,
old_port_settings[RS232_PORTNR];
const char *comports[RS232_PORTNR]={"/dev/ttyS0","/dev/ttyS1","/dev/ttyS2","/dev/ttyS3","/dev/ttyS4","/dev/ttyS5",
"/dev/ttyS6","/dev/ttyS7","/dev/ttyS8","/dev/ttyS9","/dev/ttyS10","/dev/ttyS11",
"/dev/ttyS12","/dev/ttyS13","/dev/ttyS14","/dev/ttyS15","/dev/ttyUSB0",
"/dev/ttyUSB1","/dev/ttyUSB2","/dev/ttyUSB3","/dev/ttyUSB4","/dev/ttyUSB5",
"/dev/ttyAMA0","/dev/ttyAMA1","/dev/ttyACM0","/dev/ttyACM1",
"/dev/rfcomm0","/dev/rfcomm1","/dev/ircomm0","/dev/ircomm1",
"/dev/cuau0","/dev/cuau1","/dev/cuau2","/dev/cuau3",
"/dev/cuaU0","/dev/cuaU1","/dev/cuaU2","/dev/cuaU3",
"/dev/ttyMSM0","/dev/ttyMSM1"};
int RS232_OpenComport(int comport_number, int baudrate, const char *mode, int flowctrl)
{
int baudr,
status;
if((comport_number>=RS232_PORTNR)||(comport_number<0))
{
printf("illegal comport number\n");
return(1);
}
switch(baudrate)
{
case 50 : baudr = B50;
break;
case 75 : baudr = B75;
break;
case 110 : baudr = B110;
break;
case 134 : baudr = B134;
break;
case 150 : baudr = B150;
break;
case 200 : baudr = B200;
break;
case 300 : baudr = B300;
break;
case 600 : baudr = B600;
break;
case 1200 : baudr = B1200;
break;
case 1800 : baudr = B1800;
break;
case 2400 : baudr = B2400;
break;
case 4800 : baudr = B4800;
break;
case 9600 : baudr = B9600;
break;
case 19200 : baudr = B19200;
break;
case 38400 : baudr = B38400;
break;
case 57600 : baudr = B57600;
break;
case 115200 : baudr = B115200;
break;
case 230400 : baudr = B230400;
break;
case 460800 : baudr = B460800;
break;
#if defined(__linux__)
case 500000 : baudr = B500000;
break;
case 576000 : baudr = B576000;
break;
case 921600 : baudr = B921600;
break;
case 1000000 : baudr = B1000000;
break;
case 1152000 : baudr = B1152000;
break;
case 1500000 : baudr = B1500000;
break;
case 2000000 : baudr = B2000000;
break;
case 2500000 : baudr = B2500000;
break;
case 3000000 : baudr = B3000000;
break;
case 3500000 : baudr = B3500000;
break;
case 4000000 : baudr = B4000000;
break;
#endif
default : printf("invalid baudrate\n");
return(1);
break;
}
int cbits=CS8,
cpar=0,
ipar=IGNPAR,
bstop=0;
if(strlen(mode) != 3)
{
printf("invalid mode \"%s\"\n", mode);
return(1);
}
switch(mode[0])
{
case '8': cbits = CS8;
break;
case '7': cbits = CS7;
break;
case '6': cbits = CS6;
break;
case '5': cbits = CS5;
break;
default : printf("invalid number of data-bits '%c'\n", mode[0]);
return(1);
break;
}
switch(mode[1])
{
case 'N':
case 'n': cpar = 0;
ipar = IGNPAR;
break;
case 'E':
case 'e': cpar = PARENB;
ipar = INPCK;
break;
case 'O':
case 'o': cpar = (PARENB | PARODD);
ipar = INPCK;
break;
default : printf("invalid parity '%c'\n", mode[1]);
return(1);
break;
}
switch(mode[2])
{
case '1': bstop = 0;
break;
case '2': bstop = CSTOPB;
break;
default : printf("invalid number of stop bits '%c'\n", mode[2]);
return(1);
break;
}
/*
http://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html
http://man7.org/linux/man-pages/man3/termios.3.html
*/
Cport[comport_number] = open(comports[comport_number], O_RDWR | O_NOCTTY | O_NDELAY);
if(Cport[comport_number]==-1)
{
perror("unable to open comport ");
return(1);
}
/* lock access so that another process can't also use the port */
if(flock(Cport[comport_number], LOCK_EX | LOCK_NB) != 0)
{
close(Cport[comport_number]);
perror("Another process has locked the comport.");
return(1);
}
error = tcgetattr(Cport[comport_number], old_port_settings + comport_number);
if(error==-1)
{
close(Cport[comport_number]);
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
perror("unable to read portsettings ");
return(1);
}
memset(&new_port_settings, 0, sizeof(new_port_settings)); /* clear the new struct */
new_port_settings.c_cflag = cbits | cpar | bstop | CLOCAL | CREAD;
if(flowctrl)
{
new_port_settings.c_cflag |= CRTSCTS;
}
new_port_settings.c_iflag = ipar;
new_port_settings.c_oflag = 0;
new_port_settings.c_lflag = 0;
new_port_settings.c_cc[VMIN] = 0; /* block untill n bytes are received */
new_port_settings.c_cc[VTIME] = 0; /* block untill a timer expires (n * 100 mSec.) */
cfsetispeed(&new_port_settings, baudr);
cfsetospeed(&new_port_settings, baudr);
error = tcsetattr(Cport[comport_number], TCSANOW, &new_port_settings);
if(error==-1)
{
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
close(Cport[comport_number]);
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
perror("unable to adjust portsettings ");
return(1);
}
/* http://man7.org/linux/man-pages/man4/tty_ioctl.4.html */
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
perror("unable to get portstatus");
return(1);
}
status |= TIOCM_DTR; /* turn on DTR */
status |= TIOCM_RTS; /* turn on RTS */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
perror("unable to set portstatus");
return(1);
}
return(0);
}
int RS232_PollComport(int comport_number, unsigned char *buf, int size)
{
int n;
n = read(Cport[comport_number], buf, size);
if(n < 0)
{
if(errno == EAGAIN) return 0;
}
return(n);
}
int RS232_SendByte(int comport_number, unsigned char byte)
{
int n = write(Cport[comport_number], &byte, 1);
if(n < 0)
{
if(errno == EAGAIN)
{
return 0;
}
else
{
return 1;
}
}
return(0);
}
int RS232_SendBuf(int comport_number, unsigned char *buf, int size)
{
int n = write(Cport[comport_number], buf, size);
if(n < 0)
{
if(errno == EAGAIN)
{
return 0;
}
else
{
return -1;
}
}
return(n);
}
void RS232_CloseComport(int comport_number)
{
int status;
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
perror("unable to get portstatus");
}
status &= ~TIOCM_DTR; /* turn off DTR */
status &= ~TIOCM_RTS; /* turn off RTS */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
perror("unable to set portstatus");
}
tcsetattr(Cport[comport_number], TCSANOW, old_port_settings + comport_number);
close(Cport[comport_number]);
flock(Cport[comport_number], LOCK_UN); /* free the port so that others can use it. */
}
/*
Constant Description
TIOCM_LE DSR (data set ready/line enable)
TIOCM_DTR DTR (data terminal ready)
TIOCM_RTS RTS (request to send)
TIOCM_ST Secondary TXD (transmit)
TIOCM_SR Secondary RXD (receive)
TIOCM_CTS CTS (clear to send)
TIOCM_CAR DCD (data carrier detect)
TIOCM_CD see TIOCM_CAR
TIOCM_RNG RNG (ring)
TIOCM_RI see TIOCM_RNG
TIOCM_DSR DSR (data set ready)
http://man7.org/linux/man-pages/man4/tty_ioctl.4.html
*/
int RS232_IsDCDEnabled(int comport_number)
{
int status;
ioctl(Cport[comport_number], TIOCMGET, &status);
if(status&TIOCM_CAR) return(1);
else return(0);
}
int RS232_IsRINGEnabled(int comport_number)
{
int status;
ioctl(Cport[comport_number], TIOCMGET, &status);
if(status&TIOCM_RNG) return(1);
else return(0);
}
int RS232_IsCTSEnabled(int comport_number)
{
int status;
ioctl(Cport[comport_number], TIOCMGET, &status);
if(status&TIOCM_CTS) return(1);
else return(0);
}
int RS232_IsDSREnabled(int comport_number)
{
int status;
ioctl(Cport[comport_number], TIOCMGET, &status);
if(status&TIOCM_DSR) return(1);
else return(0);
}
void RS232_enableDTR(int comport_number)
{
int status;
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
perror("unable to get portstatus");
}
status |= TIOCM_DTR; /* turn on DTR */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
perror("unable to set portstatus");
}
}
void RS232_disableDTR(int comport_number)
{
int status;
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
perror("unable to get portstatus");
}
status &= ~TIOCM_DTR; /* turn off DTR */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
perror("unable to set portstatus");
}
}
void RS232_enableRTS(int comport_number)
{
int status;
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
perror("unable to get portstatus");
}
status |= TIOCM_RTS; /* turn on RTS */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
perror("unable to set portstatus");
}
}
void RS232_disableRTS(int comport_number)
{
int status;
if(ioctl(Cport[comport_number], TIOCMGET, &status) == -1)
{
perror("unable to get portstatus");
}
status &= ~TIOCM_RTS; /* turn off RTS */
if(ioctl(Cport[comport_number], TIOCMSET, &status) == -1)
{
perror("unable to set portstatus");
}
}
void RS232_flushRX(int comport_number)
{
tcflush(Cport[comport_number], TCIFLUSH);
}
void RS232_flushTX(int comport_number)
{
tcflush(Cport[comport_number], TCOFLUSH);
}
void RS232_flushRXTX(int comport_number)
{
tcflush(Cport[comport_number], TCIOFLUSH);
}
#else /* windows */
#define RS232_PORTNR 32
HANDLE Cport[RS232_PORTNR];
const char *comports[RS232_PORTNR]={"\\\\.\\COM1", "\\\\.\\COM2", "\\\\.\\COM3", "\\\\.\\COM4",
"\\\\.\\COM5", "\\\\.\\COM6", "\\\\.\\COM7", "\\\\.\\COM8",
"\\\\.\\COM9", "\\\\.\\COM10", "\\\\.\\COM11", "\\\\.\\COM12",
"\\\\.\\COM13", "\\\\.\\COM14", "\\\\.\\COM15", "\\\\.\\COM16",
"\\\\.\\COM17", "\\\\.\\COM18", "\\\\.\\COM19", "\\\\.\\COM20",
"\\\\.\\COM21", "\\\\.\\COM22", "\\\\.\\COM23", "\\\\.\\COM24",
"\\\\.\\COM25", "\\\\.\\COM26", "\\\\.\\COM27", "\\\\.\\COM28",
"\\\\.\\COM29", "\\\\.\\COM30", "\\\\.\\COM31", "\\\\.\\COM32"};
char mode_str[128];
int RS232_OpenComport(int comport_number, int baudrate, const char *mode, int flowctrl)
{
if((comport_number>=RS232_PORTNR)||(comport_number<0))
{
printf("illegal comport number\n");
return(1);
}
switch(baudrate)
{
case 110 : strcpy(mode_str, "baud=110");
break;
case 300 : strcpy(mode_str, "baud=300");
break;
case 600 : strcpy(mode_str, "baud=600");
break;
case 1200 : strcpy(mode_str, "baud=1200");
break;
case 2400 : strcpy(mode_str, "baud=2400");
break;
case 4800 : strcpy(mode_str, "baud=4800");
break;
case 9600 : strcpy(mode_str, "baud=9600");
break;
case 19200 : strcpy(mode_str, "baud=19200");
break;
case 38400 : strcpy(mode_str, "baud=38400");
break;
case 57600 : strcpy(mode_str, "baud=57600");
break;
case 115200 : strcpy(mode_str, "baud=115200");
break;
case 128000 : strcpy(mode_str, "baud=128000");
break;
case 256000 : strcpy(mode_str, "baud=256000");
break;
case 500000 : strcpy(mode_str, "baud=500000");
break;
case 921600 : strcpy(mode_str, "baud=921600");
break;
case 1000000 : strcpy(mode_str, "baud=1000000");
break;
case 1500000 : strcpy(mode_str, "baud=1500000");
break;
case 2000000 : strcpy(mode_str, "baud=2000000");
break;
case 3000000 : strcpy(mode_str, "baud=3000000");
break;
default : printf("invalid baudrate\n");
return(1);
break;
}
if(strlen(mode) != 3)
{
printf("invalid mode \"%s\"\n", mode);
return(1);
}
switch(mode[0])
{
case '8': strcat(mode_str, " data=8");
break;
case '7': strcat(mode_str, " data=7");
break;
case '6': strcat(mode_str, " data=6");
break;
case '5': strcat(mode_str, " data=5");
break;
default : printf("invalid number of data-bits '%c'\n", mode[0]);
return(1);
break;
}
switch(mode[1])
{
case 'N':
case 'n': strcat(mode_str, " parity=n");
break;
case 'E':
case 'e': strcat(mode_str, " parity=e");
break;
case 'O':
case 'o': strcat(mode_str, " parity=o");
break;
default : printf("invalid parity '%c'\n", mode[1]);
return(1);
break;
}
switch(mode[2])
{
case '1': strcat(mode_str, " stop=1");
break;
case '2': strcat(mode_str, " stop=2");
break;
default : printf("invalid number of stop bits '%c'\n", mode[2]);
return(1);
break;
}
if(flowctrl)
{
strcat(mode_str, " xon=off to=off odsr=off dtr=on rts=off");
}
else
{
strcat(mode_str, " xon=off to=off odsr=off dtr=on rts=on");
}
/*
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363145%28v=vs.85%29.aspx
http://technet.microsoft.com/en-us/library/cc732236.aspx
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_dcb
*/
Cport[comport_number] = CreateFileA(comports[comport_number],
GENERIC_READ|GENERIC_WRITE,
0, /* no share */
NULL, /* no security */
OPEN_EXISTING,
0, /* no threads */
NULL); /* no templates */
if(Cport[comport_number]==INVALID_HANDLE_VALUE)
{
printf("unable to open comport\n");
return(1);
}
DCB port_settings;
memset(&port_settings, 0, sizeof(port_settings)); /* clear the new struct */
port_settings.DCBlength = sizeof(port_settings);
if(!BuildCommDCBA(mode_str, &port_settings))
{
printf("unable to set comport dcb settings\n");
CloseHandle(Cport[comport_number]);
return(1);
}
if(flowctrl)
{
port_settings.fOutxCtsFlow = TRUE;
port_settings.fRtsControl = RTS_CONTROL_HANDSHAKE;
}
if(!SetCommState(Cport[comport_number], &port_settings))
{
printf("unable to set comport cfg settings\n");
CloseHandle(Cport[comport_number]);
return(1);
}
COMMTIMEOUTS Cptimeouts;
Cptimeouts.ReadIntervalTimeout = MAXDWORD;
Cptimeouts.ReadTotalTimeoutMultiplier = 0;
Cptimeouts.ReadTotalTimeoutConstant = 0;
Cptimeouts.WriteTotalTimeoutMultiplier = 0;
Cptimeouts.WriteTotalTimeoutConstant = 0;
if(!SetCommTimeouts(Cport[comport_number], &Cptimeouts))
{
printf("unable to set comport time-out settings\n");
CloseHandle(Cport[comport_number]);
return(1);
}
return(0);
}
int RS232_PollComport(int comport_number, unsigned char *buf, int size)
{
int n;
/* added the void pointer cast, otherwise gcc will complain about */
/* "warning: dereferencing type-punned pointer will break strict aliasing rules" */
if(!ReadFile(Cport[comport_number], buf, size, (LPDWORD)((void *)&n), NULL))
{
return -1;
}
return(n);
}
int RS232_SendByte(int comport_number, unsigned char byte)
{
int n;
if(!WriteFile(Cport[comport_number], &byte, 1, (LPDWORD)((void *)&n), NULL))
{
return(1);
}
if(n<0) return(1);
return(0);
}
int RS232_SendBuf(int comport_number, unsigned char *buf, int size)
{
int n;
if(WriteFile(Cport[comport_number], buf, size, (LPDWORD)((void *)&n), NULL))
{
return(n);
}
return(-1);
}
void RS232_CloseComport(int comport_number)
{
CloseHandle(Cport[comport_number]);
}
/*
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363258%28v=vs.85%29.aspx
*/
int RS232_IsDCDEnabled(int comport_number)
{
int status;
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
if(status&MS_RLSD_ON) return(1);
else return(0);
}
int RS232_IsRINGEnabled(int comport_number)
{
int status;
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
if(status&MS_RING_ON) return(1);
else return(0);
}
int RS232_IsCTSEnabled(int comport_number)
{
int status;
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
if(status&MS_CTS_ON) return(1);
else return(0);
}
int RS232_IsDSREnabled(int comport_number)
{
int status;
GetCommModemStatus(Cport[comport_number], (LPDWORD)((void *)&status));
if(status&MS_DSR_ON) return(1);
else return(0);
}
void RS232_enableDTR(int comport_number)
{
EscapeCommFunction(Cport[comport_number], SETDTR);
}
void RS232_disableDTR(int comport_number)
{
EscapeCommFunction(Cport[comport_number], CLRDTR);
}
void RS232_enableRTS(int comport_number)
{
EscapeCommFunction(Cport[comport_number], SETRTS);
}
void RS232_disableRTS(int comport_number)
{
EscapeCommFunction(Cport[comport_number], CLRRTS);
}
/*
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363428%28v=vs.85%29.aspx
*/
void RS232_flushRX(int comport_number)
{
PurgeComm(Cport[comport_number], PURGE_RXCLEAR | PURGE_RXABORT);
}
void RS232_flushTX(int comport_number)
{
PurgeComm(Cport[comport_number], PURGE_TXCLEAR | PURGE_TXABORT);
}
void RS232_flushRXTX(int comport_number)
{
PurgeComm(Cport[comport_number], PURGE_RXCLEAR | PURGE_RXABORT);
PurgeComm(Cport[comport_number], PURGE_TXCLEAR | PURGE_TXABORT);
}
#endif
void RS232_cputs(int comport_number, const char *text) /* sends a string to serial port */
{
while(*text != 0) RS232_SendByte(comport_number, *(text++));
}
/* return index in comports matching to device name or -1 if not found */
int RS232_GetPortnr(const char *devname)
{
int i;
char str[32];
#if defined(__linux__) || defined(__FreeBSD__) /* Linux & FreeBSD */
strcpy(str, "/dev/");
#else /* windows */
strcpy(str, "\\\\.\\");
#endif
strncat(str, devname, 16);
str[31] = 0;
for(i=0; i<RS232_PORTNR; i++)
{
if(!strcmp(comports[i], str))
{
return i;
}
}
return -1; /* device not found */
}

View File

@@ -0,0 +1,85 @@
/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2005 - 2021 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
***************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***************************************************************************
*/
/* For more info and how to use this library, visit: http://www.teuniz.net/RS-232/ */
#ifndef rs232_INCLUDED
#define rs232_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <string.h>
#if defined(__linux__) || defined(__FreeBSD__)
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <sys/file.h>
#include <errno.h>
#else
#include <windows.h>
#endif
int RS232_OpenComport(int, int, const char *, int);
int RS232_PollComport(int, unsigned char *, int);
int RS232_SendByte(int, unsigned char);
int RS232_SendBuf(int, unsigned char *, int);
void RS232_CloseComport(int);
void RS232_cputs(int, const char *);
int RS232_IsDCDEnabled(int);
int RS232_IsRINGEnabled(int);
int RS232_IsCTSEnabled(int);
int RS232_IsDSREnabled(int);
void RS232_enableDTR(int);
void RS232_disableDTR(int);
void RS232_enableRTS(int);
void RS232_disableRTS(int);
void RS232_flushRX(int);
void RS232_flushTX(int);
void RS232_flushRXTX(int);
int RS232_GetPortnr(const char *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -25,18 +25,12 @@ define Build/Prepare
endef
define Package/cc2652/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/tisbl.init $(1)/etc/init.d/tisbl
$(INSTALL_DIR) $(1)/etc/tifirmware
$(INSTALL_BIN) ./files/firmware/* $(1)/etc/tifirmware/
$(INSTALL_DIR) $(1)/lib/firmware/cc2562
$(INSTALL_BIN) ./files/firmware/* $(1)/lib/firmware/cc2562
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tisbl $(1)/usr/bin/
$(INSTALL_BIN) ./files/*.sh $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) ./files/tisbl.config $(1)/etc/config/tisbl
endef
$(eval $(call BuildPackage,cc2652))

View File

@@ -1,124 +0,0 @@
#!/usr/bin/lua
--[[
ByteCnt: 1 1 1 2 1 4
---- --------- ---------- ----- ------ -------
FieldName:Type EventCode DataLength Event Status EventId
--]]
--Type
Command = 0x01
Event = 0x04
--OpCode
GapScan_enable = 0xFE51
--EventCode
HCI_LE_ExtEvent = 0xff
--Status
SUCCESS = 0x00
--Event
GAP_HCI_ExtentionCommandStatus = 0x067F
GAP_AdvertiserScannerEvent = 0x0613
--EventId
GAP_EVT_ADV_REPORT = 0x00400000
GAP_EVT_SCAN_ENABLED = 0x00010000
local write = io.write
function print(...)
local n = select("#",...)
for i = 1,n do
local v = tostring(select(i,...))
write(v)
if i~=n then write'\t' end
end
-- write'\n'
end
function printf(str, ...)
return print(str:format(...))
end
function lshift(x, by)
return x * 2 ^ by
end
function GetUint8(Payload, position)
return string.byte(Payload, position)
end
function GetUint32(Payload, position)
return (lshift(string.byte(Payload, position+3),24) + lshift(string.byte(Payload, position+2),16) + lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
end
function GetUint16(Payload, position)
return (lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
end
function hexdump(Payload,separator)
for i=1,Payload:len(), 1 do
io.write(string.format("%02X", Payload:byte(i)))
if (i< Payload:len()) then
io.write(separator)
end
end
end
ibeacon_hdr=string.char(0x1A,0xFF,0x4C,0x00,0x02,0x15)
function DumpAdvertiserData(Payload)
--[[
Len(1byte)+Type(1byte)+Data(Len bytes)
--]]
while( Payload:len() > 0 ) do
local Len = GetUint8(Payload,1)
if (GetUint8(Payload,2) == 0xff) then -- manufacturer data
print(" MFR=")
hexdump(Payload:sub(1,Len+1),'')
if (Payload:sub(1,6) == ibeacon_hdr) then
print(" [ibeacon]")
end
end
Payload = string.sub(Payload,Len+2,-1)
end
end
function DumpAdvertiserScannerEvent(Payload)
local Status = GetUint8(Payload,3)
local EventId = GetUint32(Payload,4)
if((EventId==GAP_EVT_ADV_REPORT) and (Status==SUCCESS))
then
local MAC = string.sub(Payload,10,15)
local TxPower = GetUint8(Payload,19)
local RSSI = GetUint8(Payload,20)
printf("MAC=%02X%02X%02X%02X%02X%02X RSI=%d PWR=%d",string.byte(MAC,6),string.byte(MAC,5),string.byte(MAC,4),
string.byte(MAC,3),string.byte(MAC,2),string.byte(MAC,1),RSSI,TxPower)
local DataLength = GetUint16(Payload,30)
DumpAdvertiserData(string.sub(Payload,32,-1))
print("\n")
end
end
function hci_event_paser()
while true do
local Header = io.read(3)
if not Header then break end
local EventType = GetUint8(Header,1)
local EventCode = GetUint8(Header,2)
local DataLength = GetUint8(Header,3)
local Data = io.read(DataLength)
local Event = GetUint16(Data,1)
-- print(EventType,EventCode,DataLength,Event)
if not Data then break end
if(Event==GAP_AdvertiserScannerEvent)
then
DumpAdvertiserScannerEvent(Data)
-- hexdump(ibeacon_hdr)
end
end
end
hci_event_paser()

View File

@@ -1,8 +0,0 @@
#!/bin/sh
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x08\x00\x00\x00\x00\x00\x00\x00" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x02" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x03" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x04" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x05" > /dev/null
com-wr.sh /dev/ttyMSM1 3 "\x01\x51\xFE\x06\x00\x00\xF4\x01\x28\x00" | tee /tmp/blescan.data | ble-scan-rx-parser.sh

View File

@@ -0,0 +1,13 @@
#!/bin/sh
if [ -f /sys/class/gpio/ble_enable/value ]; then
echo 1 > /sys/class/gpio/ble_enable/value
fi
echo 0 > /sys/class/gpio/ble_backdoor/value
echo 1 > /sys/class/gpio/ble_reset/value
echo 0 > /sys/class/gpio/ble_reset/value
sleep 1
echo 1 > /sys/class/gpio/ble_reset/value
sleep 1
echo 1 > /sys/class/gpio/ble_backdoor/value
tisbl /dev/ttyMSM1 115200 2652 /lib/firmware/cc2562/simple_broadcaster_bd9.bin

View File

@@ -0,0 +1,13 @@
#!/bin/sh
if [ -f /sys/class/gpio/ble_enable/value ]; then
echo 1 > /sys/class/gpio/ble_enable/value
fi
echo 0 > /sys/class/gpio/ble_backdoor/value
echo 1 > /sys/class/gpio/ble_reset/value
echo 0 > /sys/class/gpio/ble_reset/value
sleep 1
echo 1 > /sys/class/gpio/ble_reset/value
sleep 1
echo 1 > /sys/class/gpio/ble_backdoor/value
tisbl /dev/ttyMSM1 115200 2652 /lib/firmware/cc2562/ble5_host_test_bd9.bin

View File

@@ -0,0 +1,10 @@
#!/bin/sh
if [ -f /sys/class/gpio/ble_enable/value ]; then
echo 1 > /sys/class/gpio/ble_enable/value
fi
echo 1 > /sys/class/gpio/ble_backdoor/value
echo 1 > /sys/class/gpio/ble_reset/value
sleep 1
echo 1 > /sys/class/gpio/ble_reset/value
sleep 1

View File

@@ -1,11 +0,0 @@
#!/usr/bin/lua
local block = 16
while true do
local bytes = io.read(block)
if not bytes then break end
for b in string.gfind(bytes, ".") do
io.write(string.format("%02X ", string.byte(b)))
end
io.write(string.rep(" ", block - string.len(bytes) + 1))
io.write(string.gsub(bytes, "%c", "."), "\n")
end

View File

@@ -1,20 +1,28 @@
#!/bin/sh
# script---------------- UUID---------------------------------------------------------------------- MAJOR----- MINOR----- POWER-
#example: ibeacon-broadcaster.sh "\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61" "\x01\x23" "\x45\x67" "\xC8"
if [ "$#" -eq 4 ]; then
UUID=$1
MAJOR=$2
MINOR=$3
POWER=$4
else
UUID="\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61"
MAJOR="\x01\x23"
MINOR="\x45\x67"
POWER="\xC8"
fi
function iBeconScan() {
if [ "$#" -eq 4 ]; then
UUID=$1
MAJOR=$2
MINOR=$3
POWER=$4
else
UUID="\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61"
MAJOR="\x01\x23"
MINOR="\x45\x67"
POWER="\xC8"
fi
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x01\x00\x00\x00\x00\x00\x00\x00" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x3E\xFE\x15\x12\x00\xA0\x00\x00\xA0\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7F\x01\x01\x00" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x09\x44\xFE\x23\x00\x00\x00\x1E\x00\x02\x01\x1A\x1A\xFF\x4C\x00\x02\x15${UUID}${MAJOR}${MINOR}${POWER}\x00" > /dev/null
com-wr.sh /dev/ttyMSM1 1 "\x01\x3F\xFE\x04\x00\x00\x00\x00" | hexdump.sh
cc2562-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x01\x00\x00\x00\x00\x00\x00\x00" > /dev/null
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x3E\xFE\x15\x12\x00\xA0\x00\x00\xA0\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7F\x01\x01\x00" > /dev/null
cc2562-wr.sh /dev/ttyMSM1 1 "\x09\x44\xFE\x23\x00\x00\x00\x1E\x00\x02\x01\x1A\x1A\xFF\x4C\x00\x02\x15${UUID}${MAJOR}${MINOR}${POWER}\x00" > /dev/null
cc2562-wr.sh /dev/ttyMSM1 1 "\x01\x3F\xFE\x04\x00\x00\x00\x00"
}
cc2562-reset.sh
while true
do
iBeconScan
sleep 1
done

View File

@@ -1,5 +0,0 @@
#!/bin/sh
killall -9 ser2net
tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/ble5_host_test_bd9.bin 79 34
echo "7000:telnet:0:/dev/ttyMSM1:115200 8DATABITS NONE 1STOPBIT remctl" > /tmp/ser2net.conf
ser2net -c /tmp/ser2net.conf

View File

@@ -1,9 +0,0 @@
config tisbl 'tisbl'
option firmware '/etc/tifirmware/ble5_host_test_bd9.bin'
option tty '/dev/ttyMSM1' # for EAP101 board
# option tty '/dev/ttyACM0' # for virtualbox openwrt 19.07 with TI CC26X2R launchpad
option tichip '2652'
option baudrate '115200'
option resetpin '79'
option backdoorpin '34' #EAP101-R1
# option backdoorpin '67' #EAP101-R0A-HW-modification

View File

@@ -1,21 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
#start after dbus (60)
START=62
USE_PROCD=1
start_service() {
firmware="$(uci -q get tisbl.tisbl.firmware)"
tty="$(uci -q get tisbl.tisbl.tty)"
tichip="$(uci -q get tisbl.tisbl.tichip)"
baudrate="$(uci -q get tisbl.tisbl.baudrate)"
resetpin="$(uci -q get tisbl.tisbl.resetpin)"
backdoorpin="$(uci -q get tisbl.tisbl.backdoorpin)"
tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
}
service_triggers()
{
procd_add_reload_trigger "tisbl"
}

View File

@@ -1,43 +0,0 @@
#!/bin/sh
# tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
# tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/blinky_bd13.bin 79 67
#assumption: resetpin and backdoorpin are low active
tty=$1
baudrate=$2
tichip=$3
firmware=$4
resetpin=$5
backdoorpin=$6
ti_reset() #assumption:resetpin is low active
{
if [ ! -e /sys/class/gpio/gpio${resetpin} ]; then
echo ${resetpin} > /sys/class/gpio/export
fi
echo out > /sys/class/gpio/gpio${resetpin}/direction
echo 1 > /sys/class/gpio/gpio${resetpin}/value
echo 0 > /sys/class/gpio/gpio${resetpin}/value
sleep 1
echo 1 > /sys/class/gpio/gpio${resetpin}/value
}
ti_goto_bootloader() #assumption:backdoorpin is low active
{
if [ ! -e /sys/class/gpio/gpio${backdoorpin} ]; then
echo ${backdoorpin} > /sys/class/gpio/export
fi
echo out > /sys/class/gpio/gpio${backdoorpin}/direction
echo 0 > /sys/class/gpio/gpio${backdoorpin}/value
ti_reset
sleep 1
echo 1 > /sys/class/gpio/gpio${backdoorpin}/value
}
if [ -e $firmware ]; then
ti_goto_bootloader
tisbl $tty $baudrate $tichip $firmware #try to upgrade firmware
fi

View File

@@ -0,0 +1,29 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=eltt2
PKG_VERSION:=1.0
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/eltt2
SECTION:=base
CATEGORY:=Utilities
TITLE:=eltt2
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Package/eltt2/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/eltt2 $(1)/bin/
endef
define Package/eltt2/extra_provides
echo "libc.so.6";
endef
$(eval $(call BuildPackage,eltt2))

View File

@@ -0,0 +1,27 @@
Copyright (c) 2014, Infineon Technologies AG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,15 @@
# Makefile for Embedded Linux TPM Toolbox 2 (ELTT2)
# Copyright (c) Infineon Technologies AG
#CROSS-COMPILE:=../../../../../qsdk/staging_dir/toolchain-arm/bin/arm-openwrt-linux-
#CC:=$(CROSS-COMPILE)gcc
CC = gcc
CFLAGS=-Wall -Wextra -std=c99 -g
all: eltt2
eltt2: eltt2.c eltt2.h
$(CC) $(CFLAGS) eltt2.c -o eltt2
clean:
rm -rf eltt2

View File

@@ -0,0 +1,230 @@
# ELTT2 - Infineon Embedded Linux TPM Toolbox 2 for TPM 2.0
All information in this document is Copyright (c) 2014-2022, Infineon Technologies AG <br>
All rights reserved.
# 1. Welcome
Welcome to Embedded Linux TPM Toolbox 2 (ELTT2). ELTT2 is a single-file executable program intended for testing, performing diagnosis and basic state changes of the Infineon Technologies TPM 2.0.
## 1.1 Prerequisites
To build and run ELTT2 you need GCC and a Linux system capable of hosting a TPM.
ELTT2 may run on many other little-endian hardware and software configurations capable of running Linux and hosting a TPM, but this has not been tested.
ELTT2 does not support machines with a big-endian CPU.
## 1.2 Getting Started
A TPM 2.0 evaluation board can be ordered in the [Hitex Webshop](https://www.ehitex.de/evaluation-boards/infineon/2564/iridium-9670-tpm2.0-spi).
<p align="center">
<img src="https://cloud.githubusercontent.com/assets/19730245/25651091/77a84744-2fe1-11e7-91bd-a2e39678202d.JPG" width="350"/>
</p>
In order to execute ELTT2, you need to compile it first:
1. Switch to the directory with the ELTT2 source code
2. Compile the source code by typing the following command:
make
Due to hardware (and thus TPM) access restrictions for normal users, ELTT2 requires root (aka superuser or administrator) privileges. They can be obtained e.g. by using the 'sudo' command on Debian Linux derivates.
The Infineon [TPM 2.0 Application Note](https://www.infineon.com/dgdl/Infineon-App-Note-SLx9670-TPM2.0_Embedded_RPi_DI_SLx-AN-v01_20-EN.pdf?fileId=5546d46267c74c9a01684b96e69f5d7b) shows how the TPM device driver can be set up (e.g. for Linux Kernel 4.14).
# 2. Usage of ELTT2
## 2.1 Generic Usage
ELTT2 is operated as follows:
Call: `./eltt2 <option(s)>`
For example: `./eltt2 -g` or `./eltt2 -gc`
For getting an overview of the possible commands, run `./eltt2 -h`
Some options require the TPM to be in a specific state. This state is shown in brackets ("[]") behind each command line option in the list below:
\[-\]: none <br>
\[\*\]: the TPM platform hierarchy authorization value is not set (i.e., empty buffer) <br>
\[l\]: the required PCR bank is allocated <br>
\[u\]: started <br>
To get the TPM into the required state, call ELTT2 with the corresponding commands ("x" for a state means that whether this state is required or not depends on the actual command or the command parameters sent eventually to the TPM).
Command line option | Explanation | Precondition
--- | --- | ---
`-a [hash algorithm] <data bytes>` | Hash Sequence SHA-1/256/384 \[default: SHA-1\] | \[u\]
`-A <data bytes>` | Hash Sequence SHA-256 | \[u\]
`-b <command bytes>` | Enter your own TPM command | \[u\]
`-c` | Read Clock | \[u\]
`-d <shutdown type>` | Shutdown | \[u\]
`-e [hash algorithm] <PCR index> <PCR digest>` | PCR Extend SHA-1/256/384 \[default: SHA-1\] | \[u\], \[l\]
`-E <PCR index> <PCR digest>` | PCR Extend SHA-256 | \[u\], \[l\]
`-g` | Get fixed capability values | \[u\]
`-v` | Get variable capability values | \[u\]
`-G <data length>` | Get Random | \[u\]
`-h` | Help | \[-\]
`-l <hash algorithm>` | PCR Allocate SHA-1/256/384 | \[u\], \[\*\]
`-r [hash algorithm] <PCR index>` | PCR Read SHA-1/256/384 \[default: SHA-1\] | \[u\], \[l\]
`-R <PCR index>` | PCR Read SHA-256 | \[u\], \[l\]
`-s [hash algorithm] <data bytes>` | Hash SHA-1/256/384 \[default: SHA-1\] | \[u\]
`-S <data bytes>` | Hash SHA-256 | \[u\]
`-t <test type>` | Self Test | \[u\]
`-T` | Get Test Result | \[u\]
`-u <startup type>` | Startup | \[-\]
`-z <PCR index>` | PCR Reset | \[u\]
Additional information:
`-a`: <br>
With the "-a" command you can hash given data with the SHA-1/256/384 hash algorithm. This hash sequence sends 3 commands \[start, update, complete\] to the TPM and allows to hash an arbitrary amount of data. For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
`./eltt2 -a 41624364` Hash given data with SHA-1 hash algorithm. <br>
or <br>
`./eltt2 -a sha1 41624364` Hash given data with SHA-1 hash algorithm. <br>
`./eltt2 -a sha256 41624364` Hash given data with SHA-256 hash algorithm. <br>
`./eltt2 -a sha384 41624364` Hash given data with SHA-384 hash algorithm. <br>
`-A`: <br>
With the "-A" command you can hash given data with the SHA-256 hash algorithm. This hash sequence sends 3 commands \[start, update, complete\] to the TPM and allows to hash an arbitrary amount of data. For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
`./eltt2 -A 41624364`
`-b`: <br>
With the "-b" command you can enter your own TPM command bytes and read the TPM response. For example, use the following command to send a TPM2_Startup with startup type CLEAR to the TPM: <br>
`./eltt2 -b 80010000000C000001440000`
`-c`: <br>
With the "-c" command you can read the clock values of the TPM.
`-d`: <br>
With the "-d" command you can issue a TPM shutdown. It has 2 options: <br>
`./eltt2 -d` <br>
or <br>
`./eltt2 -d clear` send a TPM2_Shutdown command with shutdown type CLEAR to the TPM. <br>
`./eltt2 -d state` send a TPM2_Shutdown command with shutdown type STATE to the TPM. <br>
`-e`: <br>
With the "-e" command you can extend bytes in the selected PCR with SHA-1/256/384. To do so, you have to enter the index of PCR in hexadecimal that you like to extend and the digest you want to extend the selected PCR with. Note that you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest must have a length of 20/32/48 bytes (will be padded with 0 if necessary). The TPM then builds an SHA-1/256/384 hash over the PCR data in the selected PCR and the digest you provided and writes the result back to the selected PCR. For example, use the following command to extend PCR 23 (0x17) with the byte sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}: <br>
`./eltt2 -e 17 41624364` Extend bytes in PCR 23 with SHA-1. <br>
or <br>
`./eltt2 -e sha1 17 41624364` Extend bytes in PCR 23 with SHA-1. <br>
`./eltt2 -e sha256 17 41624364` Extend bytes in PCR 23 with SHA-256. <br>
`./eltt2 -e sha384 17 41624364` Extend bytes in PCR 23 with SHA-384. <br>
`-E`: <br>
With the "-E" command you can extend bytes in the selected PCR with SHA-256. To do so, you have to enter the index of PCR in hexadecimal that you like to extend and the digest you want to extend the selected PCR with. Note that you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest must have a length of 32 bytes (will be padded with 0 if necessary). The TPM then builds an SHA-256 hash over the PCR data in the selected PCR and the digest you provided and writes the result back to the selected PCR. For example, use the following command to extend PCR 23 (0x17) with the byte sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}: <br>
`./eltt2 -E 17 41624364`
`-g`: <br>
With the "-g" command you can read the TPM's fixed properties.
`-v`: <br>
With the "-v" command you can read the TPM's variable properties.
`-G`: <br>
With the "-G" command you can get a given amount of random bytes. Note that you can only request a maximum amount of 32 random bytes at once. For example, use the following command to get 20 (0x14) random bytes: <br>
`./eltt2 -G 14`
`-l`: <br>
With the "-l" command you can allocate the SHA-1/256/384 PCR bank. Take note of two things. Firstly, the command requires a platform authorization value and it is set to an empty buffer; hence the command cannot be used if the TPM platform authorization value is set (e.g., by UEFI). Secondly, when the command is executed successfully a TPM reset has to follow for it to take effect. For example, use the following command to allocate a PCR bank: <br>
`./eltt2 -l sha1` Allocate SHA-1 PCR bank. <br>
`./eltt2 -l sha256` Allocate SHA-256 PCR bank. <br>
`./eltt2 -l sha384` Allocate SHA-384 PCR bank. <br>
`-r`: <br>
With the "-r" command you can read data from a selected SHA-1/256/384 PCR. For example, use the following command to read data from PCR 23 (0x17): <br>
`./eltt2 -r 17` Read data from SHA-1 PCR 23. <br>
or <br>
`./eltt2 -r sha1 17` Read data from SHA-1 PCR 23. <br>
`./eltt2 -r sha256 17` Read data from SHA-256 PCR 23. <br>
`./eltt2 -r sha384 17` Read data from SHA-384 PCR 23. <br>
`-R`: <br>
With the "-R" command you can read data from a selected SHA-256 PCR. For example, use the following command to read data from PCR 23 (0x17): <br>
`./eltt2 -R 17`
`-s`: <br>
With the "-s" command you can hash given data with the SHA-1/256/384 hash algorithm. This command only allows a limited amount of data to be hashed (depending on the TPM's maximum input buffer size). For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
`./eltt2 -s 41624364` Hash given data with SHA-1 hash algorithm. <br>
or <br>
`./eltt2 -s sha1 41624364` Hash given data with SHA-1 hash algorithm. <br>
`./eltt2 -s sha256 41624364` Hash given data with SHA-256 hash algorithm. <br>
`./eltt2 -s sha384 41624364` Hash given data with SHA-384 hash algorithm. <br>
`-S`: <br>
With the "-S" command you can hash given data with the SHA-256 hash algorithm. This command only allows a limited amount of data to be hashed (depending on the TPM input buffer size). For example, use the following command to hash the byte sequence {0x41, 0x62, 0x43, 0x64}: <br>
`./eltt2 -S 41624364`
`-t`: <br>
With the "-t" command you can issue a TPM selftest. It has 3 options: <br>
`./eltt2 -t` <br>
or<br>
`./eltt2 -t not_full` Perform a partial TPM2_Selftest to test previously untested TPM capabilities. <br>
`./eltt2 -t full` Perform a full TPM2_Selftest to test all TPM capabilities. <br>
`./eltt2 -t incremental` Perform a test of selected algorithms.
`-T`: <br>
With the "-T" command you can read the results of a previously run selftest.
`-u`: <br>
With the "-u" command you can issue a TPM startup command. It has 2 options: <br>
`./eltt2 -u` <br>
or <br>
`./eltt2 -u clear` send a TPM2_Startup with startup type CLEAR to the TPM. <br>
`./eltt2 -u state` send a TPM2_Startup with startup type STATE to the TPM.
`-z`: <br>
With the "-z" command you can reset a selected PCR. Note that you can only reset PCRs 16 and 23. For example, use the following command to reset PCR 23 (0x17): <br>
`./eltt2 -z 17`
## 2.2 Examples:
In order to work with the TPM, perform the following steps:
- Send the TPM2_Startup command: `./eltt2 -u`
# 3. If you have questions
If you have any questions or problems, please read the section "FAQ and
Troubleshooting" in this document.
In case you still have questions, contact your local Infineon
Representative.
Further information is available at <https://www.infineon.com/tpm>.
# 4. FAQ and Troubleshooting
If you encounter any error, please make sure that
- the TPM is properly connected.
- the TPM driver is loaded, i.e. check that "/dev/tpm0" exists. In case of driver loading problems (e.g. shown by "Error opening device"), reboot your system and try to load the driver again.
- ELTT2 has been started with root permissions. Please note that ELTT2 needs root permissions for all commands.
- the TPM is started. (See section 2.2 in this document on how to do this.)
The following list shows the most common errors and their solution:
The ELTT2 response is "Error opening the device.":
- You need to load a TPM driver before you can work with ELTT2.
- You need to start ELTT2 with root permissions.
The ELTT2 responds with error code 0x100.
- You need to send the TPM2_Startup command, or you did send it twice. In
case you have not sent it yet, do so with `./eltt2 -u`.
The TPM does not change any of the permanent flags shown by sending the "-g"
command , e.g. after a force clear.
- The TPM requires a reset in order to change any of the permanent flags.
Press the reset button or disconnect the TPM to do so.
The value of a PCR does not change after sending PCR extend or reset.
- With the application permissions you cannot modify every PCR. For more
details, please refer to the description for the different PCR commands
in this file.

View File

@@ -0,0 +1,362 @@
--------------------------------------------------------------------------------
Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0 v1.1
Infineon Technologies AG
All information in this document is Copyright (c) 2014, Infineon Technologies AG
All rights reserved.
--------------------------------------------------------------------------------
Contents:
1. Welcome
1.1 Prerequisites
1.2 Contents of the package
1.3 Getting Started
2. Usage of Embedded Linux TPM Toolbox 2 (ELTT2)
2.1 Generic Usage
2.2 Examples
3. If you have questions
4. Release Info
5. FAQ
================================================================================
1. Welcome
Welcome to Embedded Linux TPM Toolbox 2 (ELTT2).
ELTT2 is a single-file executable program intended for testing, performing
diagnosis and basic state changes of the Infineon Technologies TPM 2.0.
1.1 Prerequisites
To build and run ELTT2 you need GCC and a Linux system capable of hosting a
TPM 2.0.
Tested PC Platforms (x86):
- Ubuntu (R) Linux 12.04 LTS - 64 bit (modified Kernel 3.15.4)
with Infineon TPM 2.0 SLB9665 Firmware 5.22
Tested Embedded Platforms (ARM):
- Android 6.0 "Marshmallow" - 64 bit (modified Kernel 3.18.0+) on HiKey
with Prototype Infineon I2C TPM 2.0 for Embedded Platforms
ELTT2 may run on many other little-endian hardware and software
configurations capable of running Linux and hosting a TPM 2.0, but this has
not been tested.
ELTT2 does not support machines with a big-endian CPU.
1.2 Contents of Package
ELTT2 consists of the following files:
- eltt2.c
Contains all method implementations of ELTT2.
- eltt2.h
Contains all constant definitions, method and command byte declarations
for the operation of ELTT2.
- License.txt
Contains the license agreement for ELTT2.
- Makefile
Contains the command to compile ELTT2.
- README.txt
This file.
1.3 Getting Started
In order to execute ELTT2, you need to compile it first:
1. Switch to the directory with the ELTT2 source code
2. Compile the source code by typing the following command:
make
Due to hardware (and thus TPM) access restrictions for normal users, ELTT2
requires root (aka superuser or administrator) privileges. They can be
obtained e.g. by using the 'sudo' command on Debian Linux derivates.
2. Usage of ELTT2
2.1 Generic Usage
ELTT2 is operated as follows:
Call: ./eltt2 <option(s)>
For example: ./eltt2 -g or ./eltt2 -gc
For getting an overview of the possible commands, run ./eltt2 -h
Some options require the TPM to be in a specific state. This state is shown
in brackets ("[]") behind each command line option in the list below:
[-]: none
[*]: the TPM platform hierarchy authorization value is not set (i.e., empty buffer)
[l]: the required PCR bank is allocated
[u]: started
To get the TPM into the required state, call ELTT2 with the corresponding
commands ("x" for a state means that whether this state is required or not
depends on the actual command or the command parameters sent eventually to
the TPM).
Command line options: Preconditions:
-a [hash algorithm] <data bytes>: Hash Sequence SHA-1/256/384 [default: SHA-1] [u]
-A <data bytes>: Hash Sequence SHA-256 [u]
-b <command bytes>: Enter your own TPM command [u]
-c: Read Clock [u]
-d <shutdown type>: Shutdown [u]
-e [hash algorithm] <PCR index> <PCR digest>: PCR Extend SHA-1/256/384 [default: SHA-1] [u], [l]
-E <PCR index> <PCR digest>: PCR Extend SHA-256 [u], [l]
-g: Get fixed capability values [u]
-v: Get variable capability values [u]
-G <data length>: Get Random [u]
-h: Help [-]
-l <hash algorithm>: PCR Allocate SHA-1/256/384 [u], [*]
-r [hash algorithm] <PCR index>: PCR Read SHA-1/256/384 [default: SHA-1] [u], [l]
-R <PCR index>: PCR Read SHA-256 [u], [l]
-s [hash algorithm] <data bytes>: Hash SHA-1/SHA256 [default: SHA-1] [u]
-S <data bytes>: Hash SHA-256 [u]
-t <test type>: Self Test [u]
-T: Get Test Result [u]
-u <startup type>: Startup [-]
-z <PCR index>: PCR Reset [u]
Additional information:
-a:
With the "-a" command you can hash given data with the SHA-1/256/384 hash
algorithm. This hash sequence sends 3 commands [start, update, complete]
to the TPM and allows to hash an arbitrary amount of data.
For example, use the following command to hash the byte sequence {0x41,
0x62, 0x43, 0x64}:
./eltt2 -a 41624364 Hash given data with SHA-1 hash algorithm.
or
./eltt2 -a sha1 41624364 Hash given data with SHA-1 hash algorithm.
./eltt2 -a sha256 41624364 Hash given data with SHA-256 hash algorithm.
-A:
With the "-A" command you can hash given data with the SHA-256 hash
algorithm. This hash sequence sends 3 commands [start, update, complete] to
the TPM and allows to hash an arbitrary amount of data.
For example, use the following command to hash the byte sequence {0x41,
0x62, 0x43, 0x64}:
./eltt2 -A 41624364
-b:
With the "-b" command you can enter your own TPM command bytes and read the
TPM response.
For example, use the following command to send a TPM2_Startup with startup
type CLEAR to the TPM:
./eltt2 -b 80010000000C000001440000
-c:
With the "-c" command you can read the clock values of the TPM.
-d:
With the "-d" command you can issue a TPM shutdown. It has 2 options:
./eltt2 -d
or
./eltt2 -d clear send a TPM2_Shutdown command with shutdown type CLEAR to
the TPM.
./eltt2 -d state send a TPM2_Shutdown command with shutdown type STATE to
the TPM.
-e:
With the "-e" command you can extend bytes in the selected PCR with SHA-1/256/384.
To do so, you have to enter the index of PCR in hexadecimal that you like to
extend and the digest you want to extend the selected PCR with. Note that
you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest
must have a length of 20/32/48 bytes (will be padded with 0 if necessary).
The TPM then builds an SHA-1/256/384 hash over the PCR data in the selected PCR
and the digest you provided and writes the result back to the selected PCR.
For example, use the following command to extend PCR 23 (0x17) with the byte
sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}:
./eltt2 -e 17 41624364 Extend bytes in PCR 23 with SHA-1.
or
./eltt2 -e sha1 17 41624364 Extend bytes in PCR 23 with SHA-1.
./eltt2 -e sha256 17 41624364 Extend bytes in PCR 23 with SHA-256.
-E:
With the "-E" command you can extend bytes in the selected PCR with SHA-256.
To do so, you have to enter the index of PCR in hexadecimal that you like to
extend and the digest you want to extend the selected PCR with. Note that
you can only extend PCRs with index 0 to 16 and PCR 23 and that the digest
must have a length of 32 bytes (will be padded with 0 if necessary).
The TPM then builds an SHA-256 hash over the PCR data in the selected PCR
and the digest you provided and writes the result back to the selected PCR.
For example, use the following command to extend PCR 23 (0x17) with the byte
sequence {0x41, 0x62, 0x43, 0x64, 0x00, ... (will be filled with 0x00)}:
./eltt2 -E 17 41624364
-g:
With the "-g" command you can read the TPM's fixed properties.
-v:
With the "-v" command you can read the TPM's variable properties.
-G:
With the "-G" command you can get a given amount of random bytes. Note that
you can only request a maximum amount of 32 random bytes at once.
For example, use the following command to get 20 (0x14) random bytes:
./eltt2 -G 14
-l:
With the "-l" command you can allocate the SHA-1/256/384 PCR bank.
Take note of two things. Firstly, the command requires a platform
authorization value and it is set to an empty buffer; hence the command
cannot be used if the TPM platform authorization value is set (e.g., by UEFI).
Secondly, when the command is executed successfully a TPM reset has to
follow for it to take effect. For example, use the following command to
allocate a PCR bank:
./eltt2 -l sha1 Allocate SHA-1 PCR bank.
./eltt2 -l sha256 Allocate SHA-256 PCR bank.
./eltt2 -l sha384 Allocate SHA-384 PCR bank.
-r:
With the "-r" command you can read data from a selected SHA-1/256/384 PCR.
For example, use the following command to read data from PCR 23 (0x17):
./eltt2 -r 17 Read data from SHA-1 PCR 23.
or
./eltt2 -r sha1 17 Read data from SHA-1 PCR 23.
./eltt2 -r sha256 17 Read data from SHA-256 PCR 23.
-R:
With the "-R" command you can read data from a selected SHA-256 PCR.
For example, use the following command to read data from PCR 23 (0x17):
./eltt2 -R 17
-s:
With the "-s" command you can hash given data with the SHA-1/256/384 hash
algorithm. This command only allows a limited amount of data to be hashed
(depending on the TPM's maximum input buffer size).
For example, use the following command to hash the byte sequence {0x41,
0x62, 0x43, 0x64}:
./eltt2 -s 41624364 Hash given data with SHA-1 hash algorithm.
or
./eltt2 -s sha1 41624364 Hash given data with SHA-1 hash algorithm.
./eltt2 -s sha256 41624364 Hash given data with SHA-256 hash algorithm.
-S:
With the "-S" command you can hash given data with the SHA-256 hash
algorithm. This command only allows a limited amount of data to be hashed
(depending on the TPM input buffer size).
For example, use the following command to hash the byte sequence {0x41,
0x62, 0x43, 0x64}:
./eltt2 -S 41624364
-t:
With the "-t" command you can issue a TPM selftest. It has 3 options:
./eltt2 -t
or
./eltt2 -t not_full Perform a partial TPM2_Selftest to test previously
untested TPM capabilities.
./eltt2 -t full Perform a full TPM2_Selftest to test all TPM
capabilities.
./eltt2 -t incremental Perform a test of selected algorithms.
-T:
With the "-T" command you can read the results of a previously run selftest.
-u:
With the "-u" command you can issue a TPM startup command. It has 2 options:
./eltt2 -u
or
./eltt2 -u clear send a TPM2_Startup with startup type CLEAR to the TPM.
./eltt2 -u state send a TPM2_Startup with startup type STATE to the TPM.
-z:
With the "-z" command you can reset a selected PCR. Note that you can only
reset PCRs 16 and 23 and that the PCR is going to be reset in both banks
(SHA-1 and SHA-256).
For example, use the following command to reset PCR 23 (0x17):
./eltt2 -z 17
2.2 Examples:
In order to work with the TPM, perform the following steps:
- Send the TPM2_Startup command: ./eltt2 -u
3. If you have questions
If you have any questions or problems, please read the section "FAQ and
Troubleshooting" in this document.
In case you still have questions, contact your local Infineon
Representative.
Further information is available at http://www.infineon.com/tpm.
4. Release Info
This is version 1.1. This version is a general release.
5. FAQ and Troubleshooting
If you encounter any error, please make sure that
- the TPM is properly connected.
- the TPM driver is loaded, i.e. check that "/dev/tpm0" exists. In case of
driver loading problems (e.g. shown by "Error opening device"), reboot
your system and try to load the driver again.
- ELTT2 has been started with root permissions. Please note that ELTT2 needs
root permissions for all commands.
- the TPM is started. (See section 2.2 in this document on how to do this.)
- Trousers do not run anymore. In some cases the Kernel starts Trousers by
booting.
Shut down Trousers by entering the following command:
sudo pkill tcsd
The following list shows the most common errors and their solution:
The ELTT2 response is "Error opening the device.":
- You need to load a TPM driver before you can work with ELTT2.
- You need to start ELTT2 with root permissions.
The ELTT2 responds with error code 0x100.
- You need to send the TPM2_Startup command, or you did send it twice. In
case you have not sent it yet, do so with "./eltt2 -u".
The TPM does not change any of the permanent flags shown by sending the "-g"
command , e.g. after a force clear.
- The TPM requires a reset in order to change any of the permanent flags.
Press the reset button or disconnect the TPM to do so.
The value of a PCR does not change after sending PCR extend or reset.
- With the application permissions you cannot modify every PCR. For more
details, please refer to the description for the different PCR commands
in this file.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,634 @@
#ifndef _ELTT2_H_
#define _ELTT2_H_
/**
* @brief Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0
* @details eltt2.h implements all TPM byte commands and the prototype declarations for eltt2.c.
* @file eltt2.h
* @date 2014/06/26
* @copyright Copyright (c) 2014 - 2017 Infineon Technologies AG ( www.infineon.com ).\n
* All rights reserved.\n
* \n
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
* conditions are met:\n
* \n
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.\n
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.\n
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.\n
* \n
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// this is the main page for doxygen documentation.
/** @mainpage Infineon Embedded Linux TPM Toolbox 2 (ELTT2) for TPM 2.0 Documentation
*
* @section Welcome
* Welcome to Infineon TPM 2.0 Software-Tool "Embedded Linux TPM Toolbox 2 (ELTT2)".\n
* \n
* @section Introduction
* ELTT2 is a single file-executable program
* intended for test, diagnosis and basic state changes of the Infineon
* Technologies TPM 2.0.\n
* \n
* @section Copyright
* Copyright (c) 2014 - 2017 Infineon Technologies AG ( www.infineon.com ).\n
* All rights reserved.\n
* \n
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
* conditions are met:\n
* \n
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.\n
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.\n
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.\n
* \n
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <getopt.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
#include <inttypes.h>
//-------------"Defines"-------------
#define TPM_RESP_MAX_SIZE 4096 ///< This is the maximum possible TPM response size in bytes.
#define TPM_REQ_MAX_SIZE 1024 ///< This is the maximum possible TPM request size in bytes. TBD: Find out correct value.
#define ERR_COMMUNICATION -1 ///< Return error check for read and write to the TPM.
#define ERR_BAD_CMD -2 ///< Error code for a bad command line argument or option.
#define TPM_SHA1_DIGEST_SIZE 20 ///< For all SHA-1 operations the digest's size is always 20 bytes.
#define TPM_SHA256_DIGEST_SIZE 32 ///< For all SHA-256 operations the digest's size is always 32 bytes.
#define TPM_SHA384_DIGEST_SIZE 48 ///< For all SHA-384 operations the digest's size is always 48 bytes.
#define TPM_CMD_HEADER_SIZE 10 ///< The size of a standard TPM command header is 10 bytes.
#define TPM_CMD_SIZE_OFFSET 2 ///< The offset of a TPM command's size value is 2 bytes.
#define HEX_BYTE_STRING_LENGTH 2 ///< A byte can be represented by two hexadecimal characters.
#ifndef INT_MAX
#define INT_MAX 0x7FFFFFF ///< The maximum value of a signed 32-bit integer.
#endif
// TPM Return codes
#define TPM_RC_SUCCESS 0x00000000 ///< The response error code for TPM_SUCCESS.
#define TPM_RC_BAD_TAG 0x0000001E ///< The response error code for TPM_RC_BAD_TAG.
#define TPM_RC_SIZE 0x00000095 ///< The response error code for TPM_RC_SIZE.
#define TPM_RC_INITIALIZE 0x00000100 ///< The response error code for TPM_RC_INITIALIZE.
#define TPM_RC_FAILURE 0x00000101 ///< The response error code for TPM_RC_FAILURE.
#define TPM_RC_LOCALITY 0x00000907 ///< The response error code for TPM_RC_LOCALITY.
#define FU_FIRMWARE_VALID_FLAG 4 ///< If this flag is set, the firmware is valid.
#define FU_OWNER_FLAG 1 ///< If this flag is set, the owner is set.
// print_response_buf options
#define PRINT_RESPONSE_CLEAR 1 ///< Prints response unformatted.
#define PRINT_RESPONSE_HEADERBLOCKS 2 ///< Prints response in commented blocks.
#define PRINT_RESPONSE_HEX_BLOCK 3 ///< Prints response in rows of 16 bytes and shows the line number.
#define PRINT_RESPONSE_HASH 4 ///< Prints response of Hash
#define PRINT_RESPONSE_WITHOUT_HEADER 12 ///< Prints the response buffer from byte 12.
#define PRINT_RESPONSE_HASH_WITHOUT_HEADER 16 ///< Prints the response buffer from byte 16.
#define PRINT_RESPONSE_WITH_HEADER 0 ///< Prints the response buffer from byte 0.
#define PRINT_RESPONSE_PCR_WITHOUT_HEADER 30 ///< Prints the pcr buffer from pcr_read.
// time conversion
#define YEAR_SECONDS 31536000 ///< Number of seconds in one year
#define DAY_SECONDS 86400 ///< Number of seconds in one day
#define HOUR_SECONDS 3600 ///< Number of seconds in one hour
#define MINUTE_SECONDS 60 ///< Number of seconds in one minute
#define MILISECOND_TO_SECOND 1000 ///< Convertion from miliseconds to seconds
// hash
#define STD_CC_HASH_SIZE 18 ///< Hash command size
// TPM_PT constants
#define PT_FIXED_SELECTOR 1 ///< Fixed GetCapability Flags
#define PT_VAR_SELECTOR 2 ///< Variable GetCapability Flags
//-------------"Macros"-------------
// Null pointer check
#define NULL_POINTER_CHECK(x) if (NULL == x) { ret_val = EINVAL; fprintf(stderr, "Error: Invalid argument.\n"); break; } ///< Argument NULL check.
#define MALLOC_ERROR_CHECK(x) if (NULL == x) { ret_val = errno; fprintf(stderr, "Error (re)allocating memory.\n"); break; } ///< Malloc error check.
#define MEMSET_FREE(x, y) if (NULL != x) { memset(x, 0, y); free(x); x = NULL; } ///< Sets memory to 0, frees memory and sets pointer to NULL.
// Return value check
#define RET_VAL_CHECK(x) if (EXIT_SUCCESS != x) { break; } ///< Return value check
// Command line option parser for hash algorithm
#define HASH_ALG_PARSER(o, c) \
do { \
if (o == option) \
{ \
if (c == argc) \
{ \
hash_algo = ALG_SHA1; \
} \
else \
{ \
if (0 == strcasecmp(optarg, "sha1")) \
{ \
hash_algo = ALG_SHA1; \
} \
else if (0 == strcasecmp(optarg, "sha256")) \
{ \
hash_algo = ALG_SHA256; \
} \
else if (0 == strcasecmp(optarg, "sha384")) \
{ \
hash_algo = ALG_SHA384; \
} \
else \
{ \
ret_val = ERR_BAD_CMD; \
fprintf(stderr, "Unknown option. Use '-h' for more information.\n"); \
break; \
} \
if (argc > optind) \
{ \
optarg = argv[optind++]; \
} \
} \
} \
else \
{ \
hash_algo = ALG_SHA256; \
} \
} while (0)
//--------------"Enums"--------------
// Hash algorithms
typedef enum hash_algo_enum
{
ALG_NULL,
ALG_SHA1,
ALG_SHA256,
ALG_SHA384,
} hash_algo_enum;
//-------------"Methods"-------------
/**
* @brief Convert (max.) 8 byte buffer to an unsigned 64-bit integer.
* @param [in] *input_buffer Input buffer. Make sure that its size is at least as high as offset + length.
* @param [in] offset Start byte for conversion.
* @param [in] length Amount of bytes to be converted.
* @param [out] *output_value Return the converted unsigned 64-bit integer.
* @param [in] input_buffer_size Size of input_buffer in bytes.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer or length is greater than 8.
* @retval EXIT_SUCCESS In case of success.
* @date 2014/06/26
*/
static int buf_to_uint64(uint8_t *input_buffer, uint32_t offset, uint32_t length, uint64_t *output_value, uint32_t input_buffer_size);
/**
* @brief Convert a hexadecimal string representation of bytes like "0A1F" and
returns an array containing the actual byte values as an array (e.g. { 0x0A, 0x1F }).
* @param [in] *byte_string Incoming bytes as string.
* @param [out] *byte_values Byte array representation of given input string.
* Must be allocated by caller with the length given in byte_values_size.
* @param [in] byte_values_size Size of byte_values array.
* @return One of the listed return codes.
* @retval EXIT_SUCCESS In case of success.
* @retval EINVAL In case of a NULL pointer.
* @retval value of errno In case parsing error.
* @date 2014/06/26
*/
static int hexstr_to_bytearray(char *byte_string, uint8_t *byte_values, size_t byte_values_size);
/**
* @brief Convert a number to a byte buffer.
* @param [in] input User input.
* @param [in] input_size Size of input data type in bytes.
* @param [out] *output_byte Return buffer for the converted integer.
Must be allocated by the caller with at least a size of 'input_size'.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @date 2014/06/26
*/
static int int_to_bytearray(uint64_t input, uint32_t input_size, uint8_t *output_byte);
/**
* @brief Create the PCR_Extend command.
* @param [in] *pcr_index_str User input string for PCR index.
* @param [in] *pcr_digest_str User input string of value to extend the selected PCR with.
* @param [out] *pcr_cmd_buf Return buffer for the complete command. Must be allocated by caller.
* @param [in] *pcr_cmd_buf_size Size of memory allocated at pcr_cmd_buf in bytes.
* @param [in] hash_algo Set to ALG_SHA1 for extending with SHA-1,
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer or an invalid option.
* @retval EXIT_SUCCESS In case of success.
* @retval ERR_BAD_CMD In case of bad user input.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @date 2014/06/26
*/
static int pcr_extend(char *pcr_index_str, char *pcr_digest_str, uint8_t *pcr_cmd_buf, size_t pcr_cmd_buf_size, hash_algo_enum hash_algo);
/**
* @brief Create the PCR_Allocate command.
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
* @param [in] hash_algo Set to ALG_SHA1 to allocate SHA-1,
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer or an invalid option.
* @retval EXIT_SUCCESS In case of success.
* @date 2022/05/09
*/
static int pcr_allocate(uint8_t *pcr_cmd_buf, hash_algo_enum hash_algo);
/**
* @brief Create the PCR_Read command.
* @param [in] *pcr_index_str User input string for PCR index.
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
* @param [in] hash_algo Set to ALG_SHA1 for reading with SHA-1,
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer or an invalid option.
* @retval EXIT_SUCCESS In case of success.
* @retval ERR_BAD_CMD In case of bad user input.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @date 2014/06/26
*/
static int pcr_read(char *pcr_index_str, uint8_t *pcr_cmd_buf, hash_algo_enum hash_algo);
/**
* @brief Create the PCR_Reset command.
* @param [in] *pcr_index_str User input string for PCR index.
* @param [out] *pcr_cmd_buf Return buffer for the complete command.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval ERR_BAD_CMD In case of bad user input.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @date 2014/06/26
*/
static int pcr_reset(char *pcr_index_str, uint8_t *pcr_cmd_buf);
/**
* @brief Print the command line usage and switches.
* @date 2014/06/26
*/
static void print_help();
/**
* @brief Print the response buffer in different formats.
* @param [in] *response_buf TPM response.
* @param [in] resp_size TPM response size.
* @param [in] offset Starting point for printing buffer.
* @param [in] format Select the output format.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer or an unknown output format has been transfered.
* @retval EXIT_SUCCESS In case of success.
* @retval buf_to_uint64 All error codes from buf_to_uint64.
* @date 2014/06/26
*/
static int print_response_buf(uint8_t *response_buf, size_t resp_size, uint32_t offset, int format);
/**
* @brief Print a TPM response.
* @param [in] *response_buf TPM response.
* @param [in] resp_size TPM response size.
* @param [in] option Defines appearance of output. Can have the following values:\n
- PRINT_RESPONSE_CLEAR
- PRINT_RESPONSE_HEADERBLOCKS
- PRINT_RESPONSE_HEX_BLOCK
- PRINT_RESPONSE_WITHOUT_HEADER
- PRINT_RESPONSE_WITH_HEADER
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval print_response_buf All error codes from print_response_buf.
* @retval print_clock_info All error codes from print_clock_info.
* @retval print_capability_flags All error codes from print_capability_flags.
* @date 2014/06/26
*/
static int response_print(uint8_t *response_buf, size_t resp_size, int option);
/**
* @brief Check a TPM response for errors.
* @param [in] *response_buf TPM response. Must have at least a size of TPM_CMD_HEADER_SIZE bytes.
* @return Returns the TPM return code extracted from the given TPM response or one of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval buf_to_uint64 All error codes from buf_to_uint64.
* @retval EXIT_SUCCESS In case of success.
* @date 2014/06/26
*/
static int return_error_handling(uint8_t *response_buf);
/**
* @brief Transmit TPM command to /dev/tpm0 and get the response.
* @param [in] *buf TPM request.
* @param [in] length TPM request length.
* @param [out] *response TPM response.
* @param [out] *resp_length TPM response length.
* @return One of the listed return codes or the error code stored in the global errno system variable.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @date 2014/06/26
*/
static int tpmtool_transmit(const uint8_t *buf, ssize_t length, uint8_t *response, ssize_t *resp_length);
/**
* @brief Print the capability flags.
* @param [in] *response_buf TPM response.
* @param [in] cap_selector Type of capabilities to print.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval buf_to_uint64 All error codes from buf_to_uint64.
* @date 2014/06/26
*/
static int print_capability_flags(uint8_t *response_buf, uint8_t cap_selector);
/**
* @brief Print the clock info.
* @param [in] *response_buf TPM response.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval buf_to_uint64 All error codes from buf_to_uint64.
* @date 2014/06/26
*/
static int print_clock_info(uint8_t *response_buf);
/**
* @brief Create the get_random command.
* @param [in] *data_length_string User input string for random data length.
* @param [out] *response_buf Return buffer for the complete command.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval ERR_BAD_CMD In case of bad user input.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @date 2014/06/26
*/
static int get_random(char *data_length_string, uint8_t *response_buf);
/**
* @brief Create the simple hash command.
* @param [in] *data_string User input string of data to be hashed.
* @param [in] hash_algo Set to ALG_SHA1 for hashing with SHA-1,
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
* @param [out] *hash_cmd_buf Return buffer for the complete command.
* @param [in] hash_cmd_buf_size Return buffer size.
* @return One of the listed return codes.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @retval int_to_bytearray All error codes from int_to_bytearray.
* @date 2014/06/26
*/
static int create_hash(char *data_string, hash_algo_enum hash_algo, uint8_t *hash_cmd_buf, uint32_t hash_cmd_buf_size);
/**
* @brief Create and transmit a sequence of TPM commands for hashing larger amounts of data.
* @param [in] *data_string User input string of data to be hashed.
* @param [in] hash_algo Set to ALG_SHA1 for hashing with SHA-1,
ALG_SHA256 for SHA-256, and ALG_SHA384 for SHA-384.
* @param [out] *tpm_response_buf TPM response.
* @param [out] *tpm_response_buf_size Size of tpm_response_buf.
* @return One of the listed return codes or the error code stored in the global errno system variable.
* @retval EINVAL In case of a NULL pointer.
* @retval EXIT_SUCCESS In case of success.
* @retval value of errno In case of memory allocation error.
* @retval buf_to_uint64 All error codes from buf_to_uint64.
* @retval hexstr_to_bytearray All error codes from hexstr_to_bytearray.
* @retval int_to_bytearray All error codes from int_to_bytearray.
* @retval tpmtool_transmit All error codes from tpmtool_transmit.
* @retval print_response_buf All error codes from print_response_buf
* @date 2014/06/26
*/
static int create_hash_sequence(char *data_string, hash_algo_enum hash_algo, uint8_t *tpm_response_buf, ssize_t *tpm_response_buf_size);
//-------------"command bytes"-------------
static const uint8_t tpm2_startup_clear[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0C, // commandSize
0x00, 0x00, 0x01, 0x44, // TPM_CC_Startup
0x00, 0x00 // TPM_SU_CLEAR
};
static const uint8_t tpm2_startup_state[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0C, // commandSize
0x00, 0x00, 0x01, 0x44, // TPM_CC_Startup
0x00, 0x01 // TPM_SU_STATE
};
static const uint8_t tpm_cc_shutdown_clear[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0C, // commandSize
0x00, 0x00, 0x01, 0x45, // TPM_CC_Shutdown
0x00, 0x00 // TPM_SU_CLEAR
};
static const uint8_t tpm_cc_shutdown_state[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0C, // commandSize
0x00, 0x00, 0x01, 0x45, // TPM_CC_Shutdown
0x00, 0x01 // TPM_SU_STATE
};
static const uint8_t tpm2_self_test[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0B, // commandSize
0x00, 0x00, 0x01, 0x43, // TPM_CC_SelfTest
0x00 // fullTest=No
};
static const uint8_t tpm2_self_test_full[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0B, // commandSize
0x00, 0x00, 0x01, 0x43, // TPM_CC_SelfTest
0x01 // fullTest=Yes
};
static const uint8_t tpm_cc_get_test_result[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0A, // commandSize
0x00, 0x00, 0x01, 0x7C // TPM_CC_GetTestResult
};
static const uint8_t tpm2_self_test_incremental[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x2A, // commandSize
0x00, 0x00, 0x01, 0x42, // TPM_CC_IncrementalSelfTest
0x00, 0x00, 0x00, 0x0E, // Count of Algorithm
0x00, 0x01, 0x00, 0x04, // Algorithm two per line
0x00, 0x05, 0x00, 0x06,
0x00, 0x08, 0x00, 0x0A,
0x00, 0x0B, 0x00, 0x14,
0x00, 0x15, 0x00, 0x16,
0x00, 0x17, 0x00, 0x22,
0x00, 0x25, 0x00, 0x43
};
static const uint8_t tpm2_getrandom[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0C, // commandSize
0x00, 0x00, 0x01, 0x7B, // TPM_CC_GetRandom
0x00, 0x00 // bytesRequested (will be set later)
};
static const uint8_t tpm_cc_readclock[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0A, // commandSize
0x00, 0x00, 0x01, 0x81 // TPM_CC_ReadClock
};
static const uint8_t tpm2_getcapability_fixed[] ={
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x16, // commandSize
0x00, 0x00, 0x01, 0x7A, // TPM_CC_GetCapability
0x00, 0x00, 0x00, 0x06, // TPM_CAP_TPM_PROPERTIES (Property Type: TPM_PT)
0x00, 0x00, 0x01, 0x00, // Property: TPM_PT_FAMILY_INDICATOR: PT_GROUP * 1 + 0
0x00, 0x00, 0x00, 0x66 // PropertyCount 102 (from 100 - 201)
};
static const uint8_t tpm2_getcapability_var[] ={
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x16, // commandSize
0x00, 0x00, 0x01, 0x7A, // TPM_CC_GetCapability
0x00, 0x00, 0x00, 0x06, // TPM_CAP_TPM_PROPERTIES (Property Type: TPM_PT)
0x00, 0x00, 0x02, 0x00, // Property: TPM_PT_FAMILY_INDICATOR: PT_GROUP * 2 + 0
0x00, 0x00, 0x00, 0x02 // PropertyCount 02 (from 200 - 201)
};
// Hash
static const uint8_t tpm2_hash[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0e, // commandSize
0x00, 0x00, 0x01, 0x7D, // TPM_CC_Hash
0x00, 0x00, // size (will be set later)
// buffer (will be added later)
0x00, 0x00, // hashAlg (will be added later)
0x00, 0x00, 0x00, 0x00 // hierarchy of the ticket (TPM_RH_NULL; will be added later)
};
// HashSequence
static uint8_t tpm2_hash_sequence_start[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x0e, // commandSize
0x00, 0x00, 0x01, 0x86, // TPM_CC_HashSequenceStart
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x00 // hashAlg (will be set later)
};
static uint8_t tpm2_sequence_update[] = {
0x80, 0x02, // TPM_ST_SESSIONS
0x00, 0x00, 0x00, 0x00, // commandSize (will be set later)
0x00, 0x00, 0x01, 0x5c, // TPM_CC_SequenceUpdate
0x00, 0x00, 0x00, 0x00, // sequenceHandle (will be set later)
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x09, // authSize (password authorization session)
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00 // size (will be set later)
// buffer (will be added later)
};
static uint8_t tpm2_sequence_complete[] = {
0x80, 0x02, // TPM_ST_SESSIONS
0x00, 0x00, 0x00, 0x21, // commandSize
0x00, 0x00, 0x01, 0x3e, // TPM_CC_SequenceComplete
0x00, 0x00, 0x00, 0x00, // sequenceHandle (will be set later)
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x09, // authSize (password authorization session)
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, // size (NULL buffer)
// null (indicate an empty buffer buffer)
0x40, 0x00, 0x00, 0x07 // hierarchy of the ticket (TPM_RH_NULL)
};
static const uint8_t sha1_alg[] = {
0x00, 0x04 // command for sha1 alg
};
static const uint8_t sha256_alg[] = {
0x00, 0x0B // command for sha256 alg
};
static const uint8_t sha384_alg[] = {
0x00, 0x0C // command for sha384 alg
};
static const uint8_t tpm_cc_hash_hierarchy[] = {
0x40, 0x00, 0x00, 0x07 // hierarchy of the ticket (TPM_RH_NULL)
};
//PCR_Command
static const uint8_t tpm2_pcr_allocate[] = {
0x80, 0x02, // TPM_ST_SESSIONS
0x00, 0x00, 0x00, 0x31, // commandSize
0x00, 0x00, 0x01, 0x2B, // TPM_CC_PCR_Allocate
0x40, 0x00, 0x00, 0x0C, // TPM_RH_PLATFORM
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x09, // authSize (password authorization session)
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, // count (TPML_PCR_SELECTION)
0x00, 0x04, // hash (TPMS_PCR_SELECTION; SHA-1)
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
0x00, 0x00, 0x00, // pcrSelect (TPMS_PCR_SELECTION; will be set later)
0x00, 0x0B, // hash (TPMS_PCR_SELECTION; SHA-256)
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
0x00, 0x00, 0x00, // pcrSelect (TPMS_PCR_SELECTION; will be set later)
0x00, 0x0C, // hash (TPMS_PCR_SELECTION; SHA-384)
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
0x00, 0x00, 0x00 // pcrSelect (TPMS_PCR_SELECTION; will be set later)
};
static const uint8_t tpm2_pcr_read[] = {
0x80, 0x01, // TPM_ST_NO_SESSIONS
0x00, 0x00, 0x00, 0x14, // commandSize
0x00, 0x00, 0x01, 0x7E, // TPM_CC_PCR_Read
0x00, 0x00, 0x00, 0x01, // count (TPML_PCR_SELECTION)
0x00, 0x00, // hash (TPMS_PCR_SELECTION; will be set later)
0x03, // sizeofSelect (TPMS_PCR_SELECTION)
0x00, 0x00, 0x00 // pcrSelect (TPMS_PCR_SELECTION)
};
static const uint8_t tpm2_pcr_extend[] = {
0x80, 0x02, // TPM_ST_SESSIONS
0x00, 0x00, 0x00, 0x00, // commandSize (will be set later)
0x00, 0x00, 0x01, 0x82, // TPM_CC_PCR_Extend
0x00, 0x00, 0x00, 0x00, // {PCR_FIRST:PCR_LAST} (TPMI_DH_PCR)
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x09, // authSize (password authorization session)
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, // count (TPML_DIGEST_VALUES)
0x00, 0x00 // hashAlg (TPMT_HA; will be set later)
// digest (TPMT_HA; will be added later)
};
static const uint8_t tpm2_pcr_reset[] = {
0x80, 0x02, // TPM_ST_SESSIONS
0x00, 0x00, 0x00, 0x1B, // commandSize
0x00, 0x00, 0x01, 0x3D, // TPM_CC_PCR_Reset
0x00, 0x00, 0x00, 0x00, // {PCR_FIRST:PCR_LAST} (TPMI_DH_PCR)
0x00, 0x00, // authSize (NULL Password)
// null (indicate a NULL Password)
0x00, 0x09, // authSize (password authorization session)
0x40, 0x00, 0x00, 0x09, // TPM_RS_PW (indicate a password authorization session)
0x00, 0x00, 0x01, 0x00, 0x00
};
#endif /* _ELTT2_H_ */

View File

@@ -1,77 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fbwifi
PKG_VERSION:=2
PKG_RELEASE:=0
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Simon Kinane <skinane@fb.com>
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/fbwifi
SUBMENU:=Captive Portals
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iptables +luasec +luasocket \
+libuci-lua +luaposix \
+lua-cjson +uhttpd
TITLE:=Facebook Wi-Fi
PKGARCH:=all
endef
define Package/fbwifi/description
Facebook Wi-Fi, an AP authorisation solution
endef
define Package/luci-app-fbwifi
SUBMENU:=3. Applications
SECTION:=luci
CATEGORY:=LuCI
TITLE:=LuCI support for Facebook Wi-Fi
DEPENDS:= \
+fbwifi \
+luci-base +luci-mod-network +luci-mod-status +luci-theme-bootstrap
endef
define Package/luci-app-fbwifi/description
LuCI support for Facebook Wi-Fi
endef
define Package/fbwifi/conffiles
/etc/config/fbwifi
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/fbwifi/install
$(INSTALL_DIR) $(1)
$(CP) ./files/fbwifi/* $(1)/
endef
define Package/luci-app-fbwifi/install
$(INSTALL_DIR) $(1)
$(CP) ./files/luci-app-fbwifi/* $(1)
endef
$(eval $(call BuildPackage,fbwifi))
$(eval $(call BuildPackage,luci-app-fbwifi))

View File

@@ -1,22 +0,0 @@
# Facebook Wi-Fi v2.0 Reference Implementation for OpenWrt
## Getting started
Case studies for OEM customers are available at the official page of [Facebook Wi-Fi](https://www.facebook.com/facebook-wifi).
For OEM engineers, start by reading the init script in [files/etc/init.d/fbwifi](https://github.com/facebookincubator/fbc_owrt_feed/blob/master/fbwifi/files/etc/init.d/fbwifi)
To enable Facebook Wi-Fi, configure the gateway_token in `/etc/config/fbwifi`, and run `fbwifi enable`.
To disable Facebook Wi-Fi, run `fbwifi disable`.
## Contents
The 'files' subdirectory contains two subdirectories, one for the fbwifi
package that implements the Facebook Wi-Fi v2.0 standard for OpenWrt, and
another one containing a LuCI application to configure Facebook Wi-Fi.
The folder structures follow *nix conventions:
- 'etc' is the boot time scripts and configuration
- 'usr' contains procedural scripts, lua common code module and GUI prototype for luci
- 'www' contains the HTTP endpoints as CGI handlers

View File

@@ -1,6 +0,0 @@
config fbwifi 'main'
option enabled '0'
option gateway_token 'FBWIFI:GATEWAY|123456789|0123456789|abcdeABCDE123456789'
option http_port '2060'
option https_port '2061'
option zone 'lan'

View File

@@ -1,10 +0,0 @@
#!/bin/sh
[ "$ACTION" = ifup ] || exit 0
/etc/init.d/fbwifi enabled || exit 0
ip route get fibmatch 1.1.1.1 | grep -q "$DEVICE" || exit 0
logger -t fbwifi "Reloading fbwifi due to $ACTION of $INTERFACE ($DEVICE)"
/etc/init.d/fbwifi restart

View File

@@ -1,43 +0,0 @@
#!/bin/sh /etc/rc.common
START=90
USE_PROCD=1
reload_service() {
restart
}
service_triggers() {
procd_add_reload_trigger fbwifi
}
start_service() {
config_load fbwifi
config_get_bool enabled 'main' 'enabled' '0'
[ "$enabled" -eq 0 ] && return
config_get http_port main http_port
[ -z "$http_port" ] && {
logger -t fbwifi "required option http_port not set"
exit 1
}
config_get https_port main https_port
[ -z "$https_port" ] && {
logger -t fbwifi "required option https_port not set"
exit 1
}
logger "[fbwifi] Enabled; starting"
mkdir -p /tmp/fbwifi
/usr/sbin/fbwifi reload
procd_open_instance
procd_set_param command /usr/sbin/fbwifi_validate_token_db
procd_set_param respawn 1 300 0
procd_close_instance
}

View File

@@ -1,156 +0,0 @@
-- SPDX-License-Identifier: GPL-2.0-only
-- Copyright (c) Facebook, Inc. and its affiliates.
--
-- FBWIFI Lua library
-- function table
local fbwifi = {}
local http = require("ssl.https")
local json = require("cjson")
local log = require("posix.syslog")
local uci = require("uci")
function fbwifi.gateway_token()
token = uci.get("fbwifi.main.gateway_token")
if token and string.len(token) > 0 then
return token
else
log.syslog( log.LOG_WARNING, "[fbwifi] UCI option fbwifi.main.gateway_token is missing" )
return nil
end
end
function fbwifi.validate_token( token )
local valid = false
if string.len(token or '' ) > 0 then
GATEWAY_TOKEN = fbwifi.gateway_token()
URL="https://api.fbwifi.com/v2.0/token"
BODY="token="..token
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
if code==200 then
valid = true
else
log.syslog(log.LOG_WARNING, "[fbwifi] validate_token:"..body)
end
end
return valid
end
local mac_to_purge=''
function remove_client_by_mac(client)
state = uci.cursor("/var/state", "/tmp/fbwifi")
for key, value in pairs(client) do
if
key == 'mac' and
value == mac_to_purge
then
log.syslog(log.LOG_INFO, string.format("[fbwifi] Purging DB entry %s for MAC %s", client['.name'] or 'unknown', mac_to_purge) )
state:delete("fbwifi", client['.name'])
return
end
end
end
function fbwifi.instate_client_rule( token, client_mac )
log.syslog(log.LOG_INFO, "[fbwifi] Validating client "..client_mac)
state = uci.cursor("/var/state", "/tmp/fbwifi")
state_name = "token_" .. token
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
local RULE
log.syslog(log.LOG_INFO, string.format("[fbwifi] Cleaning DB for MAC %s", client_mac) )
mac_to_purge = client_mac
state:foreach("fbwifi", "client", remove_client_by_mac)
log.syslog(log.LOG_INFO, string.format("[fbwifi] Adding DB entry %s for MAC %s", state_name, client_mac) )
state:set("fbwifi", state_name, "client")
state:set("fbwifi", state_name, "token", token)
state:set("fbwifi", state_name, "mac", client_mac)
state:set("fbwifi", state_name, "authenticated", "true")
-- verify a rule exists for the given client MAC,
-- OR install it
RULE=string.format(RULE_COND.." || "..RULE_FMT, client_mac, "A", client_mac)
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Opening iptables for %s", client_mac ) )
res = os.execute(RULE)
if res ~= 0 then
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
end
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
state:save('fbwifi')
state:commit('fbwifi')
end
function fbwifi.revoke_client_rule( token )
if (token == nil) then
log.syslog(log.LOG_INFO, "[fbwifi] Invalidating token, but token is Nil")
return
end
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Invalidating token (%s)", token) )
state = uci.cursor("/var/state", "/tmp/fbwifi")
state_name = "token_" .. token
client_mac = state:get("fbwifi", state_name, "mac")
if client_mac then
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
-- verify a rule exists for the given client MAC,
-- AND delete it
RULE=string.format(RULE_COND.." && "..RULE_FMT, client_mac, "D", client_mac)
res = os.execute(RULE)
if res ~= 0 then
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
end
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
state:delete("fbwifi", state_name)
state:save('fbwifi')
state:commit('fbwifi')
else
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Client MAC not found in DB (%s)", state_name ) )
end
end
function fbwifi.reset()
local success = false
GATEWAY_TOKEN = fbwifi.gateway_token()
URL="https://api.fbwifi.com/v2.0/gateway/reset"
BODY="{}"
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
if code==200 then
log.syslog(log.LOG_INFO, "[fbwifi] Reset committed")
success = true
else
log.syslog(log.LOG_WARNING, "[fbwifi] Reset failed : "..body)
end
return success
end
--
-- Return the function table to the host script
--
return fbwifi

View File

@@ -1,58 +0,0 @@
#!/bin/sh
case "$1" in
disable)
uci set fbwifi.main.enabled=0
uci delete firewall.fbwifi
uci delete uhttpd.fbwifi_redirect
uci delete uhttpd.main.json_script
uci set uhttpd.main.cert='/etc/uhttpd.crt'
uci set uhttpd.main.key='/etc/uhttpd.key'
uci set uhttpd.main.rfc1918_filter=1
;;
enable)
uci set fbwifi.main.enabled=1
uci set firewall.fbwifi=include
uci set firewall.fbwifi.enabled=1
uci set firewall.fbwifi.family=ipv4
uci set firewall.fbwifi.path=/usr/share/fbwifi/firewall.include
uci set firewall.fbwifi.reload=1
uci set firewall.fbwifi.type=script
uci set uhttpd.fbwifi_redirect=uhttpd
uci set uhttpd.fbwifi_redirect.enabled=1
uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert'
uci set uhttpd.fbwifi_redirect.home='/dev/null'
uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json'
uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key'
uci set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060'
uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061'
uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert'
uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json'
uci set uhttpd.main.key='/tmp/fbwifi/https_server_key'
uci set uhttpd.main.rfc1918_filter=0
;;
reload)
/usr/sbin/fbwifi_get_config
login_url=$(uci -c /var/state get fbwifi.main.captive_portal_url)
[ -z "$login_url" ] && {
logger -t fbwifi "captive_portal_url not available yet"
exit 1
}
printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json
/etc/init.d/uhttpd restart
exit 0
;;
esac
uci commit
/etc/init.d/uhttpd restart
reload_config

View File

@@ -1,8 +0,0 @@
echo -e "Runtime configuration and token DB\n"
uci -c /var/state export fbwifi
echo -e "\nDynamic firewall flow rules\n"
iptables -t mangle -L FBWIFI_CLIENT_TO_INTERNET
echo -e "\nDHCP leases\n"
cat /tmp/dhcp.leases

View File

@@ -1,39 +0,0 @@
#!/usr/bin/lua
http = require("ssl.https")
json = require("cjson")
log = require("posix.syslog")
socket = require("socket")
require("uci")
fbwifi = require("fbwifi")
GATEWAY_TOKEN = fbwifi.gateway_token()
state = uci.cursor("/var/state", "/tmp/fbwifi")
payload="name="..socket.dns.gethostname()
function queue_ssid_update(iface)
bssid_file="/sys/class/net/br-"..iface["network"].."/address"
local file = io.open(bssid_file)
if file then
for line in file:lines() do
payload=payload.."&bssid[]="..line
end
file:close()
payload=payload.."ssid[]="..iface["ssid"]
else
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to find BSSID for interface br-"..iface["network"])
end
end
state:foreach("wireless", "wifi-iface", queue_ssid_update)
URL="https://api.fbwifi.com/v2.0/gateway"
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, payload)
if code == 200 then
log.syslog(log.LOG_INFO, "[fbwifi] gateway information updated "..body)
os.exit(0)
else
log.syslog(log.LOG_WARNING, "[fbwifi] gateway API failed "..body)
os.exit(code)
end

View File

@@ -1,111 +0,0 @@
#!/usr/bin/lua
http = require("ssl.https")
json = require("cjson")
require("uci")
log = require("posix.syslog")
fbwifi = require("fbwifi")
GATEWAY_TOKEN = fbwifi.gateway_token()
http_port = uci.get("fbwifi.main.http_port")
https_port = uci.get("fbwifi.main.https_port")
statefile = assert(io.open("/var/state/fbwifi", "a"), "could not create state file")
statefile:close()
state = uci.cursor("/var/state", "/tmp/fbwifi")
URL="https://api.fbwifi.com/v2.0/gateway"
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN.."&fields=config,config_version")
if code == 200 then
log.syslog(log.LOG_INFO, "[fbwifi] Got gateway config ("..code..")")
else
log.syslog(log.LOG_CRIT, "[fbwifi] Failed to get gateway config ("..code..")")
os.exit(1)
end
obj = json.decode(body)
function save_cert(name, value)
log.syslog(log.LOG_INFO, "[fbwifi] Saving cert "..name)
local f = assert(io.open("/tmp/fbwifi/"..name, "w"))
f:write(value)
f:close()
end
function process_redirect(ix, host)
IP_SET = "ip addr replace dev lo "..host
local result = os.execute(IP_SET)
if result == 0 then
log.syslog(log.LOG_INFO, "[fbwifi] Redirect address applied "..host)
else
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to apply redirect address "..host)
end
ip = string.match(host, '([0-9\.]*)/([0-9]*)')
RULE_FMT="grep -q \"%s\" /etc/hosts || echo \"%s\tstar.fbwifigateway.net\" >> /etc/hosts"
HOSTS_RULE = string.format(RULE_FMT, ip, ip)
result = os.execute(HOSTS_RULE)
if result == 0 then
log.syslog(log.LOG_INFO, "[fbwifi] Cached redirect host for DNS")
else
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to amend /etc/hosts")
log.syslog(log.LOG_INFO, "[fbwifi] "..HOSTS_RULE)
end
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 80 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..http_port)
--print(result)
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 443 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..https_port)
--print(result)
end
save_cert("https_server_cert", obj['config']['https_server_cert'])
save_cert("https_server_key", obj['config']['https_server_key'])
result = os.execute("iptables -t nat -F FBWIFI_HOST_REDIRLIST")
--print(result)
table.foreach(obj['config']['host_redirect_ips'], process_redirect)
RULE_FORMAT = "iptables -t mangle -A FBWIFI_TRAFFIC_ALLOWLIST -d %s -p %s --dport %s -j MARK --set-mark 0xfb"
function process_traffic_rule(ix, rule)
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
if rule["protocol"] == 6 then
PROTO = "tcp"
elseif rule["protocol"] == 17 then
PROTO = "udp"
end
RULE = string.format(RULE_FORMAT, rule["ip"], PROTO, rule["port"])
local result = os.execute(RULE)
if result == 0 then
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
else
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to install traffic rule ; "..RULE)
end
end
local cross_origin_list = {}
function process_cross_origin_rule(ix, url)
log.syslog(log.LOG_INFO, "[fbwifi] Cross origin rule "..url)
table.insert(cross_origin_list, url)
end
function process_url(url_purpose, fqdn)
log.syslog(log.LOG_INFO, "[fbwifi] Caching "..url_purpose)
state:set("fbwifi", "main", url_purpose, fqdn)
end
state:set("fbwifi", "main", "config")
result = os.execute("iptables -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST ")
--print(result)
table.foreach(obj['config']['traffic_allowlist'], process_traffic_rule)
table.foreach(obj['config']['cross_origin_allowlist'], process_cross_origin_rule)
table.foreach(obj['config']['urls'], process_url)
state:set("fbwifi", "main", "cross_origin_allow_rules", cross_origin_list)
state:set("fbwifi", "main", "config_version", obj['config_version'])
state:save('fbwifi')
state:commit('fbwifi')

View File

@@ -1,75 +0,0 @@
#!/usr/bin/lua
https = require("ssl.https")
json = require("cjson")
log = require("posix.syslog")
fbwifi = require("fbwifi")
require("uci")
state = uci.cursor("/var/state", "/tmp/fbwifi")
GATEWAY_TOKEN = fbwifi.gateway_token()
request = {
tokens = {},
traffic_type = "total",
config_version = state:get("fbwifi", "main", "config_version")
}
function queue_token(client)
request.tokens[client.token]={
incoming = json.null,
outgoing = json.null,
connected_time_sec = json.null,
inactive_time_sec = json.null,
signal_rssi_dbm = json.null,
--expected_tpus_mbps = json.null,
is_connected = true
}
end
state:foreach("fbwifi", "client", queue_token)
print( "\nRequest:\n"..json.encode(request) )
URL="https://api.fbwifi.com/v2.0/tokens"
BODY=string.format(
"tokens=%s&traffic_type=%s&config_version=%s",
json.encode(request.tokens),
"total",
state:get("fbwifi", "main", "config_version")
)
body, code, headers = https.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
if code then
print( "\nResponse:\n"..body )
end
response = json.decode(body)
--print(response)
--table.foreach(response,print)
--table.foreach(response.tokens,print)
if response.config_valid then
log.syslog(log.LOG_INFO, "[fbwifi] Config validated")
else
log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config")
local result = os.execute("/usr/sbin/fbwifi reload")
if result == 0 then
log.syslog(log.LOG_INFO, "[fbwifi] successfully fetched and loaded new config ")
else
log.syslog(log.LOG_WARNING, "[fbwifi] failed to fetch and load new config, possible stale config")
end
end
function process_token(token, metadata)
table.foreach(metadata,print)
if metadata.valid then
print("OK: "..token)
else
print("Nok: "..token)
fbwifi.revoke_client_rule( token )
end
end
table.foreach(response.tokens,process_token)

View File

@@ -1,75 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) Facebook, Inc. and its affiliates.
IPT4="/usr/sbin/iptables"
set -- --wait 1 --wait-interval 100
fbwifi_http_port="$(uci get fbwifi.main.http_port)"
[ -n "$fbwifi_http_port" ] || {
logger -t fbwifi "required option http_port not set"
exit 1
}
fbwifi_https_port="$(uci get fbwifi.main.https_port)"
[ -n "$fbwifi_https_port" ] || {
logger -t fbwifi "required option https_port not set"
exit 1
}
fbwifi_zone="$(uci get fbwifi.main.zone)"
[ -n "$fbwifi_zone" ] || {
logger -t fbwifi "required option zone not set"
exit 1
}
fbwifi_ifaces="$(fw3 -q zone "$fbwifi_zone")"
## Create custom chains
"$IPT4" "$@" -t filter -N FBWIFI_FORWARD 2>/dev/null
"$IPT4" "$@" -t filter -N FBWIFI_INPUT 2>/dev/null
"$IPT4" "$@" -t mangle -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null
"$IPT4" "$@" -t mangle -N FBWIFI_PREROUTING 2>/dev/null
"$IPT4" "$@" -t mangle -N FBWIFI_TRAFFIC_ALLOWLIST 2>/dev/null
"$IPT4" "$@" -t nat -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null
"$IPT4" "$@" -t nat -N FBWIFI_PREROUTING 2>/dev/null
"$IPT4" "$@" -t nat -N FBWIFI_HOST_REDIRLIST 2>/dev/null
## Flush custom chains
"$IPT4" "$@" -t filter -F FBWIFI_FORWARD
"$IPT4" "$@" -t filter -F FBWIFI_INPUT
"$IPT4" "$@" -t mangle -F FBWIFI_CLIENT_TO_INTERNET
"$IPT4" "$@" -t mangle -F FBWIFI_PREROUTING
"$IPT4" "$@" -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST
"$IPT4" "$@" -t nat -F FBWIFI_CLIENT_TO_INTERNET
"$IPT4" "$@" -t nat -F FBWIFI_PREROUTING
"$IPT4" "$@" -t nat -F FBWIFI_HOST_REDIRLIST
## Populate custom chains
"$IPT4" "$@" -t filter -A FBWIFI_FORWARD -p udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
"$IPT4" "$@" -t filter -A FBWIFI_FORWARD -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
"$IPT4" "$@" -t filter -A FBWIFI_FORWARD -j REJECT
"$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_http_port" -m conntrack --ctstate NEW -j ACCEPT
"$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_https_port" -m conntrack --ctstate NEW -j ACCEPT
"$IPT4" "$@" -t filter -A FBWIFI_INPUT -p tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT
"$IPT4" "$@" -t mangle -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET
"$IPT4" "$@" -t mangle -A FBWIFI_PREROUTING -j FBWIFI_TRAFFIC_ALLOWLIST
"$IPT4" "$@" -t nat -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p udp --dport 443 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p udp --dport 443 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
"$IPT4" "$@" -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j REDIRECT --to-ports "$fbwifi_http_port"
## Hook custom chains in firewall3 chains
"$IPT4" "$@" -t filter -I "zone_${fbwifi_zone}_input" 2 -j FBWIFI_INPUT
"$IPT4" "$@" -t filter -I "zone_${fbwifi_zone}_forward" 2 -j FBWIFI_FORWARD
"$IPT4" "$@" -t nat -I "zone_${fbwifi_zone}_prerouting" 2 -j FBWIFI_PREROUTING
# There are no firewall3 zone chains in the mangle table so we need to do this for all interfaces in the zone
for iface in $fbwifi_ifaces; do
"$IPT4" "$@" -t mangle -I PREROUTING -i "$iface" -j FBWIFI_PREROUTING
done

View File

@@ -1,8 +0,0 @@
{
"request": [
[ "if",
[ "regex", "REQUEST_URI", "^/fbwifi" ],
[ "rewrite", "/cgi-bin%REQUEST_URI%" ]
]
]
}

View File

@@ -1,70 +0,0 @@
#!/usr/bin/lua
require("uci")
log = require("posix.syslog")
fbwifi = require("fbwifi")
state = uci.cursor("/var/state", "/tmp/fbwifi")
function process_cors()
origin = os.getenv("HTTP_ORIGIN")
log.syslog(log.LOG_INFO, string.format("[fbwifi] [auth] process_cors origin %s", origin or 'not found') )
if string.len(origin or '') > 0 then
allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules")
for _, value in pairs(allow_list) do
if value == origin then
log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors Appending CORS Headers to HTTP")
print("Access-Control-Allow-Origin: "..origin)
print("Vary: Origin")
break
end
end
else
log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors No CORS Headers added to Response")
end
end
method = os.getenv("REQUEST_METHOD")
if method == 'GET' then
log.syslog(log.LOG_INFO, "[fbwifi] [auth] GET handler")
print("Status: 302 Found")
print("Location: "..state:get("fbwifi", "main", "landing_page_url"))
process_cors()
print ('\n')
elseif method == 'POST' then
local token
log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler")
process_cors()
print("Status: 200 OK")
form_data=io.read()
while form_data do
token = string.match(form_data, '[%d]+')
if string.len(token or '') > 14 then
client = os.getenv("REMOTE_ADDR")
f = io.popen("awk '/"..client..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
client_mac = assert(f:read('*a'))
f:close()
if fbwifi.validate_token(token) then
log.syslog(log.LOG_INFO, string.format( "[fbwifi] [auth] POST handler : Validating Token (%s) for MAC (%s)", token or 'nil', client_mac or 'nil') )
fbwifi.instate_client_rule(token, client_mac)
print("\n{\"valid\":true}\n")
else
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] [auth] POST handler : ! Invalid token (%s) for mac (%s) !", token or 'nil', client_mac or 'nil') )
fbwifi.revoke_client_rule(token)
print("\n{\"valid\":false}\n")
end
log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler completed")
return
end
form_data=io.read()
end
print ('\n')
log.syslog(log.LOG_WARNING, string.format("[fbwifi] [auth] POST handler : token not found" ))
fbwifi.revoke_client_rule(token)
print("\n{\"valid\":false}\n")
end

View File

@@ -1,42 +0,0 @@
#!/usr/bin/lua
json = require("cjson")
require("uci")
state = uci.cursor("/var/state", "/tmp/fbwifi")
client_mac = ""
token = ""
response = {}
response['venue-info-url'] = state:get("fbwifi", "main", "capport_venue_info_url")
function map_remote_mac_to_token(client)
for key, value in pairs(client) do
if
key == 'mac' and
value == client_mac
then
token = client.token
return false
end
end
end
function hasValidToken(client_ip)
f = io.popen("awk '/"..client_ip..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
client_mac = assert(f:read('*a'))
f:close()
state:foreach("fbwifi", "client", map_remote_mac_to_token)
return 0 < string.len(token)
end
print("Content-type: application/captive+json; charset=utf-8\n")
client = os.getenv("REMOTE_ADDR")
response['captive'] = not hasValidToken(client)
if response['captive'] then
response['user-portal-url'] = state:get("fbwifi", "main", "captive_portal_url")
end
print( json.encode(response) )

View File

@@ -1,57 +0,0 @@
#!/usr/bin/lua
json = require("cjson")
fbwifi = require("fbwifi")
state = uci.cursor("/var/state", "/tmp/fbwifi")
GATEWAY_TOKEN = fbwifi.gateway_token()
response = { api_version = "2.0", token = json.null }
client_mac = ""
function process_cors()
origin = os.getenv("HTTP_ORIGIN")
if string.len(origin or '') > 0 then
allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules")
for _, value in pairs(allow_list) do
if value == origin then
print("Access-Control-Allow-Origin: "..origin)
print("Vary: Origin")
break
end
end
end
end
function map_remote_mac_to_token(client)
for key, value in pairs(client) do
if
key == 'mac' and
value == client_mac
then
response.token = client.token
return false -- escape outer loop
end
end
end
function getClientToken(client_ip)
f = io.popen("awk '/"..client_ip..".*0x2/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
client_mac = assert(f:read('*a'))
f:close()
state:foreach("fbwifi", "client", map_remote_mac_to_token)
end
function getGatewayId()
id = string.match(GATEWAY_TOKEN, 'FBWIFI:GATEWAY|[0-9]*|([0-9]*)')
return id
end
process_cors()
print("Content-type: application/json; charset=utf-8\n")
getClientToken(os.getenv("REMOTE_ADDR"))
response.gateway_id = getGatewayId()
print( json.encode(response) )

View File

@@ -1,12 +0,0 @@
-- SPDX-License-Identifier: GPL-2.0-only
-- Copyright (c) Facebook, Inc. and its affiliates.
module("luci.controller.fbwifi", package.seeall)
sys = require "luci.sys"
ut = require "luci.util"
function index()
entry({"admin", "network", "fbwifi"}, template("fbwifi"), "Facebook Wi-Fi", 90).dependent=false
end

View File

@@ -1,16 +0,0 @@
<%#
Copyright
Licensed to the public under the GNU General Public License v2.
-%>
<%+header%>
<h1>Facebook Wi-Fi</h1>
<%
require("uci")
state = uci.cursor("/var/state", "/tmp/fbwifi")
url = state:get("fbwifi", "main", "captive_portal_config_url")
%>
<a href="<% print(url) %>">Configure FB business page</a>
<%+footer%>

View File

@@ -10,14 +10,15 @@ CPU_TYPE:=cortex-a7
KERNEL_PATCHVER:=4.4
KERNEL_NAME_SUFFIX=-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016
KERNEL_QSDK_4_4:=y
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += kmod-qca-nss-dp kmod-qca-ssdk swconfig \
kmod-qca-nss-drv \
kmod-usb-phy-ipq807x kmod-usb-dwc3-of-simple \
kmod-ath11k-ahb kmod-qrtr_mproc wpad \
kmod-gpio-button-hotplug \
qca-thermald-10.4 qca-ssdk-shell kmod-qca-nss-drv-bridge-mgr \
kmod-gpio-button-hotplug kmod-bootconfig \
qca-thermald-10.4 qca-ssdk-shell \
uboot-envtools
$(eval $(call BuildTarget))

View File

@@ -17,9 +17,6 @@ cig,wf194c4)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
;;
esac
case "$board" in
edgecore,eap101)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
@@ -32,11 +29,37 @@ edgecore,eap102)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
;;
edgecore,eap104)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt"
ucidef_set_led_netdev "wan" "wan" "yellow:uplink" "eth0"
;;
liteon,wpx8324)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "orange:wifi2" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt"
ucidef_set_led_netdev "wan" "wan" "blue:uplink" "eth0"
;;
hfcl,ion4xi|\
hfcl,ion4xi_wp|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
hfcl,ion4xe)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wifi2" "phy1tpt"
;;
glinet,ax1800|\
glinet,axt1800)
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0" "tx rx link"
;;
yuncore,fap650|\
yuncore,fap655|\
muxi,ap3220l)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt"
;;
esac
board_config_flush

View File

@@ -13,6 +13,8 @@ qcom_setup_interfaces()
case $board in
hfcl,ion4xi|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xe)
ucidef_set_interface_wan "eth0 eth1"
ucidef_set_interface_lan ""
@@ -31,19 +33,55 @@ qcom_setup_interfaces()
cig,wf194c|\
cig,wf194c4|\
edgecore,eap106|\
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
qcom,ipq5018-mp03.1|\
qcom,ipq5018-mp03.3|\
sercomm,wallaby)
yuncore,ax840|\
motorola,q14|\
sercomm,wallaby|\
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2)
ucidef_set_interface_lan "eth0"
ucidef_set_interface_wan "eth1"
;;
edgecore,eap101)
edgecore,eap101|\
glinet,axt1800)
ucidef_set_interface_lan "eth1 eth2"
ucidef_set_interface_wan "eth0"
;;
edgecore,eap102|\
liteon,wpx8324|\
wallys,dr6018|\
cig,wf188n|\
cig,wf196)
cig,wf196|\
muxi,ap3220l)
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
;;
cig,wf660a)
ucidef_set_interface_wan "eth0"
;;
cig,wf186w)
ucidef_add_switch "switch0" "4:wan" "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0"
;;
cig,wf186h)
ucidef_add_switch "switch0" "4:wan" "1:lan" "2:lan" "6@eth0"
;;
yuncore,fap650)
ucidef_set_interface_lan "eth3 eth2 eth1 eth0"
ucidef_set_interface_wan "eth4"
;;
hfcl,ion4xi_wp)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
ucidef_set_interface_wan "eth4"
;;
hfcl,ion4xi_w|\
hfcl,ion4x_w)
ucidef_set_interface_wan "eth0"
;;
hfcl,ion4xi_HMR)
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
;;
@@ -51,11 +89,22 @@ qcom_setup_interfaces()
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
ucidef_set_interface_wan "eth4"
;;
wallys,dr6018-v4)
wallys,dr6018-v4|\
glinet,ax1800|\
meshpp,s618-cp03|\
meshpp,s618-cp01)
ucidef_set_interface_lan "eth1 eth2 eth3 eth4"
ucidef_set_interface_wan "eth0"
;;
cybertan,eww622-a1|\
cybertan,eww622-a1)
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch1" \
"6@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
;;
xunison,d50-5g)
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan "eth1"
;;
qcom,ipq5018-mp03.1)
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
@@ -63,6 +112,42 @@ qcom_setup_interfaces()
ucidef_add_switch_attr "switch1" "enable" "false"
ucidef_add_switch_attr "switch1" "reset" "true"
;;
qcom,ipq5018-mp03.3)
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch1"
ucidef_add_switch_attr "switch1" "enable" "false"
ucidef_add_switch_attr "switch1" "reset" "true"
;;
edgecore,eap104)
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch1" \
"6@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
;;
cybertan,eww631-a1)
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch1"
ucidef_add_switch_attr "switch1" "enable" "false"
ucidef_add_switch_attr "switch1" "reset" "true"
;;
cybertan,eww631-b1)
ucidef_add_switch "switch0"
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan ""
ucidef_add_switch "switch1"
ucidef_add_switch_attr "switch1" "enable" "false"
ucidef_add_switch_attr "switch1" "reset" "true"
;;
wallys,dr5018)
ucidef_set_interface_lan "eth0 eth1"
ucidef_add_switch "switch1"
ucidef_add_switch_attr "switch1" "enable" "false"
ucidef_add_switch_attr "switch1" "reset" "true"
;;
yuncore,fap655)
ucidef_add_switch "switch1" \
"6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
;;
esac
}
@@ -73,25 +158,123 @@ qcom_setup_macs()
case $board in
cig,wf194c|\
cig,wf194c4)
mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2)
mtd=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mtd" ] && return;
mac=$(grep BaseMacAddress= $mtd | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $lan_mac
ucidef_set_network_device_mac eth1 $wan_mac
ip link set eth0 address $lan_mac
ip link set eth1 address $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
cig,wf186w)
mtd=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mtd" ] && return;
mac=$(grep BaseMacAddress= $mtd | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
#lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $wan_mac
# ucidef_set_network_device_mac eth1 $wan_mac
ip link set eth0 address $wan_mac
# ip link set eth1 address $wan_mac
# ucidef_set_label_macaddr $wan_mac
;;
cig,wf186h)
mtd=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mtd" ] && return;
mac=$(grep BaseMacAddress= $mtd | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
ucidef_set_network_device_mac eth0 $wan_mac
ip link set eth0 address $wan_mac
;;
cybertan,eww631-a1|\
cybertan,eww631-b1)
mac=$(grep -i -m 1 BaseMacAddress= /dev/`cat /proc/mtd | grep APPSBLENV | cut -d: -f1` | cut -d= -f2)
[ -z "$mac"] && mac="00:11:22:33:44:00"
wan_mac=$(macaddr_canonicalize $mac)
ucidef_set_network_device_mac eth0 $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
cig,wf188n|\
cig,wf196)
mtd=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mtd" ] && return;
mac=$(grep BaseMacAddress= $mtd | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth1 $lan_mac
ucidef_set_network_device_mac eth0 $wan_mac
ip link set eth0 address $wan_mac
ip link set eth1 address $lan_mac
ucidef_set_label_macaddr $wan_mac
;;
cig,wf660a)
mmc_dev=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mmc_dev" ] && mmc_dev=$(find_mmc_part "0:APPSBLENV")
[ -z "$mmc_dev" ] && return
mac=$(grep BaseMacAddress= $mmc_dev | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
ucidef_set_network_device_mac eth0 $wan_mac
ip link set eth0 address $wan_mac
;;
cybertan,eww622-a1)
mac=$(grep -i -m 1 mac_addr_base= /dev/`cat /proc/mtd | grep devinfo | cut -d: -f1` | cut -d= -f2)
[ -z "$mac"] && mac="00:11:22:33:44:55"
wan_mac=$(macaddr_canonicalize $mac)
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $wan_mac
ucidef_set_network_device_mac eth1 $lan_mac
ucidef_set_label_macaddr $wan_mac
;;
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
yuncore,ax840)
wan_mac=$(cat /sys/class/net/eth1/address)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
yuncore,fap650)
wan_mac=$(cat /sys/class/net/eth4/address)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
yuncore,fap655)
wan_mac=$(cat /sys/class/net/eth0/address)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
muxi,ap3220l)
wan_mac=$(mtd_get_mac_binary 0:Product_Info 0x5b)
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $wan_mac
ucidef_set_network_device_mac eth1 $lan_mac
ip link set eth0 address $wan_mac
ip link set eth1 address $lan_mac
;;
*)
wan_mac=$(cat /sys/class/net/eth0/address)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
wallys,dr5018)
mac=$(grep -i -m 1 BaseMacAddress= /dev/`cat /proc/mtd | grep APPSBLENV | cut -d: -f1` | cut -d= -f2)
[ -z "$mac"] && mac="00:11:22:33:44:00"
wan_mac=$(macaddr_canonicalize $mac)
ucidef_set_network_device_mac eth0 $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
[ -n "$wan_mac" ] && ucidef_set_label_macaddr "$wan_mac"
}
board_config_update
board=$(board_name)
ucidef_set_bridge_device bridge
qcom_setup_interfaces $board
qcom_setup_macs $board
board_config_flush

View File

@@ -39,32 +39,86 @@ ath11k_generate_macs_wf194() {
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_ion4x() {
touch /lib/firmware/ath11k-macs
wifimac0=$(grep WLAN0_BASEMAC= /dev/mtd15 |cut -d '=' -f2)
wifimac1=$(grep WLAN1_BASEMAC= /dev/mtd15 |cut -d '=' -f2)
wifimac2=00:00:00:00:00:00
ath11k_generate_macs_ion4x() {
local dev=$(find_mtd_chardev "0:ART")
touch /lib/firmware/ath11k-macs
wifimac0=$(grep WLAN0_BASEMAC= $dev |cut -d '=' -f2)
wifimac1=$(grep WLAN1_BASEMAC= $dev |cut -d '=' -f2)
wifimac2=00:00:00:00:00:00
echo -ne \\x${wifimac0//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${wifimac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_pax1800() {
touch /lib/firmware/ath11k-macs
eth=$(cat /sys/class/net/eth0/address)
mac1=$(macaddr_add $eth 10)
mac2=$(macaddr_add $eth 2)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_wf660a() {
touch /lib/firmware/ath11k-macs
mmc_dev=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mmc_dev" ] && mmc_dev=$(find_mmc_part "0:APPSBLENV")
[ -n "$mmc_dev" ] && mac=$(grep BaseMacAddress= $mmc_dev | cut -dx -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 1)
mac2=$(macaddr_add $eth 2)
mac3=$(macaddr_add $eth 3)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_wf186w() {
touch /lib/firmware/ath11k-macs
local dev=$(find_mtd_chardev "0:APPSBLENV")
mac=$(grep BaseMacAddress= $dev | cut -dx -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
mac3=$(macaddr_add $eth 4)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_wf186h() {
touch /lib/firmware/ath11k-macs
local dev=$(find_mtd_chardev "0:APPSBLENV")
mac=$(grep BaseMacAddress= $dev | cut -dx -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
mac3=$(macaddr_add $eth 4)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
caldata_die() {
echo "caldata: " "$*"
exit 1
echo "caldata: " "$*"
exit 1
}
caldata_extract() {
local part=$1
local offset=$(($2))
local count=$(($3))
local mtd
local part=$1
local offset=$(($2))
local count=$(($3))
local mtd
mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
mtd=$(find_mtd_chardev $part)
if [ -z "$mtd" ]; then
mtd=/dev/$(echo $(find_mmc_part $part) | sed 's/^.\{5\}//')
fi
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $mtd"
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $mtd"
}
board=$(board_name)
@@ -77,12 +131,15 @@ case "$FIRMWARE" in
cig,wf196|\
edgecore,eap102 |\
edgecore,eap106 |\
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
tplink,ex227|\
tplink,ex447|\
sercomm,wallaby)
caldata_extract "0:ART" 0x1000 0x20000
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
@@ -90,32 +147,91 @@ case "$FIRMWARE" in
case "$board" in
cig,wf188|\
cig,wf188n|\
cig,wf660a|\
edgecore,eap101|\
hfcl,ion4xi|\
hfcl,ion4x_2|\
hfcl,ion4x|\
hfcl,ion4xe|\
hfcl,ion4xi_wp|\
wallys,dr6018|\
wallys,dr6018-v4|\
meshpp,ipq6018-cp01|\
meshpp,ipq6018-cp03|\
qcom,ipq6018-cp03|\
qcom,ipq6018-cp01|\
xiaomi,ax1800)
caldata_extract "0:ART" 0x1000 0x20000
xiaomi,ax1800|\
glinet,ax1800|\
yuncore,ax840|\
yuncore,fap650|\
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
ath11k/IPQ5018/hw1.0/caldata.bin)
case "$board" in
cig,wf186w|\
cig,wf186h|\
cybertan,eww622-a1|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
wallys,dr5018|\
edgecore,eap104|\
yuncore,fap655|\
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
liteon,wpx8324|\
motorola,q14|\
muxi,ap3220l|\
xunison,d50-5g|\
qcom,ipq5018-mp03.1)
caldata_extract "0:ART" 0x1000 0x20000
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_1.bin)
case "$board" in
cig,wf186w|\
cig,wf186h|\
wallys,dr5018|\
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
yuncore,fap655|\
motorola,q14)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_2.bin)
case "$board" in
motorola,q14|\
wallys,dr5018|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
edgecore,eap104|\
liteon,wpx8324)
caldata_extract "0:ART" 0x4c000 0x20000
;;
muxi,ap3220l)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
ath11k/QCN9074/hw1.0/caldata_1.bin)
case "$board" in
cig,wf196|\
wallys,dr6018-v4|\
cybertan,eww622-a1|\
xunison,d50-5g|\
qcom,ipq5018-mp03.1|\
qcom,ipq807x-hk14)
caldata_extract "0:ART" 0x26800 0x20000
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
@@ -123,27 +239,54 @@ ath11k/QCN9074/hw1.0/caldata_2.bin)
case "$board" in
qcom,ipq807x-hk14|\
qcom,ipq5018-mp03.3)
caldata_extract "0:ART" 0x4C000 0x20000
caldata_extract "0:ART" 0x4C000 0x20000
;;
esac
;;
ath11k-macs)
case "$board" in
hfcl,ion4xi|\
hfcl,ion4xe)
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
hfcl,ion4xi_wp|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xe)
ath11k_generate_macs_ion4x
;;
edgecore,eap101)
ath11k_generate_macs_eap101
;;
yuncore,ax840|\
yuncore,fap655|\
edgecore,eap102|\
edgecore,eap104|\
edgecore,eap106|\
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
xunison,d50-5g|\
cig,wf188n)
ath11k_generate_macs
;;
cig,wf194c|\
cig,wf194c)
cig,wf194c4|\
cig,wf196)
ath11k_generate_macs_wf194
;;
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2)
ath11k_generate_macs_pax1800
;;
cig,wf660a)
ath11k_generate_macs_wf660a
;;
cig,wf186w)
ath11k_generate_macs_wf186w
;;
cig,wf186h)
ath11k_generate_macs_wf186h
;;
esac
;;

View File

@@ -1,67 +0,0 @@
#!/bin/sh
[ "$ACTION" = add ] || exit
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
[ "$NPROCS" -gt 1 ] || exit
PROC_MASK="$(( (1 << $NPROCS) - 1 ))"
find_irq_cpu() {
local dev="$1"
local match="$(grep -m 1 "$dev\$" /proc/interrupts)"
local cpu=0
[ -n "$match" ] && {
set -- $match
shift
for cur in `seq 1 $NPROCS`; do
[ "$1" -gt 0 ] && {
cpu=$(($cur - 1))
break
}
shift
done
}
echo "$cpu"
}
set_hex_val() {
local file="$1"
local val="$2"
val="$(printf %x "$val")"
[ -n "$DEBUG" ] && echo "$file = $val"
echo "$val" > "$file"
}
default_ps="$(uci get "network.@globals[0].default_ps")"
[ -n "$default_ps" -a "$default_ps" != 1 ] && exit 0
exec 512>/var/lock/smp_tune.lock
flock 512 || exit 1
for dev in /sys/class/net/*; do
[ -d "$dev" ] || continue
# ignore virtual interfaces
[ -n "$(ls "${dev}/" | grep '^lower_')" ] && continue
[ -d "${dev}/device" ] || continue
device="$(readlink "${dev}/device")"
device="$(basename "$device")"
irq_cpu="$(find_irq_cpu "$device")"
irq_cpu_mask="$((1 << $irq_cpu))"
for q in ${dev}/queues/rx-*; do
set_hex_val "$q/rps_cpus" "$(($PROC_MASK & ~$irq_cpu_mask))"
done
ntxq="$(ls -d ${dev}/queues/tx-* | wc -l)"
idx=$(($irq_cpu + 1))
for q in ${dev}/queues/tx-*; do
set_hex_val "$q/xps_cpus" "$((1 << $idx))"
let "idx = idx + 1"
[ "$idx" -ge "$NPROCS" ] && idx=0
done
done

View File

@@ -0,0 +1,40 @@
#!/bin/sh
. /lib/functions.sh
debug() {
logger -t HOTPLUG-DVLAN "$*"
}
if [ "${INTERFACE:0:4}" != "wlan" ]; then
exit 0
fi
case "$(board_name)" in
"cig,wf186w")
wan_iface="eth0"
switch_dev="switch0"
switch_wan_port=4
switch_cpu_port=6
;;
*)
exit 0
esac
VSTR="$(echo $INTERFACE | egrep -o 'v([0-9]+)$')"
[ -z "$VSTR" ] && exit 0
VID="${VSTR:1}"
[ $VID -lt 1 -o $VID -gt 4096 ] && exit 0
if [ "$ACTION" = "add" ]; then
debug "[$INTERFACE] Dynamic VLAN $VID added, configuring switch"
swconfig dev ${switch_dev} vlan $VID set ports "${switch_wan_port}t ${switch_cpu_port}t"
elif [ "$ACTION" = "remove" ]; then
let cnt="$(bridge vlan show vid $VID | egrep "^wlan" | wc -l)"
debug "[$INTERFACE] Dynamic VLAN interface removed, references left = $cnt"
if [ $cnt -eq 0 ]; then
debug "[$INTERFACE] No more references, removing $VID from switch"
swconfig dev ${switch_dev} vlan $VID set ports ""
fi
fi

View File

@@ -1,3 +1,3 @@
#!/bin/sh
mac=$(cat /etc/board.json | jsonfilter -e '@["network-device"]["'$DEVICENAME'"]'.macaddr)
mac=$(cat /etc/board.json | jsonfilter -e '@["network_device"]["'$DEVICENAME'"]'.macaddr)
[ -n "$mac" ] && ip link set $DEVICENAME address $mac

View File

@@ -19,4 +19,12 @@ boot() {
ssdk_sh debug phy set 8 0x4004c441 0x8
;;
esac
case "$(board_name)" in
cig,wf196)
# setup the leds
ssdk_sh debug phy set 0 0x401ec431 0xc00f
ssdk_sh debug phy set 0 0x401ec430 0x806f
;;
esac
}

View File

@@ -4,8 +4,20 @@ START=99
boot() {
case "$(board_name)" in
hfcl,ion4xe|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
hfcl,ion4xi_wp|\
hfcl,ion4xi)
fw_setenv boot_count 0
;;
edgecore,eap101|\
edgecore,eap102)
avail=$(fw_printenv -n upgrade_available)
[ "${avail}" -eq 1 ] || fw_setenv upgrade_available 1
fw_setenv bootcount 0
;;
esac

View File

@@ -1,58 +0,0 @@
#!/bin/sh /etc/rc.common
START=80
set_affinity() {
local affinity=$1
local name=$2
local irq=`grep -E -m1 $name /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '`
[ -n "$irq" ] && {
logger ath11k setting affinity for $name/$irq to $affinity
echo $affinity > /proc/irq/$irq/smp_affinity
}
}
boot() {
. /lib/functions/system.sh
board=$(board_name)
case $board in
cig,wf196)
set_affinity 1 reo2host-destination-ring2
set_affinity 2 reo2host-destination-ring1
;;
*)
set_affinity 2 reo2host-destination-ring2
set_affinity 1 reo2host-destination-ring1
;;
esac
case $board in
maple)
;;
*)
set_affinity 8 reo2host-destination-ring4
set_affinity 4 reo2host-destination-ring3
set_affinity 8 wbm2host-tx-completions-ring3
set_affinity 4 wbm2host-tx-completions-ring2
set_affinity 2 wbm2host-tx-completions-ring1
set_affinity 8 ppdu-end-interrupts-mac1
set_affinity 8 rxdma2host-monitor-status-ring-mac1
set_affinity 8 rxdma2host-monitor-destination-mac1
set_affinity 8 host2rxdma-monitor-ring1
;;
esac
set_affinity 4 ppdu-end-interrupts-mac2
set_affinity 4 rxdma2host-monitor-status-ring-mac2
set_affinity 4 rxdma2host-monitor-destination-mac2
set_affinity 4 host2rxdma-monitor-ring2
set_affinity 2 ppdu-end-interrupts-mac3
set_affinity 2 rxdma2host-monitor-status-ring-mac3
set_affinity 2 rxdma2host-monitor-destination-mac3
set_affinity 2 host2rxdma-monitor-ring3
}

View File

@@ -0,0 +1,126 @@
# The U-Boot loader with the datachk patchset for dualbooting requires image
# sizes and checksums to be provided in the U-Boot environment.
# The devices come with 2 main partitions - while one is active
# sysupgrade will flash the other. The boot order is changed to boot the
# newly flashed partition. If the new partition can't be booted due to
# upgrade failures the previously used partition is loaded.
platform_post_upgrade_sanity_check()
{
local part_name=$1
local inactive_mtd=$2
local cfg_md5=$3
local part_offset=$4
local part_size=$5
md5_part_disk=$(dd if=/dev/${inactive_mtd} bs=$((64*1024)) skip=$((part_offset / (64*1024))) count=$((part_size / (64*1024))) 2>&- | md5sum | awk '{print $1}')
if [ "${cfg_md5}" != "${md5_part_disk}" ]; then
echo "post-flashing checksum mismatch: ${part_name}" >&2
echo "${cfg_md5} != ${md5_part_disk}"
return 1
fi
return 0
}
platform_do_upgrade_dualboot_datachk() {
local tar_file="$1"
local restore_backup
local primary_kernel_mtd
local setenv_script="/tmp/fw_env_upgrade"
local kernel_mtd="$(find_mtd_index $PART_NAME)"
local kernel_offset="$(cat /sys/class/mtd/mtd${kernel_mtd}/offset)"
local total_size="$(cat /sys/class/mtd/mtd${kernel_mtd}/size)"
# detect to which flash region the new image is written to.
#
# 1. check what is the mtd index for the first flash region on this
# device
# 2. check if the target partition ("inactive") has the mtd index of
# the first flash region
#
# - when it is: the new bootseq will be 1,2 and the first region is
# modified
# - when it isnt: bootseq will be 2,1 and the second region is
# modified
#
# The detection has to be done via the hardcoded mtd partition because
# the current boot might be done with the fallback region. Let us
# assume that the current bootseq is 1,2. The bootloader detected that
# the image in flash region 1 is corrupt and thus switches to flash
# region 2. The bootseq in the u-boot-env is now still the same and
# the sysupgrade code can now only rely on the actual mtd indexes and
# not the bootseq variable to detect the currently booted flash
# region/image.
#
# In the above example, an implementation which uses bootseq ("1,2") to
# detect the currently booted image would assume that region 1 is booted
# and then overwrite the variables for the wrong flash region (aka the
# one which isn't modified). This could result in a device which doesn't
# boot anymore to Linux until it was reflashed with ap51-flash.
local next_boot_part="1"
case "$(board_name)" in
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2)
primary_kernel_mtd=9
;;
*)
echo "failed to detect primary kernel mtd partition for board"
return 1
;;
esac
[ "$kernel_mtd" = "$primary_kernel_mtd" ] || next_boot_part="2"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c)
local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c)
# rootfs without EOF marker
rootfs_length=$((rootfs_length-4))
local kernel_md5=$(tar xf $tar_file ${board_dir}/kernel -O | md5sum); kernel_md5="${kernel_md5%% *}"
# md5 checksum of rootfs with EOF marker
local rootfs_md5=$(tar xf $tar_file ${board_dir}/root -O | dd bs=1 count=$rootfs_length | md5sum); rootfs_md5="${rootfs_md5%% *}"
#
# add tar support to get_image() to use default_do_upgrade() instead?
#
# take care of restoring a saved config
[ -n "$UPGRADE_BACKUP" ] && restore_backup="${MTD_CONFIG_ARGS} -j ${UPGRADE_BACKUP}"
mtd -q erase inactive
tar xf $tar_file ${board_dir}/root -O | mtd -n -p $kernel_length $restore_backup write - $PART_NAME
tar xf $tar_file ${board_dir}/kernel -O | mtd -n write - $PART_NAME
platform_post_upgrade_sanity_check "kernel" "mtd${kernel_mtd}" $kernel_md5 0 $kernel_length || return 1
platform_post_upgrade_sanity_check "rootfs" "mtd${kernel_mtd}" $rootfs_md5 $kernel_length $rootfs_length || return 1
# prepare new u-boot env
if [ "$next_boot_part" = "1" ]; then
echo "bootseq 1,2" > $setenv_script
else
echo "bootseq 2,1" > $setenv_script
fi
printf "kernel_size_%i 0x%08x\n" $next_boot_part $kernel_length >> $setenv_script
printf "vmlinux_start_addr 0x%08x\n" ${kernel_offset} >> $setenv_script
printf "vmlinux_size 0x%08x\n" ${kernel_length} >> $setenv_script
printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script
printf "rootfs_size_%i 0x%08x\n" $next_boot_part $((total_size-kernel_length)) >> $setenv_script
printf "rootfs_start_addr 0x%08x\n" $((kernel_offset+kernel_length)) >> $setenv_script
printf "rootfs_size 0x%08x\n" ${rootfs_length} >> $setenv_script
printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script
# store u-boot env changes
mkdir -p /var/lock
fw_setenv -s $setenv_script || {
echo "failed to update U-Boot environment"
return 1
}
}

View File

@@ -1,43 +1,168 @@
. /lib/functions/system.sh
qca_do_upgrade() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
RAMFS_COPY_BIN='fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock /tmp/downgrade'
qca_do_upgrade() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
local dev=$(find_mtd_chardev "0:HLOS")
tar Oxf $tar_file ${board_dir}/kernel | mtd write - ${dev}
tar Oxf $tar_file ${board_dir}/kernel | mtd write - ${dev}
if [ -n "$UPGRADE_BACKUP" ]; then
tar Oxf $tar_file ${board_dir}/root | mtd -j "$UPGRADE_BACKUP" write - rootfs
else
tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs
fi
if [ -n "$UPGRADE_BACKUP" ]; then
tar Oxf $tar_file ${board_dir}/root | mtd -j "$UPGRADE_BACKUP" write - rootfs
else
tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs
fi
}
find_mmc_part() {
local DEVNAME PARTNAME
if grep -q "$1" /proc/mtd; then
echo "" && return 0
fi
for DEVNAME in /sys/block/mmcblk*/mmcblk*p*; do
PARTNAME=$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')
[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
done
}
do_flash_emmc() {
local tar_file=$1
local emmcblock=$(find_mmc_part $2)
local board_dir=$3
local part=$4
[ -b "$emmcblock" ] || emmcblock=$(find_mmc_part $2)
[ -z "$emmcblock" ] && {
echo failed to find $2
return
}
echo erase $4 / $emmcblock
dd if=/dev/zero of=${emmcblock} 2> /dev/null
echo flash $4
tar Oxf $tar_file ${board_dir}/$part | dd of=${emmcblock}
}
spi_nor_emmc_do_upgrade_bootconfig() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
[ -f /proc/boot_info/getbinary_bootconfig ] || {
echo "bootconfig does not exist"
exit
}
CI_ROOTPART="$(cat /proc/boot_info/rootfs/upgradepartition)"
CI_KERNPART="$(cat /proc/boot_info/0:HLOS/upgradepartition)"
[ -n "$CI_KERNPART" -a -n "$CI_ROOTPART" ] || {
echo "kernel or rootfs partition is unknown"
exit
}
local primary="0"
[ "$(cat /proc/boot_info/rootfs/primaryboot)" = "0" ] && primary="1"
echo "$primary" > /proc/boot_info/rootfs/primaryboot 2>/dev/null
echo "$primary" > /proc/boot_info/0:HLOS/primaryboot 2>/dev/null
cp /proc/boot_info/getbinary_bootconfig /tmp/bootconfig
do_flash_emmc $tar_file $CI_KERNPART $board_dir kernel
do_flash_emmc $tar_file $CI_ROOTPART $board_dir root
local emmcblock="$(find_mmc_part "rootfs_data")"
if [ -e "$emmcblock" ]; then
mkfs.ext4 -F "$emmcblock"
fi
for part in "0:BOOTCONFIG" "0:BOOTCONFIG1"; do
local mtdchar=$(echo $(find_mtd_chardev $part) | sed 's/^.\{5\}//')
if [ -n "$mtdchar" ]; then
echo start to update $mtdchar
mtd -qq write /proc/boot_info/getbinary_bootconfig "/dev/${mtdchar}" 2>/dev/null && echo update mtd $mtdchar
else
emmcblock=$(find_mmc_part $part)
echo erase ${emmcblock}
dd if=/dev/zero of=${emmcblock} 2> /dev/null
echo update $emmcblock
dd if=/tmp/bootconfig of=${emmcblock} 2> /dev/null
fi
done
}
emmc_do_upgrade() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
do_flash_emmc $tar_file '0:HLOS' $board_dir kernel
do_flash_emmc $tar_file 'rootfs' $board_dir root
local emmcblock="$(find_mmc_part "rootfs_data")"
if [ -e "$emmcblock" ]; then
mkfs.ext4 -F "$emmcblock"
fi
}
platform_check_image() {
local magic_long="$(get_magic_long "$1")"
board=$(board_name)
case $board in
cig,wf186w|\
cig,wf186h|\
cig,wf188|\
cig,wf660a|\
cig,wf188n|\
cig,wf194c|\
cig,wf194c4|\
cig,wf196|\
cybertan,eww622-a1|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
glinet,ax1800|\
glinet,axt1800|\
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
wallys,dr5018|\
wallys,dr6018|\
wallys,dr6018-v4|\
edgecore,eap101|\
edgecore,eap102|\
edgecore,eap104|\
liteon,wpx8324|\
edgecore,eap106|\
hfcl,ion4xi|\
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
hfcl,ion4xi_wp|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xe|\
muxi,ap3220l|\
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2|\
tplink,ex227|\
tplink,ex447|\
yuncore,ax840|\
yuncore,fap650|\
yuncore,fap655|\
motorola,q14|\
muxi,ap3220l|\
qcom,ipq6018-cp01|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
xunison,d50|\
xunison,d50-5g|\
qcom,ipq5018-mp03.3)
[ "$magic_long" = "73797375" ] && return 0
;;
@@ -55,29 +180,108 @@ platform_do_upgrade() {
cig,wf188)
qca_do_upgrade $1
;;
cig,wf660a)
spi_nor_emmc_do_upgrade_bootconfig $1
;;
motorola,q14)
emmc_do_upgrade $1
;;
cig,wf188n|\
cig,wf194c|\
cig,wf194c4|\
cig,wf196|\
cybertan,eww622-a1|\
hfcl,ion4xi|\
hfcl,ion4xe|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
glinet,ax1800|\
glinet,axt1800|\
indio,um-310ax-v1|\
indio,um-510axp-v1|\
indio,um-510axm-v1|\
qcom,ipq6018-cp01|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
xunison,d50|\
xunison,d50-5g|\
qcom,ipq5018-mp03.3|\
wallys,dr5018|\
wallys,dr6018|\
wallys,dr6018-v4|\
yuncore,fap650|\
tplink,ex447|\
tplink,ex227)
tplink,ex227|\
meshpp,s618-cp03|\
meshpp,s618-cp01)
nand_upgrade_tar "$1"
;;
edgecore,eap106|\
edgecore,eap102|\
edgecore,eap101)
hfcl,ion4xi|\
hfcl,ion4x|\
hfcl,ion4x_2|\
hfcl,ion4xe)
if grep -q rootfs_1 /proc/cmdline; then
CI_UBIPART="rootfs"
fw_setenv primary 0 || exit 1
else
CI_UBIPART="rootfs_1"
fw_setenv primary 1 || exit 1
fi
nand_upgrade_tar "$1"
;;
hfcl,ion4xi_w|\
hfcl,ion4x_w|\
hfcl,ion4xi_HMR|\
hfcl,ion4xi_wp)
wp_part=$(fw_printenv primary | cut -d = -f2)
echo "Current Primary is $wp_part"
if [[ $wp_part == 1 ]]; then
CI_UBIPART="rootfs"
CI_FWSETENV="primary 0"
else
CI_UBIPART="rootfs_1"
CI_FWSETENV="primary 1"
fi
nand_upgrade_tar "$1"
;;
edgecore,eap104|\
liteon,wpx8324|\
edgecore,eap106)
CI_UBIPART="rootfs1"
[ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs"
nand_upgrade_tar "$1"
;;
edgecore,eap101|\
edgecore,eap102)
if [ "$(find_mtd_chardev rootfs)" ]; then
CI_UBIPART="rootfs"
else
if [ -e /tmp/downgrade ]; then
CI_UBIPART="rootfs1"
fw_setenv active 1 || exit 1
fw_setenv upgrade_available 0 || exit 1
elif grep -q rootfs1 /proc/cmdline; then
CI_UBIPART="rootfs2"
CI_FWSETENV="active 2"
else
CI_UBIPART="rootfs1"
CI_FWSETENV="active 1"
fi
fi
nand_upgrade_tar "$1"
;;
plasmacloud,pax1800-v1|\
plasmacloud,pax1800-v2)
PART_NAME="inactive"
platform_do_upgrade_dualboot_datachk "$1"
;;
cig,wf186w|\
cig,wf186h|\
yuncore,ax840|\
yuncore,fap655)
[ -f /proc/boot_info/rootfs/upgradepartition ] && {
CI_UBIPART="$(cat /proc/boot_info/rootfs/upgradepartition)"
CI_BOOTCFG=1
}
nand_upgrade_tar "$1"
;;
esac
}

View File

@@ -75,6 +75,7 @@ CONFIG_BLK_DEV_NVME=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
# CONFIG_BOOTCONFIG_PARTITION is not set
# CONFIG_VIRTIO_BLK is not set
# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
@@ -547,8 +548,8 @@ CONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PROC_STRIPPED is not set
CONFIG_PSTORE=y
CONFIG_PSTORE_RAM=y
# CONFIG_PSTORE_CONSOLE is not set
# CONFIG_PSTORE_PMSG is not set
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PWM=y
CONFIG_PWM_IPQ4019=y
# CONFIG_PWM_PCA9685 is not set
@@ -823,7 +824,6 @@ CONFIG_SKB_FIXED_SIZE_2K=y
CONFIG_AQ_PHY=y
CONFIG_DIAG_CHAR=y
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_BOOTCONFIG_PARTITION is not set
# CONFIG_CRYPTO_DEV_QCEDEV is not set
# CONFIG_CRYPTO_DEV_QCRYPTO is not set
# CONFIG_MHI_BUS_TEST is not set

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-cig-wf186h.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-cig-wf186w.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-eap104.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,10 @@
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-eww631-a1.dts"
/ {
model = "CyberTan EWW631-A1";
compatible = "cybertan,eww631-a1", "qcom,ipq5018";
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,10 @@
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-eww631-b1.dts"
/ {
model = "CyberTan EWW631-B1";
compatible = "cybertan,eww631-b1", "qcom,ipq5018";
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-hfcl-ion4x_w.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-hfcl-ion4xi_HMR.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-hfcl-ion4xi_w.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-liteon-wpx8324.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-muxi-ap3220l.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-q14.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,10 @@
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-wallys-dr5018.dts"
/ {
model = "Wallys DR5018";
compatible = "wallys,dr5018", "qcom,ipq5018";
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-xunison-d50-5g.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-xunison-d50.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq5018-yuncore-fap655.dts"
/ {
pmuv8: pmu {
compatible = "arm,cortex-a7-pmu";
};
};

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-cig-wf660a.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-gl-ax1800.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-gl-axt1800.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4x.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4x_2.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi_wp.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-indio-um-310ax-v1.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-indio-um-510axm-v1.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-indio-um-510axp-v1.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,2 @@
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-meshpp-s618-cp01.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,2 @@
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-meshpp-s618-cp03.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-pax1800-v1.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-pax1800-v2.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-yuncore-ax840.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-yuncore-fap650.dts"
#include "qcom-ipq6018.dtsi"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,965 @@
/dts-v1/;
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "qcom-ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "CIG wf186h";
compatible = "cig,wf186h","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";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
#ifdef __IPQ_MEM_PROFILE_256_MB__
bootargs-append = " swiotlb=1";
#else
bootargs-append = " swiotlb=1 coherent_pool=2M";
#endif
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 8MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x40800000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* + | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 13MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CD00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4CF00000 | 15MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4DE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4DF00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E000000 | 17MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x4F100000 | 16MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3000000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4c000000 {
no-map;
reg = <0x0 0x4c000000 0x0 0xD00000>;
};
m3_dump: m3_dump@4CD00000 {
no-map;
reg = <0x0 0x4CD00000 0x0 0x100000>;
};
q6_etr_region:q6_etr_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0xF00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4DE00000 {
no-map;
reg = <0x0 0x4DE00000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4DF00000 {
no-map;
reg = <0x0 0x4DF00000 0x0 0x100000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x01100000>;
};
mhi_region1: dma_pool1@4F100000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x4F100000 0x0 0x01000000>;
};
#elif __IPQ_MEM_PROFILE_512_MB__
/* 512 MB Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 16MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x41000000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 14MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CF00000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4D000000 | 2MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4D200000 | 16MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4E200000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4E300000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4E400000 | 5MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E900000 | 30MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x50700000 | 16MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3900000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C000000 {
no-map;
reg = <0x0 0x4C000000 0x0 0xE00000>;
};
m3_dump: m3_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D000000 {
no-map;
reg = <0x0 0x4D000000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0x01E00000>;
};
mhi_region1: dma_pool1@50700000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x50700000 0x0 0x01000000>;
};
#else
/* 1G Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 16MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x41000000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 14MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CF00000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4D000000 | 2MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4D200000 | 16MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4E200000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4E300000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4E400000 | 5MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E900000 | 45MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x51600000 | 24MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3900000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C000000 {
no-map;
reg = <0x0 0x4C000000 0x0 0xE00000>;
};
m3_dump: m3_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D000000 {
no-map;
reg = <0x0 0x4D000000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0x02D00000>;
};
mhi_region1: dma_pool1@51600000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x51600000 0x0 0x01800000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
status = "ok";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_pins>;
pinctrl-names = "default";
cs-select = <0>;
status = "ok";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "n25q128a11";
linux,modalias = "m25p80", "n25q128a11";
spi-max-frequency = <50000000>;
use-default-sizes;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 35 0>;
cig_clk_div = <0xff>;
ethernet-phy@0 {
reg = <0x1d>;
};
};
realtek@29{
compatible = "realtek,rtl8367s";
mii-bus = <&mdio1>;
realtek,extif0 = <0 0 10 1 1 1 1 1 2>;
switch = <&tlmm 35 0>;
phy-addr = <29>;
status = "ok";
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
wifi0: wifi@c000000 {
status = "ok";
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
dp2 {
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";
};
qcom,test@0 {
status = "ok";
};
lpass: lpass@0xA000000{
status = "disabled";
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
status = "disabled";
};
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "rst";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
pcm_lb: pcm_lb@0 {
status = "disabled";
};
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&phy_led_pins>;
pinctrl-names = "default";
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio31", "gpio33";
function = "blsp1_uart1";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data_0 {
pins = "gpio7";
function = "qspi0";
drive-strength = <8>;
bias-disable;
};
qspi_data_1 {
pins = "gpio6";
function = "qspi1";
drive-strength = <8>;
bias-disable;
};
qspi_data_2 {
pins = "gpio5";
function = "qspi2";
drive-strength = <8>;
bias-disable;
};
qspi_data_3 {
pins = "gpio4";
function = "qspi3";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
wps_button {
pins = "gpio38";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
rst_button {
pins = "gpio27";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
};
pwm_pins: pwm_pinmux {
mux_1 {
pins = "gpio0";
function = "pwm10";
drive-strength = <8>;
};
mux_2 {
pins = "gpio1";
function = "pwm20";
drive-strength = <8>;
};
mux_3 {
pins = "gpio45";
function = "pwm3";
drive-strength = <8>;
};
};
};
&soc {
pwm: pwm@0x1941010 {
pinctrl-0 = <&pwm_pins>;
pinctrl-names = "default";
used-pwm-indices = <1>, <1>, <1>, <1>;
dft-pwm-status = <1>, <0>, <0>, <0>;
status = "ok";
};
};
&usb3 {
status = "disabled";
device-power-gpio = <&tlmm 24 1>;
};
&eud {
status = "ok";
};
&pcie_x1 {
status = "ok";
perst-gpio = <&tlmm 18 1>;
};
&pcie_x2 {
status = "disabled";
perst-gpio = <&tlmm 15 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&pcie_x1phy {
status = "disabled";
};
&pcie_x2phy {
status = "disabled";
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
qrtr_instance_id = <0x21>;
#address-cells = <0x2>;
#size-cells = <0x2>;
memory-region = <&mhi_region1>;
#if !defined(__CNSS2__)
base-addr = <0x4E900000>;
m3-dump-addr = <0x4FD00000>;
etr-addr = <0x4FE00000>;
qcom,caldb-addr = <0x4FF00000>;
qcom,tgt-mem-mode = <0x1>;
mhi,max-channels = <30>;
mhi,timeout = <10000>;
qcom,board_id = <0xa4>;
#endif
};
};
&wifi3 {
status = "ok";
};
&qfprom {
status = "ok";
};
&tsens {
status = "ok";
};
&qcom_q6v5_wcss {
qcom,multipd_arch;
memory-region = <&q6_mem_regions>;
qcom,share_bootargs;
qcom,bootargs_smem = <507>;
boot-args = <0x2 0x4 0x2 0x12 0x0 0x0>;
/* IPQ5018 */
q6v5_wcss_userpd1 {
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <1>;
qca,auto-restart;
qca,int_radio;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
/* QCN6122 5G */
q6v5_wcss_userpd2 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <2>;
qca,auto-restart;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "disabled";
};
&qgic_msi_0 {
status = "ok";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x24>;
qcom,bdf-addr = <0x0 0x4C000000 0x4C000000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x0 0x4D000000 0 0 0>;
#else
qcom,caldb-addr = <0x4D000000>;
m3-dump-addr = <0x4CE00000>;
#endif
qcom,caldb-size = <0x200000>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
qcom,bdf-addr = <0x0 0x4D200000 0x4CF00000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x0 0x4E400000 0 0 0>;
#else
qcom,caldb-addr = <0x4E400000>;
m3-dump-addr = <0x4E200000>;
#endif
qcom,caldb-size = <0x500000>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
status = "ok";
};

View File

@@ -0,0 +1,965 @@
/dts-v1/;
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "qcom-ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "CIG wf186w";
compatible = "cig,wf186w","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";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
#ifdef __IPQ_MEM_PROFILE_256_MB__
bootargs-append = " swiotlb=1";
#else
bootargs-append = " swiotlb=1 coherent_pool=2M";
#endif
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 8MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x40800000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* + | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 13MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CD00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4CF00000 | 15MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4DE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4DF00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E000000 | 17MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x4F100000 | 16MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3000000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4c000000 {
no-map;
reg = <0x0 0x4c000000 0x0 0xD00000>;
};
m3_dump: m3_dump@4CD00000 {
no-map;
reg = <0x0 0x4CD00000 0x0 0x100000>;
};
q6_etr_region:q6_etr_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0xF00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4DE00000 {
no-map;
reg = <0x0 0x4DE00000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4DF00000 {
no-map;
reg = <0x0 0x4DF00000 0x0 0x100000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x01100000>;
};
mhi_region1: dma_pool1@4F100000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x4F100000 0x0 0x01000000>;
};
#elif __IPQ_MEM_PROFILE_512_MB__
/* 512 MB Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 16MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x41000000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 14MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CF00000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4D000000 | 2MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4D200000 | 16MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4E200000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4E300000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4E400000 | 5MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E900000 | 30MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x50700000 | 16MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3900000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C000000 {
no-map;
reg = <0x0 0x4C000000 0x0 0xE00000>;
};
m3_dump: m3_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D000000 {
no-map;
reg = <0x0 0x4D000000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0x01E00000>;
};
mhi_region1: dma_pool1@50700000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x50700000 0x0 0x01000000>;
};
#else
/* 1G Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 16MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x41000000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 16MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C000000 | 14MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4CE00000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4CF00000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4D000000 | 2MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4D200000 | 16MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4E200000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4E300000 | 1MB |
* +--------+--------------+-------------------------+
* | caldb | 0x4E400000 | 5MB |
* +--------+--------------+-------------------------+
* | | | |
* |QCN9000 | 0x4E900000 | 45MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | MHI1 | 0x51600000 | 24MB |
* | | | |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x3900000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01000000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C000000 {
no-map;
reg = <0x0 0x4C000000 0x0 0xE00000>;
};
m3_dump: m3_dump@4CE00000 {
no-map;
reg = <0x0 0x4CE00000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4CF00000 {
no-map;
reg = <0x0 0x4CF00000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D000000 {
no-map;
reg = <0x0 0x4D000000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn9000_region: qcn9000_pcie0@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0x02D00000>;
};
mhi_region1: dma_pool1@51600000 {
compatible = "shared-dma-pool";
no-map;
reg = <0x0 0x51600000 0x0 0x01800000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
status = "ok";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_pins>;
pinctrl-names = "default";
cs-select = <0>;
status = "ok";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "n25q128a11";
linux,modalias = "m25p80", "n25q128a11";
spi-max-frequency = <50000000>;
use-default-sizes;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 35 0>;
cig_clk_div = <0xff>;
ethernet-phy@0 {
reg = <0x1d>;
};
};
realtek@29{
compatible = "realtek,rtl8367s";
mii-bus = <&mdio1>;
realtek,extif0 = <0 0 10 1 1 1 1 1 2>;
switch = <&tlmm 35 0>;
phy-addr = <29>;
status = "ok";
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
wifi0: wifi@c000000 {
status = "ok";
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
dp2 {
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";
};
qcom,test@0 {
status = "ok";
};
lpass: lpass@0xA000000{
status = "disabled";
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
status = "disabled";
};
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "rst";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
pcm_lb: pcm_lb@0 {
status = "disabled";
};
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&phy_led_pins>;
pinctrl-names = "default";
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio31", "gpio33";
function = "blsp1_uart1";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data_0 {
pins = "gpio7";
function = "qspi0";
drive-strength = <8>;
bias-disable;
};
qspi_data_1 {
pins = "gpio6";
function = "qspi1";
drive-strength = <8>;
bias-disable;
};
qspi_data_2 {
pins = "gpio5";
function = "qspi2";
drive-strength = <8>;
bias-disable;
};
qspi_data_3 {
pins = "gpio4";
function = "qspi3";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
wps_button {
pins = "gpio38";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
rst_button {
pins = "gpio27";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
};
pwm_pins: pwm_pinmux {
mux_1 {
pins = "gpio0";
function = "pwm10";
drive-strength = <8>;
};
mux_2 {
pins = "gpio1";
function = "pwm20";
drive-strength = <8>;
};
mux_3 {
pins = "gpio45";
function = "pwm3";
drive-strength = <8>;
};
};
};
&soc {
pwm: pwm@0x1941010 {
pinctrl-0 = <&pwm_pins>;
pinctrl-names = "default";
used-pwm-indices = <1>, <1>, <1>, <1>;
dft-pwm-status = <1>, <0>, <0>, <0>;
status = "ok";
};
};
&usb3 {
status = "disabled";
device-power-gpio = <&tlmm 24 1>;
};
&eud {
status = "ok";
};
&pcie_x1 {
status = "ok";
perst-gpio = <&tlmm 18 1>;
};
&pcie_x2 {
status = "disabled";
perst-gpio = <&tlmm 15 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&pcie_x1phy {
status = "disabled";
};
&pcie_x2phy {
status = "disabled";
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
qrtr_instance_id = <0x21>;
#address-cells = <0x2>;
#size-cells = <0x2>;
memory-region = <&mhi_region1>;
#if !defined(__CNSS2__)
base-addr = <0x4E900000>;
m3-dump-addr = <0x4FD00000>;
etr-addr = <0x4FE00000>;
qcom,caldb-addr = <0x4FF00000>;
qcom,tgt-mem-mode = <0x1>;
mhi,max-channels = <30>;
mhi,timeout = <10000>;
qcom,board_id = <0xa4>;
#endif
};
};
&wifi3 {
status = "ok";
};
&qfprom {
status = "ok";
};
&tsens {
status = "ok";
};
&qcom_q6v5_wcss {
qcom,multipd_arch;
memory-region = <&q6_mem_regions>;
qcom,share_bootargs;
qcom,bootargs_smem = <507>;
boot-args = <0x2 0x4 0x2 0x12 0x0 0x0>;
/* IPQ5018 */
q6v5_wcss_userpd1 {
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <1>;
qca,auto-restart;
qca,int_radio;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
/* QCN6122 5G */
q6v5_wcss_userpd2 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <2>;
qca,auto-restart;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "disabled";
};
&qgic_msi_0 {
status = "ok";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x24>;
qcom,bdf-addr = <0x0 0x4C000000 0x4C000000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x0 0x4D000000 0 0 0>;
#else
qcom,caldb-addr = <0x4D000000>;
m3-dump-addr = <0x4CE00000>;
#endif
qcom,caldb-size = <0x200000>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
qcom,bdf-addr = <0x0 0x4D200000 0x4CF00000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x0 0x4E400000 0 0 0>;
#else
qcom,caldb-addr = <0x4E400000>;
m3-dump-addr = <0x4E200000>;
#endif
qcom,caldb-size = <0x500000>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
status = "ok";
};

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,10 @@
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
led-boot = &led_sys;
led-failsafe = &led_sys;
led-running = &led_sys;
led-upgrade = &led_sys;
};
chosen {
@@ -708,32 +712,20 @@
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@1 {
led_sys: led@1 {
label = "sys:blue";
gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; /* GPIO_1 */
/* default-state="on"; */
linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on";
};
led@35 {
label = "sys:green";
gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; /* GPIO_35 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@31 {
label = "sys:red";
gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; /* GPIO_31 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
};
};

View File

@@ -0,0 +1,908 @@
/dts-v1/;
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "qcom-ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Qualcomm Technologies, Inc. IPQ5018/AP-MP03.5-C1";
compatible = "qcom,ipq5018-mp03.5-c1", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
#ifdef __IPQ_MEM_PROFILE_256_MB__
bootargs-append = " swiotlb=1";
#else
bootargs-append = " swiotlb=1 coherent_pool=2M";
#endif
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 15MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E400000 | 15MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4F300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F400000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4500000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
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_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xF00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0xF00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 {
no-map;
reg = <0x0 0x4F300000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 {
no-map;
reg = <0x0 0x4F400000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 14MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D300000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D400000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D600000 | 16MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E800000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4ED00000 | 16MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4FD00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4FE00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4FF00000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x5400000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xE00000>;
};
m3_dump: m3_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D400000 {
no-map;
reg = <0x0 0x4D400000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D600000 {
no-map;
reg = <0x0 0x4D600000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 {
no-map;
reg = <0x0 0x4E600000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 {
no-map;
reg = <0x0 0x4E700000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 {
no-map;
reg = <0x0 0x4E800000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4ED00000 0x0 0x1000000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 {
no-map;
reg = <0x0 0x4FD00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 {
no-map;
reg = <0x0 0x4FE00000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 {
no-map;
reg = <0x0 0x4FF00000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_pins>;
pinctrl-names = "default";
cs-select = <0>;
status = "ok";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "n25q128a11";
linux,modalias = "m25p80", "n25q128a11";
spi-max-frequency = <50000000>;
use-default-sizes;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "disabled";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <28>;
};
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
mdiobus = <&mdio0>;
};
/*
port@1 {
port_id = <2>;
phy_address = <0x1c>;
mdiobus = <&mdio1>;
port_mac_sel = "QGMAC_PORT";
};
*/
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
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>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <28>;
mdio-bus = <&mdio1>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
*/
qcom,test@0 {
status = "ok";
};
lpass: lpass@0xA000000{
status = "disabled";
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
status = "disabled";
};
pcm_lb: pcm_lb@0 {
status = "disabled";
};
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins &phy_led_pins>;
pinctrl-names = "default";
blsp0_uart_pins: blsp0_uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio23", "gpio25", "gpio24", "gpio26";
function = "blsp1_uart2";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data_0 {
pins = "gpio7";
function = "qspi0";
drive-strength = <8>;
bias-disable;
};
qspi_data_1 {
pins = "gpio6";
function = "qspi1";
drive-strength = <8>;
bias-disable;
};
qspi_data_2 {
pins = "gpio5";
function = "qspi2";
drive-strength = <8>;
bias-disable;
};
qspi_data_3 {
pins = "gpio4";
function = "qspi3";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio28";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_3 {
pins = "gpio26";
function = "audio_rxd";
drive-strength = <8>;
bias-pull-down;
};
mux_4 {
pins = "gpio27";
function = "audio_txmclk";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_6 {
pins = "gpio29";
function = "audio_txfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_7 {
pins = "gpio30";
function = "audio_txd";
drive-strength = <8>;
bias-pull-down;
};
};
leds_pins: leds_pinmux {
sys_blue {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
sys_red {
pins = "gpio36";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
sys_green {
pins = "gpio37";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 28 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
gpio_leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@30 {
label = "sys:blue";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; /* GPIO_30 */
default-state="on";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@36 {
label = "sys:red";
gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>; /* GPIO_36 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@37 {
label = "sys:green";
gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; /* GPIO_37 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
};
};
&usb3 {
status = "disabled";
device-power-gpio = <&tlmm 24 1>;
};
&eud {
status = "ok";
};
&pcie_x1 {
status = "disabled";
perst-gpio = <&tlmm 18 1>;
};
&pcie_x2 {
status = "disabled";
perst-gpio = <&tlmm 15 1>;
};
&bt {
status = "ok";
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&pcie_x1phy {
status = "disabled";
};
&pcie_x2phy {
status = "disabled";
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};
&qfprom {
status = "ok";
};
&tsens {
status = "ok";
};
&qcom_q6v5_wcss {
qcom,multipd_arch;
memory-region = <&q6_mem_regions>;
qcom,share_bootargs;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
/* IPQ5018 */
q6v5_wcss_userpd1 {
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <1>;
qca,auto-restart;
qca,int_radio;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
/* QCN6122 6G */
q6v5_wcss_userpd2 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <2>;
qca,auto-restart;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
/* QCN6122 5G */
q6v5_wcss_userpd3 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <3>;
qca,auto-restart;
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "disabled";
};
&qgic_msi_0 {
status = "ok";
};
&qgic_msi_1 {
status = "ok";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x24>;
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x4D400000 0x4D400000 0 0 0>;
#else
qcom,caldb-addr = <0x4D400000>;
m3-dump-addr = <0x4D200000>;
#endif
qcom,caldb-size = <0x200000>;
status = "ok";
};
&wifi1 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>;
#else
qcom,caldb-addr = <0x4FF00000>;
m3-dump-addr = <0x4FD00000>;
#endif
qcom,caldb-size = <0x500000>;
status = "ok";
};
&wifi2 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0xb0>;
qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>;
#else
qcom,caldb-addr = <0x4FF00000>;
m3-dump-addr = <0x4FD00000>;
#endif
qcom,caldb-size = <0x500000>;
status = "disabled";
};

View File

@@ -0,0 +1,791 @@
/dts-v1/;
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "qcom-ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Qualcomm Technologies, Inc. IPQ5018/AP-MP02.1";
compatible = "qcom,ipq5018-mp02.1", "qcom,ipq5018";
interrupt-parent = <&intc>;
MP_256;
/delete-property/ MP_512;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
//serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
bootargs-append = " swiotlb=1";
stdout-path = "serial0";
};
/* 256 MB Profile
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | NSS | 0x40000000 | 8MB |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x40800000 | Depends on total memory |
* | | | |
* | | | |
* | | | |
* + | | |
* +--------+--------------+-------------------------+
* | | | |
* | uboot | 0x4A600000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +--------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +--------+--------------+-------------------------+
* | | | |
* | TZ | 0x4AC00000 | 4MB |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | Q6 | 0x4B000000 | 20MB |
* | code/ | | |
* | data | | |
* +--------+--------------+-------------------------+
* | | | |
* |IPQ5018 | 0x4C400000 | 13MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4D100000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4D200000 | 1MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4D300000 | 15MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4E200000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4E300000 | 1MB |
* +--------+--------------+-------------------------+
* |QCN6122 | 0x4E400000 | 15MB |
* | data | | |
* +--------+--------------+-------------------------+
* | M3 Dump| 0x4F300000 | 1MB |
* +--------+--------------+-------------------------+
* | QDSS | 0x4F400000 | 1MB |
* +--------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +=================================================+
*/
reserved-memory {
/delete-node/ nss@40000000;
nss@40000000 {
no-map;
reg = <0x0 0x40000000 0x0 0x0800000>;
};
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4500000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
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_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xF00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0xF00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F300000 {
no-map;
reg = <0x0 0x4F300000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F400000 {
no-map;
reg = <0x0 0x4F400000 0x0 0x100000>;
};
};
soc {
serial@78af000 {
status = "ok";
};
/*
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
*/
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_pins>;
pinctrl-names = "default";
cs-select = <0>;
status = "ok";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "n25q128a11";
linux,modalias = "m25p80", "n25q128a11";
spi-max-frequency = <50000000>;
use-default-sizes;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 38 0>;
ethernet-phy@0 {
reg = <0>;
};
ethernet-phy@1 {
reg = <1>;
};
ethernet-phy@2 {
reg = <2>;
};
ethernet-phy@3 {
reg = <3>;
};
ethernet-phy@4 {
reg = <4>;
};
};
ess-instance {
num_devices = <0x2>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
// mdiobus = <&mdio0>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "low";
};
};
ess-switch1@1 {
compatible = "qcom,ess-switch-qca83xx";
device_id = <1>;
switch_access_mode = "mdio";
mdio-bus = <&mdio1>;
reset_gpio = <0x26>;
switch_cpu_bmp = <0x40>; /* cpu port bitmap (Port 6 GMAC) */
switch_lan_bmp = <0x1e>; /* lan port bitmap */
switch_wan_bmp = <0x0>; /* wan port bitmap */
qca,ar8327-initvals = <
0x00004 0x7600000 /* PAD0_MODE */
0x00008 0x1000000 /* PAD5_MODE */
0x0000c 0x80 /* PAD6_MODE */
0x00010 0x2613a0 /* PORT6 FORCE MODE*/
0x000e4 0xaa545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */
0x00094 0x4e /* PORT6_STATUS */
>;
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>;
};
};
};
};
qcom_q6v5_wcss@CD00000 {
memory-region = <&q6_mem_regions>;
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
qcom,test@0 {
status = "ok";
};
};
thermal-zones {
status = "ok";
};
};
&sdhc_1 {
status = "disabled";
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins>;
pinctrl-names = "default";
blsp0_uart_pins: blsp0_uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
/*
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx {
pins = "gpio23";
function = "blsp1_uart2";
drive-strength = <8>;
input-enable;
bias-disable;
bias-pull-up;
};
blsp1_uart_tx {
pins = "gpio25";
function = "blsp1_uart2";
drive-strength = <8>;
bias-disable;
output-high;
bias-pull-up;
};
blsp1_uart_rfr {
pins = "gpio24";
function = "blsp1_uart2";
drive-strength = <8>;
bias-disable;
output-high;
bias-pull-up;
};
blsp1_uart_cts {
pins = "gpio26";
function = "blsp1_uart2";
drive-strength = <8>;
bias-disable;
input-enable;
bias-pull-up;
};
};
*/
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
/*
phy_pins: phy_pins {
phy_intr {
pins = "gpio25";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
phy_reset {
pins = "gpio26";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
output-low;
};
};
*/
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data_0 {
pins = "gpio7";
function = "qspi0";
drive-strength = <8>;
bias-disable;
};
qspi_data_1 {
pins = "gpio6";
function = "qspi1";
drive-strength = <8>;
bias-disable;
};
qspi_data_2 {
pins = "gpio5";
function = "qspi2";
drive-strength = <8>;
bias-disable;
};
qspi_data_3 {
pins = "gpio4";
function = "qspi3";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio28";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
poe_pins: poe_pinmux {
/*
LAN port PoE output enable
H --> enable; L --> disable (Default setting to H)
*/
mux_0 {
pins = "gpio24";
function = "gpio";
drive-strength = <2>;
bias-pull-up;
output-high;
};
mux_1 { /* PSE_INT_N */
pins = "gpio27";
function = "gpio";
bias-pull-up;
input;
};
};
leds_pins: leds_pinmux {
sys_green {
pins = "gpio1";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
sys_blue {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
sys_red {
pins = "gpio46";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 28 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
gpio_leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@1 {
label = "sys:green";
gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; /* GPIO_1/ATST_QP0 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@30 {
label = "sys:blue";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; /* GPIO_30 */
default-state="on";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@46 {
label = "sys:red";
gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>; /* GPIO_46 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
};
};
&usb3 {
status = "disabled";
};
&eud {
status = "ok";
};
&pcie_x1 {
status = "disabled";
perst-gpio = <&tlmm 27 1>;
};
&pcie_x2 {
status = "disabled";
perst-gpio = <&tlmm 15 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&pcie_x1phy {
status = "disabled";
};
&pcie_x2phy {
status = "disabled";
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};
&qfprom {
status = "ok";
};
&tsens {
status = "ok";
};
&qcom_q6v5_wcss {
qcom,multipd_arch;
qcom,share_bootargs;
qcom,bootargs_smem = <507>;
/* Please refer the IPQ50xx SoC Software doc to define pcie reset pin */
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x0F 0x0 0x0>;
/* IPQ5018 */
q6v5_wcss_userpd1 {
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <1>;
qca,auto-restart;
qca,int_radio;
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
};
/* QCN6122 6G */
q6v5_wcss_userpd2 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <2>;
qca,auto-restart;
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
};
/* QCN6122 5G */
q6v5_wcss_userpd3 {
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names ="fatal",
"ready",
"spawn_ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
qca,asid = <3>;
qca,auto-restart;
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "ok";
};
&qgic_msi_0 {
status = "ok";
};
&qgic_msi_1 {
status = "ok";
};
&wifi0 {
/* IPQ5018 24G*/
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
qcom,tgt-mem-mode = <2>;
qcom,board_id = <0x24>;
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
qcom,caldb-addr = <0x4D400000>;
qcom,caldb-size = <0x200000>;
nss-radio-priority = <0>;
m3-dump-addr = <0x4D200000>;
mem-region = <&q6_ipq5018_data>;
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
qcom,tgt-mem-mode = <2>;
qcom,board_id = <0x60>;
qcom,bdf-addr = <0x4D600000 0x4D600000 0x4D300000 0x0 0x0>;
qcom,caldb-addr = <0x4E800000>;
m3-dump-addr = <0x4E600000>;
nss-radio-priority = <1>;
mem-region = <&q6_qcn6122_data1>;
qcom,caldb-size = <0x500000>;
status = "ok";
};
&wifi2 {
status = "disabled";
};

File diff suppressed because it is too large Load Diff

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