source: rtems/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c @ 8bbf69e

4.115
Last change on this file since 8bbf69e was 8bbf69e, checked in by Joel Sherrill <joel.sherrill@…>, on 05/16/12 at 21:04:10

pci.h cleanup - Consolidate common defines to cpukit pci.h

+ libbsp/sparc/shared/include/pci.h was largely a copy of

an older version of the cpukit pci.h. Removed much of the
contents and included <rtems/pci.h>.

+ sparc/*/pci*.c - Move to <rtems/pci.h> required updating

to use uint32_t for dword accesses.

+ Rename PCI_MULTI_FUNCTION to PCI_HEADER_TYPE_MULTI_FUNCTION
+ Define PCI_HEADER_TYPE_MULTI_FUNCTION in cpukit pci.h and remove

PCI_MULTI_FUNCTION definitions in C files.

+ Move PCI_INVALID_VENDORDEVICEID definitions from various C files

to cpukit pci.h

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * detect_host_bridge.c
3 *
4 * This code is inspired by detect_grackle_bridge.c of SVGM BSP
5 * written by Till Straumann
6 * Copyright (C) 2001, 2003 Till Straumann <strauman@slac.stanford.edu>
7 *
8 * Copyright (C) 2004 S. Kate Feng, <feng1@bnl.gov>
9 * wrote it to support the MVME5500 board.
10 *
11 */
12#include <libcpu/io.h>
13#include <rtems/bspIo.h>            /* printk */
14
15#include <bsp/pci.h>
16#include <bsp/gtreg.h>
17#include <bsp/gtpcireg.h>
18
19#include <stdio.h>
20#include <string.h>
21
22#define PCI_DEBUG 0
23
24#define HOSTBRIDGET_ERROR               0xf0000000
25
26unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet)
27{
28  uint32_t pcidata, pcidata1;
29  int PciLocal, busNumber=0;
30
31  /* On the mvme5500 board, the GT64260B system controller had the MCP
32   * signal pulled up high.  Thus, the MCP signal is not used as it is
33   * on other boards such as mvme2307.
34   */
35  if (enableMCP) return(-1);
36  for (PciLocal=0; PciLocal<1; PciLocal++ ) {
37     pci_read_config_dword(busNumber,
38                        0,
39                        0,
40                        PCI_COMMAND,
41                        &pcidata);
42
43    if (!quiet)
44    printk("Before _BSP_clear_hostbridge_errors(): 0x%x, cause 0x%x\n",
45           pcidata, inl(0x1d58));
46
47    outl(0,0x1d58);
48
49    /* Clear the error on the host bridge */
50    pcidata1= pcidata;
51    pcidata1 |= PCI_STATUS_CLRERR_MASK;
52    pcidata1 |= 0x140;
53    pci_write_config_dword(busNumber,
54                               0,
55                               0,
56                          PCI_COMMAND,
57                          pcidata1);
58
59    pci_read_config_dword(busNumber,
60                               0,
61                               0,
62                          PCI_COMMAND,
63                          &pcidata1);
64
65    if (!quiet) printk("After _BSP_clear_hostbridge_errors(): sts 0x%x\n",
66                        pcidata1);
67    if (pcidata1 & HOSTBRIDGET_ERROR) printk("BSP_clear_hostbridge_errors(): unable to clear pending hostbridge errors\n");
68    busNumber += BSP_MAX_PCI_BUS_ON_PCI0;
69  }
70  return(pcidata &  HOSTBRIDGET_ERROR);
71}
Note: See TracBrowser for help on using the repository browser.