- Turn the sc_[tr]bufaddr fields into arrays of addresses instead of just

the base address. This allows for a more flexible layout of buffers
  in the Lance's memory.
- Add a new element 'sc_saved_csr0' to am7990_softc. It's value is or-ed
  with the current csr0 value in the am7990_intr() function. This allowes
  for a 'deferred' interrupt sceme.
This commit is contained in:
leo 1997-03-09 21:12:39 +00:00
parent 40cef5c5ce
commit 3d849b9429
3 changed files with 19 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7990.c,v 1.24 1996/12/06 21:54:00 pk Exp $ */
/* $NetBSD: am7990.c,v 1.25 1997/03/09 21:12:39 leo Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -143,7 +143,7 @@ void
am7990_config(sc)
struct am7990_softc *sc;
{
int mem;
int mem, i;
/* Make sure the chip is stopped. */
am7990_stop(sc);
@ -200,6 +200,10 @@ am7990_config(sc)
sc->sc_sh = shutdownhook_establish(am7990_shutdown, sc);
if (sc->sc_sh == NULL)
panic("am7990_config: can't establish shutdownhook");
sc->sc_rbufaddr = malloc(sc->sc_nrbuf * sizeof(int), M_DEVBUF,
M_WAITOK);
sc->sc_tbufaddr = malloc(sc->sc_ntbuf * sizeof(int), M_DEVBUF,
M_WAITOK);
mem = 0;
sc->sc_initaddr = mem;
@ -208,10 +212,10 @@ am7990_config(sc)
mem += sizeof(struct lermd) * sc->sc_nrbuf;
sc->sc_tmdaddr = mem;
mem += sizeof(struct letmd) * sc->sc_ntbuf;
sc->sc_rbufaddr = mem;
mem += LEBLEN * sc->sc_nrbuf;
sc->sc_tbufaddr = mem;
mem += LEBLEN * sc->sc_ntbuf;
for (i = 0; i < sc->sc_nrbuf; i++, mem += LEBLEN)
sc->sc_rbufaddr[i] = mem;
for (i = 0; i < sc->sc_ntbuf; i++, mem += LEBLEN)
sc->sc_tbufaddr[i] = mem;
#ifdef notyet
if (mem > ...)
panic(...);
@ -677,7 +681,8 @@ am7990_intr(arg)
register struct am7990_softc *sc = arg;
register u_int16_t isr;
isr = (*sc->sc_rdcsr)(sc, LE_CSR0);
isr = (*sc->sc_rdcsr)(sc, LE_CSR0) | sc->sc_saved_csr0;
sc->sc_saved_csr0 = 0;
#ifdef LEDEBUG
if (sc->sc_debug)
printf("%s: am7990_intr entering with isr=%04x\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7990reg.h,v 1.1 1995/04/11 04:17:50 mycroft Exp $ */
/* $NetBSD: am7990reg.h,v 1.2 1997/03/09 21:12:41 leo Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -91,8 +91,8 @@ struct leinit {
#define LE_INITADDR(sc) (sc->sc_initaddr)
#define LE_RMDADDR(sc, bix) (sc->sc_rmdaddr + sizeof(struct lermd) * (bix))
#define LE_TMDADDR(sc, bix) (sc->sc_tmdaddr + sizeof(struct letmd) * (bix))
#define LE_RBUFADDR(sc, bix) (sc->sc_rbufaddr + LEBLEN * (bix))
#define LE_TBUFADDR(sc, bix) (sc->sc_tbufaddr + LEBLEN * (bix))
#define LE_RBUFADDR(sc, bix) (sc->sc_rbufaddr[bix])
#define LE_TBUFADDR(sc, bix) (sc->sc_tbufaddr[bix])
/* register addresses */
#define LE_CSR0 0x0000 /* Control and status register */

View File

@ -1,4 +1,4 @@
/* $NetBSD: am7990var.h,v 1.9 1997/01/15 18:24:40 gwr Exp $ */
/* $NetBSD: am7990var.h,v 1.10 1997/03/09 21:12:42 leo Exp $ */
/*
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -89,7 +89,7 @@ struct am7990_softc {
void *sc_sh; /* shutdownhook cookie */
u_int16_t sc_conf3; /* CSR3 value */
u_int16_t sc_pad1; /* be nice to m68k ports */
u_int16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
void *sc_mem; /* base address of RAM -- CPU's view */
u_long sc_addr; /* base address of RAM -- LANCE's view */
@ -104,8 +104,8 @@ struct am7990_softc {
int sc_initaddr;
int sc_rmdaddr;
int sc_tmdaddr;
int sc_rbufaddr;
int sc_tbufaddr;
int *sc_rbufaddr;
int *sc_tbufaddr;
#ifdef LEDEBUG
int sc_debug;