xref: /titanic_51/usr/src/uts/common/sys/ndifm.h (revision 342440ec94087b8c751c580ab9ed6c693d31d418)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_NDIFM_H
28 #define	_SYS_NDIFM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/ddifm.h>
37 #include <sys/ddifm_impl.h>
38 
39 /* FM handle cache support */
40 #define	DMA_HANDLE	0
41 #define	ACC_HANDLE	1
42 #define	DEFAULT_DMACACHE_SZ	100
43 #define	DEFAULT_ACCCACHE_SZ	10
44 
45 extern int default_dmacache_sz;
46 extern int default_acccache_sz;
47 
48 /* Forward declarations for FM NDI */
49 
50 typedef struct i_ddi_fmc ndi_fmc_t;
51 typedef struct i_ddi_fmc_entry ndi_fmcentry_t;
52 
53 /* Per-handle NDI error status */
54 typedef struct i_ndi_err {
55 	uint64_t err_ena;			/* ENA for this error */
56 	int err_status;				/* error status */
57 	int err_expected;			/* was this error expected? */
58 	void *err_ontrap;			/* ontrap protection, if any */
59 	struct i_ddi_fmc_entry *err_fep;	/* FM cache link */
60 	int (*err_cf)();			/* compare function */
61 } ndi_err_t;
62 
63 #ifdef	_KERNEL
64 
65 extern void ndi_fmc_insert(dev_info_t *, int, void *, void *);
66 extern void ndi_fmc_remove(dev_info_t *, int, const void *);
67 extern int ndi_fmc_error(dev_info_t *, dev_info_t *, int, uint64_t,
68     const void *);
69 extern int ndi_fmc_entry_error(dev_info_t *, int, ddi_fm_error_t *,
70     const void *);
71 extern int ndi_fmc_entry_error_all(dev_info_t *, int, ddi_fm_error_t *);
72 
73 extern int ndi_fm_handler_dispatch(dev_info_t *, dev_info_t *,
74     const ddi_fm_error_t *);
75 extern int i_ddi_fm_handler_dispatch(dev_info_t *, const ddi_fm_error_t *);
76 
77 extern void ndi_fm_acc_err_set(ddi_acc_handle_t, ddi_fm_error_t *);
78 extern void ndi_fm_dma_err_set(ddi_dma_handle_t, ddi_fm_error_t *);
79 
80 #endif	/* _KERNEL */
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_NDIFM_H */
87