/* $NetBSD: dp83932var.h,v 1.13 2021/02/20 09:36:31 rin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/*
* Data structure definitions for the National Semiconductor DP83932
* Systems-Oriented Network Interface Controller (SONIC).
*/
/*
* NOTE: The control data for the SONIC must not cross a 64k boundary,
* so we have to be careful about how we size things.
*
* Also, since the SONIC is only a 10Mb/s chip, and systems on which
* it is present tend to be low on memory, we try to keep the data
* structure sizes small.
*/
/*
* Number of CAM entries.
*/
#define SONIC_NCAMENT 16
/*
* Control structures are DMA'd to the SONIC chip. We allocate them in
* a single clump that maps to a single DMA segment to make several things
* easier.
*/
struct sonic_control_data16 {
/*
* The transmit descriptors.
*/
struct sonic_tda16 scd_txdescs[SONIC_NTXDESC];
/*
* The receive descriptors.
*/
struct sonic_rda16 scd_rxdescs[SONIC_NRXDESC];
/*
* The receive resource descriptors.
*/
struct sonic_rra16 scd_rxbufs[SONIC_NRXDESC];
/*
* Software state for transmit and receive descriptors.
*/
struct sonic_descsoft {
struct mbuf *ds_mbuf; /* head of mbuf chain */
bus_dmamap_t ds_dmamap; /* our DMA map */
};
/*
* Software state per device.
*/
struct sonic_softc {
device_t sc_dev; /* generic device information */
bus_space_tag_t sc_st; /* bus space tag */
bus_space_handle_t sc_sh; /* bus space handle */
bus_dma_tag_t sc_dmat; /* bus DMA tag */
struct ethercom sc_ethercom; /* ethernet common data */
int sc_32bit; /* use 32-bit mode */
int sc_bigendian; /* BMODE -> Vcc */
bus_dmamap_t sc_cddmamap; /* control data DMA map */
#define sc_cddma sc_cddmamap->dm_segs[0].ds_addr
bus_dmamap_t sc_nulldmamap; /* DMA map for the pad buffer */
#define sc_nulldma sc_nulldmamap->dm_segs[0].ds_addr
/*
* Software state for transmit and receive descriptors.
*/
struct sonic_descsoft sc_txsoft[SONIC_NTXDESC];
struct sonic_descsoft sc_rxsoft[SONIC_NRXDESC];
/*
* Control data structures.
*/
union {
struct sonic_control_data16 *cdun_16;
struct sonic_control_data32 *cdun_32;
} sc_cdun;
#define sc_cdata16 sc_cdun.cdun_16
#define sc_cdata32 sc_cdun.cdun_32