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

📄 syslib7445.c

📁 sysLib.c - generic PPC system-dependent library 7445BSP重要文件
💻 C
📖 第 1 页 / 共 5 页
字号:
	    {ATA_DEV3_STATE, 0, 0, 512, 0xff},  /* ctrl 1, drive 1 */	}    };#endif	/* INCLUDE_ATA *//* static locals */LOCAL char sysModelStr [80]	= SYS_MODEL;	/* Sandpoint Model string */LOCAL char sysInfoStr [200];			/* Sandpoint INFO string */LOCAL char wrongCpuMsg []	= WRONG_CPU_MSG; /* static locals which define the PREP or CHRP mapping */LOCAL ULONG sysPciConfAddr;		/* PCI Configuration Address */LOCAL ULONG sysPciConfData;		/* PCI Configuration Data */LOCAL ULONG sysPciMstrIsaIoLocal;	/* CPU's PCI ISA IO Address */LOCAL ULONG sysPciMstrCfgAdrs;		/* CPU's PCI Config Address */LOCAL ULONG sysPciMstrIoLocal;		/* CPU's PCI IO Address */LOCAL ULONG sysPciMstrIackLocal;	/* CPU's PCI IACK Address */LOCAL ULONG sysPciMstrIsaMemLocal;	/* CPU's PCI ISA MEMORY Address */LOCAL ULONG sysPciMstrMemIoLocal;	/* CPU's PCI Memory Address */LOCAL ULONG sysPciSlvMemLocal;		/* PCI view of system memory */LOCAL ULONG sysPciMstrMemIoBus;		/* PCI view of PCI *//* forward declarations */char *  sysPhysMemTop		(void);		/* Top of physical memory */char * 	sysInfo 		(void);		void    sysMemMapDetect		(void);		/* detect PREP or CHRP map */void	sysCpuCheck 		(void);		/* detect CPU type */void    sysDelay		(void);		/* delay 1 millisecond */void	sysMsDelay		(UINT delay);	/* delay N millisecond(s) */ULONG   sys107RegRead           (ULONG regNum);void    sys107RegWrite          (ULONG regNum, ULONG regVal);STATUS  sysIntEnablePIC		(int intNum);	/* Enable i8259 or EPIC */ULONG   sysEUMBBARRead          (ULONG regNum);void    sysEUMBBARWrite         (ULONG regNum, ULONG regVal);#if defined INCLUDE_PCILOCAL STATUS sysPciSpecialCycle (int busNo, UINT32 message);LOCAL STATUS sysPciConfigRead (int busNo, int deviceNo, int funcNo,                                int offset, int width, void * pData);LOCAL STATUS sysPciConfigWrite (int busNo, int deviceNo, int funcNo,                                int offset, int width, ULONG data);#endif /* INCLUDE_PCI */#ifdef INCLUDE_MMU		/* add a sysPhysMemDesc entry */STATUS  sysMmuMapAdd		(void *address, UINT len,				 	 UINT initialStateMask, UINT initialState);#endif /* INCLUDE_MMU */#ifdef INCLUDE_NVRAM		/* NVRAM init and access routines */void    sysNvramHwInit		(void);UCHAR	sysNvRead		(ULONG);void	sysNvWrite		(ULONG, UCHAR);#if defined(INCLUDE_SYS_UPDATE_FLASH)	/* reprogram the bootrom */STATUS sysUpdateFlash (char * filename);#endif /* INCLUDE_SYS_UPDATE_FLASH */#endif /* INCLUDE_NVRAM */#if defined(INCLUDE_NETWORK) && defined(INCLUDE_END) 	/* network */#if defined(INCLUDE_DC_END) STATUS  sysDec21x40PciInit (void);     #endif /* INCLUDE_DC_END */#if defined(INCLUDE_FEI_END) void    sys557PciInit (void);        #endif /* INCLUDE_FEI_END */#if defined(INCLUDE_LN_97X_END)STATUS  sysLan97xPciInit (void);         #endif /* INCLUDE_LN_97X_END */#if defined(INCLUDE_EL_3C90X_END)STATUS sysEl3c90xPciInit (void);#endif /* INCLUDE_LN_97X_END */ #endif /* INCLUDE_NETWORK && INCLUDE_END *//* external imports */IMPORT VOID   sysOutWord	(ULONG address, UINT16 data);	/* sysALib.s */IMPORT VOID   sysOutLong	(ULONG address, ULONG data);	/* sysALib.s */IMPORT USHORT sysInWord		(ULONG address);		/* sysALib.s */IMPORT ULONG  sysInLong		(ULONG address);		/* sysALib.s */IMPORT VOID   sysOutByte 	(ULONG, UCHAR);			/* sysALib.s */IMPORT UCHAR  sysInByte		(ULONG);			/* sysALib.s */IMPORT STATUS sysMemProbeSup    (int length, char * src, char * dest);IMPORT VOIDFUNCPTR _pSysL2CacheInvFunc;IMPORT VOIDFUNCPTR _pSysL2CacheEnable;IMPORT VOIDFUNCPTR _pSysL2CacheDisable;IMPORT VOIDFUNCPTR _pSysL2CacheFlush;IMPORT BOOL snoopEnable;IMPORT ULONG sysPVRReadSys(void);IMPORT VOIDFUNCPTR _pSysL3CacheFlushDisableFunc;IMPORT VOIDFUNCPTR _pSysL3CacheInvalEnableFunc;/*  * mmuPpcBatInitMPC74x5 initializes the standard 4 (0-3)  I/D BAT's & * the additional 4 (4-7) I/D BAT's present on the MPC74[45]5. */IMPORT void mmuPpcBatInitMPC74x5 (UINT32 *pSysBatDesc);/*  * mmuPpcBatInitMPC7x5 initializes the standard 4 (0-3) I/D BAT's & * the additional 4 (4-7) I/D BAT's present on the MPC7[45]5. */IMPORT void mmuPpcBatInitMPC7x5 (UINT32 *pSysBatDesc);/* _pSysBatInitFunc needs to be set to either of the above 2 depending   on which processor it is running to make use of the additional BAT's   on the MPC 7455/755.   If this is not set or is set to NULL then the standard mmuPpcBatInit   fn. would be called which would initialize the (0-3) I/D BAT's*/IMPORT FUNCPTR _pSysBatInitFunc;#if defined INCLUDE_ATA                         /* ATA / EIDE driver */IMPORT ATA_CTRL   ataCtrl [];                   /* for sysAta.c */IMPORT VOIDFUNCPTR _func_sysAtaInit;#endif/*  By default this is set to NULL in the mmu Library and  in that case     the standard BAT init func. to initialize the 4 I/D BAT's is called.    If the standard & Extra BAT's need to be initialized then set this    to the ones supplied by the mmuLib or else implement your own fn. and    supply it here.*//* BSP DRIVERS */#include "vme/nullVme.c"		/* No VME bus on the Sandpoint */#include "w83553PciIbc.c"#include "sysEpic.c"#ifdef INCLUDE_DUART#   include "sysDuart.c"                /* 8245 Duart driver */#   include "sio/ns16550Sio.c"          /* NS Uart driver */#endif /* INCLUDE_DUART */#include "ns8730xSuperIo.c"		/* superIO support */#ifndef SP8240#include "sysCacheLockLib.c"		/* Cache Lock/unlock library */#endif/* * Note: local copies of pciConfigLig.c and pciAutoConfigLib.c are * provided to work around a board problem with device IDSEL=12 causing * a freeze-up when probed * */#if defined (INCLUDE_PCI)#    include "pci/pciIntLib.c"		/* PCI int support */#    include "pci/pciConfigLib.c"#    ifdef INCLUDE_SHOW_ROUTINES#       include "pci/pciConfigShow.c"	/* PCI config space display */#    endif /* INCLUDE_SHOW_ROUTINES */#    ifdef INCLUDE_PCI_AUTOCONF		/* Sandpoint uses autoconfig */#       include "pci/pciAutoConfigLib.c"    /* automatic PCI configuration */#       include "sysBusPci.c"		/* pciAutoConfig BSP support file */#    endif /*  INCLUDE_PCI_AUTOCONF */#endif /* INCLUDE_PCI */#if defined (INCLUDE_NVRAM)#    include "mem/byteNvRam.c"		/* byte nvram routines */#endif#ifdef INCLUDE_SYSCLK#include "timer/ppcDecTimer.c"#endif /* INCLUDE_SYSCLK */#ifdef INCLUDE_AUXCLK#    include "i8254AuxClk.c"		/* i8254 (on winbond) support */#endif#if defined(INCLUDE_SERIAL)#    include "sysSerial.c"		/* BSP i8250 sio/serial setup */#endif#ifdef	INCLUDE_ATA#  include "sysAta.c"			/* sysAtaInit() routine */#endif	/* INCLUDE_ATA */#ifdef INCLUDE_FDC#include "./isaDma.c"#include "./fdcDrv.c"#endif /* INCLUDE_FDC */#ifdef INCLUDE_NETWORK#    include "./sysNet.c"		/* network setup */#    ifdef INCLUDE_END#        ifdef INCLUDE_DC_END#            include "sysDec21x40End.c"#        endif /* INCLUDE_DC_END */#        ifdef INCLUDE_FEI_END#            include "sysFei82557End.c"#        endif /* INCLUDE_FEI_END */#        ifdef INCLUDE_LN_97X_END#            include "sysLn97xEnd.c"#        endif /* INCLUDE_LN_97X_END */#        ifdef INCLUDE_EL_3C90X_END#            include "sysEl3c90xEnd.c"#        endif /* INCLUDE_EL_3C90X_END */#    endif /* INCLUDE_END */#endif	/* INCLUDE_NETWORK */#ifdef  INCLUDE_FLASH#    include "mem/flashMem.c"		/* 29F040 is supported */#endif  /* INCLUDE_FLASH */#if defined(INCLUDE_WINDML)#    include "sysWindML.c"#endif /* INCLUDE_WINDML *//********************************************************************************* 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 Sandpoint - MPC8240"** RETURNS: A pointer to the string.*/char * sysModel (void)    {    ULONG regVal;    ULONG procVer;    sprintf (sysModelStr, "Motorola %s", SYS_MODEL);     /* The CPU type is indicated in the Processor Version Register (PVR) */     regVal = sysPVRReadSys();     procVer  = regVal & 0xffff;     regVal = regVal >>16;     switch (regVal)       {	  case CPU_TYPE_603:	     strcat (sysModelStr, "- MPC603");	     break;	  case CPU_TYPE_603E:	     strcat (sysModelStr, "- MPC603E");	     break;	  case CPU_TYPE_603P:	     strcat (sysModelStr, "- MPC603P");	     break;	  case CPU_TYPE_604:	     strcat (sysModelStr, "- MPC604");	     break;	  case CPU_TYPE_604E:	     strcat (sysModelStr, "- MPC604E");	     break;	  case CPU_TYPE_604R:	     strcat (sysModelStr, "- MPC604R");	     break;	  case CPU_TYPE_750:            if ( procVer == CPU_TYPE_745 )               strcat (sysModelStr, "- MPC745");            else            if ( procVer == CPU_TYPE_755 )               strcat (sysModelStr, "- MPC755");            else            if ( procVer == CPU_VER_750 )               strcat (sysModelStr, "- MPC750");            else            if ( procVer == CPU_VER_740 )               strcat (sysModelStr, "- MPC740");            else               strcat (sysModelStr, "- MPC7xx");            break;/*	     strcat (sysModelStr, "- MPC740/750");	    break;*/          case CPU_TYPE_8240:             strcat(sysModelStr, "- MPC8240");            break;          case CPU_TYPE_8245:#if defined(SP8241)             strcat(sysModelStr, "- MPC8241");#elif defined(SP8245)             strcat(sysModelStr, "- MPC8245");#else             strcat(sysModelStr, "- MPC8245/MPC8241");#endif            break;          case CPU_TYPE_7400:             strcat(sysModelStr, "- MPC7400");            break;          case CPU_TYPE_7410:             strcat(sysModelStr, "- MPC7410");            break;          case CPU_TYPE_7450:#if defined(SP7441)             strcat(sysModelStr, "- MPC7441");#else             strcat(sysModelStr, "- MPC7450");#endif            break;          case CPU_TYPE_7455:#if defined(SP7445)             strcat(sysModelStr, "- MPC7445");#else             strcat(sysModelStr, "- MPC7455");#endif            break;	  default:	     break;	 }	/* switch  */    return (sysModelStr);    }#if     defined (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* RETURNS: OK  -  for 7400 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:          case CPU_TYPE_7450:          case CPU_TYPE_7455:             altivecUnitPresent = OK;            break;          default:             break;         }      /* switch  */    return (altivecUnitPresent);    }#endif  /* INCLUDE_ALTIVEC *//********************************************************************************* sysInfo - return some information on the CPU board configuration** This routine returns a string containing the L2 backside cache size,* if enabled, the PCI map selected, and whether NVRAM is selected.* The string may contain line feeds. For example,**      512KB L2 backside cache enabled *      PCI Memory Map B*      NVRAM enabled** RETURNS: A pointer to the string.*/char * sysInfo (void)    {    /* Show memory map being used */    if (sysPciConfAddr == MPC107_CFG_ADDR_PREP)	strcpy(sysInfoStr, "PCI Memory Map A\n");    else	strcpy(sysInfoStr, "PCI Memory Map B\n");#ifdef USER_750_L2BACK	switch (L2_CACHE_BACK_SIDE_SIZE)	    {	    case L2CR_QM:		 strcpy(sysInfoStr, "256KB L2 backside cache enabled\n");		 break;	    case L2CR_HM:		 strcpy(sysInfoStr, "512KB L2 backside cache enabled\n");		 break;	    case L2CR_1M:		 strcpy(sysInfoStr, "1M L2 backside cache enabled\n");		 break;	    default:		 break;	    } /*switch */#endif /* USER_750_L2BACK */#ifdef  INCLUDE_NVRAM	strcat(sysInfoStr, "NVRAM enabled\n");#else	strcat(sysInfoStr, "No NVRAM enabled\n");#endif  /* INCLUDE_NVRAM */          return (sysInfoStr);    }/********************************************************************************* 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 hardware features of the board.* It is the first board-specific C code executed, and runs with* interrupts masked in the processor.* This routine resets all devices to a quiescent state, typically* by calling driver initialization routines.** NOTE: Because this routine may be called from sysToMonitor, it must* shutdown all potential DMA master devices.  If a device is doing DMA* at reboot time, the DMA could interfere with the reboot. For devices* on non-local busses, this is easy if the bus reset or sysFail line can* be asserted.** NOTE: This routine should not be called directly by any user application.** RETURNS: N/A*/void sysHwInit (void)    {    int         pciBusNo;       	/* PCI bus number */    int         pciDevNo;       	/* PCI device number */    int         pciFuncNo;      	/* PCI function number */#if defined(INCLUDE_MMU)    PHYS_MEM_DESC * pMmu;    int ix;    PCI_SYSTEM * pPci = &sysParams;   /* sysBusPci.[ch] */#endif /* defined(INCLUDE_MMU) */

⌨️ 快捷键说明

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