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

📄 syslib_765.c

📁 sysLib.c - generic PPC system-dependent library 765BSP重要文件
💻 C
📖 第 1 页 / 共 5 页
字号:
#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 */LOCAL int	sysSmUtilTasValue = 0;		/* special soft tas value *//* forward declarations */void	sysCpuCheck (void);void	sysModeCheck (void);char *  sysPhysMemTop (void);STATUS	sysPciExtHawkInit (int, int, int);void    sysDec21x40UpdateLoadStr (void);UCHAR	sysNvRead (ULONG);void	sysNvWrite (ULONG,UCHAR);STATUS  sysBusProbe (char *, int, int, char *);void	sysUsDelay (UINT);void	sysConfigBpe (void);void	sysConfigDpm (void);void    reportBootromErrors (void);BOOL	sysSysconAsserted (void);void	sysDelay (void);LOCAL	void	sysHawkCapt (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_BPEvoid  sysConfigBpe (void);#endif#ifdef INCLUDE_DPMvoid  sysConfigDpm (void);#endif#ifdef  INCLUDE_SM_COMMONint	     sysSmArg2Compute (void);LOCAL void   sysSmParamsCompute (void);LOCAL int    sysPciConfigPack21554 (int, int, int, int);LOCAL STATUS sysPciConfig21554InLong (int, int, int, int, UINT32 *);LOCAL STATUS (*cpciConfigInLong)(int, int, int, int, UINT32 *) =                                sysPciConfig21554InLong;#   if (SM_OFF_BOARD == TRUE)#       ifdef SYS_SM_ANCHOR_POLL_LISTLOCAL UINT     sysSmAnchorCandidate (UINT, UINT, UINT);#       endifLOCAL STATUS   sysSmAnchorFind (int, char **);LOCAL char   * sysSmAnchorPoll (void);char         * sysSmAnchorAdrs ();         /* Anchor address (dynamic) */#   endif  /* SM_OFF_BOARD == TRUE */#endif  /* INCLUDE_SM_COMMON *//* 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 VOIDFUNCPTR      smUtilTasClearRtn;IMPORT UINT32 sysTimeBaseLGet (void);IMPORT UINT   sysHid1Get (void);IMPORT UCHAR  sysProductStr[];IMPORT STATUS sysHawkI2cByteRead (UCHAR, UCHAR, UCHAR *);IMPORT STATUS sysHawkI2cByteWrite (UCHAR, UCHAR, UCHAR *);IMPORT UINT32 sysDramSize ();/* BSP DRIVERS */#include "pci/pciConfigLib.c"#ifdef INCLUDE_NETWORK#   ifdef INCLUDE_END#      include "sysDec21x40End.c"#   endif /* INCLUDE_END */#endif /* INCLUDE_NETWORK */#include "sysSerial.c"#include "mem/byteNvRam.c"#include "sysMotVpd.c"#include "timer/ppcDecTimer.c"		/* PPC603 & 604 have on chip timers */#ifdef INCLUDE_SHOW_ROUTINES#   include "pci/pciConfigShow.c"       /* display of PCI config space */#   include "sysMotVpdShow.c"#   include "hawkSmcShow.c"#endif#include "drv/pci/pciAutoConfigLib.h"#include "sysBusPci.c"#include "sysCache.c"#include "hawkPhb.c"#ifdef INCLUDE_MPIC#  include "hawkMpic.c"#else#  include "sl82565IntrCtl.c"#endif#ifdef INCLUDE_HAWK_AUXCLK#   include "hawkAuxClk.c"#endif#ifdef INCLUDE_DEC2155X#   include "dec2155xCpci.c"#endif#ifdef  INCLUDE_ATA#   include "sysAta.c"                  /* sysAtaInit routine */#endif#ifdef INCLUDE_ALTIVEC/******************************************************************************** sysAltivecProbe - Check if the CPU has ALTIVEC unit.** This routine returns OK it the CPU has an ALTIVEC unit in it.* Presently it checks for 7400 and 7410* RETURNS: OK  -  for 7400/7410 Processor type*          ERROR - otherwise.*/int  sysAltivecProbe (void)    {    ULONG regVal;    int altivecUnitPresent = ERROR;     /* The CPU type is indicated in the Processor Version Register (PVR) */     regVal = CPU_TYPE;     switch (regVal)       {          case CPU_TYPE_7400:          case CPU_TYPE_7410:             altivecUnitPresent = OK;            break;          default:             break;         }      /* switch  */    return (altivecUnitPresent);    }#endif  /* INCLUDE_ALTIVEC *//******************************************************************************** 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.** RETURNS: A pointer to the string.*/char * sysModel (void)    {    UINT cpu;    char cpuStr[80];    /* Determine CPU type and build display string */    cpu = CPU_TYPE;    switch (cpu)        {        case CPU_TYPE_604E:            sprintf(cpuStr, "604e");            break;        case CPU_TYPE_604R:            sprintf(cpuStr, "604r");            break;        case CPU_TYPE_603P:            sprintf(cpuStr, "603p");            break;        case CPU_TYPE_603E:            sprintf(cpuStr, "603e");            break;        case CPU_TYPE_750:            sprintf(cpuStr, "750");            break;        case CPU_TYPE_7400:            if (CPU_REV < CPU_REV_7410)                sprintf(cpuStr, "7400");            else                sprintf(cpuStr, "7410");            break;        case CPU_TYPE_7410:            sprintf(cpuStr, "7410");            break;        default:            sprintf (cpuStr, "60%d", cpu);            break;        }    sprintf (sysModelStr, "Motorola %s - MPC%s", sysProductStr, cpuStr);    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 */    /*     * If mmu tables are used, this is where we would dynamically     * update the entry describing main memory, using sysPhysMemTop().     * We must call sysPhysMemTop () at sysHwInit() time to do     * the memory autosizing if available.     */    sysPhysMemTop ();    /* Do the Hawk PCI-Host Bridge phase 1 init */    (void) sysHawkPhbInit ();    /* Initialize the VPD information */    (void) sysVpdInit ();    /* Do the Hawk PCI-Host Bridge phase 2 init */    (void) sysHawkPhbInit2 ();    /*	Validate CPU type */    sysCpuCheck();         /*     * If MPC7400 (Max) or MPC7410 (Nitro):     *     Setup  exception addresses.     *     Disable & invalidate if L2 enabled.     */    if ((CPU_TYPE == CPU_TYPE_7400) || (CPU_TYPE == CPU_TYPE_7410))	{#if defined(INCLUDE_CACHE_SUPPORT) && defined(INCLUDE_CACHE_L2)	sysL2CacheDisable ();#endif 	}	    /*	Validate the operating mode. */    sysModeCheck();	/* does not return if incorrect mode */    /* Initialize PCI driver library. */    if (pciConfigLibInit (PCI_MECHANISM_1, PCI_PRIMARY_CAR, PCI_PRIMARY_CDR, 0)        != OK)        {        sysToMonitor (BOOT_NO_AUTOBOOT);        }#ifdef INCLUDE_DEC2155X    /* Configure the Dec 2155x */    sysDec2155xInit ();#endif    /*     * 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 = TRUE;	/* Remember that PCI is configured */	}    sysDec21x40UpdateLoadStr ();    /*     *  The IBC powers up with most of the PCI Header values     *  being correct.  So, only registers that do not power-up     *  in the correct state are modified here.     */    if (pciFindDevice ((PCI_ID_IBC & 0xFFFF), (PCI_ID_IBC >> 16) & 0xFFFF, 0,                       &pciBusNo, &pciDevNo, &pciFuncNo) != ERROR)        {	/*	 * Enable Guaranteed Access Timing (default), the Arbiter Timeout	 * Timer, and  Bus Lock (locks PCI Bus when PCI LOCK# signal asserted)	 */        pciConfigOutByte (pciBusNo, pciDevNo, pciFuncNo, PCI_CFG_IBC_ARB_CTL,			  (ARB_CTL_GAT |			   ARB_CTL_TIMEOUT_TIMER |			   ARB_CTL_BUS_LOCK));        }#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 Hawk's PCI Header.     *	The non-PCI Config Space registers have already been     *	initialized in the initial startup code.     */    if (pciFindDevice ((PCI_ID_HAWK & 0xFFFF), (PCI_ID_HAWK >> 16) & 0xFFFF,                       0, &sysHawkPciBusNo, &sysHawkPciDevNo,                       &sysHawkPciFuncNo) != ERROR)        {        (void)sysHawkInitPhbExt (sysHawkPciBusNo, sysHawkPciDevNo,                                 sysHawkPciFuncNo);        }#ifndef INCLUDE_MPIC    /* 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)        {        (void)sysPciExtIbcInit(pciBusNo, pciDevNo, pciFuncNo);        }#endif /* INCLUDE_MPIC */    /*     *  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 ); #ifdef INCLUDE_MPIC    /*     *  Initialize the non-PCI Config Space registers of the     *  Hawk Mpic.     */    sysMpicInit();#endif /* INCLUDE_MPIC */    /* set pointer to bus probing hook */    _func_vxMemProbeHook = (FUNCPTR)sysBusProbe;    /* Initialize COM1 serial channel */    sysSerialHwInit();    /* Disable the watchdog timer */    sysNvWrite ((ULONG)WD_TIMER, 0);    /* clear Hawk error conditions */    sysHawkErrClr ();

⌨️ 快捷键说明

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