📄 syslib.c
字号:
/* decide a destination RAM address and the entry point */
if ((int)&end > 0x100000)
{
pDst = (short *)RAM_HIGH_ADRS; /* copy it in lower mem */
pEntry = (FUNCPTR)(RAM_HIGH_ADRS + ROM_WARM_HIGH);
}
else
{
pDst = (short *)RAM_LOW_ADRS; /* copy it in upper mem */
pEntry = (FUNCPTR)(RAM_LOW_ADRS + ROM_WARM_LOW);
}
/* disable 16-bit memory access */
#ifdef INCLUDE_ULTRA
sysOutByte (IO_ADRS_ULTRA + 4, sysInByte (IO_ADRS_ULTRA + 4) | 0x80);
sysOutByte (IO_ADRS_ULTRA + 5, sysInByte (IO_ADRS_ULTRA + 5) & ~0x80);
#endif /* INCLUDE_ULTRA */
#ifdef INCLUDE_ELC
sysOutByte (IO_ADRS_ELC + 5, sysInByte (IO_ADRS_ELC + 5) & ~0x80);
#endif /* INCLUDE_ELC */
/* copy EPROM to RAM and jump, if there is a VxWorks EPROM */
for (ix = 0; ix < NELEMENTS(sysRomBase); ix++)
{
bcopyBytes ((char *)sysRomBase[ix], buf, ROM_SIGNATURE_SIZE);
if (strncmp (sysRomSignature, buf, ROM_SIGNATURE_SIZE) == 0)
{
for (iy = 0; iy < 1024; iy++)
{
*sysRomBase[ix] = iy; /* map the moveable window */
pSrc = (short *)((int)sysRomBase[ix] + 0x200);
for (iz = 0; iz < 256; iz++)
*pDst++ = *pSrc++;
}
(*pEntry) (startType);
}
}
#ifdef INCLUDE_FD
if (sysWarmType == 1)
{
IMPORT int dosFsDrvNum;
fdDrv (FD_INT_VEC, FD_INT_LVL); /* initialize floppy disk */
if (dosFsDrvNum == ERROR)
dosFsInit (NUM_DOSFS_FILES); /* initialize DOS-FS */
if (usrFdConfig (sysWarmFdDrive, sysWarmFdType, "/vxboot/") == ERROR)
{
printErr ("usrFdConfig failed.\n");
return (ERROR);
}
}
#endif /* INCLUDE_FD */
#ifdef INCLUDE_ATA
if (sysWarmType == 2)
{
ATA_RESOURCE *pAtaResource = &ataResources[sysWarmAtaCtrl];
IMPORT char *memTopPhys;
IMPORT int dosFsDrvNum;
if (ataDrv (sysWarmAtaCtrl, pAtaResource->drives,
pAtaResource->intVector, pAtaResource->intLevel,
pAtaResource->configType, pAtaResource->semTimeout,
pAtaResource->wdgTimeout) == ERROR) /* initialize ATA/IDE disk */
{
printErr ("Could not initialize.\n");
return (ERROR);
}
if (dosFsDrvNum == ERROR)
dosFsInit (NUM_DOSFS_FILES); /* initialize DOS-FS */
#if (CPU_FAMILY==I80X86)
#define ATA_MEM_DOSFS 0x200000
if ((int)&end < 0x100000)
{
if ((int)memTopPhys >= (0x200000 + ATA_MEM_DOSFS))
memAddToPool ((char *)memTopPhys - ATA_MEM_DOSFS, ATA_MEM_DOSFS);
}
#endif /* (CPU_FAMILY==I80X86) */
if (usrAtaConfig (sysWarmAtaCtrl, sysWarmAtaDrive, "/vxboot/") == ERROR)
{
printErr ("usrAtaConfig failed.\n");
return (ERROR);
}
}
#endif /* INCLUDE_ATA */
#ifdef INCLUDE_TFFS
if (sysWarmType == 3)
{
IMPORT int dosFsDrvNum;
tffsDrv (); /* initialize TFFS */
if (dosFsDrvNum == ERROR)
dosFsInit (NUM_DOSFS_FILES); /* initialize DOS-FS */
if (usrTffsConfig (sysWarmTffsDrive, FALSE, "/vxboot/") == ERROR)
{
printErr ("usrTffsConfig failed.\n");
return (ERROR);
}
}
#endif /* INCLUDE_TFFS */
#if (defined (INCLUDE_FD) || defined (INCLUDE_ATA) || defined(INCLUDE_TFFS))
if ((sysWarmType == 1) || (sysWarmType == 2)|| (sysWarmType ==3))
{
int fd;
if ((fd = open ("/vxboot/bootrom.sys", O_RDWR, 0644)) == ERROR)
{
if ((fd = open ("/vxboot/bootrom.dat", O_RDWR, 0644)) == ERROR)
{
printErr ("Can't open \"%s\"\n", "bootrom.{sys,dat}");
return (ERROR);
}
if (read (fd, (char *)pDst, 0x20) == ERROR) /* a.out header */
{
printErr ("Error during read file: %x\n", errnoGet ());
return (ERROR);
}
}
/* read text and data, write them to the memory */
if (read (fd, (char *)pDst, 0x98000) == ERROR)
{
printErr ("Error during read file: %x\n", errnoGet ());
return (ERROR);
}
close (fd);
(*pEntry) (startType);
}
#endif /* defined (INCLUDE_FD) || defined (INCLUDE_ATA) */
intLock ();
#ifdef INCLUDE_ELC
elcdetach (0);
#endif /* INCLUDE_ELC */
#ifdef INCLUDE_ULTRA
ultradetach (0);
#endif /* INCLUDE_ULTRA */
sysClkDisable ();
sysWait ();
sysOutByte (COMMAND_8042, 0xfe); /* assert SYSRESET */
sysWait ();
sysOutByte (COMMAND_8042, 0xff); /* NULL command */
sysReboot (); /* crash the global descriptor table */
return (OK); /* in case we ever continue from ROM monitor */
}
/*******************************************************************************
*
* sysIntDisable - disable a bus interrupt level
*
* This routine disables a specified bus interrupt level.
*
* RETURNS: ERROR, always.
*
* ARGSUSED0
*/
STATUS sysIntDisable
(
int intLevel /* interrupt level to disable */
)
{
return (ERROR);
}
/*******************************************************************************
*
* sysIntEnable - enable a bus interrupt level
*
* This routine enables a specified bus interrupt level.
*
* RETURNS: ERROR, always.
*
* ARGSUSED0
*/
STATUS sysIntEnable
(
int intLevel /* interrupt level to enable */
)
{
return (ERROR);
}
/****************************************************************************
*
* sysProcNumGet - get the processor number
*
* This routine returns the processor number for the CPU board, which is
* set with sysProcNumSet().
*
* RETURNS: The processor number for the CPU board.
*
* SEE ALSO: sysProcNumSet()
*/
int sysProcNumGet (void)
{
return (sysProcNum);
}
/****************************************************************************
*
* sysProcNumSet - set the processor number
*
* Set the processor number for the CPU board. Processor numbers should be
* unique on a single backplane.
*
* NOTE: By convention, only Processor 0 should dual-port its memory.
*
* RETURNS: N/A
*
* SEE ALSO: sysProcNumGet()
*/
void sysProcNumSet
(
int procNum /* processor number */
)
{
sysProcNum = procNum;
}
/*******************************************************************************
*
* sysDelay - allow recovery time for port accesses
*
* This routine provides a brief delay used between accesses to the same serial
* port chip.
*
* RETURNS: N/A
*/
void sysDelay (void)
{
char ix;
ix = sysInByte (0x84); /* it takes 720ns */
}
/*******************************************************************************
*
* sysStrayInt - Do nothing for stray interrupts.
*
* Do nothing for stray interrupts.
*/
LOCAL void sysStrayInt (void)
{
sysStrayIntCount++;
}
/*******************************************************************************
*
* sysMmuMapAdd - insert a new mmu mapping
*
* This routine adds a new mmu mapping entry to allow dynamic mappings.
*
* RETURNS: OK or ERROR depending on availability of free mappings.
*/
STATUS sysMmuMapAdd
(
void *address,
UINT length,
UINT initialStateMask,
UINT initialState
)
{
PHYS_MEM_DESC *pMmu;
STATUS result = OK;
pMmu = &sysPhysMemDesc[sysPhysMemDescNumEnt];
if(pMmu->virtualAddr != (void *)DUMMY_VIRT_ADDR)
result = ERROR;
else
{
pMmu->virtualAddr = address;
pMmu->physicalAddr = address;
pMmu->len = length;
pMmu->initialStateMask = initialStateMask;
pMmu->initialState = initialState;
sysPhysMemDescNumEnt += 1;
}
return (result);
}
#if FALSE /* they are called at entry and exit of intVecSet() */
/*******************************************************************************
*
* sysIntVecSetEnt - entry hook routine for intVecSet()
*
* This is an entry hook routine for intVecSet()
* This takes the same parameters of intVecSet()
*
* RETURNS: N/A
*/
LOCAL void sysIntVecSetEnt
(
FUNCPTR *vector, /* vector offset */
FUNCPTR function /* address to place in vector */
)
{
}
/*******************************************************************************
*
* sysIntVecSetExit - exit hook routine for intVecSet()
*
* This is an exit hook routine for intVecSet()
* This takes the same parameters of intVecSet()
*
* RETURNS: N/A
*/
LOCAL void sysIntVecSetExit
(
FUNCPTR *vector, /* vector offset */
FUNCPTR function /* address to place in vector */
)
{
}
#endif /* FALSE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -