xref: /freebsd/sys/dev/qlxgbe/ql_glbl.h (revision 718cf2ccb9956613756ab15d7a0e28f2c8e91cab)
1*718cf2ccSPedro F. Giffuni /*-
2*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*718cf2ccSPedro 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  * $FreeBSD$
30f10a77bbSDavid C Somayajulu  */
31f10a77bbSDavid C Somayajulu /*
32f10a77bbSDavid C Somayajulu  * File: ql_glbl.h
33f10a77bbSDavid C Somayajulu  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
34f10a77bbSDavid C Somayajulu  * Content: Contains prototypes of the exported functions from each file.
35f10a77bbSDavid C Somayajulu  */
36f10a77bbSDavid C Somayajulu #ifndef _QL_GLBL_H_
37f10a77bbSDavid C Somayajulu #define _QL_GLBL_H_
38f10a77bbSDavid C Somayajulu 
39f10a77bbSDavid C Somayajulu /*
40f10a77bbSDavid C Somayajulu  * from ql_isr.c
41f10a77bbSDavid C Somayajulu  */
42f10a77bbSDavid C Somayajulu extern void ql_mbx_isr(void *arg);
43f10a77bbSDavid C Somayajulu extern void ql_isr(void *arg);
44b89f2279SDavid C Somayajulu extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count);
45f10a77bbSDavid C Somayajulu 
46f10a77bbSDavid C Somayajulu /*
47f10a77bbSDavid C Somayajulu  * from ql_os.c
48f10a77bbSDavid C Somayajulu  */
49f10a77bbSDavid C Somayajulu extern int ql_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
50f10a77bbSDavid C Somayajulu extern void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
51f10a77bbSDavid C Somayajulu extern int ql_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp);
52f10a77bbSDavid C Somayajulu 
53f10a77bbSDavid C Somayajulu /*
54f10a77bbSDavid C Somayajulu  * from ql_hw.c
55f10a77bbSDavid C Somayajulu  */
56f10a77bbSDavid C Somayajulu extern int ql_alloc_dma(qla_host_t *ha);
57f10a77bbSDavid C Somayajulu extern void ql_free_dma(qla_host_t *ha);
58f10a77bbSDavid C Somayajulu extern void ql_hw_add_sysctls(qla_host_t *ha);
59f10a77bbSDavid C Somayajulu extern int ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, int nsegs,
6035291c22SDavid C Somayajulu                 uint32_t tx_idx, struct mbuf *mp, uint32_t txr_idx,
6135291c22SDavid C Somayajulu 		uint32_t iscsi_pdu);
6235291c22SDavid C Somayajulu extern void qla_confirm_9kb_enable(qla_host_t *ha);
63f10a77bbSDavid C Somayajulu extern int ql_init_hw_if(qla_host_t *ha);
64f10a77bbSDavid C Somayajulu extern int ql_hw_set_multi(qla_host_t *ha, uint8_t *mta, uint32_t mcnt,
65f10a77bbSDavid C Somayajulu 		uint32_t add_multi);
66f10a77bbSDavid C Somayajulu extern void ql_del_hw_if(qla_host_t *ha);
67f10a77bbSDavid C Somayajulu extern int ql_set_promisc(qla_host_t *ha);
6835291c22SDavid C Somayajulu extern void qla_reset_promisc(qla_host_t *ha);
69f10a77bbSDavid C Somayajulu extern int ql_set_allmulti(qla_host_t *ha);
7035291c22SDavid C Somayajulu extern void qla_reset_allmulti(qla_host_t *ha);
71f10a77bbSDavid C Somayajulu extern void ql_update_link_state(qla_host_t *ha);
72b89f2279SDavid C Somayajulu extern void ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx);
73f10a77bbSDavid C Somayajulu extern int ql_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id);
74f10a77bbSDavid C Somayajulu extern void ql_get_stats(qla_host_t *ha);
75f10a77bbSDavid C Somayajulu extern void ql_hw_link_status(qla_host_t *ha);
76f10a77bbSDavid C Somayajulu extern int ql_hw_check_health(qla_host_t *ha);
7735291c22SDavid C Somayajulu extern void qla_hw_async_event(qla_host_t *ha);
7835291c22SDavid C Somayajulu extern int qla_get_nic_partition(qla_host_t *ha, uint32_t *supports_9kb,
7935291c22SDavid C Somayajulu 		uint32_t *num_rcvq);
8061fb8de9SDavid C Somayajulu extern int qla_hw_del_all_mcast(qla_host_t *ha);
8135291c22SDavid C Somayajulu 
82b89f2279SDavid C Somayajulu extern int ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp);
83f10a77bbSDavid C Somayajulu extern void ql_minidump(qla_host_t *ha);
846a62bec0SDavid C Somayajulu extern int ql_minidump_init(qla_host_t *ha);
85f10a77bbSDavid C Somayajulu 
86f10a77bbSDavid C Somayajulu /*
87f10a77bbSDavid C Somayajulu  * from ql_misc.c
88f10a77bbSDavid C Somayajulu  */
89f10a77bbSDavid C Somayajulu extern int ql_init_hw(qla_host_t *ha);
90f10a77bbSDavid C Somayajulu extern int ql_rdwr_indreg32(qla_host_t *ha, uint32_t addr, uint32_t *val,
91f10a77bbSDavid C Somayajulu 		uint32_t rd);
92f10a77bbSDavid C Somayajulu extern int ql_rd_flash32(qla_host_t *ha, uint32_t addr, uint32_t *data);
93f10a77bbSDavid C Somayajulu extern int ql_rdwr_offchip_mem(qla_host_t *ha, uint64_t addr,
94f10a77bbSDavid C Somayajulu 		q80_offchip_mem_val_t *val, uint32_t rd);
95f10a77bbSDavid C Somayajulu extern void ql_read_mac_addr(qla_host_t *ha);
96f10a77bbSDavid C Somayajulu extern int ql_erase_flash(qla_host_t *ha, uint32_t off, uint32_t size);
97f10a77bbSDavid C Somayajulu extern int ql_wr_flash_buffer(qla_host_t *ha, uint32_t off, uint32_t size,
98f10a77bbSDavid C Somayajulu 		void *buf);
99f10a77bbSDavid C Somayajulu extern int ql_stop_sequence(qla_host_t *ha);
100f10a77bbSDavid C Somayajulu extern int ql_start_sequence(qla_host_t *ha, uint16_t index);
101f10a77bbSDavid C Somayajulu 
102f10a77bbSDavid C Somayajulu /*
103f10a77bbSDavid C Somayajulu  * from ql_ioctl.c
104f10a77bbSDavid C Somayajulu  */
105f10a77bbSDavid C Somayajulu extern int ql_make_cdev(qla_host_t *ha);
106f10a77bbSDavid C Somayajulu extern void ql_del_cdev(qla_host_t *ha);
107f10a77bbSDavid C Somayajulu 
10835291c22SDavid C Somayajulu extern unsigned char ql83xx_firmware[];
10935291c22SDavid C Somayajulu extern unsigned int ql83xx_firmware_len;
11035291c22SDavid C Somayajulu extern unsigned char ql83xx_bootloader[];
11135291c22SDavid C Somayajulu extern unsigned int ql83xx_bootloader_len;
11235291c22SDavid C Somayajulu extern unsigned char ql83xx_resetseq[];
11335291c22SDavid C Somayajulu extern unsigned int ql83xx_resetseq_len;
11435291c22SDavid C Somayajulu extern unsigned char ql83xx_minidump[];
11535291c22SDavid C Somayajulu extern unsigned int ql83xx_minidump_len;
11635291c22SDavid C Somayajulu 
117ab142b3fSDavid C Somayajulu extern void ql_alloc_drvr_state_buffer(qla_host_t *ha);
118ab142b3fSDavid C Somayajulu extern void ql_free_drvr_state_buffer(qla_host_t *ha);
119ab142b3fSDavid C Somayajulu extern void ql_capture_drvr_state(qla_host_t *ha);
120ab142b3fSDavid C Somayajulu 
121f10a77bbSDavid C Somayajulu #endif /* #ifndef_QL_GLBL_H_ */
122