| 1 |
// SPDX-License-Identifier: BSD-3-Clause-Clear |
| 2 |
/* |
| 3 |
* Copyright (c) 2020 The Linux Foundation. All rights reserved. |
| 4 |
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. |
| 5 |
*/ |
| 6 |
#include <linux/devcoredump.h> |
| 7 |
#include "hif.h" |
| 8 |
#include "coredump.h" |
| 9 |
#include "debug.h" |
| 10 |
|
| 11 |
enum |
| 12 |
ath12k_fw_crash_dump_type ath12k_coredump_get_dump_type(enum ath12k_qmi_target_mem type) |
| 13 |
{ |
| 14 |
enum ath12k_fw_crash_dump_type dump_type; |
| 15 |
|
| 16 |
switch (type) { |
| 17 |
case HOST_DDR_REGION_TYPE: |
| 18 |
dump_type = FW_CRASH_DUMP_REMOTE_MEM_DATA; |
| 19 |
break; |
| 20 |
case M3_DUMP_REGION_TYPE: |
| 21 |
dump_type = FW_CRASH_DUMP_M3_DUMP; |
| 22 |
break; |
| 23 |
case PAGEABLE_MEM_REGION_TYPE: |
| 24 |
dump_type = FW_CRASH_DUMP_PAGEABLE_DATA; |
| 25 |
break; |
| 26 |
case BDF_MEM_REGION_TYPE: |
| 27 |
case CALDB_MEM_REGION_TYPE: |
| 28 |
dump_type = FW_CRASH_DUMP_NONE; |
| 29 |
break; |
| 30 |
case MLO_GLOBAL_MEM_REGION_TYPE: |
| 31 |
dump_type = FW_CRASH_DUMP_MLO_GLOBAL_DATA; |
| 32 |
break; |
| 33 |
default: |
| 34 |
dump_type = FW_CRASH_DUMP_TYPE_MAX; |
| 35 |
break; |
| 36 |
} |
| 37 |
|
| 38 |
return dump_type; |
| 39 |
} |
| 40 |
|
| 41 |
void ath12k_coredump_upload(struct work_struct *work) |
| 42 |
{ |
| 43 |
struct ath12k_base *ab = container_of(work, struct ath12k_base, dump_work); |
| 44 |
|
| 45 |
ath12k_info(ab, "Uploading coredump\n"); |
| 46 |
/* dev_coredumpv() takes ownership of the buffer */ |
| 47 |
dev_coredumpv(ab->dev, ab->dump_data, ab->ath12k_coredump_len, GFP_KERNEL); |
| 48 |
ab->dump_data = NULL; |
| 49 |
} |
| 50 |
|
| 51 |
void ath12k_coredump_collect(struct ath12k_base *ab) |
| 52 |
{ |
| 53 |
ath12k_hif_coredump_download(ab); |
| 54 |
} |