drm/radeon/kms: add support for MC ucode loading on SI

Dan Carpenter dan.carpenter at oracle.com
Wed Feb 5 05:19:32 PST 2014


Hello Alex Deucher,

The patch 8b074dd64053: "drm/radeon/kms: add support for MC ucode
loading on SI" from Mar 20, 2012, leads to the following static
checker warning:

	drivers/gpu/drm/radeon/si.c:1507 si_mc_load_microcode()
	warn: we tested 'running' before and it was 'false'

drivers/gpu/drm/radeon/si.c
  1506          if (running == 0) {
                    ^^^^^^^^^^^^
  1507                  if (running) {
                            ^^^^^^^
Nope.

  1508                          blackout = RREG32(MC_SHARED_BLACKOUT_CNTL);
  1509                          WREG32(MC_SHARED_BLACKOUT_CNTL, blackout | 1);
  1510                  }
  1511  
  1512                  /* reset the engine and set to writable */
  1513                  WREG32(MC_SEQ_SUP_CNTL, 0x00000008);
  1514                  WREG32(MC_SEQ_SUP_CNTL, 0x00000010);
  1515  
  1516                  /* load mc io regs */
  1517                  for (i = 0; i < regs_size; i++) {
  1518                          WREG32(MC_SEQ_IO_DEBUG_INDEX, io_mc_regs[(i << 1)]);
  1519                          WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]);
  1520                  }
  1521                  /* load the MC ucode */
  1522                  fw_data = (const __be32 *)rdev->mc_fw->data;
  1523                  for (i = 0; i < ucode_size; i++)
  1524                          WREG32(MC_SEQ_SUP_PGM, be32_to_cpup(fw_data++));
  1525  
  1526                  /* put the engine back into the active state */
  1527                  WREG32(MC_SEQ_SUP_CNTL, 0x00000008);
  1528                  WREG32(MC_SEQ_SUP_CNTL, 0x00000004);
  1529                  WREG32(MC_SEQ_SUP_CNTL, 0x00000001);
  1530  
  1531                  /* wait for training to complete */
  1532                  for (i = 0; i < rdev->usec_timeout; i++) {
  1533                          if (RREG32(MC_SEQ_TRAIN_WAKEUP_CNTL) & TRAIN_DONE_D0)
  1534                                  break;
  1535                          udelay(1);
  1536                  }
  1537                  for (i = 0; i < rdev->usec_timeout; i++) {
  1538                          if (RREG32(MC_SEQ_TRAIN_WAKEUP_CNTL) & TRAIN_DONE_D1)
  1539                                  break;
  1540                          udelay(1);
  1541                  }
  1542  
  1543                  if (running)
                            ^^^^^^^
False.

  1544                          WREG32(MC_SHARED_BLACKOUT_CNTL, blackout);
  1545          }

regards,
dan carpenter


More information about the dri-devel mailing list