📄 syspciautoconfig.c
字号:
/* sysPciAutoConfig.c - SBC8240/8245 PCI autoconfig support *//* Copyright 1984-2001 Wind River Systems, Inc. *//*modification history--------------------01a,30mar01,gh written.*//*DESCRIPTIONThis module contains the "non-generic" or "board specific" PCI-PCIbridge initialization code. The module contains code to: 1. Determine if a particular function is to be excluded from the automatic configuration process. 2. Program the "interrupt line" field of the PCI configuration header.*//* 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;/* locals *//* 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 */ ) { STATUS retVal = OK ; 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 retVal = 0xFF; if (pLoc->bus == MPC8240_PCI_BRIDGE) { if (pLoc->device == PCI_SLOT_J3) retVal = PCI_INTA_IRQ; /* PCI slot J3 */ else if (pLoc->device == PCI_SLOT_J2) retVal = PCI_INTB_IRQ; /* PCI slot J2 */ } return retVal; }/************************************************************************* 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 ) { UINT32 picr1; /* 32-bit Prefetchable Memory Space */ sysParams.pciMem32 = CPU_PCI_MEM_ADRS; sysParams.pciMem32Size = CPU_PCI_MEM_SIZE; /* 32-bit non-Prefetchable Memory Space */ sysParams.pciMemIo32 = CPU_PCI_NO_PRE_MEM_ADRS; sysParams.pciMemIo32Size = CPU_PCI_NO_PRE_MEM_SIZE; /* 16-bit ISA I/O Space - First block of memory in the I/O space */ sysParams.pciIo16 = 0x00008000; sysParams.pciIo16Size = 0x00008000; /* 32-bit PCI I/O Space - Remaining memory in the I/O space */ sysParams.pciIo32 = 0x00800000; sysParams.pciIo32Size = 0x00400000; /* 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; pciConfigInLong (0,0,0,0xa8,&picr1); /* read PICR1 */ /* disable MCP */ pciConfigOutLong (0,0,0,0xa8,picr1 & ~0x00000800); pciAutoConfig (&sysParams); /* re-enable MCP */ pciConfigOutLong (0,0,0,0xa8,picr1); }#endif /* INCLUDE_PCI_AUTOCONF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -