Home | History | Annotate | Line # | Download | only in dev
if_le.c revision 1.4
      1  1.1      cgd /*
      2  1.1      cgd  * Copyright (c) 1982, 1990 The Regents of the University of California.
      3  1.1      cgd  * All rights reserved.
      4  1.1      cgd  *
      5  1.1      cgd  * Redistribution and use in source and binary forms, with or without
      6  1.1      cgd  * modification, are permitted provided that the following conditions
      7  1.1      cgd  * are met:
      8  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
      9  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     10  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     11  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     12  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     13  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     14  1.1      cgd  *    must display the following acknowledgement:
     15  1.1      cgd  *	This product includes software developed by the University of
     16  1.1      cgd  *	California, Berkeley and its contributors.
     17  1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     18  1.1      cgd  *    may be used to endorse or promote products derived from this software
     19  1.1      cgd  *    without specific prior written permission.
     20  1.1      cgd  *
     21  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1      cgd  * SUCH DAMAGE.
     32  1.1      cgd  *
     33  1.2      cgd  *	from: @(#)if_le.c	7.6 (Berkeley) 5/8/91
     34  1.4  mycroft  *	$Id: if_le.c,v 1.4 1994/01/30 18:42:47 mycroft Exp $
     35  1.1      cgd  */
     36  1.1      cgd 
     37  1.1      cgd #include "le.h"
     38  1.1      cgd #if NLE > 0
     39  1.1      cgd 
     40  1.1      cgd #include "bpfilter.h"
     41  1.1      cgd 
     42  1.1      cgd /*
     43  1.1      cgd  * AMD 7990 LANCE
     44  1.1      cgd  *
     45  1.1      cgd  * This driver will generate and accept tailer encapsulated packets even
     46  1.1      cgd  * though it buys us nothing.  The motivation was to avoid incompatibilities
     47  1.1      cgd  * with VAXen, SUNs, and others that handle and benefit from them.
     48  1.1      cgd  * This reasoning is dubious.
     49  1.1      cgd  */
     50  1.1      cgd #include "sys/param.h"
     51  1.1      cgd #include "sys/systm.h"
     52  1.1      cgd #include "sys/mbuf.h"
     53  1.1      cgd #include "sys/buf.h"
     54  1.1      cgd #include "sys/protosw.h"
     55  1.1      cgd #include "sys/socket.h"
     56  1.1      cgd #include "sys/syslog.h"
     57  1.1      cgd #include "sys/ioctl.h"
     58  1.1      cgd #include "sys/errno.h"
     59  1.1      cgd 
     60  1.1      cgd #include "net/if.h"
     61  1.1      cgd #include "net/netisr.h"
     62  1.1      cgd #include "net/route.h"
     63  1.1      cgd 
     64  1.1      cgd #ifdef INET
     65  1.1      cgd #include "netinet/in.h"
     66  1.1      cgd #include "netinet/in_systm.h"
     67  1.1      cgd #include "netinet/in_var.h"
     68  1.1      cgd #include "netinet/ip.h"
     69  1.1      cgd #include "netinet/if_ether.h"
     70  1.1      cgd #endif
     71  1.1      cgd 
     72  1.1      cgd #ifdef NS
     73  1.1      cgd #include "netns/ns.h"
     74  1.1      cgd #include "netns/ns_if.h"
     75  1.1      cgd #endif
     76  1.1      cgd 
     77  1.1      cgd #include "../include/cpu.h"
     78  1.1      cgd #include "../hp300/isr.h"
     79  1.1      cgd #include "../include/mtpr.h"
     80  1.1      cgd #include "device.h"
     81  1.1      cgd #include "if_lereg.h"
     82  1.1      cgd 
     83  1.1      cgd #if NBPFILTER > 0
     84  1.1      cgd #include "../net/bpf.h"
     85  1.1      cgd #include "../net/bpfdesc.h"
     86  1.1      cgd #endif
     87  1.1      cgd 
     88  1.1      cgd /* offsets for:	   ID,   REGS,    MEM,  NVRAM */
     89  1.1      cgd int	lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
     90  1.1      cgd 
     91  1.1      cgd int	leattach();
     92  1.1      cgd struct	driver ledriver = {
     93  1.1      cgd 	leattach, "le",
     94  1.1      cgd };
     95  1.1      cgd 
     96  1.1      cgd struct	isr le_isr[NLE];
     97  1.1      cgd int	ledebug = 0;		/* console error messages */
     98  1.1      cgd 
     99  1.1      cgd int	leintr(), leinit(), leioctl(), lestart(), ether_output();
    100  1.1      cgd struct	mbuf *leget();
    101  1.1      cgd extern	struct ifnet loif;
    102  1.1      cgd 
    103  1.1      cgd /*
    104  1.1      cgd  * Ethernet software status per interface.
    105  1.1      cgd  *
    106  1.1      cgd  * Each interface is referenced by a network interface structure,
    107  1.1      cgd  * le_if, which the routing code uses to locate the interface.
    108  1.1      cgd  * This structure contains the output queue for the interface, its address, ...
    109  1.1      cgd  */
    110  1.1      cgd struct	le_softc {
    111  1.1      cgd 	struct	arpcom sc_ac;	/* common Ethernet structures */
    112  1.1      cgd #define	sc_if	sc_ac.ac_if	/* network-visible interface */
    113  1.1      cgd #define	sc_addr	sc_ac.ac_enaddr	/* hardware Ethernet address */
    114  1.1      cgd 	struct	lereg0 *sc_r0;	/* DIO registers */
    115  1.1      cgd 	struct	lereg1 *sc_r1;	/* LANCE registers */
    116  1.1      cgd 	struct	lereg2 *sc_r2;	/* dual-port RAM */
    117  1.1      cgd 	int	sc_rmd;		/* predicted next rmd to process */
    118  1.1      cgd 	int	sc_runt;
    119  1.1      cgd 	int	sc_jab;
    120  1.1      cgd 	int	sc_merr;
    121  1.1      cgd 	int	sc_babl;
    122  1.1      cgd 	int	sc_cerr;
    123  1.1      cgd 	int	sc_miss;
    124  1.1      cgd 	int	sc_xint;
    125  1.1      cgd 	int	sc_xown;
    126  1.1      cgd 	int	sc_uflo;
    127  1.1      cgd 	int	sc_rxlen;
    128  1.1      cgd 	int	sc_rxoff;
    129  1.1      cgd 	int	sc_txoff;
    130  1.1      cgd 	int	sc_busy;
    131  1.1      cgd 	short	sc_iflags;
    132  1.1      cgd #if NBPFILTER > 0
    133  1.1      cgd 	caddr_t sc_bpf;
    134  1.1      cgd #endif
    135  1.1      cgd } le_softc[NLE];
    136  1.1      cgd 
    137  1.1      cgd /* access LANCE registers */
    138  1.1      cgd #define	LERDWR(cntl, src, dst) \
    139  1.1      cgd 	do { \
    140  1.1      cgd 		(dst) = (src); \
    141  1.1      cgd 	} while (((cntl)->ler0_status & LE_ACK) == 0);
    142  1.1      cgd 
    143  1.1      cgd /*
    144  1.1      cgd  * Interface exists: make available by filling in network interface
    145  1.1      cgd  * record.  System will initialize the interface when it is ready
    146  1.1      cgd  * to accept packets.
    147  1.1      cgd  */
    148  1.1      cgd leattach(hd)
    149  1.1      cgd 	struct hp_device *hd;
    150  1.1      cgd {
    151  1.1      cgd 	register struct lereg0 *ler0;
    152  1.1      cgd 	register struct lereg2 *ler2;
    153  1.1      cgd 	struct lereg2 *lemem = 0;
    154  1.1      cgd 	struct le_softc *le = &le_softc[hd->hp_unit];
    155  1.1      cgd 	struct ifnet *ifp = &le->sc_if;
    156  1.1      cgd 	char *cp;
    157  1.1      cgd 	int i;
    158  1.1      cgd 
    159  1.1      cgd 	ler0 = le->sc_r0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr);
    160  1.1      cgd 	le->sc_r1 = (struct lereg1 *)(lestd[1] + (int)hd->hp_addr);
    161  1.1      cgd 	ler2 = le->sc_r2 = (struct lereg2 *)(lestd[2] + (int)hd->hp_addr);
    162  1.1      cgd 	if (ler0->ler0_id != LEID)
    163  1.1      cgd 		return(0);
    164  1.1      cgd 	le_isr[hd->hp_unit].isr_intr = leintr;
    165  1.1      cgd 	hd->hp_ipl = le_isr[hd->hp_unit].isr_ipl = LE_IPL(ler0->ler0_status);
    166  1.1      cgd 	le_isr[hd->hp_unit].isr_arg = hd->hp_unit;
    167  1.1      cgd 	ler0->ler0_id = 0xFF;
    168  1.1      cgd 	DELAY(100);
    169  1.1      cgd 
    170  1.1      cgd 	/*
    171  1.1      cgd 	 * Read the ethernet address off the board, one nibble at a time.
    172  1.1      cgd 	 */
    173  1.1      cgd 	cp = (char *)(lestd[3] + (int)hd->hp_addr);
    174  1.1      cgd 	for (i = 0; i < sizeof(le->sc_addr); i++) {
    175  1.1      cgd 		le->sc_addr[i] = (*++cp & 0xF) << 4;
    176  1.1      cgd 		cp++;
    177  1.1      cgd 		le->sc_addr[i] |= *++cp & 0xF;
    178  1.1      cgd 		cp++;
    179  1.1      cgd 	}
    180  1.1      cgd 	printf("le%d: hardware address %s\n", hd->hp_unit,
    181  1.1      cgd 		ether_sprintf(le->sc_addr));
    182  1.1      cgd 
    183  1.1      cgd 	/*
    184  1.1      cgd 	 * Setup for transmit/receive
    185  1.1      cgd 	 */
    186  1.1      cgd 	ler2->ler2_mode = LE_MODE;
    187  1.1      cgd 	ler2->ler2_padr[0] = le->sc_addr[1];
    188  1.1      cgd 	ler2->ler2_padr[1] = le->sc_addr[0];
    189  1.1      cgd 	ler2->ler2_padr[2] = le->sc_addr[3];
    190  1.1      cgd 	ler2->ler2_padr[3] = le->sc_addr[2];
    191  1.1      cgd 	ler2->ler2_padr[4] = le->sc_addr[5];
    192  1.1      cgd 	ler2->ler2_padr[5] = le->sc_addr[4];
    193  1.1      cgd 	ler2->ler2_ladrf0 = 0;
    194  1.1      cgd 	ler2->ler2_ladrf1 = 0;
    195  1.1      cgd 	ler2->ler2_rlen = LE_RLEN;
    196  1.1      cgd 	ler2->ler2_rdra = (int)lemem->ler2_rmd;
    197  1.1      cgd 	ler2->ler2_tlen = LE_TLEN;
    198  1.1      cgd 	ler2->ler2_tdra = (int)lemem->ler2_tmd;
    199  1.1      cgd 	isrlink(&le_isr[hd->hp_unit]);
    200  1.1      cgd 	ler0->ler0_status = LE_IE;
    201  1.1      cgd 
    202  1.1      cgd 	ifp->if_unit = hd->hp_unit;
    203  1.1      cgd 	ifp->if_name = "le";
    204  1.1      cgd 	ifp->if_mtu = ETHERMTU;
    205  1.1      cgd 	ifp->if_init = leinit;
    206  1.1      cgd 	ifp->if_ioctl = leioctl;
    207  1.1      cgd 	ifp->if_output = ether_output;
    208  1.1      cgd 	ifp->if_start = lestart;
    209  1.1      cgd 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
    210  1.1      cgd #if NBPFILTER > 0
    211  1.1      cgd 	bpfattach(&le->sc_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
    212  1.1      cgd #endif
    213  1.1      cgd 	if_attach(ifp);
    214  1.1      cgd 	return (1);
    215  1.1      cgd }
    216  1.1      cgd 
    217  1.1      cgd ledrinit(ler2)
    218  1.1      cgd 	register struct lereg2 *ler2;
    219  1.1      cgd {
    220  1.1      cgd 	register struct lereg2 *lemem = 0;
    221  1.1      cgd 	register int i;
    222  1.1      cgd 
    223  1.1      cgd 	for (i = 0; i < LERBUF; i++) {
    224  1.1      cgd 		ler2->ler2_rmd[i].rmd0 = (int)lemem->ler2_rbuf[i];
    225  1.1      cgd 		ler2->ler2_rmd[i].rmd1 = LE_OWN;
    226  1.1      cgd 		ler2->ler2_rmd[i].rmd2 = -LEMTU;
    227  1.1      cgd 		ler2->ler2_rmd[i].rmd3 = 0;
    228  1.1      cgd 	}
    229  1.1      cgd 	for (i = 0; i < LETBUF; i++) {
    230  1.1      cgd 		ler2->ler2_tmd[i].tmd0 = (int)lemem->ler2_tbuf[i];
    231  1.1      cgd 		ler2->ler2_tmd[i].tmd1 = 0;
    232  1.1      cgd 		ler2->ler2_tmd[i].tmd2 = 0;
    233  1.1      cgd 		ler2->ler2_tmd[i].tmd3 = 0;
    234  1.1      cgd 	}
    235  1.1      cgd }
    236  1.1      cgd 
    237  1.1      cgd lereset(unit)
    238  1.1      cgd 	register int unit;
    239  1.1      cgd {
    240  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    241  1.1      cgd 	register struct lereg0 *ler0 = le->sc_r0;
    242  1.1      cgd 	register struct lereg1 *ler1 = le->sc_r1;
    243  1.1      cgd 	register struct lereg2 *lemem = 0;
    244  1.1      cgd 	register int timo = 100000;
    245  1.1      cgd 	register int stat;
    246  1.1      cgd 
    247  1.1      cgd #ifdef lint
    248  1.1      cgd 	stat = unit;
    249  1.1      cgd #endif
    250  1.1      cgd #if NBPFILTER > 0
    251  1.1      cgd 	if (le->sc_if.if_flags & IFF_PROMISC)
    252  1.1      cgd 		/* set the promiscuous bit */
    253  1.1      cgd 		le->sc_r2->ler2_mode = LE_MODE|0x8000;
    254  1.1      cgd 	else
    255  1.1      cgd 		le->sc_r2->ler2_mode = LE_MODE;
    256  1.1      cgd #endif
    257  1.1      cgd 	LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
    258  1.1      cgd 	LERDWR(ler0, LE_STOP, ler1->ler1_rdp);
    259  1.1      cgd 	ledrinit(le->sc_r2);
    260  1.1      cgd 	le->sc_rmd = 0;
    261  1.1      cgd 	LERDWR(ler0, LE_CSR1, ler1->ler1_rap);
    262  1.1      cgd 	LERDWR(ler0, (int)&lemem->ler2_mode, ler1->ler1_rdp);
    263  1.1      cgd 	LERDWR(ler0, LE_CSR2, ler1->ler1_rap);
    264  1.1      cgd 	LERDWR(ler0, 0, ler1->ler1_rdp);
    265  1.1      cgd 	LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
    266  1.1      cgd 	LERDWR(ler0, LE_INIT, ler1->ler1_rdp);
    267  1.1      cgd 	do {
    268  1.1      cgd 		if (--timo == 0) {
    269  1.1      cgd 			printf("le%d: init timeout, stat = 0x%x\n",
    270  1.1      cgd 			       unit, stat);
    271  1.1      cgd 			break;
    272  1.1      cgd 		}
    273  1.1      cgd 		LERDWR(ler0, ler1->ler1_rdp, stat);
    274  1.1      cgd 	} while ((stat & LE_IDON) == 0);
    275  1.1      cgd 	LERDWR(ler0, LE_STOP, ler1->ler1_rdp);
    276  1.1      cgd 	LERDWR(ler0, LE_CSR3, ler1->ler1_rap);
    277  1.1      cgd 	LERDWR(ler0, LE_BSWP, ler1->ler1_rdp);
    278  1.1      cgd 	LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
    279  1.1      cgd 	LERDWR(ler0, LE_STRT | LE_INEA, ler1->ler1_rdp);
    280  1.1      cgd 	le->sc_if.if_flags &= ~IFF_OACTIVE;
    281  1.1      cgd }
    282  1.1      cgd 
    283  1.1      cgd /*
    284  1.1      cgd  * Initialization of interface
    285  1.1      cgd  */
    286  1.1      cgd leinit(unit)
    287  1.1      cgd 	int unit;
    288  1.1      cgd {
    289  1.1      cgd 	struct le_softc *le = &le_softc[unit];
    290  1.1      cgd 	register struct ifnet *ifp = &le->sc_if;
    291  1.1      cgd 	int s;
    292  1.1      cgd 
    293  1.1      cgd 	/* not yet, if address still unknown */
    294  1.1      cgd 	if (ifp->if_addrlist == (struct ifaddr *)0)
    295  1.1      cgd 		return;
    296  1.1      cgd 	if ((ifp->if_flags & IFF_RUNNING) == 0) {
    297  1.1      cgd 		s = splimp();
    298  1.1      cgd 		ifp->if_flags |= IFF_RUNNING;
    299  1.1      cgd 		lereset(unit);
    300  1.1      cgd 	        (void) lestart(ifp);
    301  1.1      cgd 		splx(s);
    302  1.1      cgd 	}
    303  1.1      cgd }
    304  1.1      cgd 
    305  1.1      cgd /*
    306  1.1      cgd  * Start output on interface.  Get another datagram to send
    307  1.1      cgd  * off of the interface queue, and copy it to the interface
    308  1.1      cgd  * before starting the output.
    309  1.1      cgd  */
    310  1.1      cgd lestart(ifp)
    311  1.1      cgd 	struct ifnet *ifp;
    312  1.1      cgd {
    313  1.1      cgd 	register struct le_softc *le = &le_softc[ifp->if_unit];
    314  1.1      cgd 	register struct letmd *tmd;
    315  1.1      cgd 	register struct mbuf *m;
    316  1.1      cgd 	int len;
    317  1.1      cgd 
    318  1.1      cgd 	if ((le->sc_if.if_flags & IFF_RUNNING) == 0)
    319  1.1      cgd 		return (0);
    320  1.1      cgd 	IF_DEQUEUE(&le->sc_if.if_snd, m);
    321  1.1      cgd 	if (m == 0)
    322  1.1      cgd 		return (0);
    323  1.1      cgd 	len = leput(le->sc_r2->ler2_tbuf[0], m);
    324  1.1      cgd #if NBPFILTER > 0
    325  1.1      cgd 	/*
    326  1.1      cgd 	 * If bpf is listening on this interface, let it
    327  1.1      cgd 	 * see the packet before we commit it to the wire.
    328  1.1      cgd 	 */
    329  1.1      cgd 	if (le->sc_bpf)
    330  1.1      cgd                 bpf_tap(le->sc_bpf, le->sc_r2->ler2_tbuf[0], len);
    331  1.1      cgd #endif
    332  1.1      cgd 	tmd = le->sc_r2->ler2_tmd;
    333  1.1      cgd 	tmd->tmd3 = 0;
    334  1.1      cgd 	tmd->tmd2 = -len;
    335  1.1      cgd 	tmd->tmd1 = LE_OWN | LE_STP | LE_ENP;
    336  1.1      cgd 	le->sc_if.if_flags |= IFF_OACTIVE;
    337  1.1      cgd 	return (0);
    338  1.1      cgd }
    339  1.1      cgd 
    340  1.1      cgd leintr(unit)
    341  1.1      cgd 	register int unit;
    342  1.1      cgd {
    343  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    344  1.1      cgd 	register struct lereg0 *ler0 = le->sc_r0;
    345  1.1      cgd 	register struct lereg1 *ler1;
    346  1.1      cgd 	register int stat;
    347  1.1      cgd 
    348  1.1      cgd 	if ((ler0->ler0_status & LE_IR) == 0)
    349  1.1      cgd 		return(0);
    350  1.1      cgd 	if (ler0->ler0_status & LE_JAB) {
    351  1.1      cgd 		le->sc_jab++;
    352  1.1      cgd 		lereset(unit);
    353  1.1      cgd 		return(1);
    354  1.1      cgd 	}
    355  1.1      cgd 	ler1 = le->sc_r1;
    356  1.1      cgd 	LERDWR(ler0, ler1->ler1_rdp, stat);
    357  1.1      cgd 	if (stat & LE_SERR) {
    358  1.1      cgd 		leerror(unit, stat);
    359  1.1      cgd 		if (stat & LE_MERR) {
    360  1.1      cgd 			le->sc_merr++;
    361  1.1      cgd 			lereset(unit);
    362  1.1      cgd 			return(1);
    363  1.1      cgd 		}
    364  1.1      cgd 		if (stat & LE_BABL)
    365  1.1      cgd 			le->sc_babl++;
    366  1.1      cgd 		if (stat & LE_CERR)
    367  1.1      cgd 			le->sc_cerr++;
    368  1.1      cgd 		if (stat & LE_MISS)
    369  1.1      cgd 			le->sc_miss++;
    370  1.1      cgd 		LERDWR(ler0, LE_BABL|LE_CERR|LE_MISS|LE_INEA, ler1->ler1_rdp);
    371  1.1      cgd 	}
    372  1.1      cgd 	if ((stat & LE_RXON) == 0) {
    373  1.1      cgd 		le->sc_rxoff++;
    374  1.1      cgd 		lereset(unit);
    375  1.1      cgd 		return(1);
    376  1.1      cgd 	}
    377  1.1      cgd 	if ((stat & LE_TXON) == 0) {
    378  1.1      cgd 		le->sc_txoff++;
    379  1.1      cgd 		lereset(unit);
    380  1.1      cgd 		return(1);
    381  1.1      cgd 	}
    382  1.1      cgd 	if (stat & LE_RINT) {
    383  1.1      cgd 		/* interrupt is cleared in lerint */
    384  1.1      cgd 		lerint(unit);
    385  1.1      cgd 	}
    386  1.1      cgd 	if (stat & LE_TINT) {
    387  1.1      cgd 		LERDWR(ler0, LE_TINT|LE_INEA, ler1->ler1_rdp);
    388  1.1      cgd 		lexint(unit);
    389  1.1      cgd 	}
    390  1.1      cgd 	return(1);
    391  1.1      cgd }
    392  1.1      cgd 
    393  1.1      cgd /*
    394  1.1      cgd  * Ethernet interface transmitter interrupt.
    395  1.1      cgd  * Start another output if more data to send.
    396  1.1      cgd  */
    397  1.1      cgd lexint(unit)
    398  1.1      cgd 	register int unit;
    399  1.1      cgd {
    400  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    401  1.1      cgd 	register struct letmd *tmd = le->sc_r2->ler2_tmd;
    402  1.1      cgd 
    403  1.1      cgd 	if ((le->sc_if.if_flags & IFF_OACTIVE) == 0) {
    404  1.1      cgd 		le->sc_xint++;
    405  1.1      cgd 		return;
    406  1.1      cgd 	}
    407  1.1      cgd 	if (tmd->tmd1 & LE_OWN) {
    408  1.1      cgd 		le->sc_xown++;
    409  1.1      cgd 		return;
    410  1.1      cgd 	}
    411  1.1      cgd 	if (tmd->tmd1 & LE_ERR) {
    412  1.1      cgd err:
    413  1.1      cgd 		lexerror(unit);
    414  1.1      cgd 		le->sc_if.if_oerrors++;
    415  1.1      cgd 		if (tmd->tmd3 & (LE_TBUFF|LE_UFLO)) {
    416  1.1      cgd 			le->sc_uflo++;
    417  1.1      cgd 			lereset(unit);
    418  1.1      cgd 		}
    419  1.1      cgd 		else if (tmd->tmd3 & LE_LCOL)
    420  1.1      cgd 			le->sc_if.if_collisions++;
    421  1.1      cgd 		else if (tmd->tmd3 & LE_RTRY)
    422  1.1      cgd 			le->sc_if.if_collisions += 16;
    423  1.1      cgd 	}
    424  1.1      cgd 	else if (tmd->tmd3 & LE_TBUFF)
    425  1.1      cgd 		/* XXX documentation says BUFF not included in ERR */
    426  1.1      cgd 		goto err;
    427  1.1      cgd 	else if (tmd->tmd1 & LE_ONE)
    428  1.1      cgd 		le->sc_if.if_collisions++;
    429  1.1      cgd 	else if (tmd->tmd1 & LE_MORE)
    430  1.1      cgd 		/* what is the real number? */
    431  1.1      cgd 		le->sc_if.if_collisions += 2;
    432  1.1      cgd 	else
    433  1.1      cgd 		le->sc_if.if_opackets++;
    434  1.1      cgd 	le->sc_if.if_flags &= ~IFF_OACTIVE;
    435  1.1      cgd 	(void) lestart(&le->sc_if);
    436  1.1      cgd }
    437  1.1      cgd 
    438  1.1      cgd #define	LENEXTRMP \
    439  1.1      cgd 	if (++bix == LERBUF) bix = 0, rmd = le->sc_r2->ler2_rmd; else ++rmd
    440  1.1      cgd 
    441  1.1      cgd /*
    442  1.1      cgd  * Ethernet interface receiver interrupt.
    443  1.1      cgd  * If input error just drop packet.
    444  1.1      cgd  * Decapsulate packet based on type and pass to type specific
    445  1.1      cgd  * higher-level input routine.
    446  1.1      cgd  */
    447  1.1      cgd lerint(unit)
    448  1.1      cgd 	int unit;
    449  1.1      cgd {
    450  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    451  1.1      cgd 	register int bix = le->sc_rmd;
    452  1.1      cgd 	register struct lermd *rmd = &le->sc_r2->ler2_rmd[bix];
    453  1.1      cgd 
    454  1.1      cgd 	/*
    455  1.1      cgd 	 * Out of sync with hardware, should never happen?
    456  1.1      cgd 	 */
    457  1.1      cgd 	if (rmd->rmd1 & LE_OWN) {
    458  1.1      cgd 		LERDWR(le->sc_r0, LE_RINT|LE_INEA, le->sc_r1->ler1_rdp);
    459  1.1      cgd 		return;
    460  1.1      cgd 	}
    461  1.1      cgd 
    462  1.1      cgd 	/*
    463  1.1      cgd 	 * Process all buffers with valid data
    464  1.1      cgd 	 */
    465  1.1      cgd 	while ((rmd->rmd1 & LE_OWN) == 0) {
    466  1.1      cgd 		int len = rmd->rmd3;
    467  1.1      cgd 
    468  1.1      cgd 		/* Clear interrupt to avoid race condition */
    469  1.1      cgd 		LERDWR(le->sc_r0, LE_RINT|LE_INEA, le->sc_r1->ler1_rdp);
    470  1.1      cgd 
    471  1.1      cgd 		if (rmd->rmd1 & LE_ERR) {
    472  1.1      cgd 			le->sc_rmd = bix;
    473  1.1      cgd 			lererror(unit, "bad packet");
    474  1.1      cgd 			le->sc_if.if_ierrors++;
    475  1.1      cgd 		} else if ((rmd->rmd1 & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP)) {
    476  1.1      cgd 			/*
    477  1.1      cgd 			 * Find the end of the packet so we can see how long
    478  1.1      cgd 			 * it was.  We still throw it away.
    479  1.1      cgd 			 */
    480  1.1      cgd 			do {
    481  1.1      cgd 				LERDWR(le->sc_r0, LE_RINT|LE_INEA,
    482  1.1      cgd 				       le->sc_r1->ler1_rdp);
    483  1.1      cgd 				rmd->rmd3 = 0;
    484  1.1      cgd 				rmd->rmd1 = LE_OWN;
    485  1.1      cgd 				LENEXTRMP;
    486  1.1      cgd 			} while (!(rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)));
    487  1.1      cgd 			le->sc_rmd = bix;
    488  1.1      cgd 			lererror(unit, "chained buffer");
    489  1.1      cgd 			le->sc_rxlen++;
    490  1.1      cgd 			/*
    491  1.1      cgd 			 * If search terminated without successful completion
    492  1.1      cgd 			 * we reset the hardware (conservative).
    493  1.1      cgd 			 */
    494  1.1      cgd 			if ((rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)) !=
    495  1.1      cgd 			    LE_ENP) {
    496  1.1      cgd 				lereset(unit);
    497  1.1      cgd 				return;
    498  1.1      cgd 			}
    499  1.1      cgd 		} else
    500  1.1      cgd 			leread(unit, le->sc_r2->ler2_rbuf[bix], len);
    501  1.1      cgd 		rmd->rmd3 = 0;
    502  1.1      cgd 		rmd->rmd1 = LE_OWN;
    503  1.1      cgd 		LENEXTRMP;
    504  1.1      cgd 	}
    505  1.1      cgd 	le->sc_rmd = bix;
    506  1.1      cgd }
    507  1.1      cgd 
    508  1.1      cgd leread(unit, buf, len)
    509  1.1      cgd 	int unit;
    510  1.1      cgd 	char *buf;
    511  1.1      cgd 	int len;
    512  1.1      cgd {
    513  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    514  1.1      cgd 	register struct ether_header *et;
    515  1.1      cgd     	struct mbuf *m;
    516  1.1      cgd 	int off, resid;
    517  1.3  deraadt 	u_short etype;
    518  1.1      cgd 
    519  1.1      cgd 	le->sc_if.if_ipackets++;
    520  1.1      cgd 	et = (struct ether_header *)buf;
    521  1.1      cgd 	/* adjust input length to account for header and CRC */
    522  1.1      cgd 	len = len - sizeof(struct ether_header) - 4;
    523  1.1      cgd 
    524  1.1      cgd #define	ledataaddr(et, off, type)	((type)(((caddr_t)((et)+1)+(off))))
    525  1.3  deraadt 	etype = ntohs(et->ether_type);
    526  1.4  mycroft 	if (etype >= ETHERTYPE_TRAIL &&
    527  1.4  mycroft 	    etype < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
    528  1.3  deraadt 		off = (etype - ETHERTYPE_TRAIL) * 512;
    529  1.1      cgd 		if (off >= ETHERMTU)
    530  1.1      cgd 			return;		/* sanity */
    531  1.3  deraadt 		et->ether_type = *ledataaddr(et, off, u_short *);
    532  1.1      cgd 		resid = ntohs(*(ledataaddr(et, off+2, u_short *)));
    533  1.1      cgd 		if (off + resid > len)
    534  1.1      cgd 			return;		/* sanity */
    535  1.1      cgd 		len = off + resid;
    536  1.1      cgd 	} else
    537  1.1      cgd 		off = 0;
    538  1.1      cgd 
    539  1.1      cgd 	if (len <= 0) {
    540  1.1      cgd 		if (ledebug)
    541  1.1      cgd 			log(LOG_WARNING,
    542  1.1      cgd 			    "le%d: ierror(runt packet): from %s: len=%d\n",
    543  1.1      cgd 			    unit, ether_sprintf(et->ether_shost), len);
    544  1.1      cgd 		le->sc_runt++;
    545  1.1      cgd 		le->sc_if.if_ierrors++;
    546  1.1      cgd 		return;
    547  1.1      cgd 	}
    548  1.1      cgd #if NBPFILTER > 0
    549  1.1      cgd 	/*
    550  1.1      cgd 	 * Check if there's a bpf filter listening on this interface.
    551  1.1      cgd 	 * If so, hand off the raw packet to bpf, which must deal with
    552  1.1      cgd 	 * trailers in its own way.
    553  1.1      cgd 	 */
    554  1.1      cgd 	if (le->sc_bpf) {
    555  1.1      cgd 		bpf_tap(le->sc_bpf, buf, len + sizeof(struct ether_header));
    556  1.1      cgd 
    557  1.1      cgd 		/*
    558  1.1      cgd 		 * Note that the interface cannot be in promiscuous mode if
    559  1.1      cgd 		 * there are no bpf listeners.  And if we are in promiscuous
    560  1.1      cgd 		 * mode, we have to check if this packet is really ours.
    561  1.1      cgd 		 *
    562  1.1      cgd 		 * XXX This test does not support multicasts.
    563  1.1      cgd 		 */
    564  1.1      cgd 		if ((le->sc_if.if_flags & IFF_PROMISC)
    565  1.1      cgd 		    && bcmp(et->ether_dhost, le->sc_addr,
    566  1.1      cgd 			    sizeof(et->ether_dhost)) != 0
    567  1.1      cgd 		    && bcmp(et->ether_dhost, etherbroadcastaddr,
    568  1.1      cgd 			    sizeof(et->ether_dhost)) != 0)
    569  1.1      cgd 			return;
    570  1.1      cgd 	}
    571  1.1      cgd #endif
    572  1.1      cgd 	/*
    573  1.1      cgd 	 * Pull packet off interface.  Off is nonzero if packet
    574  1.1      cgd 	 * has trailing header; leget will then force this header
    575  1.1      cgd 	 * information to be at the front, but we still have to drop
    576  1.1      cgd 	 * the type and length which are at the front of any trailer data.
    577  1.1      cgd 	 */
    578  1.1      cgd 	m = leget(buf, len, off, &le->sc_if);
    579  1.1      cgd 	if (m == 0)
    580  1.1      cgd 		return;
    581  1.1      cgd 	ether_input(&le->sc_if, et, m);
    582  1.1      cgd }
    583  1.1      cgd 
    584  1.1      cgd /*
    585  1.1      cgd  * Routine to copy from mbuf chain to transmit
    586  1.1      cgd  * buffer in board local memory.
    587  1.1      cgd  */
    588  1.1      cgd leput(lebuf, m)
    589  1.1      cgd 	register char *lebuf;
    590  1.1      cgd 	register struct mbuf *m;
    591  1.1      cgd {
    592  1.1      cgd 	register struct mbuf *mp;
    593  1.1      cgd 	register int len, tlen = 0;
    594  1.1      cgd 
    595  1.1      cgd 	for (mp = m; mp; mp = mp->m_next) {
    596  1.1      cgd 		len = mp->m_len;
    597  1.1      cgd 		if (len == 0)
    598  1.1      cgd 			continue;
    599  1.1      cgd 		tlen += len;
    600  1.1      cgd 		bcopy(mtod(mp, char *), lebuf, len);
    601  1.1      cgd 		lebuf += len;
    602  1.1      cgd 	}
    603  1.1      cgd 	m_freem(m);
    604  1.1      cgd 	if (tlen < LEMINSIZE) {
    605  1.1      cgd 		bzero(lebuf, LEMINSIZE - tlen);
    606  1.1      cgd 		tlen = LEMINSIZE;
    607  1.1      cgd 	}
    608  1.1      cgd 	return(tlen);
    609  1.1      cgd }
    610  1.1      cgd 
    611  1.1      cgd /*
    612  1.1      cgd  * Routine to copy from board local memory into mbufs.
    613  1.1      cgd  */
    614  1.1      cgd struct mbuf *
    615  1.1      cgd leget(lebuf, totlen, off0, ifp)
    616  1.1      cgd 	char *lebuf;
    617  1.1      cgd 	int totlen, off0;
    618  1.1      cgd 	struct ifnet *ifp;
    619  1.1      cgd {
    620  1.1      cgd 	register struct mbuf *m;
    621  1.1      cgd 	struct mbuf *top = 0, **mp = &top;
    622  1.1      cgd 	register int off = off0, len;
    623  1.1      cgd 	register char *cp;
    624  1.1      cgd 	char *epkt;
    625  1.1      cgd 
    626  1.1      cgd 	lebuf += sizeof (struct ether_header);
    627  1.1      cgd 	cp = lebuf;
    628  1.1      cgd 	epkt = cp + totlen;
    629  1.1      cgd 	if (off) {
    630  1.1      cgd 		cp += off + 2 * sizeof(u_short);
    631  1.1      cgd 		totlen -= 2 * sizeof(u_short);
    632  1.1      cgd 	}
    633  1.1      cgd 
    634  1.1      cgd 	MGETHDR(m, M_DONTWAIT, MT_DATA);
    635  1.1      cgd 	if (m == 0)
    636  1.1      cgd 		return (0);
    637  1.1      cgd 	m->m_pkthdr.rcvif = ifp;
    638  1.1      cgd 	m->m_pkthdr.len = totlen;
    639  1.1      cgd 	m->m_len = MHLEN;
    640  1.1      cgd 
    641  1.1      cgd 	while (totlen > 0) {
    642  1.1      cgd 		if (top) {
    643  1.1      cgd 			MGET(m, M_DONTWAIT, MT_DATA);
    644  1.1      cgd 			if (m == 0) {
    645  1.1      cgd 				m_freem(top);
    646  1.1      cgd 				return (0);
    647  1.1      cgd 			}
    648  1.1      cgd 			m->m_len = MLEN;
    649  1.1      cgd 		}
    650  1.1      cgd 		len = min(totlen, epkt - cp);
    651  1.1      cgd 		if (len >= MINCLSIZE) {
    652  1.1      cgd 			MCLGET(m, M_DONTWAIT);
    653  1.1      cgd 			if (m->m_flags & M_EXT)
    654  1.1      cgd 				m->m_len = len = min(len, MCLBYTES);
    655  1.1      cgd 			else
    656  1.1      cgd 				len = m->m_len;
    657  1.1      cgd 		} else {
    658  1.1      cgd 			/*
    659  1.1      cgd 			 * Place initial small packet/header at end of mbuf.
    660  1.1      cgd 			 */
    661  1.1      cgd 			if (len < m->m_len) {
    662  1.1      cgd 				if (top == 0 && len + max_linkhdr <= m->m_len)
    663  1.1      cgd 					m->m_data += max_linkhdr;
    664  1.1      cgd 				m->m_len = len;
    665  1.1      cgd 			} else
    666  1.1      cgd 				len = m->m_len;
    667  1.1      cgd 		}
    668  1.1      cgd 		bcopy(cp, mtod(m, caddr_t), (unsigned)len);
    669  1.1      cgd 		cp += len;
    670  1.1      cgd 		*mp = m;
    671  1.1      cgd 		mp = &m->m_next;
    672  1.1      cgd 		totlen -= len;
    673  1.1      cgd 		if (cp == epkt)
    674  1.1      cgd 			cp = lebuf;
    675  1.1      cgd 	}
    676  1.1      cgd 	return (top);
    677  1.1      cgd }
    678  1.1      cgd 
    679  1.1      cgd /*
    680  1.1      cgd  * Process an ioctl request.
    681  1.1      cgd  */
    682  1.1      cgd leioctl(ifp, cmd, data)
    683  1.1      cgd 	register struct ifnet *ifp;
    684  1.1      cgd 	int cmd;
    685  1.1      cgd 	caddr_t data;
    686  1.1      cgd {
    687  1.1      cgd 	register struct ifaddr *ifa = (struct ifaddr *)data;
    688  1.1      cgd 	struct le_softc *le = &le_softc[ifp->if_unit];
    689  1.1      cgd 	struct lereg1 *ler1 = le->sc_r1;
    690  1.1      cgd 	int s = splimp(), error = 0;
    691  1.1      cgd 
    692  1.1      cgd 	switch (cmd) {
    693  1.1      cgd 
    694  1.1      cgd 	case SIOCSIFADDR:
    695  1.1      cgd 		ifp->if_flags |= IFF_UP;
    696  1.1      cgd 		switch (ifa->ifa_addr->sa_family) {
    697  1.1      cgd #ifdef INET
    698  1.1      cgd 		case AF_INET:
    699  1.1      cgd 			leinit(ifp->if_unit);	/* before arpwhohas */
    700  1.1      cgd 			((struct arpcom *)ifp)->ac_ipaddr =
    701  1.1      cgd 				IA_SIN(ifa)->sin_addr;
    702  1.1      cgd 			arpwhohas((struct arpcom *)ifp, &IA_SIN(ifa)->sin_addr);
    703  1.1      cgd 			break;
    704  1.1      cgd #endif
    705  1.1      cgd #ifdef NS
    706  1.1      cgd 		case AF_NS:
    707  1.1      cgd 		    {
    708  1.1      cgd 			register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
    709  1.1      cgd 
    710  1.1      cgd 			if (ns_nullhost(*ina))
    711  1.1      cgd 				ina->x_host = *(union ns_host *)(le->sc_addr);
    712  1.1      cgd 			else {
    713  1.1      cgd 				/*
    714  1.1      cgd 				 * The manual says we can't change the address
    715  1.1      cgd 				 * while the receiver is armed,
    716  1.1      cgd 				 * so reset everything
    717  1.1      cgd 				 */
    718  1.1      cgd 				ifp->if_flags &= ~IFF_RUNNING;
    719  1.1      cgd 				bcopy((caddr_t)ina->x_host.c_host,
    720  1.1      cgd 				    (caddr_t)le->sc_addr, sizeof(le->sc_addr));
    721  1.1      cgd 			}
    722  1.1      cgd 			leinit(ifp->if_unit); /* does le_setaddr() */
    723  1.1      cgd 			break;
    724  1.1      cgd 		    }
    725  1.1      cgd #endif
    726  1.1      cgd 		default:
    727  1.1      cgd 			leinit(ifp->if_unit);
    728  1.1      cgd 			break;
    729  1.1      cgd 		}
    730  1.1      cgd 		break;
    731  1.1      cgd 
    732  1.1      cgd 	case SIOCSIFFLAGS:
    733  1.1      cgd 		if ((ifp->if_flags & IFF_UP) == 0 &&
    734  1.1      cgd 		    ifp->if_flags & IFF_RUNNING) {
    735  1.1      cgd 			LERDWR(le->sc_r0, LE_STOP, ler1->ler1_rdp);
    736  1.1      cgd 			ifp->if_flags &= ~IFF_RUNNING;
    737  1.1      cgd 		} else if (ifp->if_flags & IFF_UP &&
    738  1.1      cgd 		    (ifp->if_flags & IFF_RUNNING) == 0)
    739  1.1      cgd 			leinit(ifp->if_unit);
    740  1.1      cgd 		/*
    741  1.1      cgd 		 * If the state of the promiscuous bit changes, the interface
    742  1.1      cgd 		 * must be reset to effect the change.
    743  1.1      cgd 		 */
    744  1.1      cgd 		if (((ifp->if_flags ^ le->sc_iflags) & IFF_PROMISC) &&
    745  1.1      cgd 		    (ifp->if_flags & IFF_RUNNING)) {
    746  1.1      cgd 			le->sc_iflags = ifp->if_flags;
    747  1.1      cgd 			lereset(ifp->if_unit);
    748  1.1      cgd 			lestart(ifp);
    749  1.1      cgd 		}
    750  1.1      cgd 		break;
    751  1.1      cgd 
    752  1.1      cgd 	default:
    753  1.1      cgd 		error = EINVAL;
    754  1.1      cgd 	}
    755  1.1      cgd 	splx(s);
    756  1.1      cgd 	return (error);
    757  1.1      cgd }
    758  1.1      cgd 
    759  1.1      cgd leerror(unit, stat)
    760  1.1      cgd 	int unit;
    761  1.1      cgd 	int stat;
    762  1.1      cgd {
    763  1.1      cgd 	if (!ledebug)
    764  1.1      cgd 		return;
    765  1.1      cgd 
    766  1.1      cgd 	/*
    767  1.1      cgd 	 * Not all transceivers implement heartbeat
    768  1.1      cgd 	 * so we only log CERR once.
    769  1.1      cgd 	 */
    770  1.1      cgd 	if ((stat & LE_CERR) && le_softc[unit].sc_cerr)
    771  1.1      cgd 		return;
    772  1.1      cgd 	log(LOG_WARNING,
    773  1.1      cgd 	    "le%d: error: stat=%b\n", unit,
    774  1.1      cgd 	    stat,
    775  1.1      cgd 	    "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT");
    776  1.1      cgd }
    777  1.1      cgd 
    778  1.1      cgd lererror(unit, msg)
    779  1.1      cgd 	int unit;
    780  1.1      cgd 	char *msg;
    781  1.1      cgd {
    782  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    783  1.1      cgd 	register struct lermd *rmd;
    784  1.1      cgd 	int len;
    785  1.1      cgd 
    786  1.1      cgd 	if (!ledebug)
    787  1.1      cgd 		return;
    788  1.1      cgd 
    789  1.1      cgd 	rmd = &le->sc_r2->ler2_rmd[le->sc_rmd];
    790  1.1      cgd 	len = rmd->rmd3;
    791  1.1      cgd 	log(LOG_WARNING,
    792  1.1      cgd 	    "le%d: ierror(%s): from %s: buf=%d, len=%d, rmd1=%b\n",
    793  1.1      cgd 	    unit, msg,
    794  1.1      cgd 	    len > 11 ? ether_sprintf(&le->sc_r2->ler2_rbuf[le->sc_rmd][6]) : "unknown",
    795  1.1      cgd 	    le->sc_rmd, len,
    796  1.1      cgd 	    rmd->rmd1,
    797  1.1      cgd 	    "\20\20OWN\17ERR\16FRAM\15OFLO\14CRC\13RBUF\12STP\11ENP");
    798  1.1      cgd }
    799  1.1      cgd 
    800  1.1      cgd lexerror(unit)
    801  1.1      cgd 	int unit;
    802  1.1      cgd {
    803  1.1      cgd 	register struct le_softc *le = &le_softc[unit];
    804  1.1      cgd 	register struct letmd *tmd;
    805  1.1      cgd 	int len;
    806  1.1      cgd 
    807  1.1      cgd 	if (!ledebug)
    808  1.1      cgd 		return;
    809  1.1      cgd 
    810  1.1      cgd 	tmd = le->sc_r2->ler2_tmd;
    811  1.1      cgd 	len = -tmd->tmd2;
    812  1.1      cgd 	log(LOG_WARNING,
    813  1.1      cgd 	    "le%d: oerror: to %s: buf=%d, len=%d, tmd1=%b, tmd3=%b\n",
    814  1.1      cgd 	    unit,
    815  1.1      cgd 	    len > 5 ? ether_sprintf(&le->sc_r2->ler2_tbuf[0][0]) : "unknown",
    816  1.1      cgd 	    0, len,
    817  1.1      cgd 	    tmd->tmd1,
    818  1.1      cgd 	    "\20\20OWN\17ERR\16RES\15MORE\14ONE\13DEF\12STP\11ENP",
    819  1.1      cgd 	    tmd->tmd3,
    820  1.1      cgd 	    "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY");
    821  1.1      cgd }
    822  1.1      cgd #endif
    823