1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_NXGE_NXGE_IPP_H
27#define	_SYS_NXGE_NXGE_IPP_H
28
29#pragma ident	"%Z%%M%	%I%	%E% SMI"
30
31#ifdef	__cplusplus
32extern "C" {
33#endif
34
35#include <nxge_ipp_hw.h>
36#include <npi_ipp.h>
37
38#define	IPP_MAX_PKT_SIZE	0x1FFFF
39#define	IPP_MAX_ERR_SHOW	10
40
41typedef	struct _ipp_errlog {
42	boolean_t		multiple_err;
43	uint16_t		dfifo_rd_ptr;
44	uint32_t		state_mach;
45	uint16_t		ecc_syndrome;
46} ipp_errlog_t, *p_ipp_errlog_t;
47
48typedef struct _nxge_ipp_stats {
49	uint32_t 		errors;
50	uint32_t 		inits;
51	uint32_t 		sop_miss;
52	uint32_t 		eop_miss;
53	uint32_t 		dfifo_ue;
54	uint32_t 		ecc_err_cnt;
55	uint32_t 		pfifo_perr;
56	uint32_t 		pfifo_over;
57	uint32_t 		pfifo_und;
58	uint32_t 		bad_cs_cnt;
59	uint32_t 		pkt_dis_cnt;
60	ipp_errlog_t		errlog;
61} nxge_ipp_stats_t, *p_nxge_ipp_stats_t;
62
63typedef	struct _nxge_ipp {
64	uint32_t		config;
65	uint32_t		iconfig;
66	ipp_status_t		status;
67	uint32_t		max_pkt_size;
68	nxge_ipp_stats_t	*stat;
69} nxge_ipp_t;
70
71/* IPP prototypes */
72nxge_status_t nxge_ipp_reset(p_nxge_t);
73nxge_status_t nxge_ipp_init(p_nxge_t);
74nxge_status_t nxge_ipp_disable(p_nxge_t);
75nxge_status_t nxge_ipp_drain(p_nxge_t);
76nxge_status_t nxge_ipp_handle_sys_errors(p_nxge_t);
77nxge_status_t nxge_ipp_fatal_err_recover(p_nxge_t);
78nxge_status_t nxge_ipp_eccue_valid_check(p_nxge_t, boolean_t *);
79void nxge_ipp_inject_err(p_nxge_t, uint32_t);
80
81#ifdef	__cplusplus
82}
83#endif
84
85#endif	/* _SYS_NXGE_NXGE_IPP_H */
86