Path: blob/main/sys/contrib/dev/athk/ath10k/coredump.h
48375 views
/* SPDX-License-Identifier: ISC */1/*2* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.3*/45#ifndef _COREDUMP_H_6#define _COREDUMP_H_78#include "core.h"910#define ATH10K_FW_CRASH_DUMP_VERSION 11112/**13* enum ath10k_fw_crash_dump_type - types of data in the dump file14* @ATH10K_FW_CRASH_DUMP_REGDUMP: Register crash dump in binary format15*/16enum ath10k_fw_crash_dump_type {17ATH10K_FW_CRASH_DUMP_REGISTERS = 0,18ATH10K_FW_CRASH_DUMP_CE_DATA = 1,1920/* contains multiple struct ath10k_dump_ram_data_hdr */21ATH10K_FW_CRASH_DUMP_RAM_DATA = 2,2223ATH10K_FW_CRASH_DUMP_MAX,24};2526struct ath10k_tlv_dump_data {27/* see ath10k_fw_crash_dump_type above */28__le32 type;2930/* in bytes */31__le32 tlv_len;3233/* pad to 32-bit boundaries as needed */34u8 tlv_data[];35} __packed;3637struct ath10k_dump_file_data {38/* dump file information */3940/* "ATH10K-FW-DUMP" */41char df_magic[16];4243__le32 len;4445/* file dump version */46__le32 version;4748/* some info we can get from ath10k struct that might help */4950guid_t guid;5152__le32 chip_id;5354/* 0 for now, in place for later hardware */55__le32 bus_type;5657__le32 target_version;58__le32 fw_version_major;59__le32 fw_version_minor;60__le32 fw_version_release;61__le32 fw_version_build;62__le32 phy_capability;63__le32 hw_min_tx_power;64__le32 hw_max_tx_power;65__le32 ht_cap_info;66__le32 vht_cap_info;67__le32 num_rf_chains;6869/* firmware version string */70char fw_ver[ETHTOOL_FWVERS_LEN];7172/* Kernel related information */7374/* time-of-day stamp */75__le64 tv_sec;7677/* time-of-day stamp, nano-seconds */78__le64 tv_nsec;7980/* LINUX_VERSION_CODE */81__le32 kernel_ver_code;8283/* VERMAGIC_STRING */84char kernel_ver[64];8586/* room for growth w/out changing binary format */87u8 unused[128];8889/* struct ath10k_tlv_dump_data + more */90u8 data[];91} __packed;9293struct ath10k_dump_ram_data_hdr {94/* enum ath10k_mem_region_type */95__le32 region_type;9697__le32 start;9899/* length of payload data, not including this header */100__le32 length;101102u8 data[];103};104105/* magic number to fill the holes not copied due to sections in regions */106#define ATH10K_MAGIC_NOT_COPIED 0xAA107108/* part of user space ABI */109enum ath10k_mem_region_type {110ATH10K_MEM_REGION_TYPE_REG = 1,111ATH10K_MEM_REGION_TYPE_DRAM = 2,112ATH10K_MEM_REGION_TYPE_AXI = 3,113ATH10K_MEM_REGION_TYPE_IRAM1 = 4,114ATH10K_MEM_REGION_TYPE_IRAM2 = 5,115ATH10K_MEM_REGION_TYPE_IOSRAM = 6,116ATH10K_MEM_REGION_TYPE_IOREG = 7,117ATH10K_MEM_REGION_TYPE_MSA = 8,118};119120/* Define a section of the region which should be copied. As not all parts121* of the memory is possible to copy, for example some of the registers can122* be like that, sections can be used to define what is safe to copy.123*124* To minimize the size of the array, the list must obey the format:125* '{start0,stop0},{start1,stop1},{start2,stop2}....' The values below must126* also obey to 'start0 < stop0 < start1 < stop1 < start2 < ...', otherwise127* we may encounter error in the dump processing.128*/129struct ath10k_mem_section {130u32 start;131u32 end;132};133134/* One region of a memory layout. If the sections field is null entire135* region is copied. If sections is non-null only the areas specified in136* sections are copied and rest of the areas are filled with137* ATH10K_MAGIC_NOT_COPIED.138*/139struct ath10k_mem_region {140enum ath10k_mem_region_type type;141u32 start;142u32 len;143144const char *name;145146struct {147const struct ath10k_mem_section *sections;148u32 size;149} section_table;150};151152/* Contains the memory layout of a hardware version identified with the153* hardware id, split into regions.154*/155struct ath10k_hw_mem_layout {156u32 hw_id;157u32 hw_rev;158enum ath10k_bus bus;159160struct {161const struct ath10k_mem_region *regions;162int size;163} region_table;164};165166/* FIXME: where to put this? */167extern unsigned long ath10k_coredump_mask;168169#ifdef CONFIG_DEV_COREDUMP170171int ath10k_coredump_submit(struct ath10k *ar);172struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);173int ath10k_coredump_create(struct ath10k *ar);174int ath10k_coredump_register(struct ath10k *ar);175void ath10k_coredump_unregister(struct ath10k *ar);176void ath10k_coredump_destroy(struct ath10k *ar);177178const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar);179const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);180181#else /* CONFIG_DEV_COREDUMP */182183static inline int ath10k_coredump_submit(struct ath10k *ar)184{185return 0;186}187188static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)189{190return NULL;191}192193static inline int ath10k_coredump_create(struct ath10k *ar)194{195return 0;196}197198static inline int ath10k_coredump_register(struct ath10k *ar)199{200return 0;201}202203static inline void ath10k_coredump_unregister(struct ath10k *ar)204{205}206207static inline void ath10k_coredump_destroy(struct ath10k *ar)208{209}210211static inline const struct ath10k_hw_mem_layout *212ath10k_coredump_get_mem_layout(struct ath10k *ar)213{214return NULL;215}216217static inline const struct ath10k_hw_mem_layout *218_ath10k_coredump_get_mem_layout(struct ath10k *ar)219{220return NULL;221}222223#endif /* CONFIG_DEV_COREDUMP */224225#endif /* _COREDUMP_H_ */226227228