drm/radeon/kms: add ucode loader for NI

Dan Carpenter dan.carpenter at oracle.com
Wed Feb 5 05:18:55 PST 2014


Hello Alex Deucher,

The patch 0af62b016804: "drm/radeon/kms: add ucode loader for NI"
from Jan 6, 2011, leads to the following static checker warning:

	drivers/gpu/drm/radeon/ni.c:646 ni_mc_load_microcode()
	warn: we tested 'running' before and it was 'false'

drivers/gpu/drm/radeon/ni.c
   643          running = RREG32(MC_SEQ_SUP_CNTL) & RUN_MASK;
   644  
   645          if ((mem_type == MC_SEQ_MISC0_GDDR5_VALUE) && (running == 0)) {
                                                               ^^^^^^^^^^^^
   646                  if (running) {
                            ^^^^^^^
Never true condition.

   647                          blackout = RREG32(MC_SHARED_BLACKOUT_CNTL);
   648                          WREG32(MC_SHARED_BLACKOUT_CNTL, 1);
   649                  }
   650  
   651                  /* reset the engine and set to writable */
   652                  WREG32(MC_SEQ_SUP_CNTL, 0x00000008);
   653                  WREG32(MC_SEQ_SUP_CNTL, 0x00000010);
   654  
   655                  /* load mc io regs */
   656                  for (i = 0; i < regs_size; i++) {
   657                          WREG32(MC_SEQ_IO_DEBUG_INDEX, io_mc_regs[(i << 1)]);
   658                          WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]);
   659                  }
   660                  /* load the MC ucode */
   661                  fw_data = (const __be32 *)rdev->mc_fw->data;
   662                  for (i = 0; i < ucode_size; i++)
   663                          WREG32(MC_SEQ_SUP_PGM, be32_to_cpup(fw_data++));
   664  
   665                  /* put the engine back into the active state */
   666                  WREG32(MC_SEQ_SUP_CNTL, 0x00000008);
   667                  WREG32(MC_SEQ_SUP_CNTL, 0x00000004);
   668                  WREG32(MC_SEQ_SUP_CNTL, 0x00000001);
   669  
   670                  /* wait for training to complete */
   671                  for (i = 0; i < rdev->usec_timeout; i++) {
   672                          if (RREG32(MC_IO_PAD_CNTL_D0) & MEM_FALL_OUT_CMD)
   673                                  break;
   674                          udelay(1);
   675                  }
   676  
   677                  if (running)
                            ^^^^^^^
Again.

   678                          WREG32(MC_SHARED_BLACKOUT_CNTL, blackout);
   679          }

regards,
dan carpenter


More information about the dri-devel mailing list