]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: [FW Promotion] Release 0.1.23.0
authorTaimur Hassan <Syed.Hassan@amd.com>
Fri, 8 Aug 2025 21:25:15 +0000 (17:25 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 18 Aug 2025 20:58:52 +0000 (16:58 -0400)
1. Fix loop counter.
2. Check whether rb->capacity is 0.

Acked-by: Sun peng (Leo) Li <sunpeng.li@amd.com>
Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 52295efdba6363cae5fe86d9cdd8c68696b45a9a..d7008d84c1ec1e234efe96f84f8595950bdd98fa 100644 (file)
@@ -6542,15 +6542,18 @@ static inline bool dmub_rb_full(struct dmub_rb *rb)
 static inline bool dmub_rb_push_front(struct dmub_rb *rb,
                                      const union dmub_rb_cmd *cmd)
 {
-       uint64_t volatile *dst = (uint64_t volatile *)((uint8_t *)(rb->base_address) + rb->wrpt);
-       const uint64_t *src = (const uint64_t *)cmd;
+       uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
+       const uint8_t *src = (const uint8_t *)cmd;
        uint8_t i;
 
+       if (rb->capacity == 0)
+               return false;
+
        if (dmub_rb_full(rb))
                return false;
 
        // copying data
-       for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
+       for (i = 0; i < DMUB_RB_CMD_SIZE; i++)
                *dst++ = *src++;
 
        rb->wrpt += DMUB_RB_CMD_SIZE;
@@ -6575,6 +6578,9 @@ static inline bool dmub_rb_out_push_front(struct dmub_rb *rb,
        uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
        const uint8_t *src = (const uint8_t *)cmd;
 
+       if (rb->capacity == 0)
+               return false;
+
        if (dmub_rb_full(rb))
                return false;
 
@@ -6620,6 +6626,9 @@ static inline void dmub_rb_get_rptr_with_offset(struct dmub_rb *rb,
                                  uint32_t num_cmds,
                                  uint32_t *next_rptr)
 {
+       if (rb->capacity == 0)
+               return;
+
        *next_rptr = rb->rptr + DMUB_RB_CMD_SIZE * num_cmds;
 
        if (*next_rptr >= rb->capacity)
@@ -6683,6 +6692,9 @@ static inline bool dmub_rb_out_front(struct dmub_rb *rb,
  */
 static inline bool dmub_rb_pop_front(struct dmub_rb *rb)
 {
+       if (rb->capacity == 0)
+               return false;
+
        if (dmub_rb_empty(rb))
                return false;
 
@@ -6707,6 +6719,9 @@ static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
        uint32_t rptr = rb->rptr;
        uint32_t wptr = rb->wrpt;
 
+       if (rb->capacity == 0)
+               return;
+
        while (rptr != wptr) {
                uint64_t *data = (uint64_t *)((uint8_t *)(rb->base_address) + rptr);
                uint8_t i;