xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_fct.h (revision 93c20f2609342fd05f6625f16dfcb9348e7977f2)
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 2008 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_send_response_done
78 #pragma weak fct_send_cmd_done
79 #pragma weak fct_scsi_data_xfer_done
80 #pragma weak fct_handle_rcvd_flogi
81 #pragma weak fct_port_shutdown
82 #pragma weak fct_port_initialize
83 #pragma weak stmf_deregister_port_provider
84 #pragma weak stmf_free
85 #pragma weak stmf_alloc
86 #pragma weak stmf_register_port_provider
87 extern void *stmf_alloc();
88 extern void *fct_alloc();
89 #endif	/* MODSYM_SUPPORT */
90 
91 struct emlxs_fct_dmem_bucket;
92 typedef struct emlxs_fct_dmem_bctl {
93 	struct emlxs_fct_dmem_bucket *bctl_bucket;
94 	struct emlxs_fct_dmem_bctl *bctl_next;
95 	uint64_t bctl_dev_addr;
96 	stmf_data_buf_t *bctl_buf;
97 
98 } emlxs_fct_dmem_bctl_t;
99 
100 typedef struct emlxs_fct_dmem_bucket {
101 	uint32_t dmem_buf_size;
102 	uint32_t dmem_nbufs;
103 	uint32_t dmem_nbufs_free;
104 	uint8_t *dmem_host_addr;
105 	uint64_t dmem_dev_addr;
106 	ddi_dma_handle_t dmem_dma_handle;
107 	ddi_acc_handle_t dmem_acc_handle;
108 	emlxs_fct_dmem_bctl_t *dmem_bctl_free_list;
109 	void *dmem_bctls_mem;
110 	kmutex_t dmem_lock;
111 
112 } emlxs_fct_dmem_bucket_t;
113 
114 
115 #endif	/* SFCT_SUPPORT */
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _EMLXS_FCT_H */
122