Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Fix some off-by-one errors; patch from Jonathan...



details:   https://anonhg.NetBSD.org/src/rev/3702f7a6888e
branches:  trunk
changeset: 482812:3702f7a6888e
user:      pk <pk%NetBSD.org@localhost>
date:      Tue Feb 22 12:12:21 2000 +0000

description:
Fix some off-by-one errors; patch from Jonathan O'Brien.

diffstat:

 sys/dev/sbus/stp4020.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r ea40b3d0f7dd -r 3702f7a6888e sys/dev/sbus/stp4020.c
--- a/sys/dev/sbus/stp4020.c    Tue Feb 22 11:40:20 2000 +0000
+++ b/sys/dev/sbus/stp4020.c    Tue Feb 22 12:12:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stp4020.c,v 1.8 2000/01/13 10:03:25 joda Exp $ */
+/*     $NetBSD: stp4020.c,v 1.9 2000/02/22 12:12:21 pk Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -281,7 +281,7 @@
        sc->sc_socks[0].sc = sc->sc_socks[1].sc = sc;
        sc->sc_socks[0].tag = sc->sc_socks[1].tag = sa->sa_bustag;
 
-       if (sa->sa_nreg < 7) {
+       if (sa->sa_nreg < 8) {
                printf("%s: only %d register sets\n",
                        self->dv_xname, sa->sa_nreg);
                return;
@@ -293,6 +293,7 @@
                return;
        }
 
+#define STP4020_BANK_PROM      0
 #define STP4020_BANK_CTRL      4
        for (i = 0; i < 8; i++) {
                int s, w;
@@ -303,6 +304,10 @@
                 *      bank  4:   control registers
                 *      banks 5-7: socket 1, windows 0-2
                 */
+               if (i == STP4020_BANK_PROM)
+                       /* Skip the PROM */
+                       continue;
+
                if (i == STP4020_BANK_CTRL) {
                        if (sbus_bus_map(sa->sa_bustag,
                                         sa->sa_reg[i].sbr_slot,
@@ -319,12 +324,13 @@
                         * for easy access in control/status IO functions.
                         */
                        sc->sc_socks[0].regs = sc->sc_socks[1].regs = bh;
+                       continue;
                }
 
                if (i < STP4020_BANK_CTRL)
-                       s = 0, w = i;           /* banks 0-2 */
+                       s = 0, w = i - 1;               /* banks 1-3 */
                else
-                       s = 1, w = i - 4;       /* banks 4-6 */
+                       s = 1, w = i - 5;               /* banks 5-7 */
 
                if (sbus_bus_map(sa->sa_bustag,
                                 sa->sa_reg[i].sbr_slot,
@@ -396,6 +402,7 @@
        h->winalloc = 0;
 
        /* Configure one pcmcia device per socket */
+       paa.paa_busname = "pcmcia";
        paa.pct = (pcmcia_chipset_tag_t)h->sc->sc_pct;
        paa.pch = (pcmcia_chipset_handle_t)h;
        paa.iobase = 0;



Home | Main Index | Thread Index | Old Index