438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King/*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Copyright (c) 2011 Jason King.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Copyright (c) 2000 Berkeley Software Design, Inc.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Copyright (c) 1997, 1998, 1999, 2000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King *
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Redistribution and use in source and binary forms, with or without
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * modification, are permitted provided that the following conditions
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * are met:
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * 1. Redistributions of source code must retain the above copyright
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * notice, this list of conditions and the following disclaimer.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * 2. Redistributions in binary form must reproduce the above copyright
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * notice, this list of conditions and the following disclaimer in the
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * documentation and/or other materials provided with the distribution.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * 3. All advertising materials mentioning features or use of this software
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * must display the following acknowledgement:
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * This product includes software developed by Bill Paul.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * 4. Neither the name of the author nor the names of any co-contributors
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * may be used to endorse or promote products derived from this software
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * without specific prior written permission.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King *
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * THE POSSIBILITY OF SUCH DAMAGE.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King *
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#ifndef _PCNIMPL_H
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define _PCNIMPL_H
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#ifdef __cplusplus
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingextern "C" {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#endif
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#ifdef _KERNEL
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_VENDORID 0x1022
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_DEVICEID_PCNET 0x2000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_DEVICEID_HOME 0x2001
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingtypedef struct pcn_type {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_vid;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_did;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King char *pcn_name; /* ddi_set_prop takes char * */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King} pcn_type_t;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXRECLAIM 8
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_HEADROOM 34
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXRESCHED 120
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_BAM 0x0008 /* broadcast address match */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_LAFM 0x0010 /* logical address filter match */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_PAM 0x0020 /* physical address match */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_BPE 0x0080 /* bus parity error */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_ENP 0x0100 /* end of packet */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_STP 0x0200 /* start of packet */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_BUFF 0x0400 /* buffer error */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_CRC 0x0800 /* CRC error */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_OFLOW 0x1000 /* rx overrun */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_FRAM 0x2000 /* framing error */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_ERR 0x4000 /* error summary */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_OWN 0x8000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXSTAT_STR \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\020" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\004BAM" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\005LAFM" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\006PAM" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\010BPE" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\011ENP" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\012STP" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\013BUFF" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\014CRC" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\015OFLOW" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\016FRAM" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\017ERR" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\020OWN"
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXLEN_MBO 0xF000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXLEN_BUFSZ 0x0FFF
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingtypedef struct pcn_rx_desc {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_rxlen;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_rsvd0;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_bufsz;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_rxstat;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_rbaddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_uspace;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King} pcn_rx_desc_t;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingtypedef struct pcn_tx_desc {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_txstat;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_txctl;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_tbaddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_uspace;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King} pcn_tx_desc_t;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_OWN 0x80000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_ERR 0x40000000 /* error summary */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_ADD_FCS 0x20000000 /* add FCS to pkt */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_MORE_LTINT 0x10000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_ONE 0x08000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_DEF 0x04000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_STP 0x02000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_ENP 0x01000000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_BPE 0x00800000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_MBO 0x0000F000
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_BUFSZ 0x00000FFF
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXCTL_STR \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\020" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\040OWN" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\037ERR" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\036ADD_FCS" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\035MORE_LTINT" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\034ONE" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\033DEF" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\032STP" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\031ENP" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\030BPE"
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingtypedef struct pcn_buf {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King caddr_t pb_buf;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_dma_handle_t pb_dmah;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_acc_handle_t pb_acch;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pb_paddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King} pcn_buf_t;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King/* Constants, do not change */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_BUFSZ (1664)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_MCHASH (64)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King/* Number of descriptor entries */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RXRING 64
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_TXRING 256
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason Kingtypedef struct pcn {
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King dev_info_t *pcn_dip;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King mac_handle_t pcn_mh;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King mii_handle_t pcn_mii;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_cachesize;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_flags;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_instance;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King kmutex_t pcn_xmtlock;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King kmutex_t pcn_intrlock;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King kmutex_t pcn_reglock;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_iblock_cookie_t pcn_icookie;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint_t pcn_int_pri;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_type;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int8_t pcn_extphyaddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King /*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Register and DMA access
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uintptr_t pcn_regs;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_acc_handle_t pcn_regshandle;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King /*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Receive descriptors.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_rxhead;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King pcn_rx_desc_t *pcn_rxdescp;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_dma_handle_t pcn_rxdesc_dmah;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_acc_handle_t pcn_rxdesc_acch;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_rxdesc_paddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King pcn_buf_t **pcn_rxbufs;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King /*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Transmit descriptors.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_txreclaim;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_txsend;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King int pcn_txavail;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King pcn_tx_desc_t *pcn_txdescp;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_dma_handle_t pcn_txdesc_dmah;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King ddi_acc_handle_t pcn_txdesc_acch;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint32_t pcn_txdesc_paddr;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King pcn_buf_t **pcn_txbufs;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King hrtime_t pcn_txstall_time;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King boolean_t pcn_wantw;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King /*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * Address management.
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uchar_t pcn_addr[ETHERADDRL];
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King boolean_t pcn_promisc;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_mccount[PCN_MCHASH];
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint16_t pcn_mctab[PCN_MCHASH / 16];
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King /*
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King * stats
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_ipackets;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_opackets;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_rbytes;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_obytes;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_brdcstxmt;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_multixmt;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_brdcstrcv;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_multircv;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_norcvbuf;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_errrcv;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_errxmt;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_missed;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_underflow;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_overflow;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_align_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_fcs_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_carrier_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_collisions;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_ex_collisions;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_tx_late_collisions;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_defer_xmts;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_first_collisions;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_multi_collisions;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_sqe_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_macxmt_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_macrcv_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_toolong_errors;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_runt;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King uint64_t pcn_jabber;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King} pcn_t;
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King/* Flags */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_RUNNING (1L << 0)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_SUSPENDED (1L << 1)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_INTR_ENABLED (1L << 2)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define PCN_FLAGSTR \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\020" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\001RUNNING" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\002SUSPENDED" \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King "\003INTR_ENABLED"
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define IS_RUNNING(p) ((p)->pcn_flags & PCN_RUNNING)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define IS_SUSPENDED(p) ((p)->pcn_flags & PCN_SUSPENDED)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define SYNCTXDESC(pcnp, index, who) \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King (void) ddi_dma_sync(pcnp->pcn_txdesc_dmah, \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King (index * sizeof (pcn_tx_desc_t)), sizeof (pcn_tx_desc_t), who)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define SYNCRXDESC(pcnp, index, who) \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King (void) ddi_dma_sync(pcnp->pcn_rxdesc_dmah, \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King (index * sizeof (pcn_rx_desc_t)), sizeof (pcn_rx_desc_t), who)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#define SYNCBUF(pb, len, who) \
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King (void) ddi_dma_sync(pb->pb_dmah, 0, len, who)
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#endif /* _KERNEL */
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#ifdef __cplusplus
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King}
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#endif
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King
438b5f69eb4f998015cc0835f19f2f80663f2f53Jason King#endif /* _PCNIMPL_H */