?? sysinit.c
字號:
/* @(#) pSOSystem PowerPC/V2.2.2: configs/sysinit.c (ppc) 3.203 97/11/10 10:08:57 */
/***********************************************************************/
/* */
/* MODULE: configs/std/sysinit.c */
/* DATE: 97/11/10 */
/* PURPOSE: Main system configuration file */
/* */
/*-------------------------------------------------------------------*/
/* */
/* Copyright 1991 - 1997, Integrated Systems, Inc. */
/* all RIGHTS RESERVED */
/* */
/* Permission is hereby granted to licensees of Integrated Systems, */
/* Inc. products to use or abstract this computer program for the */
/* sole purpose of implementing a product based on Integrated */
/* Systems, Inc. products. No other rights to reproduce, use, */
/* or disseminate this computer program, whether in part or in */
/* whole, are granted. */
/* */
/* Integrated Systems, Inc. makes no representation or warranties */
/* with respect to the performance of this computer program, and */
/* specifically disclaims any responsibility for any damages, */
/* special or consequential, connected with the use of this program. */
/* */
/*---------------------------------------------------------------------*/
/* */
/* This code in this module controls the configuration of the */
/* operating system. Many configurations are possible, based on */
/* these inputs: */
/* * Options selected in "sys_conf.h" */
/* * The capabilities of the board-support package being used, */
/* as defined in "bsp.h" */
/* * Answers given to questions in the startup configuration */
/* dialog, if it is enabled */
/* */
/***********************************************************************/
#if __cplusplus
extern "C" {
#endif
#define _SYSINIT_C 1
#include "sys_conf.h"
#include "bsp.h"
#include <bspfuncs.h>
#include <pna.h>
#include <configs.h>
#include <sysvars.h>
#include <apdialog.h>
#include <version.h>
#include <machine.h>
#if (VERSION != BSP_VERSION)
#error "BSP_VERSION and pSOSystem VERSION do not match!"
#endif
#if SC_PSOS && SC_PSOSM
#error "Cannot use both pSOS+ and pSOS+m!"
#endif
#if SC_PSOSM
#define PSOS_INIT pSOSm_Init
#else
#define PSOS_INIT pSOS_Init
#endif
static void Delay5sec(void);
extern ULONG Dialog(void);
/*---------------------------------------------------------------------*/
/* Compile-time checks */
/*---------------------------------------------------------------------*/
#if (SC_DEV_SERIAL && BSP_SERIAL)
#if(SC_DEV_SERIAL > SC_DEVMAX)
#error "SC_DEV_SERIAL cannot be > SC_DEVMAX"
#endif
#endif
#if SC_DEV_TIMER
#if(SC_DEV_TIMER > SC_DEVMAX)
#error "SC_DEV_TIMER cannot be > SC_DEVMAX"
#endif
#if (!SC_PSOS && !SC_PSOSM)
#error "Must have pSOS+ or pSOS+m in system to use tick timer!"
#endif
#endif
#if SC_DEV_RAMDISK
#if(SC_DEV_RAMDISK > SC_DEVMAX)
#error "SC_DEV_RAMDISK cannot be > SC_DEVMAX"
#endif
#endif
#if (SC_DEV_SCSI && BSP_SCSI)
#if(SC_DEV_SCSI > SC_DEVMAX)
#error "SC_DEV_SCSI cannot be > SC_DEVMAX"
#endif
#endif
#if (SC_DEV_TFTP)
#if(SC_DEV_TFTP > SC_DEVMAX)
#error "SC_DEV_TFTP cannot be > SC_DEVMAX"
#endif
#endif
/*---------------------------------------------------------------------*/
/* External function declarations */
/*---------------------------------------------------------------------*/
extern ULONG Print(char *format, ...);
#if !BSP_NEW_SERIAL
extern void SerialSetup(ULONG, ULONG, ULONG);
#endif
#define MAGIC 0x05291989
#define ALIGN(addr, boundary) ((addr + boundary - 1) & ~(boundary - 1))
extern UCHAR FreeMemStart[];
#if (GHS || __DIAB)
extern UCHAR TextEnd[];
extern UCHAR DataStart[];
extern UCHAR DataEnd[];
#endif /* GHS || __DIAB */
extern const char MemErrMsg[] =
"System Initialization Failed: insufficient memory available!";
NV_Parms NVVars;
#define PROBE_CON_SER_PORT SC_PROBE_CONSOLE
#if BSP_NEW_SERIAL
/*-----------------------------------------------------------------*/
/* Set up the non pSOS port array. */
/*-----------------------------------------------------------------*/
int Non_pSOSChan[SC_NumNon_pSOSChan+2];
int NumNon_pSOSChan;
int SysBaud;
int SysConsole;
#endif
extern UCHAR *PnaSetup(UCHAR *, NODE_CT *);
extern UCHAR *PrepcSetup(UCHAR *, NODE_CT *);
extern UCHAR *PsosSetup(UCHAR *, NODE_CT *);
extern UCHAR *PhileSetup(UCHAR *, NODE_CT *);
extern UCHAR *PrpcSetup(UCHAR *, NODE_CT *);
extern UCHAR *ProbeSetup(UCHAR *, NODE_CT *);
extern UCHAR *PmontSetup(UCHAR *, NODE_CT *);
extern UCHAR *PseSetup(UCHAR *, NODE_CT *);
#if (SC_PX)
extern UCHAR *PxSetup(UCHAR *, NODE_CT *);
#endif
#if ((SC_PSOS == USEROM) || (SC_PSOSM == USEROM))
#if (SC_BOOT_ROM == YES)
#error "Must not use SC_PSOS or SC_PSOSM USEROM with SC_BOOT_ROM code"
#endif /* SC_BOOT_ROM */
ULONG (*pSOS_tmp)(void);
#else
extern void PSOS_INIT(void);
#endif
#if (SC_PROBE == USEROM)
#if (SC_BOOT_ROM == YES)
#error "Must not use SC_PROBE USEROM with SC_BOOT_ROM code"
#endif /* SC_BOOT_ROM */
ULONG (*pROBE_tmp)(void);
#endif
static const struct SD_parms SysVarsDefaults =
{
SC_SD_DEBUG_MODE,
0, 0, 0,
SD_STARTUP_DELAY,
SD_DEF_BAUD,
SD_VME_BASE_ADDR,
SD_DEF_GTWY_IP,
SD_LAN1,
0, 0, 0,
SD_LAN1_IP,
SD_LAN1_SUBNET_MASK,
SD_SM_NODE,
SD_NISM,
0, 0, 0,
SD_NISM_IP,
SD_NISM_SUBNET_MASK,
SD_NISM_DIRADDR,
SD_KISM,
SD_KISM_DIRADDR,
};
#if BSP_NEW_SERIAL
#if (BSP_MMU == YES)
UCHAR *gGsBlkArea; /* Start address of the GS block area */
ULONG gGsBlkAreaSize = 0; /* Size of the allocated region */
#endif
extern UCHAR *GSblkSetup(UCHAR *, ULONG, ULONG *);
extern void SerialInit(void);
/*-----------------------------------------------------------------*/
/* Global variables set here used by dipi */
/*-----------------------------------------------------------------*/
int ProbeCon, ProbeHst;
#endif
#if !BSP_NEW_SERIAL && BSP_PARALLEL
extern UCHAR *GSblkSetup(UCHAR *, ULONG, ULONG *);
#if (BSP_MMU == YES)
UCHAR *gGsBlkArea; /* Start address of the GS block area */
ULONG gGsBlkAreaSize = 0; /* Size of the allocated region */
#endif
#endif
NODE_CT *oldanchor;
/*---------------------------------------------------------------------*/
/* Node anchor and node configuration table. The anchor address is */
/* defined in the linker command file. The anchor is a pointer to the */
/* node configuration table, which in turn points to the configuration */
/* tables for the various components. */
/*---------------------------------------------------------------------*/
extern NODE_CT *anchor;
extern NODE_CT *rom_anchor;
NODE_CT NodeCfg;
/*******************************************************************/
/* CheckSum: Calculate the checksum for a STORAGE structure */
/* */
/* INPUTS: StructPtr - ptr to structure to checksum */
/* StructSize - size of structure in bytes */
/* RETURNS: Checksum for the structure */
/* NOTE: We consider the "checksum" to be simply the sum of */
/* the individual bytes in the structure */
/* */
/*******************************************************************/
ULONG CheckSum(void *StructPtr, int StructSize)
{
UCHAR *p = (UCHAR *)StructPtr;
USHORT tot = 0;
while(StructSize--)
tot += *p++ & 0xFF;
return tot;
}
/***********************************************************************/
/* AdjustSysVars: Make any run-time adjustments necessary to the */
/* system variables */
/* */
/* NOTE: This should be called after the system variables have */
/* been "finalized" by reading from parameter storage and */
/* possibly being changed by the startup dialog */
/* */
/***********************************************************************/
static void AdjustSysVars(void)
{
#if (!SC_PSOS && !SC_PSOSM)
if (SysVars.DebugMode == DBG_AP)
{
#if SC_STARTUP_DIALOG
Print("Configured to run application, but pSOS+ not "
"present, so setting to stand-alone pROBE+\n");
#endif
SysVars.DebugMode = DBG_SA;
}
#endif
#if !SC_PNA
if (SysVars.DebugMode == DBG_XN)
{
#if SC_STARTUP_DIALOG
Print("Operating mode was remote debug/networked, "
"but pNA not present\n");
Print("Setting pROBE+ mode to standalone!\n");
#endif
SysVars.DebugMode = DBG_SA;
}
#endif
#if !SC_RBUG_PORT
if (SysVars.DebugMode == DBG_XS)
{
#if SC_STARTUP_DIALOG
Print("Operating mode was remote debug/Serial, but "
"SC_RBUG_PORT is not set.\n");
Print("Setting pROBE+ mode to standalone!\n");
#endif
SysVars.DebugMode = DBG_SA;
}
#endif
#if !BSP_LAN1
if (SysVars.Lan1)
{
#if SC_STARTUP_DIALOG
Print("LAN interface requested, but BSP does not "
"support it\n");
#endif
SysVars.Lan1 = 0;
}
#endif
}
/***********************************************************************/
/* BuildConfigTables: Build the component configuration tables, using */
/* information from the system variables (SysVars). */
/* */
/* INPUT: FreeMemPtr - Pointer to first byte of available memory */
/* */
/***********************************************************************/
static UCHAR *BuildConfigTables(UCHAR *FreeMemPtr)
{
#if (SC_BOOT_ROM == YES)
oldanchor = (void *)0;
#else /* SC_BOOT_ROM */
oldanchor = rom_anchor;
#endif /* SC_BOOT_ROM */
/* This is where the component's configuration functions are called */
#if SC_PROBE
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = ProbeSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PNA
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PnaSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PREPC
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PrepcSetup(FreeMemPtr, &NodeCfg);
#endif
#if (SC_PHILE || SC_DEV_RAMDISK || SC_DEV_SCSI)
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PhileSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PRPC
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PrpcSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PX
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PxSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PSE
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PseSetup(FreeMemPtr, &NodeCfg);
#endif
#if SC_PMONT
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PmontSetup(FreeMemPtr, &NodeCfg);
#endif
/*---------------------------------------------------------------------*/
/* Perform any BSP specific configuration functions. Most of the node */
/* configuration table can be used by BspSetup(). Only PsosSetup has */
/* not been done when BspSetup is called. BspSetup may rely on this. */
/*---------------------------------------------------------------------*/
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = (UCHAR *)BspSetup(FreeMemPtr, &NodeCfg);
#if (BSP_MMU == YES)
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = BspMmuInit((ULONG) FreeMemPtr);
#endif
#if (SC_PSOS || SC_PSOSM)
/*-----------------------------------------------------------------*/
/* PsosSetup() must be called after all other Setup functions. */
/* */
/* If pSOS+ has been configured into the system, the FreeMemPtr is */
/* now part of pSOS+ region zero! So it can't be used to allocate */
/* any more memory after this. */
/*-----------------------------------------------------------------*/
FreeMemPtr = (UCHAR *)ALIGN((ULONG)FreeMemPtr, 4);
FreeMemPtr = PsosSetup(FreeMemPtr, &NodeCfg);
#endif
/*---------------------------------------------------------------------*/
/* Finally, finish up node configuration table and set node anchor to */
/* point to it. */
/*---------------------------------------------------------------------*/
NodeCfg.cputype = BspCpuType();
if( ((NodeCfg.cputype & 0xff) == PPC603e) ||
((NodeCfg.cputype & 0xff) == PPC603p) )
NodeCfg.cputype = (NodeCfg.cputype & ~0xff) | PPC603;
else if( ((NodeCfg.cputype & 0xff) == PPC604e) ||
((NodeCfg.cputype & 0xff) == PPC604r) ||
((NodeCfg.cputype & 0xff) == PPC604p) )
NodeCfg.cputype = (NodeCfg.cputype & ~0xff) | PPC604;
else if( (NodeCfg.cputype & 0xff) == PPC860)
NodeCfg.cputype = (NodeCfg.cputype & ~0xff) | PPC821;
#if (BSP_MMU == YES)
NodeCfg.cputype |= 0x200;
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -