xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_firmware_log.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2022 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 #ifndef _KBASE_CSF_FIRMWARE_LOG_H_
23 #define _KBASE_CSF_FIRMWARE_LOG_H_
24 
25 #include <mali_kbase.h>
26 
27 /** Offset of the last field of functions call list entry from the image header */
28 #define FUNC_CALL_LIST_ENTRY_NAME_OFFSET (0x8)
29 
30 /*
31  * Firmware log dumping buffer size.
32  */
33 #define FIRMWARE_LOG_DUMP_BUF_SIZE PAGE_SIZE
34 
35 /**
36  * kbase_csf_firmware_log_init - Initialize firmware log handling.
37  *
38  * @kbdev: Pointer to the Kbase device
39  *
40  * Return: The initialization error code.
41  */
42 int kbase_csf_firmware_log_init(struct kbase_device *kbdev);
43 
44 /**
45  * kbase_csf_firmware_log_term - Terminate firmware log handling.
46  *
47  * @kbdev: Pointer to the Kbase device
48  */
49 void kbase_csf_firmware_log_term(struct kbase_device *kbdev);
50 
51 /**
52  * kbase_csf_firmware_log_dump_buffer - Read remaining data in the firmware log
53  *                                  buffer and print it to dmesg.
54  *
55  * @kbdev: Pointer to the Kbase device
56  */
57 void kbase_csf_firmware_log_dump_buffer(struct kbase_device *kbdev);
58 
59 /**
60  * kbase_csf_firmware_log_parse_logging_call_list_entry - Parse FW logging function call list entry.
61  *
62  * @kbdev: Instance of a GPU platform device that implements a CSF interface.
63  * @entry: Pointer to section.
64  */
65 void kbase_csf_firmware_log_parse_logging_call_list_entry(struct kbase_device *kbdev,
66 							  const uint32_t *entry);
67 /**
68  * kbase_csf_firmware_log_toggle_logging_calls - Enables/Disables FW logging function calls.
69  *
70  * @kbdev:  Instance of a GPU platform device that implements a CSF interface.
71  * @val:    Configuration option value.
72  *
73  * Return: 0 if successful, negative error code on failure
74  */
75 int kbase_csf_firmware_log_toggle_logging_calls(struct kbase_device *kbdev, u32 val);
76 
77 #endif /* _KBASE_CSF_FIRMWARE_LOG_H_ */
78