📄 syspciautoconfig.c
字号:
/* sysPciAutoConfig.c - template PCI autoconfig support *//* Copyright 2002 Wind River Systems, Inc. *//*modification history--------------------01a,21may02,scm written.*//* TODO - Fill in this file with I/O addresses and related constants for the template BSP. Anything with "template" as a prefix needs to examined and re-named to id the BSP (i.e. iq80321, iq80310, etc.) *//*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 "drv/pci/pciAutoConfigLib.c"/* defines *//* Latency Timer value - 255 PCI clocks */#undef PCI_LATENCY_TIMER#define PCI_LATENCY_TIMER 0xff/* globals *//* locals */LOCAL PCI_SYSTEM sysParams;/* forward declarations */LOCAL int sysPciAutoConfigInclude (PCI_SYSTEM *pSys, PCI_LOC *pciLoc, UINT devVend);LOCAL UCHAR sysPciAutoConfigIntAsgn (PCI_SYSTEM *pSys, PCI_LOC *pFunc, UCHAR intPin);#if 0/* at the current time not needed... */LOCAL void sysPciAutoconfigPreEnumBridgeInit (PCI_SYSTEM *pSys, PCI_LOC *pLoc, UINT devVend);LOCAL void sysPciAutoconfigPostEnumBridgeInit (PCI_SYSTEM *pSys, PCI_LOC *pLoc, UINT devVend);#endif/* subroutines */void sysPciAutoConfig (void);/******************************************************************************** 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 *pciLoc, /* input: PCI address of this function */ UINT devVend /* input: Device/vendor ID number */ ) { BOOL retVal = ERROR; /* default to excluded */ /* If it's the host bridge then exclude it */ if ((pciLoc->bus == 0) && (pciLoc->device == 0) && (pciLoc->function == 0)) { return ERROR; } switch(devVend) { /* TODO - add any excluded devices by device/vendor ID here */ default: retVal = OK; break; } return retVal; }/******************************************************************************** sysPciAutoConfigIntAssign - Assign the "interrupt line" value.** RETURNS: "interrupt line" value.*/LOCAL UCHAR sysPciAutoConfigIntAsgn ( PCI_SYSTEM *pSys, /* input: AutoConfig system information */ PCI_LOC *pFunc, UCHAR intPin /* input: interrupt pin number */ ) { if(pFunc->bus != 0) return (UCHAR)ERROR; switch(pFunc->device) { /* TODO - add any non-standard interrupt assignments here, FEI, GEI, Secondary PCI Slot, etc. */ default: /* ... */ return (UCHAR)0xff; break; } }#if 0/* at the current time not needed... *//******************************************************************************** sysPciAutoconfigPreEnumBridgeInit - Pre-Bridge Initialization.** RETURNS: N/A*/LOCAL void sysPciAutoconfigPreEnumBridgeInit ( PCI_SYSTEM * pSys, /* PCI_SYSTEM structure pointer */ PCI_LOC * pLoc, /* pointer to function in question */ UINT devVend /* deviceID/vendorID of device */ ) { return; }/******************************************************************************** sysPciAutoconfigPostEnumBridgeInit - Post-Bridge Initialization.** RETURNS: N/A*/LOCAL void sysPciAutoconfigPostEnumBridgeInit ( PCI_SYSTEM * pSys, /* PCI_SYSTEM structure pointer */ PCI_LOC * pLoc, /* pointer to function in question */ UINT devVend /* deviceID/vendorID of device */ ) { return; }#endif/********************************************************************************* 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) { /* TODO - define platform-specific PCI address spaces here */ /* 32-bit Non-Prefetchable Memory Space */ sysParams.pciMemIo32 = template_PCI_MEM0_BASE; sysParams.pciMemIo32Size = SZ_64M; /* 32-bit Prefetchable Memory Space */ sysParams.pciMem32 = 0; sysParams.pciMem32Size = 0; /* 16-bit ISA I/O Space */ sysParams.pciIo16 = template_PCI_IO16_BASE; sysParams.pciIo16Size = SZ_32K; /* 32-bit PCI I/O Space */ sysParams.pciIo32 = template_PCI_IO_BASE; sysParams.pciIo32Size = SZ_32K; /* Configuration space parameters */ sysParams.cacheSize = 32; sysParams.maxLatency = PCI_LATENCY_TIMER; sysParams.autoIntRouting = FALSE; sysParams.includeRtn = sysPciAutoConfigInclude; sysParams.intAssignRtn = sysPciAutoConfigIntAsgn; sysParams.bridgePreConfigInit = NULL; /* sysPciAutoconfigPreEnumBridgeInit; */ sysParams.bridgePostConfigInit = NULL; /* sysPciAutoconfigPostEnumBridgeInit; */ /* Perform AutoConfig */ pciAutoConfig (&sysParams); }#endif /* INCLUDE_PCI_AUTOCONF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -