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 #include "dmub/dmub_srv_stat.h"
0027 #include "dmub/inc/dmub_cmd.h"
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 enum dmub_status dmub_srv_stat_get_notification(struct dmub_srv *dmub,
0047 struct dmub_notification *notify)
0048 {
0049
0050
0051
0052
0053
0054 union dmub_rb_out_cmd cmd = {0};
0055
0056 if (!dmub->hw_init) {
0057 notify->type = DMUB_NOTIFICATION_NO_DATA;
0058 notify->pending_notification = false;
0059 return DMUB_STATUS_INVALID;
0060 }
0061
0062
0063 dmub->outbox1_rb.wrpt = dmub->hw_funcs.get_outbox1_wptr(dmub);
0064
0065 if (!dmub_rb_out_front(&dmub->outbox1_rb, &cmd)) {
0066 notify->type = DMUB_NOTIFICATION_NO_DATA;
0067 notify->pending_notification = false;
0068 return DMUB_STATUS_OK;
0069 }
0070
0071 switch (cmd.cmd_common.header.type) {
0072 case DMUB_OUT_CMD__DP_AUX_REPLY:
0073 notify->type = DMUB_NOTIFICATION_AUX_REPLY;
0074 notify->link_index = cmd.dp_aux_reply.control.instance;
0075 notify->result = cmd.dp_aux_reply.control.result;
0076 dmub_memcpy((void *)¬ify->aux_reply,
0077 (void *)&cmd.dp_aux_reply.reply_data, sizeof(struct aux_reply_data));
0078 break;
0079 case DMUB_OUT_CMD__DP_HPD_NOTIFY:
0080 if (cmd.dp_hpd_notify.hpd_data.hpd_type == DP_HPD) {
0081 notify->type = DMUB_NOTIFICATION_HPD;
0082 notify->hpd_status = cmd.dp_hpd_notify.hpd_data.hpd_status;
0083 } else {
0084 notify->type = DMUB_NOTIFICATION_HPD_IRQ;
0085 }
0086
0087 notify->link_index = cmd.dp_hpd_notify.hpd_data.instance;
0088 notify->result = AUX_RET_SUCCESS;
0089 break;
0090 case DMUB_OUT_CMD__SET_CONFIG_REPLY:
0091 notify->type = DMUB_NOTIFICATION_SET_CONFIG_REPLY;
0092 notify->link_index = cmd.set_config_reply.set_config_reply_control.instance;
0093 notify->sc_status = cmd.set_config_reply.set_config_reply_control.status;
0094 break;
0095 default:
0096 notify->type = DMUB_NOTIFICATION_NO_DATA;
0097 break;
0098 }
0099
0100
0101 dmub_rb_pop_front(&dmub->outbox1_rb);
0102 dmub->hw_funcs.set_outbox1_rptr(dmub, dmub->outbox1_rb.rptr);
0103
0104
0105
0106
0107
0108 if (dmub_rb_empty(&dmub->outbox1_rb))
0109 notify->pending_notification = false;
0110 else
0111 notify->pending_notification = true;
0112
0113 return DMUB_STATUS_OK;
0114 }