Exemplo n.º 1
0
static int get_cpuid(void) {
    unsigned long id = nb_Read(0x90);

    switch (id)
	{
		case 0x31504D44L: //"DMP1"
            return CPU_VORTEX86SX;
		case 0x32504D44L: //"DMP2"
		{
            unsigned char nbrv = nb_Read8(0x08);
            unsigned char sbrv = sb_Read8(0x08);
            unsigned long ide  = pci_In32(VX86_pciDev[VX86_IDE], 0x00);
		    if ((nbrv == 1) && (sbrv == 1) && (ide == 0x101017f3L)) return CPU_VORTEX86DX_A;  // Vortex86DX ver. A
		    if ((nbrv == 1) && (sbrv == 2) && (ide != 0x101017f3L)) return CPU_VORTEX86DX_C;  // Vortex86DX ver. C (PBA/PBB)
		    if ((nbrv == 2) && (sbrv == 2) && (ide != 0x101017f3L)) return CPU_VORTEX86DX_D;  // Vortex86DX ver. D

            return CPU_VORTEX86DX_UNKNOWN;
        }
		case 0x33504D44L: //"DMP3"
			return CPU_VORTEX86MX;
		case 0x35504D44L: //"DMP5"
			return CPU_VORTEX86MX_PLUS;
		case 0x34504D44L: //"DMP4"
			return CPU_VORTEX86DX2;
		case 0x36504D44L:
			return CPU_VORTEX86DX3;
		case 0x37504D44L:
			return CPU_VORTEX86EX;
	}

	return CPU_UNSUPPORTED;
}
Exemplo n.º 2
0
static void write_cmos(unsigned char address, unsigned char buf)
{
  if(address >= EEPROMSIZE_BANK0) // 0~199
	return ;

#if (defined(DMP_DOS_BC) || defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM))
  io_DisableINT();
#elif defined (DMP_LINUX)
  lockCMOS();
#endif

  void *pciDev = NULL;
  pciDev = pci_Alloc(0x00, 0x07, 0x00);
  if(pciDev == NULL)
  {
#if (defined(DMP_DOS_BC) || defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM))
    Serial.print("CMOS device doesn't exist\n");
#elif (defined(DMP_LINUX))
    printf("CMOS device doesn't exist\n");
#endif
    return;
  }

  unsigned long int reg;
  reg = pci_In32(pciDev, 0xc0);
  if(address == 20 || address == 22) //special case
  {
    //Set bit 3 to access high 128 bytes RTC SRAM
	pci_Out32(pciDev, 0xc0, reg | 0x00000008);
        address = (address == 20)? 26:27;
        io_outpb(0x70, address);
  }
  else if(address < 100) // 0~99 low page 
  {
	//clear bit 3 to access low 128 bytes RTC SRAM
	pci_Out32(pciDev, 0xc0, reg & 0xfffffff7);
	io_outpb(0x70, address + 28);
  }
  else// 100~199 high page
  {
	//Set bit 3 to access high 128 bytes RTC SRAM
	pci_Out32(pciDev, 0xc0, reg | 0x00000008);
	address -= 100;
	io_outpb(0x70, address + 28);
  }
  io_outpb(0x71, buf);
  // Restore old register value
  pci_Out32(pciDev, 0xc0, reg);
  pci_Free(pciDev);
  
#if (defined(DMP_DOS_BC) || defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM))
  io_RestoreINT();
#elif defined (DMP_LINUX)
  unLockCMOS();
#endif

}
Exemplo n.º 3
0
DMPAPI(unsigned long) vx86_NBSB_Read(int fun, unsigned char offset) {
    if (VX86_pciDev[VX86_NB + fun] == NULL) return 0xffffffffL;
    return pci_In32(VX86_pciDev[VX86_NB + fun], offset);
}