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_TXC_H 27*3859Sml29623 #define _NPI_TXC_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_txc_hw.h> 37*3859Sml29623 38*3859Sml29623 /* 39*3859Sml29623 * Transmit Controller (TXC) NPI error codes 40*3859Sml29623 */ 41*3859Sml29623 #define TXC_ER_ST (TXC_BLK_ID << NPI_BLOCK_ID_SHIFT) 42*3859Sml29623 #define TXC_ID_SHIFT(n) (n << NPI_PORT_CHAN_SHIFT) 43*3859Sml29623 44*3859Sml29623 #define NPI_TXC_PORT_INVALID(n) (TXC_ID_SHIFT(n) | IS_PORT |\ 45*3859Sml29623 TXC_ER_ST | PORT_INVALID) 46*3859Sml29623 47*3859Sml29623 #define NPI_TXC_CHANNEL_INVALID(n) (TXC_ID_SHIFT(n) | IS_PORT |\ 48*3859Sml29623 TXC_ER_ST | CHANNEL_INVALID) 49*3859Sml29623 50*3859Sml29623 #define NPI_TXC_OPCODE_INVALID(n) (TXC_ID_SHIFT(n) | IS_PORT |\ 51*3859Sml29623 TXC_ER_ST | OPCODE_INVALID) 52*3859Sml29623 53*3859Sml29623 /* 54*3859Sml29623 * Register offset (0x1000 bytes for each channel) for TXC registers. 55*3859Sml29623 */ 56*3859Sml29623 #define NXGE_TXC_FZC_OFFSET(x, cn) (x + TXC_FZC_CHANNEL_OFFSET(cn)) 57*3859Sml29623 58*3859Sml29623 /* 59*3859Sml29623 * Register offset (0x100 bytes for each port) for TXC Function zero 60*3859Sml29623 * control registers. 61*3859Sml29623 */ 62*3859Sml29623 #define NXGE_TXC_FZC_CNTL_OFFSET(x, port) (x + \ 63*3859Sml29623 TXC_FZC_CNTL_PORT_OFFSET(port)) 64*3859Sml29623 /* 65*3859Sml29623 * PIO macros to read and write the transmit control registers. 66*3859Sml29623 */ 67*3859Sml29623 #define TXC_FZC_REG_READ64(handle, reg, cn, val_p) \ 68*3859Sml29623 NXGE_REG_RD64(handle, \ 69*3859Sml29623 (NXGE_TXC_FZC_OFFSET(reg, cn)), val_p) 70*3859Sml29623 71*3859Sml29623 #define TXC_FZC_REG_WRITE64(handle, reg, cn, data) \ 72*3859Sml29623 NXGE_REG_WR64(handle, \ 73*3859Sml29623 (NXGE_TXC_FZC_OFFSET(reg, cn)), data) 74*3859Sml29623 75*3859Sml29623 #define TXC_FZC_CNTL_REG_READ64(handle, reg, port, val_p) \ 76*3859Sml29623 NXGE_REG_RD64(handle, \ 77*3859Sml29623 (NXGE_TXC_FZC_CNTL_OFFSET(reg, port)), val_p) 78*3859Sml29623 79*3859Sml29623 #define TXC_FZC_CNTL_REG_WRITE64(handle, reg, port, data) \ 80*3859Sml29623 NXGE_REG_WR64(handle, \ 81*3859Sml29623 (NXGE_TXC_FZC_CNTL_OFFSET(reg, port)), data) 82*3859Sml29623 83*3859Sml29623 /* 84*3859Sml29623 * TXC (Transmit Controller) prototypes. 85*3859Sml29623 */ 86*3859Sml29623 npi_status_t npi_txc_dma_max_burst(npi_handle_t, io_op_t, 87*3859Sml29623 uint8_t, uint32_t *); 88*3859Sml29623 npi_status_t npi_txc_dma_max_burst_set(npi_handle_t, uint8_t, 89*3859Sml29623 uint32_t); 90*3859Sml29623 npi_status_t npi_txc_dma_bytes_transmitted(npi_handle_t, 91*3859Sml29623 uint8_t, uint32_t *); 92*3859Sml29623 npi_status_t npi_txc_control(npi_handle_t, io_op_t, 93*3859Sml29623 p_txc_control_t); 94*3859Sml29623 npi_status_t npi_txc_global_enable(npi_handle_t); 95*3859Sml29623 npi_status_t npi_txc_global_disable(npi_handle_t); 96*3859Sml29623 npi_status_t npi_txc_control_clear(npi_handle_t, uint8_t); 97*3859Sml29623 npi_status_t npi_txc_training_set(npi_handle_t, uint32_t); 98*3859Sml29623 npi_status_t npi_txc_training_get(npi_handle_t, uint32_t *); 99*3859Sml29623 npi_status_t npi_txc_port_control_get(npi_handle_t, uint8_t, 100*3859Sml29623 uint32_t *); 101*3859Sml29623 npi_status_t npi_txc_port_enable(npi_handle_t, uint8_t); 102*3859Sml29623 npi_status_t npi_txc_port_disable(npi_handle_t, uint8_t); 103*3859Sml29623 npi_status_t npi_txc_dma_max_burst(npi_handle_t, io_op_t, 104*3859Sml29623 uint8_t, uint32_t *); 105*3859Sml29623 npi_status_t npi_txc_port_dma_enable(npi_handle_t, uint8_t, 106*3859Sml29623 uint32_t); 107*3859Sml29623 npi_status_t npi_txc_port_dma_list_get(npi_handle_t, uint8_t, 108*3859Sml29623 uint32_t *); 109*3859Sml29623 npi_status_t npi_txc_port_dma_channel_enable(npi_handle_t, uint8_t, 110*3859Sml29623 uint8_t); 111*3859Sml29623 npi_status_t npi_txc_port_dma_channel_disable(npi_handle_t, uint8_t, 112*3859Sml29623 uint8_t); 113*3859Sml29623 114*3859Sml29623 npi_status_t npi_txc_pkt_stuffed_get(npi_handle_t, uint8_t, 115*3859Sml29623 uint32_t *, uint32_t *); 116*3859Sml29623 npi_status_t npi_txc_pkt_xmt_to_mac_get(npi_handle_t, uint8_t, 117*3859Sml29623 uint32_t *, uint32_t *); 118*3859Sml29623 npi_status_t npi_txc_reorder_get(npi_handle_t, uint8_t, 119*3859Sml29623 uint32_t *); 120*3859Sml29623 npi_status_t npi_txc_dump_tdc_fzc_regs(npi_handle_t, uint8_t); 121*3859Sml29623 npi_status_t npi_txc_dump_fzc_regs(npi_handle_t); 122*3859Sml29623 npi_status_t npi_txc_dump_port_fzc_regs(npi_handle_t, uint8_t); 123*3859Sml29623 npi_status_t npi_txc_ro_states_get(npi_handle_t, uint8_t, 124*3859Sml29623 txc_ro_states_t *); 125*3859Sml29623 npi_status_t npi_txc_ro_ecc_state_clr(npi_handle_t, uint8_t); 126*3859Sml29623 npi_status_t npi_txc_sf_states_get(npi_handle_t, uint8_t, 127*3859Sml29623 txc_sf_states_t *); 128*3859Sml29623 npi_status_t npi_txc_sf_ecc_state_clr(npi_handle_t, uint8_t); 129*3859Sml29623 void npi_txc_global_istatus_get(npi_handle_t, txc_int_stat_t *); 130*3859Sml29623 void npi_txc_global_istatus_clear(npi_handle_t, uint64_t); 131*3859Sml29623 void npi_txc_global_imask_set(npi_handle_t, uint8_t, 132*3859Sml29623 uint8_t); 133*3859Sml29623 134*3859Sml29623 #ifdef __cplusplus 135*3859Sml29623 } 136*3859Sml29623 #endif 137*3859Sml29623 138*3859Sml29623 #endif /* _NPI_TXC_H */ 139