tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ep driver
Hi.
On 2021/06/27 20:49, Rin Okuyama wrote:
> Hi,
>
> On 2021/06/27 19:44, T wrote:
>> Hi,
>> I have recently upgraded a NetBSD/prep machine from 8.1 to 9.2 and the ep
>> NIC no longer seems to work after the upgrade, it worked in previous 7
>> and 8 versions. The NIC is a 3Com 3c515-TX (ISA 10/100). Here are a few
>> dmesg segments from different kernel versions for this card:
>>
>> For 7.1.1_PATCH:
>> isapnp0: read port 0x203
>> ep0 at isapnp0 port 0x280/32 irq 5 drq 3
>> ep0: 3Com Fast EtherLink ISA
>> ep0: address xx:xx:xx:xx:xx:xx, 64KB word-wide FIFO, 1:1 Rx:Tx split
>> ukphy1 at ep0 phy 24: OUI 0x1000e8, model 0x0000, rev. 1
>> ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
>> vmmask 73000000 schedmask 73000000 highmask 7f000000
>>
>>
>> For 8.1:
>> isapnp0: read port 0x203
>> ...
>> ep0 at isapnp0 port 0x280/32 irq 11 drq 3
>> 3Com Fast EtherLink ISA
>> ep0: address xx:xx:xx:xx:xx:xx, 64KB word-wide FIFO, 1:1 Rx:Tx split
>> nsphy0 at ep0 phy 24: DP83840 10/100 media interface, rev. 1
>> nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
>> vmmask 71400000 schedmask 71c00000 highmask 7fc00000
>>
>>
>> For 9.2:
>>
>> [ 1.000000] isapnp0: read port 0x203
>> [ 1.000000] ep0 at isapnp0 port 0x280/32 irq 5 drq 3
>> [ 1.000000] 3Com Fast EtherLink ISA
>> [ 1.000000] ep0: autoconfiguration error: wrote 0x7ff to
>> TX_AVAIL_THRESH, read back 0x0. Interface disabled
>> [ 1.000000] vmmask 73000000 schedmask 73000000 highmask 7f000000
>>
>> The error message originates from line 382 in this file:
>> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/elink3.c?
>> annotate=1.152&only_with_tag=MAIN
>>
>> and figure something happened between these two revisions:
>> --- src/sys/dev/ic/elink3.c 2018/07/26 23:55:29 1.140.8.1
>> netbsd-8-1-RELEASE
>> +++ src/sys/dev/ic/elink3.c 2019/05/29 06:17:28 1.149 netbsd-9-2-
>> RELEASE
>>
>> Does anyone have any idea what's going on here?
>>
>
> A variant of ep(4) for PCMCIA works just fine for amiga:
>
> ---
> NetBSD 9.99.85 (A1200_WSCONS) #14: Wed Jun 16 07:44:49 JST 2021
> rin@latipes:/sys/arch/amiga/compile/A1200_WSCONS
> ...
> pcmcia0 at pccard0
> ep0 at pcmcia0 function 0: <3Com, Megahertz 589E, TP/BNC LAN PC Card, 005>
> ep0: address 00:50:04:cc:ee:7e, 8KB byte-wide FIFO, 5:3 Rx:Tx split
> ep0: 10baseT, 10base5, 10base2 (default 10baseT)
> ---
>
> This model does not have MII, and it seems that differences b/w
> netbsd-8 and -9 are mostly in MII part.
>
> Saitoh-san, do you have any idea?
>
> Thanks,
> rin
isapnp/if_ep_isapnp.c
both 8.1 and 9.2 have rev. 1.35
ic/elink3reg.h
both 8.1 and 9.2 have rev. 1.31
ic/elink3var.h
both 8.1 and 9.2 have rev. 1.39
In isapnp/if_ep_isapnp.c:
-------------------------------------------
void
ep_isapnp_attach(device_t parent, device_t self, void *aux)
{
struct ep_softc *sc = device_private(self);
struct isapnp_attach_args *ipa = aux;
int chipset;
aprint_naive("\n");
aprint_normal("\n");
sc->sc_dev = self;
if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) {
aprint_error_dev(sc->sc_dev, "error in region allocation\n");
return;
}
aprint_normal("%s %s\n", ipa->ipa_devident, ipa->ipa_devclass);
sc->sc_iot = ipa->ipa_iot;
sc->sc_ioh = ipa->ipa_io[0].h;
sc->bustype = ELINK_BUS_ISA;
sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num,
ipa->ipa_irq[0].type, IPL_NET, epintr, sc);
sc->enable = NULL;
sc->disable = NULL;
sc->enabled = 1;
if (strcmp(ipa->ipa_devlogic, "TCM5051") == 0) {
/* 3c515 */
chipset = ELINK_CHIPSET_CORKSCREW;
} else {
/* 3c509 */
chipset = ELINK_CHIPSET_3C509;
}
epconfig(sc, chipset, NULL);
}
-------------------------------------------
Nothing special.
epconfig() in elink3.c is:
-------------------------------------------
/*
* Back-end attach and configure.
*/
int
epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr)
{
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
struct mii_data *mii = &sc->sc_mii;
u_int16_t i;
u_int8_t myla[ETHER_ADDR_LEN];
callout_init(&sc->sc_mii_callout, 0);
callout_setfunc(&sc->sc_mii_callout, ep_tick, sc);
callout_init(&sc->sc_mbuf_callout, 0);
callout_setfunc(&sc->sc_mbuf_callout, epmbuffill, sc);
sc->ep_chipset = chipset;
/*
* We could have been groveling around in other register
* windows in the front-end; make sure we're in window 0
* to read the EEPROM.
*/
GO_WINDOW(0);
if (enaddr == NULL) {
/*
* Read the station address from the eeprom.
*/
for (i = 0; i < ETHER_ADDR_LEN / 2; i++) {
u_int16_t x = ep_read_eeprom(sc, i);
myla[(i << 1)] = x >> 8;
myla[(i << 1) + 1] = x;
}
enaddr = myla;
}
/*
* Vortex-based (3c59x pci,eisa) and Boomerang (3c900) cards
* allow FDDI-sized (4500) byte packets. Commands only take an
* 11-bit parameter, and 11 bits isn't enough to hold a full-size
* packet length.
* Commands to these cards implicitly upshift a packet size
* or threshold by 2 bits.
* To detect cards with large-packet support, we probe by setting
* the transmit threshold register, then change windows and
* read back the threshold register directly, and see if the
* threshold value was shifted or not.
*/
bus_space_write_2(iot, ioh, ELINK_COMMAND,
SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE);
GO_WINDOW(5);
i = bus_space_read_2(iot, ioh, ELINK_W5_TX_AVAIL_THRESH);
GO_WINDOW(1);
switch (i) {
case ELINK_LARGEWIN_PROBE:
case (ELINK_LARGEWIN_PROBE & ELINK_LARGEWIN_MASK):
sc->ep_pktlenshift = 0;
break;
case (ELINK_LARGEWIN_PROBE << 2):
sc->ep_pktlenshift = 2;
break;
default:
aprint_error_dev(sc->sc_dev,
"wrote 0x%x to TX_AVAIL_THRESH, read back 0x%x. "
"Interface disabled\n",
ELINK_LARGEWIN_PROBE, (int) i);
return (1);
}
-------------------------------------------
0) GO_WINDOW(0)
1) read mac address
2) write ELINK_COMMAND
3) GO_WINDOW(5)
4) read ELINK_W5_TX_AVAIL_THRESH (***)
5) GO_WINDOW(1)
and a read value of ELINK_W5_TX_AVAIL_THRESH in "4)" was incorrect.
Has the bus_space_read*() problem in isapnp(4)?
I think it would worth to see if the read value
of the MAC address correct. Could you try it?
--
-----------------------------------------------
SAITOH Masanobu (msaitoh%execsw.org@localhost
msaitoh%netbsd.org@localhost)
Home |
Main Index |
Thread Index |
Old Index