From 001384147050b9cd9daadb4d3115cc0f13f5b319 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 5 May 2019 11:17:45 +0200 Subject: [PATCH] carl9170 toolchain: update to gcc 9.1.0 gcc will now be warning about conflicting alignments when a pointer from a packed structure is in play. the include headers will likely need further fixes, but we can wait until the linux kernel folks know how they want to deal with ieee80211.h. Signed-off-by: Christian Lamparter --- carlfw/include/wl.h | 2 +- carlfw/src/hostif.c | 8 ++++++-- carlfw/src/wlantx.c | 5 +++-- include/linux/ieee80211.h | 24 ++++++++++++------------ include/shared/wlan.h | 2 +- toolchain/Makefile | 2 +- toolchain/SHA256SUMS | 16 +--------------- 7 files changed, 25 insertions(+), 34 deletions(-) diff --git a/carlfw/include/wl.h b/carlfw/include/wl.h index 8499ca2..5566be4 100644 --- a/carlfw/include/wl.h +++ b/carlfw/include/wl.h @@ -237,7 +237,7 @@ static inline __inline void unhide_super(struct dma_desc *desc) desc->totalLen += sizeof(struct carl9170_tx_superdesc); } -static inline __inline __hot void read_tsf(uint32_t *tsf) +static inline __inline __hot void read_tsf(uint32_t tsf[static 2]) { /* * "According to the [hardware] documentation: diff --git a/carlfw/src/hostif.c b/carlfw/src/hostif.c index 73e89c7..06726db 100644 --- a/carlfw/src/hostif.c +++ b/carlfw/src/hostif.c @@ -213,10 +213,14 @@ void handle_cmd(struct carl9170_rsp *resp) fw.reboot = 1; break; - case CARL9170_CMD_READ_TSF: + case CARL9170_CMD_READ_TSF: { + uint32_t tmptsf[2]; + + read_tsf(tmptsf); resp->hdr.len = 8; - read_tsf((uint32_t *)resp->tsf.tsf); + memcpy(resp->tsf.tsf, tmptsf, sizeof(tmptsf)); break; + } case CARL9170_CMD_RX_FILTER: resp->hdr.len = 0; diff --git a/carlfw/src/wlantx.c b/carlfw/src/wlantx.c index 474c040..a8d0952 100644 --- a/carlfw/src/wlantx.c +++ b/carlfw/src/wlantx.c @@ -260,7 +260,7 @@ static void __wlan_tx(struct dma_desc *desc) if (unlikely(super->s.fill_in_tsf)) { struct ieee80211_mgmt *mgmt = (void *) &super->f.data.i3e; - uint32_t *tsf = (uint32_t *) &mgmt->u.probe_resp.timestamp; + uint32_t tmptsf[2]; /* * Truth be told: this is a hack. @@ -272,7 +272,8 @@ static void __wlan_tx(struct dma_desc *desc) * (even, if it's got an accurate atomic clock source). */ - read_tsf(tsf); + read_tsf(tmptsf); + memcpy(&mgmt->u.probe_resp.timestamp, tmptsf, sizeof(tmptsf)); } wlan_tx_ampdu(super); diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 31c59ea..46ce6cf 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -897,33 +897,33 @@ struct ieee80211_mgmt { __le16 status_code; /* possibly followed by Challenge text */ u8 variable[0]; - } __packed auth; + } __packed __aligned(4) auth; struct { __le16 reason_code; - } __packed deauth; + } __packed __aligned(4) deauth; struct { __le16 capab_info; __le16 listen_interval; /* followed by SSID and Supported rates */ u8 variable[0]; - } __packed assoc_req; + } __packed __aligned(4) assoc_req; struct { __le16 capab_info; __le16 status_code; __le16 aid; /* followed by Supported rates */ u8 variable[0]; - } __packed assoc_resp, reassoc_resp; + } __packed __aligned(4) assoc_resp, reassoc_resp; struct { __le16 capab_info; __le16 listen_interval; u8 current_ap[6]; /* followed by SSID and Supported rates */ u8 variable[0]; - } __packed reassoc_req; + } __packed __aligned(4) reassoc_req; struct { __le16 reason_code; - } __packed disassoc; + } __packed __aligned(4) disassoc; struct { __le64 timestamp; __le16 beacon_int; @@ -931,11 +931,11 @@ struct ieee80211_mgmt { /* followed by some of SSID, Supported rates, * FH Params, DS Params, CF Params, IBSS Params, TIM */ u8 variable[0]; - } __packed beacon; + } __packed __aligned(4) beacon; struct { /* only variable items: SSID, Supported rates */ u8 variable[0]; - } __packed probe_req; + } __packed __aligned(4) probe_req; struct { __le64 timestamp; __le16 beacon_int; @@ -943,7 +943,7 @@ struct ieee80211_mgmt { /* followed by some of SSID, Supported rates, * FH Params, DS Params, CF Params, IBSS Params */ u8 variable[0]; - } __packed probe_resp; + } __packed __aligned(4) probe_resp; struct { u8 category; union { @@ -1041,8 +1041,8 @@ struct ieee80211_mgmt { u8 variable[0]; } __packed ftm; } u; - } __packed action; - } u; + } __packed __aligned(4) action; + } u __aligned(2); } __packed __aligned(2); /* Supported rates membership selectors */ @@ -1245,7 +1245,7 @@ struct ieee80211_bar { __u8 ta[6]; __le16 control; __le16 start_seq_num; -} __packed __aligned(4); +} __packed __aligned(2); /* 802.11 BA(R) control masks */ #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 diff --git a/include/shared/wlan.h b/include/shared/wlan.h index 9c6b7ff..117f005 100644 --- a/include/shared/wlan.h +++ b/include/shared/wlan.h @@ -273,7 +273,7 @@ struct ar9170_tx_frame { struct ieee80211_hdr i3e; u8 payload[0]; } data; -} __packed; +} __packed __aligned(4); struct carl9170_tx_superframe { struct carl9170_tx_superdesc s; diff --git a/toolchain/Makefile b/toolchain/Makefile index cfa351c..e7a0be7 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -6,7 +6,7 @@ NEWLIB_VER=3.1.0 NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz NEWLIB_URL="ftp://sourceware.org/pub/newlib/$(NEWLIB_TAR)" -GCC_VER=8.3.0 +GCC_VER=9.1.0 GCC_TAR=gcc-$(GCC_VER).tar.xz GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)" diff --git a/toolchain/SHA256SUMS b/toolchain/SHA256SUMS index 647d674..3a53959 100644 --- a/toolchain/SHA256SUMS +++ b/toolchain/SHA256SUMS @@ -1,20 +1,6 @@ -1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a src/gcc-7.2.0.tar.xz -5b76a9b97c9464209772ed25ce55181a7bb144a66e5669aaec945aa64da3189b src/newlib-2.5.0.tar.gz -0b871e271c4c620444f8264f72143b4d224aa305306d85dd77ab8dce785b1e85 src/binutils-2.29.tar.xz 87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912 src/gmp-6.1.2.tar.xz -617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3 src/mpc-1.0.3.tar.gz -7a62ac1a04408614fccdc506e4844b10cf0ad2c2b1677097f8f35d3a1344a950 src/mpfr-3.1.6.tar.xz 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e src/mpc-1.1.0.tar.gz -fbe2cd1418b321f5c899ce4f0f0f4e73f5ecc7d02145b0e1fd096f5c3afb8a1d src/mpfr-4.0.0.tar.xz -c8566335ee74e5fcaeb8595b4ebd0400c4b043d6acb3263ecb1314f8f5501332 src/newlib-3.0.0.tar.gz -832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c src/gcc-7.3.0.tar.xz -e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577 src/binutils-2.29.1.tar.xz -67874a60826303ee2fb6affc6dc0ddd3e749e9bfcb4c8655e3953d0458a6e16e src/mpfr-4.0.1.tar.xz -6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6 src/binutils-2.30.tar.xz -1d1866f992626e61349a1ccd0b8d5253816222cdc13390dcfaa74b093aa2b153 src/gcc-8.1.0.tar.xz -5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86 src/binutils-2.31.1.tar.xz -196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080 src/gcc-8.2.0.tar.xz fb4fa1cc21e9060719208300a61420e4089d6de6ef59cf533b57fe74801d102a src/newlib-3.1.0.tar.gz 1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a src/mpfr-4.0.2.tar.xz 0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04 src/binutils-2.32.tar.xz -64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c src/gcc-8.3.0.tar.xz +79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0 src/gcc-9.1.0.tar.xz -- 2.31.1