hme.h revision 0219346b07c8d846112a335f1543309c21e3d8da
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_HME_H
#define _SYS_HME_H
#ifdef __cplusplus
extern "C" {
#endif
/* mode */
#define HME_AUTO_SPEED 0
#define HME_FORCE_SPEED 1
/* speed */
#define HME_SPEED_10 10
#define HME_SPEED_100 100
/* half-duplex or full-duplex mode */
#define HME_HALF_DUPLEX 0
#define HME_FULL_DUPLEX 1
#ifdef _KERNEL
/* Named Dispatch Parameter Management Structure */
typedef struct hmeparam_s {
char *hme_param_name;
} hmeparam_t;
static hmeparam_t hme_param_arr[] = {
/* min max value name */
{ 0, 1, 1, "transceiver_inuse"},
{ 0, 1, 0, "link_status"},
{ 0, 1, 0, "link_speed"},
{ 0, 1, 0, "link_mode"},
{ 0, 255, 8, "ipg1"},
{ 0, 255, 4, "ipg2"},
{ 0, 1, 0, "use_int_xcvr"},
{ 0, 255, 0, "pace_size"},
{ 0, 1, 1, "adv_autoneg_cap"},
{ 0, 1, 1, "adv_100T4_cap"},
{ 0, 1, 1, "adv_100fdx_cap"},
{ 0, 1, 1, "adv_100hdx_cap"},
{ 0, 1, 1, "adv_10fdx_cap"},
{ 0, 1, 1, "adv_10hdx_cap"},
{ 0, 1, 1, "autoneg_cap"},
{ 0, 1, 1, "100T4_cap"},
{ 0, 1, 1, "100fdx_cap"},
{ 0, 1, 1, "100hdx_cap"},
{ 0, 1, 1, "10fdx_cap"},
{ 0, 1, 1, "10hdx_cap"},
{ 0, 1, 0, "lp_autoneg_cap"},
{ 0, 1, 0, "lp_100T4_cap"},
{ 0, 1, 0, "lp_100fdx_cap"},
{ 0, 1, 0, "lp_100hdx_cap"},
{ 0, 1, 0, "lp_10fdx_cap"},
{ 0, 1, 0, "lp_10hdx_cap"},
{ 0, 1, 1, "lance_mode"},
{ 0, 31, 16, "ipg0"},
};
#define HME_PARAM_CNT 29
/* command */
#define HME_ND_GET ND_GET
#define HME_ND_SET ND_SET
/* default IPG settings */
#define IPG1 8
#define IPG2 4
/*
* Declarations and definitions specific to the
* FEPS 10/100 Mbps Ethernet (hme) device.
*/
/*
* 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_hmep field. All instances
* are threaded together into one list of active instances
* ordered on minor device number.
*/
#define MSECOND(t) t
#define SECOND(t) t*1000
#define HME_2P1_REVID 0x20
#define HME_2P1_REVID_OBP 0x21
#define HME_LINKDOWN_OK 0
#define HME_FORCE_LINKDOWN 1
#define HME_LINKDOWN_STARTED 2
#define HME_LINKDOWN_DONE 3
#define P1_0 0x100
#define HME_EXTERNAL_TRANSCEIVER 0
#define HME_INTERNAL_TRANSCEIVER 1
#define HME_NO_TRANSCEIVER 2
#define HME_HWAN_TRY 0 /* Try Hardware autonegotiation */
#define RESET_TO_BE_ISSUED 0 /* Reset command to be issued to the PHY */
/* Power rampup. Issue powerdown in */
/* the driver to insure good reset. */
struct hmesave {
};
typedef struct {
} hmebuf_t;
/*
* HME Device Channel instance state information.
*
* Each instance is dynamically allocated on first attach.
*/
struct hme {
int instance; /* instance */
/*
* xcvr information
*/
int hme_mifpoll_enable;
int hme_frame_enable;
int hme_rxcv_enable;
int hme_phy_retries; /* phy reset failures */
int hme_phy_failure; /* phy failure type */
int hme_64bit_xfer; /* 64-bit Sbus xfers */
int hme_phyad;
int hme_autoneg;
/* named dispatch table */
int hme_transceiver; /* current PHY in use */
int hme_linkup; /* link status */
int hme_xcvr_state; /* transceiver status */
int hme_forcespeed; /* speed in forced mode */
int hme_tryspeed; /* speed in auto mode */
int hme_fdx; /* full-duplex mode */
int hme_pace_count; /* pacing pkt count */
int hme_macfdx;
int hme_linkcheck;
int hme_force_linkdown;
int hme_nlasttries;
int hme_ntries;
int hme_delay;
int hme_linkup_10;
int hme_linkup_cnt;
int hme_cheerio_mode;
int hme_polling_on;
int hme_mifpoll_data;
int hme_mifpoll_flag;
/*
* This is part of the hardening of the hme driver
* (following x fields)
*/
unsigned char *hme_romp; /* fcode rom pointer */
/*
* DDI dma handle, kernel virtual base,
* and io virtual base of IOPB area.
*/
/* recieved at the start of 'hme_check_link' */
/* watch dog interval. */
/*
* check if transmitter is hung
*/
/*
* Debuging kstats
*/
};
/* flags */
/* Mac address flags */
struct hmekstat {
};
/*
* This structure is organized to meet the following requirements:
* - bb_buf starts on an HMEBURSTSIZE boundary.
* - hmebuf is an even multiple of HMEBURSTSIZE
* - bb_buf[] is large enough to contain max VLAN frame (1522) plus
* (3 x HMEBURSTSIZE) rounded up to the next HMEBURSTSIZE
* XXX What about another 128 bytes (HMEC requirement).
* Fast aligned copy requires both the source and destination
* addresses have the same offset from some N-byte boundary.
*/
#define HMEBURSTSIZE (64)
#define HMEBUFSIZE (1728)
/*
* Define offset from start of bb_buf[] to point receive descriptor.
* Requirements:
* - must be 14 bytes back of a 4-byte boundary so the start of
* the network packet is 4-byte aligned.
* - leave some headroom for others
*/
#define HMEHEADROOM (34)
/* Offset for the first byte in the receive buffer */
#define HME_FSTBYTE_OFFSET 2
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_HME_H */