[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dc and multiple cards [patch]
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: dc and multiple cards [patch]
- From: Henning Brauer <lists-openbsdtech_(_at_)_bsws_(_dot_)_de>
- Date: Wed, 6 Jun 2001 19:41:54 +0200
- Mail-followup-to: tech_(_at_)_openbsd_(_dot_)_org
Hi,
the dc driver is broken in 2.9. Whenever there is more than one card
containing an i21143 installed you'll find yourself on ddb>.
The problem lives in dc.c's dc_parse_21143_srom():
for (i = 0; i < lhdr->dc_mcnt; i++) {
hdr = (struct dc_eblock_hdr *)ptr;
switch(hdr->dc_type) {
case DC_EBLOCK_MII:
dc_decode_leaf_mii(sc, (struct dc_eblock_mii *)hdr);
break;
case DC_EBLOCK_SIA:
dc_decode_leaf_sia(sc, (struct dc_eblock_sia *)hdr);
break;
case DC_EBLOCK_SYM:
dc_decode_leaf_sym(sc, (struct dc_eblock_sym *)hdr);
break;
default:
/* Don't care. Yet. */
break;
}
ptr += (hdr->dc_len & 0x7F);
ptr++;
}
On the first card, the for loop is runs about 70 times and finishes then.
everything fine. on the second card there is an (for me) obscure access
violation (sorry, forgot to save the trace...) after about 20 loops.
I solved this problem by reintroducing the code used instead of
dc_parse_21143_srom in OPENBSD_2_8, see patch below.
There is another problem which seems to be totally unrelated: all 4
interfaces on an 4 port card are detected with the same MAC:
dc0 at pci2 dev 0 function 0 "DEC DECchip 21142/3" rev 0x41: irq 10 address 00:00:cb:26:11:bc
icsphy0 at dc0 phy 5: ICS1892 10/100 media interface, rev. 0
dc1 at pci2 dev 4 function 0 "DEC DECchip 21142/3" rev 0x41: irq 10 address 00:00:cb:26:11:bc
icsphy1 at dc1 phy 5: ICS1892 10/100 media interface, rev. 0
dc2 at pci2 dev 8 function 0 "DEC DECchip 21142/3" rev 0x41: irq 10 address 00:00:cb:26:11:bc
icsphy2 at dc2 phy 5: ICS1892 10/100 media interface, rev. 0
dc3 at pci2 dev 12 function 0 "DEC DECchip 21142/3" rev 0x41: irq 10 address 00:00:cb:26:11:bc
icsphy3 at dc3 phy 5: ICS1892 10/100 media interface, rev. 0
ppb2 at pci0 dev 9 function 0 "DEC DECchip 21152 PCI-PCI" rev 0x03
pci3 at ppb2 bus 3
dc4 at pci3 dev 0 function 0 "DEC DECchip 21142/3" rev 0x41: irq 11 address 00:00:cb:26:11:cc
icsphy4 at dc4 phy 5: ICS1892 10/100 media interface, rev. 0
dc5 at pci3 dev 4 function 0 "DEC DECchip 21142/3" rev 0x41: irq 11 address 00:00:cb:26:11:cc
icsphy5 at dc5 phy 5: ICS1892 10/100 media interface, rev. 0
dc6 at pci3 dev 8 function 0 "DEC DECchip 21142/3" rev 0x41: irq 11 address 00:00:cb:26:11:cc
icsphy6 at dc6 phy 5: ICS1892 10/100 media interface, rev. 0
dc7 at pci3 dev 12 function 0 "DEC DECchip 21142/3" rev 0x41: irq 11 address 00:00:cb:26:11:cc
icsphy7 at dc7 phy 5: ICS1892 10/100 media interface, rev. 0
I've thrown 6 1-port cards in to verify that this is not related to IRQ
sharing.
Interestingly enough, the de driver does detect the MACs all right. But as
we know its performance on 21143 chips is, eh, poor. I don't have an idea
where to look for a fix - I'd appreciate any hint.
btw, the right MACs are :bc, :bd, :be, :bf for the first card and :cc, :cd,
:ce and :cf for the second.
Greetings
Henning
--- if_dc_pci.c.orig Wed Jun 6 17:42:04 2001
+++ if_dc_pci.c Wed Jun 6 18:00:24 2001
@@ -429,9 +429,32 @@
* The tricky ones are the Macronix/PNIC II and the
* Intel 21143.
*/
- if (DC_IS_INTEL(sc))
- dc_parse_21143_srom(sc);
- else if (DC_IS_MACRONIX(sc) || DC_IS_PNICII(sc)) {
+ if (DC_IS_INTEL(sc)) {
+ u_int32_t media, cwuc;
+ cwuc = pci_conf_read(pc, pa->pa_tag, DC_PCI_CWUC);
+ cwuc |= DC_CWUC_FORCE_WUL;
+ pci_conf_write(pc, pa->pa_tag, DC_PCI_CWUC, cwuc);
+ DELAY(10000);
+ media = pci_conf_read(pc, pa->pa_tag, DC_PCI_CWUC);
+ cwuc &= ~DC_CWUC_FORCE_WUL;
+ pci_conf_write(pc, pa->pa_tag, DC_PCI_CWUC, cwuc);
+ DELAY(10000);
+ if (media & DC_CWUC_MII_ABILITY)
+ sc->dc_pmode = DC_PMODE_MII;
+ if (media & DC_CWUC_SYM_ABILITY) {
+ sc->dc_pmode = DC_PMODE_SYM;
+ sc->dc_flags |= DC_21143_NWAY;
+ }
+ /*
+ * If none of the bits are set, then this NIC
+ * isn't meant to support 'wake up LAN' mode.
+ * This is usually only the case on multiport
+ * cards, and these cards almost always have
+ * MII transceivers.
+ */
+ if (media == 0)
+ sc->dc_pmode = DC_PMODE_MII;
+ } else if (DC_IS_MACRONIX(sc) || DC_IS_PNICII(sc)) {
if (sc->dc_type == DC_TYPE_98713)
sc->dc_pmode = DC_PMODE_MII;
else
--
* Henning Brauer, hostmaster_(_at_)_bsws_(_dot_)_de, http://www.bsws.de *
* Roedingsmarkt 14, 20459 Hamburg, Germany *
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)
Visit your host, monkey.org