![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* 0003 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. 0004 */ 0005 0006 #ifndef MSM_DISP_SNAPSHOT_H_ 0007 #define MSM_DISP_SNAPSHOT_H_ 0008 0009 #include <drm/drm_atomic_helper.h> 0010 #include <drm/drm_device.h> 0011 #include "../../../drm_crtc_internal.h" 0012 #include <drm/drm_print.h> 0013 #include <drm/drm_atomic.h> 0014 #include <linux/debugfs.h> 0015 #include <linux/list.h> 0016 #include <linux/delay.h> 0017 #include <linux/spinlock.h> 0018 #include <linux/ktime.h> 0019 #include <linux/uaccess.h> 0020 #include <linux/dma-buf.h> 0021 #include <linux/slab.h> 0022 #include <linux/list_sort.h> 0023 #include <linux/pm.h> 0024 #include <linux/pm_runtime.h> 0025 #include <linux/kthread.h> 0026 #include <linux/devcoredump.h> 0027 #include "msm_kms.h" 0028 0029 #define MSM_DISP_SNAPSHOT_MAX_BLKS 10 0030 0031 /* debug option to print the registers in logs */ 0032 #define MSM_DISP_SNAPSHOT_DUMP_IN_CONSOLE 0 0033 0034 /* print debug ranges in groups of 4 u32s */ 0035 #define REG_DUMP_ALIGN 16 0036 0037 /** 0038 * struct msm_disp_state - structure to store current dpu state 0039 * @dev: device pointer 0040 * @drm_dev: drm device pointer 0041 * @atomic_state: atomic state duplicated at the time of the error 0042 * @time: timestamp at which the coredump was captured 0043 */ 0044 struct msm_disp_state { 0045 struct device *dev; 0046 struct drm_device *drm_dev; 0047 0048 struct list_head blocks; 0049 0050 struct drm_atomic_state *atomic_state; 0051 0052 struct timespec64 time; 0053 }; 0054 0055 /** 0056 * struct msm_disp_state_block - structure to store each hardware block state 0057 * @name: name of the block 0058 * @drm_dev: handle to the linked list head 0059 * @size: size of the register space of this hardware block 0060 * @state: array holding the register dump of this hardware block 0061 * @base_addr: starting address of this hardware block's register space 0062 */ 0063 struct msm_disp_state_block { 0064 char name[SZ_128]; 0065 struct list_head node; 0066 unsigned int size; 0067 u32 *state; 0068 void __iomem *base_addr; 0069 }; 0070 0071 /** 0072 * msm_disp_snapshot_init - initialize display snapshot 0073 * @drm_dev: drm device handle 0074 * 0075 * Returns: 0 or -ERROR 0076 */ 0077 int msm_disp_snapshot_init(struct drm_device *drm_dev); 0078 0079 /** 0080 * msm_disp_snapshot_destroy - destroy the display snapshot 0081 * @drm_dev: drm device handle 0082 * 0083 * Returns: none 0084 */ 0085 void msm_disp_snapshot_destroy(struct drm_device *drm_dev); 0086 0087 /** 0088 * msm_disp_snapshot_state_sync - synchronously snapshot display state 0089 * @kms: the kms object 0090 * 0091 * Returns state or error 0092 * 0093 * Must be called with &kms->dump_mutex held 0094 */ 0095 struct msm_disp_state *msm_disp_snapshot_state_sync(struct msm_kms *kms); 0096 0097 /** 0098 * msm_disp_snapshot_state - trigger to dump the display snapshot 0099 * @drm_dev: handle to drm device 0100 0101 * Returns: none 0102 */ 0103 void msm_disp_snapshot_state(struct drm_device *drm_dev); 0104 0105 /** 0106 * msm_disp_state_print - print out the current dpu state 0107 * @disp_state: handle to drm device 0108 * @p: handle to drm printer 0109 * 0110 * Returns: none 0111 */ 0112 void msm_disp_state_print(struct msm_disp_state *disp_state, struct drm_printer *p); 0113 0114 /** 0115 * msm_disp_snapshot_capture_state - utility to capture atomic state and hw registers 0116 * @disp_state: handle to msm_disp_state struct 0117 0118 * Returns: none 0119 */ 0120 void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state); 0121 0122 /** 0123 * msm_disp_state_free - free the memory after the coredump has been read 0124 * @data: handle to struct msm_disp_state 0125 0126 * Returns: none 0127 */ 0128 void msm_disp_state_free(void *data); 0129 0130 /** 0131 * msm_disp_snapshot_add_block - add a hardware block with its register dump 0132 * @disp_state: handle to struct msm_disp_state 0133 * @name: name of the hardware block 0134 * @len: size of the register space of the hardware block 0135 * @base_addr: starting address of the register space of the hardware block 0136 * @fmt: format in which the block names need to be printed 0137 * 0138 * Returns: none 0139 */ 0140 __printf(4, 5) 0141 void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len, 0142 void __iomem *base_addr, const char *fmt, ...); 0143 0144 #endif /* MSM_DISP_SNAPSHOT_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |