xref: /titanic_50/usr/src/uts/common/sys/ndifm.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
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 /*
24  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_SYS_NDIFM_H
29 #define	_SYS_NDIFM_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #include <sys/ddifm.h>
38 #include <sys/ddifm_impl.h>
39 
40 /* FM handle cache support */
41 #define	DMA_HANDLE	0
42 #define	ACC_HANDLE	1
43 #define	DEFAULT_DMACACHE_SZ	100
44 #define	DEFAULT_ACCCACHE_SZ	10
45 
46 extern int default_dmacache_sz;
47 extern int default_acccache_sz;
48 
49 /* Forward declarations for FM NDI */
50 
51 typedef struct i_ddi_fmc ndi_fmc_t;
52 typedef struct i_ddi_fmc_entry ndi_fmcentry_t;
53 
54 /* Per-handle NDI error status */
55 typedef struct i_ndi_err {
56 	uint64_t err_ena;			/* ENA for this error */
57 	int err_status;				/* error status */
58 	int err_expected;			/* was this error expected? */
59 	void *err_ontrap;			/* ontrap protection, if any */
60 	struct i_ddi_fmc_entry *err_fep;	/* FM cache link */
61 } ndi_err_t;
62 
63 
64 typedef int (ndi_fmcompare_t)(dev_info_t *, const void *, const void *,
65     const void *);
66 
67 #ifdef	_KERNEL
68 
69 extern void ndi_fmc_insert(dev_info_t *, int, void *, void *);
70 extern void ndi_fmc_remove(dev_info_t *, int, const void *);
71 extern int ndi_fmc_error(dev_info_t *, dev_info_t *, int, ndi_fmcompare_t,
72     uint64_t, const void *);
73 
74 extern int ndi_fm_handler_dispatch(dev_info_t *, dev_info_t *,
75     const ddi_fm_error_t *);
76 extern int i_ddi_fm_handler_dispatch(dev_info_t *, const ddi_fm_error_t *);
77 
78 extern void ndi_fm_acc_err_set(ddi_acc_handle_t, ddi_fm_error_t *);
79 extern void ndi_fm_dma_err_set(ddi_dma_handle_t, ddi_fm_error_t *);
80 
81 #endif	/* _KERNEL */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_NDIFM_H */
88