xref: /illumos-gate/usr/src/uts/common/sys/ndifm.h (revision 69b1fd3f24d0ee2e682883606201c61f52085805)
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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/ddifm.h>
35 #include <sys/ddifm_impl.h>
36 
37 /* FM handle cache support */
38 #define	DMA_HANDLE	0
39 #define	ACC_HANDLE	1
40 #define	DEFAULT_DMACACHE_SZ	100
41 #define	DEFAULT_ACCCACHE_SZ	10
42 
43 extern int default_dmacache_sz;
44 extern int default_acccache_sz;
45 
46 /* Forward declarations for FM NDI */
47 
48 typedef struct i_ddi_fmc ndi_fmc_t;
49 typedef struct i_ddi_fmc_entry ndi_fmcentry_t;
50 
51 /* Per-handle NDI error status */
52 typedef struct i_ndi_err {
53 	uint64_t err_ena;			/* ENA for this error */
54 	int err_status;				/* error status */
55 	int err_expected;			/* was this error expected? */
56 	void *err_ontrap;			/* ontrap protection, if any */
57 	struct i_ddi_fmc_entry *err_fep;	/* FM cache link */
58 	int (*err_cf)();			/* compare function */
59 } ndi_err_t;
60 
61 #ifdef	_KERNEL
62 
63 extern void ndi_fmc_insert(dev_info_t *, int, void *, void *);
64 extern void ndi_fmc_remove(dev_info_t *, int, const void *);
65 extern int ndi_fmc_error(dev_info_t *, dev_info_t *, int, uint64_t,
66     const void *);
67 extern int ndi_fmc_entry_error(dev_info_t *, int, ddi_fm_error_t *,
68     const void *);
69 extern int ndi_fmc_entry_error_all(dev_info_t *, int, ddi_fm_error_t *);
70 
71 extern int ndi_fm_handler_dispatch(dev_info_t *, dev_info_t *,
72     const ddi_fm_error_t *);
73 extern int i_ddi_fm_handler_dispatch(dev_info_t *, const ddi_fm_error_t *);
74 
75 extern void ndi_fm_acc_err_set(ddi_acc_handle_t, ddi_fm_error_t *);
76 extern void ndi_fm_dma_err_set(ddi_dma_handle_t, ddi_fm_error_t *);
77 
78 #endif	/* _KERNEL */
79 
80 #ifdef	__cplusplus
81 }
82 #endif
83 
84 #endif	/* _SYS_NDIFM_H */
85