From 567448c8c71e025e9d339444a46c01b6fa20d3bd Mon Sep 17 00:00:00 2001 From: "Rodney W. Grimes" Date: Thu, 23 Mar 1995 09:00:20 +0000 Subject: [PATCH] Change MAX_SLOTS -> EISA_MAX_SLOTS and correct comments. Add this to ultra14f.c and eliminate constants. Correct EISA slot scan loops to look at slots 1 to 15 inclusive (off by 1 errors all over the place). Other drivers need this, I will get to it after a little more work. Correct the ultrastore EISA probe so that it starts after the last EISA slot probed instead of starting over from slot 0. We need an eisa.h to move a lot of common constants into. I will write it if someone tells me where it should go (sys/eisa?). --- sys/i386/eisa/aha1742.c | 6 +++--- sys/i386/isa/aha1742.c | 6 +++--- sys/i386/isa/ultra14f.c | 29 +++++++++++++++++++---------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/sys/i386/eisa/aha1742.c b/sys/i386/eisa/aha1742.c index 9ef2fddbce98..1511eeb18647 100644 --- a/sys/i386/eisa/aha1742.c +++ b/sys/i386/eisa/aha1742.c @@ -14,7 +14,7 @@ * * commenced: Sun Sep 27 18:14:01 PDT 1992 * - * $Id: aha1742.c,v 1.27 1994/11/26 23:10:03 ats Exp $ + * $Id: aha1742.c,v 1.28 1995/03/23 07:31:07 gibbs Exp $ */ #include @@ -275,7 +275,7 @@ void ahbminphys(); struct ecb *ahb_ecb_phys_kv(); u_int32 ahb_adapter_info(); -#define MAX_SLOTS 16 /* XXX should this be 16?? Need EISA spec */ +#define EISA_MAX_SLOTS 16 /* XXX This should go into a comon header */ static ahb_slot = 0; /* slot last board was found in */ static ahb_unit = 0; int ahb_debug = 0; @@ -447,7 +447,7 @@ ahbprobe(dev) u_char byte1, byte2, byte3; ahb_slot++; - while (ahb_slot <= MAX_SLOTS) { + while (ahb_slot < EISA_MAX_SLOTS) { port = 0x1000 * ahb_slot; byte1 = inb(port + HID0); byte2 = inb(port + HID1); diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c index 9ef2fddbce98..1511eeb18647 100644 --- a/sys/i386/isa/aha1742.c +++ b/sys/i386/isa/aha1742.c @@ -14,7 +14,7 @@ * * commenced: Sun Sep 27 18:14:01 PDT 1992 * - * $Id: aha1742.c,v 1.27 1994/11/26 23:10:03 ats Exp $ + * $Id: aha1742.c,v 1.28 1995/03/23 07:31:07 gibbs Exp $ */ #include @@ -275,7 +275,7 @@ void ahbminphys(); struct ecb *ahb_ecb_phys_kv(); u_int32 ahb_adapter_info(); -#define MAX_SLOTS 16 /* XXX should this be 16?? Need EISA spec */ +#define EISA_MAX_SLOTS 16 /* XXX This should go into a comon header */ static ahb_slot = 0; /* slot last board was found in */ static ahb_unit = 0; int ahb_debug = 0; @@ -447,7 +447,7 @@ ahbprobe(dev) u_char byte1, byte2, byte3; ahb_slot++; - while (ahb_slot <= MAX_SLOTS) { + while (ahb_slot < EISA_MAX_SLOTS) { port = 0x1000 * ahb_slot; byte1 = inb(port + HID0); byte2 = inb(port + HID1); diff --git a/sys/i386/isa/ultra14f.c b/sys/i386/isa/ultra14f.c index f99098809f4a..9eb6ac107d02 100644 --- a/sys/i386/isa/ultra14f.c +++ b/sys/i386/isa/ultra14f.c @@ -22,7 +22,7 @@ * today: Fri Jun 2 17:21:03 EST 1994 * added 24F support ++sg * - * $Id: ultra14f.c,v 1.27 1995/01/07 23:23:40 ats Exp $ + * $Id: ultra14f.c,v 1.28 1995/03/16 18:12:06 bde Exp $ */ #include @@ -278,6 +278,8 @@ int uha24_init __P((int unit)); struct mscp *cheat; unsigned long int scratch; +#define EISA_MAX_SLOTS 16 /* XXX This should go into a comon header */ +static uha_slot = 0; /* slot last board was found in */ static uha_unit = 0; #define UHA_SHOWMSCPS 0x01 #define UHA_SHOWINTS 0x02 @@ -927,18 +929,19 @@ int unit; { unsigned char p0, p1, p2, p3, p5, p7; unsigned char id[7], rev, haid; - int slot, port, irq, i; + int port = 0, irq, i; int resetcount = 4000; struct uha_data *uha = uhadata[unit]; struct uha_reg *ur = uhareg[unit]; struct uha_bits *ub = uhabits[unit]; /* Search for the 24F's product ID */ - for (slot = 1; slot < 15; slot++) { + uha_slot++; + while (uha_slot < EISA_MAX_SLOTS) { /* * Prepare to use a 24F. */ - port = EISA_CONFIG | (slot << 12); + port = EISA_CONFIG | (uha_slot << 12); ur->id = port + 0x00; ur->type = port + 0x02; ur->ectl = port + 0x04; @@ -964,13 +967,18 @@ int unit; ub->abort_ack = U24_ABORT_ACK; ub->icm_ack = U24_ICM_ACK; - /* Make sure an EISA card is installed in this slot. */ + /* + * Make sure an EISA card is installed in this slot, + * and if it is make sure that the card is enabled. + */ outb(ur->id, 0xff); p0 = inb(ur->id); - if (p0 == 0xff || (p0 & 0x80) != 0) continue; - - /* It's EISA, so make sure the card is enabled. */ - if ((inb(ur->ectl) & EISA_DISABLE) == 0) continue; + if ((p0 == 0xff) || + ((p0 & 0x80) != 0) || + ((inb(ur->ectl) & EISA_DISABLE) == 0)) { + uha_slot++; + continue; + } /* Found an enabled card. Grab the product ID. */ p1 = inb(ur->id+1); @@ -987,8 +995,9 @@ int unit; /* We only want the 24F product ID. */ if (!strcmp(id, "USC024")) break; + uha_slot++; } - if (slot == 15) return(ENODEV); + if (uha_slot == EISA_MAX_SLOTS) return(ENODEV); /* We have the card! Grab remaining config. */ p5 = inb(ur->config);