Date: 2 Nov 1997 10:15:08 GMT From: nnd@itfs.nsk.su To: hackers@freebsd.org Subject: Re: Cyclades :( Message-ID: <63hjrc$on2@news.itfs.nsk.su> References: <199711011653.IAA03064@implode.root.com>
next in thread | previous in thread | raw e-mail | index | archive | help
David Greenman <dg@root.com> wrote: > > Driver's text inspection shows that there is ONLY ONE > >significant difference with 'standard FreeBSD's' cy-driver: > >(this is a 'diff -bu' result for /sys/i386/isa/cy.c version > >1.55 of 1997/09/21) > > > >--- cy.c.ORIG Sat Nov 1 13:33:19 1997 > >+++ cy.c Sat Nov 1 13:36:55 1997 > >@@ -410,7 +404,7 @@ > > #endif > > > > static int cy_chip_offset[] = { > >- 0x0000, 0x0200, 0x0400, 0x0600, 0x0100, 0x0300, 0x0500, 0x0700, > >+ 0x0000, 0x0400, 0x0800, 0x0c00, 0x0200, 0x0600, 0x0a00, 0x0e00 > > }; > > static int cy_nr_cd1400s[NCY]; > > static int cy_total_devices; > > > > > > Can someone with Cyclom-8/16YeP (and problems ;-) > >test this patch ? I myself can not test it because my only ONE > >Cyclom-16YeP now busily serves 12 modems on Linux box. > > > > Partial "correctnes proof" for this patch can be found > >in (working) Linux 'cy' (or 'cz') driver which uses the same > >chip_offset addresses as in "patched" driver, but not as in > >original FreeBSD's 'cy' driver. > If you look at the cy_inb/cy_outb functions in cyreg.h, you'll see that > the offset is adjusted (shifted left by one bit) for the PCI card, making > the appropriate adjustment. The above change (which has the left shift built > in to the numbers) would effectively double this shift. What I'm saying is > that unless I'm really missing something, the patch can't be correct. Yes I know that this 'cy_chip_offset' values are shifted left by one bit for PCI (and for 0 bits for ISA) and therefore can not explain how can FreeBSD's version of driver works at all ;-) Even with the fact that most inb/outbs are in fact cd_inb/cd_outb with following definitions: #define cd_inb(iobase, reg, cy_align) (*((iobase) + ((reg)*2 << (cy_align)))) #define cy_inb(iobase, reg) (*((iobase) + (reg))) #define cd_outb(iobase, reg, cy_align, val) ((void)(*((iobase) + ((reg)*2 << (cy_align))) = (val))) #define cy_outb(iobase, reg, val) ((void)(*((iobase) + (reg)) = (val))) Here are the parts of working (just now in one of my PCs) Linux driver: .... static char rcsid[] = "$Revision: 1.36.4.33 $$Date: 1997/06/27 19:00:00 $"; /* * linux/drivers/char/cyclades.c * * This file contains the driver for the Cyclades Cyclom-Y multiport * serial boards. * * Maintained by Marcio Saito (marcio@cyclades.com) and * Randolph Bentson (bentson@grieg.seaslug.org) * * For Technical support and installation problems, please send e-mail * to support@cyclades.com. * * Much of the design and some of the code came from serial.c * which was copyright (C) 1991, 1992 Linus Torvalds. It was * extensively rewritten by Theodore Ts'o, 8/16/92 -- 9/14/92, * and then fixed as suggested by Michael K. Johnson 12/12/92. ...... /* The Cyclom-Ye has placed the sequential chips in non-sequential * address order. This look-up table overcomes that problem. */ static int cy_chip_offset [] = { 0x0000, 0x0400, 0x0800, 0x0C00, 0x0200, 0x0600, 0x0A00, 0x0E00 }; ..... card_base_addr = (unsigned char *)cinfo->base_addr; index = cinfo->bus_index; /* This loop checks all chips in the card. Make a note whenever _any_ chip had some work to do, as this is considered an indication that there will be more to do. Only when no chip has any work does this outermost loop exit. */ do{ had_work = 0; for ( chip = 0 ; chip < cinfo->num_chips ; chip ++) { base_addr = (unsigned char *) (cinfo->base_addr + (cy_chip_offset[chip]<<index)); too_many = 0; while ( (status = base_addr[CySVRR<<index]) != 0x00) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?63hjrc$on2>