Home | History | Annotate | Line # | Download | only in vme
if_le_vme.c revision 1.1
      1  1.1  leo /*	$NetBSD	*/
      2  1.1  leo 
      3  1.1  leo /*-
      4  1.1  leo  * Copyright (c) 1997 Leo Weppelman.  All rights reserved.
      5  1.1  leo  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
      6  1.1  leo  * Copyright (c) 1992, 1993
      7  1.1  leo  *	The Regents of the University of California.  All rights reserved.
      8  1.1  leo  *
      9  1.1  leo  * This code is derived from software contributed to Berkeley by
     10  1.1  leo  * Ralph Campbell and Rick Macklem.
     11  1.1  leo  *
     12  1.1  leo  * Redistribution and use in source and binary forms, with or without
     13  1.1  leo  * modification, are permitted provided that the following conditions
     14  1.1  leo  * are met:
     15  1.1  leo  * 1. Redistributions of source code must retain the above copyright
     16  1.1  leo  *    notice, this list of conditions and the following disclaimer.
     17  1.1  leo  * 2. Redistributions in binary form must reproduce the above copyright
     18  1.1  leo  *    notice, this list of conditions and the following disclaimer in the
     19  1.1  leo  *    documentation and/or other materials provided with the distribution.
     20  1.1  leo  * 3. All advertising materials mentioning features or use of this software
     21  1.1  leo  *    must display the following acknowledgement:
     22  1.1  leo  *	This product includes software developed by the University of
     23  1.1  leo  *	California, Berkeley and its contributors.
     24  1.1  leo  * 4. Neither the name of the University nor the names of its contributors
     25  1.1  leo  *    may be used to endorse or promote products derived from this software
     26  1.1  leo  *    without specific prior written permission.
     27  1.1  leo  *
     28  1.1  leo  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29  1.1  leo  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30  1.1  leo  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31  1.1  leo  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32  1.1  leo  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33  1.1  leo  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34  1.1  leo  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35  1.1  leo  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36  1.1  leo  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37  1.1  leo  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38  1.1  leo  * SUCH DAMAGE.
     39  1.1  leo  *
     40  1.1  leo  *	@(#)if_le.c	8.2 (Berkeley) 11/16/93
     41  1.1  leo  */
     42  1.1  leo 
     43  1.1  leo #include "bpfilter.h"
     44  1.1  leo 
     45  1.1  leo #include <sys/param.h>
     46  1.1  leo #include <sys/systm.h>
     47  1.1  leo #include <sys/mbuf.h>
     48  1.1  leo #include <sys/syslog.h>
     49  1.1  leo #include <sys/socket.h>
     50  1.1  leo #include <sys/device.h>
     51  1.1  leo 
     52  1.1  leo #include <net/if.h>
     53  1.1  leo 
     54  1.1  leo #ifdef INET
     55  1.1  leo #include <netinet/in.h>
     56  1.1  leo #include <netinet/if_ether.h>
     57  1.1  leo #endif
     58  1.1  leo 
     59  1.1  leo #include <machine/cpu.h>
     60  1.1  leo #include <machine/bus.h>
     61  1.1  leo #include <machine/iomap.h>
     62  1.1  leo #include <machine/scu.h>
     63  1.1  leo 
     64  1.1  leo #include <atari/atari/device.h>
     65  1.1  leo #include <atari/atari/intr.h>
     66  1.1  leo 
     67  1.1  leo #include <dev/ic/am7990reg.h>
     68  1.1  leo #include <dev/ic/am7990var.h>
     69  1.1  leo 
     70  1.1  leo #include <atari/vme/vmevar.h>
     71  1.1  leo #include <atari/vme/if_levar.h>
     72  1.1  leo 
     73  1.1  leo struct le_addresses {
     74  1.1  leo 	u_long	reg_addr;
     75  1.1  leo 	u_long	mem_addr;
     76  1.1  leo 	int	irq;
     77  1.1  leo } lestd[] = {
     78  1.1  leo 	{ 0xfe00fff0, 0xfe010000, IRQUNK },	/* Riebl VME	*/
     79  1.1  leo 	{ 0xffcffff0, 0xffcf0000,      5 },	/* PAM VME	*/
     80  1.1  leo 	{ 0xfecffff0, 0xfecf0000,      5 }	/* Rhotron VME	*/
     81  1.1  leo };
     82  1.1  leo 
     83  1.1  leo #define	NLESTD	(sizeof(lestd) / sizeof(lestd[0]))
     84  1.1  leo 
     85  1.1  leo /*
     86  1.1  leo  * All cards have 64KB RAM. However.... On the Riebl cards the area
     87  1.1  leo  * between the offsets 0xee70-0xeec0 is used to store config data.
     88  1.1  leo  */
     89  1.1  leo #define	MEMSIZE	(64*1024)
     90  1.1  leo 
     91  1.1  leo /*
     92  1.1  leo  * Default mac for RIEBL cards without a (working) battery. The first 4 bytes
     93  1.1  leo  * are the manufacturer id.
     94  1.1  leo  */
     95  1.1  leo static u_char riebl_def_mac[] = {
     96  1.1  leo 	0x00, 0x00, 0x36, 0x04, 0x00, 0x00
     97  1.1  leo };
     98  1.1  leo 
     99  1.1  leo static int le_intr __P((struct le_softc *, int));
    100  1.1  leo static void lepseudointr __P((struct le_softc *, void *));
    101  1.1  leo static int le_vme_match __P((struct device *, struct cfdata *, void *));
    102  1.1  leo static void le_vme_attach __P((struct device *, struct device *, void *));
    103  1.1  leo static int probe_addresses __P((bus_space_tag_t *, bus_space_tag_t *,
    104  1.1  leo 				bus_space_handle_t *, bus_space_handle_t *));
    105  1.1  leo static void riebl_skip_reserved_area __P((struct am7990_softc *));
    106  1.1  leo 
    107  1.1  leo struct cfattach le_vme_ca = {
    108  1.1  leo 	sizeof(struct le_softc), le_vme_match, le_vme_attach
    109  1.1  leo };
    110  1.1  leo 
    111  1.1  leo hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
    112  1.1  leo hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t));
    113  1.1  leo 
    114  1.1  leo hide void
    115  1.1  leo lewrcsr(sc, port, val)
    116  1.1  leo 	struct am7990_softc	*sc;
    117  1.1  leo 	u_int16_t		port, val;
    118  1.1  leo {
    119  1.1  leo 	struct le_softc		*lesc = (struct le_softc *)sc;
    120  1.1  leo 	int			s;
    121  1.1  leo 
    122  1.1  leo 	s = splhigh();
    123  1.1  leo 	bus_space_write_2(lesc->sc_iot, lesc->sc_ioh, LER_RAP, port);
    124  1.1  leo 	bus_space_write_2(lesc->sc_iot, lesc->sc_ioh, LER_RDP, val);
    125  1.1  leo 	splx(s);
    126  1.1  leo }
    127  1.1  leo 
    128  1.1  leo hide u_int16_t
    129  1.1  leo lerdcsr(sc, port)
    130  1.1  leo 	struct am7990_softc	*sc;
    131  1.1  leo 	u_int16_t		port;
    132  1.1  leo {
    133  1.1  leo 	struct le_softc		*lesc = (struct le_softc *)sc;
    134  1.1  leo 	u_int16_t		val;
    135  1.1  leo 	int			s;
    136  1.1  leo 
    137  1.1  leo 	s = splhigh();
    138  1.1  leo 	bus_space_write_2(lesc->sc_iot, lesc->sc_ioh, LER_RAP, port);
    139  1.1  leo 	val = bus_space_read_2(lesc->sc_iot, lesc->sc_ioh, LER_RDP);
    140  1.1  leo 	splx(s);
    141  1.1  leo 
    142  1.1  leo 	return (val);
    143  1.1  leo }
    144  1.1  leo 
    145  1.1  leo static int
    146  1.1  leo le_vme_match(parent, cfp, aux)
    147  1.1  leo 	struct device	*parent;
    148  1.1  leo 	struct cfdata	*cfp;
    149  1.1  leo 	void		*aux;
    150  1.1  leo {
    151  1.1  leo 	struct vme_attach_args	*va = aux;
    152  1.1  leo 	int			i;
    153  1.1  leo 	bus_space_tag_t		iot;
    154  1.1  leo 	bus_space_tag_t		memt;
    155  1.1  leo 	bus_space_handle_t	ioh;
    156  1.1  leo 	bus_space_handle_t	memh;
    157  1.1  leo 
    158  1.1  leo 	iot  = va->va_iot;
    159  1.1  leo 	memt = va->va_memt;
    160  1.1  leo 
    161  1.1  leo 	for (i = 0; i < NLESTD; i++) {
    162  1.1  leo 		struct le_addresses	*le_ap = &lestd[i];
    163  1.1  leo 		int			found  = 0;
    164  1.1  leo 
    165  1.1  leo 		if ((va->va_iobase != IOBASEUNK)
    166  1.1  leo 		     && (va->va_iobase != le_ap->reg_addr))
    167  1.1  leo 			continue;
    168  1.1  leo 
    169  1.1  leo 		if ((va->va_maddr != MADDRUNK)
    170  1.1  leo 		     && (va->va_maddr != le_ap->mem_addr))
    171  1.1  leo 			continue;
    172  1.1  leo 
    173  1.1  leo 		if ((le_ap->irq != IRQUNK) && (va->va_irq != le_ap->irq))
    174  1.1  leo 			continue;
    175  1.1  leo 
    176  1.1  leo 		if (bus_space_map(iot, le_ap->reg_addr, 16, 0, &ioh)) {
    177  1.1  leo 			printf("leprobe: cannot map io-area\n");
    178  1.1  leo 			return (0);
    179  1.1  leo 		}
    180  1.1  leo 		if (bus_space_map(memt, le_ap->mem_addr, MEMSIZE, 0, &memh)) {
    181  1.1  leo 			bus_space_unmap(iot, (caddr_t)le_ap->reg_addr, 16);
    182  1.1  leo 			printf("leprobe: cannot map memory-area\n");
    183  1.1  leo 			return (0);
    184  1.1  leo 		}
    185  1.1  leo 		found = probe_addresses(&iot, &memt, &ioh, &memh);
    186  1.1  leo 		bus_space_unmap(iot, (caddr_t)le_ap->reg_addr, 16);
    187  1.1  leo 		bus_space_unmap(memt, (caddr_t)le_ap->mem_addr, 8*NBPG);
    188  1.1  leo 
    189  1.1  leo 		if (found) {
    190  1.1  leo 			va->va_iobase = le_ap->reg_addr;
    191  1.1  leo 			va->va_iosize = 16;
    192  1.1  leo 			va->va_maddr  = le_ap->mem_addr;
    193  1.1  leo 			va->va_msize  = MEMSIZE;
    194  1.1  leo 			if (va->va_irq == IRQUNK)
    195  1.1  leo 				va->va_irq = le_ap->irq;
    196  1.1  leo 			return 1;
    197  1.1  leo 		}
    198  1.1  leo     }
    199  1.1  leo     return (0);
    200  1.1  leo }
    201  1.1  leo 
    202  1.1  leo static int
    203  1.1  leo probe_addresses(iot, memt, ioh, memh)
    204  1.1  leo bus_space_tag_t		*iot;
    205  1.1  leo bus_space_tag_t		*memt;
    206  1.1  leo bus_space_handle_t	*ioh;
    207  1.1  leo bus_space_handle_t	*memh;
    208  1.1  leo {
    209  1.1  leo 	/*
    210  1.1  leo 	 * Test accesibility of register and memory area
    211  1.1  leo 	 */
    212  1.1  leo 	if(!bus_space_peek_2(*iot, *ioh, LER_RDP))
    213  1.1  leo 		return 0;
    214  1.1  leo 	if(!bus_space_peek_1(*memt, *memh, 0))
    215  1.1  leo 		return 0;
    216  1.1  leo 
    217  1.1  leo 	/*
    218  1.1  leo 	 * Test for writable memory
    219  1.1  leo 	 */
    220  1.1  leo 	bus_space_write_2(*memt, *memh, 0, 0xa5a5);
    221  1.1  leo 	if (bus_space_read_2(*memt, *memh, 0) != 0xa5a5)
    222  1.1  leo 		return 0;
    223  1.1  leo 
    224  1.1  leo 	/*
    225  1.1  leo 	 * Test writability of selector port.
    226  1.1  leo 	 */
    227  1.1  leo 	bus_space_write_2(*iot, *ioh, LER_RAP, LE_CSR1);
    228  1.1  leo 	if (bus_space_read_2(*iot, *ioh, LER_RAP) != LE_CSR1)
    229  1.1  leo 		return 0;
    230  1.1  leo 
    231  1.1  leo 	/*
    232  1.1  leo 	 * Do a small register test
    233  1.1  leo 	 */
    234  1.1  leo 	bus_space_write_2(*iot, *ioh, LER_RAP, LE_CSR0);
    235  1.1  leo 	bus_space_write_2(*iot, *ioh, LER_RDP, LE_C0_INIT | LE_C0_STOP);
    236  1.1  leo 	if (bus_space_read_2(*iot, *ioh, LER_RDP) != LE_C0_STOP)
    237  1.1  leo 		return 0;
    238  1.1  leo 
    239  1.1  leo 	bus_space_write_2(*iot, *ioh, LER_RDP, LE_C0_STOP);
    240  1.1  leo 	if (bus_space_read_2(*iot, *ioh, LER_RDP) != LE_C0_STOP)
    241  1.1  leo 		return 0;
    242  1.1  leo 
    243  1.1  leo 	return 1;
    244  1.1  leo }
    245  1.1  leo 
    246  1.1  leo /*
    247  1.1  leo  * Interrupt mess. Because the card's interrupt is hardwired to either
    248  1.1  leo  * ipl5 or ipl3 (mostly on ipl5) and raising splnet to spl5() just won't do
    249  1.1  leo  * (it kills the serial at the least), we use a 2-level interrupt sceme. The
    250  1.1  leo  * card interrupt is routed to 'le_intr'. If the previous ipl was below
    251  1.1  leo  * splnet, just call the mi-function. If not, save the interrupt status,
    252  1.1  leo  * turn off card interrupts (the card is *very* persistent) and arrange
    253  1.1  leo  * for a softint 'callback' through 'lepseudointr'.
    254  1.1  leo  */
    255  1.1  leo static int
    256  1.1  leo le_intr(lesc, sr)
    257  1.1  leo 	struct le_softc	*lesc;
    258  1.1  leo 	int		 sr;
    259  1.1  leo {
    260  1.1  leo 	struct am7990_softc	*sc = &lesc->sc_am7990;
    261  1.1  leo 	u_int16_t		csr0;
    262  1.1  leo 
    263  1.1  leo 	if ((sr & PSL_IPL) < IPL_NET)
    264  1.1  leo 		am7990_intr(sc);
    265  1.1  leo 	else {
    266  1.1  leo 		sc->sc_saved_csr0 = csr0 = lerdcsr(sc, LE_CSR0);
    267  1.1  leo 		lewrcsr(sc, LE_CSR0, csr0 & ~LE_C0_INEA);
    268  1.1  leo 		add_sicallback((si_farg)lepseudointr, lesc, sc);
    269  1.1  leo 	}
    270  1.1  leo 	return 1;
    271  1.1  leo }
    272  1.1  leo 
    273  1.1  leo 
    274  1.1  leo static void
    275  1.1  leo lepseudointr(lesc, sc)
    276  1.1  leo struct le_softc	*lesc;
    277  1.1  leo void		*sc;
    278  1.1  leo {
    279  1.1  leo 	int	s;
    280  1.1  leo 
    281  1.1  leo 	s = splx(lesc->sc_splval);
    282  1.1  leo 	am7990_intr(sc);
    283  1.1  leo 	splx(s);
    284  1.1  leo }
    285  1.1  leo 
    286  1.1  leo static void
    287  1.1  leo le_vme_attach(parent, self, aux)
    288  1.1  leo 	struct device *parent, *self;
    289  1.1  leo 	void *aux;
    290  1.1  leo {
    291  1.1  leo 	struct le_softc		*lesc = (struct le_softc *)self;
    292  1.1  leo 	struct am7990_softc	*sc = &lesc->sc_am7990;
    293  1.1  leo 	struct vme_attach_args	*va = aux;
    294  1.1  leo 	bus_space_handle_t	ioh;
    295  1.1  leo 	bus_space_handle_t	memh;
    296  1.1  leo 	int			i;
    297  1.1  leo 
    298  1.1  leo 	printf("\n%s: ", sc->sc_dev.dv_xname);
    299  1.1  leo 
    300  1.1  leo 	if (bus_space_map(va->va_iot, va->va_iobase, va->va_iosize, 0, &ioh))
    301  1.1  leo 		panic("leattach: cannot map io-area\n");
    302  1.1  leo 	if (bus_space_map(va->va_memt, va->va_maddr, va->va_msize, 0, &memh))
    303  1.1  leo 		panic("leattach: cannot map mem-area\n");
    304  1.1  leo 
    305  1.1  leo 	lesc->sc_iot    = va->va_iot;
    306  1.1  leo 	lesc->sc_ioh    = ioh;
    307  1.1  leo 	lesc->sc_memt   = va->va_memt;
    308  1.1  leo 	lesc->sc_memh   = memh;
    309  1.1  leo 	lesc->sc_splval = (va->va_irq << 8) | PSL_S; /* XXX */
    310  1.1  leo 
    311  1.1  leo 	/*
    312  1.1  leo 	 * Go on to find board type
    313  1.1  leo 	 */
    314  1.1  leo 	if (bus_space_peek_1(va->va_iot, ioh, LER_EEPROM)) {
    315  1.1  leo 		printf("PAM card");
    316  1.1  leo 		lesc->sc_type = LE_PAM;
    317  1.1  leo 		bus_space_read_1(va->va_iot, ioh, LER_MEME);
    318  1.1  leo 	}
    319  1.1  leo 	else {
    320  1.1  leo 		printf("Riebl card");
    321  1.1  leo 		if(bus_space_read_4(va->va_memt, memh, RIEBL_MAGIC_ADDR)
    322  1.1  leo 								== RIEBL_MAGIC)
    323  1.1  leo 			lesc->sc_type = LE_NEW_RIEBL;
    324  1.1  leo 		else {
    325  1.1  leo 			printf("(without battery) ");
    326  1.1  leo 			lesc->sc_type = LE_OLD_RIEBL;
    327  1.1  leo 		}
    328  1.1  leo 	}
    329  1.1  leo 
    330  1.1  leo 	sc->sc_copytodesc   = am7990_copytobuf_contig;
    331  1.1  leo 	sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
    332  1.1  leo 	sc->sc_copytobuf    = am7990_copytobuf_contig;
    333  1.1  leo 	sc->sc_copyfrombuf  = am7990_copyfrombuf_contig;
    334  1.1  leo 	sc->sc_zerobuf      = am7990_zerobuf_contig;
    335  1.1  leo 
    336  1.1  leo 	sc->sc_rdcsr   = lerdcsr;
    337  1.1  leo 	sc->sc_wrcsr   = lewrcsr;
    338  1.1  leo 	sc->sc_hwinit  = NULL;
    339  1.1  leo 	sc->sc_conf3   = LE_C3_BSWP;
    340  1.1  leo 	sc->sc_addr    = 0;
    341  1.1  leo 	sc->sc_memsize = va->va_msize;
    342  1.1  leo 	sc->sc_mem     = (void *)memh; /* XXX */
    343  1.1  leo 
    344  1.1  leo 	/*
    345  1.1  leo 	 * Get MAC address
    346  1.1  leo 	 */
    347  1.1  leo 	switch (lesc->sc_type) {
    348  1.1  leo 	    case LE_OLD_RIEBL:
    349  1.1  leo 		bcopy(riebl_def_mac, sc->sc_arpcom.ac_enaddr,
    350  1.1  leo 					sizeof(sc->sc_arpcom.ac_enaddr));
    351  1.1  leo 		break;
    352  1.1  leo 	    case LE_NEW_RIEBL:
    353  1.1  leo 		for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++)
    354  1.1  leo 		    sc->sc_arpcom.ac_enaddr[i] =
    355  1.1  leo 			bus_space_read_1(va->va_memt, memh, i + RIEBL_MAC_ADDR);
    356  1.1  leo 			break;
    357  1.1  leo 	    case LE_PAM:
    358  1.1  leo 		i = bus_space_read_1(va->va_iot, ioh, LER_EEPROM);
    359  1.1  leo 		for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) {
    360  1.1  leo 		    sc->sc_arpcom.ac_enaddr[i] =
    361  1.1  leo 			(bus_space_read_2(va->va_memt, memh, 2 * i) << 4) |
    362  1.1  leo 			(bus_space_read_2(va->va_memt, memh, 2 * i + 1) & 0xf);
    363  1.1  leo 		}
    364  1.1  leo 		i = bus_space_read_1(va->va_iot, ioh, LER_MEME);
    365  1.1  leo 		break;
    366  1.1  leo 	}
    367  1.1  leo 
    368  1.1  leo 	am7990_config(sc);
    369  1.1  leo 
    370  1.1  leo 	if ((lesc->sc_type == LE_OLD_RIEBL) || (lesc->sc_type == LE_NEW_RIEBL))
    371  1.1  leo 		riebl_skip_reserved_area(sc);
    372  1.1  leo 
    373  1.1  leo 	/*
    374  1.1  leo 	 * XXX: We always use uservector 64....
    375  1.1  leo 	 */
    376  1.1  leo 	if ((lesc->sc_intr = intr_establish(64, USER_VEC, 0,
    377  1.1  leo 				(hw_ifun_t)le_intr, lesc)) == NULL) {
    378  1.1  leo 		printf("le_vme_attach: Can't establish interrupt\n");
    379  1.1  leo 		return;
    380  1.1  leo 	}
    381  1.1  leo 
    382  1.1  leo 	/*
    383  1.1  leo 	 * Notify the card of the vector
    384  1.1  leo 	 */
    385  1.1  leo 	switch (lesc->sc_type) {
    386  1.1  leo 		case LE_OLD_RIEBL:
    387  1.1  leo 		case LE_NEW_RIEBL:
    388  1.1  leo 			bus_space_write_2(va->va_memt, memh, RIEBL_IVEC_ADDR,
    389  1.1  leo 								64 + 64);
    390  1.1  leo 			break;
    391  1.1  leo 		case LE_PAM:
    392  1.1  leo 			bus_space_write_1(va->va_iot, ioh, LER_IVEC, 64 + 64);
    393  1.1  leo 			break;
    394  1.1  leo 	}
    395  1.1  leo 
    396  1.1  leo 	/*
    397  1.1  leo 	 * Unmask the VME-interrupt we're on
    398  1.1  leo 	 */
    399  1.1  leo 	if (machineid & ATARI_TT)
    400  1.1  leo 		SCU->vme_mask |= 1 << va->va_irq;
    401  1.1  leo }
    402  1.1  leo 
    403  1.1  leo /*
    404  1.1  leo  * True if 'addr' containe within [start,len]
    405  1.1  leo  */
    406  1.1  leo #define WITHIN(start, len, addr)	\
    407  1.1  leo 		((addr >= start) && ((addr) <= ((start) + (len))))
    408  1.1  leo static void
    409  1.1  leo riebl_skip_reserved_area(sc)
    410  1.1  leo 	struct am7990_softc	*sc;
    411  1.1  leo {
    412  1.1  leo 	int	offset = 0;
    413  1.1  leo 	int	i;
    414  1.1  leo 
    415  1.1  leo 	for(i = 0; i < sc->sc_nrbuf; i++) {
    416  1.1  leo 		if (WITHIN(sc->sc_rbufaddr[i], LEBLEN, RIEBL_RES_START)
    417  1.1  leo 		    || WITHIN(sc->sc_rbufaddr[i], LEBLEN, RIEBL_RES_END)) {
    418  1.1  leo 			offset = RIEBL_RES_END - sc->sc_rbufaddr[i];
    419  1.1  leo 		}
    420  1.1  leo 		sc->sc_rbufaddr[i] += offset;
    421  1.1  leo 	}
    422  1.1  leo 
    423  1.1  leo 	for(i = 0; i < sc->sc_ntbuf; i++) {
    424  1.1  leo 		if (WITHIN(sc->sc_tbufaddr[i], LEBLEN, RIEBL_RES_START)
    425  1.1  leo 		    || WITHIN(sc->sc_tbufaddr[i], LEBLEN, RIEBL_RES_END)) {
    426  1.1  leo 			offset = RIEBL_RES_END - sc->sc_tbufaddr[i];
    427  1.1  leo 		}
    428  1.1  leo 		sc->sc_tbufaddr[i] += offset;
    429  1.1  leo 	}
    430  1.1  leo }
    431