NetBSD Problem Report #31134

From www@netbsd.org  Sun Sep  4 07:53:21 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 0326F63B874; Sat,  3 Sep 2005 22:08:24 +0000 (UTC)
Message-Id: <20050903220824.0326F63B874@narn.netbsd.org>
Date: Sat,  3 Sep 2005 22:08:24 +0000 (UTC)
From: streamer@cytrynka.infoland.int.pl
Reply-To: streamer@cytrynka.infoland.int.pl
To: gnats-bugs@netbsd.org
Subject: ep driver unusable 
X-Send-Pr-Version: www-1.0

>Number:         31134
>Category:       port-amiga
>Synopsis:       ep driver unusable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-amiga-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 04 07:54:01 +0000 2005
>Closed-Date:    Sun Mar 08 14:52:22 +0000 2020
>Last-Modified:  Sun Mar 08 14:52:22 +0000 2020
>Originator:     Radek Kujawa
>Release:        2.0
>Organization:
>Environment:
NetBSD a1200 2.0 NetBSD 2.0 (GENERIC) #0: Tue Nov 30 22:37:50 UTC 2004  builds@build:/big/builds/ab/netbsd-2-0-RELEASE/amiga/200411300000Z-obj/big/builds/ab/netbsd-2-0-RELEASE/src/sys/arch/amiga/compile/GENERIC amiga
>Description:
If you try to use ep-based PCMCIA ethernet card on NetBSD/amiga you'll get: 

ep0 at pcmcia0 function 0: 3Com 3c589 10Mbps Ethernet
ep0: wrote 0x7ff to TX_AVAIL_THRESH, read back 0x0. Interface disabled
ep0: couldn't configure controller

Removing and reinserting card does nothing. Interface is not listed by ifconfig -a. 
>How-To-Repeat:
Reboot. Insert card into PCMCIA slot. 
>Fix:

>Release-Note:

>Audit-Trail:
From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: martin@fripost.org, is@NetBSD.org
Subject: Re: port-amiga/31134 ep driver unusable
Date: Tue, 3 Mar 2020 12:33:42 +0900

 Fix proposed to port-amiga@:

      http://mail-index.netbsd.org/port-amiga/2020/02/18/msg008092.html

 See thread started from this message.

 -------- Forwarded Message --------
 Subject: 3c589 PCMCIA on A1200 - possible resolution to PR port-amiga/31134
 Date: Tue, 18 Feb 2020 22:46:38 +0100
 From: Martin Åberg <martin@fripost.org>
 To: port-amiga@netbsd.org

 Hello,

 I have made an effort to get the 3Com 3C589 EtherLink III PCMCIA
 Ethernet card going in NetBSD 9.0 on Amiga A1200.

 The results look promising. However, since I don't have access to other
 PCMCIA cards, one concern is that the patch could break support for
 other PCMCIA cards with 8-bit and 16-bit I/O.

 Below is some background, an example and the patch.

 ----
 The NetBSD Amiga PCMCIA bus driver, gayle_pcmcia.c, appears to be
 working well with 8-bit PCMCIA I/O accesses but not 16-bit I/O accesses.
 This
 patch enables support for 16-bit I/O accesses which allows for use of
 the 3Com
 3C589 EtherLink III Ethernet controller.


 Summary:
 Mapping of motherboard (CPU) bus accesses to the PCMCIA bus is handled
 by the
 Gayle chip. The chip and how it interfaces with the Amiga computer is
 not very
 well docuemented.

 For 8-bit PCMCIA I/O accesses, PCMCIA address line A0 is controlled by
 CPU A16
 and is handled correctly by the current gayle_pcmcia.c.

 For 16-bit PCMCIA I/O accesses, no address translation is needed on the CPU
 side. However, the word data (16-bit) bus between the CPU bus and the PCMCIA
 bus is byte swapped. This patch accounts for the byte-swapping in software.


 How it was tested:
 The patch has been tested with NetBSD 9.0 on an Amiga A1200 and the 3Com
 3C689
 PCMCIA card. Two different processor boards were been used: Blizzard 1230 IV
 and Blizzard 1260.

 NetBSD 9.0 kernel boot message without this patch (same as reported in
 the 2005
 problem report):
    [   1.0000050] pccard0 at mainbus0
    [   1.0000050] pcmcia0 at pccard0
    [   1.0000050] ep0 at pcmcia0 function 0: <3Com Corporation, 3C589D,
 TP/BNC LAN Card Ver. 2a, 000002>
    [   1.0000050] ep0: wrote 0x7ff to TX_AVAIL_THRESH, read back 0x0.
 Interface disabled
    [   1.0000050] ep0: couldn't configure controller

 NetBSD 9.0 kernel boot message with this patch:
    [   1.0000050] pccard0 at mainbus0
    [   1.0000050] pcmcia0 at pccard0
    [   1.0000050] ep0 at pcmcia0 function 0: <3Com Corporation, 3C589D,
 TP/BNC LAN Card Ver. 2a, 000002>
    [   1.0000050] ep0: address 00:60:08:22:32:e4, 8KB byte-wide FIFO,
 5:3 Rx:Tx split
    [   1.0000050] ep0: 10baseT, 10base5, 10base2 (default 10baseT)


 Example use:
    # ifconfig ep0
    ep0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            address: 00:60:08:22:32:e4
            media: Ethernet 10baseT
            inet 192.168.1.2/24 broadcast 192.168.1.255 flags 0x0
            inet6 fe80::260:8ff:fe22:32e4%ep0/64 flags 0x0 scopeid 0x1
    # ping 192.168.1.1
    PING cl (192.168.1.1): 56 data bytes
    64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=5.315917 ms
    64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=7.304981 ms
    64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=7.319078 ms
    64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=7.288065 ms

    ----cl PING Statistics----
    4 packets transmitted, 4 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 5.315917/6.807010/7.319078/0.994143 ms


 Others:
 - Unplugging the card and inserting it again works.
 - Not tested with other PCMCIA cards.
 - Closes PR port-amiga/31134


 Patch:
 (Yes, it changes only a single source code line.)

 $ git diff origin/netbsd-9
 diff --git a/sys/arch/amiga/dev/gayle_pcmcia.c
 b/sys/arch/amiga/dev/gayle_pcmcia.c
 index ea3a131b98ff..8bc49f61fd55 100644
 --- a/sys/arch/amiga/dev/gayle_pcmcia.c
 +++ b/sys/arch/amiga/dev/gayle_pcmcia.c
 @@ -131,7 +131,7 @@ pccard_attach(device_t parent, device_t self, void *aux)
          pmap_update(vm_map_pmap(kernel_map));

          /* override the one-byte access methods for I/O space */
 -       pcmio_bs_methods = amiga_bus_stride_1;
 +       pcmio_bs_methods = amiga_bus_stride_1swap;
          pcmio_bs_methods.bsr1 = pcmio_bsr1;
          pcmio_bs_methods.bsw1 = pcmio_bsw1;
          pcmio_bs_methods.bsrm1 = pcmio_bsrm1;

 ----

 /Martin

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: martin@fripost.org, is@NetBSD.org
Subject: Re: port-amiga/31134 ep driver unusable
Date: Tue, 3 Mar 2020 12:36:15 +0900

 -------- Forwarded Message --------
 Subject: CVS commit: src/sys/arch/amiga/dev
 Date: Mon, 2 Mar 2020 19:48:23 +0000
 From: Ignatios Souvatzis <is@netbsd.org>
 Reply-To: source-changes-d@NetBSD.org
 To: source-changes-full@NetBSD.org

 Module Name:	src
 Committed By:	is
 Date:		Mon Mar  2 19:48:23 UTC 2020

 Modified Files:
 	src/sys/arch/amiga/dev: gayle_pcmcia.c

 Log Message:
 The Gayle interface uses swapped (little-endian) word accesses, so we
 need to use the amiga_bus_stride_1swap methods for the word accesses.

 Analyzed and submitted via port-amiga@ by Martin Åberg.

 Tested on formerly working hardware

 - by Jukka Andberg	with Dlink DE-660+		(ne)
 - by Frank Wille	with D-Link DFE-670TXD		(ne)

 Tested on formerly not working hardware:

 - by Martin		with 3Com 3c589 Etherling III	(ep)
 - by Martin and Frank	with CompactFlash cards		(wdc)


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amiga/dev/gayle_pcmcia.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: martin@fripost.org, is@NetBSD.org
Subject: Re: port-amiga/31134 ep driver unusable
Date: Tue, 3 Mar 2020 12:42:10 +0900

 -------- Forwarded Message --------
 Subject: CVS commit: src/doc
 Date: Mon, 2 Mar 2020 20:04:42 +0000
 From: Ignatios Souvatzis <is@netbsd.org>
 Reply-To: source-changes-d@NetBSD.org
 To: source-changes-full@NetBSD.org

 Module Name:	src
 Committed By:	is
 Date:		Mon Mar  2 20:04:42 UTC 2020

 Modified Files:
 	src/doc: CHANGES

 Log Message:
 Fix word accesses on Gayle (Amiga1200) pcmcia. Patch by Martin Åberg.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2654 -r1.2655 src/doc/CHANGES

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: rin@NetBSD.org
State-Changed-When: Tue, 03 Mar 2020 03:49:12 +0000
State-Changed-Why:
Fixed in -HEAD. Martin, thank you very much for your great work!

It is nice to be pulled up into netbsd-9, where Martin originally worked.


State-Changed-From-To: needs-pullups->closed
State-Changed-By: is@NetBSD.org
State-Changed-When: Sun, 08 Mar 2020 14:52:22 +0000
State-Changed-Why:
Pullups requested and added to netbsd-7, netbsd-8 and netbsd-9


>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.