• Wen Gong's avatar
    ath10k: sdio: add firmware coredump support · 3c45f21a
    Wen Gong authored
    When firmware crashes it's possible to create a coredump for later analysis,
    add support to collect the register and memory info from SDIO devices.
    
    The coredump configuration is different between QCA6174 PCI and QCA6174 SDIO,
    so add specific registers and memory regions for the latter.
    
    QCA6174 SDIO has two methods to dump the firmware: fastdump and slowdump.
    Fastdump is not supported in olded versions of firmware, and for these ath10k
    will automatically select slowdump. If firmware supports fastdump, ath10k will
    automatically select it. QCA6174 SDIO firmware version
    WLAN.RMH.4.4.1-00017-QCARMSWPZ-2 is the first version supporting fastdump.
    
    For slowdump, ath10k_sdio_hif_diag_read() can not be used as the diag
    window has a limit value, it is 4 bytes and the dump's buffer length is larger
    than it, it will trigger error. So this patch adds ath10k_sdio_read_mem() to
    read 4 bytes for each time.
    
    Example output of a firmware crash:
    
    ath10k_sdio mmc1:0001:1: simulating soft firmware crash
    ath10k_sdio mmc1:0001:1: firmware crashed! (guid 413d98b1-84c0-4298-b605-2b10ec0c54a5)
    ath10k_sdio mmc1:0001:1: qca6174 hw3.2 sdio target 0x05030000 chip_id 0x00000000 sub 0000:0000
    ath10k_sdio mmc1:0001:1: kconfig debug 1 debugfs 1 tracing 1 dfs 0 testmode 1
    ath10k_sdio mmc1:0001:1: firmware ver WLAN.RMH4.4.1-00126-QCARMSWP-1 api 6 features wowlan,ignore-otp,raw-mode crc32 b84317cf
    ath10k_sdio mmc1:0001:1: board_file api 2 bmi_id 0:4 crc32 6364cfcc
    ath10k_sdio mmc1:0001:1: htt-ver 3.69 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1
    ath10k_sdio mmc1:0001:1: firmware register dump:
    ath10k_sdio mmc1:0001:1: [00]: 0x05030000 0x000015B3 0x0099908D 0x00955B31
    ath10k_sdio mmc1:0001:1: [04]: 0x0099908D 0x00060730 0x00000018 0x004641A0
    ath10k_sdio mmc1:0001:1: [08]: 0x0041FAA4 0x0041FA9C 0x00999070 0x00404490
    ath10k_sdio mmc1:0001:1: [12]: 0x00000009 0xFFFFFFFF 0x00952CD0 0x00952CE6
    ath10k_sdio mmc1:0001:1: [16]: 0x00952CC4 0x00910712 0x00000000 0x00000000
    ath10k_sdio mmc1:0001:1: [20]: 0x4099908D 0x0040E9E8 0x00000001 0x00423AC0
    ath10k_sdio mmc1:0001:1: [24]: 0x809F3189 0x0040EA48 0x00426240 0xC099908D
    ath10k_sdio mmc1:0001:1: [28]: 0x809143A7 0x0040EA68 0x0041FAA4 0x00423A80
    ath10k_sdio mmc1:0001:1: [32]: 0x809F1193 0x0040EA88 0x00411770 0x004117E0
    ath10k_sdio mmc1:0001:1: [36]: 0x809F0EEE 0x0040EAA8 0x00000000 0x00000000
    ath10k_sdio mmc1:0001:1: [40]: 0x80911210 0x0040EAC8 0x00000008 0x00404130
    ath10k_sdio mmc1:0001:1: [44]: 0x80911154 0x0040EB28 0x00400000 0x00000000
    ath10k_sdio mmc1:0001:1: [48]: 0x8091122D 0x0040EB48 0x00000000 0x00400600
    ath10k_sdio mmc1:0001:1: [52]: 0x40910024 0x0040EB78 0x0040AB98 0x0040AB98
    ath10k_sdio mmc1:0001:1: [56]: 0x00000000 0x0040EB98 0x009BB001 0x00040020
    
    Tested-on: QCA6174 SDIO WLAN.RMH.4.4.1-00018-QCARMSWP-1
    Signed-off-by: default avatarWen Gong <wgong@codeaurora.org>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/1569310030-834-3-git-send-email-wgong@codeaurora.org
    3c45f21a
coredump.c 34.5 KB