Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Don't panic if the memory size is "weird", but in...



details:   https://anonhg.NetBSD.org/src/rev/78db5073c5b6
branches:  trunk
changeset: 509147:78db5073c5b6
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Apr 27 17:08:02 2001 +0000

description:
Don't panic if the memory size is "weird", but instead compute
reasonable transmit/receive buffer count.
This is needed for e.g. SKNET adapters, which use top 30 bytes of 16KB
memory to map registers and PROM and hence not all the memory is
available for buffers.

diffstat:

 sys/dev/ic/lance.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 3f319bca74cb -r 78db5073c5b6 sys/dev/ic/lance.c
--- a/sys/dev/ic/lance.c        Fri Apr 27 17:04:39 2001 +0000
+++ b/sys/dev/ic/lance.c        Fri Apr 27 17:08:02 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lance.c,v 1.17 2000/12/14 06:27:25 thorpej Exp $       */
+/*     $NetBSD: lance.c,v 1.18 2001/04/27 17:08:02 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -210,7 +210,7 @@
 lance_config(sc)
        struct lance_softc *sc;
 {
-       int i;
+       int i, nbuf;
 
        /* Make sure the chip is stopped. */
        lance_stop(sc);
@@ -266,7 +266,10 @@
                sc->sc_ntbuf = 32;
                break;
        default:
-               panic("lance_config: weird memory size");
+               /* weird memory size; cope with it */
+               nbuf = sc->sc_memsize / LEBLEN;
+               sc->sc_ntbuf = nbuf / 5;
+               sc->sc_nrbuf = nbuf - sc->sc_ntbuf;
        }
 
        printf(": address %s\n", ether_sprintf(sc->sc_enaddr));



Home | Main Index | Thread Index | Old Index