From d177b9aaaeb06d3b64d59261b03fd93a9257732a Mon Sep 17 00:00:00 2001 From: Eugene Krasnikov Date: Fri, 5 Apr 2013 18:37:26 +0200 Subject: [PATCH 1/2] Add WMI_GET_BUILD_NUMBER New command WMI_GET_BUILD_NUMBER has following fields: major minor tag Signed-off-by: Eugene Krasnikov --- target_firmware/wlan/if_ath.c | 14 ++++++++++++++ target_firmware/wlan/include/k2/wlan_cfg.h | 5 ++++- target_firmware/wlan/include/magpie/wlan_cfg.h | 3 +++ target_firmware/wlan/include/wlan_hdr.h | 6 ++++++ target_firmware/wlan/include/wmi.h | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/target_firmware/wlan/if_ath.c b/target_firmware/wlan/if_ath.c index baf1ae6..e059e4d 100755 --- a/target_firmware/wlan/if_ath.c +++ b/target_firmware/wlan/if_ath.c @@ -1729,6 +1729,19 @@ static void ath_rc_mask_tgt(void *Context, A_UINT16 Command, wmi_cmd_rsp(sc->tgt_wmi_handle, Command, SeqNo, NULL, 0); } +static void ath_get_build_number_tgt(void *Context,A_UINT16 Command, A_UINT16 SeqNo, + A_UINT8 *data, a_int32_t datalen) +{ + struct ath_softc_tgt *sc = (struct ath_softc_tgt *)Context; + struct wmi_build_number bld_num; + + bld_num.major = ATH_BUILD_NUMBER_MAJOR; + bld_num.minor = ATH_BUILD_NUMBER_MINOR; + bld_num.tag = ATH_BUILD_NUMBER_TAG; + + wmi_cmd_rsp(sc->tgt_wmi_handle, Command, SeqNo, &bld_num, sizeof(bld_num)); +} + static WMI_DISPATCH_ENTRY Magpie_Sys_DispatchEntries[] = { {handle_echo_command, WMI_ECHO_CMDID, 0}, @@ -1762,6 +1775,7 @@ static WMI_DISPATCH_ENTRY Magpie_Sys_DispatchEntries[] = {ath_tx_stats_tgt, WMI_TX_STATS_CMDID, 0}, {ath_rx_stats_tgt, WMI_RX_STATS_CMDID, 0}, {ath_rc_mask_tgt, WMI_BITRATE_MASK_CMDID, 0}, + {ath_get_build_number_tgt, WMI_GET_BUILD_NUMBER, 0} }; /*****************/ diff --git a/target_firmware/wlan/include/k2/wlan_cfg.h b/target_firmware/wlan/include/k2/wlan_cfg.h index ce42d2c..5ad7d0a 100755 --- a/target_firmware/wlan/include/k2/wlan_cfg.h +++ b/target_firmware/wlan/include/k2/wlan_cfg.h @@ -82,7 +82,10 @@ #define ATH_VERSION_MAJOR 1 #define ATH_VERSION_MINOR 4 - + +#define ATH_BUILD_NUMBER_MAJOR 1 +#define ATH_BUILD_NUMBER_MINOR 1 +#define ATH_BUILD_NUMBER_TAG 1 /************************** HAL configurations **************************/ #define HAL_DESC_OPTIMIZATION diff --git a/target_firmware/wlan/include/magpie/wlan_cfg.h b/target_firmware/wlan/include/magpie/wlan_cfg.h index 2590e9f..c66bf06 100755 --- a/target_firmware/wlan/include/magpie/wlan_cfg.h +++ b/target_firmware/wlan/include/magpie/wlan_cfg.h @@ -68,6 +68,9 @@ #define ATH_VERSION_MAJOR 1 #define ATH_VERSION_MINOR 4 +#define ATH_BUILD_NUMBER_MAJOR 1 +#define ATH_BUILD_NUMBER_MINOR 1 +#define ATH_BUILD_NUMBER_TAG 1 /************************** HAL configurations **************************/ #define HAL_DESC_OPTIMIZATION diff --git a/target_firmware/wlan/include/wlan_hdr.h b/target_firmware/wlan/include/wlan_hdr.h index cfcfa0a..838f2bf 100755 --- a/target_firmware/wlan/include/wlan_hdr.h +++ b/target_firmware/wlan/include/wlan_hdr.h @@ -221,6 +221,12 @@ struct ath_aggr_info { a_uint8_t padding; }; +struct wmi_build_number { + a_uint16_t major; + a_uint16_t minor; + a_uint16_t tag; +}; + struct wmi_data_delba { a_uint8_t ni_nodeindex; a_uint8_t tidno; diff --git a/target_firmware/wlan/include/wmi.h b/target_firmware/wlan/include/wmi.h index 47bf4a7..9c577a6 100755 --- a/target_firmware/wlan/include/wmi.h +++ b/target_firmware/wlan/include/wmi.h @@ -162,6 +162,7 @@ typedef enum { WMI_TX_STATS_CMDID, WMI_RX_STATS_CMDID, WMI_BITRATE_MASK_CMDID, + WMI_GET_BUILD_NUMBER } WMI_COMMAND_ID; /* From 075667f6ad2e5914e0b73481c1f6a6b33decb5ad Mon Sep 17 00:00:00 2001 From: Eugene Krasnikov Date: Mon, 22 Apr 2013 20:56:52 +0200 Subject: [PATCH 2/2] Add build information to the beginning of the binary With this commit both htc_9271.fw and htc_7010.fw will have build information in the beginning of the file. Driver can read this information even before loading fw to the chip. Build information format: u32 major; u32 minor; u32 tag; char commit_id[40]; char user_name[32]; Signed-off-by: Eugene Krasnikov --- .../build/utility/athfw2lnx/Makefile | 2 +- .../build/utility/athfw2lnx/athfw2lnx.c | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/Makefile b/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/Makefile index f13c296..e5957f9 100644 --- a/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/Makefile +++ b/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/Makefile @@ -5,7 +5,7 @@ $(error "ERROR: usage: make ATH_FW=fw.c") endif athfw2lnx: athfw2lnx.c $(ATH_FW) - gcc -o $@ athfw2lnx.c $(ATH_FW) + gcc -o $@ athfw2lnx.c $(ATH_FW) -DHOSTNAME=\"$(shell hostname)\" -DCOMMIT_HASH=\"$(shell git rev-parse --short HEAD)\" clean: rm -f athfw2lnx diff --git a/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/athfw2lnx.c b/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/athfw2lnx.c index aa74e8f..1513f14 100644 --- a/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/athfw2lnx.c +++ b/target_firmware/magpie_fw_dev/build/utility/athfw2lnx/athfw2lnx.c @@ -35,14 +35,35 @@ #include #include #include +#include /* These names may vary but this is typical */ extern const uint32_t zcFwImage[]; extern const uint32_t zcFwImageSize; +#define WLAN_BUILD_VER_MAJOR 1 +#define WLAN_BUILD_VER_MINOR 1 +#define WLAN_BUILD_VER_TAG 1 + +struct build_info { + uint32_t major; + uint32_t minor; + uint32_t tag; + char commit_id[40]; + char user_name[32]; +}; int main() { uint32_t i; + struct build_info binfo; + + binfo.major = WLAN_BUILD_VER_MAJOR; + binfo.minor = WLAN_BUILD_VER_MINOR; + binfo.tag = WLAN_BUILD_VER_TAG; + memcpy(binfo.user_name, HOSTNAME, strlen(HOSTNAME)); + memcpy(binfo.commit_id, COMMIT_HASH, strlen(COMMIT_HASH)); + write(1, &binfo, sizeof(binfo)); + for (i = 0; i < zcFwImageSize/4; i++) write(1, &zcFwImage[i], 4); }