xref: /freebsd/sys/dev/qlxgbe/ql_glbl.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1718cf2ccSPedro F. Giffuni /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
435291c22SDavid C Somayajulu  * Copyright (c) 2013-2016 Qlogic Corporation
5f10a77bbSDavid C Somayajulu  * All rights reserved.
6f10a77bbSDavid C Somayajulu  *
7f10a77bbSDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
8f10a77bbSDavid C Somayajulu  *  modification, are permitted provided that the following conditions
9f10a77bbSDavid C Somayajulu  *  are met:
10f10a77bbSDavid C Somayajulu  *
11f10a77bbSDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
12f10a77bbSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
13f10a77bbSDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
14f10a77bbSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
15f10a77bbSDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
16f10a77bbSDavid C Somayajulu  *
17f10a77bbSDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18f10a77bbSDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19f10a77bbSDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20f10a77bbSDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21f10a77bbSDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22f10a77bbSDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23f10a77bbSDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24f10a77bbSDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25f10a77bbSDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26f10a77bbSDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27f10a77bbSDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
28f10a77bbSDavid C Somayajulu  */
29f10a77bbSDavid C Somayajulu /*
30f10a77bbSDavid C Somayajulu  * File: ql_glbl.h
31f10a77bbSDavid C Somayajulu  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
32f10a77bbSDavid C Somayajulu  * Content: Contains prototypes of the exported functions from each file.
33f10a77bbSDavid C Somayajulu  */
34f10a77bbSDavid C Somayajulu #ifndef _QL_GLBL_H_
35f10a77bbSDavid C Somayajulu #define _QL_GLBL_H_
36f10a77bbSDavid C Somayajulu 
37f10a77bbSDavid C Somayajulu /*
38f10a77bbSDavid C Somayajulu  * from ql_isr.c
39f10a77bbSDavid C Somayajulu  */
40f10a77bbSDavid C Somayajulu extern void ql_mbx_isr(void *arg);
41f10a77bbSDavid C Somayajulu extern void ql_isr(void *arg);
42b89f2279SDavid C Somayajulu extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count);
43f10a77bbSDavid C Somayajulu 
44f10a77bbSDavid C Somayajulu /*
45f10a77bbSDavid C Somayajulu  * from ql_os.c
46f10a77bbSDavid C Somayajulu  */
47f10a77bbSDavid C Somayajulu extern int ql_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
48f10a77bbSDavid C Somayajulu extern void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
49f10a77bbSDavid C Somayajulu extern int ql_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp);
50b65c0c07SDavid C Somayajulu extern void qla_set_error_recovery(qla_host_t *ha);
51f10a77bbSDavid C Somayajulu 
52f10a77bbSDavid C Somayajulu /*
53f10a77bbSDavid C Somayajulu  * from ql_hw.c
54f10a77bbSDavid C Somayajulu  */
55f10a77bbSDavid C Somayajulu extern int ql_alloc_dma(qla_host_t *ha);
56f10a77bbSDavid C Somayajulu extern void ql_free_dma(qla_host_t *ha);
57f10a77bbSDavid C Somayajulu extern void ql_hw_add_sysctls(qla_host_t *ha);
58f10a77bbSDavid C Somayajulu extern int ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, int nsegs,
5935291c22SDavid C Somayajulu                 uint32_t tx_idx, struct mbuf *mp, uint32_t txr_idx,
6035291c22SDavid C Somayajulu 		uint32_t iscsi_pdu);
6135291c22SDavid C Somayajulu extern void qla_confirm_9kb_enable(qla_host_t *ha);
62f10a77bbSDavid C Somayajulu extern int ql_init_hw_if(qla_host_t *ha);
63f10a77bbSDavid C Somayajulu extern int ql_hw_set_multi(qla_host_t *ha, uint8_t *mta, uint32_t mcnt,
64f10a77bbSDavid C Somayajulu 		uint32_t add_multi);
65f10a77bbSDavid C Somayajulu extern void ql_del_hw_if(qla_host_t *ha);
66f10a77bbSDavid C Somayajulu extern int ql_set_promisc(qla_host_t *ha);
6735291c22SDavid C Somayajulu extern void qla_reset_promisc(qla_host_t *ha);
68f10a77bbSDavid C Somayajulu extern int ql_set_allmulti(qla_host_t *ha);
6935291c22SDavid C Somayajulu extern void qla_reset_allmulti(qla_host_t *ha);
70f10a77bbSDavid C Somayajulu extern void ql_update_link_state(qla_host_t *ha);
71b89f2279SDavid C Somayajulu extern void ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx);
72f10a77bbSDavid C Somayajulu extern int ql_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id);
73f10a77bbSDavid C Somayajulu extern void ql_get_stats(qla_host_t *ha);
74f10a77bbSDavid C Somayajulu extern void ql_hw_link_status(qla_host_t *ha);
75f10a77bbSDavid C Somayajulu extern int ql_hw_check_health(qla_host_t *ha);
7635291c22SDavid C Somayajulu extern void qla_hw_async_event(qla_host_t *ha);
7735291c22SDavid C Somayajulu extern int qla_get_nic_partition(qla_host_t *ha, uint32_t *supports_9kb,
7835291c22SDavid C Somayajulu 		uint32_t *num_rcvq);
7961fb8de9SDavid C Somayajulu extern int qla_hw_del_all_mcast(qla_host_t *ha);
8035291c22SDavid C Somayajulu 
81b89f2279SDavid C Somayajulu extern int ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp);
82f10a77bbSDavid C Somayajulu extern void ql_minidump(qla_host_t *ha);
836a62bec0SDavid C Somayajulu extern int ql_minidump_init(qla_host_t *ha);
84f10a77bbSDavid C Somayajulu 
85f10a77bbSDavid C Somayajulu /*
86f10a77bbSDavid C Somayajulu  * from ql_misc.c
87f10a77bbSDavid C Somayajulu  */
88f10a77bbSDavid C Somayajulu extern int ql_init_hw(qla_host_t *ha);
89f10a77bbSDavid C Somayajulu extern int ql_rdwr_indreg32(qla_host_t *ha, uint32_t addr, uint32_t *val,
90f10a77bbSDavid C Somayajulu 		uint32_t rd);
91f10a77bbSDavid C Somayajulu extern int ql_rd_flash32(qla_host_t *ha, uint32_t addr, uint32_t *data);
92f10a77bbSDavid C Somayajulu extern int ql_rdwr_offchip_mem(qla_host_t *ha, uint64_t addr,
93f10a77bbSDavid C Somayajulu 		q80_offchip_mem_val_t *val, uint32_t rd);
94f10a77bbSDavid C Somayajulu extern void ql_read_mac_addr(qla_host_t *ha);
95f10a77bbSDavid C Somayajulu extern int ql_erase_flash(qla_host_t *ha, uint32_t off, uint32_t size);
96f10a77bbSDavid C Somayajulu extern int ql_wr_flash_buffer(qla_host_t *ha, uint32_t off, uint32_t size,
97f10a77bbSDavid C Somayajulu 		void *buf);
98f10a77bbSDavid C Somayajulu extern int ql_stop_sequence(qla_host_t *ha);
99f10a77bbSDavid C Somayajulu extern int ql_start_sequence(qla_host_t *ha, uint16_t index);
100f10a77bbSDavid C Somayajulu 
101f10a77bbSDavid C Somayajulu /*
102f10a77bbSDavid C Somayajulu  * from ql_ioctl.c
103f10a77bbSDavid C Somayajulu  */
104f10a77bbSDavid C Somayajulu extern int ql_make_cdev(qla_host_t *ha);
105f10a77bbSDavid C Somayajulu extern void ql_del_cdev(qla_host_t *ha);
106f10a77bbSDavid C Somayajulu 
10735291c22SDavid C Somayajulu extern unsigned char ql83xx_firmware[];
10835291c22SDavid C Somayajulu extern unsigned int ql83xx_firmware_len;
10935291c22SDavid C Somayajulu extern unsigned char ql83xx_bootloader[];
11035291c22SDavid C Somayajulu extern unsigned int ql83xx_bootloader_len;
11135291c22SDavid C Somayajulu extern unsigned char ql83xx_resetseq[];
11235291c22SDavid C Somayajulu extern unsigned int ql83xx_resetseq_len;
11335291c22SDavid C Somayajulu extern unsigned char ql83xx_minidump[];
11435291c22SDavid C Somayajulu extern unsigned int ql83xx_minidump_len;
11535291c22SDavid C Somayajulu 
116ab142b3fSDavid C Somayajulu extern void ql_alloc_drvr_state_buffer(qla_host_t *ha);
117ab142b3fSDavid C Somayajulu extern void ql_free_drvr_state_buffer(qla_host_t *ha);
118ab142b3fSDavid C Somayajulu extern void ql_capture_drvr_state(qla_host_t *ha);
119b65c0c07SDavid C Somayajulu extern void ql_sp_log(qla_host_t *ha, uint16_t fmtstr_idx, uint16_t num_params,
120b65c0c07SDavid C Somayajulu 		uint32_t param0, uint32_t param1, uint32_t param2,
121b65c0c07SDavid C Somayajulu 		uint32_t param3, uint32_t param4);
122b65c0c07SDavid C Somayajulu extern void ql_alloc_sp_log_buffer(qla_host_t *ha);
123b65c0c07SDavid C Somayajulu extern void ql_free_sp_log_buffer(qla_host_t *ha);
124b65c0c07SDavid C Somayajulu 
125f10a77bbSDavid C Somayajulu #endif /* #ifndef_QL_GLBL_H_ */
126