1 /* SPDX-License-Identifier: GPL-2.0-only
2  *
3  * Copyright (C) 2020-2021 Intel Corporation.
4  */
5 
6 #ifndef _IOSM_IPC_COREDUMP_H_
7 #define _IOSM_IPC_COREDUMP_H_
8 
9 #include "iosm_ipc_devlink.h"
10 
11 /* Max number of bytes to receive for Coredump list structure */
12 #define MAX_CD_LIST_SIZE  0x1000
13 
14 /* Max buffer allocated to receive coredump data */
15 #define MAX_DATA_SIZE 0x00010000
16 
17 /* Max length */
18 #define MAX_SIZE_LEN 32
19 
20 /**
21  * struct iosm_cd_list_entry - Structure to hold coredump file info.
22  * @size:       Number of bytes for the entry
23  * @filename:   Coredump filename to be generated on host
24  */
25 struct iosm_cd_list_entry {
26 	__le32 size;
27 	char filename[IOSM_MAX_FILENAME_LEN];
28 } __packed;
29 
30 /**
31  * struct iosm_cd_list - Structure to hold list of coredump files
32  *                      to be collected.
33  * @num_entries:        Number of entries to be received
34  * @entry:              Contains File info
35  */
36 struct iosm_cd_list {
37 	__le32 num_entries;
38 	struct iosm_cd_list_entry entry[];
39 } __packed;
40 
41 /**
42  * struct iosm_cd_table - Common Coredump table
43  * @version:            Version of coredump structure
44  * @list:               Coredump list structure
45  */
46 struct iosm_cd_table {
47 	__le32 version;
48 	struct iosm_cd_list list;
49 } __packed;
50 
51 int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
52 			 u32 region_size);
53 
54 int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd);
55 
56 #endif /* _IOSM_IPC_COREDUMP_H_ */
57