18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * amd8111_edac.h, EDAC defs for AMD8111 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 _AMD8111_EDAC_H_
138c2ecf20Sopenharmony_ci#define _AMD8111_EDAC_H_
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/************************************************************
168c2ecf20Sopenharmony_ci *	PCI Bridge Status and Command Register, DevA:0x04
178c2ecf20Sopenharmony_ci ************************************************************/
188c2ecf20Sopenharmony_ci#define REG_PCI_STSCMD	0x04
198c2ecf20Sopenharmony_cienum pci_stscmd_bits {
208c2ecf20Sopenharmony_ci	PCI_STSCMD_SSE		= BIT(30),
218c2ecf20Sopenharmony_ci	PCI_STSCMD_RMA		= BIT(29),
228c2ecf20Sopenharmony_ci	PCI_STSCMD_RTA		= BIT(28),
238c2ecf20Sopenharmony_ci	PCI_STSCMD_SERREN	= BIT(8),
248c2ecf20Sopenharmony_ci	PCI_STSCMD_CLEAR_MASK	= (PCI_STSCMD_SSE |
258c2ecf20Sopenharmony_ci				   PCI_STSCMD_RMA |
268c2ecf20Sopenharmony_ci				   PCI_STSCMD_RTA)
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/************************************************************
308c2ecf20Sopenharmony_ci *	PCI Bridge Memory Base-Limit Register, DevA:0x1c
318c2ecf20Sopenharmony_ci ************************************************************/
328c2ecf20Sopenharmony_ci#define REG_MEM_LIM     0x1c
338c2ecf20Sopenharmony_cienum mem_limit_bits {
348c2ecf20Sopenharmony_ci	MEM_LIMIT_DPE   = BIT(31),
358c2ecf20Sopenharmony_ci	MEM_LIMIT_RSE   = BIT(30),
368c2ecf20Sopenharmony_ci	MEM_LIMIT_RMA   = BIT(29),
378c2ecf20Sopenharmony_ci	MEM_LIMIT_RTA   = BIT(28),
388c2ecf20Sopenharmony_ci	MEM_LIMIT_STA   = BIT(27),
398c2ecf20Sopenharmony_ci	MEM_LIMIT_MDPE  = BIT(24),
408c2ecf20Sopenharmony_ci	MEM_LIMIT_CLEAR_MASK  = (MEM_LIMIT_DPE |
418c2ecf20Sopenharmony_ci				 MEM_LIMIT_RSE |
428c2ecf20Sopenharmony_ci				 MEM_LIMIT_RMA |
438c2ecf20Sopenharmony_ci				 MEM_LIMIT_RTA |
448c2ecf20Sopenharmony_ci				 MEM_LIMIT_STA |
458c2ecf20Sopenharmony_ci				 MEM_LIMIT_MDPE)
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/************************************************************
498c2ecf20Sopenharmony_ci *	HyperTransport Link Control Register, DevA:0xc4
508c2ecf20Sopenharmony_ci ************************************************************/
518c2ecf20Sopenharmony_ci#define REG_HT_LINK	0xc4
528c2ecf20Sopenharmony_cienum ht_link_bits {
538c2ecf20Sopenharmony_ci	HT_LINK_LKFAIL	= BIT(4),
548c2ecf20Sopenharmony_ci	HT_LINK_CRCFEN	= BIT(1),
558c2ecf20Sopenharmony_ci	HT_LINK_CLEAR_MASK = (HT_LINK_LKFAIL)
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/************************************************************
598c2ecf20Sopenharmony_ci *	PCI Bridge Interrupt and Bridge Control, DevA:0x3c
608c2ecf20Sopenharmony_ci ************************************************************/
618c2ecf20Sopenharmony_ci#define REG_PCI_INTBRG_CTRL	0x3c
628c2ecf20Sopenharmony_cienum pci_intbrg_ctrl_bits {
638c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_DTSERREN	= BIT(27),
648c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_DTSTAT		= BIT(26),
658c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_MARSP		= BIT(21),
668c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_SERREN		= BIT(17),
678c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_PEREN		= BIT(16),
688c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_CLEAR_MASK	= (PCI_INTBRG_CTRL_DTSTAT),
698c2ecf20Sopenharmony_ci	PCI_INTBRG_CTRL_POLL_MASK	= (PCI_INTBRG_CTRL_DTSERREN |
708c2ecf20Sopenharmony_ci					   PCI_INTBRG_CTRL_MARSP |
718c2ecf20Sopenharmony_ci					   PCI_INTBRG_CTRL_SERREN)
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/************************************************************
758c2ecf20Sopenharmony_ci *		I/O Control 1 Register, DevB:0x40
768c2ecf20Sopenharmony_ci ************************************************************/
778c2ecf20Sopenharmony_ci#define REG_IO_CTRL_1 0x40
788c2ecf20Sopenharmony_cienum io_ctrl_1_bits {
798c2ecf20Sopenharmony_ci	IO_CTRL_1_NMIONERR	= BIT(7),
808c2ecf20Sopenharmony_ci	IO_CTRL_1_LPC_ERR	= BIT(6),
818c2ecf20Sopenharmony_ci	IO_CTRL_1_PW2LPC	= BIT(1),
828c2ecf20Sopenharmony_ci	IO_CTRL_1_CLEAR_MASK	= (IO_CTRL_1_LPC_ERR | IO_CTRL_1_PW2LPC)
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/************************************************************
868c2ecf20Sopenharmony_ci *		Legacy I/O Space Registers
878c2ecf20Sopenharmony_ci ************************************************************/
888c2ecf20Sopenharmony_ci#define REG_AT_COMPAT 0x61
898c2ecf20Sopenharmony_cienum at_compat_bits {
908c2ecf20Sopenharmony_ci	AT_COMPAT_SERR		= BIT(7),
918c2ecf20Sopenharmony_ci	AT_COMPAT_IOCHK		= BIT(6),
928c2ecf20Sopenharmony_ci	AT_COMPAT_CLRIOCHK	= BIT(3),
938c2ecf20Sopenharmony_ci	AT_COMPAT_CLRSERR	= BIT(2),
948c2ecf20Sopenharmony_ci};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistruct amd8111_dev_info {
978c2ecf20Sopenharmony_ci	u16 err_dev;	/* PCI Device ID */
988c2ecf20Sopenharmony_ci	struct pci_dev *dev;
998c2ecf20Sopenharmony_ci	int edac_idx;	/* device index */
1008c2ecf20Sopenharmony_ci	char *ctl_name;
1018c2ecf20Sopenharmony_ci	struct edac_device_ctl_info *edac_dev;
1028c2ecf20Sopenharmony_ci	void (*init)(struct amd8111_dev_info *dev_info);
1038c2ecf20Sopenharmony_ci	void (*exit)(struct amd8111_dev_info *dev_info);
1048c2ecf20Sopenharmony_ci	void (*check)(struct edac_device_ctl_info *edac_dev);
1058c2ecf20Sopenharmony_ci};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_cistruct amd8111_pci_info {
1088c2ecf20Sopenharmony_ci	u16 err_dev;	/* PCI Device ID */
1098c2ecf20Sopenharmony_ci	struct pci_dev *dev;
1108c2ecf20Sopenharmony_ci	int edac_idx;	/* pci index */
1118c2ecf20Sopenharmony_ci	const char *ctl_name;
1128c2ecf20Sopenharmony_ci	struct edac_pci_ctl_info *edac_dev;
1138c2ecf20Sopenharmony_ci	void (*init)(struct amd8111_pci_info *dev_info);
1148c2ecf20Sopenharmony_ci	void (*exit)(struct amd8111_pci_info *dev_info);
1158c2ecf20Sopenharmony_ci	void (*check)(struct edac_pci_ctl_info *edac_dev);
1168c2ecf20Sopenharmony_ci};
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#endif /* _AMD8111_EDAC_H_ */
119