From proff@suburbia.net  Fri Nov 29 17:26:41 1996
Received: from suburbia.net (suburbia.net [198.142.2.24])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA16841
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Nov 1996 17:26:38 -0800 (PST)
Received: (from proff@localhost)
          by suburbia.net (8.8.3/8.8.2) id MAA04272;
          Sat, 30 Nov 1996 12:26:28 +1100 (EST)
Message-Id: <199611300126.MAA04272@suburbia.net>
Date: Sat, 30 Nov 1996 12:26:28 +1100 (EST)
From: Julian Assange <proff@suburbia.net>
Reply-To: proff@suburbia.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: <Synopsis of the problem (one line)>cy.c cyclades driver does not detect DCD drop on cuac* (mgetty)
X-Send-Pr-Version: 3.2

>Number:         2127
>Category:       kern
>Synopsis:       cy.c cyclades driver does not detect DCD drop on cuac* (mgetty)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 29 17:30:01 PST 1996
>Closed-Date:    Thu Dec 5 04:43:43 PST 1996
>Last-Modified:  Thu Dec  5 04:44:39 PST 1996
>Originator:     Julian Assange
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	

Cyclades 16Ye PCI

>Description:

	

The cy.c driver does not detect DCD drop when using callout devices.
This is a problem for outgoing ppp connections and for mgetty, which
listens for modem RING's on cuac* rather than listening for a carrier
on ttyc*. It is also possible that DCD drops are not followed on ttyc*
(haven't tested). The problem is definately with the cy.c driver as an
otherwise identical configuration works without problem with
16550A ports and sio.c.

>How-To-Repeat:

	at&c1 (follow remote carrier)
	open line via /dev/cuac*
	make remote connection
	hang up remote modem.

	

>Fix:
	
	

I am unfamiliar with cy.c, but a few potential problems noted are (the unified diff marks are against sio.c):

-static void
-cd1400_channel_cmd(iobase, cmd, cy_align)
-       cy_addr iobase;
-       int     cmd;
-       int     cy_align;
-{
-       /* XXX hsu@clinet.fi: This is always more dependent on ISA bus speed,
-          as the card is probed every round?  Replaced delaycount with 8k.
-          Either delaycount has to be implemented in FreeBSD or more sensible
-          way of doing these should be implemented.  DELAY isn't enough here.
-          */
-       u_int   maxwait = 5 * 8 * 1024; /* approx. 5 ms */
+

-       /* wait for processing of previous command to complete */
-       while (cd_inb(iobase, CD1400_CCR, cy_align) && maxwait--)
-               ;
+

Timing is going to be considerably different on PCI vs ISA - however,
however if anything the delay/retry should be over forgiving in its
new (PCI) enviroment rather than the other way around.

In several places, sio.c has had variations on the following code
added:

+       if (com->gone)
+               return(0);
 
But com->gone is used to indicate a uart that has disappeared,
rather than a DCD drop.

There does not seem to be any great differences in the DCD or HUPCL code
between sio.c and cy.c, although there is lots for RTS/CTS. Perhaps there
is some interplay here I am not seeing.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: fenner 
Responsible-Changed-When: Sun Dec 1 22:31:17 PST 1996 
Responsible-Changed-Why:  
Submitter did not intend for PR to be confidential. 
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Thu Dec 5 04:43:43 PST 1996 
State-Changed-Why:  
Fixed in rev.1.43 of cy.c. 
>Unformatted:
