xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_fct.h (revision 291a2b48b9adcd7b3666c34e80ba6411929afe7f)
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 2009 Emulex.  All rights reserved.
24  * Use is subject to License terms.
25  */
26 
27 
28 #ifndef _EMLXS_FCT_H
29 #define	_EMLXS_FCT_H
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #ifdef SFCT_SUPPORT
36 
37 #include <sys/conf.h>
38 #include <sys/ddi.h>
39 #include <sys/stat.h>
40 #include <sys/pci.h>
41 #include <sys/sunddi.h>
42 #include <sys/modctl.h>
43 
44 
45 #ifdef	NS_RSNN_NN
46 #undef	NS_RSNN_NN
47 #endif /* NS_RSNN_NN */
48 
49 #include <stmf_defines.h>
50 
51 #ifdef FC_WELL_KNOWN_ADDR
52 #undef FC_WELL_KNOWN_ADDR
53 #endif /* FC_WELL_KNOWN_ADDR */
54 
55 #include <fct_defines.h>
56 #include <stmf.h>
57 #include <portif.h>
58 #include <fct.h>
59 
60 #ifndef LINK_SPEED_8G
61 #define	LINK_SPEED_8G		5
62 #endif /* LINK_SPEED_8G */
63 
64 #ifndef LINK_SPEED_10G
65 #define	LINK_SPEED_10G		6
66 #endif /* LINK_SPEED_10G */
67 
68 #ifndef MODSYM_SUPPORT
69 #pragma weak fct_alloc
70 #pragma weak fct_free
71 #pragma weak fct_scsi_task_alloc
72 #pragma weak fct_register_local_port
73 #pragma weak fct_deregister_local_port
74 #pragma weak fct_handle_event
75 #pragma weak fct_post_rcvd_cmd
76 #pragma weak fct_ctl
77 #pragma weak fct_queue_cmd_for_termination
78 #pragma weak fct_send_response_done
79 #pragma weak fct_send_cmd_done
80 #pragma weak fct_scsi_data_xfer_done
81 #pragma weak fct_handle_rcvd_flogi
82 #pragma weak fct_port_shutdown
83 #pragma weak fct_port_initialize
84 #pragma weak stmf_deregister_port_provider
85 #pragma weak stmf_free
86 #pragma weak stmf_alloc
87 #pragma weak stmf_register_port_provider
88 extern void* stmf_alloc();
89 extern void* fct_alloc();
90 #endif /* MODSYM_SUPPORT */
91 
92 struct emlxs_fct_dmem_bucket;
93 typedef struct emlxs_fct_dmem_bctl
94 {
95 	struct emlxs_fct_dmem_bucket	*bctl_bucket;
96 	struct emlxs_fct_dmem_bctl	*bctl_next;
97 	uint64_t			bctl_dev_addr;
98 	stmf_data_buf_t			*bctl_buf;
99 } emlxs_fct_dmem_bctl_t;
100 
101 typedef struct emlxs_fct_dmem_bucket
102 {
103 	uint32_t		dmem_buf_size;
104 	uint32_t		dmem_nbufs;
105 	uint32_t		dmem_nbufs_free;
106 	uint8_t			*dmem_host_addr;
107 	uint64_t		dmem_dev_addr;
108 	ddi_dma_handle_t	dmem_dma_handle;
109 	ddi_acc_handle_t	dmem_acc_handle;
110 	emlxs_fct_dmem_bctl_t	*dmem_bctl_free_list;
111 	void			*dmem_bctls_mem;
112 	kmutex_t		dmem_lock;
113 } emlxs_fct_dmem_bucket_t;
114 
115 
116 #endif	/* SFCT_SUPPORT */
117 
118 #ifdef	__cplusplus
119 }
120 #endif
121 
122 #endif	/* _EMLXS_FCT_H */
123