/*
*
* Copyright (C) 2007 Mark Kettenis.
* Copyright (C) 2001 Eduardo Horvath.
* 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
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*
*/
/*
* Misc. definitions for Sun Cassini ethernet controllers.
*/
/*
* Preferred page size. Cassini has a configurable page size, but
* needs at least 8k to handle jumbo frames. This happens to be the
* default anyway.
*/
#define CAS_PAGE_SIZE 8192
/*
* Transmit descriptor ring size. This is arbitrary, but allocate
* enough descriptors for 64 pending transmissions and 16 segments
* per packet.
*/
#define CAS_NTXSEGS 16
/*
* Receive descriptor ring size. We have one Rx buffer per incoming
* packet, so this logic is a little simpler.
*/
#define CAS_NRXDESC 128
#define CAS_NRXDESC_MASK (CAS_NRXDESC - 1)
/*
* Control structures are DMA'd to the Cassini chip. We allocate them in
* a single clump that maps to a single DMA segment to make several things
* easier.
*/
struct cas_control_data {
/*
* The transmit descriptors.
*/
struct cas_desc ccd_txdescs[CAS_NTXDESC];
/*
* The receive completions.
*/
struct cas_comp ccd_rxcomps[CAS_NRXCOMP];
bus_dma_tag_t sc_dmatag; /* bus dma tag */
bus_dmamap_t sc_dmamap; /* bus dma handle */
int sc_burst; /* DVMA burst size in effect */
int sc_phys[2]; /* MII instance -> PHY map */
u_int sc_flags;
#define CAS_SERDES (1 << 4) /* use the SERDES */
int sc_mif_config; /* Selected MII reg setting */
/*
* Ring buffer DMA stuff.
*/
bus_dma_segment_t sc_cdseg; /* control data memory */
int sc_cdnseg; /* number of segments */
bus_dmamap_t sc_cddmamap; /* control data DMA map */
#define sc_cddma sc_cddmamap->dm_segs[0].ds_addr
/*
* Software state for transmit and receive descriptors.
*/
struct cas_sxd sc_txd[CAS_NTXDESC];
uint32_t sc_tx_cnt, sc_tx_prod, sc_tx_cons;