⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syslib.c

📁 WINDRIVER MCP750 BSP
💻 C
📖 第 1 页 / 共 5 页
字号:
    VM_STATE_VALID	| VM_STATE_WRITABLE	 | VM_STATE_CACHEABLE_NOT |    VM_STATE_GUARDED    },    {    (void *) FLASH_BASE_ADRS,    (void *) FLASH_BASE_ADRS,    FLASH_MEM_SIZE,    VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,    VM_STATE_VALID	| VM_STATE_WRITABLE	 | VM_STATE_CACHEABLE_NOT    }    };int sysPhysMemDescNumEnt = NELEMENTS (sysPhysMemDesc);int   sysBus	   = VME_BUS;		/* system bus type */int   sysCpu	   = CPU;		/* CPU type */char * sysBootLine = BOOT_LINE_ADRS;	/* address of boot line */char * sysExcMsg   = EXC_MSG_ADRS;	/* catastrophic message area */int   sysProcNum;			/* processor number of this CPU */int   sysFlags; 			/* boot flags */char  sysBootHost [BOOT_FIELD_LEN];	/* name of host from which we booted */char  sysBootFile [BOOT_FIELD_LEN];	/* name of file from which we booted */UINT  sysVectorIRQ0  = INT_VEC_IRQ0;	/* vector for IRQ0 */LOCAL int   sysRavPciBusNo;		/* Raven Config Space BDF address */LOCAL int   sysRavPciDevNo;LOCAL int   sysRavPciFuncNo;int    smIntArg1 = -1;				/* Shared memory SM_INT_ARG1 */int    smIntArg2 = -1;				/* Shared memory SM_INT_ARG2 */RAVEN_WIN_STRUCT sysRavCpuToPciWin[RAVEN_WIN_CNT] = { { 0 } };RAVEN_WIN_STRUCT sysRavPciToCpuWin[RAVEN_WIN_CNT] = { { 0 } };int   sysValidRavenWindows = 0;		/* number of valid entries *//* last 5 nibbles are board specific, initialized in sysHwInit */unsigned char lnEnetAddr [6] = { 0x08, 0x00, 0x3e, 0x00, 0x00, 0x00 };#ifdef	INCLUDE_ATAATA_RESOURCE	ataResources[ATA_MAX_CTRLS];/* *	The first member in the ATA_TYPE struct has a dual purpose. *	1) If cylinders == 0, the device location is not probed at startup. *	2) If cylinders |= 0, the device location is probed, and if a device *	   is found, the driver will fill in the first 3 member of the struct *	   with number of cylinders, number of heads, and sectors per track. * *	The last 2 members of the struct are static and should not be changed. * *	The ATA_TYPE struct has the following layout: *		int cylinders; *		int heads; *		int sectorsTrack; *		int bytesSector; *		int precomp; * *	NOTE:	If configType == ATA_GEO_FORCE, the user needs to fill in *		values for cylinders, heads, and sectorsTrack. */ATA_TYPE	ataTypes [ATA_MAX_CTRLS][ATA_MAX_DRIVES] =    {	{	    {ATA_DEV0_STATE, 0, 0, 512, 0xff},	/* controller 0, drive 0 */	    {ATA_DEV1_STATE, 0, 0, 512, 0xff},	/* controller 0, drive 1 */	},	{	    {ATA_DEV2_STATE, 0, 0, 512, 0xff},	/* controller 1, drive 0 */	    {ATA_DEV3_STATE, 0, 0, 512, 0xff},	/* controller 1, drive 1 */	}    };#endif	/* INCLUDE_ATA *//* locals */LOCAL char sysModelStr[80];LOCAL char sysWrongCpuMsg[] = WRONG_CPU_MSG;UINT32 sysProbeFault = 0; /* used by dsi exception trap handler */#ifdef INCLUDE_SM_COMMON#   ifdef SYS_SM_ANCHOR_POLL_LISTstatic SYS_SM_ANCHOR_POLLING_LIST sysSmAnchorPollList[] =    {    SYS_SM_ANCHOR_POLL_LIST    { 0xffffffff, 0xffffffff }	/* Required entry: marks end of list */    };#   endif  /* SYS_SM_ANCHOR_POLL_LIST */#endif  /* INCLUDE_SM_COMMON */#ifdef DEC2155X_SYSTEM_SUPPORTstatic SYS_SM_DEV_LIST sysSmDeviceList[] =    {#   ifdef SYS_SM_DEVICE_LIST    SYS_SM_DEVICE_LIST#   endif    { 0xffffffff, 0xffffffff }	/* Required entry: marks end of list */    };#endif  /* DEC2155X_SYSTEM_SUPPORT */LOCAL int sysSmUtilTasValue = 0;		/* special soft tas value *//* forward declarations */void	sysSpuriousIntHandler (void);void	sysCpuCheck (void);char *	sysPhysMemTop (void);STATUS	sysPciExtViaInit (int, int, int);void	sysDec21x40UpdateLoadStr (void);UCHAR	sysNvRead (ULONG);void	sysNvWrite (ULONG,UCHAR);void	sysBusTasClear (volatile char * address);STATUS	sysBusProbe (char *, int, int, char *);void	sysMsDelay (UINT);void	sysDelay (void);LOCAL	void	sysRavenCapt (void);void	sysPciInsertLong (UINT32, UINT32, UINT32);void	sysPciInsertWord (UINT32, UINT16, UINT16);void	sysPciInsertByte (UINT32, UINT8, UINT8);void	sysPciOutLongConfirm (UINT32, UINT32);void	sysPciOutWordConfirm (UINT32, UINT16);void	sysPciOutByteConfirm (UINT32, UINT8);#ifdef INCLUDE_DPESTATUS  sysConfigDpe (void);#endif#ifdef INCLUDE_SM_COMMON#   ifdef DEC2155X_SYSTEM_SUPPORT#	if (SM_OFF_BOARD == TRUE)LOCAL STATUS (*cpciConfigInLong)( int, int, int, int, UINT32 *) =	      pciConfigInLong;#	endif  /* SM_OFF_BOARD == TRUE */#   else  /* DEC2155X_SYSTEM_SUPPORT */LOCAL STATUS sysPciConfig21554InLong (int, int, int, int, UINT32 *);LOCAL STATUS (*cpciConfigInLong)( int, int, int, int, UINT32 *) =	      sysPciConfig21554InLong;LOCAL int sysPciConfigPack21554 ( int, int, int, int);#   endif  /* DEC2155X_SYSTEM_SUPPORT */LOCAL void sysSmParamsCompute (void);int sysSmArg2Compute (void);#   if (SM_OFF_BOARD == TRUE)#	ifdef SYS_SM_ANCHOR_POLL_LISTLOCAL UINT	 sysSmAnchorCandidate ( UINT, UINT, UINT);#	endif  /* SYS_SM_ANCHOR_POLL_LIST */LOCAL STATUS sysSmAnchorFind ( int, char **);LOCAL char   *sysSmAnchorPoll (void);char *	sysSmAnchorAdrs ();	/* Anchor address (dynamic) */#   endif  /* SM_OFF_BOARD == TRUE */#endif  /* INCLUDE_SM_COMMON */#ifdef DEC2155X_SYSTEM_SUPPORTint 	 	sysBusIntAck (int);STATUS	 	sysBusIntGen (int, int);STATUS	 	sysIntEnable (int);STATUS	 	sysIntDisable (int);STATUS	 	sysMailboxConnect (FUNCPTR, int);STATUS	 	sysMailboxEnable (char *);LOCAL UINT	sysSmDeviceParticipant ( UINT, UINT, UINT);LOCAL void	sysDec2155xPriIntConnect (void);LOCAL void	sysDec2155xIntr (int);LOCAL STATUS	sysDec2155xIntEnable (int);LOCAL STATUS	sysDec2155xIntDisable (int);#endif  /* DEC2155X_SYSTEM_SUPPORT *//* externals */IMPORT UCHAR  sysInByte (ULONG);IMPORT void   sysOutByte (ULONG, UCHAR);IMPORT UINT16 sysIn16 (UINT16 *);IMPORT void   sysOut16 (UINT16 *, UINT16);IMPORT UINT32 sysIn32 (UINT32 *);IMPORT void   sysOut32 (UINT32 *, UINT32);IMPORT void   sysPciRead32 (UINT32, UINT32 *);IMPORT void   sysPciWrite32 (UINT32, UINT32);IMPORT void   sysClkIntCIO (void);IMPORT STATUS sysMemProbeSup (int length, char * src, char * dest);IMPORT int    sysProbeExc ();IMPORT void	sysClkIntCIO (void);IMPORT int	sysGetBusSpd (void);#ifdef INCLUDE_VPDIMPORT STATUS sysVpdBrdInit (void);IMPORT STATUS sysVpdTmInit (void);#endif  /* INCLUDE_VPD *//* BSP DRIVERS */#include "pci/pciAutoConfigLib.c"	/* PCI Auto-config support */#include "pci/pciConfigLib.c"		/* PCI config space access */#include "./sysBusPci.c"#ifdef INCLUDE_SHOW_ROUTINES#  include "pci/pciConfigShow.c"	/* display of PCI config space */#  ifdef INCLUDE_VPD#    include "sysMotVpdShow.c"#  endif  /* INCLUDE_VPD */#endif  /* INCLUDE_SHOW_ROUTINES */#ifdef INCLUDE_NETWORK#   include "./sysNet.c"#   ifdef INCLUDE_END#      include "./sysDec21x40End.c"#   endif  /* INCLUDE_END */#endif  /* INCLUDE_NETWORK */#include "sysSerial.c"#include "mem/byteNvRam.c"#include "timer/ppcDecTimer.c"		/* PPC603 & 604 have on chip timers */#include "sysScsi.c"			/* sysScsiInit routine */#ifdef	INCLUDE_ATA#  include "sysAta.c"			/* sysAtaInit routine */#endif	/* INCLUDE_ATA */#include "sysCache.c"#include "ns8730xSuperIo.c"#include "ravenPci.c"#include "ravenMpic.c"#include "timer/ppcZ8536Timer.c"#ifdef INCLUDE_RAVEN_AUXCLK#  include "ravenAuxClk.c"#endif	/* INCLUDE_RAVEN_AUXCLK */#ifdef INCLUDE_DEC2155X#  include "dec2155xCpci.c"#endif  /* INCLUDE_DEC2155X *//******************************************************************************** sysModel - return the model name of the CPU board** This routine returns the model name of the CPU board.  The returned string* depends on the board model and CPU version being used, for example,* "Motorola MVME2600 - MPC 604e".** RETURNS: A pointer to the string.*/char * sysModel (void)    {    char   base_type;    char * pBrdType;    int    cpu;    /* Determine board type */    base_type = *SYS_REG_BMSR;    switch (base_type)	{	case SYS_REG_BMSR_MCP750:		pBrdType = "MCP750";		break;	case SYS_REG_BMSR_MCPN750:		pBrdType = "MCPN750";		break;	default:		pBrdType = "Unknown";		break;	}    /* Determine CPU type and build display string */    cpu = CPU_TYPE;    switch (cpu)	{	case CPU_TYPE_604E:	    sprintf (sysModelStr, "Motorola %s - MPC 604e", pBrdType);	    break;	case CPU_TYPE_604R:	    sprintf (sysModelStr, "Motorola %s - MPC 604r", pBrdType);	    break;	case CPU_TYPE_603P:	    sprintf (sysModelStr, "Motorola %s - MPC 603p", pBrdType);	    break;	case CPU_TYPE_603E:	    sprintf (sysModelStr, "Motorola %s - MPC 603e", pBrdType);	    break;	case CPU_TYPE_750:	    sprintf (sysModelStr, "Motorola %s - MPC 750", pBrdType);	    break;	default:	    sprintf (sysModelStr, "Motorola %s - MPC 60%d", pBrdType, cpu);	    break;	}    return (sysModelStr);    }/********************************************************************************* sysBspRev - return the BSP version and revision number** This routine returns a pointer to a BSP version and revision number, for* example, 1.1/0. BSP_REV is concatenated to BSP_VERSION and returned.** RETURNS: A pointer to the BSP version/revision string.*/char * sysBspRev (void)    {    return (BSP_VERSION BSP_REV);    }/******************************************************************************** sysHwInit - initialize the system hardware** This routine initializes various features of the CPU board.  It is called* by usrInit() in usrConfig.c.	This routine sets up the control registers* and initializes various devices if they are present.** NOTE: This routine should not be called directly by the user application.  It* cannot be used to initialize interrupt vectors.** RETURNS: N/A*/void sysHwInit (void)    {    int 	pciBusNo;	/* PCI bus number */    int 	pciDevNo;	/* PCI device number */    int 	pciFuncNo;	/* PCI function number */    /*	Validate CPU type */    sysCpuCheck ();    /* Do the Raven init here */    sysRavenInit ();#ifdef CONFIG1_PLANAR_PCI    /* Do the Super I/O init here */    ns8730xSuperIoInit ();#endif    /*	Initialize PCI driver library. */    if (pciConfigLibInit (PCI_MECHANISM_1, PCI_PRIMARY_CAR, PCI_PRIMARY_CDR, 0)	!= OK)	{	sysToMonitor (BOOT_NO_AUTOBOOT);	}    /*     *	The Raven powers up with the correct PCI Header values.     *	So, no initialization of the PCI Header is performed.     *     *	The IBC powers up with the correct PCI Header values.     *	So, no initialization of the PCI Header is performed.     */    /*     * Capture the state (enabled or disabled) of the PCI-PCI bridge     * for future reference - see call to sysPciAutoConfig() in this     * function.     */#ifdef INCLUDE_DEC2155X    /* Configure the Dec 2155x */    sysDec2155xInit ();#endif#ifdef INCLUDE_VPD    /* Read the processor board's Vital Product Data */    sysVpdBrdInit ();    /* Read the transition module's Vital Product Data */    sysVpdTmInit ();#endif /* INCLUDE_VPD */    /*     * Test to determine if we need to configure the PCI busses with     * sysPciAutoConfig().  If we are coming up from a ROM-based image     * then we need to reconfigure.  If we have been booted from a ROM     * image then we don't need to reconfigure since the bootrom will     * already have reconfigured the PCI busses.  We must avoid     * configuring the PCI busses twice on startup.     */    if ( !PCI_AUTOCONFIG_DONE )	{	/* in ROM boot phase, OK to continue and configure PCI busses. */	sysPciAutoConfig ();	PCI_AUTOCONFIG_FLAG++;	/* Remember that PCI is configured */	}#ifdef	INCLUDE_ATA    /*     *	Initialize the Standard PCI Header of the ATA/EIDE device     *	if present.     */	if (pciFindDevice ((PCI_ID_IDE & 0xFFFF), (PCI_ID_IDE >> 16) & 0xFFFF,			   0, &pciBusNo, &pciDevNo, &pciFuncNo) != ERROR)	    {	/*	 *  Due to pciDevConfig() limited ability to program the BARs	 *  in the PCI Config Header, we will use the 4 default	 *  (ISA Legacy) BARs.	 */	sysAtaInit (pciBusNo, pciDevNo, pciFuncNo);	}#endif /* INCLUDE_ATA */    /*     *	Initialize the extended portion of the Raven's PCI Header.     *	The non-PCI Config Space registers have already been     *	initialized in the initial startup code.     */    if (pciFindDevice ((PCI_ID_RAVEN & 0xFFFF), (PCI_ID_RAVEN >> 16) & 0xFFFF,		       0, &sysRavPciBusNo, &sysRavPciDevNo,                       &sysRavPciFuncNo) != ERROR)	{	sysRavenInitPciExt (sysRavPciBusNo, sysRavPciDevNo,                                   sysRavPciFuncNo);	}    /* Initialize the extended portion of the IBC's PCI Header.  */    if (pciFindDevice ((PCI_ID_IBC & 0xFFFF), (PCI_ID_IBC >> 16) & 0xFFFF, 0,		       &pciBusNo, &pciDevNo, &pciFuncNo) != ERROR)	{	sysPciExtViaInit (pciBusNo, pciDevNo, pciFuncNo);	}    /*     *	Initialize the non-PCI Config Space registers of the     *	IBC which doesn't have a true device driver.     */    sysIbcInit ();    /*     *	Reset the MPIC.     */    sysPciWrite32 (MPIC_ADDR(MPIC_GLOBAL_CONFIG_REG), RESET_CNTRLR);    /*     *	Initialize the non-PCI Config Space registers of the     *	Raven Mpic.     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -