eri.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ERI_H
#define _SYS_ERI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#define ETHERTYPE_IPV4 ETHERTYPE_IP
/* Named Dispatch Parameter Management Structure */
typedef struct param_s {
char *param_name;
} param_t;
#define ERI_PARAM_CNT 51
typedef enum {
/*
* kstats
*/
typedef struct stats {
/*
*/
/*
* MAC TX Event stats
*/
/*
* MAC RX Event stats
*/
/*
* MAC Control event stats
*/
/*
* Software event stats
*/
/*
* Fatal errors
*/
/*
* parity error
*/
/*
* Fatal error stats
*/
/*
* PCI Configuration space staus register
*/
/*
* MIB II variables
*/
/*
* Link Status
*/
} stats_t;
/*
* Definitions for module_info.
*/
#define ERI_MINPSZ (0) /* min packet size */
#define TX_STREAM_MIN 512
/*
* Per-Stream instance state information.
*
* Each instance is dynamically allocated at open() and free'd
* at close(). Each per-Stream instance points to at most one
* per-device structure using the sb_erip field. All instances
* are threaded together into one list of active instances
* ordered on minor device number.
*/
struct eristr {
struct ether_addr
/* Reference count for filter bits */
};
*(((uint8_t *)(a)) + 1) ^ \
*(((uint8_t *)(a)) + 2) ^ \
*(((uint8_t *)(a)) + 3) ^ \
*(((uint8_t *)(a)) + 4) ^ \
/*
* per-stream flags
*/
/*
* Maximum number of receive descriptors posted to the chip.
*/
/*
* Maximum number of transmit descriptors for lazy reclaim.
*/
/*
* Full DLSAP address length (in struct dladdr format).
*/
/*
* Return the address of an adjacent descriptor in the given ring.
*/
#define MSECOND(t) t
#define SECOND(t) t*1000
/*
* ERI ASIC Revision Numbers
*/
#define ERI_ERIREV_1_0 0x1
/*
* Link poll interval for detecting change of transceivers
*/
/*
* Parallel detection Fault restart timer
*/
/*
* Check rmac hang restart timer
*/
#define ERI_RMAC_HANG_WORKAROUND
/*
* undefine ERI_PM_WORKAROUND this time. With ERI_PM_WORKAROUND defined,
* each non_fatal error causes pci clock to go up for 30 seconds. Therefore,
* no TXMAC_UNDERRUN or excessive RXFIFO_OVERFLOW should happen.
*/
/*
* Link bringup modes
*/
#define ERI_AUTO_BRINGUP 0
#define ERI_FORCED_BRINGUP 1
/*
* Transceivers selected for use by the driver.
*/
#define NO_XCVR 2
#define INTERNAL_XCVR 0
#define EXTERNAL_XCVR 1
/*
* states for manually creating the link down condition
*/
#define ERI_LINKDOWN_OK 0
#define ERI_FORCE_LINKDOWN 1
#define ERI_LINKDOWN_STARTED 2
#define ERI_LINKDOWN_DONE 3
/*
* states for bringing up the link in auto-negotiation mode
*/
#define ERI_HWAN_TRY 0 /* Try Hardware autonegotiation */
/*
* states for resetting the transceiver
*/
#define RESET_TO_BE_ISSUED 0 /* Reset command to be issued to the PHY */
/*
* ERI Supported PHY devices
* ERI ASIC supports a built in Gigabit Serial LInk Interface and MII
* External SERDES interfaces with shared pins.
* On some product implementations, the built-in Serial Link may not be present
* either because the Serial Link circuitry does not work or because the product
* needs to use only the MII interface.
* When both the Serial Link and MII PHY's are present, the driver normally
* tries to bring up both the links. If both of them come up, it will select the
* link defined by the "eri_default_link" variable by default.
* The user may use the configuration variable
* eri_select_link to manually select
* either the Serial Link or the MII PHY to be used.
*/
/*
* Values for the eri_serial_link field
*/
#define ERI_SERIAL_LINK_NOT_PRESENT 0
#define ERI_SERIAL_LINK_PRESENT 1
/*
* Values for the eri_non-serial-link field
*/
#define ERI_NO_SHARED_PIN_PHY 0
#define ERI_MII_PRESENT 1
#define ERI_SERDES_PRESENT 2
/*
* Values for the default selection when both the serial link and
* the MII links are present.
*/
#define ERI_DEFAULT_SERIAL_LINK 0
#define ERI_DEFAULT_MII_LINK 1
/*
* Values for the eri_select_link field to manually select the PHY
*/
#define ERI_AUTO_PHY 0 /* Select PHY automatically */
/*
* Speed definitions for param_speed
*/
#define SPEED_10 10
#define SPEED_100 100
#define SPEED_UNK 0
/*
* Mode definitions for param_mode
*/
#define ERI_MODE_HDX 0
#define ERI_MODE_FDX 1
#define ERI_MODE_UDX 2
/*
* eri_linkup_state" definitions
*/
#define ERI_START_LINK_BRINGUP 0
#define ERI_SERIAL_LINK_BRINGUP 1
#define ERI_SERDES_LINK_BRINGUP 2
#define ERI_MII_LINK_BRINGUP 3
#define ERI_DEFAULT_LINK_BRINGUP 4
#define ERI_ALT_LINK_BRINGUP 5
/*
* structure used to detect tx hang condition
*/
struct erisave {
};
/*
* ERI Device Channel instance state information.
*
* Each instance is dynamically allocated on first attach.
*/
struct eri {
int cpci_mode; /* compact pci dev (future) */
int low_power_mode; /* E* (low power) */
int asic_rev; /* ERI ASIC rev no. */
int board_rev; /* ERI ASIC rev no. */
int burstsizes; /* binary encoded val */
int pagesize; /* btop(9f) */
int rpending; /* Max.no. of RX bufs post */
int tpending; /* Max.no. of tX bufs post */
int tx_cur_cnt; /* # of packets for int_me */
int mifpoll_enable;
int frame_enable;
int lance_mode_enable;
int ngu_enable;
int link_pulse_disabled;
int xmit_dma_mode;
int rcv_dma_mode;
#ifdef RCV_OVRFLOW_CORRUPTION_BUG
#endif
/*
* these are handles for the dvma resources reserved
* by dvma_reserve
*/
/*
* these are used if dvma reserve fails, and we have to fall
* back on the older ddi_dma_addr_setup routines
*/
int rcv_handle_cnt;
int xmit_handle_cnt;
int rx_reset_issued;
int tx_reset_issued;
int rxmac_reset_issued;
int txmac_reset_issued;
int global_reset_issued;
int rmdmax_mask;
int init_macregs;
int phyad; /* addr of the PHY in use */
int xcvr; /* current PHY in use */
int openloop_autoneg;
int autoneg;
int force_linkdown;
int mode;
int linkup_10;
int pace_count; /* pacing pkt count */
int nlasttries;
int ntries;
int delay;
int linkup_attempts;
int polling_on;
int mifpoll_data;
int mifpoll_flag; /* indicates MIF intr */
int pauseTX; /* pcs link-pause TX enable */
int pauseRX; /* pcs link-pause RX enable */
int macfdx; /* mac full-duplex mode */
int linkup_cnt;
int linkup; /* selected link status */
int linkup_state; /* link bringup state */
int linkup_changed; /* link bringup state */
int linkcheck;
int linksts_msg;
/* named dispatch table */
/*
* DDI dma handle, kernel virtual base,
* and io virtual base of IOPB area.
*/
/*
* Check if transmitter is hung
*/
#ifdef XMIT_SERIAL_QUEUE
/* A syncq implementation. */
#endif
#ifdef ERI_RMAC_HANG_WORKAROUND
#endif
};
/*
* ERI IOCTLS.
* Change : TODO : MBE
*/
/*
* Loopback modes: For diagnostic testing purposes the ERI card
* can be placed in loopback mode.
* There are three modes of loopback provided by the driver,
* Mac loopback, PCS loopback and Serdes loopback.
*/
#define ERI_LOOPBACK_OFF 0
#define ERI_MAC_LOOPBACK_ON 1
#define ERI_PCS_LOOPBACK_ON 2
#define ERI_SER_LOOPBACK_ON 4
typedef struct {
int loopback;
} loopback_t;
/*
* flags
* TODO : MBE
*/
/*
* Mac address flags
*/
struct erikstat {
/*
*/
struct kstat_named erik_ipackets;
struct kstat_named erik_ierrors;
struct kstat_named erik_opackets;
struct kstat_named erik_oerrors;
struct kstat_named erik_collisions;
/*
* required by kstat for MIB II objects(RFC 1213)
*/
/* MIB - ifInOctets */
/* MIB - ifOutOctets */
/* delivered to upper layer */
/* MIB - ifInNUcastPkts */
/* requested to be sent */
/* MIB - ifOutNUcastPkts */
/* delivered to upper layer */
/* MIB - ifInNUcastPkts */
/* requested to be sent */
/* MIB - ifOutNUcastPkts */
/* MIB - ifInDiscards */
/* MIB - ifOutDiscards */
/*
* Software event stats
*/
struct kstat_named erik_inits;
struct kstat_named erik_rx_inits;
struct kstat_named erik_tx_inits;
struct kstat_named erik_nocanput;
struct kstat_named erik_allocbfail;
struct kstat_named erik_drop;
/*
* MAC Control event stats
*/
struct kstat_named erik_pause_oncount;
struct kstat_named erik_pause_offcount;
struct kstat_named erik_pause_time_count;
/*
* MAC TX Event stats
*/
struct kstat_named erik_txmac_urun;
struct kstat_named erik_txmac_maxpkt_err;
struct kstat_named erik_excessive_coll;
struct kstat_named erik_late_coll;
struct kstat_named erik_first_coll;
struct kstat_named erik_defer_timer_exp;
struct kstat_named erik_peak_attempt_cnt;
struct kstat_named erik_jab;
struct kstat_named erik_notmds;
struct kstat_named erik_tx_hang;
/*
* MAC RX Event stats
*/
struct kstat_named erik_rx_corr;
struct kstat_named erik_rx_overflow;
struct kstat_named erik_rx_hang;
struct kstat_named erik_rx_align_err;
struct kstat_named erik_rx_crc_err;
struct kstat_named erik_rx_length_err;
struct kstat_named erik_rx_code_viol_err;
struct kstat_named erik_rx_bad_pkts;
struct kstat_named erik_rx_runt;
struct kstat_named erik_rx_toolong_pkts;
/*
* Fatal errors
*/
struct kstat_named erik_rxtag_err;
/*
* Parity error
*/
struct kstat_named erik_parity_error;
/*
* PCI fatal error stats
*/
/*
* PCI Configuration space staus register
*/
struct kstat_named erik_pci_det_parity_err;
/*
* PSARC 1997/198 : 64bit kstats
*/
struct kstat_named erik_ipackets64;
struct kstat_named erik_opackets64;
/* MIB - ifInOctets */
/* MIB - ifOutOctets */
};
/* TBD: new value ? */
/*
* This structure is organized to meet the following requirements:
* - hb_buf starts on an ERI_BURSTSIZE boundary.
* - eribuf is an even multiple of ERI_BURSTSIZE
* - hb_buf[] is large enough to contain max frame (1518) plus
* (3 x ERI_BURSTSIZE) rounded up to the next ERI_BURSTSIZE
*/
/*
* #define ERI_BURSTSIZE (64)
*/
#define ERI_BURSTSIZE (128)
#define ERI_HEADROOM (34)
/* Offset for the first byte in the receive buffer */
#define ERI_FSTBYTE_OFFSET 2
#define ERI_CKSUM_OFFSET 14
/*
* Private DLPI full dlsap address format.
*/
struct eridladdr {
struct ether_addr dl_phys;
};
#define ERI_PMCAP_NONE 0
#define ERI_PMCAP_4MHZ 4
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ERI_H */