/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ERI_H
#define _SYS_ERI_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/* Named Dispatch Parameter Management Structure */
typedef struct param_s {
char *param_name;
} param_t;
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;
/*
* 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.
*/
/*
* Maximum number of receive descriptors posted to the chip.
*/
/*
* Maximum number of transmit descriptors for lazy reclaim.
*/
/*
* Return the address of an adjacent descriptor in the given ring.
*/
#define MSECOND(t) t
/*
* ERI ASIC Revision Numbers
*/
/*
* 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
/*
* Transceivers selected for use by the driver.
*/
#define INTERNAL_XCVR 0
/*
* states for manually creating the link down condition
*/
#define ERI_LINKDOWN_OK 0
/*
* states for bringing up the link in auto-negotiation mode
*/
/*
* states for resetting the transceiver
*/
/*
* 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
/*
* Values for the eri_non-serial-link field
*/
#define ERI_NO_SHARED_PIN_PHY 0
/*
* Values for the default selection when both the serial link and
* the MII links are present.
*/
#define ERI_DEFAULT_SERIAL_LINK 0
/*
* Values for the eri_select_link field to manually select the PHY
*/
/*
* eri_linkup_state" definitions
*/
#define ERI_START_LINK_BRINGUP 0
/*
* 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 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 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 openloop_autoneg;
int autoneg;
int force_linkdown;
int mode;
int linkup_10;
int nlasttries;
int ntries;
int delay;
int linkup_attempts;
int polling_on;
int mifpoll_data;
int linkup_cnt;
int linkcheck;
/* named dispatch table */
/*
* DDI dma handle, kernel virtual base,
* and io virtual base of IOPB area.
*/
/*
* Check if transmitter is hung
*/
#ifdef ERI_RMAC_HANG_WORKAROUND
#endif
};
/*
* LADRF bit array manipulation macros. These are for working within the
* array of words defined by erip->ladrf, converting a bit (0-255) into
* the index and offset in the ladrf bit array. Note that the array is
* provided in "Big Endian" order.
*/
/*
* 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
typedef struct {
int loopback;
} loopback_t;
/*
* flags
* TODO : MBE
*/
/*
* Mac address flags
*/
struct erikstat {
/*
* Software event stats
*/
/*
* MAC Control event stats
*/
/*
* MAC TX Event stats
*/
/*
* MAC RX Event stats
*/
/*
* Fatal errors
*/
/*
* Parity error
*/
/*
* PCI fatal error stats
*/
/*
* PCI Configuration space staus register
*/
};
/* 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)
*/
/* Offset for the first byte in the receive buffer */
#define ERI_PMCAP_NONE 0
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ERI_H */