// SPDX-License-Identifier: ISC
/*
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#include "coredump.h"
#include <linux/devcoredump.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/utsname.h>
#include "debug.h"
#include "hw.h"
static const struct ath10k_mem_section qca6174_hw21_register_sections[] = {
{0 x800, 0 x810},
{0 x820, 0 x82C},
{0 x830, 0 x8F4},
{0 x90C, 0 x91C},
{0 xA14, 0 xA18},
{0 xA84, 0 xA94},
{0 xAA8, 0 xAD4},
{0 xADC, 0 xB40},
{0 x1000, 0 x10A4},
{0 x10BC, 0 x111C},
{0 x1134, 0 x1138},
{0 x1144, 0 x114C},
{0 x1150, 0 x115C},
{0 x1160, 0 x1178},
{0 x1240, 0 x1260},
{0 x2000, 0 x207C},
{0 x3000, 0 x3014},
{0 x4000, 0 x4014},
{0 x5000, 0 x5124},
{0 x6000, 0 x6040},
{0 x6080, 0 x60CC},
{0 x6100, 0 x611C},
{0 x6140, 0 x61D8},
{0 x6200, 0 x6238},
{0 x6240, 0 x628C},
{0 x62C0, 0 x62EC},
{0 x6380, 0 x63E8},
{0 x6400, 0 x6440},
{0 x6480, 0 x64CC},
{0 x6500, 0 x651C},
{0 x6540, 0 x6580},
{0 x6600, 0 x6638},
{0 x6640, 0 x668C},
{0 x66C0, 0 x66EC},
{0 x6780, 0 x67E8},
{0 x7080, 0 x708C},
{0 x70C0, 0 x70C8},
{0 x7400, 0 x741C},
{0 x7440, 0 x7454},
{0 x7800, 0 x7818},
{0 x8000, 0 x8004},
{0 x8010, 0 x8064},
{0 x8080, 0 x8084},
{0 x80A0, 0 x80A4},
{0 x80C0, 0 x80C4},
{0 x80E0, 0 x80F4},
{0 x8100, 0 x8104},
{0 x8110, 0 x812C},
{0 x9000, 0 x9004},
{0 x9800, 0 x982C},
{0 x9830, 0 x9838},
{0 x9840, 0 x986C},
{0 x9870, 0 x9898},
{0 x9A00, 0 x9C00},
{0 xD580, 0 xD59C},
{0 xF000, 0 xF0E0},
{0 xF140, 0 xF190},
{0 xF250, 0 xF25C},
{0 xF260, 0 xF268},
{0 xF26C, 0 xF2A8},
{0 x10008, 0 x1000C},
{0 x10014, 0 x10018},
{0 x1001C, 0 x10020},
{0 x10024, 0 x10028},
{0 x10030, 0 x10034},
{0 x10040, 0 x10054},
{0 x10058, 0 x1007C},
{0 x10080, 0 x100C4},
{0 x100C8, 0 x10114},
{0 x1012C, 0 x10130},
{0 x10138, 0 x10144},
{0 x10200, 0 x10220},
{0 x10230, 0 x10250},
{0 x10260, 0 x10280},
{0 x10290, 0 x102B0},
{0 x102C0, 0 x102DC},
{0 x102E0, 0 x102F4},
{0 x102FC, 0 x1037C},
{0 x10380, 0 x10390},
{0 x10800, 0 x10828},
{0 x10840, 0 x10844},
{0 x10880, 0 x10884},
{0 x108C0, 0 x108E8},
{0 x10900, 0 x10928},
{0 x10940, 0 x10944},
{0 x10980, 0 x10984},
{0 x109C0, 0 x109E8},
{0 x10A00, 0 x10A28},
{0 x10A40, 0 x10A50},
{0 x11000, 0 x11028},
{0 x11030, 0 x11034},
{0 x11038, 0 x11068},
{0 x11070, 0 x11074},
{0 x11078, 0 x110A8},
{0 x110B0, 0 x110B4},
{0 x110B8, 0 x110E8},
{0 x110F0, 0 x110F4},
{0 x110F8, 0 x11128},
{0 x11138, 0 x11144},
{0 x11178, 0 x11180},
{0 x111B8, 0 x111C0},
{0 x111F8, 0 x11200},
{0 x11238, 0 x1123C},
{0 x11270, 0 x11274},
{0 x11278, 0 x1127C},
{0 x112B0, 0 x112B4},
{0 x112B8, 0 x112BC},
{0 x112F0, 0 x112F4},
{0 x112F8, 0 x112FC},
{0 x11338, 0 x1133C},
{0 x11378, 0 x1137C},
{0 x113B8, 0 x113BC},
{0 x113F8, 0 x113FC},
{0 x11438, 0 x11440},
{0 x11478, 0 x11480},
{0 x114B8, 0 x114BC},
{0 x114F8, 0 x114FC},
{0 x11538, 0 x1153C},
{0 x11578, 0 x1157C},
{0 x115B8, 0 x115BC},
{0 x115F8, 0 x115FC},
{0 x11638, 0 x1163C},
{0 x11678, 0 x1167C},
{0 x116B8, 0 x116BC},
{0 x116F8, 0 x116FC},
{0 x11738, 0 x1173C},
{0 x11778, 0 x1177C},
{0 x117B8, 0 x117BC},
{0 x117F8, 0 x117FC},
{0 x17000, 0 x1701C},
{0 x17020, 0 x170AC},
{0 x18000, 0 x18050},
{0 x18054, 0 x18074},
{0 x18080, 0 x180D4},
{0 x180DC, 0 x18104},
{0 x18108, 0 x1813C},
{0 x18144, 0 x18148},
{0 x18168, 0 x18174},
{0 x18178, 0 x18180},
{0 x181C8, 0 x181E0},
{0 x181E4, 0 x181E8},
{0 x181EC, 0 x1820C},
{0 x1825C, 0 x18280},
{0 x18284, 0 x18290},
{0 x18294, 0 x182A0},
{0 x18300, 0 x18304},
{0 x18314, 0 x18320},
{0 x18328, 0 x18350},
{0 x1835C, 0 x1836C},
{0 x18370, 0 x18390},
{0 x18398, 0 x183AC},
{0 x183BC, 0 x183D8},
{0 x183DC, 0 x183F4},
{0 x18400, 0 x186F4},
{0 x186F8, 0 x1871C},
{0 x18720, 0 x18790},
{0 x19800, 0 x19830},
{0 x19834, 0 x19840},
{0 x19880, 0 x1989C},
{0 x198A4, 0 x198B0},
{0 x198BC, 0 x19900},
{0 x19C00, 0 x19C88},
{0 x19D00, 0 x19D20},
{0 x19E00, 0 x19E7C},
{0 x19E80, 0 x19E94},
{0 x19E98, 0 x19EAC},
{0 x19EB0, 0 x19EBC},
{0 x19F70, 0 x19F74},
{0 x19F80, 0 x19F8C},
{0 x19FA0, 0 x19FB4},
{0 x19FC0, 0 x19FD8},
{0 x1A000, 0 x1A200},
{0 x1A204, 0 x1A210},
{0 x1A228, 0 x1A22C},
{0 x1A230, 0 x1A248},
{0 x1A250, 0 x1A270},
{0 x1A280, 0 x1A290},
{0 x1A2A0, 0 x1A2A4},
{0 x1A2C0, 0 x1A2EC},
{0 x1A300, 0 x1A3BC},
{0 x1A3F0, 0 x1A3F4},
{0 x1A3F8, 0 x1A434},
{0 x1A438, 0 x1A444},
{0 x1A448, 0 x1A468},
{0 x1A580, 0 x1A58C},
{0 x1A644, 0 x1A654},
{0 x1A670, 0 x1A698},
{0 x1A6AC, 0 x1A6B0},
{0 x1A6D0, 0 x1A6D4},
{0 x1A6EC, 0 x1A70C},
{0 x1A710, 0 x1A738},
{0 x1A7C0, 0 x1A7D0},
{0 x1A7D4, 0 x1A7D8},
{0 x1A7DC, 0 x1A7E4},
{0 x1A7F0, 0 x1A7F8},
{0 x1A888, 0 x1A89C},
{0 x1A8A8, 0 x1A8AC},
{0 x1A8C0, 0 x1A8DC},
{0 x1A8F0, 0 x1A8FC},
{0 x1AE04, 0 x1AE08},
{0 x1AE18, 0 x1AE24},
{0 x1AF80, 0 x1AF8C},
{0 x1AFA0, 0 x1AFB4},
{0 x1B000, 0 x1B200},
{0 x1B284, 0 x1B288},
{0 x1B2D0, 0 x1B2D8},
{0 x1B2DC, 0 x1B2EC},
{0 x1B300, 0 x1B340},
{0 x1B374, 0 x1B378},
{0 x1B380, 0 x1B384},
{0 x1B388, 0 x1B38C},
{0 x1B404, 0 x1B408},
{0 x1B420, 0 x1B428},
{0 x1B440, 0 x1B444},
{0 x1B448, 0 x1B44C},
{0 x1B450, 0 x1B458},
{0 x1B45C, 0 x1B468},
{0 x1B584, 0 x1B58C},
{0 x1B68C, 0 x1B690},
{0 x1B6AC, 0 x1B6B0},
{0 x1B7F0, 0 x1B7F8},
{0 x1C800, 0 x1CC00},
{0 x1CE00, 0 x1CE04},
{0 x1CF80, 0 x1CF84},
{0 x1D200, 0 x1D800},
{0 x1E000, 0 x20014},
{0 x20100, 0 x20124},
{0 x21400, 0 x217A8},
{0 x21800, 0 x21BA8},
{0 x21C00, 0 x21FA8},
{0 x22000, 0 x223A8},
{0 x22400, 0 x227A8},
{0 x22800, 0 x22BA8},
{0 x22C00, 0 x22FA8},
{0 x23000, 0 x233A8},
{0 x24000, 0 x24034},
{0 x26000, 0 x26064},
{0 x27000, 0 x27024},
{0 x34000, 0 x3400C},
{0 x34400, 0 x3445C},
{0 x34800, 0 x3485C},
{0 x34C00, 0 x34C5C},
{0 x35000, 0 x3505C},
{0 x35400, 0 x3545C},
{0 x35800, 0 x3585C},
{0 x35C00, 0 x35C5C},
{0 x36000, 0 x3605C},
{0 x38000, 0 x38064},
{0 x38070, 0 x380E0},
{0 x3A000, 0 x3A064},
{0 x40000, 0 x400A4},
{0 x80000, 0 x8000C},
{0 x80010, 0 x80020},
};
static const struct ath10k_mem_section qca6174_hw30_sdio_register_sections[] = {
{0 x800, 0 x810},
{0 x820, 0 x82C},
{0 x830, 0 x8F4},
{0 x90C, 0 x91C},
{0 xA14, 0 xA18},
{0 xA84, 0 xA94},
{0 xAA8, 0 xAD4},
{0 xADC, 0 xB40},
{0 x1000, 0 x10A4},
{0 x10BC, 0 x111C},
{0 x1134, 0 x1138},
{0 x1144, 0 x114C},
{0 x1150, 0 x115C},
{0 x1160, 0 x1178},
{0 x1240, 0 x1260},
{0 x2000, 0 x207C},
{0 x3000, 0 x3014},
{0 x4000, 0 x4014},
{0 x5000, 0 x5124},
{0 x6000, 0 x6040},
{0 x6080, 0 x60CC},
{0 x6100, 0 x611C},
{0 x6140, 0 x61D8},
{0 x6200, 0 x6238},
{0 x6240, 0 x628C},
{0 x62C0, 0 x62EC},
{0 x6380, 0 x63E8},
{0 x6400, 0 x6440},
{0 x6480, 0 x64CC},
{0 x6500, 0 x651C},
{0 x6540, 0 x6580},
{0 x6600, 0 x6638},
{0 x6640, 0 x668C},
{0 x66C0, 0 x66EC},
{0 x6780, 0 x67E8},
{0 x7080, 0 x708C},
{0 x70C0, 0 x70C8},
{0 x7400, 0 x741C},
{0 x7440, 0 x7454},
{0 x7800, 0 x7818},
{0 x8010, 0 x8060},
{0 x8080, 0 x8084},
{0 x80A0, 0 x80A4},
{0 x80C0, 0 x80C4},
{0 x80E0, 0 x80ec},
{0 x8110, 0 x8128},
{0 x9000, 0 x9004},
{0 xF000, 0 xF0E0},
{0 xF140, 0 xF190},
{0 xF250, 0 xF25C},
{0 xF260, 0 xF268},
{0 xF26C, 0 xF2A8},
{0 x10008, 0 x1000C},
{0 x10014, 0 x10018},
{0 x1001C, 0 x10020},
{0 x10024, 0 x10028},
{0 x10030, 0 x10034},
{0 x10040, 0 x10054},
{0 x10058, 0 x1007C},
{0 x10080, 0 x100C4},
{0 x100C8, 0 x10114},
{0 x1012C, 0 x10130},
{0 x10138, 0 x10144},
{0 x10200, 0 x10220},
{0 x10230, 0 x10250},
{0 x10260, 0 x10280},
{0 x10290, 0 x102B0},
{0 x102C0, 0 x102DC},
{0 x102E0, 0 x102F4},
{0 x102FC, 0 x1037C},
{0 x10380, 0 x10390},
{0 x10800, 0 x10828},
{0 x10840, 0 x10844},
{0 x10880, 0 x10884},
{0 x108C0, 0 x108E8},
{0 x10900, 0 x10928},
{0 x10940, 0 x10944},
{0 x10980, 0 x10984},
{0 x109C0, 0 x109E8},
{0 x10A00, 0 x10A28},
{0 x10A40, 0 x10A50},
{0 x11000, 0 x11028},
{0 x11030, 0 x11034},
{0 x11038, 0 x11068},
{0 x11070, 0 x11074},
{0 x11078, 0 x110A8},
{0 x110B0, 0 x110B4},
{0 x110B8, 0 x110E8},
{0 x110F0, 0 x110F4},
{0 x110F8, 0 x11128},
{0 x11138, 0 x11144},
{0 x11178, 0 x11180},
{0 x111B8, 0 x111C0},
{0 x111F8, 0 x11200},
{0 x11238, 0 x1123C},
{0 x11270, 0 x11274},
{0 x11278, 0 x1127C},
{0 x112B0, 0 x112B4},
{0 x112B8, 0 x112BC},
{0 x112F0, 0 x112F4},
{0 x112F8, 0 x112FC},
{0 x11338, 0 x1133C},
{0 x11378, 0 x1137C},
{0 x113B8, 0 x113BC},
{0 x113F8, 0 x113FC},
{0 x11438, 0 x11440},
{0 x11478, 0 x11480},
{0 x114B8, 0 x114BC},
{0 x114F8, 0 x114FC},
{0 x11538, 0 x1153C},
{0 x11578, 0 x1157C},
{0 x115B8, 0 x115BC},
{0 x115F8, 0 x115FC},
{0 x11638, 0 x1163C},
{0 x11678, 0 x1167C},
{0 x116B8, 0 x116BC},
{0 x116F8, 0 x116FC},
{0 x11738, 0 x1173C},
{0 x11778, 0 x1177C},
{0 x117B8, 0 x117BC},
{0 x117F8, 0 x117FC},
{0 x17000, 0 x1701C},
{0 x17020, 0 x170AC},
{0 x18000, 0 x18050},
{0 x18054, 0 x18074},
{0 x18080, 0 x180D4},
{0 x180DC, 0 x18104},
{0 x18108, 0 x1813C},
{0 x18144, 0 x18148},
{0 x18168, 0 x18174},
{0 x18178, 0 x18180},
{0 x181C8, 0 x181E0},
{0 x181E4, 0 x181E8},
{0 x181EC, 0 x1820C},
{0 x1825C, 0 x18280},
{0 x18284, 0 x18290},
{0 x18294, 0 x182A0},
{0 x18300, 0 x18304},
{0 x18314, 0 x18320},
{0 x18328, 0 x18350},
{0 x1835C, 0 x1836C},
{0 x18370, 0 x18390},
{0 x18398, 0 x183AC},
{0 x183BC, 0 x183D8},
{0 x183DC, 0 x183F4},
{0 x18400, 0 x186F4},
{0 x186F8, 0 x1871C},
{0 x18720, 0 x18790},
{0 x19800, 0 x19830},
{0 x19834, 0 x19840},
{0 x19880, 0 x1989C},
{0 x198A4, 0 x198B0},
{0 x198BC, 0 x19900},
{0 x19C00, 0 x19C88},
{0 x19D00, 0 x19D20},
{0 x19E00, 0 x19E7C},
{0 x19E80, 0 x19E94},
{0 x19E98, 0 x19EAC},
{0 x19EB0, 0 x19EBC},
{0 x19F70, 0 x19F74},
{0 x19F80, 0 x19F8C},
{0 x19FA0, 0 x19FB4},
{0 x19FC0, 0 x19FD8},
{0 x1A000, 0 x1A200},
{0 x1A204, 0 x1A210},
{0 x1A228, 0 x1A22C},
{0 x1A230, 0 x1A248},
{0 x1A250, 0 x1A270},
{0 x1A280, 0 x1A290},
{0 x1A2A0, 0 x1A2A4},
{0 x1A2C0, 0 x1A2EC},
{0 x1A300, 0 x1A3BC},
{0 x1A3F0, 0 x1A3F4},
{0 x1A3F8, 0 x1A434},
{0 x1A438, 0 x1A444},
{0 x1A448, 0 x1A468},
{0 x1A580, 0 x1A58C},
{0 x1A644, 0 x1A654},
{0 x1A670, 0 x1A698},
{0 x1A6AC, 0 x1A6B0},
{0 x1A6D0, 0 x1A6D4},
{0 x1A6EC, 0 x1A70C},
{0 x1A710, 0 x1A738},
{0 x1A7C0, 0 x1A7D0},
{0 x1A7D4, 0 x1A7D8},
{0 x1A7DC, 0 x1A7E4},
{0 x1A7F0, 0 x1A7F8},
{0 x1A888, 0 x1A89C},
{0 x1A8A8, 0 x1A8AC},
{0 x1A8C0, 0 x1A8DC},
{0 x1A8F0, 0 x1A8FC},
{0 x1AE04, 0 x1AE08},
{0 x1AE18, 0 x1AE24},
{0 x1AF80, 0 x1AF8C},
{0 x1AFA0, 0 x1AFB4},
{0 x1B000, 0 x1B200},
{0 x1B284, 0 x1B288},
{0 x1B2D0, 0 x1B2D8},
{0 x1B2DC, 0 x1B2EC},
{0 x1B300, 0 x1B340},
{0 x1B374, 0 x1B378},
{0 x1B380, 0 x1B384},
{0 x1B388, 0 x1B38C},
{0 x1B404, 0 x1B408},
{0 x1B420, 0 x1B428},
{0 x1B440, 0 x1B444},
{0 x1B448, 0 x1B44C},
{0 x1B450, 0 x1B458},
{0 x1B45C, 0 x1B468},
{0 x1B584, 0 x1B58C},
{0 x1B68C, 0 x1B690},
{0 x1B6AC, 0 x1B6B0},
{0 x1B7F0, 0 x1B7F8},
{0 x1C800, 0 x1CC00},
{0 x1CE00, 0 x1CE04},
{0 x1CF80, 0 x1CF84},
{0 x1D200, 0 x1D800},
{0 x1E000, 0 x20014},
{0 x20100, 0 x20124},
{0 x21400, 0 x217A8},
{0 x21800, 0 x21BA8},
{0 x21C00, 0 x21FA8},
{0 x22000, 0 x223A8},
{0 x22400, 0 x227A8},
{0 x22800, 0 x22BA8},
{0 x22C00, 0 x22FA8},
{0 x23000, 0 x233A8},
{0 x24000, 0 x24034},
/* EFUSE0,1,2 is disabled here
* because its state may be reset
*
* {0x24800, 0x24804},
* {0x25000, 0x25004},
* {0x25800, 0x25804},
*/
{0 x26000, 0 x26064},
{0 x27000, 0 x27024},
{0 x34000, 0 x3400C},
{0 x34400, 0 x3445C},
{0 x34800, 0 x3485C},
{0 x34C00, 0 x34C5C},
{0 x35000, 0 x3505C},
{0 x35400, 0 x3545C},
{0 x35800, 0 x3585C},
{0 x35C00, 0 x35C5C},
{0 x36000, 0 x3605C},
{0 x38000, 0 x38064},
{0 x38070, 0 x380E0},
{0 x3A000, 0 x3A074},
/* DBI windows is skipped here, it can be only accessed when pcie
* is active (not in reset) and CORE_CTRL_PCIE_LTSSM_EN = 0 &&
* PCIE_CTRL_APP_LTSSM_ENALBE=0.
* {0x3C000 , 0x3C004},
*/
{0 x40000, 0 x400A4},
/* SI register is skipped here.
* Because it will cause bus hang
*
* {0x50000, 0x50018},
*/
{0 x80000, 0 x8000C},
{0 x80010, 0 x80020},
};
static const struct ath10k_mem_section qca6174_hw30_register_sections[] = {
{0 x800, 0 x810},
{0 x820, 0 x82C},
{0 x830, 0 x8F4},
{0 x90C, 0 x91C},
{0 xA14, 0 xA18},
{0 xA84, 0 xA94},
{0 xAA8, 0 xAD4},
{0 xADC, 0 xB40},
{0 x1000, 0 x10A4},
{0 x10BC, 0 x111C},
{0 x1134, 0 x1138},
{0 x1144, 0 x114C},
{0 x1150, 0 x115C},
{0 x1160, 0 x1178},
{0 x1240, 0 x1260},
{0 x2000, 0 x207C},
{0 x3000, 0 x3014},
{0 x4000, 0 x4014},
{0 x5000, 0 x5124},
{0 x6000, 0 x6040},
{0 x6080, 0 x60CC},
{0 x6100, 0 x611C},
{0 x6140, 0 x61D8},
{0 x6200, 0 x6238},
{0 x6240, 0 x628C},
{0 x62C0, 0 x62EC},
{0 x6380, 0 x63E8},
{0 x6400, 0 x6440},
{0 x6480, 0 x64CC},
{0 x6500, 0 x651C},
{0 x6540, 0 x6580},
{0 x6600, 0 x6638},
{0 x6640, 0 x668C},
{0 x66C0, 0 x66EC},
{0 x6780, 0 x67E8},
{0 x7080, 0 x708C},
{0 x70C0, 0 x70C8},
{0 x7400, 0 x741C},
{0 x7440, 0 x7454},
{0 x7800, 0 x7818},
{0 x8000, 0 x8004},
{0 x8010, 0 x8064},
{0 x8080, 0 x8084},
{0 x80A0, 0 x80A4},
{0 x80C0, 0 x80C4},
{0 x80E0, 0 x80F4},
{0 x8100, 0 x8104},
{0 x8110, 0 x812C},
{0 x9000, 0 x9004},
{0 x9800, 0 x982C},
{0 x9830, 0 x9838},
{0 x9840, 0 x986C},
{0 x9870, 0 x9898},
{0 x9A00, 0 x9C00},
{0 xD580, 0 xD59C},
{0 xF000, 0 xF0E0},
{0 xF140, 0 xF190},
{0 xF250, 0 xF25C},
{0 xF260, 0 xF268},
{0 xF26C, 0 xF2A8},
{0 x10008, 0 x1000C},
{0 x10014, 0 x10018},
{0 x1001C, 0 x10020},
{0 x10024, 0 x10028},
{0 x10030, 0 x10034},
{0 x10040, 0 x10054},
{0 x10058, 0 x1007C},
{0 x10080, 0 x100C4},
{0 x100C8, 0 x10114},
{0 x1012C, 0 x10130},
{0 x10138, 0 x10144},
{0 x10200, 0 x10220},
{0 x10230, 0 x10250},
{0 x10260, 0 x10280},
{0 x10290, 0 x102B0},
{0 x102C0, 0 x102DC},
{0 x102E0, 0 x102F4},
{0 x102FC, 0 x1037C},
{0 x10380, 0 x10390},
{0 x10800, 0 x10828},
{0 x10840, 0 x10844},
{0 x10880, 0 x10884},
{0 x108C0, 0 x108E8},
{0 x10900, 0 x10928},
{0 x10940, 0 x10944},
{0 x10980, 0 x10984},
{0 x109C0, 0 x109E8},
{0 x10A00, 0 x10A28},
{0 x10A40, 0 x10A50},
{0 x11000, 0 x11028},
{0 x11030, 0 x11034},
{0 x11038, 0 x11068},
{0 x11070, 0 x11074},
{0 x11078, 0 x110A8},
{0 x110B0, 0 x110B4},
{0 x110B8, 0 x110E8},
{0 x110F0, 0 x110F4},
{0 x110F8, 0 x11128},
{0 x11138, 0 x11144},
{0 x11178, 0 x11180},
{0 x111B8, 0 x111C0},
{0 x111F8, 0 x11200},
{0 x11238, 0 x1123C},
{0 x11270, 0 x11274},
{0 x11278, 0 x1127C},
{0 x112B0, 0 x112B4},
{0 x112B8, 0 x112BC},
{0 x112F0, 0 x112F4},
{0 x112F8, 0 x112FC},
{0 x11338, 0 x1133C},
{0 x11378, 0 x1137C},
{0 x113B8, 0 x113BC},
{0 x113F8, 0 x113FC},
{0 x11438, 0 x11440},
{0 x11478, 0 x11480},
{0 x114B8, 0 x114BC},
{0 x114F8, 0 x114FC},
{0 x11538, 0 x1153C},
{0 x11578, 0 x1157C},
{0 x115B8, 0 x115BC},
{0 x115F8, 0 x115FC},
{0 x11638, 0 x1163C},
{0 x11678, 0 x1167C},
{0 x116B8, 0 x116BC},
{0 x116F8, 0 x116FC},
{0 x11738, 0 x1173C},
{0 x11778, 0 x1177C},
{0 x117B8, 0 x117BC},
{0 x117F8, 0 x117FC},
{0 x17000, 0 x1701C},
{0 x17020, 0 x170AC},
{0 x18000, 0 x18050},
{0 x18054, 0 x18074},
{0 x18080, 0 x180D4},
{0 x180DC, 0 x18104},
{0 x18108, 0 x1813C},
{0 x18144, 0 x18148},
{0 x18168, 0 x18174},
{0 x18178, 0 x18180},
{0 x181C8, 0 x181E0},
{0 x181E4, 0 x181E8},
{0 x181EC, 0 x1820C},
{0 x1825C, 0 x18280},
{0 x18284, 0 x18290},
{0 x18294, 0 x182A0},
{0 x18300, 0 x18304},
{0 x18314, 0 x18320},
{0 x18328, 0 x18350},
{0 x1835C, 0 x1836C},
{0 x18370, 0 x18390},
{0 x18398, 0 x183AC},
{0 x183BC, 0 x183D8},
{0 x183DC, 0 x183F4},
{0 x18400, 0 x186F4},
{0 x186F8, 0 x1871C},
{0 x18720, 0 x18790},
{0 x19800, 0 x19830},
{0 x19834, 0 x19840},
{0 x19880, 0 x1989C},
{0 x198A4, 0 x198B0},
{0 x198BC, 0 x19900},
{0 x19C00, 0 x19C88},
{0 x19D00, 0 x19D20},
{0 x19E00, 0 x19E7C},
{0 x19E80, 0 x19E94},
{0 x19E98, 0 x19EAC},
{0 x19EB0, 0 x19EBC},
{0 x19F70, 0 x19F74},
{0 x19F80, 0 x19F8C},
{0 x19FA0, 0 x19FB4},
{0 x19FC0, 0 x19FD8},
{0 x1A000, 0 x1A200},
{0 x1A204, 0 x1A210},
{0 x1A228, 0 x1A22C},
{0 x1A230, 0 x1A248},
{0 x1A250, 0 x1A270},
{0 x1A280, 0 x1A290},
{0 x1A2A0, 0 x1A2A4},
{0 x1A2C0, 0 x1A2EC},
{0 x1A300, 0 x1A3BC},
{0 x1A3F0, 0 x1A3F4},
{0 x1A3F8, 0 x1A434},
{0 x1A438, 0 x1A444},
{0 x1A448, 0 x1A468},
{0 x1A580, 0 x1A58C},
{0 x1A644, 0 x1A654},
{0 x1A670, 0 x1A698},
{0 x1A6AC, 0 x1A6B0},
{0 x1A6D0, 0 x1A6D4},
{0 x1A6EC, 0 x1A70C},
{0 x1A710, 0 x1A738},
{0 x1A7C0, 0 x1A7D0},
{0 x1A7D4, 0 x1A7D8},
{0 x1A7DC, 0 x1A7E4},
{0 x1A7F0, 0 x1A7F8},
{0 x1A888, 0 x1A89C},
{0 x1A8A8, 0 x1A8AC},
{0 x1A8C0, 0 x1A8DC},
{0 x1A8F0, 0 x1A8FC},
{0 x1AE04, 0 x1AE08},
{0 x1AE18, 0 x1AE24},
{0 x1AF80, 0 x1AF8C},
{0 x1AFA0, 0 x1AFB4},
{0 x1B000, 0 x1B200},
{0 x1B284, 0 x1B288},
{0 x1B2D0, 0 x1B2D8},
{0 x1B2DC, 0 x1B2EC},
{0 x1B300, 0 x1B340},
{0 x1B374, 0 x1B378},
{0 x1B380, 0 x1B384},
{0 x1B388, 0 x1B38C},
{0 x1B404, 0 x1B408},
{0 x1B420, 0 x1B428},
{0 x1B440, 0 x1B444},
{0 x1B448, 0 x1B44C},
{0 x1B450, 0 x1B458},
{0 x1B45C, 0 x1B468},
{0 x1B584, 0 x1B58C},
{0 x1B68C, 0 x1B690},
{0 x1B6AC, 0 x1B6B0},
{0 x1B7F0, 0 x1B7F8},
{0 x1C800, 0 x1CC00},
{0 x1CE00, 0 x1CE04},
{0 x1CF80, 0 x1CF84},
{0 x1D200, 0 x1D800},
{0 x1E000, 0 x20014},
{0 x20100, 0 x20124},
{0 x21400, 0 x217A8},
{0 x21800, 0 x21BA8},
{0 x21C00, 0 x21FA8},
{0 x22000, 0 x223A8},
{0 x22400, 0 x227A8},
{0 x22800, 0 x22BA8},
{0 x22C00, 0 x22FA8},
{0 x23000, 0 x233A8},
{0 x24000, 0 x24034},
{0 x26000, 0 x26064},
{0 x27000, 0 x27024},
{0 x34000, 0 x3400C},
{0 x34400, 0 x3445C},
{0 x34800, 0 x3485C},
{0 x34C00, 0 x34C5C},
{0 x35000, 0 x3505C},
{0 x35400, 0 x3545C},
{0 x35800, 0 x3585C},
{0 x35C00, 0 x35C5C},
{0 x36000, 0 x3605C},
{0 x38000, 0 x38064},
{0 x38070, 0 x380E0},
{0 x3A000, 0 x3A074},
{0 x40000, 0 x400A4},
{0 x80000, 0 x8000C},
{0 x80010, 0 x80020},
};
static const struct ath10k_mem_region qca6174_hw10_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x70000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
/* RTC_SOC_BASE_ADDRESS */
.start = 0 x0,
/* WLAN_MBOX_BASE_ADDRESS - RTC_SOC_BASE_ADDRESS */
.len = 0 x800 - 0 x0,
.name = "REG_PART1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
/* STEREO_BASE_ADDRESS */
.start = 0 x27000,
/* USB_BASE_ADDRESS - STEREO_BASE_ADDRESS */
.len = 0 x60000 - 0 x27000,
.name = "REG_PART2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_mem_region qca6174_hw21_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x70000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_AXI,
.start = 0 xa0000,
.len = 0 x18000,
.name = "AXI" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x800,
.len = 0 x80020 - 0 x800,
.name = "REG_TOTAL" ,
.section_table = {
.sections = qca6174_hw21_register_sections,
.size = ARRAY_SIZE(qca6174_hw21_register_sections),
},
},
};
static const struct ath10k_mem_region qca6174_hw30_sdio_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 xa8000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_AXI,
.start = 0 xa0000,
.len = 0 x18000,
.name = "AXI" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IRAM1,
.start = 0 x00980000,
.len = 0 x00080000,
.name = "IRAM1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IRAM2,
.start = 0 x00a00000,
.len = 0 x00040000,
.name = "IRAM2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x800,
.len = 0 x80020 - 0 x800,
.name = "REG_TOTAL" ,
.section_table = {
.sections = qca6174_hw30_sdio_register_sections,
.size = ARRAY_SIZE(qca6174_hw30_sdio_register_sections),
},
},
};
static const struct ath10k_mem_region qca6174_hw30_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 xa8000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_AXI,
.start = 0 xa0000,
.len = 0 x18000,
.name = "AXI" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x800,
.len = 0 x80020 - 0 x800,
.name = "REG_TOTAL" ,
.section_table = {
.sections = qca6174_hw30_register_sections,
.size = ARRAY_SIZE(qca6174_hw30_register_sections),
},
},
/* IRAM dump must be put last */
{
.type = ATH10K_MEM_REGION_TYPE_IRAM1,
.start = 0 x00980000,
.len = 0 x00080000,
.name = "IRAM1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IRAM2,
.start = 0 x00a00000,
.len = 0 x00040000,
.name = "IRAM2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_mem_region qca988x_hw20_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x50000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x4000,
.len = 0 x2000,
.name = "REG_PART1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x8000,
.len = 0 x58000,
.name = "REG_PART2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_mem_region qca99x0_hw20_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x60000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x980000,
.len = 0 x50000,
.name = "IRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOSRAM,
.start = 0 xC0000,
.len = 0 x40000,
.name = "SRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x30000,
.len = 0 x7000,
.name = "APB REG 1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x3f000,
.len = 0 x3000,
.name = "APB REG 2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x43000,
.len = 0 x3000,
.name = "WIFI REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x4A000,
.len = 0 x5000,
.name = "CE REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x80000,
.len = 0 x6000,
.name = "SOC REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_mem_region qca9984_hw10_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x80000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x980000,
.len = 0 x50000,
.name = "IRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOSRAM,
.start = 0 xC0000,
.len = 0 x40000,
.name = "SRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x30000,
.len = 0 x7000,
.name = "APB REG 1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x3f000,
.len = 0 x3000,
.name = "APB REG 2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x43000,
.len = 0 x3000,
.name = "WIFI REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x4A000,
.len = 0 x5000,
.name = "CE REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x80000,
.len = 0 x6000,
.name = "SOC REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_mem_section ipq4019_soc_reg_range[] = {
{0 x080000, 0 x080004},
{0 x080020, 0 x080024},
{0 x080028, 0 x080050},
{0 x0800d4, 0 x0800ec},
{0 x08010c, 0 x080118},
{0 x080284, 0 x080290},
{0 x0802a8, 0 x0802b8},
{0 x0802dc, 0 x08030c},
{0 x082000, 0 x083fff}
};
static const struct ath10k_mem_region qca4019_hw10_mem_regions[] = {
{
.type = ATH10K_MEM_REGION_TYPE_DRAM,
.start = 0 x400000,
.len = 0 x68000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 xC0000,
.len = 0 x40000,
.name = "SRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x980000,
.len = 0 x50000,
.name = "IRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x30000,
.len = 0 x7000,
.name = "APB REG 1" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x3f000,
.len = 0 x3000,
.name = "APB REG 2" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x43000,
.len = 0 x3000,
.name = "WIFI REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_IOREG,
.start = 0 x4A000,
.len = 0 x5000,
.name = "CE REG" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
{
.type = ATH10K_MEM_REGION_TYPE_REG,
.start = 0 x080000,
.len = 0 x083fff - 0 x080000,
.name = "REG_TOTAL" ,
.section_table = {
.sections = ipq4019_soc_reg_range,
.size = ARRAY_SIZE(ipq4019_soc_reg_range),
},
},
};
static const struct ath10k_mem_region wcn399x_hw10_mem_regions[] = {
{
/* MSA region start is not fixed, hence it is assigned at runtime */
.type = ATH10K_MEM_REGION_TYPE_MSA,
.len = 0 x100000,
.name = "DRAM" ,
.section_table = {
.sections = NULL,
.size = 0 ,
},
},
};
static const struct ath10k_hw_mem_layout hw_mem_layouts[] = {
{
.hw_id = QCA6174_HW_1_0_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw10_mem_regions,
.size = ARRAY_SIZE(qca6174_hw10_mem_regions),
},
},
{
.hw_id = QCA6174_HW_1_1_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw10_mem_regions,
.size = ARRAY_SIZE(qca6174_hw10_mem_regions),
},
},
{
.hw_id = QCA6174_HW_1_3_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw10_mem_regions,
.size = ARRAY_SIZE(qca6174_hw10_mem_regions),
},
},
{
.hw_id = QCA6174_HW_2_1_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw21_mem_regions,
.size = ARRAY_SIZE(qca6174_hw21_mem_regions),
},
},
{
.hw_id = QCA6174_HW_3_0_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw30_mem_regions,
.size = ARRAY_SIZE(qca6174_hw30_mem_regions),
},
},
{
.hw_id = QCA6174_HW_3_2_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw30_mem_regions,
.size = ARRAY_SIZE(qca6174_hw30_mem_regions),
},
},
{
.hw_id = QCA6174_HW_3_2_VERSION,
.hw_rev = ATH10K_HW_QCA6174,
.bus = ATH10K_BUS_SDIO,
.region_table = {
.regions = qca6174_hw30_sdio_mem_regions,
.size = ARRAY_SIZE(qca6174_hw30_sdio_mem_regions),
},
},
{
.hw_id = QCA9377_HW_1_1_DEV_VERSION,
.hw_rev = ATH10K_HW_QCA9377,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca6174_hw30_mem_regions,
.size = ARRAY_SIZE(qca6174_hw30_mem_regions),
},
},
{
.hw_id = QCA988X_HW_2_0_VERSION,
.hw_rev = ATH10K_HW_QCA988X,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca988x_hw20_mem_regions,
.size = ARRAY_SIZE(qca988x_hw20_mem_regions),
},
},
{
.hw_id = QCA9984_HW_1_0_DEV_VERSION,
.hw_rev = ATH10K_HW_QCA9984,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca9984_hw10_mem_regions,
.size = ARRAY_SIZE(qca9984_hw10_mem_regions),
},
},
{
.hw_id = QCA9888_HW_2_0_DEV_VERSION,
.hw_rev = ATH10K_HW_QCA9888,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca9984_hw10_mem_regions,
.size = ARRAY_SIZE(qca9984_hw10_mem_regions),
},
},
{
.hw_id = QCA99X0_HW_2_0_DEV_VERSION,
.hw_rev = ATH10K_HW_QCA99X0,
.bus = ATH10K_BUS_PCI,
.region_table = {
.regions = qca99x0_hw20_mem_regions,
.size = ARRAY_SIZE(qca99x0_hw20_mem_regions),
},
},
{
.hw_id = QCA4019_HW_1_0_DEV_VERSION,
.hw_rev = ATH10K_HW_QCA4019,
.bus = ATH10K_BUS_AHB,
.region_table = {
.regions = qca4019_hw10_mem_regions,
.size = ARRAY_SIZE(qca4019_hw10_mem_regions),
},
},
{
.hw_id = WCN3990_HW_1_0_DEV_VERSION,
.hw_rev = ATH10K_HW_WCN3990,
.bus = ATH10K_BUS_SNOC,
.region_table = {
.regions = wcn399x_hw10_mem_regions,
.size = ARRAY_SIZE(wcn399x_hw10_mem_regions),
},
},
};
static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)
{
const struct ath10k_hw_mem_layout *hw;
const struct ath10k_mem_region *mem_region;
size_t size = 0 ;
int i;
hw = ath10k_coredump_get_mem_layout(ar);
if (!hw)
return 0 ;
mem_region = &hw->region_table.regions[0 ];
for (i = 0 ; i < hw->region_table.size; i++) {
size += mem_region->len;
mem_region++;
}
/* reserve space for the headers */
size += hw->region_table.size * sizeof (struct ath10k_dump_ram_data_hdr);
/* make sure it is aligned 16 bytes for debug message print out */
size = ALIGN(size, 16 );
return size;
}
const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar)
{
if (!test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
return NULL;
return _ath10k_coredump_get_mem_layout(ar);
}
EXPORT_SYMBOL(ath10k_coredump_get_mem_layout);
const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar)
{
int i;
if (WARN_ON(ar->target_version == 0 ))
return NULL;
for (i = 0 ; i < ARRAY_SIZE(hw_mem_layouts); i++) {
if (ar->target_version == hw_mem_layouts[i].hw_id &&
ar->hw_rev == hw_mem_layouts[i].hw_rev &&
hw_mem_layouts[i].bus == ar->hif.bus)
return &hw_mem_layouts[i];
}
return NULL;
}
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
{
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
lockdep_assert_held(&ar->dump_mutex);
if (ath10k_coredump_mask == 0 )
/* coredump disabled */
return NULL;
guid_gen(&crash_data->guid);
ktime_get_real_ts64(&crash_data->timestamp);
return crash_data;
}
EXPORT_SYMBOL(ath10k_coredump_new);
static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
{
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
size_t hdr_len = sizeof (*dump_data);
size_t len, sofar = 0 ;
unsigned char *buf;
len = hdr_len;
if (test_bit(ATH10K_FW_CRASH_DUMP_REGISTERS, &ath10k_coredump_mask))
len += sizeof (*dump_tlv) + sizeof (crash_data->registers);
if (test_bit(ATH10K_FW_CRASH_DUMP_CE_DATA, &ath10k_coredump_mask))
len += sizeof (*dump_tlv) + sizeof (*ce_hdr) +
CE_COUNT * sizeof (ce_hdr->entries[0 ]);
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof (*dump_tlv) + crash_data->ramdump_buf_len;
sofar += hdr_len;
/* This is going to get big when we start dumping FW RAM and such,
* so go ahead and use vmalloc.
*/
buf = vzalloc(len);
if (!buf)
return NULL;
mutex_lock(&ar->dump_mutex);
dump_data = (struct ath10k_dump_file_data *)(buf);
strscpy(dump_data->df_magic, "ATH10K-FW-DUMP" ,
sizeof (dump_data->df_magic));
dump_data->len = cpu_to_le32(len);
dump_data->version = cpu_to_le32(ATH10K_FW_CRASH_DUMP_VERSION);
guid_copy(&dump_data->guid, &crash_data->guid);
dump_data->chip_id = cpu_to_le32(ar->bus_param.chip_id);
dump_data->bus_type = cpu_to_le32(0 );
dump_data->target_version = cpu_to_le32(ar->target_version);
dump_data->fw_version_major = cpu_to_le32(ar->fw_version_major);
dump_data->fw_version_minor = cpu_to_le32(ar->fw_version_minor);
dump_data->fw_version_release = cpu_to_le32(ar->fw_version_release);
dump_data->fw_version_build = cpu_to_le32(ar->fw_version_build);
dump_data->phy_capability = cpu_to_le32(ar->phy_capability);
dump_data->hw_min_tx_power = cpu_to_le32(ar->hw_min_tx_power);
dump_data->hw_max_tx_power = cpu_to_le32(ar->hw_max_tx_power);
dump_data->ht_cap_info = cpu_to_le32(ar->ht_cap_info);
dump_data->vht_cap_info = cpu_to_le32(ar->vht_cap_info);
dump_data->num_rf_chains = cpu_to_le32(ar->num_rf_chains);
strscpy(dump_data->fw_ver, ar->hw->wiphy->fw_version,
sizeof (dump_data->fw_ver));
dump_data->kernel_ver_code = 0 ;
strscpy(dump_data->kernel_ver, init_utsname()->release,
sizeof (dump_data->kernel_ver));
dump_data->tv_sec = cpu_to_le64(crash_data->timestamp.tv_sec);
dump_data->tv_nsec = cpu_to_le64(crash_data->timestamp.tv_nsec);
if (test_bit(ATH10K_FW_CRASH_DUMP_REGISTERS, &ath10k_coredump_mask)) {
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
dump_tlv->type = cpu_to_le32(ATH10K_FW_CRASH_DUMP_REGISTERS);
dump_tlv->tlv_len = cpu_to_le32(sizeof (crash_data->registers));
memcpy(dump_tlv->tlv_data, &crash_data->registers,
sizeof (crash_data->registers));
sofar += sizeof (*dump_tlv) + sizeof (crash_data->registers);
}
if (test_bit(ATH10K_FW_CRASH_DUMP_CE_DATA, &ath10k_coredump_mask)) {
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
dump_tlv->type = cpu_to_le32(ATH10K_FW_CRASH_DUMP_CE_DATA);
dump_tlv->tlv_len = cpu_to_le32(struct_size(ce_hdr, entries,
CE_COUNT));
ce_hdr = (struct ath10k_ce_crash_hdr *)(dump_tlv->tlv_data);
ce_hdr->ce_count = cpu_to_le32(CE_COUNT);
memset(ce_hdr->reserved, 0 , sizeof (ce_hdr->reserved));
memcpy(ce_hdr->entries, crash_data->ce_crash_data,
CE_COUNT * sizeof (ce_hdr->entries[0 ]));
sofar += sizeof (*dump_tlv) + sizeof (*ce_hdr) +
CE_COUNT * sizeof (ce_hdr->entries[0 ]);
}
/* Gather ram dump */
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask)) {
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
dump_tlv->type = cpu_to_le32(ATH10K_FW_CRASH_DUMP_RAM_DATA);
dump_tlv->tlv_len = cpu_to_le32(crash_data->ramdump_buf_len);
if (crash_data->ramdump_buf_len) {
memcpy(dump_tlv->tlv_data, crash_data->ramdump_buf,
crash_data->ramdump_buf_len);
sofar += sizeof (*dump_tlv) + crash_data->ramdump_buf_len;
}
}
mutex_unlock(&ar->dump_mutex);
return dump_data;
}
int ath10k_coredump_submit(struct ath10k *ar)
{
struct ath10k_dump_file_data *dump;
if (ath10k_coredump_mask == 0 )
/* coredump disabled */
return 0 ;
dump = ath10k_coredump_build(ar);
if (!dump) {
ath10k_warn(ar, "no crash dump data found for devcoredump" );
return -ENODATA;
}
dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL);
return 0 ;
}
int ath10k_coredump_create(struct ath10k *ar)
{
if (ath10k_coredump_mask == 0 )
/* coredump disabled */
return 0 ;
ar->coredump.fw_crash_data = vzalloc(sizeof (*ar->coredump.fw_crash_data));
if (!ar->coredump.fw_crash_data)
return -ENOMEM;
return 0 ;
}
int ath10k_coredump_register(struct ath10k *ar)
{
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask)) {
crash_data->ramdump_buf_len = ath10k_coredump_get_ramdump_size(ar);
if (!crash_data->ramdump_buf_len)
return 0 ;
crash_data->ramdump_buf = vzalloc(crash_data->ramdump_buf_len);
if (!crash_data->ramdump_buf)
return -ENOMEM;
}
return 0 ;
}
void ath10k_coredump_unregister(struct ath10k *ar)
{
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
vfree(crash_data->ramdump_buf);
}
void ath10k_coredump_destroy(struct ath10k *ar)
{
if (ar->coredump.fw_crash_data->ramdump_buf) {
vfree(ar->coredump.fw_crash_data->ramdump_buf);
ar->coredump.fw_crash_data->ramdump_buf = NULL;
ar->coredump.fw_crash_data->ramdump_buf_len = 0 ;
}
vfree(ar->coredump.fw_crash_data);
ar->coredump.fw_crash_data = NULL;
}
Messung V0.5 in Prozent C=96 H=92 G=93
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-06-07)
¤
*© Formatika GbR, Deutschland