xref: /titanic_51/usr/src/uts/sun4u/sys/pci/pci_ecc.h (revision b453864f3587ccc3324d7a3b0438a1e542dcfde7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PCI_ECC_H
28 #define	_SYS_PCI_ECC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/errorq.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 typedef struct ecc_intr_info {
39 	struct ecc *ecc_p;
40 
41 	int ecc_type;			/* CBNINTR_UE or CBNINTR_CE */
42 
43 	/*
44 	 * ECC status registers.
45 	 */
46 	uint64_t ecc_afsr_pa;
47 	uint64_t ecc_afar_pa;
48 
49 	/*
50 	 * Implementation-specific masks & shift values.
51 	 */
52 	uint64_t ecc_errpndg_mask;	/* 0 if not applicable. */
53 	uint64_t ecc_offset_mask;
54 	uint_t ecc_offset_shift;
55 	uint_t ecc_size_log2;
56 } ecc_intr_info_t;
57 
58 typedef struct ecc {
59 	pci_common_t *ecc_pci_cmn_p;
60 
61 	/*
62 	 * ECC control and status registers:
63 	 */
64 	volatile uint64_t ecc_csr_pa;
65 
66 	/*
67 	 * Information specific to error type.
68 	 */
69 	struct ecc_intr_info ecc_ue;
70 	struct ecc_intr_info ecc_ce;
71 	timeout_id_t ecc_to_id;
72 } ecc_t;
73 
74 extern void ecc_create(pci_t *pci_p);
75 extern int ecc_register_intr(pci_t *pci_p);
76 extern void ecc_destroy(pci_t *pci_p);
77 extern void ecc_configure(pci_t *pci_p);
78 extern void ecc_enable_intr(pci_t *pci_p);
79 extern void ecc_disable_wait(ecc_t *ecc_p);
80 extern uint_t ecc_disable_nowait(ecc_t *ecc_p);
81 extern uint_t ecc_intr(caddr_t a);
82 extern int ecc_err_handler(ecc_errstate_t *ecc_err_p);
83 extern void ecc_err_drain(void *, ecc_errstate_t *, errorq_elem_t *);
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif	/* _SYS_PCI_ECC_H */
90