xref: /freebsd/sys/dev/liquidio/base/cn23xx_pf_device.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1*f173c2b7SSean Bruno /*
2*f173c2b7SSean Bruno  *   BSD LICENSE
3*f173c2b7SSean Bruno  *
4*f173c2b7SSean Bruno  *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5*f173c2b7SSean Bruno  *   All rights reserved.
6*f173c2b7SSean Bruno  *
7*f173c2b7SSean Bruno  *   Redistribution and use in source and binary forms, with or without
8*f173c2b7SSean Bruno  *   modification, are permitted provided that the following conditions
9*f173c2b7SSean Bruno  *   are met:
10*f173c2b7SSean Bruno  *
11*f173c2b7SSean Bruno  *     * Redistributions of source code must retain the above copyright
12*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer.
13*f173c2b7SSean Bruno  *     * Redistributions in binary form must reproduce the above copyright
14*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer in
15*f173c2b7SSean Bruno  *       the documentation and/or other materials provided with the
16*f173c2b7SSean Bruno  *       distribution.
17*f173c2b7SSean Bruno  *     * Neither the name of Cavium, Inc. nor the names of its
18*f173c2b7SSean Bruno  *       contributors may be used to endorse or promote products derived
19*f173c2b7SSean Bruno  *       from this software without specific prior written permission.
20*f173c2b7SSean Bruno  *
21*f173c2b7SSean Bruno  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*f173c2b7SSean Bruno  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*f173c2b7SSean Bruno  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24*f173c2b7SSean Bruno  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25*f173c2b7SSean Bruno  *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26*f173c2b7SSean Bruno  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27*f173c2b7SSean Bruno  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28*f173c2b7SSean Bruno  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29*f173c2b7SSean Bruno  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*f173c2b7SSean Bruno  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*f173c2b7SSean Bruno  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*f173c2b7SSean Bruno  */
33*f173c2b7SSean Bruno 
34*f173c2b7SSean Bruno /* \file  cn23xx_device.h
35*f173c2b7SSean Bruno  * \brief Host Driver: Routines that perform CN23XX specific operations.
36*f173c2b7SSean Bruno  */
37*f173c2b7SSean Bruno 
38*f173c2b7SSean Bruno #ifndef __CN23XX_PF_DEVICE_H__
39*f173c2b7SSean Bruno #define __CN23XX_PF_DEVICE_H__
40*f173c2b7SSean Bruno 
41*f173c2b7SSean Bruno #include "cn23xx_pf_regs.h"
42*f173c2b7SSean Bruno 
43*f173c2b7SSean Bruno /*
44*f173c2b7SSean Bruno  * Register address and configuration for a CN23XX devices.
45*f173c2b7SSean Bruno  * If device specific changes need to be made then add a struct to include
46*f173c2b7SSean Bruno  * device specific fields as shown in the commented section
47*f173c2b7SSean Bruno  */
48*f173c2b7SSean Bruno struct lio_cn23xx_pf {
49*f173c2b7SSean Bruno 	/* PCI interrupt summary register */
50*f173c2b7SSean Bruno 	uint32_t	intr_sum_reg64;
51*f173c2b7SSean Bruno 
52*f173c2b7SSean Bruno 	/* PCI interrupt enable register */
53*f173c2b7SSean Bruno 	uint32_t	intr_enb_reg64;
54*f173c2b7SSean Bruno 
55*f173c2b7SSean Bruno 	/* The PCI interrupt mask used by interrupt handler */
56*f173c2b7SSean Bruno 	uint64_t	intr_mask64;
57*f173c2b7SSean Bruno 
58*f173c2b7SSean Bruno 	struct lio_config *conf;
59*f173c2b7SSean Bruno };
60*f173c2b7SSean Bruno 
61*f173c2b7SSean Bruno #define BUSY_READING_REG_PF_LOOP_COUNT	10000
62*f173c2b7SSean Bruno 
63*f173c2b7SSean Bruno int	lio_cn23xx_pf_setup_device(struct octeon_device *oct);
64*f173c2b7SSean Bruno 
65*f173c2b7SSean Bruno uint32_t	lio_cn23xx_pf_get_oq_ticks(struct octeon_device *oct,
66*f173c2b7SSean Bruno 					   uint32_t time_intr_in_us);
67*f173c2b7SSean Bruno 
68*f173c2b7SSean Bruno int	lio_cn23xx_pf_fw_loaded(struct octeon_device *oct);
69*f173c2b7SSean Bruno 
70*f173c2b7SSean Bruno #endif	/* __CN23XX_PF_DEVICE_H__ */
71