Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:57

0001 /*
0002  * detect_host_bridge.c
0003  *
0004  * This code is inspired by detect_grackle_bridge.c of SVGM BSP
0005  * written by Till Straumann
0006  * Copyright (C) 2001, 2003 Till Straumann <strauman@slac.stanford.edu>
0007  *
0008  * Copyright (C) 2004 S. Kate Feng, <feng1@bnl.gov>
0009  * wrote it to support the MVME5500 board.
0010  *
0011  */
0012 #include <libcpu/io.h>
0013 #include <rtems/bspIo.h>        /* printk */
0014 
0015 #include <bsp/pci.h>
0016 #include <bsp/gtreg.h>
0017 #include <bsp/gtpcireg.h>
0018 
0019 #include <stdio.h>
0020 #include <string.h>
0021 #include <inttypes.h>
0022 
0023 #define PCI_DEBUG 0
0024 
0025 #define HOSTBRIDGET_ERROR               0xf0000000
0026 
0027 unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet)
0028 {
0029   uint32_t pcidata, pcidata1;
0030   int PciLocal, busNumber=0;
0031 
0032   /* On the mvme5500 board, the GT64260B system controller had the MCP
0033    * signal pulled up high.  Thus, the MCP signal is not used as it is
0034    * on other boards such as mvme2307.
0035    */
0036   if (enableMCP) return(-1);
0037   for (PciLocal=0; PciLocal<1; PciLocal++ ) {
0038      pci_read_config_dword(busNumber,
0039             0,
0040             0,
0041                 PCI_COMMAND,
0042                         &pcidata);
0043 
0044     if (!quiet)
0045     printk("Before _BSP_clear_hostbridge_errors(): 0x%" PRIx32 ", cause 0x%lx\n",
0046        pcidata, inl(0x1d58));
0047 
0048     outl(0,0x1d58);
0049 
0050     /* Clear the error on the host bridge */
0051     pcidata1= pcidata;
0052     pcidata1 |= PCI_STATUS_CLRERR_MASK;
0053     pcidata1 |= 0x140;
0054     pci_write_config_dword(busNumber,
0055                    0,
0056                    0,
0057               PCI_COMMAND,
0058                           pcidata1);
0059 
0060     pci_read_config_dword(busNumber,
0061                    0,
0062                    0,
0063               PCI_COMMAND,
0064                           &pcidata1);
0065 
0066     if (!quiet) printk("After _BSP_clear_hostbridge_errors(): sts 0x%" PRIx32 "\n",
0067                         pcidata1);
0068     if (pcidata1 & HOSTBRIDGET_ERROR) printk("BSP_clear_hostbridge_errors(): unable to clear pending hostbridge errors\n");
0069     busNumber += BSP_MAX_PCI_BUS_ON_PCI0;
0070   }
0071   return(pcidata &  HOSTBRIDGET_ERROR);
0072 }