lpfc: add Emulex FC driver version 8.0.28
[linux-2.6-block.git] / drivers / scsi / lpfc / lpfc_crtn.h
CommitLineData
dea3101e 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Enterprise Fibre Channel Host Bus Adapters. *
4 * Refer to the README file included with this package for *
5 * driver version and adapter support. *
6 * Copyright (C) 2004 Emulex Corporation. *
7 * www.emulex.com *
8 * *
9 * This program is free software; you can redistribute it and/or *
10 * modify it under the terms of the GNU General Public License *
11 * as published by the Free Software Foundation; either version 2 *
12 * of the License, or (at your option) any later version. *
13 * *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details, a copy of which *
18 * can be found in the file COPYING included with this package. *
19 *******************************************************************/
20
21/*
22 * $Id: lpfc_crtn.h 1.166 2005/04/07 08:46:47EDT sf_support Exp $
23 */
24
25void lpfc_dump_mem(struct lpfc_hba *, LPFC_MBOXQ_t *, uint16_t);
26void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *);
27int lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
28 struct lpfc_dmabuf *mp);
29void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
30void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
31int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
32void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *);
33void lpfc_set_slim(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
34int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *,
35 uint32_t);
36void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
37void lpfc_unreg_did(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
38void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
39
40
41int lpfc_linkdown(struct lpfc_hba *);
42void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
43
44void lpfc_mbx_cmpl_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
45void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
46void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
47void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
48void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
49int lpfc_nlp_plogi(struct lpfc_hba *, struct lpfc_nodelist *);
50int lpfc_nlp_adisc(struct lpfc_hba *, struct lpfc_nodelist *);
51int lpfc_nlp_unmapped(struct lpfc_hba *, struct lpfc_nodelist *);
52int lpfc_nlp_list(struct lpfc_hba *, struct lpfc_nodelist *, int);
53void lpfc_set_disctmo(struct lpfc_hba *);
54int lpfc_can_disctmo(struct lpfc_hba *);
55int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *);
56int lpfc_check_sli_ndlp(struct lpfc_hba *, struct lpfc_sli_ring *,
57 struct lpfc_iocbq *, struct lpfc_nodelist *);
58int lpfc_nlp_remove(struct lpfc_hba *, struct lpfc_nodelist *);
59void lpfc_nlp_init(struct lpfc_hba *, struct lpfc_nodelist *, uint32_t);
60struct lpfc_nodelist *lpfc_setup_disc_node(struct lpfc_hba *, uint32_t);
61struct lpfc_nodelist *lpfc_setup_rscn_node(struct lpfc_hba *, uint32_t);
62void lpfc_disc_list_loopmap(struct lpfc_hba *);
63void lpfc_disc_start(struct lpfc_hba *);
64void lpfc_disc_flush_list(struct lpfc_hba *);
65void lpfc_disc_timeout(unsigned long);
66void lpfc_scan_timeout(unsigned long);
67
68struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);
69struct lpfc_nodelist *lpfc_findnode_remove_rpi(struct lpfc_hba * phba,
70 uint16_t rpi);
71void lpfc_addnode_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
72 uint16_t rpi);
73
74int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t);
75int lpfc_do_work(void *);
76int lpfc_disc_state_machine(struct lpfc_hba *, struct lpfc_nodelist *, void *,
77 uint32_t);
78
79uint32_t lpfc_cmpl_prli_reglogin_issue(struct lpfc_hba *,
80 struct lpfc_nodelist *, void *,
81 uint32_t);
82uint32_t lpfc_cmpl_plogi_prli_issue(struct lpfc_hba *, struct lpfc_nodelist *,
83 void *, uint32_t);
84
85int lpfc_check_sparm(struct lpfc_hba *, struct lpfc_nodelist *,
86 struct serv_parm *, uint32_t);
87int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist * ndlp,
88 int);
89int lpfc_els_abort_flogi(struct lpfc_hba *);
90int lpfc_initial_flogi(struct lpfc_hba *);
91int lpfc_issue_els_plogi(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
92int lpfc_issue_els_prli(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
93int lpfc_issue_els_adisc(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
94int lpfc_issue_els_logo(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
95int lpfc_issue_els_scr(struct lpfc_hba *, uint32_t, uint8_t);
96int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
97int lpfc_els_rsp_acc(struct lpfc_hba *, uint32_t, struct lpfc_iocbq *,
98 struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t);
99int lpfc_els_rsp_reject(struct lpfc_hba *, uint32_t, struct lpfc_iocbq *,
100 struct lpfc_nodelist *);
101int lpfc_els_rsp_adisc_acc(struct lpfc_hba *, struct lpfc_iocbq *,
102 struct lpfc_nodelist *);
103int lpfc_els_rsp_prli_acc(struct lpfc_hba *, struct lpfc_iocbq *,
104 struct lpfc_nodelist *);
105void lpfc_els_retry_delay(unsigned long);
106void lpfc_els_retry_delay_handler(struct lpfc_nodelist *);
107void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
108 struct lpfc_iocbq *);
109int lpfc_els_handle_rscn(struct lpfc_hba *);
110int lpfc_els_flush_rscn(struct lpfc_hba *);
111int lpfc_rscn_payload_check(struct lpfc_hba *, uint32_t);
112void lpfc_els_flush_cmd(struct lpfc_hba *);
113int lpfc_els_disc_adisc(struct lpfc_hba *);
114int lpfc_els_disc_plogi(struct lpfc_hba *);
115void lpfc_els_timeout(unsigned long);
116void lpfc_els_timeout_handler(struct lpfc_hba *);
117
118void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
119 struct lpfc_iocbq *);
120int lpfc_ns_cmd(struct lpfc_hba *, struct lpfc_nodelist *, int);
121int lpfc_fdmi_cmd(struct lpfc_hba *, struct lpfc_nodelist *, int);
122void lpfc_fdmi_tmo(unsigned long);
123void lpfc_fdmi_tmo_handler(struct lpfc_hba *);
124
125int lpfc_config_port_prep(struct lpfc_hba *);
126int lpfc_config_port_post(struct lpfc_hba *);
127int lpfc_hba_down_prep(struct lpfc_hba *);
128void lpfc_hba_init(struct lpfc_hba *, uint32_t *);
129int lpfc_post_buffer(struct lpfc_hba *, struct lpfc_sli_ring *, int, int);
130void lpfc_decode_firmware_rev(struct lpfc_hba *, char *, int);
131uint8_t *lpfc_get_lpfchba_info(struct lpfc_hba *, uint8_t *);
132int lpfc_fcp_abort(struct lpfc_hba *, int, int, int);
133int lpfc_online(struct lpfc_hba *);
134int lpfc_offline(struct lpfc_hba *);
135
136
137int lpfc_sli_setup(struct lpfc_hba *);
138int lpfc_sli_queue_setup(struct lpfc_hba *);
139void lpfc_slim_access(struct lpfc_hba *);
140
141void lpfc_handle_eratt(struct lpfc_hba *);
142void lpfc_handle_latt(struct lpfc_hba *);
143irqreturn_t lpfc_intr_handler(int, void *, struct pt_regs *);
144
145void lpfc_read_rev(struct lpfc_hba *, LPFC_MBOXQ_t *);
146void lpfc_config_ring(struct lpfc_hba *, int, LPFC_MBOXQ_t *);
147void lpfc_config_port(struct lpfc_hba *, LPFC_MBOXQ_t *);
148void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
149LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *);
150
151int lpfc_mem_alloc(struct lpfc_hba *);
152void lpfc_mem_free(struct lpfc_hba *);
153
154int lpfc_sli_hba_setup(struct lpfc_hba *);
155int lpfc_sli_hba_down(struct lpfc_hba *);
156int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
157int lpfc_sli_handle_mb_event(struct lpfc_hba *);
158int lpfc_sli_handle_slow_ring_event(struct lpfc_hba *,
159 struct lpfc_sli_ring *, uint32_t);
160void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
161int lpfc_sli_issue_iocb(struct lpfc_hba *, struct lpfc_sli_ring *,
162 struct lpfc_iocbq *, uint32_t);
163void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t);
164int lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *);
165int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
166 struct lpfc_dmabuf *);
167struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *,
168 struct lpfc_sli_ring *,
169 dma_addr_t);
170int lpfc_sli_issue_abort_iotag32(struct lpfc_hba *, struct lpfc_sli_ring *,
171 struct lpfc_iocbq *);
172int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
173 uint64_t, lpfc_ctx_cmd);
174int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
175 uint64_t, uint32_t, lpfc_ctx_cmd);
176
177void lpfc_mbox_timeout(unsigned long);
178void lpfc_mbox_timeout_handler(struct lpfc_hba *);
179void lpfc_map_fcp_cmnd_to_bpl(struct lpfc_hba *, struct lpfc_scsi_buf *);
180void lpfc_free_scsi_cmd(struct lpfc_scsi_buf *);
181uint32_t lpfc_os_timeout_transform(struct lpfc_hba *, uint32_t);
182
183struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order,
184 uint32_t did);
185
186int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq,
187 uint32_t timeout);
188
189int lpfc_sli_issue_iocb_wait_high_priority(struct lpfc_hba * phba,
190 struct lpfc_sli_ring * pring,
191 struct lpfc_iocbq * piocb,
192 uint32_t flag,
193 struct lpfc_iocbq * prspiocbq,
194 uint32_t timeout);
195void lpfc_sli_wake_iocb_high_priority(struct lpfc_hba * phba,
196 struct lpfc_iocbq * queue1,
197 struct lpfc_iocbq * queue2);
198
199void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *);
200void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t);
201
202/* Function prototypes. */
203const char* lpfc_info(struct Scsi_Host *);
204void lpfc_get_cfgparam(struct lpfc_hba *);
205int lpfc_alloc_sysfs_attr(struct lpfc_hba *);
206void lpfc_free_sysfs_attr(struct lpfc_hba *);
207extern struct class_device_attribute *lpfc_host_attrs[];
208extern struct scsi_host_template lpfc_template;
209extern struct fc_function_template lpfc_transport_functions;
210
211void lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp);
212
213#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
214#define HBA_EVENT_RSCN 5
215#define HBA_EVENT_LINK_UP 2
216#define HBA_EVENT_LINK_DOWN 3