NetBSD Problem Report #8443

Received: (qmail 10908 invoked from network); 19 Sep 1999 06:31:02 -0000
Message-Id: <199909190631.XAA14889@nooksack.ldc.cs.wwu.edu>
Date: Sat, 18 Sep 1999 23:31:10 -0700 (PDT)
From: mer@interlink.or.jp
Reply-To: mer@interlink.or.jp
To: gnats-bugs@gnats.netbsd.org
Subject: Some isapnp devices are not activated.
X-Send-Pr-Version: www-1.0

>Number:         8443
>Category:       kern
>Synopsis:       Some isapnp devices are not activated.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 18 23:35:01 +0000 1999
>Closed-Date:    Fri May 21 21:37:16 +0000 2021
>Last-Modified:  Fri May 21 21:37:16 +0000 2021
>Originator:     YAMANO-UCHI, Hidetoshi
>Release:        1.4.1
>Organization:
>Environment:
NetBSD printemps 1.4.1 NetBSD 1.4.1 (PRINTEMPS_OPTI) #7: Sun Sep 19 13:18:33 JST 1999     mer@printemps:/usr/src/sys/arch/i386/compile/PRINTEMPS_OPTI i386

>Description:
Some isapnp devices are not activate in NetBSD-1.4.1.
The specs. on isapnp said that isapnp devices are activated
AFTER sending WAIT_FOR_KEY.

And some isapnp devices are assigned duplicated DRQ
as follow.

wss1 at isapnp0 port 0x534/4,0x380/12,0x220/16,0xe0c/4 irq 5 drq 0,0

P.S.  PR:kern/7370 is obsoleted.  
P.S.2 This fix is not good.
>How-To-Repeat:


>Fix:
--- /sys/dev/isapnp/isapnp.c    Mon Mar 22 18:38:58 1999
+++ isapnp.c    Sun Sep 19 13:53:41 1999
@@ -106,6 +106,8 @@
        int i;
        u_char v = ISAPNP_LFSR_INIT;

+       isapnp_write_reg(sc, ISAPNP_CONFIG_CONTROL, ISAPNP_CC_WAIT_FOR_KEY);
+
        /* First write 0's twice to enter the Wait for Key state */
        ISAPNP_WRITE_ADDR(sc, 0);
        ISAPNP_WRITE_ADDR(sc, 0);
@@ -115,6 +117,7 @@
                ISAPNP_WRITE_ADDR(sc, v);
                v = ISAPNP_LFSR_NEXT(v);
        }
+       DELAY(2000);
 }


@@ -337,6 +340,12 @@
                error = isapnp_alloc_drq(ipa->ipa_ic, &ipa->ipa_drq[ndrq]);
                if (error)
                        goto bad;
+               {
+                 int b;
+
+                 for (b = ndrq + 1; b < ipa->ipa_ndrq; b++)
+                   ipa->ipa_drq[b].bits &= ~( 1 << ipa->ipa_drq[ndrq].num );
+               }
        }

        if (alloc)
@@ -721,6 +730,12 @@
                if (isapnp_findcard(sc))
                        break;
                isapnp_unmap_readport(sc);
+               /* Reset the cards */
+               isapnp_write_reg(sc, ISAPNP_CONFIG_CONTROL, ISAPNP_CC_RESET_DRV)
;
+               DELAY(2000);
+               /* Send the key again */
+               isapnp_init(sc);
+               DELAY(2000);
        }

        if (p > ISAPNP_RDDATA_MAX) {
@@ -970,6 +985,9 @@
        struct isapnp_attach_args *ipa, *lpa;
        int c, d;

+       int i = 0;
+       struct isapnp_attach_args lpa_array[20];
+
        /*
         * Look for cards.  If none are found, we say so and just return.
         */
@@ -981,12 +999,14 @@

        printf("%s: read port 0x%x\n", sc->sc_dev.dv_xname, sc->sc_read_port);

+        isapnp_init(sc);
        /*
         * Now configure all of the cards.
         */
        for (c = 0; c < sc->sc_ncards; c++) {
                /* Good morning card c */
                isapnp_write_reg(sc, ISAPNP_WAKE, c + 1);
+               DELAY(250);

                if ((ipa = isapnp_get_resource(sc, c)) == NULL)
                        continue;
@@ -994,7 +1014,14 @@
                DPRINTF(("Selecting attachments\n"));
                for (d = 0;
                    (lpa = isapnp_bestconfig(sc, &ipa)) != NULL; d++) {
-                       isapnp_write_reg(sc, ISAPNP_LOGICAL_DEV_NUM, d);
+                         isapnp_write_reg(sc, ISAPNP_WAKE, c + 1);
+                         isapnp_write_reg(sc, ISAPNP_LOGICAL_DEV_NUM, d);
+                         /* search apropreate device driver */
+                         if (config_search(isapnp_submatch, self, 
+                                           lpa) == NULL ) {
+                           isapnp_write_reg(sc, ISAPNP_ACTIVATE, 0);
+                           continue;
+                         }
                        isapnp_configure(sc, lpa);
 #ifdef DEBUG_ISAPNP
                        {
@@ -1024,11 +1051,23 @@
                        lpa->ipa_memt = sc->sc_memt;
                        lpa->ipa_dmat = sc->sc_dmat;

-                       isapnp_write_reg(sc, ISAPNP_ACTIVATE, 1);
 #ifdef _KERNEL
+#if 0
                        if (config_found_sm(self, lpa, isapnp_print,
-                           isapnp_submatch) == NULL)
-                               isapnp_write_reg(sc, ISAPNP_ACTIVATE, 0);
+                            isapnp_submatch) == NULL)
+#else
+                       {
+                         if (i<=20) {
+                           isapnp_write_reg(sc, ISAPNP_LOGICAL_DEV_NUM, d);
+                           isapnp_write_reg(sc, ISAPNP_IO_RANGE_CHECK, 0);
+                           DELAY(1000); /* XXX is it really necessary ? */
+                           isapnp_write_reg(sc, ISAPNP_ACTIVATE, 1);
+                           DELAY(1000); /* XXX is it really necessary ? */
+                           lpa_array[i] = *lpa;
+                           i++;
+                         }
+                       }
+#endif
 #else
                        isapnp_print(lpa, NULL);
                        printf("\n");
@@ -1037,4 +1076,11 @@
                }
                isapnp_write_reg(sc, ISAPNP_WAKE, 0);    /* Good night cards */
        }
+       isapnp_write_reg(sc, ISAPNP_CONFIG_CONTROL, ISAPNP_CC_WAIT_FOR_KEY);
+       DELAY(1000); /* XXX is it really necessary ? */
+#if 1
+       for(d=0;d<i;d++) {
+         config_found_sm(self, &lpa_array[d], isapnp_print, isapnp_submatch);
+       }
+#endif
 }


>Release-Note:
>Audit-Trail:

From: "Yamano-uchi, Hidetoshi" (=?ISO-2022-JP?B?GyRAOzNGYhsoSg==?=
	=?ISO-2022-JP?B?IBskQDFRSVIbKEo=?=) <mer@interlink.or.jp>
To: gnats-bugs@netbsd.org
Cc:  Subject: kern/8443
Date: Fri, 24 Sep 1999 00:23:26 +0900

 I found a typo in
 /*      $NetBSD: isapnpreg.h,v 1.7 1998/09/05 14:15:26 christos Exp $   */

 --- isapnpreg.h.dist	Sat Aug 14 22:29:49 1999
 +++ isapnpreg.h	Thu Sep 23 22:30:03 1999
 @@ -88,7 +88,7 @@
  #define		ISAPNP_MEM_LRANGE_15_8			0x4

  #define ISAPNP_NUM_IO					8
 -#define ISAPNP_IO_DESC { 0x60, 0x62, 0x64, 0x68, 0x6a, 0x6c, 0x6e }
 +#define ISAPNP_IO_DESC { 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e }
  #define		ISAPNP_IO_BASE_15_8			0x0
  #define		ISAPNP_IO_BASE_7_0			0x1

State-Changed-From-To: open->analyzed 
State-Changed-By: christos 
State-Changed-When: Thu Sep 23 12:14:14 EDT 1999 
State-Changed-Why:  
Applied, fix to the typo, but the IRQ stuff is not a good solution... We'll 
need to wait for the bios isapnp solution. 

State-Changed-From-To: analyzed->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 21 May 2021 21:37:16 +0000
State-Changed-Why:
christos applied the patch a long time ago, and today nobody cares if
the isapnp code is ugly (assuming it even still exists)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.