1*96f141a8Smiod /* $OpenBSD: lance.h,v 1.1 2013/10/28 22:13:12 miod Exp $ */ 2*96f141a8Smiod /* $NetBSD: lance.h,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */ 3*96f141a8Smiod 4*96f141a8Smiod /*- 5*96f141a8Smiod * Copyright (c) 1982, 1992, 1993 6*96f141a8Smiod * The Regents of the University of California. All rights reserved. 7*96f141a8Smiod * 8*96f141a8Smiod * Redistribution and use in source and binary forms, with or without 9*96f141a8Smiod * modification, are permitted provided that the following conditions 10*96f141a8Smiod * are met: 11*96f141a8Smiod * 1. Redistributions of source code must retain the above copyright 12*96f141a8Smiod * notice, this list of conditions and the following disclaimer. 13*96f141a8Smiod * 2. Redistributions in binary form must reproduce the above copyright 14*96f141a8Smiod * notice, this list of conditions and the following disclaimer in the 15*96f141a8Smiod * documentation and/or other materials provided with the distribution. 16*96f141a8Smiod * 3. Neither the name of the University nor the names of its contributors 17*96f141a8Smiod * may be used to endorse or promote products derived from this software 18*96f141a8Smiod * without specific prior written permission. 19*96f141a8Smiod * 20*96f141a8Smiod * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21*96f141a8Smiod * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*96f141a8Smiod * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*96f141a8Smiod * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24*96f141a8Smiod * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25*96f141a8Smiod * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26*96f141a8Smiod * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27*96f141a8Smiod * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28*96f141a8Smiod * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29*96f141a8Smiod * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30*96f141a8Smiod * SUCH DAMAGE. 31*96f141a8Smiod * 32*96f141a8Smiod * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 33*96f141a8Smiod */ 34*96f141a8Smiod 35*96f141a8Smiod #define LEMTU 1518 36*96f141a8Smiod #define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ 37*96f141a8Smiod #define LERBUF 8 38*96f141a8Smiod #define LERBUFLOG2 3 39*96f141a8Smiod #define LE_RLEN (LERBUFLOG2 << 13) 40*96f141a8Smiod #define LE_NEXTRMD(x) (((x) + 1) & (LERBUF - 1)) 41*96f141a8Smiod #define LETBUF 1 42*96f141a8Smiod #define LETBUFLOG2 0 43*96f141a8Smiod #define LE_TLEN (LETBUFLOG2 << 13) 44*96f141a8Smiod #define LE_NEXTTMD(x) (((x) + 1) & (LETBUF - 1)) 45*96f141a8Smiod 46*96f141a8Smiod /* Local Area Network Controller for Ethernet (LANCE) registers */ 47*96f141a8Smiod struct lereg { 48*96f141a8Smiod volatile uint16_t ler_rdp; /* register data port */ 49*96f141a8Smiod uint16_t unused; 50*96f141a8Smiod volatile uint16_t ler_rap; /* register address port */ 51*96f141a8Smiod }; 52*96f141a8Smiod 53*96f141a8Smiod /* 54*96f141a8Smiod * lance memory 55*96f141a8Smiod */ 56*96f141a8Smiod 57*96f141a8Smiod /* receive message descriptors. bits/hadr are byte order dependent. */ 58*96f141a8Smiod struct lermd_v { 59*96f141a8Smiod volatile uint16_t rmd0; /* low address of packet */ 60*96f141a8Smiod #if BYTE_ORDER == BIG_ENDIAN 61*96f141a8Smiod volatile uint8_t rmd1_bits; /* descriptor bits */ 62*96f141a8Smiod volatile uint8_t rmd1_hadr; /* high address of packet */ 63*96f141a8Smiod #else 64*96f141a8Smiod volatile uint8_t rmd1_hadr; /* high address of packet */ 65*96f141a8Smiod volatile uint8_t rmd1_bits; /* descriptor bits */ 66*96f141a8Smiod #endif 67*96f141a8Smiod volatile int16_t rmd2; /* buffer byte count */ 68*96f141a8Smiod volatile uint16_t rmd3; /* message byte count */ 69*96f141a8Smiod }; 70*96f141a8Smiod 71*96f141a8Smiod /* transmit message descriptors */ 72*96f141a8Smiod struct letmd_v { 73*96f141a8Smiod volatile uint16_t tmd0; /* low address of packet */ 74*96f141a8Smiod #if BYTE_ORDER == BIG_ENDIAN 75*96f141a8Smiod volatile uint8_t tmd1_bits; /* descriptor bits */ 76*96f141a8Smiod volatile uint8_t tmd1_hadr; /* high address of packet */ 77*96f141a8Smiod #else 78*96f141a8Smiod volatile uint8_t tmd1_hadr; /* high address of packet */ 79*96f141a8Smiod volatile uint8_t tmd1_bits; /* descriptor bits */ 80*96f141a8Smiod #endif 81*96f141a8Smiod volatile int16_t tmd2; /* buffer byte count */ 82*96f141a8Smiod volatile uint16_t tmd3; /* transmit error bits */ 83*96f141a8Smiod }; 84*96f141a8Smiod 85*96f141a8Smiod struct lemem { 86*96f141a8Smiod /* initialization block */ 87*96f141a8Smiod volatile uint16_t lem_mode; /* mode */ 88*96f141a8Smiod volatile uint16_t lem_padr[3]; /* physical address */ 89*96f141a8Smiod volatile uint16_t lem_ladrf[4]; /* logical address filter */ 90*96f141a8Smiod volatile uint16_t lem_rdra; /* receive descriptor addr */ 91*96f141a8Smiod volatile uint16_t lem_rlen; /* rda high and ring size */ 92*96f141a8Smiod volatile uint16_t lem_tdra; /* transmit descriptor addr */ 93*96f141a8Smiod volatile uint16_t lem_tlen; /* tda high and ring size */ 94*96f141a8Smiod uint16_t lem_pad0[4]; 95*96f141a8Smiod struct lermd_v lem_rmd[LERBUF]; 96*96f141a8Smiod struct letmd_v lem_tmd[LETBUF]; 97*96f141a8Smiod volatile uint8_t lem_rbuf[LERBUF][LEMTU]; 98*96f141a8Smiod volatile uint8_t lem_tbuf[LETBUF][LEMTU]; 99*96f141a8Smiod }; 100*96f141a8Smiod 101*96f141a8Smiod struct le_softc { 102*96f141a8Smiod struct lereg *sc_reg; 103*96f141a8Smiod struct lemem *sc_mem; 104*96f141a8Smiod uint8_t sc_enaddr[6]; 105*96f141a8Smiod int sc_curtmd; 106*96f141a8Smiod int sc_currmd; 107*96f141a8Smiod }; 108