?? syspciautoconfig.c
字號:
/* sysPciAutoConfig.c - Motorola MPC5200 PCI autoconfig support *//* includes */#include "vxWorks.h"#include "logLib.h"#include "taskLib.h"#include "config.h"#ifdef INCLUDE_PCI_AUTOCONF#include "drv/pci/pciAutoConfigLib.h"#include "pci/pciAutoConfigLib.c" /* Auto discovery/config *//* typedefs *//* globals */PCI_SYSTEM sysParams;/* forward declarations */LOCAL UCHAR sysPciAutoConfigIntAsgn ( PCI_SYSTEM * pSys, PCI_LOC * pFunc, UCHAR intPin );LOCAL STATUS sysPciAutoConfigInclude ( PCI_SYSTEM *pSys, PCI_LOC *pciLoc, UINT devVend );/* Latency Timer value - 64 PCI clocks */#define PCI_LAT_TIMER 0x40/* subroutines *//************************************************************************* sysPciAutoConfigInclude - Determine if function is to be autoConfigured** This function is called with PCI bus, device, function, and vendor* information. It returns an indication of whether or not the particular* function should be included in the automatic configuration process.* This capability is useful if it is desired that a particular function* NOT be automatically configured. Of course, if the device is not* included in automatic configuration, it will be unusable unless the* user's code made provisions to configure the function outside of the* the automatic process.** RETURNS: TRUE if function is to be included in automatic configuration,* FALSE otherwise.*/LOCAL int sysPciAutoConfigInclude ( PCI_SYSTEM *pSys, /* input: AutoConfig system information */ PCI_LOC *pLoc, /* input: PCI address of this function */ UINT devVend /* input: Device/vendor ID number */ ) { BOOL retVal = OK; PCI_AUTO_DEBUG_MSG ("sysPciAutoConfigInclude: ps= %08x, pl= %08x, dv= %08x\n", (int)pSys, (int)pLoc, devVend,0,0,0); switch (devVend) { /* If it's the MPC5200 then exclude it as it is already be configured. * Note that ERROR is returned, so the device will not be auto-configured. */ case MPC5200B_PCI_ID: retVal = ERROR; break; default: retVal = OK; break; } return(retVal); }/************************************************************************* sysPciAutoConfigIntAssign - Assign the "interrupt line" value.** This routine assign the interrupt line value.** RETURNS: "interrupt line" value.*/LOCAL UCHAR sysPciAutoConfigIntAsgn ( PCI_SYSTEM * pSys, PCI_LOC * pLoc, UCHAR intPin ) { UCHAR irqValue = 0xff; if (intPin == 0 || pLoc->device >= PCI_MAX_DEV || pLoc->device < PCI_MIN_DEV) { return irqValue; }logMsg("sysPciAutoConfigIntAsgn(): bus=%d, dev=%d, int=%d\n", pLoc->bus, pLoc->device, intPin, 4,5,6); if (pLoc->bus == MPC5200_PCI_BRIDGE) { switch((pLoc->device)-PCI_MIN_DEV) { case 24: irqValue = 0; break; case 25: irqValue = 5; break; } } return irqValue; }/************************************************************************* sysPciAutoConfig - PCI autoConfig support routine** This routine instantiates the PCI_SYSTEM structure needed to configure* the system. This consists of assigning address ranges to each category* of PCI system resource: Prefetchable and Non-Prefetchable 32-bit Memory, and* 16- and 32-bit I/O. Global values for the Cache Line Size and Maximum* Latency are also specified. Finally, the four supplemental routines for * device inclusion/exclusion, interrupt assignment, and pre- and* post-enumeration bridge initialization are specified. ** RETURNS: N/A*/void sysPciAutoConfig ( void ) { /* 32-bit Prefetchable Memory Space */ sysParams.pciMem32 = BUS_PCI_MEM_ADRS; sysParams.pciMem32Size = PCI_MEM_SIZE; /* 32-bit non-Prefetchable Memory Space */ sysParams.pciMemIo32 = BUS_PCI_NO_PRE_MEM_ADRS; sysParams.pciMemIo32Size = PCI_NO_PRE_MEM_SIZE; /* 16-bit ISA I/O Space - First block of memory in the I/O space */ sysParams.pciIo16 = BUS_PCI_IO_ADRS; sysParams.pciIo16Size = 0xffff; /* TBD */ /* 32-bit PCI I/O Space - Remaining memory in the I/O space */ sysParams.pciIo32 = BUS_PCI_IO_ADRS+0x10000; sysParams.pciIo32Size = PCI_IO_SIZE-0x10000; /* Configuration space parameters */ sysParams.maxBus = PCI_MAX_BUS; sysParams.cacheSize = ( _CACHE_ALIGN_SIZE / 4 ); sysParams.maxLatency = PCI_LAT_TIMER; sysParams.autoIntRouting = TRUE; sysParams.includeRtn = sysPciAutoConfigInclude; sysParams.intAssignRtn = sysPciAutoConfigIntAsgn; sysParams.bridgePreConfigInit = NULL; sysParams.bridgePostConfigInit = NULL; pciAutoConfig (&sysParams); }#endif /* INCLUDE_PCI_AUTOCONF */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -