NetBSD Problem Report #3753

Received: (qmail 851 invoked from network); 16 Jun 1997 16:53:25 -0000
Message-Id: <199706161652.TAA13384@tuhnu.cute.fi>
Date: Mon, 16 Jun 1997 19:52:20 +0300 (EET DST)
From: Jarkko Torppa <torppa@cute.fi>
Reply-To: torppa@cute.fi
To: gnats-bugs@gnats.netbsd.org
Subject: cyclades driver is broken
X-Send-Pr-Version: 3.95

>Number:         3753
>Category:       kern
>Synopsis:       cyclades driver is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 16 10:05:02 +0000 1997
>Closed-Date:    Sat Jul 05 05:32:42 +0000 1997
>Last-Modified:  Sat Jul 05 05:33:06 +0000 1997
>Originator:     Jarkko Torppa
>Release:        NetBSD1.2D
>Organization:
 Jarkko.Torppa@cute.fi     +358-9-34871220         Cute Communications Oy
>Environment:
NetBSD spotty.cute.fi 1.2D NetBSD 1.2D (SPOTTY) #20: Mon Jun 16 03:26:58 EEST 1997     root@spotty.cute.fi:/mnt/src/sys/arch/i386/compile/SPOTTY i386


>Description:
cy driver has the following bugs/problems:
 it doesnt like pci cards of type PCI_MAPREG_MEM_TYPE_32BIT_1M
 it only probes first 16 ports on a 32 port card
 only the first 4 ports actually work
 tries to access non exisistent card when ports > 16 are tried
 it's internal counters (CY_DEBUG1) conflicts somehow with general 
  interrupt counters

After this patch some interrupts seem to go missed, but the ports do
work ok.

>How-To-Repeat:
 get a cyclades(32) and try
>Fix:
Apply the following patch in sys/dev current of today (970616) has
these files

diff -u -r cy.orig/ic/cy.c cy/ic/cy.c
--- cy.orig/ic/cy.c	Mon Jun 16 19:29:55 1997
+++ cy/ic/cy.c	Mon Jun 16 19:35:20 1997
@@ -98,7 +98,7 @@
 			chip -= (CY32_ADDR_FIX << bustype);

 #ifdef CY_DEBUG
-		printf("%s probe chip %d offset 0x%lx ... ",
+		printf("%s probe chip %d offset 0x%x ...\n",
 		    sc->sc_dev.dv_xname, cy_chip, chip);
 #endif

@@ -122,7 +122,7 @@
 	         * cleared chip 0 GFRCR. In that case we have a 16 port card.
 	         */
 		if (cy_chip == 4 &&
-		    bus_space_read_1(tag, bsh, chip +
+		    bus_space_read_1(tag, bsh,
 		       ((CD1400_GFRCR << 1) << bustype)) == 0)
 			break;

@@ -201,7 +201,7 @@

 		for (cdu = 0; cdu < CD1400_NO_OF_CHANNELS; cdu++) {
 			sc->sc_ports[port].cy_port_num = port;
-			sc->sc_ports[port].cy_chip = chip;
+			sc->sc_ports[port].cy_chip = cy_chip;

 			/* should we initialize anything else here? */
 			port++;
diff -u -r cy.orig/ic/cyvar.h cy/ic/cyvar.h
--- cy.orig/ic/cyvar.h	Mon Jun 16 19:30:01 1997
+++ cy/ic/cyvar.h	Mon Jun 16 19:35:25 1997
@@ -12,7 +12,7 @@
  */

 /* #define CY_DEBUG */
-#define CY_DEBUG1
+/* #define CY_DEBUG1 */

 /*
  * Maximum number of ports per card
@@ -32,7 +32,7 @@
  * card number in next 2 bits (only space for 4 cards)
  * high bit reserved for dialout flag
  */
-#define CY_PORT(x) (minor(x) & 0xf)
+#define CY_PORT(x) (minor(x) & 0x1f)
 #define CY_CARD(x) ((minor(x) >> 5) & 3)
 #define CY_DIALOUT(x) ((minor(x) & 0x80) != 0)
 #define CY_DIALIN(x) (!CY_DIALOUT(x))
diff -u -r cy.orig/pci/cy_pci.c cy/pci/cy_pci.c
--- cy.orig/pci/cy_pci.c	Mon Jun 16 19:30:20 1997
+++ cy/pci/cy_pci.c	Mon Jun 16 19:35:39 1997
@@ -53,7 +53,7 @@
 	    PCI_MAPREG_TYPE_IO, 0,
 	    iotp, iohp, NULL, iosizep) == 0);
 	memh_valid = (pci_mapreg_map(pap, 0x18,
-	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
+	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT | PCI_MAPREG_MEM_TYPE_32BIT_1M, 0,
 	    memtp, memhp, NULL, memsizep) == 0);

 	if (ioh_valid && memh_valid)
@@ -169,7 +169,7 @@
 	sc->sc_ih = pci_intr_establish(pap->pa_pc, intrhandle, IPL_TTY,
 	    cy_intr, sc);
 	if (sc->sc_ih == NULL) {
-		printf(": couldn't establish interrupt", sc->sc_dev.dv_xname);
+		printf("%s: couldn't establish interrupt", sc->sc_dev.dv_xname);
 		if (intrstr != NULL)
 			printf(" at %s", intrstr);
 		printf("\n");

>Release-Note:
>Audit-Trail:

From: "Chris G. Demetriou" <cgd@pa.dec.com>
To: torppa@cute.fi
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/3753: cyclades driver is broken 
Date: Mon, 16 Jun 97 10:18:11 -0700

 > cy driver has the following bugs/problems:
 >  it doesnt like pci cards of type PCI_MAPREG_MEM_TYPE_32BIT_1M
 > [ ... ]
 > --- cy.orig/pci/cy_pci.c	Mon Jun 16 19:30:20 1997
 > +++ cy/pci/cy_pci.c	Mon Jun 16 19:35:39 1997
 > @@ -53,7 +53,7 @@
 >  	    PCI_MAPREG_TYPE_IO, 0,
 >  	    iotp, iohp, NULL, iosizep) == 0);
 >  	memh_valid = (pci_mapreg_map(pap, 0x18,
 > -	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
 > +	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT | PCI_MAPREG_MEM_TYPE_32BIT_1M, 0,
 >  	    memtp, memhp, NULL, memsizep) == 0);
 >  
 >  	if (ioh_valid && memh_valid)

 That patch will cause the driver to work _only_ on the 32BIT_1M cards,
 i.e. it _won't_ work on the ones which can map their memory higher
 than 1MB.

 I _think_ the right solution is to or in that bit depending on the PCI
 device ID; could you verify that?


 chris



From: Jarkko Torppa <torppa@cute.fi>
To: "Chris G. Demetriou" <cgd@pa.dec.com>
Cc: torppa@cute.fi, gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/3753: cyclades driver is broken 
Date: Mon, 16 Jun 1997 23:17:03 +0300

 > That patch will cause the driver to work _only_ on the 32BIT_1M cards,
 > i.e. it _won't_ work on the ones which can map their memory higher
 > than 1MB.
 > 
 > I _think_ the right solution is to or in that bit depending on the PCI
 > device ID; could you verify that?
 > 

 I only have this one card I can test with, so I actually can't verify that 
 this works with both types but it at least works with my card.

 This is agains currents cy_pci.c

 --- /cute/torppa/cy-net/cy.orig/pci/cy_pci.c    Mon Jun 16 19:30:20 1997
 +++ cy_pci.c    Mon Jun 16 23:00:42 1997
 @@ -48,13 +48,19 @@
         bus_size_t              *iosizep, *memsizep;
  {
         int ioh_valid, memh_valid;
 +       pcireg_t pciregs;

         ioh_valid = (pci_mapreg_map(pap, 0x14,
 -           PCI_MAPREG_TYPE_IO, 0,
 -           iotp, iohp, NULL, iosizep) == 0);
 -       memh_valid = (pci_mapreg_map(pap, 0x18,
 -           PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
 -           memtp, memhp, NULL, memsizep) == 0);
 +                                   PCI_MAPREG_TYPE_IO, 0,
 +                                   iotp, iohp, NULL, iosizep) == 0);
 +
 +       pciregs = PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT;
 +
 +       if(PCI_PRODUCT(pap->pa_id) == PCI_PRODUCT_CYCLADES_CYCLOMY_1)
 +         pciregs |= PCI_MAPREG_MEM_TYPE_32BIT_1M;
 +
 +       memh_valid = (pci_mapreg_map(pap, 0x18,pciregs,0,memtp, memhp, NULL,
 +                                    memsizep) == 0);

         if (ioh_valid && memh_valid)
                 return (1);
 @@ -169,7 +175,7 @@
         sc->sc_ih = pci_intr_establish(pap->pa_pc, intrhandle, IPL_TTY,
             cy_intr, sc);
         if (sc->sc_ih == NULL) {
 -               printf(": couldn't establish interrupt", sc->sc_dev.dv_xname);
 +               printf("%s: couldn't establish interrupt", sc->sc_dev.dv_xname);
                 if (intrstr != NULL)
                         printf(" at %s", intrstr);
                 printf("\n");

 -- 
  Jarkko.Torppa@cute.fi     +358-9-34871220         Cute Communications Oy


State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Mon Jun 16 22:47:01 PDT 1997 
State-Changed-Why:  
fixes to cyvar.h (except for debugging enable) and cy.c applied.  fixes 
to cy_pci.c reworked a bit and applied.  they should be showing up in 
-current tomorrow, and if you could make sure they actually work for you 
i'd appreciate it. 

State-Changed-From-To: closed->open 
State-Changed-By: cgd 
State-Changed-When: Mon Jun 16 22:50:09 PDT 1997 
State-Changed-Why:  
reopened, because I don't understand what was meant by the CY_DEBUG1 
counters "conflict[ing] somehow" with the general interrupt counters. 

From: "Chris G. Demetriou" <cgd@pa.dec.com>
To: Jarkko Torppa <torppa@cute.fi>
Cc: "Chris G. Demetriou" <cgd@pa.dec.com>, gnats-bugs@gnats.netbsd.org
Subject: Re: kern/3753: cyclades driver is broken 
Date: Mon, 16 Jun 97 22:52:20 -0700

 So, as you probably noticed because of automatic messages:

 (1) I checked in fixes for the problems you reported, except for the
 CY_DEBUG1 one.

 (2) I closed the PR.

 (3) I re-opened the PR, since I realized that I had no clue what you
 were talking about re: the interrupt counter problem you mentioned.


 Could you try the new version of the files (cyvar.h, cy.c, and
 cy_pci.c) after the next FTP server update?  Also, could you please
 explain the CY_DEBUG1 counter problem in more detail?



 chris

From: ws@kurt.tools.de (Wolfgang Solfrank)
To: torppa@cute.fi, cgd@pa.dec.com
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.ORG
Subject: Re: kern/3753: cyclades driver is broken
Date: Tue, 17 Jun 1997 18:03:55 +0200

 > > cy driver has the following bugs/problems:
 > >  it doesnt like pci cards of type PCI_MAPREG_MEM_TYPE_32BIT_1M
 > > [ ... ]
 > > --- cy.orig/pci/cy_pci.c	Mon Jun 16 19:30:20 1997
 > > +++ cy/pci/cy_pci.c	Mon Jun 16 19:35:39 1997
 > > @@ -53,7 +53,7 @@
 > >  	    PCI_MAPREG_TYPE_IO, 0,
 > >  	    iotp, iohp, NULL, iosizep) == 0);
 > >  	memh_valid = (pci_mapreg_map(pap, 0x18,
 > > -	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
 > > +	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT | PCI_MAPREG_MEM_TYPE_32BIT_1M, 0,
 > >  	    memtp, memhp, NULL, memsizep) == 0);
 > >  
 > >  	if (ioh_valid && memh_valid)
 > 
 > That patch will cause the driver to work _only_ on the 32BIT_1M cards,
 > i.e. it _won't_ work on the ones which can map their memory higher
 > than 1MB.
 > 
 > I _think_ the right solution is to or in that bit depending on the PCI
 > device ID; could you verify that?

 Hmm, I think that since the low 4 bits of memory mapping registers are by
 definition read-only, the right solution is to fix pci_mapreg_map to accept the
 unmodified call and ignore the sense of the PCI_MAPREG_MEM_TYPE_32BIT_1M bit.
 -- 
 ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800

From: "Chris G. Demetriou" <cgd@pa.dec.com>
To: ws@kurt.tools.de (Wolfgang Solfrank)
Cc: torppa@cute.fi, cgd@pa.dec.com, gnats-bugs@gnats.netbsd.org,
        netbsd-bugs@netbsd.org
Subject: Re: kern/3753: cyclades driver is broken 
Date: Tue, 17 Jun 97 09:40:12 -0700

 >Hmm, I think that since the low 4 bits of memory mapping registers are by
 >definition read-only, the right solution is to fix pci_mapreg_map to accept the
 >unmodified call and ignore the sense of the PCI_MAPREG_MEM_TYPE_32BIT_1M bit.

 I don't think so.  The point of supplying those bits are so that the
 driver can make sure it's actually mapping the kind of region it
 thinks it's supposed to be getting.

 The driver knows (or should know, if people hacking on the driver had
 the documentation 8-) what type of region each mapping register maps.
 It's a nice sanity-check, to prevent stupid driver bogons and problems
 caused by changes to the board not otherwise recognized by the driver
 and/or PCI code.



 chris

From: ws@kurt.tools.de (Wolfgang Solfrank)
To: cgd@pa.dec.com
Cc: torppa@cute.fi, gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.ORG
Subject: Re: kern/3753: cyclades driver is broken
Date: Tue, 17 Jun 1997 19:14:21 +0200

 > I don't think so.  The point of supplying those bits are so that the
 > driver can make sure it's actually mapping the kind of region it
 > thinks it's supposed to be getting.
 > 
 > The driver knows (or should know, if people hacking on the driver had
 > the documentation 8-) what type of region each mapping register maps.
 > It's a nice sanity-check, to prevent stupid driver bogons and problems
 > caused by changes to the board not otherwise recognized by the driver
 > and/or PCI code.

 I can buy that for all the other bits in the range 0-3 (it's highly unlikely
 that a range of memory on some card is marked prefetchable, but marked
 non-prefetchable on some otherwise similar card for example), but the _1M bit
 is a different kind of cattle IMHO (as can be seen with this example).
 -- 
 ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800

From: Jarkko Torppa <torppa@cute.fi>
To: "Chris G. Demetriou" <cgd@pa.dec.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/3753: cyclades driver is broken 
Date: Thu, 03 Jul 1997 23:10:39 +0300

 Sorry this took a while, but I were having a vacation and the machine with the 
 card was moved into light production use so I'm not very free to expiriment 
 with it at the moment.

 > (2) I closed the PR.
 > 
 > (3) I re-opened the PR, since I realized that I had no clue what you
 > were talking about re: the interrupt counter problem you mentioned.

 The version running under 1.2D missed lot of irq's rates for stray7 and 
 stray15 were nearly as much as the rate for it's irq. So far 1.2G kernel of 17 
 Jun has logged only 1 stray7, the usage is much lighter than normal as our 
 leasedline to outsideworld is broken at the moment.

 > Could you try the new version of the files (cyvar.h, cy.c, and
 > cy_pci.c) after the next FTP server update?  Also, could you please
 > explain the CY_DEBUG1 counter problem in more detail?

 Seems to function at least as well as 1.2D kernel I were running before.

 I think that there is no problem with CY_DEBUG1, sometimes the interrupt rate 
 just is high (at least 2000+ but it might as well have been 20k+), the driver 
 propably missed irq's and the card kept re-posting them. The machine is 133Mhz 
 Pentium.


 -- 
  Jarkko.Torppa@cute.fi     +358-9-34871220         Cute Communications Oy


State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Fri Jul 4 22:32:42 PDT 1997 
State-Changed-Why:  
OK, now that the CY_DEBUG1 issue has been clarified, close this. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.