1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __AMDGPU_NBIO_H__
24#define __AMDGPU_NBIO_H__
25
26
27
28
29struct nbio_hdp_flush_reg {
30 u32 ref_and_mask_cp0;
31 u32 ref_and_mask_cp1;
32 u32 ref_and_mask_cp2;
33 u32 ref_and_mask_cp3;
34 u32 ref_and_mask_cp4;
35 u32 ref_and_mask_cp5;
36 u32 ref_and_mask_cp6;
37 u32 ref_and_mask_cp7;
38 u32 ref_and_mask_cp8;
39 u32 ref_and_mask_cp9;
40 u32 ref_and_mask_sdma0;
41 u32 ref_and_mask_sdma1;
42 u32 ref_and_mask_sdma2;
43 u32 ref_and_mask_sdma3;
44 u32 ref_and_mask_sdma4;
45 u32 ref_and_mask_sdma5;
46 u32 ref_and_mask_sdma6;
47 u32 ref_and_mask_sdma7;
48};
49
50struct amdgpu_nbio_ras_funcs {
51 void (*handle_ras_controller_intr_no_bifring)(struct amdgpu_device *adev);
52 void (*handle_ras_err_event_athub_intr_no_bifring)(struct amdgpu_device *adev);
53 int (*init_ras_controller_interrupt)(struct amdgpu_device *adev);
54 int (*init_ras_err_event_athub_interrupt)(struct amdgpu_device *adev);
55 void (*query_ras_error_count)(struct amdgpu_device *adev,
56 void *ras_error_status);
57 int (*ras_late_init)(struct amdgpu_device *adev);
58 void (*ras_fini)(struct amdgpu_device *adev);
59};
60
61struct amdgpu_nbio_funcs {
62 const struct nbio_hdp_flush_reg *hdp_flush_reg;
63 u32 (*get_hdp_flush_req_offset)(struct amdgpu_device *adev);
64 u32 (*get_hdp_flush_done_offset)(struct amdgpu_device *adev);
65 u32 (*get_pcie_index_offset)(struct amdgpu_device *adev);
66 u32 (*get_pcie_data_offset)(struct amdgpu_device *adev);
67 u32 (*get_pcie_port_index_offset)(struct amdgpu_device *adev);
68 u32 (*get_pcie_port_data_offset)(struct amdgpu_device *adev);
69 u32 (*get_rev_id)(struct amdgpu_device *adev);
70 void (*mc_access_enable)(struct amdgpu_device *adev, bool enable);
71 u32 (*get_memsize)(struct amdgpu_device *adev);
72 void (*sdma_doorbell_range)(struct amdgpu_device *adev, int instance,
73 bool use_doorbell, int doorbell_index, int doorbell_size);
74 void (*vcn_doorbell_range)(struct amdgpu_device *adev, bool use_doorbell,
75 int doorbell_index, int instance);
76 void (*enable_doorbell_aperture)(struct amdgpu_device *adev,
77 bool enable);
78 void (*enable_doorbell_selfring_aperture)(struct amdgpu_device *adev,
79 bool enable);
80 void (*ih_doorbell_range)(struct amdgpu_device *adev,
81 bool use_doorbell, int doorbell_index);
82 void (*enable_doorbell_interrupt)(struct amdgpu_device *adev,
83 bool enable);
84 void (*update_medium_grain_clock_gating)(struct amdgpu_device *adev,
85 bool enable);
86 void (*update_medium_grain_light_sleep)(struct amdgpu_device *adev,
87 bool enable);
88 void (*get_clockgating_state)(struct amdgpu_device *adev,
89 u32 *flags);
90 void (*ih_control)(struct amdgpu_device *adev);
91 void (*init_registers)(struct amdgpu_device *adev);
92 void (*remap_hdp_registers)(struct amdgpu_device *adev);
93 void (*enable_aspm)(struct amdgpu_device *adev,
94 bool enable);
95 void (*program_aspm)(struct amdgpu_device *adev);
96 void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev);
97 void (*apply_l1_link_width_reconfig_wa)(struct amdgpu_device *adev);
98};
99
100struct amdgpu_nbio {
101 const struct nbio_hdp_flush_reg *hdp_flush_reg;
102 struct amdgpu_irq_src ras_controller_irq;
103 struct amdgpu_irq_src ras_err_event_athub_irq;
104 struct ras_common_if *ras_if;
105 const struct amdgpu_nbio_funcs *funcs;
106 const struct amdgpu_nbio_ras_funcs *ras_funcs;
107};
108
109int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev);
110void amdgpu_nbio_ras_fini(struct amdgpu_device *adev);
111#endif
112