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