Commit 8af54c61 authored by Mustapha Ghaddar's avatar Mustapha Ghaddar Committed by Alex Deucher
Browse files

drm/amd/display: Update dmub header to match DMUB



[WHY]
Last PR missed name of a struct to match in DMUB

[HOW]
Update the logic in dmub_cmh.h header

Tested-by: default avatarDaniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: default avatarMeenakshikumar Somasundaram <Meenakshikumar.Somasundaram@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarMustapha Ghaddar <mghaddar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 60b73429
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -130,6 +130,17 @@ enum dmub_notification_type {
	DMUB_NOTIFICATION_MAX
};

/**
 * DPIA NOTIFICATION Response Type
 */
enum dpia_notify_bw_alloc_status {

	DPIA_BW_REQ_FAILED = 0,
	DPIA_BW_REQ_SUCCESS,
	DPIA_EST_BW_CHANGED,
	DPIA_BW_ALLOC_CAPS_CHANGED
};

/**
 * struct dmub_region - dmub hw memory region
 * @base: base address for region, must be 256 byte aligned
@@ -465,7 +476,10 @@ struct dmub_notification {
		struct aux_reply_data aux_reply;
		enum dp_hpd_status hpd_status;
		enum set_config_status sc_status;
		struct dpia_notification_reply_data bw_alloc_reply;
		/**
		 * DPIA notification command.
		 */
		struct dmub_rb_cmd_dpia_notification dpia_notification;
	};
};

+84 −81
Original line number Diff line number Diff line
@@ -770,7 +770,10 @@ enum dmub_out_cmd_type {
	 * Command type used for SET_CONFIG Reply notification
	 */
	DMUB_OUT_CMD__SET_CONFIG_REPLY = 3,
	DMUB_OUT_CMD__DPIA_NOTIFICATION = 5
	/**
	 * Command type used for USB4 DPIA notification
	 */
	DMUB_OUT_CMD__DPIA_NOTIFICATION = 5,
};

/* DMUB_CMD__DPIA command sub-types. */
@@ -780,6 +783,11 @@ enum dmub_cmd_dpia_type {
	DMUB_CMD__DPIA_MST_ALLOC_SLOTS = 2,
};

/* DMUB_OUT_CMD__DPIA_NOTIFICATION command types. */
enum dmub_cmd_dpia_notification_type {
	DPIA_NOTIFY__BW_ALLOCATION = 0,
};

#pragma pack(push, 1)

/**
@@ -1518,29 +1526,66 @@ struct dp_hpd_data {
};

/**
 * DPIA NOTIFICATION Response Type
 * Definition of a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
 */
struct dmub_rb_cmd_dp_hpd_notify {
	/**
	 * Command header.
	 */
	struct dmub_cmd_header header;
	/**
	 * Data passed to driver from FW in a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
	 */
enum dpia_notify_bw_alloc_status {
	struct dp_hpd_data hpd_data;
};

	DPIA_BW_REQ_FAILED = 0,
	DPIA_BW_REQ_SUCCESS,
	DPIA_EST_BW_CHANGED,
	DPIA_BW_ALLOC_CAPS_CHANGED
/**
 * Definition of a SET_CONFIG reply from DPOA.
 */
enum set_config_status {
	SET_CONFIG_PENDING = 0,
	SET_CONFIG_ACK_RECEIVED,
	SET_CONFIG_RX_TIMEOUT,
	SET_CONFIG_UNKNOWN_ERROR,
};

/* DMUB_OUT_CMD__DPIA_NOTIFY Reply command - OutBox Cmd */
/**
 * Data passed to driver from FW in a DMUB_OUT_CMD__DPIA_NOTIFY command.
 * Definition of a set_config reply
 */
struct dpia_notification_reply_data {
	uint8_t allocated_bw;
	uint8_t estimated_bw;
struct set_config_reply_control_data {
	uint8_t instance; /* DPIA Instance */
	uint8_t status; /* Set Config reply */
	uint16_t pad; /* Alignment */
};

/**
 * Definition of a DMUB_OUT_CMD__SET_CONFIG_REPLY command.
 */
struct dmub_rb_cmd_dp_set_config_reply {
	struct dmub_cmd_header header;
	struct set_config_reply_control_data set_config_reply_control;
};

/**
 * Definition of a DPIA notification header
 */
struct dpia_notification_header {
	uint8_t instance; /**< DPIA Instance */
	uint8_t reserved[3];
	enum dmub_cmd_dpia_notification_type type; /**< DPIA notification type */
};

/**
 * Definition of the common data struct of DPIA notification
 */
struct dpia_notification_common {
	bool shared;
	uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)
								- sizeof(struct dpia_notification_header)];
};

/**
 * Definition of a DPIA notification data
 */
struct dpia_bw_allocation_notify_data {
	union {
		struct {
@@ -1549,10 +1594,12 @@ struct dpia_bw_allocation_notify_data {
			uint16_t bw_request_succeeded: 1; /**< BW_Request_Succeeded */
			uint16_t est_bw_changed: 1; /**< Estimated_BW changed */
			uint16_t bw_alloc_cap_changed: 1; /**< BW_Allocation_Capabiity_Changed */
			uint16_t reserved: 11;
			uint16_t reserved: 11; /**< Reserved */
		} bits;

		uint16_t flags;
	};

	uint8_t cm_id; /**< CM ID */
	uint8_t group_id; /**< Group ID */
	uint8_t granularity; /**< BW Allocation Granularity */
@@ -1561,79 +1608,35 @@ struct dpia_bw_allocation_notify_data {
	uint8_t reserved;
};

union dpia_notification_data {
	struct dpia_notification_common common_data;
	struct dpia_bw_allocation_notify_data dpia_bw_alloc;	/**< Used for DPIA BW Allocation mode notification */
};

enum dmub_cmd_dpia_notification_type {
	DPIA_NOTIFY__BW_ALLOCATION = 0,
};

struct dpia_notification_header {
	uint8_t instance;							/**< DPIA Instance */
	uint8_t reserved[3];
	enum dmub_cmd_dpia_notification_type type;	/**< DPIA notification type */
};

struct dpia_notification_payload {
	struct dpia_notification_header  header;
	union dpia_notification_data      data;   /**< DPIA notification data */
};

/**
 * Definition of a DMUB_OUT_CMD__DPIA_NOTIFY command.
 */
struct dmub_rb_cmd_dpia_notification {
	/**
	 * Command header.
	 */
	struct dmub_cmd_header header;  /**< DPIA notification header */
	/**
	 * Data passed to driver from FW in a DMUB_OUT_CMD__DPIA_NOTIFY command.
	 */
	struct dpia_notification_payload payload; /**< DPIA notification payload */
};

/**
 * Definition of a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
 */
struct dmub_rb_cmd_dp_hpd_notify {
/**
	 * Command header.
 * union dpia_notify_data_type - DPIA Notification in Outbox command
 */
	struct dmub_cmd_header header;
union dpia_notification_data {
	/**
	 * Data passed to driver from FW in a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
	 * DPIA Notification for common data struct
	 */
	struct dp_hpd_data hpd_data;
};
	struct dpia_notification_common common_data;

	/**
 * Definition of a SET_CONFIG reply from DPOA.
	 * DPIA Notification for DP BW Allocation support
	 */
enum set_config_status {
	SET_CONFIG_PENDING = 0,
	SET_CONFIG_ACK_RECEIVED,
	SET_CONFIG_RX_TIMEOUT,
	SET_CONFIG_UNKNOWN_ERROR,
	struct dpia_bw_allocation_notify_data dpia_bw_alloc;
};

/**
 * Definition of a set_config reply
 * Definition of a DPIA notification payload
 */
struct set_config_reply_control_data {
	uint8_t instance; /* DPIA Instance */
	uint8_t status; /* Set Config reply */
	uint16_t pad; /* Alignment */
struct dpia_notification_payload {
	struct dpia_notification_header header;
	union dpia_notification_data data; /**< DPIA notification payload data */
};

/**
 * Definition of a DMUB_OUT_CMD__SET_CONFIG_REPLY command.
 * Definition of a DMUB_OUT_CMD__DPIA_NOTIFICATION command.
 */
struct dmub_rb_cmd_dp_set_config_reply {
	struct dmub_cmd_header header;
	struct set_config_reply_control_data set_config_reply_control;
struct dmub_rb_cmd_dpia_notification {
	struct dmub_cmd_header header; /**< DPIA notification header */
	struct dpia_notification_payload payload; /**< DPIA notification payload */
};

/**
@@ -3502,9 +3505,9 @@ union dmub_rb_out_cmd {
	 */
	struct dmub_rb_cmd_dp_set_config_reply set_config_reply;
	/**
	 * BW ALLOCATION notification command.
	 * DPIA notification command.
	 */
	struct dmub_rb_cmd_dpia_notification dpia_notify;
	struct dmub_rb_cmd_dpia_notification dpia_notification;
};
#pragma pack(pop)

+10 −10
Original line number Diff line number Diff line
@@ -94,22 +94,22 @@ enum dmub_status dmub_srv_stat_get_notification(struct dmub_srv *dmub,
		break;
	case DMUB_OUT_CMD__DPIA_NOTIFICATION:
		notify->type = DMUB_NOTIFICATION_DPIA_NOTIFICATION;
		notify->link_index = cmd.dpia_notify.payload.header.instance;
		notify->link_index = cmd.dpia_notification.payload.header.instance;

		if (cmd.dpia_notify.payload.header.type == DPIA_NOTIFY__BW_ALLOCATION) {
		if (cmd.dpia_notification.payload.header.type == DPIA_NOTIFY__BW_ALLOCATION) {

			notify->bw_alloc_reply.estimated_bw =
					cmd.dpia_notify.payload.data.dpia_bw_alloc.estimated_bw;
			notify->bw_alloc_reply.allocated_bw =
					cmd.dpia_notify.payload.data.dpia_bw_alloc.allocated_bw;
			notify->dpia_notification.payload.data.dpia_bw_alloc.estimated_bw =
					cmd.dpia_notification.payload.data.dpia_bw_alloc.estimated_bw;
			notify->dpia_notification.payload.data.dpia_bw_alloc.allocated_bw =
					cmd.dpia_notification.payload.data.dpia_bw_alloc.allocated_bw;

			if (cmd.dpia_notify.payload.data.dpia_bw_alloc.bits.bw_request_failed)
			if (cmd.dpia_notification.payload.data.dpia_bw_alloc.bits.bw_request_failed)
				notify->result = DPIA_BW_REQ_FAILED;
			else if (cmd.dpia_notify.payload.data.dpia_bw_alloc.bits.bw_request_succeeded)
			else if (cmd.dpia_notification.payload.data.dpia_bw_alloc.bits.bw_request_succeeded)
				notify->result = DPIA_BW_REQ_SUCCESS;
			else if (cmd.dpia_notify.payload.data.dpia_bw_alloc.bits.est_bw_changed)
			else if (cmd.dpia_notification.payload.data.dpia_bw_alloc.bits.est_bw_changed)
				notify->result = DPIA_EST_BW_CHANGED;
			else if (cmd.dpia_notify.payload.data.dpia_bw_alloc.bits.bw_alloc_cap_changed)
			else if (cmd.dpia_notification.payload.data.dpia_bw_alloc.bits.bw_alloc_cap_changed)
				notify->result = DPIA_BW_ALLOC_CAPS_CHANGED;
		}
		break;