xref: /aosp_15_r20/external/mesa3d/src/freedreno/decode/crashdec.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2021 Google, Inc.
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef __CRASHDEC_H__
7 #define __CRASHDEC_H__
8 
9 #include <assert.h>
10 #include <getopt.h>
11 #include <inttypes.h>
12 #include <stdarg.h>
13 #include <stdbool.h>
14 #include <stdint.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <unistd.h>
19 
20 #include "freedreno_pm4.h"
21 
22 #include "ir3/instr-a3xx.h"
23 #include "buffers.h"
24 #include "cffdec.h"
25 #include "disasm.h"
26 #include "pager.h"
27 #include "rnnutil.h"
28 #include "util.h"
29 
30 extern struct rnn *rnn_gmu;
31 extern struct rnn *rnn_control;
32 extern struct rnn *rnn_pipe;
33 
34 extern bool verbose;
35 
36 extern struct cffdec_options options;
37 
38 static inline bool
have_rem_info(void)39 have_rem_info(void)
40 {
41    return options.info->chip == 6 || options.info->chip == 7;
42 }
43 
44 static inline bool
is_a7xx(void)45 is_a7xx(void)
46 {
47    return options.info->chip == 7;
48 }
49 
50 static inline bool
is_a6xx(void)51 is_a6xx(void)
52 {
53    return options.info->chip == 6;
54 }
55 
56 static inline bool
is_a5xx(void)57 is_a5xx(void)
58 {
59    return options.info->chip == 5;
60 }
61 
62 static inline bool
is_64b(void)63 is_64b(void)
64 {
65    return options.info->chip >= 5;
66 }
67 
68 static inline bool
is_gmu_legacy(void)69 is_gmu_legacy(void)
70 {
71    switch (options.dev_id.gpu_id) {
72    case 615:
73    case 618:
74    case 630:
75       return true;
76    default:
77       return false;
78    }
79 }
80 
81 void dump_register(struct regacc *r);
82 void dump_cp_mem_pool(uint32_t *mempool);
83 void handle_prefetch(uint32_t *dwords, uint32_t sizedwords);
84 
85 struct a6xx_hfi_state {
86    uint64_t iova;
87    void *buf;
88    uint32_t size;
89    int32_t history[2][8];
90 };
91 void dump_gmu_hfi(struct a6xx_hfi_state *hfi);
92 
93 #endif /* __CRASHDEC_H__ */
94