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 number of file entries */
18 #define MAX_NOF_ENTRY 256
19 
20 /* Max length */
21 #define MAX_SIZE_LEN 32
22 
23 /**
24  * struct iosm_cd_list_entry - Structure to hold coredump file info.
25  * @size:       Number of bytes for the entry
26  * @filename:   Coredump filename to be generated on host
27  */
28 struct iosm_cd_list_entry {
29 	__le32 size;
30 	char filename[IOSM_MAX_FILENAME_LEN];
31 } __packed;
32 
33 /**
34  * struct iosm_cd_list - Structure to hold list of coredump files
35  *                      to be collected.
36  * @num_entries:        Number of entries to be received
37  * @entry:              Contains File info
38  */
39 struct iosm_cd_list {
40 	__le32 num_entries;
41 	struct iosm_cd_list_entry entry[MAX_NOF_ENTRY];
42 } __packed;
43 
44 /**
45  * struct iosm_cd_table - Common Coredump table
46  * @version:            Version of coredump structure
47  * @list:               Coredump list structure
48  */
49 struct iosm_cd_table {
50 	__le32 version;
51 	struct iosm_cd_list list;
52 } __packed;
53 
54 int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
55 			 u32 region_size);
56 
57 int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd);
58 
59 #endif /* _IOSM_IPC_COREDUMP_H_ */
60