blob: 69b434073aea02f595afc5e70bdc70192585a679 [file] [log] [blame]
developere5e687d2023-08-08 16:05:33 +08001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2023 MediaTek Inc. All Rights Reserved.
4 *
5 * Author: Alvin Kuo <Alvin.Kuo@mediatek.com>
6 */
7
8#ifndef __DUMP_H__
9#define __DUMP_H__
10
11#include <sys/types.h>
12
13#define DUMP_INFO_NAME_MAX_LEN 32
14#define RELAY_DUMP_SUBBUF_SIZE 2048
developerfbdb5112023-08-21 15:12:14 +080015#define DUMP_DATA_PATH "/sys/kernel/debug/tops/trm/dump-data"
developere5e687d2023-08-08 16:05:33 +080016
17#define DUMP_LOG_FMT(FMT) "[TOPS_TOOL] [%s]: " FMT, __func__
18
19struct dump_info {
20 char name[DUMP_INFO_NAME_MAX_LEN];
21 uint64_t dump_time_sec;
22 uint32_t start_addr;
23 uint32_t size;
24 uint32_t dump_rsn;
25#define DUMP_RSN_NULL (0x0000)
26#define DUMP_RSN_WDT_TIMEOUT_CORE0 (0x0001)
27#define DUMP_RSN_WDT_TIMEOUT_CORE1 (0x0002)
28#define DUMP_RSN_WDT_TIMEOUT_CORE2 (0x0004)
29#define DUMP_RSN_WDT_TIMEOUT_CORE3 (0x0008)
30#define DUMP_RSN_WDT_TIMEOUT_COREM (0x0010)
31#define DUMP_RSN_FE_RESET (0x0020)
32};
33
34struct dump_data_header {
35 struct dump_info info;
36 uint32_t data_offset;
37 uint32_t data_len;
38 uint8_t last_frag;
39};
40
41int tops_save_dump_data(char *dump_dir);
42
43#endif /* __DUMP_H__ */