vxgehal-mrpcim.h revision 330897
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright(c) 2002-2011 Exar Corp.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification are permitted provided the following conditions are met:
9 *
10 *    1. Redistributions of source code must retain the above copyright notice,
11 *       this list of conditions and the following disclaimer.
12 *
13 *    2. Redistributions in binary form must reproduce the above copyright
14 *       notice, this list of conditions and the following disclaimer in the
15 *       documentation and/or other materials provided with the distribution.
16 *
17 *    3. Neither the name of the Exar Corporation nor the names of its
18 *       contributors may be used to endorse or promote products derived from
19 *       this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33/*$FreeBSD: stable/11/sys/dev/vxge/vxgehal/vxgehal-mrpcim.h 330897 2018-03-14 03:19:51Z eadler $*/
34
35#ifndef	VXGE_HAL_MRPCIM_H
36#define	VXGE_HAL_MRPCIM_H
37
38__EXTERN_BEGIN_DECLS
39
40/*
41 * __hal_mrpcim_t
42 *
43 * HAL mrpcim object. Represents privileged mode device.
44 */
45typedef struct __hal_mrpcim_t {
46	u32	mdio_phy_prtad0;
47	u32	mdio_phy_prtad1;
48	u32	mdio_dte_prtad0;
49	u32	mdio_dte_prtad1;
50	vxge_hal_vpd_data_t vpd_data;
51	__hal_blockpool_entry_t *mrpcim_stats_block;
52	vxge_hal_mrpcim_stats_hw_info_t *mrpcim_stats;
53	vxge_hal_mrpcim_stats_hw_info_t mrpcim_stats_sav;
54	vxge_hal_mrpcim_xpak_stats_t xpak_stats[VXGE_HAL_MAC_MAX_WIRE_PORTS];
55} __hal_mrpcim_t;
56
57#define	VXGE_HAL_MRPCIM_STATS_PIO_READ(loc, offset) {			\
58	status = vxge_hal_mrpcim_stats_access(devh,			\
59				VXGE_HAL_STATS_OP_READ,			\
60				loc,					\
61				offset,					\
62				&val64);				\
63									\
64	if (status != VXGE_HAL_OK) {					\
65		vxge_hal_trace_log_stats("<== %s:%s:%d Result = %d",	\
66				__FILE__, __func__, __LINE__, status);	\
67		return (status);					\
68	}								\
69}
70
71#define	VXGE_HAL_MRPCIM_ERROR_REG_CLEAR(reg)				\
72	vxge_os_pio_mem_write64(					\
73		hldev->header.pdev,					\
74		hldev->header.regh0,					\
75		VXGE_HAL_INTR_MASK_ALL,					\
76		(reg));
77
78#define	VXGE_HAL_MRPCIM_ERROR_REG_MASK(reg)				\
79	vxge_os_pio_mem_write64(					\
80		hldev->header.pdev,					\
81		hldev->header.regh0,					\
82		VXGE_HAL_INTR_MASK_ALL,					\
83		(reg));
84
85#define	VXGE_HAL_MRPCIM_ERROR_REG_UNMASK(mask, reg)			\
86	vxge_os_pio_mem_write64(					\
87		hldev->header.pdev,					\
88		hldev->header.regh0,					\
89		~mask,							\
90		(reg));
91
92vxge_hal_status_e
93__hal_mrpcim_mdio_access(
94    vxge_hal_device_h devh,
95    u32 port,
96    u32 operation,
97    u32 device,
98    u16 addr,
99    u16 *data);
100
101vxge_hal_status_e
102__hal_mrpcim_rts_table_access(
103    vxge_hal_device_h devh,
104    u32 action,
105    u32 rts_table,
106    u32 offset,
107    u64 *data1,
108    u64 *data2,
109    u64 *vpath_vector);
110
111vxge_hal_status_e
112__hal_mrpcim_initialize(__hal_device_t *hldev);
113
114vxge_hal_status_e
115__hal_mrpcim_terminate(__hal_device_t *hldev);
116
117void
118__hal_mrpcim_get_vpd_data(__hal_device_t *hldev);
119
120void
121__hal_mrpcim_xpak_counter_check(__hal_device_t *hldev,
122    u32 port, u32 type, u32 value);
123
124vxge_hal_status_e
125__hal_mrpcim_stats_get(
126    __hal_device_t *hldev,
127    vxge_hal_mrpcim_stats_hw_info_t *mrpcim_stats);
128
129vxge_hal_status_e
130__hal_mrpcim_mac_configure(__hal_device_t *hldev);
131
132vxge_hal_status_e
133__hal_mrpcim_lag_configure(__hal_device_t *hldev);
134
135__EXTERN_END_DECLS
136
137#endif	/* VXGE_HAL_MRPCIM_H */
138