From alter@el.ntu-kpi.kiev.ua  Tue Oct 15 10:04:06 2002
Return-Path: <alter@el.ntu-kpi.kiev.ua>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E227037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Oct 2002 10:04:06 -0700 (PDT)
Received: from relay1.ntu-kpi.kiev.ua (www.ntu-kpi.kiev.ua [212.111.192.161])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5110243E88
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Oct 2002 10:04:05 -0700 (PDT)
	(envelope-from alter@el.ntu-kpi.kiev.ua)
Received: from doppelganger.el.ntu-kpi.kiev.ua (doppelganger.el.ntu-kpi.kiev.ua [10.2.16.2])
	by relay1.ntu-kpi.kiev.ua (Postfix) with ESMTP id 7742D19BD4
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Oct 2002 20:04:01 +0300 (EEST)
Received: by doppelganger.el.ntu-kpi.kiev.ua (Postfix, from userid 1023)
	id 144281B6F; Tue, 15 Oct 2002 20:04:01 +0300 (EEST)
Message-Id: <20021015170401.144281B6F@doppelganger.el.ntu-kpi.kiev.ua>
Date: Tue, 15 Oct 2002 20:04:01 +0300 (EEST)
From: Alex Telyatnikov <alter@el.ntu-kpi.kiev.ua>
Reply-To: Alex Telyatnikov <alter@el.ntu-kpi.kiev.ua>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: RealTec-based NIC initialization problem
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         44098
>Category:       kern
>Synopsis:       RealTec-based NIC initialization problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 15 10:10:01 PDT 2002
>Closed-Date:    Sat Jan 27 18:57:23 GMT 2007
>Last-Modified:  Sat Jan 27 18:57:23 GMT 2007
>Originator:     Alex Telyatnikov
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
no
>Environment:
System: FreeBSD ep.kiev.ua 4.7-STABLE FreeBSD 4.7-STABLE #4: Tue Oct 15 19:26:37 EEST 2002 root@ep.kiev.ua:/usr/src47/sys/EP_4_7_v1 i386


	
    CPU: Athlon 1GHz
    MB:  AOpen MK73LE-V

    OS: FreeBSD 4.7-STABLE
>Description:
    Kernel failed to initialize the following NIC
        Genius III
	K023B016 REV:A
	Chip type RTL8139C, 14155S1, 116B
    with
        "rl0: unknown device ID: 0"
    error message.

    PCI Info: Vendor/Device ID 10EC/8129
    Driver checks Device ID read from NIC's EPROM.
    My card returns zeros when reading EPROM.
    It also has internal PHY interface (like 8139)

>How-To-Repeat:

>Fix:

*** /usr/src/sys/pci/if_rl.c	Tue Oct 15 17:16:59 2002
--- /usr/src/sys/pci/if_rl.c	Tue Oct 15 19:14:05 2002
***************
*** 799,804 ****
--- 799,805 ----
  	struct ifnet		*ifp;
  	u_int16_t		rl_did = 0;
  	int			unit, error = 0, rid;
+ 	int			r = 0;
  
  	s = splimp();
  
***************
*** 915,920 ****
--- 916,922 ----
  	 */
  	rl_read_eeprom(sc, (caddr_t)&rl_did, RL_EE_PCI_DID, 1, 0);
   
+ retry_from_pci:
  	if (rl_did == RT_DEVICEID_8139 || rl_did == ACCTON_DEVICEID_5030 ||
  	    rl_did == DELTA_DEVICEID_8139 || rl_did == ADDTRON_DEVICEID_8139 ||
  	    rl_did == DLINK_DEVICEID_530TXPLUS)
***************
*** 923,928 ****
--- 925,937 ----
  	else if (rl_did == RT_DEVICEID_8129)
  		sc->rl_type = RL_8129;
  	else {
+ 		printf("rl%d: unknown device ID from EPROM, retry: %x\n", unit, rl_did);
+ 		if(r==0) {
+ 		        rl_did = pci_get_device(dev);
+ 			r = 1;
+ 			printf("rl%d: PCI device ID: %x\n", unit, rl_did);
+ 			goto retry_from_pci;
+ 		}
  		printf("rl%d: unknown device ID: %x\n", unit, rl_did);
  		bus_teardown_intr(dev, sc->rl_irq, sc->rl_intrhand);
  		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq);
***************
*** 946,955 ****
--- 955,973 ----
  	/* Leave a few bytes before the start of the RX ring buffer. */
  	sc->rl_cdata.rl_rx_buf_ptr = sc->rl_cdata.rl_rx_buf;
  	sc->rl_cdata.rl_rx_buf += sizeof(u_int64_t);
+ 	
+ retry_iface_type:
  
  	/* Do MII setup */
  	if (mii_phy_probe(dev, &sc->rl_miibus,
  	    rl_ifmedia_upd, rl_ifmedia_sts)) {
+ 	    	if(r == 1) {
+ 		    sc->rl_type = (sc->rl_type == RL_8139) ?
+ 		        RL_8129 : RL_8139;
+ 		    r = 2;
+ 		    printf("rl%d: MII without phy (bad EPROM), retry\n", sc->rl_unit);
+ 		    goto retry_iface_type;
+ 	    	}
  		printf("rl%d: MII without any phy!\n", sc->rl_unit);
  		bus_teardown_intr(dev, sc->rl_irq, sc->rl_intrhand);
  		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq);


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Fri Dec 29 19:53:32 UTC 2006 
State-Changed-Why:  
I had several systems with multiple rl cards in the past (up to 5 cards 
in one machine) all without problems, i suspect this is solved, can you 
confirm please? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44098 
Responsible-Changed-From-To: freebsd-bugs->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Fri Dec 29 19:53:43 UTC 2006 
Responsible-Changed-Why:  
grab the ticket. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44098 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Sat Jan 27 18:57:21 UTC 2007 
State-Changed-Why:  
feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44098 
>Unformatted:
