afeimpl.h revision 96fb08b94cc33de779f46f36c30d77230f1a8c2f
/*
* Solaris driver for ethernet cards based on the ADMtek Centaur
*
* Copyright (c) 2007 by Garrett D'Amore <garrett@damore.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _AFEIMPL_H
#define _AFEIMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
/*
* Compile time tunables.
*/
/*
* Constants, do not change.
*/
#define AFE_MCHASH (64)
typedef struct afe_card afe_card_t;
typedef struct afe_rxbuf afe_rxbuf_t;
typedef struct afe_txbuf afe_txbuf_t;
typedef struct afe_desc afe_desc_t;
/*
* Card models.
*/
typedef enum {
MODEL_CENTAUR = 1,
} afe_model_t;
struct afe_card {
char *card_cardname; /* Description of the card */
};
/*
* Device instance structure, one per PCI card.
*/
struct afe {
int afe_flags;
/*
* Register and DMA access.
*/
/*
* Receive descriptors.
*/
int afe_rxhead;
struct afe_desc *afe_rxdescp;
struct afe_rxbuf **afe_rxbufs;
/*
* Transmit descriptors.
*/
int afe_txreclaim;
int afe_txsend;
int afe_txavail;
struct afe_desc *afe_txdescp;
struct afe_txbuf **afe_txbufs;
/*
* Link state.
*/
/*
* Transceiver stuff.
*/
int afe_phyaddr;
int afe_phyid;
int afe_phyinuse;
int afe_forcefiber;
/*
* Address management.
*/
/*
* Kstats.
*/
unsigned afe_norcvbuf;
unsigned afe_errrcv;
unsigned afe_errxmt;
unsigned afe_missed;
unsigned afe_underflow;
unsigned afe_overflow;
unsigned afe_align_errors;
unsigned afe_fcs_errors;
unsigned afe_carrier_errors;
unsigned afe_collisions;
unsigned afe_ex_collisions;
unsigned afe_tx_late_collisions;
unsigned afe_defer_xmts;
unsigned afe_first_collisions;
unsigned afe_multi_collisions;
unsigned afe_sqe_errors;
unsigned afe_macxmt_errors;
unsigned afe_macrcv_errors;
unsigned afe_toolong_errors;
unsigned afe_runt;
unsigned afe_jabber;
};
struct afe_rxbuf {
};
struct afe_txbuf {
};
/*
* Descriptor. We use rings rather than chains.
*/
struct afe_desc {
unsigned desc_status;
unsigned desc_control;
unsigned desc_buffer1;
unsigned desc_buffer2;
};
/*
* Receive descriptor fields.
*/
/*
* Transmit descriptor fields.
*/
/*
* Interface flags.
*/
/*
* Register definitions located in afe.h exported header file.
*/
/*
* Macros to simplify hardware access.
*/
/*
* Debugging flags.
*/
#define DWARN 0x0001
#define DINTR 0x0002
#define DMACID 0x0008
#define DPHY 0x0020
#define DPCI 0x0040
#define DCHATTY 0x0080
#define DDMA 0x0100
#define DLINK 0x0200
#define DSROM 0x0400
#define DRECV 0x0800
#define DXMIT 0x1000
#ifdef DEBUG
#else
#endif
#endif /* _KERNEL */
#endif /* _AFEIMPL_H */