alpine 3.6
obsolete weakness #42

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

xf86-video-ast/src/xf86-video-ast-1.1.5/src/ast_vgatool.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

 
static void Do_DDRPHY_Init(ScrnInfoPtr pScrn)
{
  ASTRecPtr pAST = ASTPTR(pScrn);
  UCHAR *mmiobase = pAST->MMIOVirtualAddr;
  ULONG data, pass, timecnt;

  pass = 0;
  MOutdwm(mmiobase, 0x1E6E0060,0x00000005);
  while(!pass){
    for(timecnt = 0;timecnt < TIMEOUT;timecnt++){
      data = MIndwm(mmiobase, 0x1E6E0060) & 0x1;
      if(!data){
        break;
      }
    }
    if(timecnt != TIMEOUT){
      data = MIndwm(mmiobase, 0x1E6E0300) & 0x000A0000;
      if(!data){
        pass = 1;
      }
    }
    if(!pass){
      MOutdwm(mmiobase, 0x1E6E0060,0x00000000);
      usleep(10); /* delay 10 us */
      MOutdwm(mmiobase, 0x1E6E0060,0x00000005);
    }
  }

  MOutdwm(mmiobase, 0x1E6E0060,0x00000006);
}

/******************************************************************************
 Check DRAM Size
 1Gb : 0x80000000 ~ 0x87FFFFFF
 2Gb : 0x80000000 ~ 0x8FFFFFFF
 4Gb : 0x80000000 ~ 0x9FFFFFFF
 8Gb : 0x80000000 ~ 0xBFFFFFFF
 *****************************************************************************/
static void Check_DRAM_Size(ScrnInfoPtr pScrn, ULONG tRFC)
{
  ASTRecPtr pAST = ASTPTR(pScrn);
  UCHAR *mmiobase = pAST->MMIOVirtualAddr;
  ULONG reg_04, reg_14;

  reg_04 = MIndwm(mmiobase, 0x1E6E0004) & 0xfffffffc;
  reg_14 = MIndwm(mmiobase, 0x1E6E0014) & 0xffffff00;

  MOutdwm(mmiobase, 0xA0100000, 0x41424344);
  MOutdwm(mmiobase, 0x90100000, 0x35363738); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.