File indexing completed on 2025-05-11 08:23:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
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
0033
0034
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
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 }