0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef _DMUB_DCN20_H_
0027 #define _DMUB_DCN20_H_
0028
0029 #include "../inc/dmub_cmd.h"
0030
0031 struct dmub_srv;
0032
0033
0034
0035 #define DMUB_COMMON_REGS() \
0036 DMUB_SR(DMCUB_CNTL) \
0037 DMUB_SR(DMCUB_MEM_CNTL) \
0038 DMUB_SR(DMCUB_SEC_CNTL) \
0039 DMUB_SR(DMCUB_INBOX0_SIZE) \
0040 DMUB_SR(DMCUB_INBOX0_RPTR) \
0041 DMUB_SR(DMCUB_INBOX0_WPTR) \
0042 DMUB_SR(DMCUB_INBOX1_BASE_ADDRESS) \
0043 DMUB_SR(DMCUB_INBOX1_SIZE) \
0044 DMUB_SR(DMCUB_INBOX1_RPTR) \
0045 DMUB_SR(DMCUB_INBOX1_WPTR) \
0046 DMUB_SR(DMCUB_OUTBOX0_BASE_ADDRESS) \
0047 DMUB_SR(DMCUB_OUTBOX0_SIZE) \
0048 DMUB_SR(DMCUB_OUTBOX0_RPTR) \
0049 DMUB_SR(DMCUB_OUTBOX0_WPTR) \
0050 DMUB_SR(DMCUB_OUTBOX1_BASE_ADDRESS) \
0051 DMUB_SR(DMCUB_OUTBOX1_SIZE) \
0052 DMUB_SR(DMCUB_OUTBOX1_RPTR) \
0053 DMUB_SR(DMCUB_OUTBOX1_WPTR) \
0054 DMUB_SR(DMCUB_REGION3_CW0_OFFSET) \
0055 DMUB_SR(DMCUB_REGION3_CW1_OFFSET) \
0056 DMUB_SR(DMCUB_REGION3_CW2_OFFSET) \
0057 DMUB_SR(DMCUB_REGION3_CW3_OFFSET) \
0058 DMUB_SR(DMCUB_REGION3_CW4_OFFSET) \
0059 DMUB_SR(DMCUB_REGION3_CW5_OFFSET) \
0060 DMUB_SR(DMCUB_REGION3_CW6_OFFSET) \
0061 DMUB_SR(DMCUB_REGION3_CW7_OFFSET) \
0062 DMUB_SR(DMCUB_REGION3_CW0_OFFSET_HIGH) \
0063 DMUB_SR(DMCUB_REGION3_CW1_OFFSET_HIGH) \
0064 DMUB_SR(DMCUB_REGION3_CW2_OFFSET_HIGH) \
0065 DMUB_SR(DMCUB_REGION3_CW3_OFFSET_HIGH) \
0066 DMUB_SR(DMCUB_REGION3_CW4_OFFSET_HIGH) \
0067 DMUB_SR(DMCUB_REGION3_CW5_OFFSET_HIGH) \
0068 DMUB_SR(DMCUB_REGION3_CW6_OFFSET_HIGH) \
0069 DMUB_SR(DMCUB_REGION3_CW7_OFFSET_HIGH) \
0070 DMUB_SR(DMCUB_REGION3_CW0_BASE_ADDRESS) \
0071 DMUB_SR(DMCUB_REGION3_CW1_BASE_ADDRESS) \
0072 DMUB_SR(DMCUB_REGION3_CW2_BASE_ADDRESS) \
0073 DMUB_SR(DMCUB_REGION3_CW3_BASE_ADDRESS) \
0074 DMUB_SR(DMCUB_REGION3_CW4_BASE_ADDRESS) \
0075 DMUB_SR(DMCUB_REGION3_CW5_BASE_ADDRESS) \
0076 DMUB_SR(DMCUB_REGION3_CW6_BASE_ADDRESS) \
0077 DMUB_SR(DMCUB_REGION3_CW7_BASE_ADDRESS) \
0078 DMUB_SR(DMCUB_REGION3_CW0_TOP_ADDRESS) \
0079 DMUB_SR(DMCUB_REGION3_CW1_TOP_ADDRESS) \
0080 DMUB_SR(DMCUB_REGION3_CW2_TOP_ADDRESS) \
0081 DMUB_SR(DMCUB_REGION3_CW3_TOP_ADDRESS) \
0082 DMUB_SR(DMCUB_REGION3_CW4_TOP_ADDRESS) \
0083 DMUB_SR(DMCUB_REGION3_CW5_TOP_ADDRESS) \
0084 DMUB_SR(DMCUB_REGION3_CW6_TOP_ADDRESS) \
0085 DMUB_SR(DMCUB_REGION3_CW7_TOP_ADDRESS) \
0086 DMUB_SR(DMCUB_REGION4_OFFSET) \
0087 DMUB_SR(DMCUB_REGION4_OFFSET_HIGH) \
0088 DMUB_SR(DMCUB_REGION4_TOP_ADDRESS) \
0089 DMUB_SR(DMCUB_REGION5_OFFSET) \
0090 DMUB_SR(DMCUB_REGION5_OFFSET_HIGH) \
0091 DMUB_SR(DMCUB_REGION5_TOP_ADDRESS) \
0092 DMUB_SR(DMCUB_SCRATCH0) \
0093 DMUB_SR(DMCUB_SCRATCH1) \
0094 DMUB_SR(DMCUB_SCRATCH2) \
0095 DMUB_SR(DMCUB_SCRATCH3) \
0096 DMUB_SR(DMCUB_SCRATCH4) \
0097 DMUB_SR(DMCUB_SCRATCH5) \
0098 DMUB_SR(DMCUB_SCRATCH6) \
0099 DMUB_SR(DMCUB_SCRATCH7) \
0100 DMUB_SR(DMCUB_SCRATCH8) \
0101 DMUB_SR(DMCUB_SCRATCH9) \
0102 DMUB_SR(DMCUB_SCRATCH10) \
0103 DMUB_SR(DMCUB_SCRATCH11) \
0104 DMUB_SR(DMCUB_SCRATCH12) \
0105 DMUB_SR(DMCUB_SCRATCH13) \
0106 DMUB_SR(DMCUB_SCRATCH14) \
0107 DMUB_SR(DMCUB_SCRATCH15) \
0108 DMUB_SR(DMCUB_GPINT_DATAIN1) \
0109 DMUB_SR(CC_DC_PIPE_DIS) \
0110 DMUB_SR(MMHUBBUB_SOFT_RESET) \
0111 DMUB_SR(DCN_VM_FB_LOCATION_BASE) \
0112 DMUB_SR(DCN_VM_FB_OFFSET) \
0113 DMUB_SR(DMCUB_INTERRUPT_ACK) \
0114 DMUB_SR(DMCUB_TIMER_CURRENT) \
0115 DMUB_SR(DMCUB_INST_FETCH_FAULT_ADDR) \
0116 DMUB_SR(DMCUB_UNDEFINED_ADDRESS_FAULT_ADDR) \
0117 DMUB_SR(DMCUB_DATA_WRITE_FAULT_ADDR)
0118
0119 #define DMCUB_INTERNAL_REGS()
0120
0121 #define DMUB_COMMON_FIELDS() \
0122 DMUB_SF(DMCUB_CNTL, DMCUB_ENABLE) \
0123 DMUB_SF(DMCUB_CNTL, DMCUB_SOFT_RESET) \
0124 DMUB_SF(DMCUB_CNTL, DMCUB_TRACEPORT_EN) \
0125 DMUB_SF(DMCUB_MEM_CNTL, DMCUB_MEM_READ_SPACE) \
0126 DMUB_SF(DMCUB_MEM_CNTL, DMCUB_MEM_WRITE_SPACE) \
0127 DMUB_SF(DMCUB_SEC_CNTL, DMCUB_SEC_RESET) \
0128 DMUB_SF(DMCUB_SEC_CNTL, DMCUB_MEM_UNIT_ID) \
0129 DMUB_SF(DMCUB_SEC_CNTL, DMCUB_SEC_RESET_STATUS) \
0130 DMUB_SF(DMCUB_REGION3_CW0_TOP_ADDRESS, DMCUB_REGION3_CW0_TOP_ADDRESS) \
0131 DMUB_SF(DMCUB_REGION3_CW0_TOP_ADDRESS, DMCUB_REGION3_CW0_ENABLE) \
0132 DMUB_SF(DMCUB_REGION3_CW1_TOP_ADDRESS, DMCUB_REGION3_CW1_TOP_ADDRESS) \
0133 DMUB_SF(DMCUB_REGION3_CW1_TOP_ADDRESS, DMCUB_REGION3_CW1_ENABLE) \
0134 DMUB_SF(DMCUB_REGION3_CW2_TOP_ADDRESS, DMCUB_REGION3_CW2_TOP_ADDRESS) \
0135 DMUB_SF(DMCUB_REGION3_CW2_TOP_ADDRESS, DMCUB_REGION3_CW2_ENABLE) \
0136 DMUB_SF(DMCUB_REGION3_CW3_TOP_ADDRESS, DMCUB_REGION3_CW3_TOP_ADDRESS) \
0137 DMUB_SF(DMCUB_REGION3_CW3_TOP_ADDRESS, DMCUB_REGION3_CW3_ENABLE) \
0138 DMUB_SF(DMCUB_REGION3_CW4_TOP_ADDRESS, DMCUB_REGION3_CW4_TOP_ADDRESS) \
0139 DMUB_SF(DMCUB_REGION3_CW4_TOP_ADDRESS, DMCUB_REGION3_CW4_ENABLE) \
0140 DMUB_SF(DMCUB_REGION3_CW5_TOP_ADDRESS, DMCUB_REGION3_CW5_TOP_ADDRESS) \
0141 DMUB_SF(DMCUB_REGION3_CW5_TOP_ADDRESS, DMCUB_REGION3_CW5_ENABLE) \
0142 DMUB_SF(DMCUB_REGION3_CW6_TOP_ADDRESS, DMCUB_REGION3_CW6_TOP_ADDRESS) \
0143 DMUB_SF(DMCUB_REGION3_CW6_TOP_ADDRESS, DMCUB_REGION3_CW6_ENABLE) \
0144 DMUB_SF(DMCUB_REGION3_CW7_TOP_ADDRESS, DMCUB_REGION3_CW7_TOP_ADDRESS) \
0145 DMUB_SF(DMCUB_REGION3_CW7_TOP_ADDRESS, DMCUB_REGION3_CW7_ENABLE) \
0146 DMUB_SF(DMCUB_REGION4_TOP_ADDRESS, DMCUB_REGION4_TOP_ADDRESS) \
0147 DMUB_SF(DMCUB_REGION4_TOP_ADDRESS, DMCUB_REGION4_ENABLE) \
0148 DMUB_SF(DMCUB_REGION5_TOP_ADDRESS, DMCUB_REGION5_TOP_ADDRESS) \
0149 DMUB_SF(DMCUB_REGION5_TOP_ADDRESS, DMCUB_REGION5_ENABLE) \
0150 DMUB_SF(CC_DC_PIPE_DIS, DC_DMCUB_ENABLE) \
0151 DMUB_SF(MMHUBBUB_SOFT_RESET, DMUIF_SOFT_RESET) \
0152 DMUB_SF(DCN_VM_FB_LOCATION_BASE, FB_BASE) \
0153 DMUB_SF(DCN_VM_FB_OFFSET, FB_OFFSET) \
0154 DMUB_SF(DMCUB_INTERRUPT_ACK, DMCUB_OUTBOX0_READY_INT_ACK)
0155
0156 struct dmub_srv_common_reg_offset {
0157 #define DMUB_SR(reg) uint32_t reg;
0158 DMUB_COMMON_REGS()
0159 DMCUB_INTERNAL_REGS()
0160 #undef DMUB_SR
0161 };
0162
0163 struct dmub_srv_common_reg_shift {
0164 #define DMUB_SF(reg, field) uint8_t reg##__##field;
0165 DMUB_COMMON_FIELDS()
0166 #undef DMUB_SF
0167 };
0168
0169 struct dmub_srv_common_reg_mask {
0170 #define DMUB_SF(reg, field) uint32_t reg##__##field;
0171 DMUB_COMMON_FIELDS()
0172 #undef DMUB_SF
0173 };
0174
0175 struct dmub_srv_common_regs {
0176 const struct dmub_srv_common_reg_offset offset;
0177 const struct dmub_srv_common_reg_mask mask;
0178 const struct dmub_srv_common_reg_shift shift;
0179 };
0180
0181 extern const struct dmub_srv_common_regs dmub_srv_dcn20_regs;
0182
0183
0184
0185 void dmub_dcn20_init(struct dmub_srv *dmub);
0186
0187 void dmub_dcn20_reset(struct dmub_srv *dmub);
0188
0189 void dmub_dcn20_reset_release(struct dmub_srv *dmub);
0190
0191 void dmub_dcn20_backdoor_load(struct dmub_srv *dmub,
0192 const struct dmub_window *cw0,
0193 const struct dmub_window *cw1);
0194
0195 void dmub_dcn20_setup_windows(struct dmub_srv *dmub,
0196 const struct dmub_window *cw2,
0197 const struct dmub_window *cw3,
0198 const struct dmub_window *cw4,
0199 const struct dmub_window *cw5,
0200 const struct dmub_window *cw6);
0201
0202 void dmub_dcn20_setup_mailbox(struct dmub_srv *dmub,
0203 const struct dmub_region *inbox1);
0204
0205 uint32_t dmub_dcn20_get_inbox1_rptr(struct dmub_srv *dmub);
0206
0207 void dmub_dcn20_set_inbox1_wptr(struct dmub_srv *dmub, uint32_t wptr_offset);
0208
0209 void dmub_dcn20_setup_out_mailbox(struct dmub_srv *dmub,
0210 const struct dmub_region *outbox1);
0211
0212 uint32_t dmub_dcn20_get_outbox1_wptr(struct dmub_srv *dmub);
0213
0214 void dmub_dcn20_set_outbox1_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);
0215
0216 void dmub_dcn20_setup_outbox0(struct dmub_srv *dmub,
0217 const struct dmub_region *outbox0);
0218
0219 uint32_t dmub_dcn20_get_outbox0_wptr(struct dmub_srv *dmub);
0220
0221 void dmub_dcn20_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);
0222
0223 bool dmub_dcn20_is_hw_init(struct dmub_srv *dmub);
0224
0225 bool dmub_dcn20_is_supported(struct dmub_srv *dmub);
0226
0227 void dmub_dcn20_set_gpint(struct dmub_srv *dmub,
0228 union dmub_gpint_data_register reg);
0229
0230 bool dmub_dcn20_is_gpint_acked(struct dmub_srv *dmub,
0231 union dmub_gpint_data_register reg);
0232
0233 uint32_t dmub_dcn20_get_gpint_response(struct dmub_srv *dmub);
0234
0235 void dmub_dcn20_enable_dmub_boot_options(struct dmub_srv *dmub, const struct dmub_srv_hw_params *params);
0236
0237 void dmub_dcn20_skip_dmub_panel_power_sequence(struct dmub_srv *dmub, bool skip);
0238
0239 union dmub_fw_boot_status dmub_dcn20_get_fw_boot_status(struct dmub_srv *dmub);
0240
0241 bool dmub_dcn20_use_cached_inbox(struct dmub_srv *dmub);
0242
0243 bool dmub_dcn20_use_cached_trace_buffer(struct dmub_srv *dmub);
0244
0245 uint32_t dmub_dcn20_get_current_time(struct dmub_srv *dmub);
0246
0247 void dmub_dcn20_get_diagnostic_data(struct dmub_srv *dmub, struct dmub_diagnostic_data *dmub_oca);
0248
0249 #endif