Path: blob/main/sys/contrib/dev/athk/ath10k/coredump.h
107435 views
/* SPDX-License-Identifier: ISC */1/*2* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.3* Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.4*/56#ifndef _COREDUMP_H_7#define _COREDUMP_H_89#include "core.h"1011#define ATH10K_FW_CRASH_DUMP_VERSION 11213/**14* enum ath10k_fw_crash_dump_type - types of data in the dump file15* @ATH10K_FW_CRASH_DUMP_REGISTERS: Register crash dump in binary format16* @ATH10K_FW_CRASH_DUMP_CE_DATA: Copy Engine crash dump data17* @ATH10K_FW_CRASH_DUMP_RAM_DATA: RAM crash dump data, contains multiple18* struct ath10k_dump_ram_data_hdr19* @ATH10K_FW_CRASH_DUMP_MAX: Maximum enumeration20*/21enum ath10k_fw_crash_dump_type {22ATH10K_FW_CRASH_DUMP_REGISTERS = 0,23ATH10K_FW_CRASH_DUMP_CE_DATA = 1,2425/* contains multiple struct ath10k_dump_ram_data_hdr */26ATH10K_FW_CRASH_DUMP_RAM_DATA = 2,2728ATH10K_FW_CRASH_DUMP_MAX,29};3031struct ath10k_tlv_dump_data {32/* see ath10k_fw_crash_dump_type above */33__le32 type;3435/* in bytes */36__le32 tlv_len;3738/* pad to 32-bit boundaries as needed */39u8 tlv_data[];40} __packed;4142struct ath10k_dump_file_data {43/* dump file information */4445/* "ATH10K-FW-DUMP" */46char df_magic[16];4748__le32 len;4950/* file dump version */51__le32 version;5253/* some info we can get from ath10k struct that might help */5455guid_t guid;5657__le32 chip_id;5859/* 0 for now, in place for later hardware */60__le32 bus_type;6162__le32 target_version;63__le32 fw_version_major;64__le32 fw_version_minor;65__le32 fw_version_release;66__le32 fw_version_build;67__le32 phy_capability;68__le32 hw_min_tx_power;69__le32 hw_max_tx_power;70__le32 ht_cap_info;71__le32 vht_cap_info;72__le32 num_rf_chains;7374/* firmware version string */75char fw_ver[ETHTOOL_FWVERS_LEN];7677/* Kernel related information */7879/* time-of-day stamp */80__le64 tv_sec;8182/* time-of-day stamp, nano-seconds */83__le64 tv_nsec;8485/* LINUX_VERSION_CODE */86__le32 kernel_ver_code;8788/* VERMAGIC_STRING */89char kernel_ver[64];9091/* room for growth w/out changing binary format */92u8 unused[128];9394/* struct ath10k_tlv_dump_data + more */95u8 data[];96} __packed;9798struct ath10k_dump_ram_data_hdr {99/* enum ath10k_mem_region_type */100__le32 region_type;101102__le32 start;103104/* length of payload data, not including this header */105__le32 length;106107u8 data[];108};109110/* magic number to fill the holes not copied due to sections in regions */111#define ATH10K_MAGIC_NOT_COPIED 0xAA112113/* part of user space ABI */114enum ath10k_mem_region_type {115ATH10K_MEM_REGION_TYPE_REG = 1,116ATH10K_MEM_REGION_TYPE_DRAM = 2,117ATH10K_MEM_REGION_TYPE_AXI = 3,118ATH10K_MEM_REGION_TYPE_IRAM1 = 4,119ATH10K_MEM_REGION_TYPE_IRAM2 = 5,120ATH10K_MEM_REGION_TYPE_IOSRAM = 6,121ATH10K_MEM_REGION_TYPE_IOREG = 7,122ATH10K_MEM_REGION_TYPE_MSA = 8,123};124125/* Define a section of the region which should be copied. As not all parts126* of the memory is possible to copy, for example some of the registers can127* be like that, sections can be used to define what is safe to copy.128*129* To minimize the size of the array, the list must obey the format:130* '{start0,stop0},{start1,stop1},{start2,stop2}....' The values below must131* also obey to 'start0 < stop0 < start1 < stop1 < start2 < ...', otherwise132* we may encounter error in the dump processing.133*/134struct ath10k_mem_section {135u32 start;136u32 end;137};138139/* One region of a memory layout. If the sections field is null entire140* region is copied. If sections is non-null only the areas specified in141* sections are copied and rest of the areas are filled with142* ATH10K_MAGIC_NOT_COPIED.143*/144struct ath10k_mem_region {145enum ath10k_mem_region_type type;146u32 start;147u32 len;148149const char *name;150151struct {152const struct ath10k_mem_section *sections;153u32 size;154} section_table;155};156157/* Contains the memory layout of a hardware version identified with the158* hardware id, split into regions.159*/160struct ath10k_hw_mem_layout {161u32 hw_id;162u32 hw_rev;163enum ath10k_bus bus;164165struct {166const struct ath10k_mem_region *regions;167int size;168} region_table;169};170171/* FIXME: where to put this? */172extern unsigned long ath10k_coredump_mask;173174#ifdef CONFIG_DEV_COREDUMP175176int ath10k_coredump_submit(struct ath10k *ar);177struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);178int ath10k_coredump_create(struct ath10k *ar);179int ath10k_coredump_register(struct ath10k *ar);180void ath10k_coredump_unregister(struct ath10k *ar);181void ath10k_coredump_destroy(struct ath10k *ar);182183const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar);184const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);185186#else /* CONFIG_DEV_COREDUMP */187188static inline int ath10k_coredump_submit(struct ath10k *ar)189{190return 0;191}192193static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)194{195return NULL;196}197198static inline int ath10k_coredump_create(struct ath10k *ar)199{200return 0;201}202203static inline int ath10k_coredump_register(struct ath10k *ar)204{205return 0;206}207208static inline void ath10k_coredump_unregister(struct ath10k *ar)209{210}211212static inline void ath10k_coredump_destroy(struct ath10k *ar)213{214}215216static inline const struct ath10k_hw_mem_layout *217ath10k_coredump_get_mem_layout(struct ath10k *ar)218{219return NULL;220}221222static inline const struct ath10k_hw_mem_layout *223_ath10k_coredump_get_mem_layout(struct ath10k *ar)224{225return NULL;226}227228#endif /* CONFIG_DEV_COREDUMP */229230#endif /* _COREDUMP_H_ */231232233