/*
* 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 (c) 2012 Gary Mills
*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ATGE_H
#define _ATGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/ethernet.h>
#include <sys/mac_provider.h>
#include "atge_l1e_reg.h"
#include "atge_l1c_reg.h"
/*
* Flags.
*/
/*
* Timer for one second interval.
*/
/*
* Chip state.
*/
/*
* Descriptor increment and decrment operation.
*/
#define ATGE_INC_SLOT(x, y) \
((x) = ((x) + 1) % (y))
#define ATGE_DEC_SLOT(x, y) \
(x = ((x + y - 1) % y))
/*
* I/O instructions
*/
/*
* Descriptor and other endianess aware access.
*/
/*
* General purpose macros.
*/
/*
* Different type of chip models.
*/
typedef enum {
} atge_model_t;
typedef struct atge_cards {
} atge_cards_t;
/*
* Number of Descriptors for TX and RX Ring.
*/
/*
* DMA Handle for all DMA work.
*/
typedef struct atge_dma_data {
} atge_dma_t;
struct atge;
/*
*/
typedef struct atge_ring {
int r_ndesc;
int r_consumer;
int r_producer;
int r_avail_desc;
} atge_ring_t;
/*
* L1E specific private data.
*/
typedef struct atge_l1e_data {
int atge_l1e_pagesize;
int atge_l1e_rx_curp;
/*
* L1 specific private data.
*/
typedef struct atge_l1_data {
int atge_l1_rr_consumers;
/*
* L1C specific private data.
*/
typedef struct atge_l1c_data {
/*
* TX descriptor table is same with L1, L1E and L2E chips.
*/
#pragma pack(1)
typedef struct atge_tx_desc {
#pragma pack()
#define ATGE_TX_RING_SZ \
(sizeof (struct atge_tx_desc) * ATGE_TX_RING_CNT)
/*
* Private instance data structure (per-instance soft-state).
*/
typedef struct atge {
/*
* Lock for the TX ring, RX ring and interrupt. In order to align
* these locks at 8-byte boundary, we have kept it at the beginning
* of atge_t.
*/
/*
* Instance number and devinfo pointer.
*/
int atge_unit;
int atge_chip_rev;
/*
* Mac handle.
*/
/*
* MII layer handle.
*/
/*
* Config Space Handle.
*/
/*
* IO registers mapped by DDI.
*/
/*
* Interrupt management structures.
*/
int atge_intr_types;
int atge_intr_cnt;
int atge_intr_size;
int atge_intr_cap;
/*
* Common structures.
*/
int atge_tx_resched;
int atge_mtu;
int atge_int_mod;
int atge_max_frame_size;
/*
* Ethernet addresses.
*/
/*
* PHY register.
*/
int atge_phyaddr;
/*
* Flags.
*/
int atge_flags;
int atge_filter_flags;
int atge_chip_state;
/*
* Private data for the chip.
*/
void *atge_private_data;
/*
* Buffer length.
*/
int atge_rx_buf_len;
int atge_tx_buf_len;
/*
* Common stats.
*/
void *atge_hw_stats;
unsigned atge_norcvbuf;
unsigned atge_errrcv;
unsigned atge_errxmt;
unsigned atge_missed;
unsigned atge_underflow;
unsigned atge_overflow;
unsigned atge_align_errors;
unsigned atge_fcs_errors;
unsigned atge_carrier_errors;
unsigned atge_collisions;
unsigned atge_ex_collisions;
unsigned atge_tx_late_collisions;
unsigned atge_defer_xmts;
unsigned atge_first_collisions;
unsigned atge_multi_collisions;
unsigned atge_sqe_errors;
unsigned atge_macxmt_errors;
unsigned atge_macrcv_errors;
unsigned atge_toolong_errors;
unsigned atge_runt;
unsigned atge_jabber;
unsigned atge_noxmtbuf;
} atge_t;
/*
* extern functions.
*/
extern void atge_error(dev_info_t *, char *, ...);
/*
* Debugging Support.
*/
#ifdef DEBUG
#else
#endif
extern int atge_debug;
extern void atge_debug_func(char *, ...);
int, int);
extern void atge_free_a_dma_blk(atge_dma_t *);
extern void atge_buf_free(atge_dma_t *);
extern mblk_t *atge_get_mblk(int);
extern void atge_device_restart(atge_t *);
extern void atge_stop_timer(atge_t *);
extern void atge_start_timer(atge_t *);
extern void atge_device_stop(atge_t *);
extern void atge_tx_reclaim(atge_t *, int);
#ifdef __cplusplus
}
#endif
#endif /* _ATGE_H */