1*3859Sml29623 /* 2*3859Sml29623 * CDDL HEADER START 3*3859Sml29623 * 4*3859Sml29623 * The contents of this file are subject to the terms of the 5*3859Sml29623 * Common Development and Distribution License (the "License"). 6*3859Sml29623 * You may not use this file except in compliance with the License. 7*3859Sml29623 * 8*3859Sml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*3859Sml29623 * or http://www.opensolaris.org/os/licensing. 10*3859Sml29623 * See the License for the specific language governing permissions 11*3859Sml29623 * and limitations under the License. 12*3859Sml29623 * 13*3859Sml29623 * When distributing Covered Code, include this CDDL HEADER in each 14*3859Sml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*3859Sml29623 * If applicable, add the following below this CDDL HEADER, with the 16*3859Sml29623 * fields enclosed by brackets "[]" replaced with your own identifying 17*3859Sml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 18*3859Sml29623 * 19*3859Sml29623 * CDDL HEADER END 20*3859Sml29623 */ 21*3859Sml29623 /* 22*3859Sml29623 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*3859Sml29623 * Use is subject to license terms. 24*3859Sml29623 */ 25*3859Sml29623 26*3859Sml29623 #ifndef _NPI_IPP_H 27*3859Sml29623 #define _NPI_IPP_H 28*3859Sml29623 29*3859Sml29623 #pragma ident "%Z%%M% %I% %E% SMI" 30*3859Sml29623 31*3859Sml29623 #ifdef __cplusplus 32*3859Sml29623 extern "C" { 33*3859Sml29623 #endif 34*3859Sml29623 35*3859Sml29623 #include <npi.h> 36*3859Sml29623 #include <nxge_ipp_hw.h> 37*3859Sml29623 38*3859Sml29623 /* IBTP IPP Configuration */ 39*3859Sml29623 40*3859Sml29623 typedef enum ipp_config_e { 41*3859Sml29623 CFG_IPP = IPP_EN, 42*3859Sml29623 CFG_IPP_DFIFO_ECC_CORRECT = IPP_DFIFO_ECC_CORRECT_EN, 43*3859Sml29623 CFG_IPP_DROP_BAD_CRC = IPP_DROP_BAD_CRC_EN, 44*3859Sml29623 CFG_IPP_TCP_UDP_CKSUM = IPP_TCP_UDP_CKSUM_EN, 45*3859Sml29623 CFG_IPP_DFIFO_PIO_WR = IPP_DFIFO_PIO_WR_EN, 46*3859Sml29623 CFG_IPP_PRE_FIFO_PIO_WR = IPP_PRE_FIFO_PIO_WR_EN, 47*3859Sml29623 CFG_IPP_FFLP_CKSUM_INFO_PIO_WR = IPP_FFLP_CKSUM_INFO_PIO_WR_EN, 48*3859Sml29623 CFG_IPP_ALL = (IPP_EN | IPP_DFIFO_ECC_CORRECT_EN | 49*3859Sml29623 IPP_DROP_BAD_CRC_EN | IPP_TCP_UDP_CKSUM_EN | 50*3859Sml29623 IPP_DFIFO_PIO_WR_EN | IPP_PRE_FIFO_PIO_WR_EN) 51*3859Sml29623 } ipp_config_t; 52*3859Sml29623 53*3859Sml29623 typedef enum ipp_iconfig_e { 54*3859Sml29623 ICFG_IPP_PKT_DISCARD_OVFL = IPP_PKT_DISCARD_CNT_INTR_DIS, 55*3859Sml29623 ICFG_IPP_BAD_TCPIP_CKSUM_OVFL = IPP_BAD_TCPIP_CKSUM_CNT_INTR_DIS, 56*3859Sml29623 ICFG_IPP_PRE_FIFO_UNDERRUN = IPP_PRE_FIFO_UNDERRUN_INTR_DIS, 57*3859Sml29623 ICFG_IPP_PRE_FIFO_OVERRUN = IPP_PRE_FIFO_OVERRUN_INTR_DIS, 58*3859Sml29623 ICFG_IPP_PRE_FIFO_PERR = IPP_PRE_FIFO_PERR_INTR_DIS, 59*3859Sml29623 ICFG_IPP_DFIFO_ECC_UNCORR_ERR = IPP_DFIFO_ECC_UNCORR_ERR_INTR_DIS, 60*3859Sml29623 ICFG_IPP_DFIFO_MISSING_EOP_SOP = IPP_DFIFO_MISSING_EOP_SOP_INTR_DIS, 61*3859Sml29623 ICFG_IPP_ECC_ERR_OVFL = IPP_ECC_ERR_CNT_MAX_INTR_DIS, 62*3859Sml29623 ICFG_IPP_ALL = (IPP_PKT_DISCARD_CNT_INTR_DIS | 63*3859Sml29623 IPP_BAD_TCPIP_CKSUM_CNT_INTR_DIS | 64*3859Sml29623 IPP_PRE_FIFO_UNDERRUN_INTR_DIS | 65*3859Sml29623 IPP_PRE_FIFO_OVERRUN_INTR_DIS | 66*3859Sml29623 IPP_PRE_FIFO_PERR_INTR_DIS | 67*3859Sml29623 IPP_DFIFO_ECC_UNCORR_ERR_INTR_DIS | 68*3859Sml29623 IPP_DFIFO_MISSING_EOP_SOP_INTR_DIS | 69*3859Sml29623 IPP_ECC_ERR_CNT_MAX_INTR_DIS) 70*3859Sml29623 } ipp_iconfig_t; 71*3859Sml29623 72*3859Sml29623 typedef enum ipp_counter_e { 73*3859Sml29623 CNT_IPP_DISCARD_PKT = 0x00000001, 74*3859Sml29623 CNT_IPP_TCP_CKSUM_ERR = 0x00000002, 75*3859Sml29623 CNT_IPP_ECC_ERR = 0x00000004, 76*3859Sml29623 CNT_IPP_ALL = 0x00000007 77*3859Sml29623 } ipp_counter_t; 78*3859Sml29623 79*3859Sml29623 80*3859Sml29623 typedef enum ipp_port_cnt_idx_e { 81*3859Sml29623 HWCI_IPP_PKT_DISCARD = 0, 82*3859Sml29623 HWCI_IPP_TCP_CKSUM_ERR, 83*3859Sml29623 HWCI_IPP_ECC_ERR, 84*3859Sml29623 CI_IPP_MISSING_EOP_SOP, 85*3859Sml29623 CI_IPP_UNCORR_ERR, 86*3859Sml29623 CI_IPP_PERR, 87*3859Sml29623 CI_IPP_FIFO_OVERRUN, 88*3859Sml29623 CI_IPP_FIFO_UNDERRUN, 89*3859Sml29623 CI_IPP_PORT_CNT_ARR_SIZE 90*3859Sml29623 } ipp_port_cnt_idx_t; 91*3859Sml29623 92*3859Sml29623 /* IPP specific errors */ 93*3859Sml29623 94*3859Sml29623 #define IPP_MAX_PKT_BYTES_INVALID 0x50 95*3859Sml29623 #define IPP_FIFO_ADDR_INVALID 0x51 96*3859Sml29623 97*3859Sml29623 /* IPP error return macros */ 98*3859Sml29623 99*3859Sml29623 #define NPI_IPP_PORT_INVALID(portn)\ 100*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) | PORT_INVALID |\ 101*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 102*3859Sml29623 #define NPI_IPP_OPCODE_INVALID(portn)\ 103*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) | OPCODE_INVALID |\ 104*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 105*3859Sml29623 #define NPI_IPP_CONFIG_INVALID(portn)\ 106*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) | CONFIG_INVALID |\ 107*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 108*3859Sml29623 #define NPI_IPP_MAX_PKT_BYTES_INVALID(portn)\ 109*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) |\ 110*3859Sml29623 IPP_MAX_PKT_BYTES_INVALID |\ 111*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 112*3859Sml29623 #define NPI_IPP_COUNTER_INVALID(portn)\ 113*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) | COUNTER_INVALID |\ 114*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 115*3859Sml29623 #define NPI_IPP_RESET_FAILED(portn)\ 116*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) | RESET_FAILED |\ 117*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 118*3859Sml29623 #define NPI_IPP_FIFO_ADDR_INVALID(portn)\ 119*3859Sml29623 ((IPP_BLK_ID << NPI_BLOCK_ID_SHIFT) |\ 120*3859Sml29623 IPP_FIFO_ADDR_INVALID |\ 121*3859Sml29623 IS_PORT | (portn << NPI_PORT_CHAN_SHIFT)) 122*3859Sml29623 123*3859Sml29623 #define IPP_REG_RD(handle, portn, reg, val) {\ 124*3859Sml29623 NXGE_REG_RD64(handle, IPP_REG_ADDR(portn, reg), val);\ 125*3859Sml29623 } 126*3859Sml29623 127*3859Sml29623 #define IPP_REG_WR(handle, portn, reg, val) {\ 128*3859Sml29623 NXGE_REG_WR64(handle, IPP_REG_ADDR(portn, reg), val);\ 129*3859Sml29623 } 130*3859Sml29623 131*3859Sml29623 /* IPP NPI function prototypes */ 132*3859Sml29623 npi_status_t npi_ipp_get_pfifo_rd_ptr(npi_handle_t, uint8_t, 133*3859Sml29623 uint16_t *); 134*3859Sml29623 135*3859Sml29623 npi_status_t npi_ipp_get_pfifo_wr_ptr(npi_handle_t, uint8_t, 136*3859Sml29623 uint16_t *); 137*3859Sml29623 138*3859Sml29623 npi_status_t npi_ipp_write_pfifo(npi_handle_t, uint8_t, 139*3859Sml29623 uint8_t, uint32_t, uint32_t, uint32_t, 140*3859Sml29623 uint32_t, uint32_t); 141*3859Sml29623 142*3859Sml29623 npi_status_t npi_ipp_read_pfifo(npi_handle_t, uint8_t, 143*3859Sml29623 uint8_t, uint32_t *, uint32_t *, uint32_t *, 144*3859Sml29623 uint32_t *, uint32_t *); 145*3859Sml29623 146*3859Sml29623 npi_status_t npi_ipp_write_dfifo(npi_handle_t, uint8_t, 147*3859Sml29623 uint16_t, uint32_t, uint32_t, uint32_t, 148*3859Sml29623 uint32_t, uint32_t); 149*3859Sml29623 150*3859Sml29623 npi_status_t npi_ipp_read_dfifo(npi_handle_t, uint8_t, 151*3859Sml29623 uint16_t, uint32_t *, uint32_t *, uint32_t *, 152*3859Sml29623 uint32_t *, uint32_t *); 153*3859Sml29623 154*3859Sml29623 npi_status_t npi_ipp_reset(npi_handle_t, uint8_t); 155*3859Sml29623 npi_status_t npi_ipp_config(npi_handle_t, config_op_t, uint8_t, 156*3859Sml29623 ipp_config_t); 157*3859Sml29623 npi_status_t npi_ipp_set_max_pktsize(npi_handle_t, uint8_t, 158*3859Sml29623 uint32_t); 159*3859Sml29623 npi_status_t npi_ipp_iconfig(npi_handle_t, config_op_t, uint8_t, 160*3859Sml29623 ipp_iconfig_t); 161*3859Sml29623 npi_status_t npi_ipp_get_status(npi_handle_t, uint8_t, 162*3859Sml29623 ipp_status_t *); 163*3859Sml29623 npi_status_t npi_ipp_counters(npi_handle_t, counter_op_t, 164*3859Sml29623 ipp_counter_t, uint8_t, npi_counter_t *); 165*3859Sml29623 npi_status_t npi_ipp_get_ecc_syndrome(npi_handle_t, uint8_t, 166*3859Sml29623 uint16_t *); 167*3859Sml29623 npi_status_t npi_ipp_get_dfifo_eopm_rdptr(npi_handle_t, uint8_t, 168*3859Sml29623 uint16_t *); 169*3859Sml29623 npi_status_t npi_ipp_get_state_mach(npi_handle_t, uint8_t, 170*3859Sml29623 uint32_t *); 171*3859Sml29623 npi_status_t npi_ipp_get_dfifo_rd_ptr(npi_handle_t, uint8_t, 172*3859Sml29623 uint16_t *); 173*3859Sml29623 npi_status_t npi_ipp_get_dfifo_wr_ptr(npi_handle_t, uint8_t, 174*3859Sml29623 uint16_t *); 175*3859Sml29623 npi_status_t npi_ipp_get_ecc_err_count(npi_handle_t, uint8_t, 176*3859Sml29623 uint8_t *); 177*3859Sml29623 npi_status_t npi_ipp_get_pkt_dis_count(npi_handle_t, uint8_t, 178*3859Sml29623 uint16_t *); 179*3859Sml29623 npi_status_t npi_ipp_get_cs_err_count(npi_handle_t, uint8_t, 180*3859Sml29623 uint16_t *); 181*3859Sml29623 npi_status_t npi_ipp_dump_regs(npi_handle_t, uint8_t); 182*3859Sml29623 void npi_ipp_read_regs(npi_handle_t, uint8_t); 183*3859Sml29623 184*3859Sml29623 #ifdef __cplusplus 185*3859Sml29623 } 186*3859Sml29623 #endif 187*3859Sml29623 188*3859Sml29623 #endif /* _NPI_IPP_H */ 189