2004-03-16 02:51:11 +03:00
|
|
|
/* $NetBSD: if_ie_obio.c,v 1.31 2004/03/15 23:51:12 pk Exp $ */
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Paul Kranenburg.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1995 Charles D. Cranor
|
|
|
|
* 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.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Charles D. Cranor.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sparc OBIO front-end for the Intel 82586 Ethernet driver
|
|
|
|
*
|
|
|
|
* Converted to SUN ie driver by Charles D. Cranor,
|
|
|
|
* October 1994, January 1995.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The i82586 is a very painful chip, found in sun3's, sun-4/100's
|
|
|
|
* sun-4/200's, and VME based suns. The byte order is all wrong for a
|
|
|
|
* SUN, making life difficult. Programming this chip is mostly the same,
|
|
|
|
* but certain details differ from system to system. This driver is
|
|
|
|
* written so that different "ie" interfaces can be controled by the same
|
|
|
|
* driver.
|
|
|
|
*/
|
|
|
|
|
2003-07-15 04:04:39 +04:00
|
|
|
#include <sys/cdefs.h>
|
2004-03-16 02:51:11 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: if_ie_obio.c,v 1.31 2004/03/15 23:51:12 pk Exp $");
|
2003-07-15 04:04:39 +04:00
|
|
|
|
1998-01-25 22:50:50 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/protosw.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <net/if_types.h>
|
|
|
|
#include <net/if_dl.h>
|
|
|
|
#include <net/if_media.h>
|
|
|
|
#include <net/if_ether.h>
|
|
|
|
|
2000-06-29 11:40:05 +04:00
|
|
|
#include <uvm/uvm_extern.h>
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
#include <machine/bus.h>
|
2000-07-10 00:57:41 +04:00
|
|
|
#include <machine/intr.h>
|
|
|
|
#include <machine/autoconf.h>
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
#include <dev/ic/i82586reg.h>
|
|
|
|
#include <dev/ic/i82586var.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the on-board interface
|
|
|
|
*/
|
|
|
|
struct ieob {
|
|
|
|
u_char obctrl;
|
|
|
|
};
|
|
|
|
#define IEOB_NORSET 0x80 /* don't reset the board */
|
|
|
|
#define IEOB_ONAIR 0x40 /* put us on the air */
|
|
|
|
#define IEOB_ATTEN 0x20 /* attention! */
|
|
|
|
#define IEOB_IENAB 0x10 /* interrupt enable */
|
|
|
|
#define IEOB_XXXXX 0x08 /* free bit */
|
|
|
|
#define IEOB_XCVRL2 0x04 /* level 2 transceiver? */
|
|
|
|
#define IEOB_BUSERR 0x02 /* bus error */
|
|
|
|
#define IEOB_INT 0x01 /* interrupt */
|
|
|
|
|
|
|
|
#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */
|
|
|
|
|
|
|
|
|
|
|
|
static void ie_obreset __P((struct ie_softc *, int));
|
2001-03-13 19:31:14 +03:00
|
|
|
static void ie_obattend __P((struct ie_softc *, int));
|
1998-01-25 22:50:50 +03:00
|
|
|
static void ie_obrun __P((struct ie_softc *));
|
|
|
|
|
|
|
|
int ie_obio_match __P((struct device *, struct cfdata *, void *));
|
|
|
|
void ie_obio_attach __P((struct device *, struct device *, void *));
|
|
|
|
|
2002-10-01 22:57:48 +04:00
|
|
|
CFATTACH_DECL(ie_obio, sizeof(struct ie_softc),
|
2002-10-02 20:02:08 +04:00
|
|
|
ie_obio_match, ie_obio_attach, NULL, NULL);
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
/* Supported media */
|
|
|
|
static int media[] = {
|
|
|
|
IFM_ETHER | IFM_10_2,
|
|
|
|
};
|
|
|
|
#define NMEDIA (sizeof(media) / sizeof(media[0]))
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OBIO ie support routines
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ie_obreset(sc, what)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
{
|
|
|
|
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
|
|
|
ieo->obctrl = 0;
|
|
|
|
delay(100); /* XXX could be shorter? */
|
|
|
|
ieo->obctrl = IEOB_NORSET;
|
|
|
|
}
|
|
|
|
void
|
2001-03-13 19:31:14 +03:00
|
|
|
ie_obattend(sc, why)
|
1998-01-25 22:50:50 +03:00
|
|
|
struct ie_softc *sc;
|
2001-03-13 19:31:14 +03:00
|
|
|
int why;
|
1998-01-25 22:50:50 +03:00
|
|
|
{
|
|
|
|
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
|
|
|
|
|
|
|
ieo->obctrl |= IEOB_ATTEN; /* flag! */
|
|
|
|
ieo->obctrl &= ~IEOB_ATTEN; /* down. */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ie_obrun(sc)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
{
|
|
|
|
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
|
|
|
|
|
|
|
ieo->obctrl |= (IEOB_ONAIR|IEOB_IENAB|IEOB_NORSET);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ie_obio_memcopyin __P((struct ie_softc *, void *, int, size_t));
|
|
|
|
void ie_obio_memcopyout __P((struct ie_softc *, const void *, int, size_t));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy board memory to kernel.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ie_obio_memcopyin(sc, p, offset, size)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
void *p;
|
|
|
|
int offset;
|
|
|
|
size_t size;
|
|
|
|
{
|
|
|
|
void *addr = (void *)((u_long)sc->bh + offset);/*XXX - not MI!*/
|
|
|
|
wcopy(addr, p, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy from kernel space to naord memory.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ie_obio_memcopyout(sc, p, offset, size)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
const void *p;
|
|
|
|
int offset;
|
|
|
|
size_t size;
|
|
|
|
{
|
|
|
|
void *addr = (void *)((u_long)sc->bh + offset);/*XXX - not MI!*/
|
|
|
|
wcopy(p, addr, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read a 16-bit value at BH offset */
|
|
|
|
u_int16_t ie_obio_read16 __P((struct ie_softc *, int offset));
|
|
|
|
/* write a 16-bit value at BH offset */
|
|
|
|
void ie_obio_write16 __P((struct ie_softc *, int offset, u_int16_t value));
|
|
|
|
void ie_obio_write24 __P((struct ie_softc *, int offset, int addr));
|
|
|
|
|
|
|
|
u_int16_t
|
|
|
|
ie_obio_read16(sc, offset)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
int offset;
|
|
|
|
{
|
|
|
|
u_int16_t v = bus_space_read_2(sc->bt, sc->bh, offset);
|
|
|
|
return (((v&0xff)<<8) | ((v>>8)&0xff));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ie_obio_write16(sc, offset, v)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
int offset;
|
|
|
|
u_int16_t v;
|
|
|
|
{
|
|
|
|
v = (((v&0xff)<<8) | ((v>>8)&0xff));
|
|
|
|
bus_space_write_2(sc->bt, sc->bh, offset, v);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ie_obio_write24(sc, offset, addr)
|
|
|
|
struct ie_softc *sc;
|
|
|
|
int offset;
|
|
|
|
int addr;
|
|
|
|
{
|
1999-03-19 00:33:14 +03:00
|
|
|
u_char *f = (u_char *)&addr;
|
|
|
|
u_int16_t v0, v1;
|
|
|
|
u_char *t;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1999-03-19 00:33:14 +03:00
|
|
|
t = (u_char *)&v0;
|
|
|
|
t[0] = f[3]; t[1] = f[2];
|
|
|
|
bus_space_write_2(sc->bt, sc->bh, offset, v0);
|
|
|
|
|
|
|
|
t = (u_char *)&v1;
|
|
|
|
t[0] = f[1]; t[1] = 0;
|
|
|
|
bus_space_write_2(sc->bt, sc->bh, offset+2, v1);
|
1998-01-25 22:50:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ie_obio_match(parent, cf, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *cf;
|
|
|
|
void *aux;
|
|
|
|
{
|
1998-03-21 23:11:30 +03:00
|
|
|
union obio_attach_args *uoba = aux;
|
|
|
|
struct obio4_attach_args *oba;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1998-03-21 23:11:30 +03:00
|
|
|
if (uoba->uoba_isobio4 == 0)
|
1998-01-25 22:50:50 +03:00
|
|
|
return (0);
|
|
|
|
|
1998-03-21 23:11:30 +03:00
|
|
|
oba = &uoba->uoba_oba4;
|
2002-03-11 19:27:01 +03:00
|
|
|
return (bus_space_probe(oba->oba_bustag, oba->oba_paddr,
|
1998-03-30 02:10:32 +04:00
|
|
|
1, /* probe size */
|
|
|
|
0, /* offset */
|
|
|
|
0, /* flags */
|
|
|
|
NULL, NULL));
|
1998-01-25 22:50:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ie_obio_attach(parent, self, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1998-03-21 23:11:30 +03:00
|
|
|
union obio_attach_args *uoba = aux;
|
|
|
|
struct obio4_attach_args *oba = &uoba->uoba_oba4;
|
1998-01-25 22:50:50 +03:00
|
|
|
struct ie_softc *sc = (void *) self;
|
2000-05-10 02:42:08 +04:00
|
|
|
bus_dma_tag_t dmatag = oba->oba_dmatag;
|
1998-03-21 23:11:30 +03:00
|
|
|
bus_space_handle_t bh;
|
1998-08-23 14:04:56 +04:00
|
|
|
bus_dma_segment_t seg;
|
|
|
|
int rseg;
|
2000-05-10 02:42:08 +04:00
|
|
|
int error;
|
1998-08-21 18:07:37 +04:00
|
|
|
paddr_t pa;
|
1998-03-21 23:11:30 +03:00
|
|
|
struct intrhand *ih;
|
2000-05-10 02:42:08 +04:00
|
|
|
bus_size_t msize;
|
1999-03-19 00:33:14 +03:00
|
|
|
u_long iebase;
|
1998-03-21 23:11:30 +03:00
|
|
|
u_int8_t myaddr[ETHER_ADDR_LEN];
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1998-08-23 14:04:56 +04:00
|
|
|
sc->bt = oba->oba_bustag;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
sc->hwreset = ie_obreset;
|
|
|
|
sc->chan_attn = ie_obattend;
|
|
|
|
sc->hwinit = ie_obrun;
|
|
|
|
sc->memcopyout = ie_obio_memcopyout;
|
|
|
|
sc->memcopyin = ie_obio_memcopyin;
|
2001-01-23 01:28:43 +03:00
|
|
|
|
|
|
|
sc->ie_bus_barrier = NULL;
|
1998-01-25 22:50:50 +03:00
|
|
|
sc->ie_bus_read16 = ie_obio_read16;
|
|
|
|
sc->ie_bus_write16 = ie_obio_write16;
|
|
|
|
sc->ie_bus_write24 = ie_obio_write24;
|
2000-05-10 02:42:08 +04:00
|
|
|
sc->sc_msize = msize = 65536; /* XXX */
|
1998-01-25 22:50:50 +03:00
|
|
|
|
2002-03-11 19:27:01 +03:00
|
|
|
if (bus_space_map(oba->oba_bustag, oba->oba_paddr,
|
|
|
|
sizeof(struct ieob),
|
|
|
|
BUS_SPACE_MAP_LINEAR,
|
|
|
|
&bh) != 0) {
|
1998-03-21 23:11:30 +03:00
|
|
|
printf("%s: cannot map registers\n", self->dv_xname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sc->sc_reg = (void *)bh;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
|
|
|
/*
|
1998-08-23 14:04:56 +04:00
|
|
|
* Allocate control & buffer memory.
|
1998-01-25 22:50:50 +03:00
|
|
|
*/
|
2000-06-15 16:12:05 +04:00
|
|
|
if ((error = bus_dmamap_create(dmatag, msize, 1, msize, 0,
|
2000-05-10 02:42:08 +04:00
|
|
|
BUS_DMA_NOWAIT|BUS_DMA_24BIT,
|
|
|
|
&sc->sc_dmamap)) != 0) {
|
|
|
|
printf("%s: DMA map create error %d\n",
|
|
|
|
sc->sc_dev.dv_xname, error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((error = bus_dmamem_alloc(dmatag, msize, 64*1024, 0,
|
1998-08-23 14:04:56 +04:00
|
|
|
&seg, 1, &rseg,
|
2000-05-10 02:42:08 +04:00
|
|
|
BUS_DMA_NOWAIT | BUS_DMA_24BIT)) != 0) {
|
|
|
|
printf("%s: DMA memory allocation error %d\n",
|
|
|
|
self->dv_xname, error);
|
1998-08-23 14:04:56 +04:00
|
|
|
return;
|
|
|
|
}
|
2000-05-10 02:42:08 +04:00
|
|
|
|
|
|
|
/* Map DMA buffer in CPU addressable space */
|
|
|
|
if ((error = bus_dmamem_map(dmatag, &seg, rseg, msize,
|
|
|
|
(caddr_t *)&sc->sc_maddr,
|
|
|
|
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
|
|
|
|
printf("%s: DMA buffer map error %d\n",
|
|
|
|
sc->sc_dev.dv_xname, error);
|
|
|
|
bus_dmamem_free(dmatag, &seg, rseg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load the segment */
|
2001-03-08 04:38:57 +03:00
|
|
|
if ((error = bus_dmamap_load(dmatag, sc->sc_dmamap,
|
2001-03-08 04:46:18 +03:00
|
|
|
sc->sc_maddr, msize, NULL,
|
2001-03-08 04:38:57 +03:00
|
|
|
BUS_DMA_NOWAIT)) != 0) {
|
2000-05-10 02:42:08 +04:00
|
|
|
printf("%s: DMA buffer map load error %d\n",
|
|
|
|
sc->sc_dev.dv_xname, error);
|
|
|
|
bus_dmamem_unmap(dmatag, sc->sc_maddr, msize);
|
|
|
|
bus_dmamem_free(dmatag, &seg, rseg);
|
1998-08-23 14:04:56 +04:00
|
|
|
return;
|
|
|
|
}
|
1998-01-25 22:50:50 +03:00
|
|
|
|
2000-05-10 02:42:08 +04:00
|
|
|
wzero(sc->sc_maddr, msize);
|
1998-01-25 22:50:50 +03:00
|
|
|
sc->bh = (bus_space_handle_t)(sc->sc_maddr);
|
|
|
|
|
|
|
|
/*
|
1998-03-23 01:12:52 +03:00
|
|
|
* The i82586's 24-bit address space maps to the last 16MB of
|
|
|
|
* KVA space (). In addition, the SCP must appear
|
|
|
|
* at IE_SCP_ADDR within the 24-bit address space,
|
|
|
|
* i.e. at KVA IEOB_ADBASE+IE_SCP_ADDR, at the very top of
|
|
|
|
* kernel space. We double-map this last page to the first
|
|
|
|
* page (starting at `maddr') of the memory we allocate to the chip.
|
|
|
|
* (a side-effect of this double-map is that the ISCP and SCB
|
|
|
|
* structures also get aliased there, but we ignore this). The
|
|
|
|
* first page at `maddr' is only used for ISCP, SCB and the aliased
|
2003-04-02 08:35:22 +04:00
|
|
|
* SCP; the actual buffers start at maddr+PAGE_SIZE.
|
1998-03-23 01:12:52 +03:00
|
|
|
*
|
|
|
|
* In a picture:
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1998-03-21 23:11:30 +03:00
|
|
|
|---//--- ISCP-SCB-----scp-|--//- buffers -//-|... |iscp-scb-----SCP-|
|
1998-03-23 01:12:52 +03:00
|
|
|
| | | | | | |
|
2003-04-02 08:35:22 +04:00
|
|
|
| |<---PAGE_SIZE-->| | |<--PAGE_SIZE-+-->|
|
1998-03-23 01:12:52 +03:00
|
|
|
| |<------------- msize ------------->| | ^ |
|
|
|
|
| | | |
|
1998-03-21 23:11:30 +03:00
|
|
|
| \@maddr (last page dbl mapped)
|
1998-03-23 01:12:52 +03:00
|
|
|
| |
|
|
|
|
\@IEOB_ADBASE @IEOB_ADBASE+IE_SCP_ADDR-+
|
|
|
|
|
|
|
|
*
|
|
|
|
*/
|
1998-03-21 23:11:30 +03:00
|
|
|
|
1998-08-23 14:04:56 +04:00
|
|
|
/* Double map the SCP */
|
1999-07-08 22:05:21 +04:00
|
|
|
if (pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr, &pa) == FALSE)
|
1998-01-25 22:50:50 +03:00
|
|
|
panic("ie pmap_extract");
|
|
|
|
|
|
|
|
pmap_enter(pmap_kernel(), trunc_page(IEOB_ADBASE+IE_SCP_ADDR),
|
1999-03-27 02:41:25 +03:00
|
|
|
pa | PMAP_NC /*| PMAP_IOC*/,
|
1999-11-13 03:30:26 +03:00
|
|
|
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
|
2001-09-11 01:19:08 +04:00
|
|
|
pmap_update(pmap_kernel());
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1998-08-23 14:04:56 +04:00
|
|
|
/* Map iscp at location 0 (relative to `maddr') */
|
1998-03-23 01:12:52 +03:00
|
|
|
sc->iscp = 0;
|
|
|
|
|
|
|
|
/* scb follows iscp */
|
|
|
|
sc->scb = IE_ISCP_SZ;
|
|
|
|
|
1999-03-19 00:33:14 +03:00
|
|
|
/* scp is at the fixed location IE_SCP_ADDR (modulo the page size) */
|
|
|
|
sc->scp = IE_SCP_ADDR & PGOFSET;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1999-03-19 00:33:14 +03:00
|
|
|
/* Calculate the 24-bit base of i82586 operations */
|
2000-05-10 02:42:08 +04:00
|
|
|
iebase = (u_long)sc->sc_dmamap->dm_segs[0].ds_addr -
|
|
|
|
(u_long)IEOB_ADBASE;
|
1998-08-23 14:04:56 +04:00
|
|
|
ie_obio_write16(sc, IE_ISCP_SCB(sc->iscp), sc->scb);
|
1999-03-19 00:33:14 +03:00
|
|
|
ie_obio_write24(sc, IE_ISCP_BASE(sc->iscp), iebase);
|
|
|
|
ie_obio_write24(sc, IE_SCP_ISCP(sc->scp), iebase + sc->iscp);
|
1998-03-23 01:12:52 +03:00
|
|
|
|
1998-01-25 22:50:50 +03:00
|
|
|
/*
|
1999-03-19 00:33:14 +03:00
|
|
|
* Rest of first page is unused (wasted!); the other pages
|
|
|
|
* are used for buffers.
|
1998-01-25 22:50:50 +03:00
|
|
|
*/
|
2003-04-02 08:35:22 +04:00
|
|
|
sc->buf_area = PAGE_SIZE;
|
|
|
|
sc->buf_area_sz = msize - PAGE_SIZE;
|
1998-01-25 22:50:50 +03:00
|
|
|
|
1999-03-19 00:33:14 +03:00
|
|
|
if (i82586_proberam(sc) == 0) {
|
|
|
|
printf(": memory probe failed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-16 02:51:11 +03:00
|
|
|
prom_getether(0, myaddr);
|
1998-01-25 22:50:50 +03:00
|
|
|
i82586_attach(sc, "onboard", myaddr, media, NMEDIA, media[0]);
|
|
|
|
|
1998-03-21 23:11:30 +03:00
|
|
|
/* Establish interrupt channel */
|
|
|
|
ih = bus_intr_establish(oba->oba_bustag,
|
2002-12-10 16:44:47 +03:00
|
|
|
oba->oba_pri, IPL_NET,
|
1998-03-21 23:11:30 +03:00
|
|
|
i82586_intr, sc);
|
1998-01-25 22:50:50 +03:00
|
|
|
}
|