GNU Linux-libre 6.8.9-gnu
[releases.git] / drivers / accel / ivpu / ivpu_fw_log.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020-2023 Intel Corporation
4  */
5
6 #ifndef __IVPU_FW_LOG_H__
7 #define __IVPU_FW_LOG_H__
8
9 #include <linux/types.h>
10
11 #include <drm/drm_print.h>
12
13 #include "ivpu_drv.h"
14
15 #define IVPU_FW_LOG_DEFAULT 0
16 #define IVPU_FW_LOG_DEBUG   1
17 #define IVPU_FW_LOG_INFO    2
18 #define IVPU_FW_LOG_WARN    3
19 #define IVPU_FW_LOG_ERROR   4
20 #define IVPU_FW_LOG_FATAL   5
21
22 extern unsigned int ivpu_log_level;
23
24 #define IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE       SZ_1M
25 #define IVPU_FW_VERBOSE_BUFFER_LARGE_SIZE       SZ_8M
26 #define IVPU_FW_CRITICAL_BUFFER_SIZE            SZ_512K
27
28 void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p);
29 void ivpu_fw_log_clear(struct ivpu_device *vdev);
30
31 static inline void ivpu_fw_log_dump(struct ivpu_device *vdev)
32 {
33         struct drm_printer p = drm_info_printer(vdev->drm.dev);
34
35         ivpu_fw_log_print(vdev, false, &p);
36 }
37
38 #endif /* __IVPU_FW_LOG_H__ */