source: rtems/c/src/lib/libbsp/powerpc/shared/pci/generic_clear_hberrs.c @ f6f764c1

5
Last change on this file since f6f764c1 was f6f764c1, checked in by Sebastian Huber <sebastian.huber@…>, on 02/15/17 at 12:28:02

bsps/powerpc: Fix warnings

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[5a8e5df7]1#include <libcpu/io.h>
2#include <libcpu/spr.h>
3
4#include <bsp.h>
5#include <bsp/pci.h>
6
7#include <rtems/bspIo.h>
8
9#define PCI_ERR_BITS        0xf900
10#define PCI_STATUS_OK(x)    (!((x)&PCI_ERR_BITS))
11
12/* For now, just clear errors in the PCI status reg.
13 *
14 * Returns: (for diagnostic purposes)
15 *          original settings (i.e. before applying the clearing
16 *          sequence) or the error bits or 0 if there were no errors.
17 *
18 */
19
20unsigned short
21(*_BSP_clear_vmebridge_errors)(int) = 0;
22
23unsigned long
24_BSP_clear_hostbridge_errors(int enableMCP, int quiet)
25{
26unsigned long   rval;
27unsigned short  pcistat;
28int             count;
29
30    if (enableMCP)
31        return -1; /* exceptions not supported / MCP not wired */
32
33    /* read error status for info return */
34    pci_read_config_word(0,0,0,PCI_STATUS,&pcistat);
35    rval = pcistat;
36
37    count=10;
38    do {
39        /* clear error reporting registers */
40
41        /* clear PCI status register */
42        pci_write_config_word(0,0,0,PCI_STATUS, PCI_ERR_BITS);
43
44        /* read  new status */
45        pci_read_config_word(0,0,0,PCI_STATUS, &pcistat);
46
47    } while ( ! PCI_STATUS_OK(pcistat) && count-- );
48
49    if ( !PCI_STATUS_OK(rval) && !quiet) {
[f6f764c1]50        printk("Cleared PCI errors: pci_stat was 0x%04lx\n", rval);
[5a8e5df7]51    }
52    if ( !PCI_STATUS_OK(pcistat) ) {
53        printk("Unable to clear PCI errors: still 0x%04x after 10 attempts\n", pcistat);
54    }
[ac7af4a]55
[5a8e5df7]56        rval &= PCI_ERR_BITS;
57
58        /* Some VME bridges (Tsi148) don't propagate VME bus errors to PCI status reg. */
59        if ( _BSP_clear_vmebridge_errors )
60                rval |= _BSP_clear_vmebridge_errors(quiet)<<16;
61
62    return rval;
63}
Note: See TracBrowser for help on using the repository browser.