2007-11-21 Till Straumann <strauman@slac.stanford.edu>

* Makefile.am, motorola_powerpc/Makefile.am,
	* shared/pci/detect_raven_bridge.c, Makefile.am,
	* shared/pci/generic_clear_hberrs.c: separated the generic
	version of _BSP_clear_hostbridge_errors() into its own
	file.
This commit is contained in:
Till Straumann
2007-11-21 08:03:30 +00:00
parent d371a97e58
commit 5a8e5df7d4
5 changed files with 79 additions and 49 deletions

View File

@@ -1,3 +1,11 @@
2007-11-21 Till Straumann <strauman@slac.stanford.edu>
* Makefile.am, motorola_powerpc/Makefile.am,
* shared/pci/detect_raven_bridge.c, Makefile.am,
* shared/pci/generic_clear_hberrs.c: separated the generic
version of _BSP_clear_hostbridge_errors() into its own
file.
2007-11-06 Till Straumann <strauman@slac.stanford.edu>
* ep1a/irq/irq.c, gen5200/irq/irq.c, mbx8xx/irq/irq.c,

View File

@@ -35,7 +35,8 @@ EXTRA_DIST += shared/console/console.c shared/console/inch.c shared/console/poll
EXTRA_DIST += shared/motorola/motorola.c
## shared/pci
EXTRA_DIST += shared/pci/pci.c shared/pci/detect_raven_bridge.c shared/pci/pcifinddevice.c
EXTRA_DIST += shared/pci/pci.c shared/pci/detect_raven_bridge.c shared/pci/pcifinddevice.c \
shared/pci/generic_clear_hberrs.c
## shared/residual
EXTRA_DIST += shared/residual/residual.c

View File

@@ -110,6 +110,7 @@ include_bsp_HEADERS += ../../powerpc/shared/pci/pci.h
noinst_PROGRAMS += pci.rel
pci_rel_SOURCES = ../../powerpc/shared/pci/pci.c \
../../powerpc/shared/pci/detect_raven_bridge.c \
../../powerpc/shared/pci/generic_clear_hberrs.c \
../../powerpc/shared/pci/pcifinddevice.c ../../powerpc/shared/pci/pci.h
pci_rel_CPPFLAGS = $(AM_CPPFLAGS)
pci_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)

View File

@@ -32,53 +32,6 @@
extern const pci_config_access_functions pci_direct_functions;
extern const pci_config_access_functions pci_indirect_functions;
#define PCI_ERR_BITS 0xf900
#define PCI_STATUS_OK(x) (!((x)&PCI_ERR_BITS))
/* For now, just clear errors in the PCI status reg.
*
* Returns: (for diagnostic purposes)
* original settings (i.e. before applying the clearing
* sequence) or the error bits or 0 if there were no errors.
*
*/
unsigned long
_BSP_clear_hostbridge_errors(int enableMCP, int quiet)
{
unsigned long rval;
unsigned short pcistat;
int count;
if (enableMCP)
return -1; /* exceptions not supported / MCP not wired */
/* read error status for info return */
pci_read_config_word(0,0,0,PCI_STATUS,&pcistat);
rval = pcistat;
count=10;
do {
/* clear error reporting registers */
/* clear PCI status register */
pci_write_config_word(0,0,0,PCI_STATUS, PCI_ERR_BITS);
/* read new status */
pci_read_config_word(0,0,0,PCI_STATUS, &pcistat);
} while ( ! PCI_STATUS_OK(pcistat) && count-- );
if ( !PCI_STATUS_OK(rval) && !quiet) {
printk("Cleared PCI errors: pci_stat was 0x%04x\n", rval);
}
if ( !PCI_STATUS_OK(pcistat) ) {
printk("Unable to clear PCI errors: still 0x%04x after 10 attempts\n", pcistat);
}
return rval & PCI_ERR_BITS;
}
#if (defined(mpc8240) || defined(mpc8245))
/* FIXME - this should really be in a separate file - the 2100 doesn't
* have a raven chip so there is no point having 2100 code here
@@ -112,7 +65,7 @@ void detect_host_bridge()
* API, sigh...).
* So for the moment, we just don't use MCP on all mvme2xxx
* boards (using the generic, hostbridge-independent 'clear'
* implementation above).
* implementation [generic_clear_hberrs.c]).
*/
/*
* enableMCP: whether to enable MCP checkstop / machine check interrupts

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
#include <libcpu/io.h>
#include <libcpu/spr.h>
#include <bsp.h>
#include <bsp/pci.h>
#include <rtems/bspIo.h>
#define PCI_ERR_BITS 0xf900
#define PCI_STATUS_OK(x) (!((x)&PCI_ERR_BITS))
/* For now, just clear errors in the PCI status reg.
*
* Returns: (for diagnostic purposes)
* original settings (i.e. before applying the clearing
* sequence) or the error bits or 0 if there were no errors.
*
*/
unsigned short
(*_BSP_clear_vmebridge_errors)(int) = 0;
unsigned long
_BSP_clear_hostbridge_errors(int enableMCP, int quiet)
{
unsigned long rval;
unsigned short pcistat;
int count;
if (enableMCP)
return -1; /* exceptions not supported / MCP not wired */
/* read error status for info return */
pci_read_config_word(0,0,0,PCI_STATUS,&pcistat);
rval = pcistat;
count=10;
do {
/* clear error reporting registers */
/* clear PCI status register */
pci_write_config_word(0,0,0,PCI_STATUS, PCI_ERR_BITS);
/* read new status */
pci_read_config_word(0,0,0,PCI_STATUS, &pcistat);
} while ( ! PCI_STATUS_OK(pcistat) && count-- );
if ( !PCI_STATUS_OK(rval) && !quiet) {
printk("Cleared PCI errors: pci_stat was 0x%04x\n", rval);
}
if ( !PCI_STATUS_OK(pcistat) ) {
printk("Unable to clear PCI errors: still 0x%04x after 10 attempts\n", pcistat);
}
rval &= PCI_ERR_BITS;
/* Some VME bridges (Tsi148) don't propagate VME bus errors to PCI status reg. */
if ( _BSP_clear_vmebridge_errors )
rval |= _BSP_clear_vmebridge_errors(quiet)<<16;
return rval;
}