18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * amd8131_edac.h, EDAC defs for AMD8131 hypertransport chip 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2008 Wind River Systems, Inc. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Authors: Cao Qingtao <qingtao.cao@windriver.com> 88c2ecf20Sopenharmony_ci * Benjamin Walsh <benjamin.walsh@windriver.com> 98c2ecf20Sopenharmony_ci * Hu Yongqi <yongqi.hu@windriver.com> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#ifndef _AMD8131_EDAC_H_ 138c2ecf20Sopenharmony_ci#define _AMD8131_EDAC_H_ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define DEVFN_PCIX_BRIDGE_NORTH_A 8 168c2ecf20Sopenharmony_ci#define DEVFN_PCIX_BRIDGE_NORTH_B 16 178c2ecf20Sopenharmony_ci#define DEVFN_PCIX_BRIDGE_SOUTH_A 24 188c2ecf20Sopenharmony_ci#define DEVFN_PCIX_BRIDGE_SOUTH_B 32 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/************************************************************ 218c2ecf20Sopenharmony_ci * PCI-X Bridge Status and Command Register, DevA:0x04 228c2ecf20Sopenharmony_ci ************************************************************/ 238c2ecf20Sopenharmony_ci#define REG_STS_CMD 0x04 248c2ecf20Sopenharmony_cienum sts_cmd_bits { 258c2ecf20Sopenharmony_ci STS_CMD_SSE = BIT(30), 268c2ecf20Sopenharmony_ci STS_CMD_SERREN = BIT(8) 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/************************************************************ 308c2ecf20Sopenharmony_ci * PCI-X Bridge Interrupt and Bridge Control Register, 318c2ecf20Sopenharmony_ci ************************************************************/ 328c2ecf20Sopenharmony_ci#define REG_INT_CTLR 0x3c 338c2ecf20Sopenharmony_cienum int_ctlr_bits { 348c2ecf20Sopenharmony_ci INT_CTLR_DTSE = BIT(27), 358c2ecf20Sopenharmony_ci INT_CTLR_DTS = BIT(26), 368c2ecf20Sopenharmony_ci INT_CTLR_SERR = BIT(17), 378c2ecf20Sopenharmony_ci INT_CTLR_PERR = BIT(16) 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/************************************************************ 418c2ecf20Sopenharmony_ci * PCI-X Bridge Memory Base-Limit Register, DevA:0x1C 428c2ecf20Sopenharmony_ci ************************************************************/ 438c2ecf20Sopenharmony_ci#define REG_MEM_LIM 0x1c 448c2ecf20Sopenharmony_cienum mem_limit_bits { 458c2ecf20Sopenharmony_ci MEM_LIMIT_DPE = BIT(31), 468c2ecf20Sopenharmony_ci MEM_LIMIT_RSE = BIT(30), 478c2ecf20Sopenharmony_ci MEM_LIMIT_RMA = BIT(29), 488c2ecf20Sopenharmony_ci MEM_LIMIT_RTA = BIT(28), 498c2ecf20Sopenharmony_ci MEM_LIMIT_STA = BIT(27), 508c2ecf20Sopenharmony_ci MEM_LIMIT_MDPE = BIT(24), 518c2ecf20Sopenharmony_ci MEM_LIMIT_MASK = MEM_LIMIT_DPE|MEM_LIMIT_RSE|MEM_LIMIT_RMA| 528c2ecf20Sopenharmony_ci MEM_LIMIT_RTA|MEM_LIMIT_STA|MEM_LIMIT_MDPE 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/************************************************************ 568c2ecf20Sopenharmony_ci * Link Configuration And Control Register, side A 578c2ecf20Sopenharmony_ci ************************************************************/ 588c2ecf20Sopenharmony_ci#define REG_LNK_CTRL_A 0xc4 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/************************************************************ 618c2ecf20Sopenharmony_ci * Link Configuration And Control Register, side B 628c2ecf20Sopenharmony_ci ************************************************************/ 638c2ecf20Sopenharmony_ci#define REG_LNK_CTRL_B 0xc8 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cienum lnk_ctrl_bits { 668c2ecf20Sopenharmony_ci LNK_CTRL_CRCERR_A = BIT(9), 678c2ecf20Sopenharmony_ci LNK_CTRL_CRCERR_B = BIT(8), 688c2ecf20Sopenharmony_ci LNK_CTRL_CRCFEN = BIT(1) 698c2ecf20Sopenharmony_ci}; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cienum pcix_bridge_inst { 728c2ecf20Sopenharmony_ci NORTH_A = 0, 738c2ecf20Sopenharmony_ci NORTH_B = 1, 748c2ecf20Sopenharmony_ci SOUTH_A = 2, 758c2ecf20Sopenharmony_ci SOUTH_B = 3, 768c2ecf20Sopenharmony_ci NO_BRIDGE = 4 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistruct amd8131_dev_info { 808c2ecf20Sopenharmony_ci int devfn; 818c2ecf20Sopenharmony_ci enum pcix_bridge_inst inst; 828c2ecf20Sopenharmony_ci struct pci_dev *dev; 838c2ecf20Sopenharmony_ci int edac_idx; /* pci device index */ 848c2ecf20Sopenharmony_ci char *ctl_name; 858c2ecf20Sopenharmony_ci struct edac_pci_ctl_info *edac_dev; 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* 898c2ecf20Sopenharmony_ci * AMD8131 chipset has two pairs of PCIX Bridge and related IOAPIC 908c2ecf20Sopenharmony_ci * Controller, and ATCA-6101 has two AMD8131 chipsets, so there are 918c2ecf20Sopenharmony_ci * four PCIX Bridges on ATCA-6101 altogether. 928c2ecf20Sopenharmony_ci * 938c2ecf20Sopenharmony_ci * These PCIX Bridges share the same PCI Device ID and are all of 948c2ecf20Sopenharmony_ci * Function Zero, they could be discrimated by their pci_dev->devfn. 958c2ecf20Sopenharmony_ci * They share the same set of init/check/exit methods, and their 968c2ecf20Sopenharmony_ci * private structures are collected in the devices[] array. 978c2ecf20Sopenharmony_ci */ 988c2ecf20Sopenharmony_cistruct amd8131_info { 998c2ecf20Sopenharmony_ci u16 err_dev; /* PCI Device ID for AMD8131 APIC*/ 1008c2ecf20Sopenharmony_ci struct amd8131_dev_info *devices; 1018c2ecf20Sopenharmony_ci void (*init)(struct amd8131_dev_info *dev_info); 1028c2ecf20Sopenharmony_ci void (*exit)(struct amd8131_dev_info *dev_info); 1038c2ecf20Sopenharmony_ci void (*check)(struct edac_pci_ctl_info *edac_dev); 1048c2ecf20Sopenharmony_ci}; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#endif /* _AMD8131_EDAC_H_ */ 1078c2ecf20Sopenharmony_ci 108